blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
378
8.64k
id
stringlengths
44
44
length_bytes
int64
505
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.88k
prompted_full_text
stringlengths
565
12.5k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
5.05k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
snapshot_total_rows
int64
75.8k
75.8k
solution
stringlengths
242
8.3k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
9f9067b257de725c65c8a90d7dd0e34cc41bec04
[ "self.max = max\nself.num = 0\nself.condition = threading.Condition()", "with self.condition:\n while num + self.num > self.max:\n print('进货失败,请等待,进货数量%d,当前库存%d' % (num, self.num))\n self.condition.wait()\n self.num += num\n print('进货成功,进货数量%d, 当前库存%d' % (num, self.num))\n self.condition...
<|body_start_0|> self.max = max self.num = 0 self.condition = threading.Condition() <|end_body_0|> <|body_start_1|> with self.condition: while num + self.num > self.max: print('进货失败,请等待,进货数量%d,当前库存%d' % (num, self.num)) self.condition.wait() ...
Shop
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Shop: def __init__(self, max): """初始化 :param max: 最大库存 :param num: 当前库存""" <|body_0|> def stock(self, num): """进货 :param num: 进货数量 :return:""" <|body_1|> def sell(self, num): """售货 :param num: 售货数量 :return:""" <|body_2|> <|end_skeleton|>...
stack_v2_sparse_classes_75kplus_train_005500
2,308
no_license
[ { "docstring": "初始化 :param max: 最大库存 :param num: 当前库存", "name": "__init__", "signature": "def __init__(self, max)" }, { "docstring": "进货 :param num: 进货数量 :return:", "name": "stock", "signature": "def stock(self, num)" }, { "docstring": "售货 :param num: 售货数量 :return:", "name": ...
3
stack_v2_sparse_classes_30k_train_006185
Implement the Python class `Shop` described below. Class description: Implement the Shop class. Method signatures and docstrings: - def __init__(self, max): 初始化 :param max: 最大库存 :param num: 当前库存 - def stock(self, num): 进货 :param num: 进货数量 :return: - def sell(self, num): 售货 :param num: 售货数量 :return:
Implement the Python class `Shop` described below. Class description: Implement the Shop class. Method signatures and docstrings: - def __init__(self, max): 初始化 :param max: 最大库存 :param num: 当前库存 - def stock(self, num): 进货 :param num: 进货数量 :return: - def sell(self, num): 售货 :param num: 售货数量 :return: <|skeleton|> clas...
b1f9eeef652812ddcfa30db33d82b077949b192a
<|skeleton|> class Shop: def __init__(self, max): """初始化 :param max: 最大库存 :param num: 当前库存""" <|body_0|> def stock(self, num): """进货 :param num: 进货数量 :return:""" <|body_1|> def sell(self, num): """售货 :param num: 售货数量 :return:""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Shop: def __init__(self, max): """初始化 :param max: 最大库存 :param num: 当前库存""" self.max = max self.num = 0 self.condition = threading.Condition() def stock(self, num): """进货 :param num: 进货数量 :return:""" with self.condition: while num + self.num > se...
the_stack_v2_python_sparse
python/06-线程/Work/exercise3.py
huiba7i/Intermediate-Course
train
1
fd4bc45bdf24914b5d695661b8c8d42b6767da5c
[ "session_option = onnxruntime.SessionOptions()\nsession_option.log_severity_level = 3\nsession_option.intra_op_num_threads = psutil.cpu_count(logical=True) - 1\nself.onnx_session = onnxruntime.InferenceSession(model_path, sess_options=session_option, providers=providers)\nself.providers = self.onnx_session.get_prov...
<|body_start_0|> session_option = onnxruntime.SessionOptions() session_option.log_severity_level = 3 session_option.intra_op_num_threads = psutil.cpu_count(logical=True) - 1 self.onnx_session = onnxruntime.InferenceSession(model_path, sess_options=session_option, providers=providers) ...
UAEDONNX
[ "AGPL-3.0-only", "LicenseRef-scancode-proprietary-license", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UAEDONNX: def __init__(self, model_path: Optional[str]='uaed_1x3x480x640.onnx', providers: Optional[List]=[('TensorrtExecutionProvider', {'trt_engine_cache_enable': True, 'trt_engine_cache_path': '.', 'trt_fp16_enable': True}), 'CUDAExecutionProvider', 'CPUExecutionProvider']): """UAEDON...
stack_v2_sparse_classes_75kplus_train_005501
7,317
permissive
[ { "docstring": "UAEDONNX Parameters ---------- model_path: Optional[str] ONNX file path providers: Optional[List] Name of onnx execution providers", "name": "__init__", "signature": "def __init__(self, model_path: Optional[str]='uaed_1x3x480x640.onnx', providers: Optional[List]=[('TensorrtExecutionProvi...
3
stack_v2_sparse_classes_30k_train_037605
Implement the Python class `UAEDONNX` described below. Class description: Implement the UAEDONNX class. Method signatures and docstrings: - def __init__(self, model_path: Optional[str]='uaed_1x3x480x640.onnx', providers: Optional[List]=[('TensorrtExecutionProvider', {'trt_engine_cache_enable': True, 'trt_engine_cache...
Implement the Python class `UAEDONNX` described below. Class description: Implement the UAEDONNX class. Method signatures and docstrings: - def __init__(self, model_path: Optional[str]='uaed_1x3x480x640.onnx', providers: Optional[List]=[('TensorrtExecutionProvider', {'trt_engine_cache_enable': True, 'trt_engine_cache...
ff08e6e8ab095d98e96fc4a136ad5cbccc75fcf9
<|skeleton|> class UAEDONNX: def __init__(self, model_path: Optional[str]='uaed_1x3x480x640.onnx', providers: Optional[List]=[('TensorrtExecutionProvider', {'trt_engine_cache_enable': True, 'trt_engine_cache_path': '.', 'trt_fp16_enable': True}), 'CUDAExecutionProvider', 'CPUExecutionProvider']): """UAEDON...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UAEDONNX: def __init__(self, model_path: Optional[str]='uaed_1x3x480x640.onnx', providers: Optional[List]=[('TensorrtExecutionProvider', {'trt_engine_cache_enable': True, 'trt_engine_cache_path': '.', 'trt_fp16_enable': True}), 'CUDAExecutionProvider', 'CPUExecutionProvider']): """UAEDONNX Parameters ...
the_stack_v2_python_sparse
408_UAED/demo/demo_uaed_onnx.py
PINTO0309/PINTO_model_zoo
train
2,849
1cee61dc8e49ccc08d217aa29fa506e29be325c2
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Missing associated documentation comment in .proto file.
ACLServiceServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ACLServiceServicer: """Missing associated documentation comment in .proto file.""" def Read(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def Write(self, request, context): """Missing associated documentation c...
stack_v2_sparse_classes_75kplus_train_005502
9,116
permissive
[ { "docstring": "Missing associated documentation comment in .proto file.", "name": "Read", "signature": "def Read(self, request, context)" }, { "docstring": "Missing associated documentation comment in .proto file.", "name": "Write", "signature": "def Write(self, request, context)" }, ...
5
stack_v2_sparse_classes_30k_train_019954
Implement the Python class `ACLServiceServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def Read(self, request, context): Missing associated documentation comment in .proto file. - def Write(self, request, context): Missing assoc...
Implement the Python class `ACLServiceServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def Read(self, request, context): Missing associated documentation comment in .proto file. - def Write(self, request, context): Missing assoc...
7fcf74e18c1c2bc1756214657b51d155aca67ac6
<|skeleton|> class ACLServiceServicer: """Missing associated documentation comment in .proto file.""" def Read(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def Write(self, request, context): """Missing associated documentation c...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ACLServiceServicer: """Missing associated documentation comment in .proto file.""" def Read(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') ...
the_stack_v2_python_sparse
arrakisapi/api/acl_service_pb2_grpc.py
theFong/authzed-py
train
0
db3da9d2bdeb7edd21ddbec8c0e6acdf40b8afbe
[ "if error is False:\n self.__thanks_master()\nraise SystemExit(0)", "Notification(DEEP_NOTIF_INFO, '=================================')\nNotification(DEEP_NOTIF_INFO, 'Thank you for using Deeplodocus !')\nNotification(DEEP_NOTIF_INFO, '== Made by Humans with deep <3 ==')\nNotification(DEEP_NOTIF_INFO, '=======...
<|body_start_0|> if error is False: self.__thanks_master() raise SystemExit(0) <|end_body_0|> <|body_start_1|> Notification(DEEP_NOTIF_INFO, '=================================') Notification(DEEP_NOTIF_INFO, 'Thank you for using Deeplodocus !') Notification(DEEP_NOTI...
AUTHORS: -------- :author: Alix Leroy DESCRIPTION: ------------ Terminates the program
End
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class End: """AUTHORS: -------- :author: Alix Leroy DESCRIPTION: ------------ Terminates the program""" def __init__(self, error): """AUTHORS: -------- :author: Alix Leroy DESCRIPTION: ------------ Terminates the program PARAMETERS: ----------- :param error: Whether the program terminated ...
stack_v2_sparse_classes_75kplus_train_005503
1,322
permissive
[ { "docstring": "AUTHORS: -------- :author: Alix Leroy DESCRIPTION: ------------ Terminates the program PARAMETERS: ----------- :param error: Whether the program terminated with an error or not RETURN: ------- :return: None", "name": "__init__", "signature": "def __init__(self, error)" }, { "docs...
2
stack_v2_sparse_classes_30k_train_039328
Implement the Python class `End` described below. Class description: AUTHORS: -------- :author: Alix Leroy DESCRIPTION: ------------ Terminates the program Method signatures and docstrings: - def __init__(self, error): AUTHORS: -------- :author: Alix Leroy DESCRIPTION: ------------ Terminates the program PARAMETERS: ...
Implement the Python class `End` described below. Class description: AUTHORS: -------- :author: Alix Leroy DESCRIPTION: ------------ Terminates the program Method signatures and docstrings: - def __init__(self, error): AUTHORS: -------- :author: Alix Leroy DESCRIPTION: ------------ Terminates the program PARAMETERS: ...
3f9a1314ccfc1428d50de6a49a040aab4cb56dad
<|skeleton|> class End: """AUTHORS: -------- :author: Alix Leroy DESCRIPTION: ------------ Terminates the program""" def __init__(self, error): """AUTHORS: -------- :author: Alix Leroy DESCRIPTION: ------------ Terminates the program PARAMETERS: ----------- :param error: Whether the program terminated ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class End: """AUTHORS: -------- :author: Alix Leroy DESCRIPTION: ------------ Terminates the program""" def __init__(self, error): """AUTHORS: -------- :author: Alix Leroy DESCRIPTION: ------------ Terminates the program PARAMETERS: ----------- :param error: Whether the program terminated with an error...
the_stack_v2_python_sparse
deeplodocus/utils/end.py
Deeplodocus/deeplodocus
train
2
c37926776f3ad2302b551440851b48b58aa53cf8
[ "user = info.context.user\nif not user.has_perm('jobs.list_all_job'):\n raise GraphQLError('Not allowed')\nreturn Job.objects.all()", "user = info.context.user\nif not user.has_perm('jobs.list_all_joblog'):\n raise GraphQLError('Not allowed')\nreturn JobLog.objects.all()" ]
<|body_start_0|> user = info.context.user if not user.has_perm('jobs.list_all_job'): raise GraphQLError('Not allowed') return Job.objects.all() <|end_body_0|> <|body_start_1|> user = info.context.user if not user.has_perm('jobs.list_all_joblog'): raise Gr...
Query
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Query: def resolve_all_jobs(self, info, **kwargs): """Return all Jobs""" <|body_0|> def resolve_all_job_logs(self, info, **kwargs): """Return all Job Logs""" <|body_1|> <|end_skeleton|> <|body_start_0|> user = info.context.user if not user.h...
stack_v2_sparse_classes_75kplus_train_005504
3,079
permissive
[ { "docstring": "Return all Jobs", "name": "resolve_all_jobs", "signature": "def resolve_all_jobs(self, info, **kwargs)" }, { "docstring": "Return all Job Logs", "name": "resolve_all_job_logs", "signature": "def resolve_all_job_logs(self, info, **kwargs)" } ]
2
null
Implement the Python class `Query` described below. Class description: Implement the Query class. Method signatures and docstrings: - def resolve_all_jobs(self, info, **kwargs): Return all Jobs - def resolve_all_job_logs(self, info, **kwargs): Return all Job Logs
Implement the Python class `Query` described below. Class description: Implement the Query class. Method signatures and docstrings: - def resolve_all_jobs(self, info, **kwargs): Return all Jobs - def resolve_all_job_logs(self, info, **kwargs): Return all Job Logs <|skeleton|> class Query: def resolve_all_jobs(s...
ba62b369e6464259ea92dbb9ba49876513f37fba
<|skeleton|> class Query: def resolve_all_jobs(self, info, **kwargs): """Return all Jobs""" <|body_0|> def resolve_all_job_logs(self, info, **kwargs): """Return all Job Logs""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Query: def resolve_all_jobs(self, info, **kwargs): """Return all Jobs""" user = info.context.user if not user.has_perm('jobs.list_all_job'): raise GraphQLError('Not allowed') return Job.objects.all() def resolve_all_job_logs(self, info, **kwargs): """Re...
the_stack_v2_python_sparse
creator/jobs/schema.py
kids-first/kf-api-study-creator
train
3
4936a198b564c2680863123cb37f76b979a6b332
[ "super(AlbertTransformer, self).__init__()\nself.multiheadattn = MultiHeadAttn(batch_size=batch_size, query_linear_bias=query_linear_bias, key_linear_bias=key_linear_bias, value_linear_bias=value_linear_bias)\nself.add = P.Add()\nself.layernorm = LayerNorm(layer_norm_weight=layernorm_weight, layer_norm_bias=layerno...
<|body_start_0|> super(AlbertTransformer, self).__init__() self.multiheadattn = MultiHeadAttn(batch_size=batch_size, query_linear_bias=query_linear_bias, key_linear_bias=key_linear_bias, value_linear_bias=value_linear_bias) self.add = P.Add() self.layernorm = LayerNorm(layer_norm_weight=...
Transformer layer with LayerNOrm
AlbertTransformer
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlbertTransformer: """Transformer layer with LayerNOrm""" def __init__(self, batch_size, ffn_weight_shape, ffn_output_weight_shape, query_linear_bias, key_linear_bias, value_linear_bias, layernorm_weight, layernorm_bias, ffn_bias, ffn_output_bias): """init function""" <|body_...
stack_v2_sparse_classes_75kplus_train_005505
12,912
permissive
[ { "docstring": "init function", "name": "__init__", "signature": "def __init__(self, batch_size, ffn_weight_shape, ffn_output_weight_shape, query_linear_bias, key_linear_bias, value_linear_bias, layernorm_weight, layernorm_bias, ffn_bias, ffn_output_bias)" }, { "docstring": "construct function",...
2
stack_v2_sparse_classes_30k_train_052128
Implement the Python class `AlbertTransformer` described below. Class description: Transformer layer with LayerNOrm Method signatures and docstrings: - def __init__(self, batch_size, ffn_weight_shape, ffn_output_weight_shape, query_linear_bias, key_linear_bias, value_linear_bias, layernorm_weight, layernorm_bias, ffn...
Implement the Python class `AlbertTransformer` described below. Class description: Transformer layer with LayerNOrm Method signatures and docstrings: - def __init__(self, batch_size, ffn_weight_shape, ffn_output_weight_shape, query_linear_bias, key_linear_bias, value_linear_bias, layernorm_weight, layernorm_bias, ffn...
eab643f51336dbf7d711f02d27e6516e5affee59
<|skeleton|> class AlbertTransformer: """Transformer layer with LayerNOrm""" def __init__(self, batch_size, ffn_weight_shape, ffn_output_weight_shape, query_linear_bias, key_linear_bias, value_linear_bias, layernorm_weight, layernorm_bias, ffn_bias, ffn_output_bias): """init function""" <|body_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AlbertTransformer: """Transformer layer with LayerNOrm""" def __init__(self, batch_size, ffn_weight_shape, ffn_output_weight_shape, query_linear_bias, key_linear_bias, value_linear_bias, layernorm_weight, layernorm_bias, ffn_bias, ffn_output_bias): """init function""" super(AlbertTransfor...
the_stack_v2_python_sparse
research/nlp/tprr/src/albert.py
mindspore-ai/models
train
301
1525b68d2dccb56e8a112468642c1174cadc0cfc
[ "super().__init__(name=name, **kwargs)\nself.num_classes = num_classes\nself.num_anchors = num_anchors\nself.num_filters = num_filters\nself.min_level = min_level\nself.max_level = max_level\nself.repeats = repeats\nself.separable_conv = separable_conv\nself.is_training_bn = is_training_bn\nself.survival_prob = sur...
<|body_start_0|> super().__init__(name=name, **kwargs) self.num_classes = num_classes self.num_anchors = num_anchors self.num_filters = num_filters self.min_level = min_level self.max_level = max_level self.repeats = repeats self.separable_conv = separable...
Object class prediction network.
ClassNet
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClassNet: """Object class prediction network.""" def __init__(self, num_classes=90, num_anchors=9, num_filters=32, min_level=3, max_level=7, is_training_bn=False, act_type='swish', repeats=4, separable_conv=True, survival_prob=None, data_format='channels_last', name='class_net', **kwargs): ...
stack_v2_sparse_classes_75kplus_train_005506
31,612
permissive
[ { "docstring": "Initialize the ClassNet. Args: num_classes: number of classes. num_anchors: number of anchors. num_filters: number of filters for \"intermediate\" layers. min_level: minimum level for features. max_level: maximum level for features. is_training_bn: True if we train the BatchNorm. act_type: Strin...
2
stack_v2_sparse_classes_30k_train_041429
Implement the Python class `ClassNet` described below. Class description: Object class prediction network. Method signatures and docstrings: - def __init__(self, num_classes=90, num_anchors=9, num_filters=32, min_level=3, max_level=7, is_training_bn=False, act_type='swish', repeats=4, separable_conv=True, survival_pr...
Implement the Python class `ClassNet` described below. Class description: Object class prediction network. Method signatures and docstrings: - def __init__(self, num_classes=90, num_anchors=9, num_filters=32, min_level=3, max_level=7, is_training_bn=False, act_type='swish', repeats=4, separable_conv=True, survival_pr...
a5388a45f71a949639b35cc5b990bd130d2d8164
<|skeleton|> class ClassNet: """Object class prediction network.""" def __init__(self, num_classes=90, num_anchors=9, num_filters=32, min_level=3, max_level=7, is_training_bn=False, act_type='swish', repeats=4, separable_conv=True, survival_prob=None, data_format='channels_last', name='class_net', **kwargs): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ClassNet: """Object class prediction network.""" def __init__(self, num_classes=90, num_anchors=9, num_filters=32, min_level=3, max_level=7, is_training_bn=False, act_type='swish', repeats=4, separable_conv=True, survival_prob=None, data_format='channels_last', name='class_net', **kwargs): """Ini...
the_stack_v2_python_sparse
TensorFlow2/Detection/Efficientdet/model/efficientdet_keras.py
NVIDIA/DeepLearningExamples
train
11,838
b3ee95515e52c7a9a467df31ac66717f7ee42e53
[ "torch.nn.Module.__init__(self)\nself._is_all = is_all\nif self._is_all:\n self.features = torchvision.models.vgg11(pretrained=False).features\n self.features = torch.nn.Sequential(*list(self.features.children())[:-1])\nself.gap = torch.nn.AdaptiveAvgPool2d((1, 1))\nself.fc = torch.nn.Sequential(torch.nn.Line...
<|body_start_0|> torch.nn.Module.__init__(self) self._is_all = is_all if self._is_all: self.features = torchvision.models.vgg11(pretrained=False).features self.features = torch.nn.Sequential(*list(self.features.children())[:-1]) self.gap = torch.nn.AdaptiveAvgPool...
Posture
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Posture: def __init__(self, num_classes=2, is_all=True): """Declare all needed layers. Args: num_classes, int. is_all, bool: In the all/fc phase.""" <|body_0|> def _initParameter(module): """Initialize the weight and bias for each module. Args: module, torch.nn.Modul...
stack_v2_sparse_classes_75kplus_train_005507
2,827
no_license
[ { "docstring": "Declare all needed layers. Args: num_classes, int. is_all, bool: In the all/fc phase.", "name": "__init__", "signature": "def __init__(self, num_classes=2, is_all=True)" }, { "docstring": "Initialize the weight and bias for each module. Args: module, torch.nn.Module.", "name"...
3
stack_v2_sparse_classes_30k_train_005378
Implement the Python class `Posture` described below. Class description: Implement the Posture class. Method signatures and docstrings: - def __init__(self, num_classes=2, is_all=True): Declare all needed layers. Args: num_classes, int. is_all, bool: In the all/fc phase. - def _initParameter(module): Initialize the w...
Implement the Python class `Posture` described below. Class description: Implement the Posture class. Method signatures and docstrings: - def __init__(self, num_classes=2, is_all=True): Declare all needed layers. Args: num_classes, int. is_all, bool: In the all/fc phase. - def _initParameter(module): Initialize the w...
7732f37778a30302f02e6e83c9f9dc4d0e31998f
<|skeleton|> class Posture: def __init__(self, num_classes=2, is_all=True): """Declare all needed layers. Args: num_classes, int. is_all, bool: In the all/fc phase.""" <|body_0|> def _initParameter(module): """Initialize the weight and bias for each module. Args: module, torch.nn.Modul...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Posture: def __init__(self, num_classes=2, is_all=True): """Declare all needed layers. Args: num_classes, int. is_all, bool: In the all/fc phase.""" torch.nn.Module.__init__(self) self._is_all = is_all if self._is_all: self.features = torchvision.models.vgg11(pretra...
the_stack_v2_python_sparse
posture_detect/model/posture.py
changfengSir/fetal
train
0
7754a3ca009cf3c163986f1c20afdbbf5756bc04
[ "res = ApiFactory.get_home_api().banner_api()\nlogging.info('请求地址:{}'.format(res.url))\nlogging.info('响应数据:{}'.format(res.json()))\nassert res.status_code == 200\nassert res.json().get('id') == 1 and res.json().get('name') == '首页置顶'\nassert len(res.json().get('items')) > 0", "res = ApiFactory.get_home_api().theme...
<|body_start_0|> res = ApiFactory.get_home_api().banner_api() logging.info('请求地址:{}'.format(res.url)) logging.info('响应数据:{}'.format(res.json())) assert res.status_code == 200 assert res.json().get('id') == 1 and res.json().get('name') == '首页置顶' assert len(res.json().get('...
TestHomeApi
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestHomeApi: def test_home_api(self): """轮播图""" <|body_0|> def test_theme_api(self): """专题栏""" <|body_1|> def test_recent_product_api(self): """最新新品""" <|body_2|> <|end_skeleton|> <|body_start_0|> res = ApiFactory.get_home_api()...
stack_v2_sparse_classes_75kplus_train_005508
1,705
no_license
[ { "docstring": "轮播图", "name": "test_home_api", "signature": "def test_home_api(self)" }, { "docstring": "专题栏", "name": "test_theme_api", "signature": "def test_theme_api(self)" }, { "docstring": "最新新品", "name": "test_recent_product_api", "signature": "def test_recent_prod...
3
stack_v2_sparse_classes_30k_train_018597
Implement the Python class `TestHomeApi` described below. Class description: Implement the TestHomeApi class. Method signatures and docstrings: - def test_home_api(self): 轮播图 - def test_theme_api(self): 专题栏 - def test_recent_product_api(self): 最新新品
Implement the Python class `TestHomeApi` described below. Class description: Implement the TestHomeApi class. Method signatures and docstrings: - def test_home_api(self): 轮播图 - def test_theme_api(self): 专题栏 - def test_recent_product_api(self): 最新新品 <|skeleton|> class TestHomeApi: def test_home_api(self): ...
8c0f3b3b499311f2dc0e2e5a1738476e0af77cac
<|skeleton|> class TestHomeApi: def test_home_api(self): """轮播图""" <|body_0|> def test_theme_api(self): """专题栏""" <|body_1|> def test_recent_product_api(self): """最新新品""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestHomeApi: def test_home_api(self): """轮播图""" res = ApiFactory.get_home_api().banner_api() logging.info('请求地址:{}'.format(res.url)) logging.info('响应数据:{}'.format(res.json())) assert res.status_code == 200 assert res.json().get('id') == 1 and res.json().get('nam...
the_stack_v2_python_sparse
Scripts/testHome.py
yang9801/ego
train
1
c3d8f3c587750cd1def3aceb6e71a4839dc45e14
[ "pos_bboxes = [res.pos_bboxes for res in sampling_results]\npos_labels = [res.pos_gt_labels for res in sampling_results]\npos_assigned_gt_inds = [res.pos_assigned_gt_inds for res in sampling_results]\npos_rois = bbox2roi(pos_bboxes)\nmask_results = self._mask_forward(x, pos_rois, torch.cat(pos_labels))\nstage_mask_...
<|body_start_0|> pos_bboxes = [res.pos_bboxes for res in sampling_results] pos_labels = [res.pos_gt_labels for res in sampling_results] pos_assigned_gt_inds = [res.pos_assigned_gt_inds for res in sampling_results] pos_rois = bbox2roi(pos_bboxes) mask_results = self._mask_forward(...
SimpleRefineRoIHead
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleRefineRoIHead: def _mask_forward_train(self, x, sampling_results, bbox_feats, gt_masks, img_metas): """Run forward function and calculate loss for mask head in training.""" <|body_0|> def _mask_forward(self, x, rois, roi_labels): """Mask head forward function u...
stack_v2_sparse_classes_75kplus_train_005509
9,636
permissive
[ { "docstring": "Run forward function and calculate loss for mask head in training.", "name": "_mask_forward_train", "signature": "def _mask_forward_train(self, x, sampling_results, bbox_feats, gt_masks, img_metas)" }, { "docstring": "Mask head forward function used in both training and testing."...
3
null
Implement the Python class `SimpleRefineRoIHead` described below. Class description: Implement the SimpleRefineRoIHead class. Method signatures and docstrings: - def _mask_forward_train(self, x, sampling_results, bbox_feats, gt_masks, img_metas): Run forward function and calculate loss for mask head in training. - de...
Implement the Python class `SimpleRefineRoIHead` described below. Class description: Implement the SimpleRefineRoIHead class. Method signatures and docstrings: - def _mask_forward_train(self, x, sampling_results, bbox_feats, gt_masks, img_metas): Run forward function and calculate loss for mask head in training. - de...
5d887a9ab8d319736685946b1ddb6b606b584d5f
<|skeleton|> class SimpleRefineRoIHead: def _mask_forward_train(self, x, sampling_results, bbox_feats, gt_masks, img_metas): """Run forward function and calculate loss for mask head in training.""" <|body_0|> def _mask_forward(self, x, rois, roi_labels): """Mask head forward function u...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SimpleRefineRoIHead: def _mask_forward_train(self, x, sampling_results, bbox_feats, gt_masks, img_metas): """Run forward function and calculate loss for mask head in training.""" pos_bboxes = [res.pos_bboxes for res in sampling_results] pos_labels = [res.pos_gt_labels for res in sampli...
the_stack_v2_python_sparse
mmdet/models/roi_heads/refine_roi_head.py
zhengye1995/DCIC22-Cow
train
13
76b899a63afb2407f02ff43906187c94aa7d4fa9
[ "super(CLOUD, self).__init__()\nself.n_hidden = n_hidden\nself.n_layers = n_layers\nself.char_vocab_size = char_vocab_size\nself.pad_idx = pad_idx\nassert n_embedd >= 1\nself.n_embedd = n_embedd\nif self.n_embedd > 1:\n self.E = nn.Embedding(num_embeddings=char_vocab_size, embedding_dim=n_embedd, padding_idx=pad...
<|body_start_0|> super(CLOUD, self).__init__() self.n_hidden = n_hidden self.n_layers = n_layers self.char_vocab_size = char_vocab_size self.pad_idx = pad_idx assert n_embedd >= 1 self.n_embedd = n_embedd if self.n_embedd > 1: self.E = nn.Embed...
The CLOUD architecture learns the orthotactic patterns of a language by sequentially predicting the next character. Characters are identified by their index (e.g., a = 0, b = 1, ...). The character one-hot vectors go through the recurrent layer, producing hidden representations The model uses the hidden representations...
CLOUD
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CLOUD: """The CLOUD architecture learns the orthotactic patterns of a language by sequentially predicting the next character. Characters are identified by their index (e.g., a = 0, b = 1, ...). The character one-hot vectors go through the recurrent layer, producing hidden representations The mode...
stack_v2_sparse_classes_75kplus_train_005510
3,853
permissive
[ { "docstring": "Args: char_vocab_size (int): The number of characters in the vocabulary (alphabet + special characters) n_hidden (int): The size of the RNN's hidden representations (Default 128) n_layers (int): Number of RNN layers (Default 1) drop_p (float): Dropout between RNN layers if n_layers > 1 (Default ...
3
stack_v2_sparse_classes_30k_train_011748
Implement the Python class `CLOUD` described below. Class description: The CLOUD architecture learns the orthotactic patterns of a language by sequentially predicting the next character. Characters are identified by their index (e.g., a = 0, b = 1, ...). The character one-hot vectors go through the recurrent layer, pr...
Implement the Python class `CLOUD` described below. Class description: The CLOUD architecture learns the orthotactic patterns of a language by sequentially predicting the next character. Characters are identified by their index (e.g., a = 0, b = 1, ...). The character one-hot vectors go through the recurrent layer, pr...
25838f00052c1244afbd18be3635c43864f2cae1
<|skeleton|> class CLOUD: """The CLOUD architecture learns the orthotactic patterns of a language by sequentially predicting the next character. Characters are identified by their index (e.g., a = 0, b = 1, ...). The character one-hot vectors go through the recurrent layer, producing hidden representations The mode...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CLOUD: """The CLOUD architecture learns the orthotactic patterns of a language by sequentially predicting the next character. Characters are identified by their index (e.g., a = 0, b = 1, ...). The character one-hot vectors go through the recurrent layer, producing hidden representations The model uses the hi...
the_stack_v2_python_sparse
cloudmodel.py
JoseAAManzano/CLOUD
train
0
cf33d2a3d7d566102c57c6349407e449288ab6a5
[ "n = len(nums)\ntokens = self.dnc(nums, 0, n - 1)\nres = [None] * n\nfor token in tokens:\n res[token.idx] = n - token.idx - 1 - token.count\nreturn res", "if start > end:\n return []\nelif start == end:\n return [Token(nums[start], start, 0)]\nelse:\n mid = (end - start) / 2 + start\n left = self....
<|body_start_0|> n = len(nums) tokens = self.dnc(nums, 0, n - 1) res = [None] * n for token in tokens: res[token.idx] = n - token.idx - 1 - token.count return res <|end_body_0|> <|body_start_1|> if start > end: return [] elif start == end:...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countSmaller(self, nums): """Merge sort like solution. The problem gets tricky when what's asked for is elements smaller instead of no larger than. The reason is during merge operation, when left[i] >= right[j], you cannot tell how many element on the right side of right[j]...
stack_v2_sparse_classes_75kplus_train_005511
3,823
no_license
[ { "docstring": "Merge sort like solution. The problem gets tricky when what's asked for is elements smaller instead of no larger than. The reason is during merge operation, when left[i] >= right[j], you cannot tell how many element on the right side of right[j] are smaller than left[i] because of there might be...
3
stack_v2_sparse_classes_30k_train_045041
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countSmaller(self, nums): Merge sort like solution. The problem gets tricky when what's asked for is elements smaller instead of no larger than. The reason is during merge op...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countSmaller(self, nums): Merge sort like solution. The problem gets tricky when what's asked for is elements smaller instead of no larger than. The reason is during merge op...
33c623f226981942780751554f0593f2c71cf458
<|skeleton|> class Solution: def countSmaller(self, nums): """Merge sort like solution. The problem gets tricky when what's asked for is elements smaller instead of no larger than. The reason is during merge operation, when left[i] >= right[j], you cannot tell how many element on the right side of right[j]...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def countSmaller(self, nums): """Merge sort like solution. The problem gets tricky when what's asked for is elements smaller instead of no larger than. The reason is during merge operation, when left[i] >= right[j], you cannot tell how many element on the right side of right[j] are smaller t...
the_stack_v2_python_sparse
sort/leetcode_Count_Of_Smaller_Numbers_After_Self.py
monkeylyf/interviewjam
train
59
93cac2f90f521817cce4eca89ab010f3b299b3ab
[ "query = Query(Directive.collection, service_id=self._client.service_id)\nquery.add_term(field='directive_tier_id', value=self.id).limit(100)\nreturn SequenceProxy(Directive, query, client=self._client)", "if self.reward_set_id is None:\n return []\nreturn await Reward.get_by_reward_set(self.reward_set_id, cli...
<|body_start_0|> query = Query(Directive.collection, service_id=self._client.service_id) query.add_term(field='directive_tier_id', value=self.id).limit(100) return SequenceProxy(Directive, query, client=self._client) <|end_body_0|> <|body_start_1|> if self.reward_set_id is None: ...
A tier in a directive tree. Directive tiers list the set of directives required to advance to the next tier in the :class:`DirectiveTree`, e.g. "Combat Medic: Adept" or "Shotguns: Master". .. attribute:: id :type: int The unique ID of the directive tier. In the API payload, this field is called ``directive_tier_id``. ....
DirectiveTier
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DirectiveTier: """A tier in a directive tree. Directive tiers list the set of directives required to advance to the next tier in the :class:`DirectiveTree`, e.g. "Combat Medic: Adept" or "Shotguns: Master". .. attribute:: id :type: int The unique ID of the directive tier. In the API payload, this...
stack_v2_sparse_classes_75kplus_train_005512
11,340
permissive
[ { "docstring": "Return the list of directives in this tier. This returns a :class:`auraxium.SequenceProxy`.", "name": "directives", "signature": "def directives(self) -> SequenceProxy['Directive']" }, { "docstring": "Return the rewards granted upon completion of this tier.", "name": "rewards...
3
null
Implement the Python class `DirectiveTier` described below. Class description: A tier in a directive tree. Directive tiers list the set of directives required to advance to the next tier in the :class:`DirectiveTree`, e.g. "Combat Medic: Adept" or "Shotguns: Master". .. attribute:: id :type: int The unique ID of the d...
Implement the Python class `DirectiveTier` described below. Class description: A tier in a directive tree. Directive tiers list the set of directives required to advance to the next tier in the :class:`DirectiveTree`, e.g. "Combat Medic: Adept" or "Shotguns: Master". .. attribute:: id :type: int The unique ID of the d...
23dcf927a199c8d7c917d89fe96b470a34cf4bba
<|skeleton|> class DirectiveTier: """A tier in a directive tree. Directive tiers list the set of directives required to advance to the next tier in the :class:`DirectiveTree`, e.g. "Combat Medic: Adept" or "Shotguns: Master". .. attribute:: id :type: int The unique ID of the directive tier. In the API payload, this...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DirectiveTier: """A tier in a directive tree. Directive tiers list the set of directives required to advance to the next tier in the :class:`DirectiveTree`, e.g. "Combat Medic: Adept" or "Shotguns: Master". .. attribute:: id :type: int The unique ID of the directive tier. In the API payload, this field is cal...
the_stack_v2_python_sparse
auraxium/ps2/_directive.py
leonhard-s/auraxium
train
29
71ac0b72eab8c115312ed7736acd44609de6eefa
[ "self.foodToScore = defaultdict(int)\nself.foodToCuision = defaultdict(str)\nself.cuisionRank = defaultdict(lambda: SortedList(key=lambda x: (-x[0], x[1])))\nfor food, cuision, score in zip(foods, cuisines, ratings):\n self.foodToScore[food] = score\n self.foodToCuision[food] = cuision\n self.cuisionRank[c...
<|body_start_0|> self.foodToScore = defaultdict(int) self.foodToCuision = defaultdict(str) self.cuisionRank = defaultdict(lambda: SortedList(key=lambda x: (-x[0], x[1]))) for food, cuision, score in zip(foods, cuisines, ratings): self.foodToScore[food] = score sel...
FoodRatings
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FoodRatings: def __init__(self, foods: List[str], cuisines: List[str], ratings: List[int]): """foods[i] 是第 i 种食物的名字。 cuisines[i] 是第 i 种食物的烹饪方式。 ratings[i] 是第 i 种食物的最初评分。""" <|body_0|> def changeRating(self, food: str, newRating: int) -> None: """修改名字为 food 的食物的评分。删除旧...
stack_v2_sparse_classes_75kplus_train_005513
1,858
no_license
[ { "docstring": "foods[i] 是第 i 种食物的名字。 cuisines[i] 是第 i 种食物的烹饪方式。 ratings[i] 是第 i 种食物的最初评分。", "name": "__init__", "signature": "def __init__(self, foods: List[str], cuisines: List[str], ratings: List[int])" }, { "docstring": "修改名字为 food 的食物的评分。删除旧的,添加新的", "name": "changeRating", "signatur...
3
stack_v2_sparse_classes_30k_train_022826
Implement the Python class `FoodRatings` described below. Class description: Implement the FoodRatings class. Method signatures and docstrings: - def __init__(self, foods: List[str], cuisines: List[str], ratings: List[int]): foods[i] 是第 i 种食物的名字。 cuisines[i] 是第 i 种食物的烹饪方式。 ratings[i] 是第 i 种食物的最初评分。 - def changeRating...
Implement the Python class `FoodRatings` described below. Class description: Implement the FoodRatings class. Method signatures and docstrings: - def __init__(self, foods: List[str], cuisines: List[str], ratings: List[int]): foods[i] 是第 i 种食物的名字。 cuisines[i] 是第 i 种食物的烹饪方式。 ratings[i] 是第 i 种食物的最初评分。 - def changeRating...
7e79e26bb8f641868561b186e34c1127ed63c9e0
<|skeleton|> class FoodRatings: def __init__(self, foods: List[str], cuisines: List[str], ratings: List[int]): """foods[i] 是第 i 种食物的名字。 cuisines[i] 是第 i 种食物的烹饪方式。 ratings[i] 是第 i 种食物的最初评分。""" <|body_0|> def changeRating(self, food: str, newRating: int) -> None: """修改名字为 food 的食物的评分。删除旧...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FoodRatings: def __init__(self, foods: List[str], cuisines: List[str], ratings: List[int]): """foods[i] 是第 i 种食物的名字。 cuisines[i] 是第 i 种食物的烹饪方式。 ratings[i] 是第 i 种食物的最初评分。""" self.foodToScore = defaultdict(int) self.foodToCuision = defaultdict(str) self.cuisionRank = defaultdict(...
the_stack_v2_python_sparse
4_set/有序集合/字典加SortedList设计类/6126. 设计食物评分系统.py
981377660LMT/algorithm-study
train
225
25ea46673f5cd6641610961618d119b9f708fb5a
[ "test_response = self.client.get('/posts/fixture-post')\nself.assertEqual(test_response.status_code, 200)\nself.assertTemplateUsed(test_response, 'post_detail.html')\nself.assertTemplateUsed(test_response, 'base.html')\nself.assertTemplateUsed(test_response, 'disqus_snippet.html')\nself.assertTemplateUsed(test_resp...
<|body_start_0|> test_response = self.client.get('/posts/fixture-post') self.assertEqual(test_response.status_code, 200) self.assertTemplateUsed(test_response, 'post_detail.html') self.assertTemplateUsed(test_response, 'base.html') self.assertTemplateUsed(test_response, 'disqus_s...
These test the views associated with post objects.
PostViewTests
[ "CC0-1.0", "LicenseRef-scancode-unknown-license-reference", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PostViewTests: """These test the views associated with post objects.""" def test_post_details_view(self): """This tests the post-details view, ensuring that templates are loaded correctly. This view uses a user with superuser permissions so does not test the permission levels for thi...
stack_v2_sparse_classes_75kplus_train_005514
14,526
permissive
[ { "docstring": "This tests the post-details view, ensuring that templates are loaded correctly. This view uses a user with superuser permissions so does not test the permission levels for this view.", "name": "test_post_details_view", "signature": "def test_post_details_view(self)" }, { "docstri...
5
stack_v2_sparse_classes_30k_train_006708
Implement the Python class `PostViewTests` described below. Class description: These test the views associated with post objects. Method signatures and docstrings: - def test_post_details_view(self): This tests the post-details view, ensuring that templates are loaded correctly. This view uses a user with superuser p...
Implement the Python class `PostViewTests` described below. Class description: These test the views associated with post objects. Method signatures and docstrings: - def test_post_details_view(self): This tests the post-details view, ensuring that templates are loaded correctly. This view uses a user with superuser p...
d6f6c9c068bbf668c253e5943d9514947023e66d
<|skeleton|> class PostViewTests: """These test the views associated with post objects.""" def test_post_details_view(self): """This tests the post-details view, ensuring that templates are loaded correctly. This view uses a user with superuser permissions so does not test the permission levels for thi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PostViewTests: """These test the views associated with post objects.""" def test_post_details_view(self): """This tests the post-details view, ensuring that templates are loaded correctly. This view uses a user with superuser permissions so does not test the permission levels for this view.""" ...
the_stack_v2_python_sparse
communication/tests.py
BridgesLab/Lab-Website
train
0
99a141888a206fd9a29c946557c58cba7fd64345
[ "super().__init__(**kwargs)\nself.path = os.path.abspath(os.path.expanduser(path))\nself.config_path = os.path.dirname(self.path)\nreturn", "if isinstance(self.cache, bool) or not self.cache:\n cache = 'yes' if self.cache else 'no'\nelse:\n cache = int(self.cache)\nparams = {'encoding': self.encoding, 'cach...
<|body_start_0|> super().__init__(**kwargs) self.path = os.path.abspath(os.path.expanduser(path)) self.config_path = os.path.dirname(self.path) return <|end_body_0|> <|body_start_1|> if isinstance(self.cache, bool) or not self.cache: cache = 'yes' if self.cache else ...
A wrapper for File based configuration sources
ConfigFile
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConfigFile: """A wrapper for File based configuration sources""" def __init__(self, path, **kwargs): """Initialize File Object headers can be a dictionary of key/value pairs that you want to additionally include as part of the server headers to post with""" <|body_0|> de...
stack_v2_sparse_classes_75kplus_train_005515
6,343
permissive
[ { "docstring": "Initialize File Object headers can be a dictionary of key/value pairs that you want to additionally include as part of the server headers to post with", "name": "__init__", "signature": "def __init__(self, path, **kwargs)" }, { "docstring": "Returns the URL built dynamically base...
4
stack_v2_sparse_classes_30k_train_027703
Implement the Python class `ConfigFile` described below. Class description: A wrapper for File based configuration sources Method signatures and docstrings: - def __init__(self, path, **kwargs): Initialize File Object headers can be a dictionary of key/value pairs that you want to additionally include as part of the ...
Implement the Python class `ConfigFile` described below. Class description: A wrapper for File based configuration sources Method signatures and docstrings: - def __init__(self, path, **kwargs): Initialize File Object headers can be a dictionary of key/value pairs that you want to additionally include as part of the ...
be3baed7e3d33bae973f1714df4ebbf65aa33f85
<|skeleton|> class ConfigFile: """A wrapper for File based configuration sources""" def __init__(self, path, **kwargs): """Initialize File Object headers can be a dictionary of key/value pairs that you want to additionally include as part of the server headers to post with""" <|body_0|> de...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ConfigFile: """A wrapper for File based configuration sources""" def __init__(self, path, **kwargs): """Initialize File Object headers can be a dictionary of key/value pairs that you want to additionally include as part of the server headers to post with""" super().__init__(**kwargs) ...
the_stack_v2_python_sparse
apprise/config/ConfigFile.py
caronc/apprise
train
8,426
375376abc81c11436e542d54ddd90b83747af18b
[ "super(Attention, self).__init__()\nself.linear = clones(nn.Linear(C, C), 3)\nself.dropout = nn.Dropout(p=0.1)", "batchSize, n, C = P.shape\nQ = self.linear[0](P)\nK = self.linear[1](P)\nV = self.linear[2](P)\nAdj = torch.matmul(Q, K.permute(0, 2, 1)) / math.sqrt(C)\nAdj = F.softmax(Adj, dim=2)\ngcn_layer = torch...
<|body_start_0|> super(Attention, self).__init__() self.linear = clones(nn.Linear(C, C), 3) self.dropout = nn.Dropout(p=0.1) <|end_body_0|> <|body_start_1|> batchSize, n, C = P.shape Q = self.linear[0](P) K = self.linear[1](P) V = self.linear[2](P) Adj = ...
Self-Attention module, corresponding the global graph. Given lots of polyline vectors, each length is 'C', we want to get the predicted feature vector.
Attention
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Attention: """Self-Attention module, corresponding the global graph. Given lots of polyline vectors, each length is 'C', we want to get the predicted feature vector.""" def __init__(self, C): """self.linear is 3 linear transformers for Q, K, V. :param C: the length of input feature v...
stack_v2_sparse_classes_75kplus_train_005516
2,033
no_license
[ { "docstring": "self.linear is 3 linear transformers for Q, K, V. :param C: the length of input feature vector. equals to the output dim of subgraph", "name": "__init__", "signature": "def __init__(self, C)" }, { "docstring": ":param P: a list of polyline vectors, form a tensor. P.shape = [batch...
2
stack_v2_sparse_classes_30k_val_000088
Implement the Python class `Attention` described below. Class description: Self-Attention module, corresponding the global graph. Given lots of polyline vectors, each length is 'C', we want to get the predicted feature vector. Method signatures and docstrings: - def __init__(self, C): self.linear is 3 linear transfor...
Implement the Python class `Attention` described below. Class description: Self-Attention module, corresponding the global graph. Given lots of polyline vectors, each length is 'C', we want to get the predicted feature vector. Method signatures and docstrings: - def __init__(self, C): self.linear is 3 linear transfor...
0a314f7bdfc6db0247c92bc2c5c3806fdd18b885
<|skeleton|> class Attention: """Self-Attention module, corresponding the global graph. Given lots of polyline vectors, each length is 'C', we want to get the predicted feature vector.""" def __init__(self, C): """self.linear is 3 linear transformers for Q, K, V. :param C: the length of input feature v...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Attention: """Self-Attention module, corresponding the global graph. Given lots of polyline vectors, each length is 'C', we want to get the predicted feature vector.""" def __init__(self, C): """self.linear is 3 linear transformers for Q, K, V. :param C: the length of input feature vector. equals...
the_stack_v2_python_sparse
global_graph.py
JieFeng-cse/dynamic_driving
train
1
95601de276c16dd4814fd811e1a9ab6aa03aa775
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn FilterClause()", "from .filter_operand import FilterOperand\nfrom .filter_operand import FilterOperand\nfields: Dict[str, Callable[[Any], None]] = {'@odata.type': lambda n: setattr(self, 'odata_type', n.get_str_value()), 'operatorName'...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return FilterClause() <|end_body_0|> <|body_start_1|> from .filter_operand import FilterOperand from .filter_operand import FilterOperand fields: Dict[str, Callable[[Any], None]] = {'@o...
FilterClause
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FilterClause: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> FilterClause: """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: ...
stack_v2_sparse_classes_75kplus_train_005517
3,402
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: FilterClause", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(...
3
stack_v2_sparse_classes_30k_train_004591
Implement the Python class `FilterClause` described below. Class description: Implement the FilterClause class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> FilterClause: Creates a new instance of the appropriate class based on discriminator value Ar...
Implement the Python class `FilterClause` described below. Class description: Implement the FilterClause class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> FilterClause: Creates a new instance of the appropriate class based on discriminator value Ar...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class FilterClause: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> FilterClause: """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: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FilterClause: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> FilterClause: """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: FilterClause""...
the_stack_v2_python_sparse
msgraph/generated/models/filter_clause.py
microsoftgraph/msgraph-sdk-python
train
135
f7dfcee8746eda0689fe4578f293d584e1e9594a
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('arshadr_rcallah_shaikh1', 'arshadr_rcallah_shaikh1')\nurl = 'http://files.zillowstatic.com/research/public/City/City_ZriPerSqft_AllHomes.csv'\ns = requests.get(url).content\ndf = pd.read_csv(io.StringIO(...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('arshadr_rcallah_shaikh1', 'arshadr_rcallah_shaikh1') url = 'http://files.zillowstatic.com/research/public/City/City_ZriPerSqft_AllHomes.csv' s = r...
price_per_sqft_data
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class price_per_sqft_data: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing ever...
stack_v2_sparse_classes_75kplus_train_005518
4,679
no_license
[ { "docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).", "name": "execute", "signature": "def execute(trial=False)" }, { "docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d...
2
stack_v2_sparse_classes_30k_train_006772
Implement the Python class `price_per_sqft_data` described below. Class description: Implement the price_per_sqft_data class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), start...
Implement the Python class `price_per_sqft_data` described below. Class description: Implement the price_per_sqft_data class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), start...
90284cf3debbac36eead07b8d2339cdd191b86cf
<|skeleton|> class price_per_sqft_data: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing ever...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class price_per_sqft_data: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('arshadr_rcallah_shaikh1', 'arsh...
the_stack_v2_python_sparse
arshadr_rcallah_shaikh1/price_per_sqft_data.py
maximega/course-2019-spr-proj
train
2
6f42f1402721f5222de723e4db614e1909f562c8
[ "study = db.session.query(Study).get(id)\nif not study:\n return not_found_error('<Study(id={})> not found'.format(id))\nif g.current_user.is_admin is False and study.review.users.filter_by(id=g.current_user.id).one_or_none() is None:\n return forbidden_error('{} forbidden to get this study'.format(g.current_...
<|body_start_0|> study = db.session.query(Study).get(id) if not study: return not_found_error('<Study(id={})> not found'.format(id)) if g.current_user.is_admin is False and study.review.users.filter_by(id=g.current_user.id).one_or_none() is None: return forbidden_error('{...
StudyResource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StudyResource: def get(self, id, fields): """get record for a single study by id""" <|body_0|> def delete(self, id, test): """delete record for a single study by id""" <|body_1|> def put(self, args, id, test): """modify record for a single study ...
stack_v2_sparse_classes_75kplus_train_005519
19,112
no_license
[ { "docstring": "get record for a single study by id", "name": "get", "signature": "def get(self, id, fields)" }, { "docstring": "delete record for a single study by id", "name": "delete", "signature": "def delete(self, id, test)" }, { "docstring": "modify record for a single stud...
3
null
Implement the Python class `StudyResource` described below. Class description: Implement the StudyResource class. Method signatures and docstrings: - def get(self, id, fields): get record for a single study by id - def delete(self, id, test): delete record for a single study by id - def put(self, args, id, test): mod...
Implement the Python class `StudyResource` described below. Class description: Implement the StudyResource class. Method signatures and docstrings: - def get(self, id, fields): get record for a single study by id - def delete(self, id, test): delete record for a single study by id - def put(self, args, id, test): mod...
37936769dd7c4de05e44508eeb5eaf7b8cdf1c14
<|skeleton|> class StudyResource: def get(self, id, fields): """get record for a single study by id""" <|body_0|> def delete(self, id, test): """delete record for a single study by id""" <|body_1|> def put(self, args, id, test): """modify record for a single study ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StudyResource: def get(self, id, fields): """get record for a single study by id""" study = db.session.query(Study).get(id) if not study: return not_found_error('<Study(id={})> not found'.format(id)) if g.current_user.is_admin is False and study.review.users.filter_...
the_stack_v2_python_sparse
colandr/api/resources/studies.py
datakind/permanent-colandr-back
train
13
e6061e08fdb895dc5ece04ab4a4c1002f9451735
[ "if not os.path.isdir(dirpath):\n sys.exit('Der angegebene Pfad für die Dateien existiert nicht oder ist ungültig.')\nself.backlog_path = os.path.join(dirpath, 'backlog.json')\ntry:\n with open(tokenfile) as json_file:\n try:\n self.bearer = json.load(json_file)['token']\n except KeyE...
<|body_start_0|> if not os.path.isdir(dirpath): sys.exit('Der angegebene Pfad für die Dateien existiert nicht oder ist ungültig.') self.backlog_path = os.path.join(dirpath, 'backlog.json') try: with open(tokenfile) as json_file: try: se...
The network module class. Responsible for sending data to the insect counter server.
NetworkModule
[ "MIT", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NetworkModule: """The network module class. Responsible for sending data to the insect counter server.""" def __init__(self, dirpath, tokenfile, server_url): """Creates a network module instance. :param dirpath: Path where the backlog data should be saved. :param tokenfile: Name of t...
stack_v2_sparse_classes_75kplus_train_005520
4,400
permissive
[ { "docstring": "Creates a network module instance. :param dirpath: Path where the backlog data should be saved. :param tokenfile: Name of the tokenfile.json needed to authenticate with the server. :param server_url: Address of the server whom to send the data to.", "name": "__init__", "signature": "def ...
4
stack_v2_sparse_classes_30k_train_030648
Implement the Python class `NetworkModule` described below. Class description: The network module class. Responsible for sending data to the insect counter server. Method signatures and docstrings: - def __init__(self, dirpath, tokenfile, server_url): Creates a network module instance. :param dirpath: Path where the ...
Implement the Python class `NetworkModule` described below. Class description: The network module class. Responsible for sending data to the insect counter server. Method signatures and docstrings: - def __init__(self, dirpath, tokenfile, server_url): Creates a network module instance. :param dirpath: Path where the ...
3dbe50fe4a2cb2b49057cc7d15b9a1636a8b6bd1
<|skeleton|> class NetworkModule: """The network module class. Responsible for sending data to the insect counter server.""" def __init__(self, dirpath, tokenfile, server_url): """Creates a network module instance. :param dirpath: Path where the backlog data should be saved. :param tokenfile: Name of t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NetworkModule: """The network module class. Responsible for sending data to the insect counter server.""" def __init__(self, dirpath, tokenfile, server_url): """Creates a network module instance. :param dirpath: Path where the backlog data should be saved. :param tokenfile: Name of the tokenfile....
the_stack_v2_python_sparse
src/classifier/network.py
insectcounter/insectcounter
train
0
d282152d6f34c4a30089e74d7070652dcb7587f9
[ "if len(matrix) > 0 and len(matrix[0]) > 0:\n m, n = (len(matrix), len(matrix[0]))\n sums = [[0 for _ in range(n)] for _ in range(m)]\n for i in range(m):\n for j in range(n):\n sums[i][j] += matrix[i][j]\n sums[i][j] += sums[i][j - 1] if j > 0 else 0\n sums[i][j] +=...
<|body_start_0|> if len(matrix) > 0 and len(matrix[0]) > 0: m, n = (len(matrix), len(matrix[0])) sums = [[0 for _ in range(n)] for _ in range(m)] for i in range(m): for j in range(n): sums[i][j] += matrix[i][j] sums[i][j...
NumMatrix
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """:type row1: int :type col1: int :type row2: int :type col2: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_75kplus_train_005521
2,633
no_license
[ { "docstring": ":type matrix: List[List[int]]", "name": "__init__", "signature": "def __init__(self, matrix)" }, { "docstring": ":type row1: int :type col1: int :type row2: int :type col2: int :rtype: int", "name": "sumRegion", "signature": "def sumRegion(self, row1, col1, row2, col2)" ...
2
null
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:...
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:...
7de5f69e6e44ca4e74d75fed2af390b3d2cbd2b9
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """:type row1: int :type col1: int :type row2: int :type col2: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" if len(matrix) > 0 and len(matrix[0]) > 0: m, n = (len(matrix), len(matrix[0])) sums = [[0 for _ in range(n)] for _ in range(m)] for i in range(m): for j in range(n): ...
the_stack_v2_python_sparse
interview/facebook/face/phone/LC304. Range Sum Query 2D - Immutable.py
zhangshv123/superjump
train
1
8759db8511b71ca538f7077b755f7c88e2094a6b
[ "self.__keyframepath = keyframepath\nself.__featuressavepath = featuressavepath\nself.__resizeheight = resizeheight\nself.__resizewidth = resizewidth", "if os.path.isdir(self.__keyframepath):\n for dirpath, dirnames, filenames in os.walk(self.__keyframepath):\n for filename in filenames:\n se...
<|body_start_0|> self.__keyframepath = keyframepath self.__featuressavepath = featuressavepath self.__resizeheight = resizeheight self.__resizewidth = resizewidth <|end_body_0|> <|body_start_1|> if os.path.isdir(self.__keyframepath): for dirpath, dirnames, filenames ...
FeaturesExtractor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FeaturesExtractor: def __init__(self, keyframepath, featuressavepath, resizeheight=240, resizewidth=320): """初始化方法 :param keyframepath: hdfs上的keyframe信息的路径 :param featuressavepath: hdfs上的features保存的路径 :param resizeheight: 重置视频的大小的高 :param resizewidth: 重置视频的大小的宽""" <|body_0|> ...
stack_v2_sparse_classes_75kplus_train_005522
8,999
no_license
[ { "docstring": "初始化方法 :param keyframepath: hdfs上的keyframe信息的路径 :param featuressavepath: hdfs上的features保存的路径 :param resizeheight: 重置视频的大小的高 :param resizewidth: 重置视频的大小的宽", "name": "__init__", "signature": "def __init__(self, keyframepath, featuressavepath, resizeheight=240, resizewidth=320)" }, { ...
5
stack_v2_sparse_classes_30k_train_033215
Implement the Python class `FeaturesExtractor` described below. Class description: Implement the FeaturesExtractor class. Method signatures and docstrings: - def __init__(self, keyframepath, featuressavepath, resizeheight=240, resizewidth=320): 初始化方法 :param keyframepath: hdfs上的keyframe信息的路径 :param featuressavepath: h...
Implement the Python class `FeaturesExtractor` described below. Class description: Implement the FeaturesExtractor class. Method signatures and docstrings: - def __init__(self, keyframepath, featuressavepath, resizeheight=240, resizewidth=320): 初始化方法 :param keyframepath: hdfs上的keyframe信息的路径 :param featuressavepath: h...
805ae46ab3a6585b89c5360e55f42108e4b66fd5
<|skeleton|> class FeaturesExtractor: def __init__(self, keyframepath, featuressavepath, resizeheight=240, resizewidth=320): """初始化方法 :param keyframepath: hdfs上的keyframe信息的路径 :param featuressavepath: hdfs上的features保存的路径 :param resizeheight: 重置视频的大小的高 :param resizewidth: 重置视频的大小的宽""" <|body_0|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FeaturesExtractor: def __init__(self, keyframepath, featuressavepath, resizeheight=240, resizewidth=320): """初始化方法 :param keyframepath: hdfs上的keyframe信息的路径 :param featuressavepath: hdfs上的features保存的路径 :param resizeheight: 重置视频的大小的高 :param resizewidth: 重置视频的大小的宽""" self.__keyframepath = keyfram...
the_stack_v2_python_sparse
myFirstPoint/FeaturesExtractor.py
SunBite/ProvincialProject
train
1
7866c9fa6c4501020c6fbf1e417256b1e75eb3d1
[ "super(GreenLight, self).__init__(parent)\nself.setFixedSize(22, 22)\nself.green = QtGui.QColor(44, 173, 9)", "painter = QtGui.QPainter()\npainter.begin(self)\npainter.setRenderHint(QtGui.QPainter.Antialiasing, True)\npainter.setPen(self.green)\npainter.setBrush(self.green)\npainter.drawEllipse(1, 1, 20, 20)\npai...
<|body_start_0|> super(GreenLight, self).__init__(parent) self.setFixedSize(22, 22) self.green = QtGui.QColor(44, 173, 9) <|end_body_0|> <|body_start_1|> painter = QtGui.QPainter() painter.begin(self) painter.setRenderHint(QtGui.QPainter.Antialiasing, True) paint...
Creates a green circle
GreenLight
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GreenLight: """Creates a green circle""" def __init__(self, parent=None): """Initializes circle with fixed size and color""" <|body_0|> def paintEvent(self, e): """Draws the circle""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(GreenLight...
stack_v2_sparse_classes_75kplus_train_005523
4,386
no_license
[ { "docstring": "Initializes circle with fixed size and color", "name": "__init__", "signature": "def __init__(self, parent=None)" }, { "docstring": "Draws the circle", "name": "paintEvent", "signature": "def paintEvent(self, e)" } ]
2
stack_v2_sparse_classes_30k_train_001784
Implement the Python class `GreenLight` described below. Class description: Creates a green circle Method signatures and docstrings: - def __init__(self, parent=None): Initializes circle with fixed size and color - def paintEvent(self, e): Draws the circle
Implement the Python class `GreenLight` described below. Class description: Creates a green circle Method signatures and docstrings: - def __init__(self, parent=None): Initializes circle with fixed size and color - def paintEvent(self, e): Draws the circle <|skeleton|> class GreenLight: """Creates a green circle...
898bda85308f37fd19568f37fe277f93951981ec
<|skeleton|> class GreenLight: """Creates a green circle""" def __init__(self, parent=None): """Initializes circle with fixed size and color""" <|body_0|> def paintEvent(self, e): """Draws the circle""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GreenLight: """Creates a green circle""" def __init__(self, parent=None): """Initializes circle with fixed size and color""" super(GreenLight, self).__init__(parent) self.setFixedSize(22, 22) self.green = QtGui.QColor(44, 173, 9) def paintEvent(self, e): """Dr...
the_stack_v2_python_sparse
gui/statuslight.py
LightingResearchCenter/PythonDaysimeter12Client
train
0
89dd871e24459fe4437d850534f51d53bdcd35e7
[ "normal_list = list()\noutput_list = list()\nfor c in s:\n if c.isalpha():\n normal_list.append(c)\nfor c in s:\n if c.isalpha():\n output_list.append(normal_list.pop())\n else:\n output_list.append(c)\nretval = ''.join(output_list)\nprint('reversed string = {}'.format(retval))\nreturn...
<|body_start_0|> normal_list = list() output_list = list() for c in s: if c.isalpha(): normal_list.append(c) for c in s: if c.isalpha(): output_list.append(normal_list.pop()) else: output_list.append(c) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverse_v1(self, s): """A simple implementation that needs a stack. Complexity O(n). This method needs extra space (a stack). It also needs to check each character twice if it is special. :param s: The input string""" <|body_0|> def reverse_v2(self, s): ...
stack_v2_sparse_classes_75kplus_train_005524
3,616
no_license
[ { "docstring": "A simple implementation that needs a stack. Complexity O(n). This method needs extra space (a stack). It also needs to check each character twice if it is special. :param s: The input string", "name": "reverse_v1", "signature": "def reverse_v1(self, s)" }, { "docstring": "A smart...
3
stack_v2_sparse_classes_30k_train_037208
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverse_v1(self, s): A simple implementation that needs a stack. Complexity O(n). This method needs extra space (a stack). It also needs to check each character twice if it i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverse_v1(self, s): A simple implementation that needs a stack. Complexity O(n). This method needs extra space (a stack). It also needs to check each character twice if it i...
97a2386f5e3adbd7138fd123810c3232bdf7f622
<|skeleton|> class Solution: def reverse_v1(self, s): """A simple implementation that needs a stack. Complexity O(n). This method needs extra space (a stack). It also needs to check each character twice if it is special. :param s: The input string""" <|body_0|> def reverse_v2(self, s): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def reverse_v1(self, s): """A simple implementation that needs a stack. Complexity O(n). This method needs extra space (a stack). It also needs to check each character twice if it is special. :param s: The input string""" normal_list = list() output_list = list() for ...
the_stack_v2_python_sparse
python3/string_array/reverse_only_letters.py
victorchu/algorithms
train
0
b7a43631001d26eae5dfcd85b77b0028be6824eb
[ "me = request.me\ndata = {'content': request.data.get('content') or '', 'avatars': request.data.get('avatars') or '[]'}\nchecker = IdeaChecker(data=data)\nchecker.is_valid()\nif checker.errors:\n return self.error(errorcode.MSG_INVALID_DATA, errorcode.INVALID_DATA)\ntry:\n idea = Idea.objects.create(author=me...
<|body_start_0|> me = request.me data = {'content': request.data.get('content') or '', 'avatars': request.data.get('avatars') or '[]'} checker = IdeaChecker(data=data) checker.is_valid() if checker.errors: return self.error(errorcode.MSG_INVALID_DATA, errorcode.INVALI...
IdeaView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IdeaView: def post(self, request): """写想法""" <|body_0|> def get(self, request): """查看某人的想法,必须登录,可分页""" <|body_1|> <|end_skeleton|> <|body_start_0|> me = request.me data = {'content': request.data.get('content') or '', 'avatars': request.data...
stack_v2_sparse_classes_75kplus_train_005525
1,440
no_license
[ { "docstring": "写想法", "name": "post", "signature": "def post(self, request)" }, { "docstring": "查看某人的想法,必须登录,可分页", "name": "get", "signature": "def get(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_049784
Implement the Python class `IdeaView` described below. Class description: Implement the IdeaView class. Method signatures and docstrings: - def post(self, request): 写想法 - def get(self, request): 查看某人的想法,必须登录,可分页
Implement the Python class `IdeaView` described below. Class description: Implement the IdeaView class. Method signatures and docstrings: - def post(self, request): 写想法 - def get(self, request): 查看某人的想法,必须登录,可分页 <|skeleton|> class IdeaView: def post(self, request): """写想法""" <|body_0|> def ...
6a68fb207f43e5ed65299cc08535b35d5e934ead
<|skeleton|> class IdeaView: def post(self, request): """写想法""" <|body_0|> def get(self, request): """查看某人的想法,必须登录,可分页""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IdeaView: def post(self, request): """写想法""" me = request.me data = {'content': request.data.get('content') or '', 'avatars': request.data.get('avatars') or '[]'} checker = IdeaChecker(data=data) checker.is_valid() if checker.errors: return self.erro...
the_stack_v2_python_sparse
apps/pins/views.py
Slowhalfframe/fanyijiang-API
train
0
9f40c0604fb3c414c2d6212d4d14642c84036709
[ "self.id = id\nself.amount = amount\nself.account_id = account_id\nself.customer_id = customer_id\nself.status = status\nself.description = description\nself.memo = memo\nself.posted_date = posted_date\nself.transaction_date = transaction_date\nself.created_date = created_date\nself.mtype = mtype\nself.check_num = ...
<|body_start_0|> self.id = id self.amount = amount self.account_id = account_id self.customer_id = customer_id self.status = status self.description = description self.memo = memo self.posted_date = posted_date self.transaction_date = transaction_d...
Implementation of the 'Transaction' model. TODO: type model description here. Attributes: id (long|int): The Finicity ID of the transaction amount (float): The total amount of the transaction. Transactions for deposits are positive values, withdrawals and debits are negative values. account_id (long|int): The Finicity ...
Transaction
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Transaction: """Implementation of the 'Transaction' model. TODO: type model description here. Attributes: id (long|int): The Finicity ID of the transaction amount (float): The total amount of the transaction. Transactions for deposits are positive values, withdrawals and debits are negative value...
stack_v2_sparse_classes_75kplus_train_005526
7,931
permissive
[ { "docstring": "Constructor for the Transaction class", "name": "__init__", "signature": "def __init__(self, id=None, amount=None, account_id=None, customer_id=None, status=None, description=None, posted_date=None, created_date=None, memo=None, transaction_date=None, mtype=None, check_num=None, escrow_a...
2
null
Implement the Python class `Transaction` described below. Class description: Implementation of the 'Transaction' model. TODO: type model description here. Attributes: id (long|int): The Finicity ID of the transaction amount (float): The total amount of the transaction. Transactions for deposits are positive values, wi...
Implement the Python class `Transaction` described below. Class description: Implementation of the 'Transaction' model. TODO: type model description here. Attributes: id (long|int): The Finicity ID of the transaction amount (float): The total amount of the transaction. Transactions for deposits are positive values, wi...
b2ab1ded435db75c78d42261f5e4acd2a3061487
<|skeleton|> class Transaction: """Implementation of the 'Transaction' model. TODO: type model description here. Attributes: id (long|int): The Finicity ID of the transaction amount (float): The total amount of the transaction. Transactions for deposits are positive values, withdrawals and debits are negative value...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Transaction: """Implementation of the 'Transaction' model. TODO: type model description here. Attributes: id (long|int): The Finicity ID of the transaction amount (float): The total amount of the transaction. Transactions for deposits are positive values, withdrawals and debits are negative values. account_id...
the_stack_v2_python_sparse
finicityapi/models/transaction.py
monarchmoney/finicity-python
train
0
3e18e9ca5fce435798621d717e44599cb0102bfc
[ "global guessHistory, clueHistory\npopulateSecretSpace()\nsecret = makeSecret(player1)\nguessHistory = []\nclueHistory = []\nprint('Secret', secret, end='. ')\nwhile True:\n if player2 == 'human':\n guess = getHumanGuess()\n elif player2 == 'randomPlayer':\n guess = makeSecret('computer')\n e...
<|body_start_0|> global guessHistory, clueHistory populateSecretSpace() secret = makeSecret(player1) guessHistory = [] clueHistory = [] print('Secret', secret, end='. ') while True: if player2 == 'human': guess = getHumanGuess() ...
Game
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Game: def playBagels(self, player1, player2): """Play a single game of bagels: i. create a secret three digit string ii. loop, getting a 3 digit guess from player2 on each iteration iii. for each guess, get the clues as a (f,p,b) tuple iv. for each guess, print the clues for player2 if p...
stack_v2_sparse_classes_75kplus_train_005527
6,273
no_license
[ { "docstring": "Play a single game of bagels: i. create a secret three digit string ii. loop, getting a 3 digit guess from player2 on each iteration iii. for each guess, get the clues as a (f,p,b) tuple iv. for each guess, print the clues for player2 if player2 is human iii. maintain global guessHistory and clu...
2
stack_v2_sparse_classes_30k_train_001721
Implement the Python class `Game` described below. Class description: Implement the Game class. Method signatures and docstrings: - def playBagels(self, player1, player2): Play a single game of bagels: i. create a secret three digit string ii. loop, getting a 3 digit guess from player2 on each iteration iii. for each...
Implement the Python class `Game` described below. Class description: Implement the Game class. Method signatures and docstrings: - def playBagels(self, player1, player2): Play a single game of bagels: i. create a secret three digit string ii. loop, getting a 3 digit guess from player2 on each iteration iii. for each...
bdc54979f91bce6d74fcab78e0f05b95545f6930
<|skeleton|> class Game: def playBagels(self, player1, player2): """Play a single game of bagels: i. create a secret three digit string ii. loop, getting a 3 digit guess from player2 on each iteration iii. for each guess, get the clues as a (f,p,b) tuple iv. for each guess, print the clues for player2 if p...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Game: def playBagels(self, player1, player2): """Play a single game of bagels: i. create a secret three digit string ii. loop, getting a 3 digit guess from player2 on each iteration iii. for each guess, get the clues as a (f,p,b) tuple iv. for each guess, print the clues for player2 if player2 is huma...
the_stack_v2_python_sparse
HW16_AbrarRouf.py
Cloud-IV/CS100-Programs
train
0
63e118d83a87492d60981f0830300502d965b495
[ "self.partition_id = partition_id\nself.offset = offset\nself.sequence_number = sequence_number", "self.partition_id = checkpoint.partition_id\nself.offset = checkpoint.offset\nself.sequence_number = checkpoint.sequence_number" ]
<|body_start_0|> self.partition_id = partition_id self.offset = offset self.sequence_number = sequence_number <|end_body_0|> <|body_start_1|> self.partition_id = checkpoint.partition_id self.offset = checkpoint.offset self.sequence_number = checkpoint.sequence_number <|e...
Contains checkpoint metadata.
Checkpoint
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Checkpoint: """Contains checkpoint metadata.""" def __init__(self, partition_id, offset='-1', sequence_number='0'): """Initialize Checkpoint. :param partition_id: The parition ID of the checkpoint. :type partition_id: str :param offset: The receive offset of the checkpoint. :type off...
stack_v2_sparse_classes_75kplus_train_005528
1,330
permissive
[ { "docstring": "Initialize Checkpoint. :param partition_id: The parition ID of the checkpoint. :type partition_id: str :param offset: The receive offset of the checkpoint. :type offset: str :param sequence_number: The sequence number of the checkpoint. :type sequence_number: str", "name": "__init__", "s...
2
null
Implement the Python class `Checkpoint` described below. Class description: Contains checkpoint metadata. Method signatures and docstrings: - def __init__(self, partition_id, offset='-1', sequence_number='0'): Initialize Checkpoint. :param partition_id: The parition ID of the checkpoint. :type partition_id: str :para...
Implement the Python class `Checkpoint` described below. Class description: Contains checkpoint metadata. Method signatures and docstrings: - def __init__(self, partition_id, offset='-1', sequence_number='0'): Initialize Checkpoint. :param partition_id: The parition ID of the checkpoint. :type partition_id: str :para...
326f772f5cbe3d3eaf68b24485554aada463430a
<|skeleton|> class Checkpoint: """Contains checkpoint metadata.""" def __init__(self, partition_id, offset='-1', sequence_number='0'): """Initialize Checkpoint. :param partition_id: The parition ID of the checkpoint. :type partition_id: str :param offset: The receive offset of the checkpoint. :type off...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Checkpoint: """Contains checkpoint metadata.""" def __init__(self, partition_id, offset='-1', sequence_number='0'): """Initialize Checkpoint. :param partition_id: The parition ID of the checkpoint. :type partition_id: str :param offset: The receive offset of the checkpoint. :type offset: str :par...
the_stack_v2_python_sparse
azure/eventprocessorhost/checkpoint.py
Azure/azure-event-hubs-python
train
65
88f9b0618788c39b546d35a838890a1ad5d2d30b
[ "for i in range(1, len(A)):\n if A[i] < A[i - 1]:\n return i - 1", "l, h = (0, len(A) - 1)\nwhile l < h:\n m = (l + h) / 2\n if A[m] > A[m + 1]:\n h = m\n else:\n l = m + 1\nreturn l" ]
<|body_start_0|> for i in range(1, len(A)): if A[i] < A[i - 1]: return i - 1 <|end_body_0|> <|body_start_1|> l, h = (0, len(A) - 1) while l < h: m = (l + h) / 2 if A[m] > A[m + 1]: h = m else: l = m ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def peakIndexInMountainArray(self, A): """:type A: List[int] :rtype: int""" <|body_0|> def rewrite_BinarySearch(self, A): """Better solution, O(log(N))""" <|body_1|> <|end_skeleton|> <|body_start_0|> for i in range(1, len(A)): ...
stack_v2_sparse_classes_75kplus_train_005529
1,299
no_license
[ { "docstring": ":type A: List[int] :rtype: int", "name": "peakIndexInMountainArray", "signature": "def peakIndexInMountainArray(self, A)" }, { "docstring": "Better solution, O(log(N))", "name": "rewrite_BinarySearch", "signature": "def rewrite_BinarySearch(self, A)" } ]
2
stack_v2_sparse_classes_30k_test_001096
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def peakIndexInMountainArray(self, A): :type A: List[int] :rtype: int - def rewrite_BinarySearch(self, A): Better solution, O(log(N))
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def peakIndexInMountainArray(self, A): :type A: List[int] :rtype: int - def rewrite_BinarySearch(self, A): Better solution, O(log(N)) <|skeleton|> class Solution: def peakI...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def peakIndexInMountainArray(self, A): """:type A: List[int] :rtype: int""" <|body_0|> def rewrite_BinarySearch(self, A): """Better solution, O(log(N))""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def peakIndexInMountainArray(self, A): """:type A: List[int] :rtype: int""" for i in range(1, len(A)): if A[i] < A[i - 1]: return i - 1 def rewrite_BinarySearch(self, A): """Better solution, O(log(N))""" l, h = (0, len(A) - 1) ...
the_stack_v2_python_sparse
co_fb/852_Peak_Index_in_a_Mountain_Array.py
vsdrun/lc_public
train
6
cc0b6cad0ab1c6dbf319ff15aeb8925cd015c7b4
[ "conn, cursor = get_db_cursor()\nbuild = 'toy_build'\ntranscript_dict = init_refs.make_transcript_dict(cursor, build)\nconn.close()\nedges = frozenset({1, 3, 4, 5})\ngene_ID, transcript = talon.search_for_transcript(edges, transcript_dict)\nassert gene_ID == None\nassert transcript == None", "conn, cursor = get_d...
<|body_start_0|> conn, cursor = get_db_cursor() build = 'toy_build' transcript_dict = init_refs.make_transcript_dict(cursor, build) conn.close() edges = frozenset({1, 3, 4, 5}) gene_ID, transcript = talon.search_for_transcript(edges, transcript_dict) assert gene_I...
TestSearchForTranscript
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSearchForTranscript: def test_find_no_match(self): """Example where the toy transcript database contains no matches for the edge set.""" <|body_0|> def test_find_match(self): """Example where the toy transcript database contains exactly one match for the transcri...
stack_v2_sparse_classes_75kplus_train_005530
1,481
permissive
[ { "docstring": "Example where the toy transcript database contains no matches for the edge set.", "name": "test_find_no_match", "signature": "def test_find_no_match(self)" }, { "docstring": "Example where the toy transcript database contains exactly one match for the transcript.", "name": "t...
2
stack_v2_sparse_classes_30k_train_001273
Implement the Python class `TestSearchForTranscript` described below. Class description: Implement the TestSearchForTranscript class. Method signatures and docstrings: - def test_find_no_match(self): Example where the toy transcript database contains no matches for the edge set. - def test_find_match(self): Example w...
Implement the Python class `TestSearchForTranscript` described below. Class description: Implement the TestSearchForTranscript class. Method signatures and docstrings: - def test_find_no_match(self): Example where the toy transcript database contains no matches for the edge set. - def test_find_match(self): Example w...
8014faed5f982e5e106ec05239e47d65878e76c3
<|skeleton|> class TestSearchForTranscript: def test_find_no_match(self): """Example where the toy transcript database contains no matches for the edge set.""" <|body_0|> def test_find_match(self): """Example where the toy transcript database contains exactly one match for the transcri...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestSearchForTranscript: def test_find_no_match(self): """Example where the toy transcript database contains no matches for the edge set.""" conn, cursor = get_db_cursor() build = 'toy_build' transcript_dict = init_refs.make_transcript_dict(cursor, build) conn.close() ...
the_stack_v2_python_sparse
testing_suite/test_search_for_transcript.py
kopardev/TALON
train
0
dac4788e378b440d069141a83a1f3bfbb19f9363
[ "super().__init__()\nself.layers = nn.ModuleList()\nself.layers.append(rnn_cells.ConvGRUCell(in_channels, hidden_channels, conv_dim=2, kernel_size=3, dilation=1, bias=False))\nfor _ in range(n_convs):\n self.layers.append(conv_layers.ConvNonlinear(hidden_channels, hidden_channels, conv_dim=2, kernel_size=3, dila...
<|body_start_0|> super().__init__() self.layers = nn.ModuleList() self.layers.append(rnn_cells.ConvGRUCell(in_channels, hidden_channels, conv_dim=2, kernel_size=3, dilation=1, bias=False)) for _ in range(n_convs): self.layers.append(conv_layers.ConvNonlinear(hidden_channels, ...
Implementation of a GRU followed by a number of 2D convolutions inspired by [1]_. References ---------- .. [1] C. Qin, J. Schlemper, J. Caballero, A. N. Price, J. V. Hajnal and D. Rueckert, "Convolutional Recurrent Neural Networks for Dynamic MR Image Reconstruction," in IEEE Transactions on Medical Imaging, vol. 38, n...
GRUConv2d
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GRUConv2d: """Implementation of a GRU followed by a number of 2D convolutions inspired by [1]_. References ---------- .. [1] C. Qin, J. Schlemper, J. Caballero, A. N. Price, J. V. Hajnal and D. Rueckert, "Convolutional Recurrent Neural Networks for Dynamic MR Image Reconstruction," in IEEE Transa...
stack_v2_sparse_classes_75kplus_train_005531
3,131
permissive
[ { "docstring": "Inits Conv2d. Parameters ---------- in_channels: Number of input channels. int out_channels: Number of output channels. int hidden_channels: Number of hidden channels. int n_convs: Number of convolutional layers. int activation: Activation function. torch.nn.Module batchnorm: If True a batch nor...
2
stack_v2_sparse_classes_30k_train_012671
Implement the Python class `GRUConv2d` described below. Class description: Implementation of a GRU followed by a number of 2D convolutions inspired by [1]_. References ---------- .. [1] C. Qin, J. Schlemper, J. Caballero, A. N. Price, J. V. Hajnal and D. Rueckert, "Convolutional Recurrent Neural Networks for Dynamic M...
Implement the Python class `GRUConv2d` described below. Class description: Implementation of a GRU followed by a number of 2D convolutions inspired by [1]_. References ---------- .. [1] C. Qin, J. Schlemper, J. Caballero, A. N. Price, J. V. Hajnal and D. Rueckert, "Convolutional Recurrent Neural Networks for Dynamic M...
6d15dd55ca5ed6fc9fbfd31d8488ee7bab453066
<|skeleton|> class GRUConv2d: """Implementation of a GRU followed by a number of 2D convolutions inspired by [1]_. References ---------- .. [1] C. Qin, J. Schlemper, J. Caballero, A. N. Price, J. V. Hajnal and D. Rueckert, "Convolutional Recurrent Neural Networks for Dynamic MR Image Reconstruction," in IEEE Transa...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GRUConv2d: """Implementation of a GRU followed by a number of 2D convolutions inspired by [1]_. References ---------- .. [1] C. Qin, J. Schlemper, J. Caballero, A. N. Price, J. V. Hajnal and D. Rueckert, "Convolutional Recurrent Neural Networks for Dynamic MR Image Reconstruction," in IEEE Transactions on Med...
the_stack_v2_python_sparse
mridc/collections/reconstruction/models/conv/gruconv2d.py
wdika/mridc
train
40
a60711a7d4477f72c22695b57ddd9e31403a92c4
[ "self.screen_width = 800\nself.screen_height = 600\nself.bg_color = (30, 30, 30)\nself.ship_limit = 3\nself.ship_slow_speed_factor = 1 / 7\nself.bullet_width = 1\nself.bullet_height = 30\nself.bullet_color = (255, 255, 0)\nself.speedup_scale = 1.01\nself.score_scale = 1.5\nself.yellow_prob = 20.0\nself.red_prob = s...
<|body_start_0|> self.screen_width = 800 self.screen_height = 600 self.bg_color = (30, 30, 30) self.ship_limit = 3 self.ship_slow_speed_factor = 1 / 7 self.bullet_width = 1 self.bullet_height = 30 self.bullet_color = (255, 255, 0) self.speedup_scal...
A class to store all settings for Alien Invasion.
Settings
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Settings: """A class to store all settings for Alien Invasion.""" def __init__(self): """Initialize the game's static settings.""" <|body_0|> def initialize_dynamic_settings(self): """Initialize settings that change throughout the game.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_005532
2,834
no_license
[ { "docstring": "Initialize the game's static settings.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Initialize settings that change throughout the game.", "name": "initialize_dynamic_settings", "signature": "def initialize_dynamic_settings(self)" }, { ...
3
stack_v2_sparse_classes_30k_train_026786
Implement the Python class `Settings` described below. Class description: A class to store all settings for Alien Invasion. Method signatures and docstrings: - def __init__(self): Initialize the game's static settings. - def initialize_dynamic_settings(self): Initialize settings that change throughout the game. - def...
Implement the Python class `Settings` described below. Class description: A class to store all settings for Alien Invasion. Method signatures and docstrings: - def __init__(self): Initialize the game's static settings. - def initialize_dynamic_settings(self): Initialize settings that change throughout the game. - def...
61d8a85c33f54cd138c94433f062b74d396cc57f
<|skeleton|> class Settings: """A class to store all settings for Alien Invasion.""" def __init__(self): """Initialize the game's static settings.""" <|body_0|> def initialize_dynamic_settings(self): """Initialize settings that change throughout the game.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Settings: """A class to store all settings for Alien Invasion.""" def __init__(self): """Initialize the game's static settings.""" self.screen_width = 800 self.screen_height = 600 self.bg_color = (30, 30, 30) self.ship_limit = 3 self.ship_slow_speed_factor ...
the_stack_v2_python_sparse
settings.py
JankaGramofonomanka/alien_invasion
train
0
8b49d0aff9689bdd4a533f118287fd64aa426859
[ "m = len(matrix)\nn = len(matrix[0])\nlow = 0\nhigh = m * n - 1\nwhile low <= high:\n mid = (low + high) // 2\n if matrix[mid // n][mid % n] > target:\n high = mid - 1\n elif matrix[mid // n][mid % n] < target:\n low = mid + 1\n else:\n return True\nreturn False", "m = len(matrix)...
<|body_start_0|> m = len(matrix) n = len(matrix[0]) low = 0 high = m * n - 1 while low <= high: mid = (low + high) // 2 if matrix[mid // n][mid % n] > target: high = mid - 1 elif matrix[mid // n][mid % n] < target: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def searchMatrix74(self, matrix: List[List[int]], target: int) -> bool: """74. 搜索二维矩阵 行升序,每行的第一个整数大于前一行的最后一个整数 映射为一个升序数组,一次二分查找""" <|body_0|> def searchMatrix(self, matrix: List[List[int]], target: int) -> bool: """240. 搜索二维矩阵 II 行升序,列升序 从左下角开始遍历""" ...
stack_v2_sparse_classes_75kplus_train_005533
3,089
no_license
[ { "docstring": "74. 搜索二维矩阵 行升序,每行的第一个整数大于前一行的最后一个整数 映射为一个升序数组,一次二分查找", "name": "searchMatrix74", "signature": "def searchMatrix74(self, matrix: List[List[int]], target: int) -> bool" }, { "docstring": "240. 搜索二维矩阵 II 行升序,列升序 从左下角开始遍历", "name": "searchMatrix", "signature": "def searchMatr...
3
stack_v2_sparse_classes_30k_train_043220
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchMatrix74(self, matrix: List[List[int]], target: int) -> bool: 74. 搜索二维矩阵 行升序,每行的第一个整数大于前一行的最后一个整数 映射为一个升序数组,一次二分查找 - def searchMatrix(self, matrix: List[List[int]], tar...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchMatrix74(self, matrix: List[List[int]], target: int) -> bool: 74. 搜索二维矩阵 行升序,每行的第一个整数大于前一行的最后一个整数 映射为一个升序数组,一次二分查找 - def searchMatrix(self, matrix: List[List[int]], tar...
3fd69b85f52af861ff7e2c74d8aacc515b192615
<|skeleton|> class Solution: def searchMatrix74(self, matrix: List[List[int]], target: int) -> bool: """74. 搜索二维矩阵 行升序,每行的第一个整数大于前一行的最后一个整数 映射为一个升序数组,一次二分查找""" <|body_0|> def searchMatrix(self, matrix: List[List[int]], target: int) -> bool: """240. 搜索二维矩阵 II 行升序,列升序 从左下角开始遍历""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def searchMatrix74(self, matrix: List[List[int]], target: int) -> bool: """74. 搜索二维矩阵 行升序,每行的第一个整数大于前一行的最后一个整数 映射为一个升序数组,一次二分查找""" m = len(matrix) n = len(matrix[0]) low = 0 high = m * n - 1 while low <= high: mid = (low + high) // 2 ...
the_stack_v2_python_sparse
Array/Array_search_74_240_81.py
helloprogram6/leetcode_Cookbook_python
train
0
31f6c28c88e442471e77b7d19190e82d032df494
[ "super(Molecule, self).__init__()\nself.mapper = mapper\nself.image = pygame.Surface((2 * sigma, 2 * sigma))\nself.image.fill(Color.WHITE.value)\nself.image.set_colorkey(Color.WHITE.value)\ncolor = Molecule.colors[np.random.randint(0, len(Molecule.colors))]\npygame.draw.circle(self.image, color.value, [sigma, sigma...
<|body_start_0|> super(Molecule, self).__init__() self.mapper = mapper self.image = pygame.Surface((2 * sigma, 2 * sigma)) self.image.fill(Color.WHITE.value) self.image.set_colorkey(Color.WHITE.value) color = Molecule.colors[np.random.randint(0, len(Molecule.colors))] ...
A visualization of a single molecule as pygame Sprite.
Molecule
[ "CC0-1.0", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Molecule: """A visualization of a single molecule as pygame Sprite.""" def __init__(self, mapper: CoordinateMapper2D, sigma: float, pos: np.ndarray): """Args: mapper (CoordinateMapper2D): An instance to use for position mapping. sigma (float): The radius of the molecule. pos (np.ndar...
stack_v2_sparse_classes_75kplus_train_005534
1,391
permissive
[ { "docstring": "Args: mapper (CoordinateMapper2D): An instance to use for position mapping. sigma (float): The radius of the molecule. pos (np.ndarray): An array with x-y coordinates to follow.", "name": "__init__", "signature": "def __init__(self, mapper: CoordinateMapper2D, sigma: float, pos: np.ndarr...
2
stack_v2_sparse_classes_30k_train_048451
Implement the Python class `Molecule` described below. Class description: A visualization of a single molecule as pygame Sprite. Method signatures and docstrings: - def __init__(self, mapper: CoordinateMapper2D, sigma: float, pos: np.ndarray): Args: mapper (CoordinateMapper2D): An instance to use for position mapping...
Implement the Python class `Molecule` described below. Class description: A visualization of a single molecule as pygame Sprite. Method signatures and docstrings: - def __init__(self, mapper: CoordinateMapper2D, sigma: float, pos: np.ndarray): Args: mapper (CoordinateMapper2D): An instance to use for position mapping...
40a37159ef03ca992558924c5b9cdbbfba9c5a85
<|skeleton|> class Molecule: """A visualization of a single molecule as pygame Sprite.""" def __init__(self, mapper: CoordinateMapper2D, sigma: float, pos: np.ndarray): """Args: mapper (CoordinateMapper2D): An instance to use for position mapping. sigma (float): The radius of the molecule. pos (np.ndar...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Molecule: """A visualization of a single molecule as pygame Sprite.""" def __init__(self, mapper: CoordinateMapper2D, sigma: float, pos: np.ndarray): """Args: mapper (CoordinateMapper2D): An instance to use for position mapping. sigma (float): The radius of the molecule. pos (np.ndarray): An arra...
the_stack_v2_python_sparse
model_and_simulate/molecular_dynamics/molecule_sprite.py
tomtuamnuq/model_and_simulate
train
1
787a1b61ae0bc890ca0772ea5aed183e4cbe89aa
[ "self.folder = folder\nself.subset = subset\nself.is_latin_required = is_latin_required\nif root:\n self.folder = os.path.join(root, self.folder)\nassert self.subset in ['train', 'val']\nif self.subset == 'train':\n for i in range(1, 9):\n assert os.path.exists(os.path.join(self.folder, f'ch8_training_...
<|body_start_0|> self.folder = folder self.subset = subset self.is_latin_required = is_latin_required if root: self.folder = os.path.join(root, self.folder) assert self.subset in ['train', 'val'] if self.subset == 'train': for i in range(1, 9): ...
Class for conversion of ICDAR2017 to TextOnlyCocoAnnotation.
ICDAR2017MLTDatasetConverter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ICDAR2017MLTDatasetConverter: """Class for conversion of ICDAR2017 to TextOnlyCocoAnnotation.""" def __init__(self, folder, subset, is_latin_required, root=''): """Converts ICDAR2017 MLT to TextOnlyCocoAnnotation :param folder: Folder with extracted zip archives containing images and...
stack_v2_sparse_classes_75kplus_train_005535
25,441
permissive
[ { "docstring": "Converts ICDAR2017 MLT to TextOnlyCocoAnnotation :param folder: Folder with extracted zip archives containing images and annotation. :param subset: 'train' or 'val' :param is_latin_required: if it is True than images that do not contain latin text will be filtered out.", "name": "__init__", ...
5
stack_v2_sparse_classes_30k_train_003015
Implement the Python class `ICDAR2017MLTDatasetConverter` described below. Class description: Class for conversion of ICDAR2017 to TextOnlyCocoAnnotation. Method signatures and docstrings: - def __init__(self, folder, subset, is_latin_required, root=''): Converts ICDAR2017 MLT to TextOnlyCocoAnnotation :param folder:...
Implement the Python class `ICDAR2017MLTDatasetConverter` described below. Class description: Class for conversion of ICDAR2017 to TextOnlyCocoAnnotation. Method signatures and docstrings: - def __init__(self, folder, subset, is_latin_required, root=''): Converts ICDAR2017 MLT to TextOnlyCocoAnnotation :param folder:...
c553a56088f0055baba838b68c9299e19683227e
<|skeleton|> class ICDAR2017MLTDatasetConverter: """Class for conversion of ICDAR2017 to TextOnlyCocoAnnotation.""" def __init__(self, folder, subset, is_latin_required, root=''): """Converts ICDAR2017 MLT to TextOnlyCocoAnnotation :param folder: Folder with extracted zip archives containing images and...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ICDAR2017MLTDatasetConverter: """Class for conversion of ICDAR2017 to TextOnlyCocoAnnotation.""" def __init__(self, folder, subset, is_latin_required, root=''): """Converts ICDAR2017 MLT to TextOnlyCocoAnnotation :param folder: Folder with extracted zip archives containing images and annotation. ...
the_stack_v2_python_sparse
pytorch_toolkit/text_spotting/text_spotting/datasets/datasets.py
DmitriySidnev/openvino_training_extensions
train
0
6074539fef26216668624232ee3b72edbf3000b1
[ "self.client = Client()\nwl = User(name='Will Larson')\nwl.save()\njb = User(name='Jack Bauer')\njb.save()\nbc = User(name='Bill Clinton')\nbc.save()\nPoll(question='Did you vote for me?', creator=bc).save()\nPoll(question='Am I human?', creator=jb).save()\nPoll(question='Are you still reading?', creator=wl).save()...
<|body_start_0|> self.client = Client() wl = User(name='Will Larson') wl.save() jb = User(name='Jack Bauer') jb.save() bc = User(name='Bill Clinton') bc.save() Poll(question='Did you vote for me?', creator=bc).save() Poll(question='Am I human?', cr...
Test the models contained in the 'core' app.
CoreModelTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CoreModelTest: """Test the models contained in the 'core' app.""" def setUp(self): """Populate test database with model instances.""" <|body_0|> def tearDown(self): """Depopulate created model instances from test database.""" <|body_1|> def test_poll...
stack_v2_sparse_classes_75kplus_train_005536
2,715
no_license
[ { "docstring": "Populate test database with model instances.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Depopulate created model instances from test database.", "name": "tearDown", "signature": "def tearDown(self)" }, { "docstring": "This is a test for t...
4
null
Implement the Python class `CoreModelTest` described below. Class description: Test the models contained in the 'core' app. Method signatures and docstrings: - def setUp(self): Populate test database with model instances. - def tearDown(self): Depopulate created model instances from test database. - def test_poll(sel...
Implement the Python class `CoreModelTest` described below. Class description: Test the models contained in the 'core' app. Method signatures and docstrings: - def setUp(self): Populate test database with model instances. - def tearDown(self): Depopulate created model instances from test database. - def test_poll(sel...
43188aca94813f59e3e5579eef75635c2f113fa9
<|skeleton|> class CoreModelTest: """Test the models contained in the 'core' app.""" def setUp(self): """Populate test database with model instances.""" <|body_0|> def tearDown(self): """Depopulate created model instances from test database.""" <|body_1|> def test_poll...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CoreModelTest: """Test the models contained in the 'core' app.""" def setUp(self): """Populate test database with model instances.""" self.client = Client() wl = User(name='Will Larson') wl.save() jb = User(name='Jack Bauer') jb.save() bc = User(nam...
the_stack_v2_python_sparse
polling/core/tests.py
jsheffie/reading-django
train
0
ab7da8decd715ab3c38cd7e7c83c8fd3e9412efe
[ "length = len(nums)\ndp = [0] * length\ndp[0] = nums[0]\nfor i in range(1, length):\n dp[i] = max(dp[i - 1] + nums[i], nums[i])\nreturn max(dp)", "length = len(nums)\nprev = nums[0]\nresult = nums[0]\nfor i in range(1, length):\n best = max(prev + nums[i], nums[i])\n result = max(best, result)\n prev ...
<|body_start_0|> length = len(nums) dp = [0] * length dp[0] = nums[0] for i in range(1, length): dp[i] = max(dp[i - 1] + nums[i], nums[i]) return max(dp) <|end_body_0|> <|body_start_1|> length = len(nums) prev = nums[0] result = nums[0] ...
O(n) time, O(n) space -- one pass thru nums and one pass thru dp + store the dp results in an array This becomes clear when you see an example: input: [-2,1,-3,4,-1,2,1,-5,4] output: [-2, 0, 0, 0, 0, 0, 0, 0, 0] [-2, 1, 0, 0, 0, 0, 0, 0, 0] [-2, 1, -2, 0, 0, 0, 0, 0, 0] [-2, 1, -2, 4, 0, 0, 0, 0, 0] [-2, 1, -2, 4, 3, 0...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """O(n) time, O(n) space -- one pass thru nums and one pass thru dp + store the dp results in an array This becomes clear when you see an example: input: [-2,1,-3,4,-1,2,1,-5,4] output: [-2, 0, 0, 0, 0, 0, 0, 0, 0] [-2, 1, 0, 0, 0, 0, 0, 0, 0] [-2, 1, -2, 0, 0, 0, 0, 0, 0] [-2, 1, -2, 4...
stack_v2_sparse_classes_75kplus_train_005537
1,864
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "maxSubArray", "signature": "def maxSubArray(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "maxSubArray", "signature": "def maxSubArray(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: O(n) time, O(n) space -- one pass thru nums and one pass thru dp + store the dp results in an array This becomes clear when you see an example: input: [-2,1,-3,4,-1,2,1,-5,4] output: [-2, 0, 0, 0, 0, 0, 0, 0, 0] [-2, 1, 0, 0, 0, 0, 0, 0, 0] [-2,...
Implement the Python class `Solution` described below. Class description: O(n) time, O(n) space -- one pass thru nums and one pass thru dp + store the dp results in an array This becomes clear when you see an example: input: [-2,1,-3,4,-1,2,1,-5,4] output: [-2, 0, 0, 0, 0, 0, 0, 0, 0] [-2, 1, 0, 0, 0, 0, 0, 0, 0] [-2,...
844f502da4d6fb9cd69cf0a1ef71da3385a4d2b4
<|skeleton|> class Solution: """O(n) time, O(n) space -- one pass thru nums and one pass thru dp + store the dp results in an array This becomes clear when you see an example: input: [-2,1,-3,4,-1,2,1,-5,4] output: [-2, 0, 0, 0, 0, 0, 0, 0, 0] [-2, 1, 0, 0, 0, 0, 0, 0, 0] [-2, 1, -2, 0, 0, 0, 0, 0, 0] [-2, 1, -2, 4...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: """O(n) time, O(n) space -- one pass thru nums and one pass thru dp + store the dp results in an array This becomes clear when you see an example: input: [-2,1,-3,4,-1,2,1,-5,4] output: [-2, 0, 0, 0, 0, 0, 0, 0, 0] [-2, 1, 0, 0, 0, 0, 0, 0, 0] [-2, 1, -2, 0, 0, 0, 0, 0, 0] [-2, 1, -2, 4, 0, 0, 0, 0,...
the_stack_v2_python_sparse
53-max_subarray.py
stevestar888/leetcode-problems
train
2
628b6d41a6c01b18d29a71ac0e0d7e6b780e8323
[ "super(BiLSTM, self).__init__()\nself.h_dim = h_dim\nself.o_dim = o_dim\nself.d_dim = d_dim\nself.r_dim = r_dim\nself.d_prob = d_prob\nself.num_layers = num_layers\nself.with_self_att = with_self_att\nself.embeddings = embeddings\nself.task = task\nself.replace_embeddings(concept_vocab_field, ref_vocab_field)\nself...
<|body_start_0|> super(BiLSTM, self).__init__() self.h_dim = h_dim self.o_dim = o_dim self.d_dim = d_dim self.r_dim = r_dim self.d_prob = d_prob self.num_layers = num_layers self.with_self_att = with_self_att self.embeddings = embeddings se...
Bidirectional LSTM with optional self attention.
BiLSTM
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BiLSTM: """Bidirectional LSTM with optional self attention.""" def __init__(self, h_dim, o_dim, d_prob, with_self_att, d_dim, r_dim, num_layers, embeddings, concept_vocab_field=None, ref_vocab_field=None, task=''): """@param h_dim (int): hidden dimension of LSTM @param o_dim (int): d...
stack_v2_sparse_classes_75kplus_train_005538
7,167
no_license
[ { "docstring": "@param h_dim (int): hidden dimension of LSTM @param o_dim (int): dimension of the outputted language representation @param d_prob (float): probability that an output value should be dropped out @param with_self_att (bool): whether to utilize self attention or not @param d_dim (int): d_dim for se...
3
stack_v2_sparse_classes_30k_train_015537
Implement the Python class `BiLSTM` described below. Class description: Bidirectional LSTM with optional self attention. Method signatures and docstrings: - def __init__(self, h_dim, o_dim, d_prob, with_self_att, d_dim, r_dim, num_layers, embeddings, concept_vocab_field=None, ref_vocab_field=None, task=''): @param h_...
Implement the Python class `BiLSTM` described below. Class description: Bidirectional LSTM with optional self attention. Method signatures and docstrings: - def __init__(self, h_dim, o_dim, d_prob, with_self_att, d_dim, r_dim, num_layers, embeddings, concept_vocab_field=None, ref_vocab_field=None, task=''): @param h_...
2dca3ba909078739b49468ea8b772f346710d60b
<|skeleton|> class BiLSTM: """Bidirectional LSTM with optional self attention.""" def __init__(self, h_dim, o_dim, d_prob, with_self_att, d_dim, r_dim, num_layers, embeddings, concept_vocab_field=None, ref_vocab_field=None, task=''): """@param h_dim (int): hidden dimension of LSTM @param o_dim (int): d...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BiLSTM: """Bidirectional LSTM with optional self attention.""" def __init__(self, h_dim, o_dim, d_prob, with_self_att, d_dim, r_dim, num_layers, embeddings, concept_vocab_field=None, ref_vocab_field=None, task=''): """@param h_dim (int): hidden dimension of LSTM @param o_dim (int): dimension of t...
the_stack_v2_python_sparse
models/student/lfl/language/bi_lstm.py
cocolab-projects/concept-captioning
train
0
170fa266b43c5d476390711b03c322341e98b2bb
[ "u = np.linalg.norm(x, 2)\nif u != 0:\n aux_b = x[0] + np.sign(x[0]) * u\n x = x[1:] / aux_b\n x = np.concatenate((np.array([1]), x))\nreturn x", "b = -2 / np.dot(v.T, v)\nw = b * np.dot(RA.T, v)\nw = w.reshape(1, -1)\nv = v.reshape(-1, 1)\nRA = RA + v * w\nB = RA\nreturn B" ]
<|body_start_0|> u = np.linalg.norm(x, 2) if u != 0: aux_b = x[0] + np.sign(x[0]) * u x = x[1:] / aux_b x = np.concatenate((np.array([1]), x)) return x <|end_body_0|> <|body_start_1|> b = -2 / np.dot(v.T, v) w = b * np.dot(RA.T, v) w =...
Householder reflection and transformation.
Orthogonalization
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Orthogonalization: """Householder reflection and transformation.""" def house(self, x): """Perform a Householder reflection of vector. Parameters ---------- x : array-like of shape = number_of_training_samples The respective column of the matrix of regressors in each iteration of ERR...
stack_v2_sparse_classes_75kplus_train_005539
34,366
permissive
[ { "docstring": "Perform a Householder reflection of vector. Parameters ---------- x : array-like of shape = number_of_training_samples The respective column of the matrix of regressors in each iteration of ERR function. Returns ------- v : array-like of shape = number_of_training_samples The reflection of the a...
2
stack_v2_sparse_classes_30k_train_016275
Implement the Python class `Orthogonalization` described below. Class description: Householder reflection and transformation. Method signatures and docstrings: - def house(self, x): Perform a Householder reflection of vector. Parameters ---------- x : array-like of shape = number_of_training_samples The respective co...
Implement the Python class `Orthogonalization` described below. Class description: Householder reflection and transformation. Method signatures and docstrings: - def house(self, x): Perform a Householder reflection of vector. Parameters ---------- x : array-like of shape = number_of_training_samples The respective co...
736d9193a325d6251bd6e8e728b66ec76ba3d42d
<|skeleton|> class Orthogonalization: """Householder reflection and transformation.""" def house(self, x): """Perform a Householder reflection of vector. Parameters ---------- x : array-like of shape = number_of_training_samples The respective column of the matrix of regressors in each iteration of ERR...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Orthogonalization: """Householder reflection and transformation.""" def house(self, x): """Perform a Householder reflection of vector. Parameters ---------- x : array-like of shape = number_of_training_samples The respective column of the matrix of regressors in each iteration of ERR function. Re...
the_stack_v2_python_sparse
sysidentpy/narmax_base.py
wilsonrljr/sysidentpy
train
251
a1deea5eb284450427699aa57fa98c4adfa4b057
[ "super(InterfaceShellTransformer, self).__init__(*args, **kwds)\nself.temporary_objects = set()\nself._sage_import_re = re.compile('(?:sage|%s)\\\\((.*?)\\\\)' % self.shell.interface.name())", "for sage_code in self._sage_import_re.findall(line):\n expr = preparse(sage_code)\n result = self.shell.interface(...
<|body_start_0|> super(InterfaceShellTransformer, self).__init__(*args, **kwds) self.temporary_objects = set() self._sage_import_re = re.compile('(?:sage|%s)\\((.*?)\\)' % self.shell.interface.name()) <|end_body_0|> <|body_start_1|> for sage_code in self._sage_import_re.findall(line): ...
InterfaceShellTransformer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InterfaceShellTransformer: def __init__(self, *args, **kwds): """Initialize this class. All of the arguments get passed to :meth:`PrefilterTransformer.__init__`. .. attribute:: temporary_objects a list of hold onto interface objects and keep them from being garbage collected .. seealso::...
stack_v2_sparse_classes_75kplus_train_005540
26,687
no_license
[ { "docstring": "Initialize this class. All of the arguments get passed to :meth:`PrefilterTransformer.__init__`. .. attribute:: temporary_objects a list of hold onto interface objects and keep them from being garbage collected .. seealso:: :func:`interface_shell_embed` EXAMPLES:: sage: from sage.repl.interprete...
3
null
Implement the Python class `InterfaceShellTransformer` described below. Class description: Implement the InterfaceShellTransformer class. Method signatures and docstrings: - def __init__(self, *args, **kwds): Initialize this class. All of the arguments get passed to :meth:`PrefilterTransformer.__init__`. .. attribute...
Implement the Python class `InterfaceShellTransformer` described below. Class description: Implement the InterfaceShellTransformer class. Method signatures and docstrings: - def __init__(self, *args, **kwds): Initialize this class. All of the arguments get passed to :meth:`PrefilterTransformer.__init__`. .. attribute...
0d9eacbf74e2acffefde93e39f8bcbec745cdaba
<|skeleton|> class InterfaceShellTransformer: def __init__(self, *args, **kwds): """Initialize this class. All of the arguments get passed to :meth:`PrefilterTransformer.__init__`. .. attribute:: temporary_objects a list of hold onto interface objects and keep them from being garbage collected .. seealso::...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InterfaceShellTransformer: def __init__(self, *args, **kwds): """Initialize this class. All of the arguments get passed to :meth:`PrefilterTransformer.__init__`. .. attribute:: temporary_objects a list of hold onto interface objects and keep them from being garbage collected .. seealso:: :func:`interf...
the_stack_v2_python_sparse
sage/src/sage/repl/interpreter.py
bopopescu/geosci
train
0
8474726da687e888727bddad7388bf1d9ea427e0
[ "if not username:\n raise ValueError('Users must have an username')\nuser = self.model(username=username, email=email)\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user", "user = self.create_user(username, password=password, email=email)\nuser.is_admin = True\nuser.save(using=self._db)\nretu...
<|body_start_0|> if not username: raise ValueError('Users must have an username') user = self.model(username=username, email=email) user.set_password(password) user.save(using=self._db) return user <|end_body_0|> <|body_start_1|> user = self.create_user(usern...
MyUserManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyUserManager: def create_user(self, username, email, password=None): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, username, email, password): """Creates and saves a superuser with the given em...
stack_v2_sparse_classes_75kplus_train_005541
15,956
no_license
[ { "docstring": "Creates and saves a User with the given email, date of birth and password.", "name": "create_user", "signature": "def create_user(self, username, email, password=None)" }, { "docstring": "Creates and saves a superuser with the given email, date of birth and password.", "name"...
2
stack_v2_sparse_classes_30k_train_005911
Implement the Python class `MyUserManager` described below. Class description: Implement the MyUserManager class. Method signatures and docstrings: - def create_user(self, username, email, password=None): Creates and saves a User with the given email, date of birth and password. - def create_superuser(self, username,...
Implement the Python class `MyUserManager` described below. Class description: Implement the MyUserManager class. Method signatures and docstrings: - def create_user(self, username, email, password=None): Creates and saves a User with the given email, date of birth and password. - def create_superuser(self, username,...
0d2117ec379a226143713c749f42fd4a30d961b4
<|skeleton|> class MyUserManager: def create_user(self, username, email, password=None): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, username, email, password): """Creates and saves a superuser with the given em...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MyUserManager: def create_user(self, username, email, password=None): """Creates and saves a User with the given email, date of birth and password.""" if not username: raise ValueError('Users must have an username') user = self.model(username=username, email=email) ...
the_stack_v2_python_sparse
model/models.py
owenpanqiufeng/UAVMonitoringSystem
train
0
c5c07fdb87f04aaeb008e3d02771d17ac3c3e1c0
[ "message = MIMEMultipart('alternative')\nmessage['Subject'] = self.message_subject\nmessage['From'] = self.mail_from_header\nmessage['To'] = self.mail_to_header\nmessage['Reply-To'] = self.message_reply_to\nif self.html_content:\n message.attach(MIMEText(self.html_content, 'html'))\nif self.text_content:\n me...
<|body_start_0|> message = MIMEMultipart('alternative') message['Subject'] = self.message_subject message['From'] = self.mail_from_header message['To'] = self.mail_to_header message['Reply-To'] = self.message_reply_to if self.html_content: message.attach(MIMET...
Mail smtp driver.
MailSmtpDriver
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MailSmtpDriver: """Mail smtp driver.""" def message(self): """Creates a message object for the underlying driver. Returns: email.mime.multipart.MIMEMultipart""" <|body_0|> def send(self, message=None, message_contents=None): """Send the message through SMTP. Keyw...
stack_v2_sparse_classes_75kplus_train_005542
3,884
permissive
[ { "docstring": "Creates a message object for the underlying driver. Returns: email.mime.multipart.MIMEMultipart", "name": "message", "signature": "def message(self)" }, { "docstring": "Send the message through SMTP. Keyword Arguments: message {string} -- The HTML message to be sent to SMTP. (def...
4
stack_v2_sparse_classes_30k_train_038041
Implement the Python class `MailSmtpDriver` described below. Class description: Mail smtp driver. Method signatures and docstrings: - def message(self): Creates a message object for the underlying driver. Returns: email.mime.multipart.MIMEMultipart - def send(self, message=None, message_contents=None): Send the messa...
Implement the Python class `MailSmtpDriver` described below. Class description: Mail smtp driver. Method signatures and docstrings: - def message(self): Creates a message object for the underlying driver. Returns: email.mime.multipart.MIMEMultipart - def send(self, message=None, message_contents=None): Send the messa...
66a6b1480a5771bbd1056ba59cec4014beb63fa8
<|skeleton|> class MailSmtpDriver: """Mail smtp driver.""" def message(self): """Creates a message object for the underlying driver. Returns: email.mime.multipart.MIMEMultipart""" <|body_0|> def send(self, message=None, message_contents=None): """Send the message through SMTP. Keyw...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MailSmtpDriver: """Mail smtp driver.""" def message(self): """Creates a message object for the underlying driver. Returns: email.mime.multipart.MIMEMultipart""" message = MIMEMultipart('alternative') message['Subject'] = self.message_subject message['From'] = self.mail_fro...
the_stack_v2_python_sparse
src/masonite/drivers/mail/MailSmtpDriver.py
angrycaptain19/masonite
train
0
fa3b85117481f1fc562ba7fc78809e7fb47410f0
[ "cal = Calendar()\ncal.add('version', '2.0')\ncal.add('calscale', 'GREGORIAN')\nfor ifield, efield in FEED_FIELD_MAP:\n val = self.feed.get(ifield)\n if val is not None:\n cal.add(efield, val)\nself.write_items(cal)\nto_ical = getattr(cal, 'as_string', None)\nif not to_ical:\n to_ical = cal.to_ical\...
<|body_start_0|> cal = Calendar() cal.add('version', '2.0') cal.add('calscale', 'GREGORIAN') for ifield, efield in FEED_FIELD_MAP: val = self.feed.get(ifield) if val is not None: cal.add(efield, val) self.write_items(cal) to_ical = ...
iCalendar 2.0 Feed implementation.
ICal20Feed
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ICal20Feed: """iCalendar 2.0 Feed implementation.""" def write(self, outfile, encoding): """Writes the feed to the specified file in the specified encoding.""" <|body_0|> def write_items(self, calendar): """Write all events to the calendar""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_005543
2,386
permissive
[ { "docstring": "Writes the feed to the specified file in the specified encoding.", "name": "write", "signature": "def write(self, outfile, encoding)" }, { "docstring": "Write all events to the calendar", "name": "write_items", "signature": "def write_items(self, calendar)" } ]
2
null
Implement the Python class `ICal20Feed` described below. Class description: iCalendar 2.0 Feed implementation. Method signatures and docstrings: - def write(self, outfile, encoding): Writes the feed to the specified file in the specified encoding. - def write_items(self, calendar): Write all events to the calendar
Implement the Python class `ICal20Feed` described below. Class description: iCalendar 2.0 Feed implementation. Method signatures and docstrings: - def write(self, outfile, encoding): Writes the feed to the specified file in the specified encoding. - def write_items(self, calendar): Write all events to the calendar <...
aeaa9b2cd83957aee9c9face8bda190f8007c5d6
<|skeleton|> class ICal20Feed: """iCalendar 2.0 Feed implementation.""" def write(self, outfile, encoding): """Writes the feed to the specified file in the specified encoding.""" <|body_0|> def write_items(self, calendar): """Write all events to the calendar""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ICal20Feed: """iCalendar 2.0 Feed implementation.""" def write(self, outfile, encoding): """Writes the feed to the specified file in the specified encoding.""" cal = Calendar() cal.add('version', '2.0') cal.add('calscale', 'GREGORIAN') for ifield, efield in FEED_FI...
the_stack_v2_python_sparse
django_ical/feedgenerator.py
zbvc382/absence-management-system
train
0
d2ba59450ffeaa5c58861076ccb13821ce534094
[ "if not root:\n return []\nself.res = []\nself._dfs(root, sum, [])\nreturn self.res", "path.append(root.val)\nsum -= root.val\nif sum == 0 and (not root.left) and (not root.right):\n self.res.append(path[:])\n path.pop()\n return\nif root.left:\n self._dfs(root.left, sum, path)\nif root.right:\n ...
<|body_start_0|> if not root: return [] self.res = [] self._dfs(root, sum, []) return self.res <|end_body_0|> <|body_start_1|> path.append(root.val) sum -= root.val if sum == 0 and (not root.left) and (not root.right): self.res.append(path...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def pathSum(self, root, sum): """Args: root: TreeNode sum: int Return: list[list[int]]""" <|body_0|> def _dfs(self, root, sum, path): """Args: root: TreeNode sum: int path: list[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not r...
stack_v2_sparse_classes_75kplus_train_005544
980
no_license
[ { "docstring": "Args: root: TreeNode sum: int Return: list[list[int]]", "name": "pathSum", "signature": "def pathSum(self, root, sum)" }, { "docstring": "Args: root: TreeNode sum: int path: list[int]", "name": "_dfs", "signature": "def _dfs(self, root, sum, path)" } ]
2
stack_v2_sparse_classes_30k_train_031273
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def pathSum(self, root, sum): Args: root: TreeNode sum: int Return: list[list[int]] - def _dfs(self, root, sum, path): Args: root: TreeNode sum: int path: list[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def pathSum(self, root, sum): Args: root: TreeNode sum: int Return: list[list[int]] - def _dfs(self, root, sum, path): Args: root: TreeNode sum: int path: list[int] <|skeleton|>...
101bce2fac8b188a4eb2f5e017293d21ad0ecb21
<|skeleton|> class Solution: def pathSum(self, root, sum): """Args: root: TreeNode sum: int Return: list[list[int]]""" <|body_0|> def _dfs(self, root, sum, path): """Args: root: TreeNode sum: int path: list[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def pathSum(self, root, sum): """Args: root: TreeNode sum: int Return: list[list[int]]""" if not root: return [] self.res = [] self._dfs(root, sum, []) return self.res def _dfs(self, root, sum, path): """Args: root: TreeNode sum: int p...
the_stack_v2_python_sparse
code/面试题34. 二叉树中和为某一值的路径.py
AiZhanghan/Leetcode
train
0
a50a1e9a6bcacc7b33623739f757255727749e44
[ "inner_text = '添加'\nselector = 'view.swiper-box>view>view.operation>view>text'\nel_swiper_item = self.page.get_element('view.page>swiper>swiper-item')\nel_videomy = el_swiper_item.get_element('videomy#video')\nel_videomy.click()\nself.page.sleep(1)\nel_btn = el_videomy.get_element(selector, inner_text=inner_text)\n...
<|body_start_0|> inner_text = '添加' selector = 'view.swiper-box>view>view.operation>view>text' el_swiper_item = self.page.get_element('view.page>swiper>swiper-item') el_videomy = el_swiper_item.get_element('videomy#video') el_videomy.click() self.page.sleep(1) el_b...
Elements
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Elements: def add_btn(self): """添加 按钮""" <|body_0|> def remove_btn(self): """删除 按钮""" <|body_1|> def clip_btn(self): """剪辑 按钮""" <|body_2|> def video_music_btn(self): """配音乐 按钮""" <|body_3|> def video_text_btn(se...
stack_v2_sparse_classes_75kplus_train_005545
5,000
no_license
[ { "docstring": "添加 按钮", "name": "add_btn", "signature": "def add_btn(self)" }, { "docstring": "删除 按钮", "name": "remove_btn", "signature": "def remove_btn(self)" }, { "docstring": "剪辑 按钮", "name": "clip_btn", "signature": "def clip_btn(self)" }, { "docstring": "配音乐...
6
stack_v2_sparse_classes_30k_train_048275
Implement the Python class `Elements` described below. Class description: Implement the Elements class. Method signatures and docstrings: - def add_btn(self): 添加 按钮 - def remove_btn(self): 删除 按钮 - def clip_btn(self): 剪辑 按钮 - def video_music_btn(self): 配音乐 按钮 - def video_text_btn(self): 配字幕 按钮 - def preview_btn(self):...
Implement the Python class `Elements` described below. Class description: Implement the Elements class. Method signatures and docstrings: - def add_btn(self): 添加 按钮 - def remove_btn(self): 删除 按钮 - def clip_btn(self): 剪辑 按钮 - def video_music_btn(self): 配音乐 按钮 - def video_text_btn(self): 配字幕 按钮 - def preview_btn(self):...
3011071556a3fa097d951a1823a4870cc4cc81e1
<|skeleton|> class Elements: def add_btn(self): """添加 按钮""" <|body_0|> def remove_btn(self): """删除 按钮""" <|body_1|> def clip_btn(self): """剪辑 按钮""" <|body_2|> def video_music_btn(self): """配音乐 按钮""" <|body_3|> def video_text_btn(se...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Elements: def add_btn(self): """添加 按钮""" inner_text = '添加' selector = 'view.swiper-box>view>view.operation>view>text' el_swiper_item = self.page.get_element('view.page>swiper>swiper-item') el_videomy = el_swiper_item.get_element('videomy#video') el_videomy.click...
the_stack_v2_python_sparse
sevenautotest/testobjects/pages/apppages/yy/clip_page.py
hotswwkyo/SevenPytest
train
3
d48c73c0b8c755384015fe0679034a0809251b4a
[ "dic, res = ({}, [])\nfor i in nums1:\n if i not in dic:\n dic[i] = 1\n else:\n dic[i] += 1\nfor i in nums2:\n if i in dic and dic[i] > 0:\n res.append(i)\n dic[i] -= 1\nreturn res", "nums1.sort()\nnums2.sort()\nif len(nums1) > len(nums2):\n nums1, nums2 = (nums2, nums1)\nr...
<|body_start_0|> dic, res = ({}, []) for i in nums1: if i not in dic: dic[i] = 1 else: dic[i] += 1 for i in nums2: if i in dic and dic[i] > 0: res.append(i) dic[i] -= 1 return res <|end_bo...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def intersect(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: List[int]""" <|body_0|> def intersect1(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: List[int]""" <|body_1|> def interse...
stack_v2_sparse_classes_75kplus_train_005546
1,824
no_license
[ { "docstring": ":type nums1: List[int] :type nums2: List[int] :rtype: List[int]", "name": "intersect", "signature": "def intersect(self, nums1, nums2)" }, { "docstring": ":type nums1: List[int] :type nums2: List[int] :rtype: List[int]", "name": "intersect1", "signature": "def intersect1(...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def intersect(self, nums1, nums2): :type nums1: List[int] :type nums2: List[int] :rtype: List[int] - def intersect1(self, nums1, nums2): :type nums1: List[int] :type nums2: List[...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def intersect(self, nums1, nums2): :type nums1: List[int] :type nums2: List[int] :rtype: List[int] - def intersect1(self, nums1, nums2): :type nums1: List[int] :type nums2: List[...
3ded7bd0f046e8f87c9b9b9bce81e52ab1bdcdac
<|skeleton|> class Solution: def intersect(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: List[int]""" <|body_0|> def intersect1(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: List[int]""" <|body_1|> def interse...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def intersect(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: List[int]""" dic, res = ({}, []) for i in nums1: if i not in dic: dic[i] = 1 else: dic[i] += 1 for i in nums2: ...
the_stack_v2_python_sparse
leetcode/arrays/intersection_of_two_arrays.py
JeanChrist/Algorithms
train
0
0800c4305b83ed8a597e5c257d6492c5ad238238
[ "self.space = space\nself.subspace = subspace\nmesh = space.mesh()\ndegree = space.ufl_element().degree()\nif space.ufl_element().sobolev_space().name != 'L2' or ((type(degree) is tuple and np.any([deg != 1 for deg in degree])) and degree != 1):\n raise ValueError('DG1 limiter can only be applied to DG1 space')\...
<|body_start_0|> self.space = space self.subspace = subspace mesh = space.mesh() degree = space.ufl_element().degree() if space.ufl_element().sobolev_space().name != 'L2' or ((type(degree) is tuple and np.any([deg != 1 for deg in degree])) and degree != 1): raise Valu...
A vertex-based limiter for the degree 1 discontinuous Galerkin space. A vertex based limiter for fields in the DG1 space. This wraps around the vertex-based limiter implemented in Firedrake, but ensures that this is done in the space using the appropriate "equispaced" elements.
DG1Limiter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DG1Limiter: """A vertex-based limiter for the degree 1 discontinuous Galerkin space. A vertex based limiter for fields in the DG1 space. This wraps around the vertex-based limiter implemented in Firedrake, but ensures that this is done in the space using the appropriate "equispaced" elements.""" ...
stack_v2_sparse_classes_75kplus_train_005547
7,242
permissive
[ { "docstring": "Args: space (:class:`FunctionSpace`): the space in which the transported variables lies. It should be the DG1 space, or a mixed function space containing the DG1 space. subspace (int, optional): specifies that the limiter works on this component of a :class:`MixedFunctionSpace`. Raises: ValueErr...
2
stack_v2_sparse_classes_30k_train_013197
Implement the Python class `DG1Limiter` described below. Class description: A vertex-based limiter for the degree 1 discontinuous Galerkin space. A vertex based limiter for fields in the DG1 space. This wraps around the vertex-based limiter implemented in Firedrake, but ensures that this is done in the space using the...
Implement the Python class `DG1Limiter` described below. Class description: A vertex-based limiter for the degree 1 discontinuous Galerkin space. A vertex based limiter for fields in the DG1 space. This wraps around the vertex-based limiter implemented in Firedrake, but ensures that this is done in the space using the...
ab93672a84d4a71019abad4249529403e4b0c8d7
<|skeleton|> class DG1Limiter: """A vertex-based limiter for the degree 1 discontinuous Galerkin space. A vertex based limiter for fields in the DG1 space. This wraps around the vertex-based limiter implemented in Firedrake, but ensures that this is done in the space using the appropriate "equispaced" elements.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DG1Limiter: """A vertex-based limiter for the degree 1 discontinuous Galerkin space. A vertex based limiter for fields in the DG1 space. This wraps around the vertex-based limiter implemented in Firedrake, but ensures that this is done in the space using the appropriate "equispaced" elements.""" def __in...
the_stack_v2_python_sparse
gusto/limiters.py
firedrakeproject/gusto
train
10
0fd2c0af6adb48c79a5fb871453019d21501c762
[ "self.pump = Pump('127.0.0.1', '8080')\nself.sensor = Sensor('127.0.0.1', '8081')\nself.decider = Decider(100, 0.1)\nself.controller = Controller(self.sensor, self.pump, self.decider)", "self.controller.pump.set_state = MagicMock(return_value=True)\nself.controller.decider.decide = MagicMock(return_value=True)\nf...
<|body_start_0|> self.pump = Pump('127.0.0.1', '8080') self.sensor = Sensor('127.0.0.1', '8081') self.decider = Decider(100, 0.1) self.controller = Controller(self.sensor, self.pump, self.decider) <|end_body_0|> <|body_start_1|> self.controller.pump.set_state = MagicMock(return_...
Module tests for the water-regulation module. 3 test methods define. Each sets limits for MagicMock used inside the method.
ModuleTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModuleTests: """Module tests for the water-regulation module. 3 test methods define. Each sets limits for MagicMock used inside the method.""" def setUp(self): """Setup for all 3 tests""" <|body_0|> def test_app_1(self): """Testing the app 1 :return:""" <...
stack_v2_sparse_classes_75kplus_train_005548
3,287
no_license
[ { "docstring": "Setup for all 3 tests", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Testing the app 1 :return:", "name": "test_app_1", "signature": "def test_app_1(self)" }, { "docstring": "Testing the app 2 :return:", "name": "test_app_2", "signatu...
4
null
Implement the Python class `ModuleTests` described below. Class description: Module tests for the water-regulation module. 3 test methods define. Each sets limits for MagicMock used inside the method. Method signatures and docstrings: - def setUp(self): Setup for all 3 tests - def test_app_1(self): Testing the app 1 ...
Implement the Python class `ModuleTests` described below. Class description: Module tests for the water-regulation module. 3 test methods define. Each sets limits for MagicMock used inside the method. Method signatures and docstrings: - def setUp(self): Setup for all 3 tests - def test_app_1(self): Testing the app 1 ...
b1fea0309b3495b3e1dc167d7029bc9e4b6f00f1
<|skeleton|> class ModuleTests: """Module tests for the water-regulation module. 3 test methods define. Each sets limits for MagicMock used inside the method.""" def setUp(self): """Setup for all 3 tests""" <|body_0|> def test_app_1(self): """Testing the app 1 :return:""" <...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ModuleTests: """Module tests for the water-regulation module. 3 test methods define. Each sets limits for MagicMock used inside the method.""" def setUp(self): """Setup for all 3 tests""" self.pump = Pump('127.0.0.1', '8080') self.sensor = Sensor('127.0.0.1', '8081') self....
the_stack_v2_python_sparse
students/Wieslaw_Pucilowski/Lesson06/water-regulation/waterregulation/integrationtest.py
UWPCE-PythonCert-ClassRepos/SP_Online_Course2_2018
train
4
33aeb53524132e3e81b43fd854f442af1cf8ce2b
[ "super().__init__(*args, **kwargs)\nself._callback_fn = callback_fn\nself._current_task_info = None", "task_name = task['name']\nif task_name == 'resource':\n return self._callback_fn['deal_with_resource']()\nelif task_name == 'collector_start_task':\n self._current_task_info = task['task_info']\n self._...
<|body_start_0|> super().__init__(*args, **kwargs) self._callback_fn = callback_fn self._current_task_info = None <|end_body_0|> <|body_start_1|> task_name = task['name'] if task_name == 'resource': return self._callback_fn['deal_with_resource']() elif task_n...
Overview: A slave, whose master is coordinator. Used to pass message between comm collector and coordinator. Interfaces: __init__, _process_task
CollectorSlave
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CollectorSlave: """Overview: A slave, whose master is coordinator. Used to pass message between comm collector and coordinator. Interfaces: __init__, _process_task""" def __init__(self, *args, callback_fn: Dict[str, Callable], **kwargs) -> None: """Overview: Init callback functions a...
stack_v2_sparse_classes_75kplus_train_005549
8,845
permissive
[ { "docstring": "Overview: Init callback functions additionally. Callback functions are methods in comm collector.", "name": "__init__", "signature": "def __init__(self, *args, callback_fn: Dict[str, Callable], **kwargs) -> None" }, { "docstring": "Overview: Process a task according to input task...
2
stack_v2_sparse_classes_30k_train_011903
Implement the Python class `CollectorSlave` described below. Class description: Overview: A slave, whose master is coordinator. Used to pass message between comm collector and coordinator. Interfaces: __init__, _process_task Method signatures and docstrings: - def __init__(self, *args, callback_fn: Dict[str, Callable...
Implement the Python class `CollectorSlave` described below. Class description: Overview: A slave, whose master is coordinator. Used to pass message between comm collector and coordinator. Interfaces: __init__, _process_task Method signatures and docstrings: - def __init__(self, *args, callback_fn: Dict[str, Callable...
eb483fa6e46602d58c8e7d2ca1e566adca28e703
<|skeleton|> class CollectorSlave: """Overview: A slave, whose master is coordinator. Used to pass message between comm collector and coordinator. Interfaces: __init__, _process_task""" def __init__(self, *args, callback_fn: Dict[str, Callable], **kwargs) -> None: """Overview: Init callback functions a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CollectorSlave: """Overview: A slave, whose master is coordinator. Used to pass message between comm collector and coordinator. Interfaces: __init__, _process_task""" def __init__(self, *args, callback_fn: Dict[str, Callable], **kwargs) -> None: """Overview: Init callback functions additionally. ...
the_stack_v2_python_sparse
ding/worker/collector/comm/flask_fs_collector.py
shengxuesun/DI-engine
train
1
971be3e250c0470186e826d3dc3ab53cd38d6baa
[ "forgetting = super().result_key(k)\nbwt = forgetting_to_bwt(forgetting)\nreturn bwt", "forgetting = super().result()\nbwt = forgetting_to_bwt(forgetting)\nreturn bwt" ]
<|body_start_0|> forgetting = super().result_key(k) bwt = forgetting_to_bwt(forgetting) return bwt <|end_body_0|> <|body_start_1|> forgetting = super().result() bwt = forgetting_to_bwt(forgetting) return bwt <|end_body_1|>
The standalone Backward Transfer metric. This metric returns the backward transfer relative to a specific key. Alternatively, this metric returns a dict in which each key is associated to the backward transfer. Backward transfer is computed as the difference between the last value recorded for a specific key and the fi...
BWT
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BWT: """The standalone Backward Transfer metric. This metric returns the backward transfer relative to a specific key. Alternatively, this metric returns a dict in which each key is associated to the backward transfer. Backward transfer is computed as the difference between the last value recorde...
stack_v2_sparse_classes_75kplus_train_005550
22,498
permissive
[ { "docstring": "Backward Transfer is returned only for keys encountered twice. Backward Transfer is the negative forgetting. :param k: the key for which returning backward transfer. If k has not updated at least twice it returns None. :return: the difference between the last value encountered for k and its firs...
2
stack_v2_sparse_classes_30k_train_013953
Implement the Python class `BWT` described below. Class description: The standalone Backward Transfer metric. This metric returns the backward transfer relative to a specific key. Alternatively, this metric returns a dict in which each key is associated to the backward transfer. Backward transfer is computed as the di...
Implement the Python class `BWT` described below. Class description: The standalone Backward Transfer metric. This metric returns the backward transfer relative to a specific key. Alternatively, this metric returns a dict in which each key is associated to the backward transfer. Backward transfer is computed as the di...
deb2b3e842046f48efc96e55a16d7a566e022c72
<|skeleton|> class BWT: """The standalone Backward Transfer metric. This metric returns the backward transfer relative to a specific key. Alternatively, this metric returns a dict in which each key is associated to the backward transfer. Backward transfer is computed as the difference between the last value recorde...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BWT: """The standalone Backward Transfer metric. This metric returns the backward transfer relative to a specific key. Alternatively, this metric returns a dict in which each key is associated to the backward transfer. Backward transfer is computed as the difference between the last value recorded for a speci...
the_stack_v2_python_sparse
avalanche/evaluation/metrics/forgetting_bwt.py
ContinualAI/avalanche
train
1,424
9bafc9e273e98d938fa5af09d1e57a3496fa7a5e
[ "from __builtin__ import xrange\nvisited = set()\nddir = ((1, 0), (-1, 0), (0, -1), (0, 1))\n\ndef dfs(i, j):\n \"\"\"\n :ret: Bool. False: out of boundary, visited.\n \"\"\"\n if i < 0 or j < 0 or i >= len(board) or (j >= len(board[0])) or ((i, j) in visited):\n return False\n ...
<|body_start_0|> from __builtin__ import xrange visited = set() ddir = ((1, 0), (-1, 0), (0, -1), (0, 1)) def dfs(i, j): """ :ret: Bool. False: out of boundary, visited. """ if i < 0 or j < 0 or i >= len(board) or (j >= len...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countBattleships(self, board): """:type board: List[List[str]] :rtype: int""" <|body_0|> def rewrite(self, board): """:type board: List[List[str]] :rtype: int X..X ...X ...X""" <|body_1|> <|end_skeleton|> <|body_start_0|> from __builti...
stack_v2_sparse_classes_75kplus_train_005551
3,147
no_license
[ { "docstring": ":type board: List[List[str]] :rtype: int", "name": "countBattleships", "signature": "def countBattleships(self, board)" }, { "docstring": ":type board: List[List[str]] :rtype: int X..X ...X ...X", "name": "rewrite", "signature": "def rewrite(self, board)" } ]
2
stack_v2_sparse_classes_30k_train_022640
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countBattleships(self, board): :type board: List[List[str]] :rtype: int - def rewrite(self, board): :type board: List[List[str]] :rtype: int X..X ...X ...X
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countBattleships(self, board): :type board: List[List[str]] :rtype: int - def rewrite(self, board): :type board: List[List[str]] :rtype: int X..X ...X ...X <|skeleton|> clas...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def countBattleships(self, board): """:type board: List[List[str]] :rtype: int""" <|body_0|> def rewrite(self, board): """:type board: List[List[str]] :rtype: int X..X ...X ...X""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def countBattleships(self, board): """:type board: List[List[str]] :rtype: int""" from __builtin__ import xrange visited = set() ddir = ((1, 0), (-1, 0), (0, -1), (0, 1)) def dfs(i, j): """ :ret: Bool. False: out of boundary, v...
the_stack_v2_python_sparse
depth-first-search/419_Battleships_in_a_Board.py
vsdrun/lc_public
train
6
d1e06327d5beb6824ef61cfd19581e0edc516b6d
[ "results = self.new_data()\nds0 = config.datasources[0]\nip_ds = self.check_data_nodes(config)\nfor ip in ip_ds:\n url = hadoop_url(scheme=ds0.zHadoopScheme, port=ds0.zHBaseMasterPort, host=ip, endpoint='/master-status')\n headers = hadoop_headers(accept='application/json', username=ds0.zHadoopUsername, passw...
<|body_start_0|> results = self.new_data() ds0 = config.datasources[0] ip_ds = self.check_data_nodes(config) for ip in ip_ds: url = hadoop_url(scheme=ds0.zHadoopScheme, port=ds0.zHBaseMasterPort, host=ip, endpoint='/master-status') headers = hadoop_headers(accept=...
Looks for presence of HBase on Hadoop
HadoopHBasePlugin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HadoopHBasePlugin: """Looks for presence of HBase on Hadoop""" def collect(self, config): """This method return a Twisted deferred. The deferred results will be sent to the onResult then either onSuccess or onError callbacks below.""" <|body_0|> def check_data_nodes(self...
stack_v2_sparse_classes_75kplus_train_005552
13,285
no_license
[ { "docstring": "This method return a Twisted deferred. The deferred results will be sent to the onResult then either onSuccess or onError callbacks below.", "name": "collect", "signature": "def collect(self, config)" }, { "docstring": "Check if device IP in Data Nodes IP(s), an if not add it", ...
2
stack_v2_sparse_classes_30k_train_040731
Implement the Python class `HadoopHBasePlugin` described below. Class description: Looks for presence of HBase on Hadoop Method signatures and docstrings: - def collect(self, config): This method return a Twisted deferred. The deferred results will be sent to the onResult then either onSuccess or onError callbacks be...
Implement the Python class `HadoopHBasePlugin` described below. Class description: Looks for presence of HBase on Hadoop Method signatures and docstrings: - def collect(self, config): This method return a Twisted deferred. The deferred results will be sent to the onResult then either onSuccess or onError callbacks be...
72631628266289bede0743fd83e9914d6ae53aa5
<|skeleton|> class HadoopHBasePlugin: """Looks for presence of HBase on Hadoop""" def collect(self, config): """This method return a Twisted deferred. The deferred results will be sent to the onResult then either onSuccess or onError callbacks below.""" <|body_0|> def check_data_nodes(self...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HadoopHBasePlugin: """Looks for presence of HBase on Hadoop""" def collect(self, config): """This method return a Twisted deferred. The deferred results will be sent to the onResult then either onSuccess or onError callbacks below.""" results = self.new_data() ds0 = config.datasou...
the_stack_v2_python_sparse
ZenPacks/zenoss/Hadoop/dsplugins.py
zenoss/ZenPacks.zenoss.Hadoop
train
0
e4ff882ac432ed2ee43f9e7487b700100fccbea4
[ "super(QuickShift, self).__init__(paramlist)\nself.params['algorithm'] = 'QuickShift'\nself.params['alpha1'] = 0.5\nself.params['beta1'] = 0.5\nself.params['beta2'] = 0.5\nself.paramindexes = ['alpha1', 'beta1', 'beta2']\nself.set_params(paramlist)", "mindim = min(img.shape)\nratio = self.params['alpha1']\nkernel...
<|body_start_0|> super(QuickShift, self).__init__(paramlist) self.params['algorithm'] = 'QuickShift' self.params['alpha1'] = 0.5 self.params['beta1'] = 0.5 self.params['beta2'] = 0.5 self.paramindexes = ['alpha1', 'beta1', 'beta2'] self.set_params(paramlist) <|end...
Perform the Quick Shift segmentation algorithm. Segments images with quickshift clustering in Color (x,y) space. Returns ndarray segmentation mask of the labels. Parameters: image -- ndarray, input image ratio -- float, balances color-space proximity & image-space proximity. Higher vals give more weight to color-space ...
QuickShift
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuickShift: """Perform the Quick Shift segmentation algorithm. Segments images with quickshift clustering in Color (x,y) space. Returns ndarray segmentation mask of the labels. Parameters: image -- ndarray, input image ratio -- float, balances color-space proximity & image-space proximity. Higher...
stack_v2_sparse_classes_75kplus_train_005553
29,598
permissive
[ { "docstring": "Get parameters from parameter list that are used in segmentation algorithm. Assign default values to these parameters.", "name": "__init__", "signature": "def __init__(self, paramlist=None)" }, { "docstring": "Evaluate segmentation algorithm on training image. Keyword arguments: ...
2
stack_v2_sparse_classes_30k_train_020920
Implement the Python class `QuickShift` described below. Class description: Perform the Quick Shift segmentation algorithm. Segments images with quickshift clustering in Color (x,y) space. Returns ndarray segmentation mask of the labels. Parameters: image -- ndarray, input image ratio -- float, balances color-space pr...
Implement the Python class `QuickShift` described below. Class description: Perform the Quick Shift segmentation algorithm. Segments images with quickshift clustering in Color (x,y) space. Returns ndarray segmentation mask of the labels. Parameters: image -- ndarray, input image ratio -- float, balances color-space pr...
9246b8b20510d4c89357a6764ed96b919eb92d5a
<|skeleton|> class QuickShift: """Perform the Quick Shift segmentation algorithm. Segments images with quickshift clustering in Color (x,y) space. Returns ndarray segmentation mask of the labels. Parameters: image -- ndarray, input image ratio -- float, balances color-space proximity & image-space proximity. Higher...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class QuickShift: """Perform the Quick Shift segmentation algorithm. Segments images with quickshift clustering in Color (x,y) space. Returns ndarray segmentation mask of the labels. Parameters: image -- ndarray, input image ratio -- float, balances color-space proximity & image-space proximity. Higher vals give mo...
the_stack_v2_python_sparse
see/Segmentors.py
Deepak768/see-segment
train
0
a2dd55640385f241d28a2cd1b76fc097a01df024
[ "lang_obj = self.pool['res.lang']\nids = lang_obj.search(cr, uid, [('code', '<>', 'en_US'), ('translatable', '=', True)])\nlangs = lang_obj.browse(cr, uid, ids)\nreturn [(lang.code, lang.name) for lang in langs]", "class BogusTranslation(Exception):\n \"\"\"Exception class for bogus translation entries\"\"\"\n...
<|body_start_0|> lang_obj = self.pool['res.lang'] ids = lang_obj.search(cr, uid, [('code', '<>', 'en_US'), ('translatable', '=', True)]) langs = lang_obj.browse(cr, uid, ids) return [(lang.code, lang.name) for lang in langs] <|end_body_0|> <|body_start_1|> class BogusTranslation...
Wizard to copy the translations from a language to en_US When model fields are translatable, only the English version is stored in the database table. The translations into other languages are stored as ir_translation records. This method will copy a translation to the English version in every record.
wizard_copy_translations
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class wizard_copy_translations: """Wizard to copy the translations from a language to en_US When model fields are translatable, only the English version is stored in the database table. The translations into other languages are stored as ir_translation records. This method will copy a translation to th...
stack_v2_sparse_classes_75kplus_train_005554
5,534
no_license
[ { "docstring": "Find which languages are maintained in the database", "name": "_get_languages", "signature": "def _get_languages(self, cr, uid, context)" }, { "docstring": "Copy the translations from a language to en_US", "name": "act_copy", "signature": "def act_copy(self, cr, uid, ids,...
3
stack_v2_sparse_classes_30k_train_030772
Implement the Python class `wizard_copy_translations` described below. Class description: Wizard to copy the translations from a language to en_US When model fields are translatable, only the English version is stored in the database table. The translations into other languages are stored as ir_translation records. Th...
Implement the Python class `wizard_copy_translations` described below. Class description: Wizard to copy the translations from a language to en_US When model fields are translatable, only the English version is stored in the database table. The translations into other languages are stored as ir_translation records. Th...
7e6da5d7633ec585b0869d7e6aa8c95f32e540f5
<|skeleton|> class wizard_copy_translations: """Wizard to copy the translations from a language to en_US When model fields are translatable, only the English version is stored in the database table. The translations into other languages are stored as ir_translation records. This method will copy a translation to th...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class wizard_copy_translations: """Wizard to copy the translations from a language to en_US When model fields are translatable, only the English version is stored in the database table. The translations into other languages are stored as ir_translation records. This method will copy a translation to the English ver...
the_stack_v2_python_sparse
base_translation_copy/wizard/copy_translations.py
numerigraphe/numerigraphe-addons
train
0
46a913ff34e08547a1070c96921dbb89e67ff369
[ "now = datetime.datetime.now().minute\nuser_now = six.text_type(user.pk) + six.text_type(now)\nhashed_string = user_now + six.text_type(user.is_active)\nreturn hashed_string", "now = self._num_days(self._today())\ntoken_generated = self._make_token_with_timestamp(user, now)\nreturn token_generated" ]
<|body_start_0|> now = datetime.datetime.now().minute user_now = six.text_type(user.pk) + six.text_type(now) hashed_string = user_now + six.text_type(user.is_active) return hashed_string <|end_body_0|> <|body_start_1|> now = self._num_days(self._today()) token_generated ...
TokenGenerator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TokenGenerator: def _make_hash_value(self, user, timestamp): """creating a value to current user""" <|body_0|> def make_token(self, user): """Returns a token that can be used once to do a password reset for the given user.""" <|body_1|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_75kplus_train_005555
1,159
permissive
[ { "docstring": "creating a value to current user", "name": "_make_hash_value", "signature": "def _make_hash_value(self, user, timestamp)" }, { "docstring": "Returns a token that can be used once to do a password reset for the given user.", "name": "make_token", "signature": "def make_tok...
2
stack_v2_sparse_classes_30k_train_011185
Implement the Python class `TokenGenerator` described below. Class description: Implement the TokenGenerator class. Method signatures and docstrings: - def _make_hash_value(self, user, timestamp): creating a value to current user - def make_token(self, user): Returns a token that can be used once to do a password res...
Implement the Python class `TokenGenerator` described below. Class description: Implement the TokenGenerator class. Method signatures and docstrings: - def _make_hash_value(self, user, timestamp): creating a value to current user - def make_token(self, user): Returns a token that can be used once to do a password res...
ba732137778e5a64037b09d564da6a6e4a88393e
<|skeleton|> class TokenGenerator: def _make_hash_value(self, user, timestamp): """creating a value to current user""" <|body_0|> def make_token(self, user): """Returns a token that can be used once to do a password reset for the given user.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TokenGenerator: def _make_hash_value(self, user, timestamp): """creating a value to current user""" now = datetime.datetime.now().minute user_now = six.text_type(user.pk) + six.text_type(now) hashed_string = user_now + six.text_type(user.is_active) return hashed_string ...
the_stack_v2_python_sparse
apiuser/core/tokens.py
ngelrojas/cotizate-back
train
0
2be5aaedec134dfb0ec8bf5a54cc52652ad19cf8
[ "trimmed_r1 = re.sub('.fastq.gz', '_val_1.fq.gz', self.r1)\ntrimmed_r2 = re.sub('.fastq.gz', '_val_2.fq.gz', self.r2)\nif not os.path.exists(trimmed_r1):\n trim_cmd = ('time trim_galore -o {} --gzip ' + '--quality 0 --paired {} {}').format(self.home_dir + 'FASTQ/', self.r1, self.r2)\n print(trim_cmd)\n sub...
<|body_start_0|> trimmed_r1 = re.sub('.fastq.gz', '_val_1.fq.gz', self.r1) trimmed_r2 = re.sub('.fastq.gz', '_val_2.fq.gz', self.r2) if not os.path.exists(trimmed_r1): trim_cmd = ('time trim_galore -o {} --gzip ' + '--quality 0 --paired {} {}').format(self.home_dir + 'FASTQ/', self.r...
Create a FastQ object with QC commands.
fq_pair_qc
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class fq_pair_qc: """Create a FastQ object with QC commands.""" def TrimAdapters(self): """Trime adapters. Manual/methods: https://github.com/FelixKrueger/TrimGalore/blob/master/Docs/Trim_Galore_User_Guide.md Use the val_1 and val_2 files (Source: https://www.biostars.org/p/256388/#256612)...
stack_v2_sparse_classes_75kplus_train_005556
5,699
no_license
[ { "docstring": "Trime adapters. Manual/methods: https://github.com/FelixKrueger/TrimGalore/blob/master/Docs/Trim_Galore_User_Guide.md Use the val_1 and val_2 files (Source: https://www.biostars.org/p/256388/#256612) Checking ASCII scores: https://support.illumina.com/help/BaseSpace_OLH_009008/Content/Source/Inf...
2
stack_v2_sparse_classes_30k_train_018907
Implement the Python class `fq_pair_qc` described below. Class description: Create a FastQ object with QC commands. Method signatures and docstrings: - def TrimAdapters(self): Trime adapters. Manual/methods: https://github.com/FelixKrueger/TrimGalore/blob/master/Docs/Trim_Galore_User_Guide.md Use the val_1 and val_2 ...
Implement the Python class `fq_pair_qc` described below. Class description: Create a FastQ object with QC commands. Method signatures and docstrings: - def TrimAdapters(self): Trime adapters. Manual/methods: https://github.com/FelixKrueger/TrimGalore/blob/master/Docs/Trim_Galore_User_Guide.md Use the val_1 and val_2 ...
eb84ab40dcd2915b09a3126948e83ebdf981ec3d
<|skeleton|> class fq_pair_qc: """Create a FastQ object with QC commands.""" def TrimAdapters(self): """Trime adapters. Manual/methods: https://github.com/FelixKrueger/TrimGalore/blob/master/Docs/Trim_Galore_User_Guide.md Use the val_1 and val_2 files (Source: https://www.biostars.org/p/256388/#256612)...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class fq_pair_qc: """Create a FastQ object with QC commands.""" def TrimAdapters(self): """Trime adapters. Manual/methods: https://github.com/FelixKrueger/TrimGalore/blob/master/Docs/Trim_Galore_User_Guide.md Use the val_1 and val_2 files (Source: https://www.biostars.org/p/256388/#256612) Checking ASC...
the_stack_v2_python_sparse
code_variants/align_qc_class.py
frichter/embryo_rnaseq
train
2
290929722956eef88d01543e2c28fb971e071eaf
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn SearchResponse()", "from .alteration_response import AlterationResponse\nfrom .result_template_dictionary import ResultTemplateDictionary\nfrom .search_hits_container import SearchHitsContainer\nfrom .alteration_response import Alterat...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return SearchResponse() <|end_body_0|> <|body_start_1|> from .alteration_response import AlterationResponse from .result_template_dictionary import ResultTemplateDictionary from .search...
SearchResponse
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SearchResponse: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SearchResponse: """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 Retur...
stack_v2_sparse_classes_75kplus_train_005557
4,232
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: SearchResponse", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_valu...
3
null
Implement the Python class `SearchResponse` described below. Class description: Implement the SearchResponse class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SearchResponse: Creates a new instance of the appropriate class based on discriminator va...
Implement the Python class `SearchResponse` described below. Class description: Implement the SearchResponse class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SearchResponse: Creates a new instance of the appropriate class based on discriminator va...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class SearchResponse: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SearchResponse: """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 Retur...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SearchResponse: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SearchResponse: """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: SearchResp...
the_stack_v2_python_sparse
msgraph/generated/models/search_response.py
microsoftgraph/msgraph-sdk-python
train
135
d787b2ff925a978567c06c2a8174a2d3dfb9b541
[ "super(LineEditIconButton, self).__init__(*args, **kw)\nself.setCursor(QtCore.Qt.ArrowCursor)\nself.setFocusPolicy(QtCore.Qt.NoFocus)", "painter = QtWidgets.QPainter(self)\nstate = QtGui.QIcon.Disabled\nif self.isEnabled():\n state = QtGui.QIcon.Normal\n if self.isDown():\n state = QtGui.QIcon.Select...
<|body_start_0|> super(LineEditIconButton, self).__init__(*args, **kw) self.setCursor(QtCore.Qt.ArrowCursor) self.setFocusPolicy(QtCore.Qt.NoFocus) <|end_body_0|> <|body_start_1|> painter = QtWidgets.QPainter(self) state = QtGui.QIcon.Disabled if self.isEnabled(): ...
Icon button for use in a :py:class:`LineEdit` widget.
LineEditIconButton
[ "Apache-2.0", "MIT", "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LineEditIconButton: """Icon button for use in a :py:class:`LineEdit` widget.""" def __init__(self, *args, **kw): """Initialise button.""" <|body_0|> def paintEvent(self, event): """Handle paint *event*.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_005558
3,683
permissive
[ { "docstring": "Initialise button.", "name": "__init__", "signature": "def __init__(self, *args, **kw)" }, { "docstring": "Handle paint *event*.", "name": "paintEvent", "signature": "def paintEvent(self, event)" } ]
2
stack_v2_sparse_classes_30k_train_024131
Implement the Python class `LineEditIconButton` described below. Class description: Icon button for use in a :py:class:`LineEdit` widget. Method signatures and docstrings: - def __init__(self, *args, **kw): Initialise button. - def paintEvent(self, event): Handle paint *event*.
Implement the Python class `LineEditIconButton` described below. Class description: Icon button for use in a :py:class:`LineEdit` widget. Method signatures and docstrings: - def __init__(self, *args, **kw): Initialise button. - def paintEvent(self, event): Handle paint *event*. <|skeleton|> class LineEditIconButton:...
f55f52787484fcf931c4653e7e241791f052c04f
<|skeleton|> class LineEditIconButton: """Icon button for use in a :py:class:`LineEdit` widget.""" def __init__(self, *args, **kw): """Initialise button.""" <|body_0|> def paintEvent(self, event): """Handle paint *event*.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LineEditIconButton: """Icon button for use in a :py:class:`LineEdit` widget.""" def __init__(self, *args, **kw): """Initialise button.""" super(LineEditIconButton, self).__init__(*args, **kw) self.setCursor(QtCore.Qt.ArrowCursor) self.setFocusPolicy(QtCore.Qt.NoFocus) ...
the_stack_v2_python_sparse
source/ftrack_connect/ui/widget/line_edit.py
IngenuityEngine/ftrack-connect
train
0
4e8f8abfffccb64810bf83e43cec1a2e3ddfbe1c
[ "data = base_importData()\ndata.read_csv(filename)\ndata.format_data()\nself.add_standards(data.data)\ndata.clear_data()", "data = base_importData()\ndata.read_csv(filename)\ndata.format_data()\nself.update_standards(data.data)\ndata.clear_data()", "data = base_importData()\ndata.read_csv(filename)\ndata.format...
<|body_start_0|> data = base_importData() data.read_csv(filename) data.format_data() self.add_standards(data.data) data.clear_data() <|end_body_0|> <|body_start_1|> data = base_importData() data.read_csv(filename) data.format_data() self.update_st...
lims_standards_io
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class lims_standards_io: def import_standards_add(self, filename): """table adds""" <|body_0|> def import_standards_update(self, filename): """table adds""" <|body_1|> def import_standardsOrdering_add(self, filename): """table adds""" <|body_2|...
stack_v2_sparse_classes_75kplus_train_005559
1,277
permissive
[ { "docstring": "table adds", "name": "import_standards_add", "signature": "def import_standards_add(self, filename)" }, { "docstring": "table adds", "name": "import_standards_update", "signature": "def import_standards_update(self, filename)" }, { "docstring": "table adds", "...
4
stack_v2_sparse_classes_30k_train_021320
Implement the Python class `lims_standards_io` described below. Class description: Implement the lims_standards_io class. Method signatures and docstrings: - def import_standards_add(self, filename): table adds - def import_standards_update(self, filename): table adds - def import_standardsOrdering_add(self, filename...
Implement the Python class `lims_standards_io` described below. Class description: Implement the lims_standards_io class. Method signatures and docstrings: - def import_standards_add(self, filename): table adds - def import_standards_update(self, filename): table adds - def import_standardsOrdering_add(self, filename...
5dfd73689674953345d523178a67b8dda10e6d47
<|skeleton|> class lims_standards_io: def import_standards_add(self, filename): """table adds""" <|body_0|> def import_standards_update(self, filename): """table adds""" <|body_1|> def import_standardsOrdering_add(self, filename): """table adds""" <|body_2|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class lims_standards_io: def import_standards_add(self, filename): """table adds""" data = base_importData() data.read_csv(filename) data.format_data() self.add_standards(data.data) data.clear_data() def import_standards_update(self, filename): """table a...
the_stack_v2_python_sparse
SBaaS_LIMS/lims_standards_io.py
dmccloskey/SBaaS_LIMS
train
0
8b6eec457c1d52828903130dddc183ebff086d99
[ "try:\n prefix, token = header.split()\nexcept ValueError:\n raise authentication.AuthenticationError('Unable to split prefix and token from Authorization header.')\nif prefix.upper() != 'JWT':\n raise authentication.AuthenticationError(f\"Invalid Authorization header prefix '{prefix}'.\")\nreturn token", ...
<|body_start_0|> try: prefix, token = header.split() except ValueError: raise authentication.AuthenticationError('Unable to split prefix and token from Authorization header.') if prefix.upper() != 'JWT': raise authentication.AuthenticationError(f"Invalid Autho...
Custom Starlette authentication backend for JWT.
JWTAuthenticationBackend
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JWTAuthenticationBackend: """Custom Starlette authentication backend for JWT.""" def get_token_from_header(header: str) -> str: """Parse JWT token from header value.""" <|body_0|> async def authenticate(self, request: Request) -> t.Optional[tuple[authentication.AuthCrede...
stack_v2_sparse_classes_75kplus_train_005560
1,656
permissive
[ { "docstring": "Parse JWT token from header value.", "name": "get_token_from_header", "signature": "def get_token_from_header(header: str) -> str" }, { "docstring": "Handles JWT authentication process.", "name": "authenticate", "signature": "async def authenticate(self, request: Request)...
2
stack_v2_sparse_classes_30k_train_029165
Implement the Python class `JWTAuthenticationBackend` described below. Class description: Custom Starlette authentication backend for JWT. Method signatures and docstrings: - def get_token_from_header(header: str) -> str: Parse JWT token from header value. - async def authenticate(self, request: Request) -> t.Optiona...
Implement the Python class `JWTAuthenticationBackend` described below. Class description: Custom Starlette authentication backend for JWT. Method signatures and docstrings: - def get_token_from_header(header: str) -> str: Parse JWT token from header value. - async def authenticate(self, request: Request) -> t.Optiona...
1b4b4fe6819352f1f072ce307eee892866a11dcf
<|skeleton|> class JWTAuthenticationBackend: """Custom Starlette authentication backend for JWT.""" def get_token_from_header(header: str) -> str: """Parse JWT token from header value.""" <|body_0|> async def authenticate(self, request: Request) -> t.Optional[tuple[authentication.AuthCrede...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class JWTAuthenticationBackend: """Custom Starlette authentication backend for JWT.""" def get_token_from_header(header: str) -> str: """Parse JWT token from header value.""" try: prefix, token = header.split() except ValueError: raise authentication.Authenticati...
the_stack_v2_python_sparse
backend/authentication/backend.py
MrGrote/forms-backend
train
0
891f22e376a1dff14fd578490e8c68f66df5c324
[ "pattern_matcher = BackEdgeSimpleInputMatcher()\npattern = pattern_matcher.pattern()\ngraph = build_graph_with_attrs(nodes_with_attrs=pattern['nodes'], edges_with_attrs=pattern['edges'], new_nodes_with_attrs=[('cycle_data', {'kind': 'data'}), ('condition', {'kind': 'data'}), ('init', {'kind': 'data', 'shape': np.ar...
<|body_start_0|> pattern_matcher = BackEdgeSimpleInputMatcher() pattern = pattern_matcher.pattern() graph = build_graph_with_attrs(nodes_with_attrs=pattern['nodes'], edges_with_attrs=pattern['edges'], new_nodes_with_attrs=[('cycle_data', {'kind': 'data'}), ('condition', {'kind': 'data'}), ('init...
BackEdgeInputMatcherTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BackEdgeInputMatcherTest: def test1(self): """Case with constant input to init""" <|body_0|> def test2(self): """Case with non-constant input to init. Nothing should happen with graph.""" <|body_1|> <|end_skeleton|> <|body_start_0|> pattern_matcher ...
stack_v2_sparse_classes_75kplus_train_005561
9,696
permissive
[ { "docstring": "Case with constant input to init", "name": "test1", "signature": "def test1(self)" }, { "docstring": "Case with non-constant input to init. Nothing should happen with graph.", "name": "test2", "signature": "def test2(self)" } ]
2
stack_v2_sparse_classes_30k_train_036568
Implement the Python class `BackEdgeInputMatcherTest` described below. Class description: Implement the BackEdgeInputMatcherTest class. Method signatures and docstrings: - def test1(self): Case with constant input to init - def test2(self): Case with non-constant input to init. Nothing should happen with graph.
Implement the Python class `BackEdgeInputMatcherTest` described below. Class description: Implement the BackEdgeInputMatcherTest class. Method signatures and docstrings: - def test1(self): Case with constant input to init - def test2(self): Case with non-constant input to init. Nothing should happen with graph. <|sk...
e4bed7a31c9f00d8afbfcabee3f64f55496ae56a
<|skeleton|> class BackEdgeInputMatcherTest: def test1(self): """Case with constant input to init""" <|body_0|> def test2(self): """Case with non-constant input to init. Nothing should happen with graph.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BackEdgeInputMatcherTest: def test1(self): """Case with constant input to init""" pattern_matcher = BackEdgeSimpleInputMatcher() pattern = pattern_matcher.pattern() graph = build_graph_with_attrs(nodes_with_attrs=pattern['nodes'], edges_with_attrs=pattern['edges'], new_nodes_wi...
the_stack_v2_python_sparse
tools/mo/unit_tests/mo/middle/TensorIteratorInput_test.py
openvinotoolkit/openvino
train
3,953
a45d4cbc14a34a8be713dea9c7350189f090ba84
[ "self.type = feature_type\nself.feature_data = {}\nself.feature_data_xyz = {}", "for name, data in self.feature_data.items():\n ds = []\n for key, value in data.items():\n if len(key) == 3:\n feat = '{:>4}{:>10}{:>10}'.format(key[0], key[1], key[2])\n elif len(key) == 4:\n ...
<|body_start_0|> self.type = feature_type self.feature_data = {} self.feature_data_xyz = {} <|end_body_0|> <|body_start_1|> for name, data in self.feature_data.items(): ds = [] for key, value in data.items(): if len(key) == 3: ...
FeatureClass
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FeatureClass: def __init__(self, feature_type): """Master class from which all the other feature classes should be derived. Arguments feature_type(str): 'Atomic' or 'Residue' Note: Each subclass must compute: - self.feature_data: dictionary of features in human readable format, e.g. - fo...
stack_v2_sparse_classes_75kplus_train_005562
5,768
permissive
[ { "docstring": "Master class from which all the other feature classes should be derived. Arguments feature_type(str): 'Atomic' or 'Residue' Note: Each subclass must compute: - self.feature_data: dictionary of features in human readable format, e.g. - for atomic features: - {'coulomb': data_dict_clb, 'vdwaals': ...
4
stack_v2_sparse_classes_30k_train_035740
Implement the Python class `FeatureClass` described below. Class description: Implement the FeatureClass class. Method signatures and docstrings: - def __init__(self, feature_type): Master class from which all the other feature classes should be derived. Arguments feature_type(str): 'Atomic' or 'Residue' Note: Each s...
Implement the Python class `FeatureClass` described below. Class description: Implement the FeatureClass class. Method signatures and docstrings: - def __init__(self, feature_type): Master class from which all the other feature classes should be derived. Arguments feature_type(str): 'Atomic' or 'Residue' Note: Each s...
6bc8d7e4893fc06f952d6e2b1edfc4e1c19bc671
<|skeleton|> class FeatureClass: def __init__(self, feature_type): """Master class from which all the other feature classes should be derived. Arguments feature_type(str): 'Atomic' or 'Residue' Note: Each subclass must compute: - self.feature_data: dictionary of features in human readable format, e.g. - fo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FeatureClass: def __init__(self, feature_type): """Master class from which all the other feature classes should be derived. Arguments feature_type(str): 'Atomic' or 'Residue' Note: Each subclass must compute: - self.feature_data: dictionary of features in human readable format, e.g. - for atomic featu...
the_stack_v2_python_sparse
deeprank/features/FeatureClass.py
DeepRank/deeprank
train
140
be44e51edc5419aeb98d4ab73238fd8109e51db5
[ "num_level, iter_names = tiling_info\nself.num_level = num_level\nself.iter_names = iter_names\nself.ast_util = ast_util.ASTUtil()", "if isinstance(stmt, ast.ExpStmt):\n return stmt\nelif isinstance(stmt, ast.CompStmt):\n stmt.stmts = [self.__normalizeStmt(s) for s in stmt.stmts]\n while len(stmt.stmts) ...
<|body_start_0|> num_level, iter_names = tiling_info self.num_level = num_level self.iter_names = iter_names self.ast_util = ast_util.ASTUtil() <|end_body_0|> <|body_start_1|> if isinstance(stmt, ast.ExpStmt): return stmt elif isinstance(stmt, ast.CompStmt): ...
The semantic analyzer class that provides methods for check and enforcing AST semantics
SemanticAnalyzer
[ "MIT", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-other-permissive" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SemanticAnalyzer: """The semantic analyzer class that provides methods for check and enforcing AST semantics""" def __init__(self, tiling_info): """To instantiate a semantic analyzer""" <|body_0|> def __normalizeStmt(self, stmt): """* To change the format of all ...
stack_v2_sparse_classes_75kplus_train_005563
5,420
permissive
[ { "docstring": "To instantiate a semantic analyzer", "name": "__init__", "signature": "def __init__(self, tiling_info)" }, { "docstring": "* To change the format of all for-loops to a fixed form as described below: for (<id> = <exp>; <id> <= <exp>; <id> += <exp>) { <stmts> } * To change the form...
4
null
Implement the Python class `SemanticAnalyzer` described below. Class description: The semantic analyzer class that provides methods for check and enforcing AST semantics Method signatures and docstrings: - def __init__(self, tiling_info): To instantiate a semantic analyzer - def __normalizeStmt(self, stmt): * To chan...
Implement the Python class `SemanticAnalyzer` described below. Class description: The semantic analyzer class that provides methods for check and enforcing AST semantics Method signatures and docstrings: - def __init__(self, tiling_info): To instantiate a semantic analyzer - def __normalizeStmt(self, stmt): * To chan...
934ba192301cb4e23d98b9f79e91799152bf76b1
<|skeleton|> class SemanticAnalyzer: """The semantic analyzer class that provides methods for check and enforcing AST semantics""" def __init__(self, tiling_info): """To instantiate a semantic analyzer""" <|body_0|> def __normalizeStmt(self, stmt): """* To change the format of all ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SemanticAnalyzer: """The semantic analyzer class that provides methods for check and enforcing AST semantics""" def __init__(self, tiling_info): """To instantiate a semantic analyzer""" num_level, iter_names = tiling_info self.num_level = num_level self.iter_names = iter_n...
the_stack_v2_python_sparse
orio/module/ortil/semant.py
phrb/orio_experiments
train
1
4838e6c4fb9602813c6249dd9e144849d2239cd9
[ "if nums == None:\n return\ncurrent = 0\nself.sums = []\nfor i in range(len(nums)):\n current += nums[i]\n self.sums.append(current)", "if j >= i and i >= 0 and (j < len(self.sums)):\n return self.sums[j] - self.sums[i - 1] if i > 0 else self.sums[j]\nreturn 0" ]
<|body_start_0|> if nums == None: return current = 0 self.sums = [] for i in range(len(nums)): current += nums[i] self.sums.append(current) <|end_body_0|> <|body_start_1|> if j >= i and i >= 0 and (j < len(self.sums)): return self....
NumArray
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumArray: def __init__(self, nums): """initialize your data structure here. :type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """sum of elements nums[i..j], inclusive. :type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_75kplus_train_005564
804
no_license
[ { "docstring": "initialize your data structure here. :type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": "sum of elements nums[i..j], inclusive. :type i: int :type j: int :rtype: int", "name": "sumRange", "signature": "def sumRange(self, ...
2
null
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): initialize your data structure here. :type nums: List[int] - def sumRange(self, i, j): sum of elements nums[i..j], inclusive. :type i: int :type j: int ...
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): initialize your data structure here. :type nums: List[int] - def sumRange(self, i, j): sum of elements nums[i..j], inclusive. :type i: int :type j: int ...
dffe615edd36eca48d16ac9d4b660de68f2030f7
<|skeleton|> class NumArray: def __init__(self, nums): """initialize your data structure here. :type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """sum of elements nums[i..j], inclusive. :type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NumArray: def __init__(self, nums): """initialize your data structure here. :type nums: List[int]""" if nums == None: return current = 0 self.sums = [] for i in range(len(nums)): current += nums[i] self.sums.append(current) def s...
the_stack_v2_python_sparse
303RangeSumQuery-Immutable.py
cocowindwebster/PythonLeet1
train
0
9f8638b0a12fd5110d7d6514ae311c5f1bd35a44
[ "self.mnemonic = mnemonic\nself.value = value\ncondition.cond_time_pairs.append(self.cond_true_time())", "temp_start: float = []\ntemp_end: float = []\nfor key in self.mnemonic:\n if float(key['value']) < self.value:\n temp_start.append(key['time'])\n else:\n temp_end.append(key['time'])\ntime...
<|body_start_0|> self.mnemonic = mnemonic self.value = value condition.cond_time_pairs.append(self.cond_true_time()) <|end_body_0|> <|body_start_1|> temp_start: float = [] temp_end: float = [] for key in self.mnemonic: if float(key['value']) < self.value: ...
Class to hold single "greater than" subcondition
smaller
[ "BSD-3-Clause", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class smaller: """Class to hold single "greater than" subcondition""" def __init__(self, mnemonic, value): """Initializes subconditon Parameters ---------- mnemonic : astropy table includes mnemomic engineering data and corresponding primary time value : str coparison value for equal state...
stack_v2_sparse_classes_75kplus_train_005565
13,097
permissive
[ { "docstring": "Initializes subconditon Parameters ---------- mnemonic : astropy table includes mnemomic engineering data and corresponding primary time value : str coparison value for equal statement", "name": "__init__", "signature": "def __init__(self, mnemonic, value)" }, { "docstring": "Fil...
2
stack_v2_sparse_classes_30k_train_000278
Implement the Python class `smaller` described below. Class description: Class to hold single "greater than" subcondition Method signatures and docstrings: - def __init__(self, mnemonic, value): Initializes subconditon Parameters ---------- mnemonic : astropy table includes mnemomic engineering data and corresponding...
Implement the Python class `smaller` described below. Class description: Class to hold single "greater than" subcondition Method signatures and docstrings: - def __init__(self, mnemonic, value): Initializes subconditon Parameters ---------- mnemonic : astropy table includes mnemomic engineering data and corresponding...
2ae74c51594925f81dde2f28b51548ffcdc257fd
<|skeleton|> class smaller: """Class to hold single "greater than" subcondition""" def __init__(self, mnemonic, value): """Initializes subconditon Parameters ---------- mnemonic : astropy table includes mnemomic engineering data and corresponding primary time value : str coparison value for equal state...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class smaller: """Class to hold single "greater than" subcondition""" def __init__(self, mnemonic, value): """Initializes subconditon Parameters ---------- mnemonic : astropy table includes mnemomic engineering data and corresponding primary time value : str coparison value for equal statement""" ...
the_stack_v2_python_sparse
jwql/instrument_monitors/nirspec_monitors/data_trending/utils/condition.py
catherine-martlin/jwql
train
1
a89db264fdba1b2bf6acdce84afcab78cc05021c
[ "if interface == 'tf' and (not tf_support):\n pytest.skip('Skipped, no tf support')\nif interface == 'torch' and (not torch_support):\n pytest.skip('Skipped, no torch support')\ndev = qml.device('default.qubit', wires=1)\n\n@qml.qnode(dev, interface=interface)\ndef circuit(x):\n qml.RX(x, wires=0)\n ret...
<|body_start_0|> if interface == 'tf' and (not tf_support): pytest.skip('Skipped, no tf support') if interface == 'torch' and (not torch_support): pytest.skip('Skipped, no torch support') dev = qml.device('default.qubit', wires=1) @qml.qnode(dev, interface=interf...
Integration tests to make sure that to_autograd() correctly converts QNodes with/without pre-existing interfaces
TestConversion
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestConversion: """Integration tests to make sure that to_autograd() correctly converts QNodes with/without pre-existing interfaces""" def qnode(self, interface, tf_support, torch_support): """Returns a simple QNode corresponding to cos(x), with interface as determined by the interfa...
stack_v2_sparse_classes_75kplus_train_005566
40,408
permissive
[ { "docstring": "Returns a simple QNode corresponding to cos(x), with interface as determined by the interface fixture", "name": "qnode", "signature": "def qnode(self, interface, tf_support, torch_support)" }, { "docstring": "Tests that the to_autograd() function ignores QNodes that already have ...
3
null
Implement the Python class `TestConversion` described below. Class description: Integration tests to make sure that to_autograd() correctly converts QNodes with/without pre-existing interfaces Method signatures and docstrings: - def qnode(self, interface, tf_support, torch_support): Returns a simple QNode correspondi...
Implement the Python class `TestConversion` described below. Class description: Integration tests to make sure that to_autograd() correctly converts QNodes with/without pre-existing interfaces Method signatures and docstrings: - def qnode(self, interface, tf_support, torch_support): Returns a simple QNode correspondi...
0c1c805fd5dfce465a8955ee3faf81037023a23e
<|skeleton|> class TestConversion: """Integration tests to make sure that to_autograd() correctly converts QNodes with/without pre-existing interfaces""" def qnode(self, interface, tf_support, torch_support): """Returns a simple QNode corresponding to cos(x), with interface as determined by the interfa...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestConversion: """Integration tests to make sure that to_autograd() correctly converts QNodes with/without pre-existing interfaces""" def qnode(self, interface, tf_support, torch_support): """Returns a simple QNode corresponding to cos(x), with interface as determined by the interface fixture"""...
the_stack_v2_python_sparse
artifacts/old_dataset_versions/original_commits_backup/pennylane/pennylane#1081/before/test_autograd.py
MattePalte/Bugs-Quantum-Computing-Platforms
train
4
b560613f0bb153814a401992ebd735fa08e1160a
[ "res = 0\nfor i in range(len(A)):\n for j in range(len(A)):\n for k in range(len(A)):\n if A[i] & A[j] & A[k] == 0:\n res += 1\nreturn res", "d = {}\nres = 0\nfor a in A:\n for b in A:\n t = a & b\n if t in d:\n d[t] += 1\n else:\n ...
<|body_start_0|> res = 0 for i in range(len(A)): for j in range(len(A)): for k in range(len(A)): if A[i] & A[j] & A[k] == 0: res += 1 return res <|end_body_0|> <|body_start_1|> d = {} res = 0 for a i...
https://leetcode.com/problems/triples-with-bitwise-and-equal-to-zero/ explanation: https://leetcode.com/problems/triples-with-bitwise-and-equal-to-zero/discuss/227309/C%2B%2B-naive-O(n-*-n)
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """https://leetcode.com/problems/triples-with-bitwise-and-equal-to-zero/ explanation: https://leetcode.com/problems/triples-with-bitwise-and-equal-to-zero/discuss/227309/C%2B%2B-naive-O(n-*-n)""" def countTriplets(self, A): """:type A: List[int] :rtype: int""" <|bod...
stack_v2_sparse_classes_75kplus_train_005567
6,934
no_license
[ { "docstring": ":type A: List[int] :rtype: int", "name": "countTriplets", "signature": "def countTriplets(self, A)" }, { "docstring": ":type A: List[int] :rtype: int", "name": "countTriplets2", "signature": "def countTriplets2(self, A)" } ]
2
stack_v2_sparse_classes_30k_train_043045
Implement the Python class `Solution` described below. Class description: https://leetcode.com/problems/triples-with-bitwise-and-equal-to-zero/ explanation: https://leetcode.com/problems/triples-with-bitwise-and-equal-to-zero/discuss/227309/C%2B%2B-naive-O(n-*-n) Method signatures and docstrings: - def countTriplets(...
Implement the Python class `Solution` described below. Class description: https://leetcode.com/problems/triples-with-bitwise-and-equal-to-zero/ explanation: https://leetcode.com/problems/triples-with-bitwise-and-equal-to-zero/discuss/227309/C%2B%2B-naive-O(n-*-n) Method signatures and docstrings: - def countTriplets(...
54d3d9530b25272d4a2e5dc33e7035c44f506dc5
<|skeleton|> class Solution: """https://leetcode.com/problems/triples-with-bitwise-and-equal-to-zero/ explanation: https://leetcode.com/problems/triples-with-bitwise-and-equal-to-zero/discuss/227309/C%2B%2B-naive-O(n-*-n)""" def countTriplets(self, A): """:type A: List[int] :rtype: int""" <|bod...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: """https://leetcode.com/problems/triples-with-bitwise-and-equal-to-zero/ explanation: https://leetcode.com/problems/triples-with-bitwise-and-equal-to-zero/discuss/227309/C%2B%2B-naive-O(n-*-n)""" def countTriplets(self, A): """:type A: List[int] :rtype: int""" res = 0 fo...
the_stack_v2_python_sparse
old/Session002/BitManipulation/TripleswithANDEqualToZero.py
MaxIakovliev/algorithms
train
0
cf2abb2da66eb777a9103819f2f2ec2a871a5453
[ "self._validator = None\nself.logger = logger\nif api_spec_path is not None:\n try:\n api_spec_dict = read_yaml_file(api_spec_path)\n if server is not None:\n api_spec_dict['servers'] = [{'url': server}]\n api_spec = create_spec(api_spec_dict)\n self._validator = RequestVal...
<|body_start_0|> self._validator = None self.logger = logger if api_spec_path is not None: try: api_spec_dict = read_yaml_file(api_spec_path) if server is not None: api_spec_dict['servers'] = [{'url': server}] api_sp...
API Spec class to verify a request against an OpenAPI/Swagger spec.
APISpec
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class APISpec: """API Spec class to verify a request against an OpenAPI/Swagger spec.""" def __init__(self, api_spec_path: Optional[str]=None, server: Optional[str]=None, logger: logging.Logger=_default_logger): """Initialize the API spec. :param api_spec_path: Directory API path and filen...
stack_v2_sparse_classes_75kplus_train_005568
21,668
permissive
[ { "docstring": "Initialize the API spec. :param api_spec_path: Directory API path and filename of the API spec YAML source file. :param server: the server url :param logger: the logger", "name": "__init__", "signature": "def __init__(self, api_spec_path: Optional[str]=None, server: Optional[str]=None, l...
2
stack_v2_sparse_classes_30k_train_025229
Implement the Python class `APISpec` described below. Class description: API Spec class to verify a request against an OpenAPI/Swagger spec. Method signatures and docstrings: - def __init__(self, api_spec_path: Optional[str]=None, server: Optional[str]=None, logger: logging.Logger=_default_logger): Initialize the API...
Implement the Python class `APISpec` described below. Class description: API Spec class to verify a request against an OpenAPI/Swagger spec. Method signatures and docstrings: - def __init__(self, api_spec_path: Optional[str]=None, server: Optional[str]=None, logger: logging.Logger=_default_logger): Initialize the API...
bec49adaeba661d8d0f03ac9935dc89f39d95a0d
<|skeleton|> class APISpec: """API Spec class to verify a request against an OpenAPI/Swagger spec.""" def __init__(self, api_spec_path: Optional[str]=None, server: Optional[str]=None, logger: logging.Logger=_default_logger): """Initialize the API spec. :param api_spec_path: Directory API path and filen...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class APISpec: """API Spec class to verify a request against an OpenAPI/Swagger spec.""" def __init__(self, api_spec_path: Optional[str]=None, server: Optional[str]=None, logger: logging.Logger=_default_logger): """Initialize the API spec. :param api_spec_path: Directory API path and filename of the AP...
the_stack_v2_python_sparse
packages/fetchai/connections/http_server/connection.py
fetchai/agents-aea
train
192
f79b6e9d8ee31c3e7dd890f7904eb357baa74237
[ "data = {}\nmachines = db.list_machines()\ndata['machines'] = []\nfor row in machines:\n data['machines'].append(row.to_dict())\nreturn JsonResponse({'status': True, 'data': data})", "machine = db.view_machine(name=name)\nif machine:\n return JsonResponse({'status': True, 'data': machine.to_dict()})\nelse:\...
<|body_start_0|> data = {} machines = db.list_machines() data['machines'] = [] for row in machines: data['machines'].append(row.to_dict()) return JsonResponse({'status': True, 'data': data}) <|end_body_0|> <|body_start_1|> machine = db.view_machine(name=name)...
MachinesApi
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MachinesApi: def list(request): """Returns a list of all machines currently registered in Cuckoo :return:""" <|body_0|> def view(request, name=None): """Returns information about a machine :param name: machine name :return: Machine information as a dictionary""" ...
stack_v2_sparse_classes_75kplus_train_005569
1,139
no_license
[ { "docstring": "Returns a list of all machines currently registered in Cuckoo :return:", "name": "list", "signature": "def list(request)" }, { "docstring": "Returns information about a machine :param name: machine name :return: Machine information as a dictionary", "name": "view", "signa...
2
null
Implement the Python class `MachinesApi` described below. Class description: Implement the MachinesApi class. Method signatures and docstrings: - def list(request): Returns a list of all machines currently registered in Cuckoo :return: - def view(request, name=None): Returns information about a machine :param name: m...
Implement the Python class `MachinesApi` described below. Class description: Implement the MachinesApi class. Method signatures and docstrings: - def list(request): Returns a list of all machines currently registered in Cuckoo :return: - def view(request, name=None): Returns information about a machine :param name: m...
0170c52aa9536ffc5b8391190dec892c9bd7ba0b
<|skeleton|> class MachinesApi: def list(request): """Returns a list of all machines currently registered in Cuckoo :return:""" <|body_0|> def view(request, name=None): """Returns information about a machine :param name: machine name :return: Machine information as a dictionary""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MachinesApi: def list(request): """Returns a list of all machines currently registered in Cuckoo :return:""" data = {} machines = db.list_machines() data['machines'] = [] for row in machines: data['machines'].append(row.to_dict()) return JsonResponse...
the_stack_v2_python_sparse
web/controllers/machines/api.py
iNarcissuss/Cuckoodroid-1
train
0
2d9db73e9f73502b92e4b8f70d9e46d6915c634f
[ "self.data = []\nself.label = []\nself.T = data.shape[1]\nfor t in range(self.T):\n self.data += _init_data(data[:, t], allow_empty=False, default_name='data%d' % t)\n label_part = label[:, t] if label is not None else None\n self.label += _init_data(label_part, allow_empty=True, default_name='logis%d_labe...
<|body_start_0|> self.data = [] self.label = [] self.T = data.shape[1] for t in range(self.T): self.data += _init_data(data[:, t], allow_empty=False, default_name='data%d' % t) label_part = label[:, t] if label is not None else None self.label += _init...
UnrollIter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UnrollIter: def __init__(self, data, label=None, batch_size=1, last_batch_handle='pad', num_hidden=250): """data and label should be N*T*C*H*W""" <|body_0|> def provide_data(self): """The name and shape of data provided by this iterator""" <|body_1|> <|end_s...
stack_v2_sparse_classes_75kplus_train_005570
3,250
no_license
[ { "docstring": "data and label should be N*T*C*H*W", "name": "__init__", "signature": "def __init__(self, data, label=None, batch_size=1, last_batch_handle='pad', num_hidden=250)" }, { "docstring": "The name and shape of data provided by this iterator", "name": "provide_data", "signature...
2
null
Implement the Python class `UnrollIter` described below. Class description: Implement the UnrollIter class. Method signatures and docstrings: - def __init__(self, data, label=None, batch_size=1, last_batch_handle='pad', num_hidden=250): data and label should be N*T*C*H*W - def provide_data(self): The name and shape o...
Implement the Python class `UnrollIter` described below. Class description: Implement the UnrollIter class. Method signatures and docstrings: - def __init__(self, data, label=None, batch_size=1, last_batch_handle='pad', num_hidden=250): data and label should be N*T*C*H*W - def provide_data(self): The name and shape o...
d509e5a15e06233ceda1b117ab62e5b5e6d92932
<|skeleton|> class UnrollIter: def __init__(self, data, label=None, batch_size=1, last_batch_handle='pad', num_hidden=250): """data and label should be N*T*C*H*W""" <|body_0|> def provide_data(self): """The name and shape of data provided by this iterator""" <|body_1|> <|end_s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UnrollIter: def __init__(self, data, label=None, batch_size=1, last_batch_handle='pad', num_hidden=250): """data and label should be N*T*C*H*W""" self.data = [] self.label = [] self.T = data.shape[1] for t in range(self.T): self.data += _init_data(data[:, t]...
the_stack_v2_python_sparse
RNN/unroll.py
ZijiaLewisLu/HeartDeep-Kaggle-DSB2
train
0
5ca1695254c7d3366bb744103520b5c55a7f9930
[ "super().__init__()\nself.field_delimiter = ','\nself.quote_character = '\"'\nself.escape_character = '\\\\'\nself.leading_rows_to_skip = 0", "new_ddlt = deepcopy(self)\nnew_ddlt.field_delimiter = delimiter\nreturn new_ddlt", "new_ddlt = deepcopy(self)\nnew_ddlt.quote_character = char\nreturn new_ddlt", "new_...
<|body_start_0|> super().__init__() self.field_delimiter = ',' self.quote_character = '"' self.escape_character = '\\' self.leading_rows_to_skip = 0 <|end_body_0|> <|body_start_1|> new_ddlt = deepcopy(self) new_ddlt.field_delimiter = delimiter return new_...
Loader of Delimiter-Seperated Value data. By default, it's CSV.
DsvDataLiteralTransformer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DsvDataLiteralTransformer: """Loader of Delimiter-Seperated Value data. By default, it's CSV.""" def __init__(self): """Constructor of DsvDataLiteralTransformer. Config transformer to load CSV file by default.""" <|body_0|> def with_field_delimiter(self, delimiter: str):...
stack_v2_sparse_classes_75kplus_train_005571
4,394
permissive
[ { "docstring": "Constructor of DsvDataLiteralTransformer. Config transformer to load CSV file by default.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "The field's separator. Args: delimiter (str): delimiter to use. Returns: DsvDataLiteralTransformer: new instance of...
6
null
Implement the Python class `DsvDataLiteralTransformer` described below. Class description: Loader of Delimiter-Seperated Value data. By default, it's CSV. Method signatures and docstrings: - def __init__(self): Constructor of DsvDataLiteralTransformer. Config transformer to load CSV file by default. - def with_field_...
Implement the Python class `DsvDataLiteralTransformer` described below. Class description: Loader of Delimiter-Seperated Value data. By default, it's CSV. Method signatures and docstrings: - def __init__(self): Constructor of DsvDataLiteralTransformer. Config transformer to load CSV file by default. - def with_field_...
ec5e3b79abf5334783cc93edbdeb0c586f65cdf9
<|skeleton|> class DsvDataLiteralTransformer: """Loader of Delimiter-Seperated Value data. By default, it's CSV.""" def __init__(self): """Constructor of DsvDataLiteralTransformer. Config transformer to load CSV file by default.""" <|body_0|> def with_field_delimiter(self, delimiter: str):...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DsvDataLiteralTransformer: """Loader of Delimiter-Seperated Value data. By default, it's CSV.""" def __init__(self): """Constructor of DsvDataLiteralTransformer. Config transformer to load CSV file by default.""" super().__init__() self.field_delimiter = ',' self.quote_cha...
the_stack_v2_python_sparse
src/bq_test_kit/data_literal_transformers/dsv_data_literal_transformer.py
tiboun/python-bigquery-test-kit
train
47
fc40e0b75aadaf53fb1065d4907bd142287f51bb
[ "if amount == 0:\n return 0\ncur_queue = [0]\nnext_queue = []\nnum_counter = 0\nvisited = [False] * (amount + 1)\nvisited[0] = True\nwhile cur_queue:\n num_counter += 1\n for v in cur_queue:\n for coin in coins:\n new_val = v + coin\n if new_val == amount:\n retu...
<|body_start_0|> if amount == 0: return 0 cur_queue = [0] next_queue = [] num_counter = 0 visited = [False] * (amount + 1) visited[0] = True while cur_queue: num_counter += 1 for v in cur_queue: for coin in coins...
This solution is inspired by the BFS solution for problem Perfect Square. Since it is to find the least coin solution (like a shortest path from 0 to amount), using BFS gives results much faster than DP. https://discuss.leetcode.com/topic/26262/short-python-solution-using-bfs beats 97.75%
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """This solution is inspired by the BFS solution for problem Perfect Square. Since it is to find the least coin solution (like a shortest path from 0 to amount), using BFS gives results much faster than DP. https://discuss.leetcode.com/topic/26262/short-python-solution-using-bfs beats 9...
stack_v2_sparse_classes_75kplus_train_005572
5,270
no_license
[ { "docstring": ":type coins: List[int] :type amount: int :rtype: int", "name": "coinChange", "signature": "def coinChange(self, coins, amount)" }, { "docstring": ":type coins: List[int] :type amount: int :rtype: int Assume dp[i] is the fewest number of coins making up amount i, then for every co...
5
stack_v2_sparse_classes_30k_train_031876
Implement the Python class `Solution` described below. Class description: This solution is inspired by the BFS solution for problem Perfect Square. Since it is to find the least coin solution (like a shortest path from 0 to amount), using BFS gives results much faster than DP. https://discuss.leetcode.com/topic/26262/...
Implement the Python class `Solution` described below. Class description: This solution is inspired by the BFS solution for problem Perfect Square. Since it is to find the least coin solution (like a shortest path from 0 to amount), using BFS gives results much faster than DP. https://discuss.leetcode.com/topic/26262/...
7e0e917c15d3e35f49da3a00ef395bd5ff180d79
<|skeleton|> class Solution: """This solution is inspired by the BFS solution for problem Perfect Square. Since it is to find the least coin solution (like a shortest path from 0 to amount), using BFS gives results much faster than DP. https://discuss.leetcode.com/topic/26262/short-python-solution-using-bfs beats 9...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: """This solution is inspired by the BFS solution for problem Perfect Square. Since it is to find the least coin solution (like a shortest path from 0 to amount), using BFS gives results much faster than DP. https://discuss.leetcode.com/topic/26262/short-python-solution-using-bfs beats 97.75%""" ...
the_stack_v2_python_sparse
LeetCode/322_coin_change.py
yao23/Machine_Learning_Playground
train
12
fec9ddb309b765614229d2a4e7aef62f246ed3f1
[ "X0 = np.array([X[i] for i in range(len(X)) if y[i] == 0])\nX1 = np.array([X[i] for i in range(len(X)) if y[i] == 1])\nself.mju0 = np.mean(X0, axis=0)\nself.mju1 = np.mean(X1, axis=0)\ncov0 = np.dot((X0 - self.mju0).T, X0 - self.mju0)\ncov1 = np.dot((X1 - self.mju1).T, X1 - self.mju1)\nSw = cov0 + cov1\nself.weight...
<|body_start_0|> X0 = np.array([X[i] for i in range(len(X)) if y[i] == 0]) X1 = np.array([X[i] for i in range(len(X)) if y[i] == 1]) self.mju0 = np.mean(X0, axis=0) self.mju1 = np.mean(X1, axis=0) cov0 = np.dot((X0 - self.mju0).T, X0 - self.mju0) cov1 = np.dot((X1 - self....
LDA
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LDA: def fit(self, X, y): """Function: Fit the model with linear discriminant analysis Parameters: X : numpy array of shape [n_samples,n_features] Training data y : numpy array of shape [n_samples] Target values. Will be cast to X's dtype if necessary Returns: self : returns an instance ...
stack_v2_sparse_classes_75kplus_train_005573
3,848
no_license
[ { "docstring": "Function: Fit the model with linear discriminant analysis Parameters: X : numpy array of shape [n_samples,n_features] Training data y : numpy array of shape [n_samples] Target values. Will be cast to X's dtype if necessary Returns: self : returns an instance of self.", "name": "fit", "si...
3
stack_v2_sparse_classes_30k_train_048806
Implement the Python class `LDA` described below. Class description: Implement the LDA class. Method signatures and docstrings: - def fit(self, X, y): Function: Fit the model with linear discriminant analysis Parameters: X : numpy array of shape [n_samples,n_features] Training data y : numpy array of shape [n_samples...
Implement the Python class `LDA` described below. Class description: Implement the LDA class. Method signatures and docstrings: - def fit(self, X, y): Function: Fit the model with linear discriminant analysis Parameters: X : numpy array of shape [n_samples,n_features] Training data y : numpy array of shape [n_samples...
670c8eecb280424a88dfc1093a08ead813010df7
<|skeleton|> class LDA: def fit(self, X, y): """Function: Fit the model with linear discriminant analysis Parameters: X : numpy array of shape [n_samples,n_features] Training data y : numpy array of shape [n_samples] Target values. Will be cast to X's dtype if necessary Returns: self : returns an instance ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LDA: def fit(self, X, y): """Function: Fit the model with linear discriminant analysis Parameters: X : numpy array of shape [n_samples,n_features] Training data y : numpy array of shape [n_samples] Target values. Will be cast to X's dtype if necessary Returns: self : returns an instance of self.""" ...
the_stack_v2_python_sparse
classification/demo/linear_discriminant_analysis_demo.py
CescWang1991/Python-Machine-Learning
train
0
dea8d4a5fb35ea6fab2f4e0ec2ed6669043418d8
[ "self.env.revert_snapshot('deploy_ha_lma_infrastructure_alerting')\ntarget_node = {'slave-02': ['controller']}\ntarget_node_hostname = self.helpers.get_hostname_by_node_name(target_node.keys()[0])\nself.helpers.remove_nodes_from_cluster(target_node)\nself.helpers.run_ostf(should_fail=1)\nself.check_plugin_online()\...
<|body_start_0|> self.env.revert_snapshot('deploy_ha_lma_infrastructure_alerting') target_node = {'slave-02': ['controller']} target_node_hostname = self.helpers.get_hostname_by_node_name(target_node.keys()[0]) self.helpers.remove_nodes_from_cluster(target_node) self.helpers.run_...
Class for system testing the LMA Infrastructure Alerting plugin.
TestLMAInfraAlertingPluginSystem
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestLMAInfraAlertingPluginSystem: """Class for system testing the LMA Infrastructure Alerting plugin.""" def add_remove_controller_lma_infrastructure_alerting(self): """Add/remove controller nodes in existing environment Scenario: 1. Remove 1 node with the controller role. 2. Re-depl...
stack_v2_sparse_classes_75kplus_train_005574
8,357
no_license
[ { "docstring": "Add/remove controller nodes in existing environment Scenario: 1. Remove 1 node with the controller role. 2. Re-deploy the cluster. 3. Check the plugin services using the CLI 4. Check in the Nagios UI that the removed node is no longer monitored. 5. Run the health checks (OSTF). 6. Add 1 new node...
5
stack_v2_sparse_classes_30k_train_035042
Implement the Python class `TestLMAInfraAlertingPluginSystem` described below. Class description: Class for system testing the LMA Infrastructure Alerting plugin. Method signatures and docstrings: - def add_remove_controller_lma_infrastructure_alerting(self): Add/remove controller nodes in existing environment Scenar...
Implement the Python class `TestLMAInfraAlertingPluginSystem` described below. Class description: Class for system testing the LMA Infrastructure Alerting plugin. Method signatures and docstrings: - def add_remove_controller_lma_infrastructure_alerting(self): Add/remove controller nodes in existing environment Scenar...
179249df2d206eeabb3955c9dc8cb78cac3c36c6
<|skeleton|> class TestLMAInfraAlertingPluginSystem: """Class for system testing the LMA Infrastructure Alerting plugin.""" def add_remove_controller_lma_infrastructure_alerting(self): """Add/remove controller nodes in existing environment Scenario: 1. Remove 1 node with the controller role. 2. Re-depl...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestLMAInfraAlertingPluginSystem: """Class for system testing the LMA Infrastructure Alerting plugin.""" def add_remove_controller_lma_infrastructure_alerting(self): """Add/remove controller nodes in existing environment Scenario: 1. Remove 1 node with the controller role. 2. Re-deploy the cluste...
the_stack_v2_python_sparse
stacklight_tests/lma_infrastructure_alerting/test_system.py
rkhozinov/stacklight-integration-tests
train
1
672706320945662acb243bd92111448ffb99f417
[ "self.file_writer = tf.summary.create_file_writer(logdir)\nself.name = name\nself._max_images = max_images\nself._draw_bbox = draw_bbox", "with self.file_writer.as_default():\n image_draw = image\n if self._draw_bbox:\n bboxes = tf.gather(label[:, :, :4], [1, 0, 3, 2], axis=2)\n colors = np.ar...
<|body_start_0|> self.file_writer = tf.summary.create_file_writer(logdir) self.name = name self._max_images = max_images self._draw_bbox = draw_bbox <|end_body_0|> <|body_start_1|> with self.file_writer.as_default(): image_draw = image if self._draw_bbox:...
Utility class for logging images in tensorboard
ImageLogger
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageLogger: """Utility class for logging images in tensorboard""" def __init__(self, name, logdir, max_images=2, draw_bbox=False): """Initialize it, creates image tab named "name" in tensorboard""" <|body_0|> def __call__(self, image, label): """Will be performe...
stack_v2_sparse_classes_75kplus_train_005575
3,493
permissive
[ { "docstring": "Initialize it, creates image tab named \"name\" in tensorboard", "name": "__init__", "signature": "def __init__(self, name, logdir, max_images=2, draw_bbox=False)" }, { "docstring": "Will be performed for every batch call (but only two images will be saved)", "name": "__call_...
2
stack_v2_sparse_classes_30k_train_016548
Implement the Python class `ImageLogger` described below. Class description: Utility class for logging images in tensorboard Method signatures and docstrings: - def __init__(self, name, logdir, max_images=2, draw_bbox=False): Initialize it, creates image tab named "name" in tensorboard - def __call__(self, image, lab...
Implement the Python class `ImageLogger` described below. Class description: Utility class for logging images in tensorboard Method signatures and docstrings: - def __init__(self, name, logdir, max_images=2, draw_bbox=False): Initialize it, creates image tab named "name" in tensorboard - def __call__(self, image, lab...
8df69c75b117079f5e40929341c4638e741de11d
<|skeleton|> class ImageLogger: """Utility class for logging images in tensorboard""" def __init__(self, name, logdir, max_images=2, draw_bbox=False): """Initialize it, creates image tab named "name" in tensorboard""" <|body_0|> def __call__(self, image, label): """Will be performe...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ImageLogger: """Utility class for logging images in tensorboard""" def __init__(self, name, logdir, max_images=2, draw_bbox=False): """Initialize it, creates image tab named "name" in tensorboard""" self.file_writer = tf.summary.create_file_writer(logdir) self.name = name ...
the_stack_v2_python_sparse
quake_ai/utils/model_utils.py
lostwisdom/Quake_AI
train
0
84237951a38ebe151d9cfe1e48f7da952d397823
[ "dp = [0 for _ in range(n + 1)]\ndp[2] = 1\nfor i in range(3, n + 1):\n for j in range(i):\n dp[i] = max(dp[i], max((i - j) * j, j * dp[i - j]))\nreturn dp[n]", "if n <= 3:\n return n - 1\na, b = (n // 3, n % 3)\nif b == 0:\n return int(math.pow(3, a))\nif b == 1:\n return int(math.pow(3, a - 1...
<|body_start_0|> dp = [0 for _ in range(n + 1)] dp[2] = 1 for i in range(3, n + 1): for j in range(i): dp[i] = max(dp[i], max((i - j) * j, j * dp[i - j])) return dp[n] <|end_body_0|> <|body_start_1|> if n <= 3: return n - 1 a, b = ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def cuttingRope_1(self, n: int) -> int: """方法三:动态规划(自底向上) 时间复杂度:O(N^2) 空间复杂度:O(N) :param n: :return:""" <|body_0|> def cuttingRope_2(self, n: int) -> int: """:param n: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> dp = [0 for _ ...
stack_v2_sparse_classes_75kplus_train_005576
1,515
no_license
[ { "docstring": "方法三:动态规划(自底向上) 时间复杂度:O(N^2) 空间复杂度:O(N) :param n: :return:", "name": "cuttingRope_1", "signature": "def cuttingRope_1(self, n: int) -> int" }, { "docstring": ":param n: :return:", "name": "cuttingRope_2", "signature": "def cuttingRope_2(self, n: int) -> int" } ]
2
stack_v2_sparse_classes_30k_train_011839
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def cuttingRope_1(self, n: int) -> int: 方法三:动态规划(自底向上) 时间复杂度:O(N^2) 空间复杂度:O(N) :param n: :return: - def cuttingRope_2(self, n: int) -> int: :param n: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def cuttingRope_1(self, n: int) -> int: 方法三:动态规划(自底向上) 时间复杂度:O(N^2) 空间复杂度:O(N) :param n: :return: - def cuttingRope_2(self, n: int) -> int: :param n: :return: <|skeleton|> class...
62419b49000e79962bcdc99cd98afd2fb82ea345
<|skeleton|> class Solution: def cuttingRope_1(self, n: int) -> int: """方法三:动态规划(自底向上) 时间复杂度:O(N^2) 空间复杂度:O(N) :param n: :return:""" <|body_0|> def cuttingRope_2(self, n: int) -> int: """:param n: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def cuttingRope_1(self, n: int) -> int: """方法三:动态规划(自底向上) 时间复杂度:O(N^2) 空间复杂度:O(N) :param n: :return:""" dp = [0 for _ in range(n + 1)] dp[2] = 1 for i in range(3, n + 1): for j in range(i): dp[i] = max(dp[i], max((i - j) * j, j * dp[i - j])...
the_stack_v2_python_sparse
剑指 Offer(第 2 版)/cuttingRope.py
MaoningGuan/LeetCode
train
3
5253dfceafbbf2f6883080a580b76818ec808822
[ "rev_versions = {'reV': __version__, 'rex': rex.__version__, 'pysam': PySAM.__version__, 'python': sys.version, 'nrwal': NRWAL.__version__}\nversions = super().full_version_record\nversions.update(rev_versions)\nreturn versions", "self.h5.attrs['version'] = __version__\nself.h5.attrs['full_version_record'] = json...
<|body_start_0|> rev_versions = {'reV': __version__, 'rex': rex.__version__, 'pysam': PySAM.__version__, 'python': sys.version, 'nrwal': NRWAL.__version__} versions = super().full_version_record versions.update(rev_versions) return versions <|end_body_0|> <|body_start_1|> self.h...
Base class to handle reV output data in .h5 format Examples -------- The reV Outputs handler can be used to initialize h5 files in the standard reV/rex resource data format. >>> from reV import Outputs >>> import pandas as pd >>> import numpy as np >>> >>> meta = pd.DataFrame({'latitude': np.ones(100), >>> 'longitude':...
Outputs
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Outputs: """Base class to handle reV output data in .h5 format Examples -------- The reV Outputs handler can be used to initialize h5 files in the standard reV/rex resource data format. >>> from reV import Outputs >>> import pandas as pd >>> import numpy as np >>> >>> meta = pd.DataFrame({'latitu...
stack_v2_sparse_classes_75kplus_train_005577
6,003
permissive
[ { "docstring": "Get record of versions for dependencies Returns ------- dict Dictionary of package versions for dependencies", "name": "full_version_record", "signature": "def full_version_record(self)" }, { "docstring": "Set the version attribute to the h5 file.", "name": "set_version_attr"...
2
stack_v2_sparse_classes_30k_train_032067
Implement the Python class `Outputs` described below. Class description: Base class to handle reV output data in .h5 format Examples -------- The reV Outputs handler can be used to initialize h5 files in the standard reV/rex resource data format. >>> from reV import Outputs >>> import pandas as pd >>> import numpy as ...
Implement the Python class `Outputs` described below. Class description: Base class to handle reV output data in .h5 format Examples -------- The reV Outputs handler can be used to initialize h5 files in the standard reV/rex resource data format. >>> from reV import Outputs >>> import pandas as pd >>> import numpy as ...
497bb7d172197e09a9e14b1b1ca891b8c828b80a
<|skeleton|> class Outputs: """Base class to handle reV output data in .h5 format Examples -------- The reV Outputs handler can be used to initialize h5 files in the standard reV/rex resource data format. >>> from reV import Outputs >>> import pandas as pd >>> import numpy as np >>> >>> meta = pd.DataFrame({'latitu...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Outputs: """Base class to handle reV output data in .h5 format Examples -------- The reV Outputs handler can be used to initialize h5 files in the standard reV/rex resource data format. >>> from reV import Outputs >>> import pandas as pd >>> import numpy as np >>> >>> meta = pd.DataFrame({'latitude': np.ones(...
the_stack_v2_python_sparse
reV/handlers/outputs.py
NREL/reV
train
53
88597ecab3622e17f809b0f2e7c1a6f00c6a8022
[ "self.issuer_name = issuer_name\nself.subject_name = subject_name\nself.valid_from_date = APIHelper.RFC3339DateTime(valid_from_date) if valid_from_date else None\nself.valid_to_date = APIHelper.RFC3339DateTime(valid_to_date) if valid_to_date else None\nself.version_number = version_number\nself.serial_number = seri...
<|body_start_0|> self.issuer_name = issuer_name self.subject_name = subject_name self.valid_from_date = APIHelper.RFC3339DateTime(valid_from_date) if valid_from_date else None self.valid_to_date = APIHelper.RFC3339DateTime(valid_to_date) if valid_to_date else None self.version_nu...
Implementation of the 'Certificate' model. TODO: type model description here. Attributes: issuer_name (string): TODO: type description here. subject_name (string): TODO: type description here. valid_from_date (datetime): TODO: type description here. valid_to_date (datetime): TODO: type description here. version_number ...
Certificate
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Certificate: """Implementation of the 'Certificate' model. TODO: type model description here. Attributes: issuer_name (string): TODO: type description here. subject_name (string): TODO: type description here. valid_from_date (datetime): TODO: type description here. valid_to_date (datetime): TODO:...
stack_v2_sparse_classes_75kplus_train_005578
8,051
permissive
[ { "docstring": "Constructor for the Certificate class", "name": "__init__", "signature": "def __init__(self, issuer_name=None, subject_name=None, valid_from_date=None, valid_to_date=None, version_number=None, serial_number=None, key_algorithm=None, key_size=None, unique_id=None, originator=None, bank_na...
2
stack_v2_sparse_classes_30k_train_016782
Implement the Python class `Certificate` described below. Class description: Implementation of the 'Certificate' model. TODO: type model description here. Attributes: issuer_name (string): TODO: type description here. subject_name (string): TODO: type description here. valid_from_date (datetime): TODO: type descriptio...
Implement the Python class `Certificate` described below. Class description: Implementation of the 'Certificate' model. TODO: type model description here. Attributes: issuer_name (string): TODO: type description here. subject_name (string): TODO: type description here. valid_from_date (datetime): TODO: type descriptio...
fa3918a6c54ea0eedb9146578645b7eb1755b642
<|skeleton|> class Certificate: """Implementation of the 'Certificate' model. TODO: type model description here. Attributes: issuer_name (string): TODO: type description here. subject_name (string): TODO: type description here. valid_from_date (datetime): TODO: type description here. valid_to_date (datetime): TODO:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Certificate: """Implementation of the 'Certificate' model. TODO: type model description here. Attributes: issuer_name (string): TODO: type description here. subject_name (string): TODO: type description here. valid_from_date (datetime): TODO: type description here. valid_to_date (datetime): TODO: type descrip...
the_stack_v2_python_sparse
idfy_rest_client/models/certificate.py
dealflowteam/Idfy
train
0
1f9a6aa521b4ac6948a8c0b58b34a7d90001a3da
[ "self.measures_per_point = 3\nself.nr_points = 15\nself.ts_screen_number = 1\nself.ramp_config = 'bo_ramp_flop_emit_exchange_slower'\nself.init_delay = -3\nself.final_delay = 3\nself.roix = [500, 800]\nself.roiy = [400, 600]\nself.line_window = 4", "ftmp = '{0:26s} = {1:9.6f} {2:s}\\n'.format\ndtmp = '{0:26s} = ...
<|body_start_0|> self.measures_per_point = 3 self.nr_points = 15 self.ts_screen_number = 1 self.ramp_config = 'bo_ramp_flop_emit_exchange_slower' self.init_delay = -3 self.final_delay = 3 self.roix = [500, 800] self.roiy = [400, 600] self.line_wind...
.
BeamSizesParams
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BeamSizesParams: """.""" def __init__(self): """.""" <|body_0|> def __str__(self): """.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.measures_per_point = 3 self.nr_points = 15 self.ts_screen_number = 1 self.ramp_c...
stack_v2_sparse_classes_75kplus_train_005579
13,094
permissive
[ { "docstring": ".", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": ".", "name": "__str__", "signature": "def __str__(self)" } ]
2
stack_v2_sparse_classes_30k_train_039190
Implement the Python class `BeamSizesParams` described below. Class description: . Method signatures and docstrings: - def __init__(self): . - def __str__(self): .
Implement the Python class `BeamSizesParams` described below. Class description: . Method signatures and docstrings: - def __init__(self): . - def __str__(self): . <|skeleton|> class BeamSizesParams: """.""" def __init__(self): """.""" <|body_0|> def __str__(self): """.""" ...
39644161d98964a3a3d80d63269201f0a1712e82
<|skeleton|> class BeamSizesParams: """.""" def __init__(self): """.""" <|body_0|> def __str__(self): """.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BeamSizesParams: """.""" def __init__(self): """.""" self.measures_per_point = 3 self.nr_points = 15 self.ts_screen_number = 1 self.ramp_config = 'bo_ramp_flop_emit_exchange_slower' self.init_delay = -3 self.final_delay = 3 self.roix = [500,...
the_stack_v2_python_sparse
apsuite/commisslib/emit_exchange/beam_sizes.py
lnls-fac/apsuite
train
1
7dcd18b349eae8270ccea29a4b8fab20ba47e2aa
[ "session = Session()\ndomain = session['domain']\nif not domain:\n self.redirect('/')\ndetails = {}\ndetails['groups'] = self.GetGroups(domain, username)\ndetails['orgunit'] = self.GetOrgunit(domain, username)\ndetails['nicknames'] = self.GetNicknames(domain, username)\ndata = json.dumps(details)\nlogging.debug(...
<|body_start_0|> session = Session() domain = session['domain'] if not domain: self.redirect('/') details = {} details['groups'] = self.GetGroups(domain, username) details['orgunit'] = self.GetOrgunit(domain, username) details['nicknames'] = self.GetNi...
Handles get request to '/getdetails' URL.
UserDetailsHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserDetailsHandler: """Handles get request to '/getdetails' URL.""" def get(self, username): """Handels the get request for the UserDetailsHandler. Sends groups, organization unit and nicknames for the user in a JSON object. Args: username: A string denoting the user's username.""" ...
stack_v2_sparse_classes_75kplus_train_005580
8,030
permissive
[ { "docstring": "Handels the get request for the UserDetailsHandler. Sends groups, organization unit and nicknames for the user in a JSON object. Args: username: A string denoting the user's username.", "name": "get", "signature": "def get(self, username)" }, { "docstring": "Retrieves a list of g...
4
stack_v2_sparse_classes_30k_train_005436
Implement the Python class `UserDetailsHandler` described below. Class description: Handles get request to '/getdetails' URL. Method signatures and docstrings: - def get(self, username): Handels the get request for the UserDetailsHandler. Sends groups, organization unit and nicknames for the user in a JSON object. Ar...
Implement the Python class `UserDetailsHandler` described below. Class description: Handles get request to '/getdetails' URL. Method signatures and docstrings: - def get(self, username): Handels the get request for the UserDetailsHandler. Sends groups, organization unit and nicknames for the user in a JSON object. Ar...
56d49a9915ce51590a655ec5f8aeef9f65517787
<|skeleton|> class UserDetailsHandler: """Handles get request to '/getdetails' URL.""" def get(self, username): """Handels the get request for the UserDetailsHandler. Sends groups, organization unit and nicknames for the user in a JSON object. Args: username: A string denoting the user's username.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserDetailsHandler: """Handles get request to '/getdetails' URL.""" def get(self, username): """Handels the get request for the UserDetailsHandler. Sends groups, organization unit and nicknames for the user in a JSON object. Args: username: A string denoting the user's username.""" sessio...
the_stack_v2_python_sparse
samples/apps/marketplace_sample/domain_mgmt_app.py
hfalcic/google-gdata
train
3
1330f25d3bd74e6e2b640e2bc28adfa81e3e42b1
[ "temp = [[]]\nperms = []\nfor each_num in nums:\n for s in range(len(temp)):\n each_sub_set = temp[s]\n for i in range(len(each_sub_set) + 1):\n new_list = list(each_sub_set)\n new_list.insert(i, each_num)\n if len(new_list) == len(nums):\n perms.appe...
<|body_start_0|> temp = [[]] perms = [] for each_num in nums: for s in range(len(temp)): each_sub_set = temp[s] for i in range(len(each_sub_set) + 1): new_list = list(each_sub_set) new_list.insert(i, each_num) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def permute(self, nums: List[int]) -> List[List[int]]: """Time Complexity => O(n!)""" <|body_0|> def permute_backtracking(self, nums: List[int]) -> List[List[int]]: """Time Complexity => O(n!)""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_005581
1,625
no_license
[ { "docstring": "Time Complexity => O(n!)", "name": "permute", "signature": "def permute(self, nums: List[int]) -> List[List[int]]" }, { "docstring": "Time Complexity => O(n!)", "name": "permute_backtracking", "signature": "def permute_backtracking(self, nums: List[int]) -> List[List[int]...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def permute(self, nums: List[int]) -> List[List[int]]: Time Complexity => O(n!) - def permute_backtracking(self, nums: List[int]) -> List[List[int]]: Time Complexity => O(n!)
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def permute(self, nums: List[int]) -> List[List[int]]: Time Complexity => O(n!) - def permute_backtracking(self, nums: List[int]) -> List[List[int]]: Time Complexity => O(n!) <|...
80cca595dc688ca67c1ebb45b339e724ec09c374
<|skeleton|> class Solution: def permute(self, nums: List[int]) -> List[List[int]]: """Time Complexity => O(n!)""" <|body_0|> def permute_backtracking(self, nums: List[int]) -> List[List[int]]: """Time Complexity => O(n!)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def permute(self, nums: List[int]) -> List[List[int]]: """Time Complexity => O(n!)""" temp = [[]] perms = [] for each_num in nums: for s in range(len(temp)): each_sub_set = temp[s] for i in range(len(each_sub_set) + 1): ...
the_stack_v2_python_sparse
Concepts/Backtracking/46.Permutations.py
Dinesh94Singh/PythonArchivedSolutions
train
0
2cbdfcfde643582a03b3d82fb0705b90fa1796cd
[ "try:\n layer_details_dto = LayerService.get_layer_dto_by_id(id)\n return (layer_details_dto.to_primitive(), 200)\nexcept LayerServiceError as e:\n return ({'Error': str(e)}, 400)\nexcept NotFound:\n return ({'Error': 'No layer found'}, 404)\nexcept Exception as e:\n error_msg = f'Layer GET - unhandl...
<|body_start_0|> try: layer_details_dto = LayerService.get_layer_dto_by_id(id) return (layer_details_dto.to_primitive(), 200) except LayerServiceError as e: return ({'Error': str(e)}, 400) except NotFound: return ({'Error': 'No layer found'}, 404) ...
LayerAPI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LayerAPI: def get(self, id): """Gets a layer --- tags: - admin - layers produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token required: true type: string - in: path name: id description: ID of the layer type: integer required:...
stack_v2_sparse_classes_75kplus_train_005582
5,860
no_license
[ { "docstring": "Gets a layer --- tags: - admin - layers produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token required: true type: string - in: path name: id description: ID of the layer type: integer required: true default: 1 responses: 200: descrip...
2
null
Implement the Python class `LayerAPI` described below. Class description: Implement the LayerAPI class. Method signatures and docstrings: - def get(self, id): Gets a layer --- tags: - admin - layers produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token req...
Implement the Python class `LayerAPI` described below. Class description: Implement the LayerAPI class. Method signatures and docstrings: - def get(self, id): Gets a layer --- tags: - admin - layers produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token req...
8c851d2f740100c43f7b033f64adfa5a0d563f39
<|skeleton|> class LayerAPI: def get(self, id): """Gets a layer --- tags: - admin - layers produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token required: true type: string - in: path name: id description: ID of the layer type: integer required:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LayerAPI: def get(self, id): """Gets a layer --- tags: - admin - layers produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token required: true type: string - in: path name: id description: ID of the layer type: integer required: true default:...
the_stack_v2_python_sparse
server/api/layer_api.py
thinkWhere/DMIS
train
4
2adf3f18e606b193ccaafbf7b02ef642c609fc0e
[ "minNumber = 1000000000.0\nfor i in numbers:\n if i < minNumber:\n minNumber = i\nreturn minNumber", "i, j = (0, len(numbers) - 1)\nwhile i < j:\n m = (i + j) // 2\n if numbers[m] > numbers[j]:\n i = m + 1\n elif numbers[m] < numbers[j]:\n j = m\n else:\n j -= 1\nreturn ...
<|body_start_0|> minNumber = 1000000000.0 for i in numbers: if i < minNumber: minNumber = i return minNumber <|end_body_0|> <|body_start_1|> i, j = (0, len(numbers) - 1) while i < j: m = (i + j) // 2 if numbers[m] > numbers[j]:...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minArray(self, numbers: List[int]) -> int: """注意此题:虽然是递增排序,但是并不排除是包含重复元素的升序数组。 此题会分为三种情况: 第一种情况: 数组[1,2,3,4,5] 1和2旋转后数组尾部, 旋转后为 [3,4,5,1,2] 第二种情况: 数组[1,2,3,4,5] 整体旋转,旋转后不变,仍然为[1,2,3,4,5] 第三种情况: 数组[1,1,1,1,1] 不管怎么旋转,旋转后都为 [1,1,1,1,1] 复杂度分析: 时间复杂度为O(n) 空间复杂度为O(1)""" <...
stack_v2_sparse_classes_75kplus_train_005583
3,169
no_license
[ { "docstring": "注意此题:虽然是递增排序,但是并不排除是包含重复元素的升序数组。 此题会分为三种情况: 第一种情况: 数组[1,2,3,4,5] 1和2旋转后数组尾部, 旋转后为 [3,4,5,1,2] 第二种情况: 数组[1,2,3,4,5] 整体旋转,旋转后不变,仍然为[1,2,3,4,5] 第三种情况: 数组[1,1,1,1,1] 不管怎么旋转,旋转后都为 [1,1,1,1,1] 复杂度分析: 时间复杂度为O(n) 空间复杂度为O(1)", "name": "minArray", "signature": "def minArray(self, numbers: List[int...
2
stack_v2_sparse_classes_30k_train_024424
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minArray(self, numbers: List[int]) -> int: 注意此题:虽然是递增排序,但是并不排除是包含重复元素的升序数组。 此题会分为三种情况: 第一种情况: 数组[1,2,3,4,5] 1和2旋转后数组尾部, 旋转后为 [3,4,5,1,2] 第二种情况: 数组[1,2,3,4,5] 整体旋转,旋转后不变,仍然为[1...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minArray(self, numbers: List[int]) -> int: 注意此题:虽然是递增排序,但是并不排除是包含重复元素的升序数组。 此题会分为三种情况: 第一种情况: 数组[1,2,3,4,5] 1和2旋转后数组尾部, 旋转后为 [3,4,5,1,2] 第二种情况: 数组[1,2,3,4,5] 整体旋转,旋转后不变,仍然为[1...
51943e2c2c4ec70c7c1d5b53c9fdf0a719428d7a
<|skeleton|> class Solution: def minArray(self, numbers: List[int]) -> int: """注意此题:虽然是递增排序,但是并不排除是包含重复元素的升序数组。 此题会分为三种情况: 第一种情况: 数组[1,2,3,4,5] 1和2旋转后数组尾部, 旋转后为 [3,4,5,1,2] 第二种情况: 数组[1,2,3,4,5] 整体旋转,旋转后不变,仍然为[1,2,3,4,5] 第三种情况: 数组[1,1,1,1,1] 不管怎么旋转,旋转后都为 [1,1,1,1,1] 复杂度分析: 时间复杂度为O(n) 空间复杂度为O(1)""" <...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def minArray(self, numbers: List[int]) -> int: """注意此题:虽然是递增排序,但是并不排除是包含重复元素的升序数组。 此题会分为三种情况: 第一种情况: 数组[1,2,3,4,5] 1和2旋转后数组尾部, 旋转后为 [3,4,5,1,2] 第二种情况: 数组[1,2,3,4,5] 整体旋转,旋转后不变,仍然为[1,2,3,4,5] 第三种情况: 数组[1,1,1,1,1] 不管怎么旋转,旋转后都为 [1,1,1,1,1] 复杂度分析: 时间复杂度为O(n) 空间复杂度为O(1)""" minNumber = 100...
the_stack_v2_python_sparse
剑指offer/PythonVersion/11_旋转数组的最小数字.py
LeBron-Jian/BasicAlgorithmPractice
train
13
a7e27c730eebd63102939b372b90e30353ee2e74
[ "LOG.debug('image_defined called for instance', instance=instance)\ntry:\n client = self.get_session(instance.host)\n return client.alias_defined(instance.image_ref)\nexcept lxd_exceptions.APIError as ex:\n if ex.status_code == 404:\n return False\n else:\n msg = _('Failed to communicate w...
<|body_start_0|> LOG.debug('image_defined called for instance', instance=instance) try: client = self.get_session(instance.host) return client.alias_defined(instance.image_ref) except lxd_exceptions.APIError as ex: if ex.status_code == 404: ret...
Image functions for LXD.
ImageMixin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageMixin: """Image functions for LXD.""" def image_defined(self, instance): """Checks existence of an image on the local LXD image store :param instance: The nova instance Returns True if supplied image exists on the host, False otherwise""" <|body_0|> def create_alias...
stack_v2_sparse_classes_75kplus_train_005584
4,586
permissive
[ { "docstring": "Checks existence of an image on the local LXD image store :param instance: The nova instance Returns True if supplied image exists on the host, False otherwise", "name": "image_defined", "signature": "def image_defined(self, instance)" }, { "docstring": "Creates an alias for a gi...
3
stack_v2_sparse_classes_30k_train_018930
Implement the Python class `ImageMixin` described below. Class description: Image functions for LXD. Method signatures and docstrings: - def image_defined(self, instance): Checks existence of an image on the local LXD image store :param instance: The nova instance Returns True if supplied image exists on the host, Fa...
Implement the Python class `ImageMixin` described below. Class description: Image functions for LXD. Method signatures and docstrings: - def image_defined(self, instance): Checks existence of an image on the local LXD image store :param instance: The nova instance Returns True if supplied image exists on the host, Fa...
b305843e268ce4044b7fbb930b353bdbd2ad0c44
<|skeleton|> class ImageMixin: """Image functions for LXD.""" def image_defined(self, instance): """Checks existence of an image on the local LXD image store :param instance: The nova instance Returns True if supplied image exists on the host, False otherwise""" <|body_0|> def create_alias...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ImageMixin: """Image functions for LXD.""" def image_defined(self, instance): """Checks existence of an image on the local LXD image store :param instance: The nova instance Returns True if supplied image exists on the host, False otherwise""" LOG.debug('image_defined called for instance'...
the_stack_v2_python_sparse
nova_lxd/nova/virt/lxd/session/image.py
bkuschel/nova-lxd
train
1
c1759cc3a5421d2c8277d99a234498ea469202aa
[ "items = obj.items.all()\nif items:\n return OrderItemSerializer(items, many=True).data\nelse:\n return None", "if obj.shipping_address:\n return ShippingAddressSerializer(obj.shipping_address, many=False).data\nelse:\n return None" ]
<|body_start_0|> items = obj.items.all() if items: return OrderItemSerializer(items, many=True).data else: return None <|end_body_0|> <|body_start_1|> if obj.shipping_address: return ShippingAddressSerializer(obj.shipping_address, many=False).data ...
Order model serializer.
OrderSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrderSerializer: """Order model serializer.""" def get_orders(self, obj): """Get order's items.""" <|body_0|> def get_shipping_address(self, obj): """Get shipping address.""" <|body_1|> <|end_skeleton|> <|body_start_0|> items = obj.items.all() ...
stack_v2_sparse_classes_75kplus_train_005585
1,705
no_license
[ { "docstring": "Get order's items.", "name": "get_orders", "signature": "def get_orders(self, obj)" }, { "docstring": "Get shipping address.", "name": "get_shipping_address", "signature": "def get_shipping_address(self, obj)" } ]
2
stack_v2_sparse_classes_30k_train_048083
Implement the Python class `OrderSerializer` described below. Class description: Order model serializer. Method signatures and docstrings: - def get_orders(self, obj): Get order's items. - def get_shipping_address(self, obj): Get shipping address.
Implement the Python class `OrderSerializer` described below. Class description: Order model serializer. Method signatures and docstrings: - def get_orders(self, obj): Get order's items. - def get_shipping_address(self, obj): Get shipping address. <|skeleton|> class OrderSerializer: """Order model serializer."""...
6c2e8bc6b0a172ff34d0f3191dfdebbd85584525
<|skeleton|> class OrderSerializer: """Order model serializer.""" def get_orders(self, obj): """Get order's items.""" <|body_0|> def get_shipping_address(self, obj): """Get shipping address.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OrderSerializer: """Order model serializer.""" def get_orders(self, obj): """Get order's items.""" items = obj.items.all() if items: return OrderItemSerializer(items, many=True).data else: return None def get_shipping_address(self, obj): ...
the_stack_v2_python_sparse
order/serializers.py
OmarFateh/api-ecommerce
train
1
3ef17ef6d07db3ad0d73923b1c598b17382b9274
[ "if version:\n if version == 4:\n return Command.executeIp(logger, IpConstant.IPV4, IpOption.RULE, IpAction.SHOW)\n elif version == 6:\n return Command.executeIp(logger, IpConstant.IPV6, IpOption.RULE, IpAction.SHOW)\nrc = Command.executeIp(logger, IpOption.RULE, IpAction.SHOW)\nreturn rc", "i...
<|body_start_0|> if version: if version == 4: return Command.executeIp(logger, IpConstant.IPV4, IpOption.RULE, IpAction.SHOW) elif version == 6: return Command.executeIp(logger, IpConstant.IPV6, IpOption.RULE, IpAction.SHOW) rc = Command.executeIp(...
IpRule
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IpRule: def showRules(logger, version=None): """This function list all rules Args: logger Return: tuple (rc, stdout, stderr) Raise: None""" <|body_0|> def addRule(logger, source, table, version=None): """This function inserts a new rule Args: logger source - select t...
stack_v2_sparse_classes_75kplus_train_005586
23,984
no_license
[ { "docstring": "This function list all rules Args: logger Return: tuple (rc, stdout, stderr) Raise: None", "name": "showRules", "signature": "def showRules(logger, version=None)" }, { "docstring": "This function inserts a new rule Args: logger source - select the source prefix to match. table - ...
4
stack_v2_sparse_classes_30k_train_006018
Implement the Python class `IpRule` described below. Class description: Implement the IpRule class. Method signatures and docstrings: - def showRules(logger, version=None): This function list all rules Args: logger Return: tuple (rc, stdout, stderr) Raise: None - def addRule(logger, source, table, version=None): This...
Implement the Python class `IpRule` described below. Class description: Implement the IpRule class. Method signatures and docstrings: - def showRules(logger, version=None): This function list all rules Args: logger Return: tuple (rc, stdout, stderr) Raise: None - def addRule(logger, source, table, version=None): This...
81bcc74fe7c0ca036ec483f634d7be0bab19a6d0
<|skeleton|> class IpRule: def showRules(logger, version=None): """This function list all rules Args: logger Return: tuple (rc, stdout, stderr) Raise: None""" <|body_0|> def addRule(logger, source, table, version=None): """This function inserts a new rule Args: logger source - select t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IpRule: def showRules(logger, version=None): """This function list all rules Args: logger Return: tuple (rc, stdout, stderr) Raise: None""" if version: if version == 4: return Command.executeIp(logger, IpConstant.IPV4, IpOption.RULE, IpAction.SHOW) elif ...
the_stack_v2_python_sparse
oscar/a/sys/net/lnx/route.py
afeset/miner2-tools
train
0
e6b5e8b219df706a9e9fc575954b05b4718d918b
[ "mod_dir = 'a/b/packages/apps/Settings'\nmock_isdir.return_value = True\nvscode_native_project_file_gen.VSCodeNativeProjectFileGenerator(mod_dir)\nself.assertFalse(mock_mkdir.called)\nmock_mkdir.mock_reset()\nmock_isdir.return_value = False\nvscode_native_project_file_gen.VSCodeNativeProjectFileGenerator(mod_dir)\n...
<|body_start_0|> mod_dir = 'a/b/packages/apps/Settings' mock_isdir.return_value = True vscode_native_project_file_gen.VSCodeNativeProjectFileGenerator(mod_dir) self.assertFalse(mock_mkdir.called) mock_mkdir.mock_reset() mock_isdir.return_value = False vscode_nativ...
Unit tests for vscode_native_project_file_gen.py
VSCodeNativeProjectFileGenUnittests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VSCodeNativeProjectFileGenUnittests: """Unit tests for vscode_native_project_file_gen.py""" def test_init(self, mock_isdir, mock_mkdir): """Test initializing VSCodeNativeProjectFileGenerator.""" <|body_0|> def test_create_c_cpp_properties_dict(self, mock_isfile, mock_isd...
stack_v2_sparse_classes_75kplus_train_005587
3,203
no_license
[ { "docstring": "Test initializing VSCodeNativeProjectFileGenerator.", "name": "test_init", "signature": "def test_init(self, mock_isdir, mock_mkdir)" }, { "docstring": "Test _create_c_cpp_properties_dict with conditions.", "name": "test_create_c_cpp_properties_dict", "signature": "def te...
2
stack_v2_sparse_classes_30k_train_048719
Implement the Python class `VSCodeNativeProjectFileGenUnittests` described below. Class description: Unit tests for vscode_native_project_file_gen.py Method signatures and docstrings: - def test_init(self, mock_isdir, mock_mkdir): Test initializing VSCodeNativeProjectFileGenerator. - def test_create_c_cpp_properties_...
Implement the Python class `VSCodeNativeProjectFileGenUnittests` described below. Class description: Unit tests for vscode_native_project_file_gen.py Method signatures and docstrings: - def test_init(self, mock_isdir, mock_mkdir): Test initializing VSCodeNativeProjectFileGenerator. - def test_create_c_cpp_properties_...
78a61ca023cbf1a0cecfef8b97df2b274ac3a988
<|skeleton|> class VSCodeNativeProjectFileGenUnittests: """Unit tests for vscode_native_project_file_gen.py""" def test_init(self, mock_isdir, mock_mkdir): """Test initializing VSCodeNativeProjectFileGenerator.""" <|body_0|> def test_create_c_cpp_properties_dict(self, mock_isfile, mock_isd...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VSCodeNativeProjectFileGenUnittests: """Unit tests for vscode_native_project_file_gen.py""" def test_init(self, mock_isdir, mock_mkdir): """Test initializing VSCodeNativeProjectFileGenerator.""" mod_dir = 'a/b/packages/apps/Settings' mock_isdir.return_value = True vscode_n...
the_stack_v2_python_sparse
tools/asuite/aidegen/vscode/vscode_native_project_file_gen_unittest.py
ZYHGOD-1/Aosp11
train
0
957d1156ec560bbec583cde8a123231ef0151415
[ "res = {}\nfor vehi in self.browse(cr, uid, ids, context=context):\n res[vehi['id']] = len(vehi.vehi_participants_ids)\nreturn res", "if context is None:\n context = {}\nif context.get('name'):\n transport_obj = self.pool.get('student.transport')\n transport_data = transport_obj.browse(cr, uid, contex...
<|body_start_0|> res = {} for vehi in self.browse(cr, uid, ids, context=context): res[vehi['id']] = len(vehi.vehi_participants_ids) return res <|end_body_0|> <|body_start_1|> if context is None: context = {} if context.get('name'): transport_o...
transport_vehicle
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class transport_vehicle: def _participants(self, cr, uid, ids, name, vals, context=None): """This method calculate total participants @param self : Object Pointer @param cr : Database Cursor @param uid : Current Logged in User @param ids : Current Records @param name : Functional field's name ...
stack_v2_sparse_classes_75kplus_train_005588
21,327
no_license
[ { "docstring": "This method calculate total participants @param self : Object Pointer @param cr : Database Cursor @param uid : Current Logged in User @param ids : Current Records @param name : Functional field's name @param vals : Other arguments @param context : standard Dictionary @return : Dictionary having ...
2
stack_v2_sparse_classes_30k_train_003735
Implement the Python class `transport_vehicle` described below. Class description: Implement the transport_vehicle class. Method signatures and docstrings: - def _participants(self, cr, uid, ids, name, vals, context=None): This method calculate total participants @param self : Object Pointer @param cr : Database Curs...
Implement the Python class `transport_vehicle` described below. Class description: Implement the transport_vehicle class. Method signatures and docstrings: - def _participants(self, cr, uid, ids, name, vals, context=None): This method calculate total participants @param self : Object Pointer @param cr : Database Curs...
c5a5678379649ccdf57a9d55b09b30436428b430
<|skeleton|> class transport_vehicle: def _participants(self, cr, uid, ids, name, vals, context=None): """This method calculate total participants @param self : Object Pointer @param cr : Database Cursor @param uid : Current Logged in User @param ids : Current Records @param name : Functional field's name ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class transport_vehicle: def _participants(self, cr, uid, ids, name, vals, context=None): """This method calculate total participants @param self : Object Pointer @param cr : Database Cursor @param uid : Current Logged in User @param ids : Current Records @param name : Functional field's name @param vals : ...
the_stack_v2_python_sparse
education/school_transport/transport.py
adahra/addons
train
1
6f577324a94c6e2a4e08df062d3dd9d01aa40184
[ "args_parser = RequestParser()\nargs_parser.add_argument('page', type=inputs.positive, required=False, location='args')\nargs_parser.add_argument('per_page', type=inputs.int_range(constants.PER_PAGE_MIN, constants.PER_PAGE_MAX, 'per_page'), required=False, location='args')\nargs_parser.add_argument('channel_id', lo...
<|body_start_0|> args_parser = RequestParser() args_parser.add_argument('page', type=inputs.positive, required=False, location='args') args_parser.add_argument('per_page', type=inputs.int_range(constants.PER_PAGE_MIN, constants.PER_PAGE_MAX, 'per_page'), required=False, location='args') ...
频道列表
ChannelListResource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChannelListResource: """频道列表""" def get(self): """获取所有频道信息""" <|body_0|> def post(self): """新增频道""" <|body_1|> <|end_skeleton|> <|body_start_0|> args_parser = RequestParser() args_parser.add_argument('page', type=inputs.positive, require...
stack_v2_sparse_classes_75kplus_train_005589
5,465
no_license
[ { "docstring": "获取所有频道信息", "name": "get", "signature": "def get(self)" }, { "docstring": "新增频道", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_002908
Implement the Python class `ChannelListResource` described below. Class description: 频道列表 Method signatures and docstrings: - def get(self): 获取所有频道信息 - def post(self): 新增频道
Implement the Python class `ChannelListResource` described below. Class description: 频道列表 Method signatures and docstrings: - def get(self): 获取所有频道信息 - def post(self): 新增频道 <|skeleton|> class ChannelListResource: """频道列表""" def get(self): """获取所有频道信息""" <|body_0|> def post(self): ...
c9703a9c57a98babf8d1e41b227aada9ef4bfe15
<|skeleton|> class ChannelListResource: """频道列表""" def get(self): """获取所有频道信息""" <|body_0|> def post(self): """新增频道""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ChannelListResource: """频道列表""" def get(self): """获取所有频道信息""" args_parser = RequestParser() args_parser.add_argument('page', type=inputs.positive, required=False, location='args') args_parser.add_argument('per_page', type=inputs.int_range(constants.PER_PAGE_MIN, constants....
the_stack_v2_python_sparse
mis/resources/information/channel.py
Yaooooooooooooo/toutiao-backend
train
0
f4b7440335dbe6ba7fb9633145a79ef51d090d63
[ "super(TSKVolume, self).__init__(file_entry.name)\nself._file_entry = file_entry\nself._bytes_per_sector = bytes_per_sector", "tsk_vs_part = self._file_entry.GetTSKVsPart()\ntsk_addr = getattr(tsk_vs_part, u'addr', None)\nif tsk_addr is not None:\n self._AddAttribute(volume_system.VolumeAttribute(u'address', t...
<|body_start_0|> super(TSKVolume, self).__init__(file_entry.name) self._file_entry = file_entry self._bytes_per_sector = bytes_per_sector <|end_body_0|> <|body_start_1|> tsk_vs_part = self._file_entry.GetTSKVsPart() tsk_addr = getattr(tsk_vs_part, u'addr', None) if tsk_a...
Class that implements a volume object using pytsk3.
TSKVolume
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TSKVolume: """Class that implements a volume object using pytsk3.""" def __init__(self, file_entry, bytes_per_sector): """Initializes the volume object. Args: file_entry: a TSK partition file entry object (instance of FileEntry). bytes_per_sector: an integer containing number of byte...
stack_v2_sparse_classes_75kplus_train_005590
3,770
permissive
[ { "docstring": "Initializes the volume object. Args: file_entry: a TSK partition file entry object (instance of FileEntry). bytes_per_sector: an integer containing number of bytes per sector.", "name": "__init__", "signature": "def __init__(self, file_entry, bytes_per_sector)" }, { "docstring": ...
2
null
Implement the Python class `TSKVolume` described below. Class description: Class that implements a volume object using pytsk3. Method signatures and docstrings: - def __init__(self, file_entry, bytes_per_sector): Initializes the volume object. Args: file_entry: a TSK partition file entry object (instance of FileEntry...
Implement the Python class `TSKVolume` described below. Class description: Class that implements a volume object using pytsk3. Method signatures and docstrings: - def __init__(self, file_entry, bytes_per_sector): Initializes the volume object. Args: file_entry: a TSK partition file entry object (instance of FileEntry...
a0196808f569e4c5f947c458945cd0a17d1abab5
<|skeleton|> class TSKVolume: """Class that implements a volume object using pytsk3.""" def __init__(self, file_entry, bytes_per_sector): """Initializes the volume object. Args: file_entry: a TSK partition file entry object (instance of FileEntry). bytes_per_sector: an integer containing number of byte...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TSKVolume: """Class that implements a volume object using pytsk3.""" def __init__(self, file_entry, bytes_per_sector): """Initializes the volume object. Args: file_entry: a TSK partition file entry object (instance of FileEntry). bytes_per_sector: an integer containing number of bytes per sector....
the_stack_v2_python_sparse
dfvfs/volume/tsk_volume_system.py
devgc/dfvfs
train
1
d65bfe050d5d0ec54aba5a0ac4f2720a9468a7c0
[ "super().__init__(obj)\nself.keys = tuple(keys)\nself.values = tuple((key if isinstance(key, EqKey) else obj[key] for key in keys))", "obj = self.obj\nfor key, value in zip(self.keys, self.values):\n assert not isinstance(key, EqKey)\n obj[key] = intern(value)\n_maybe_setattr(obj, '$intern_canonical', obj)"...
<|body_start_0|> super().__init__(obj) self.keys = tuple(keys) self.values = tuple((key if isinstance(key, EqKey) else obj[key] for key in keys)) <|end_body_0|> <|body_start_1|> obj = self.obj for key, value in zip(self.keys, self.values): assert not isinstance(key, ...
Object indexed using getitem.
ItemEK
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ItemEK: """Object indexed using getitem.""" def __init__(self, obj, keys): """Initialize an ItemEK.""" <|body_0|> def canonicalize(self): """Canonicalize the underlying object.""" <|body_1|> <|end_skeleton|> <|body_start_0|> super().__init__(obj...
stack_v2_sparse_classes_75kplus_train_005591
9,170
permissive
[ { "docstring": "Initialize an ItemEK.", "name": "__init__", "signature": "def __init__(self, obj, keys)" }, { "docstring": "Canonicalize the underlying object.", "name": "canonicalize", "signature": "def canonicalize(self)" } ]
2
null
Implement the Python class `ItemEK` described below. Class description: Object indexed using getitem. Method signatures and docstrings: - def __init__(self, obj, keys): Initialize an ItemEK. - def canonicalize(self): Canonicalize the underlying object.
Implement the Python class `ItemEK` described below. Class description: Object indexed using getitem. Method signatures and docstrings: - def __init__(self, obj, keys): Initialize an ItemEK. - def canonicalize(self): Canonicalize the underlying object. <|skeleton|> class ItemEK: """Object indexed using getitem."...
d7b12c15453079e1a2c4fdae611c5f741574363d
<|skeleton|> class ItemEK: """Object indexed using getitem.""" def __init__(self, obj, keys): """Initialize an ItemEK.""" <|body_0|> def canonicalize(self): """Canonicalize the underlying object.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ItemEK: """Object indexed using getitem.""" def __init__(self, obj, keys): """Initialize an ItemEK.""" super().__init__(obj) self.keys = tuple(keys) self.values = tuple((key if isinstance(key, EqKey) else obj[key] for key in keys)) def canonicalize(self): """C...
the_stack_v2_python_sparse
myia/utils/intern.py
breuleux/myia
train
1
ea6345c2454cef5ce34d885aaa54dc6b054f7e1c
[ "self = object.__new__(cls)\nself.name = cls.DEFAULT_NAME\nself.value = value\nself.metadata_type = AutoModerationActionMetadataBase\nreturn self", "self.value = value\nself.name = name\nself.metadata_type = metadata_type\nself.INSTANCES[value] = self" ]
<|body_start_0|> self = object.__new__(cls) self.name = cls.DEFAULT_NAME self.value = value self.metadata_type = AutoModerationActionMetadataBase return self <|end_body_0|> <|body_start_1|> self.value = value self.name = name self.metadata_type = metadata...
Represents an ``AutoModerationAction``'s type. Attributes ---------- value : `int` The Discord side identifier value of the auto moderation action type. name : `str` The default name of the auto moderation action type. metadata_type : ``AutoModerationActionMetadataBase`` The action type's respective metadata type. Clas...
AutoModerationActionType
[ "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AutoModerationActionType: """Represents an ``AutoModerationAction``'s type. Attributes ---------- value : `int` The Discord side identifier value of the auto moderation action type. name : `str` The default name of the auto moderation action type. metadata_type : ``AutoModerationActionMetadataBas...
stack_v2_sparse_classes_75kplus_train_005592
5,182
permissive
[ { "docstring": "Creates a new auto moderation action type with the given value. Parameters ---------- value : `int` The auto moderation action type's identifier value. Returns ------- self : ``AutoModerationActionType`` The created instance.", "name": "_from_value", "signature": "def _from_value(cls, va...
2
null
Implement the Python class `AutoModerationActionType` described below. Class description: Represents an ``AutoModerationAction``'s type. Attributes ---------- value : `int` The Discord side identifier value of the auto moderation action type. name : `str` The default name of the auto moderation action type. metadata_t...
Implement the Python class `AutoModerationActionType` described below. Class description: Represents an ``AutoModerationAction``'s type. Attributes ---------- value : `int` The Discord side identifier value of the auto moderation action type. name : `str` The default name of the auto moderation action type. metadata_t...
53f24fdb38459dc5a4fd04f11bdbfee8295b76a4
<|skeleton|> class AutoModerationActionType: """Represents an ``AutoModerationAction``'s type. Attributes ---------- value : `int` The Discord side identifier value of the auto moderation action type. name : `str` The default name of the auto moderation action type. metadata_type : ``AutoModerationActionMetadataBas...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AutoModerationActionType: """Represents an ``AutoModerationAction``'s type. Attributes ---------- value : `int` The Discord side identifier value of the auto moderation action type. name : `str` The default name of the auto moderation action type. metadata_type : ``AutoModerationActionMetadataBase`` The actio...
the_stack_v2_python_sparse
hata/discord/auto_moderation/action/preinstanced.py
HuyaneMatsu/hata
train
3
e976c043f2799808af619251e252c78be2c4ca02
[ "if root.val == None:\n return None\nself.maxAverage = float('-inf')\nself.maxNode = None\n\ndef helper(node):\n if not node:\n return (0, 0.0)\n leftTotal, leftSum = helper(node.left)\n rightTotal, rightSum = helper(node.right)\n currentTotal = 1 + leftTotal + rightTotal\n currentSum = nod...
<|body_start_0|> if root.val == None: return None self.maxAverage = float('-inf') self.maxNode = None def helper(node): if not node: return (0, 0.0) leftTotal, leftSum = helper(node.left) rightTotal, rightSum = helper(node....
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def MaximumAverageSubtree(self, root): """>>> solution = Solution() >>> solution.MaximumAverageSubtree(Node1) 14 >>> solution.MaximumAverageSubtree(Node11) 20""" <|body_0|> def MaximumAverageSubtree2(self, root): """>>> solution2 = Solution() >>> solution2....
stack_v2_sparse_classes_75kplus_train_005593
9,088
no_license
[ { "docstring": ">>> solution = Solution() >>> solution.MaximumAverageSubtree(Node1) 14 >>> solution.MaximumAverageSubtree(Node11) 20", "name": "MaximumAverageSubtree", "signature": "def MaximumAverageSubtree(self, root)" }, { "docstring": ">>> solution2 = Solution() >>> solution2.MaximumAverageS...
2
stack_v2_sparse_classes_30k_train_019669
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def MaximumAverageSubtree(self, root): >>> solution = Solution() >>> solution.MaximumAverageSubtree(Node1) 14 >>> solution.MaximumAverageSubtree(Node11) 20 - def MaximumAverageSu...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def MaximumAverageSubtree(self, root): >>> solution = Solution() >>> solution.MaximumAverageSubtree(Node1) 14 >>> solution.MaximumAverageSubtree(Node11) 20 - def MaximumAverageSu...
898dc6b0d1eadf441ba06c69548a3798bcbaea99
<|skeleton|> class Solution: def MaximumAverageSubtree(self, root): """>>> solution = Solution() >>> solution.MaximumAverageSubtree(Node1) 14 >>> solution.MaximumAverageSubtree(Node11) 20""" <|body_0|> def MaximumAverageSubtree2(self, root): """>>> solution2 = Solution() >>> solution2....
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def MaximumAverageSubtree(self, root): """>>> solution = Solution() >>> solution.MaximumAverageSubtree(Node1) 14 >>> solution.MaximumAverageSubtree(Node11) 20""" if root.val == None: return None self.maxAverage = float('-inf') self.maxNode = None ...
the_stack_v2_python_sparse
Beginning/subtree_with_max_average.py
workprinond/DS_-_Algo_TechInterview_Practise
train
0
5e0bb01d74bbd6f718e89f791108781631760596
[ "yes_to_all = force_import_from_game\nfor data_type in self.DATA_TYPES:\n yes_to_all = self.import_data_type(data_type, force_import_from_game, yes_to_all, with_window=with_window)\n if data_type == 'maps' and first_time and (self.maps is not None):\n archives_msb = self.maps.DukesArchives\n rep...
<|body_start_0|> yes_to_all = force_import_from_game for data_type in self.DATA_TYPES: yes_to_all = self.import_data_type(data_type, force_import_from_game, yes_to_all, with_window=with_window) if data_type == 'maps' and first_time and (self.maps is not None): arc...
GameDirectoryProject
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GameDirectoryProject: def initialize_project(self, force_import_from_game=False, with_window: ProjectWindow=None, first_time=False): """Also offer to translate events/regions with entity IDs and export entities modules.""" <|body_0|> def offer_fix_broken_regions(self, with_w...
stack_v2_sparse_classes_75kplus_train_005594
6,562
no_license
[ { "docstring": "Also offer to translate events/regions with entity IDs and export entities modules.", "name": "initialize_project", "signature": "def initialize_project(self, force_import_from_game=False, with_window: ProjectWindow=None, first_time=False)" }, { "docstring": "Offer to fix broken ...
4
stack_v2_sparse_classes_30k_train_046419
Implement the Python class `GameDirectoryProject` described below. Class description: Implement the GameDirectoryProject class. Method signatures and docstrings: - def initialize_project(self, force_import_from_game=False, with_window: ProjectWindow=None, first_time=False): Also offer to translate events/regions with...
Implement the Python class `GameDirectoryProject` described below. Class description: Implement the GameDirectoryProject class. Method signatures and docstrings: - def initialize_project(self, force_import_from_game=False, with_window: ProjectWindow=None, first_time=False): Also offer to translate events/regions with...
88693c0015056ee8e3d1dbcb795c05fca4349e38
<|skeleton|> class GameDirectoryProject: def initialize_project(self, force_import_from_game=False, with_window: ProjectWindow=None, first_time=False): """Also offer to translate events/regions with entity IDs and export entities modules.""" <|body_0|> def offer_fix_broken_regions(self, with_w...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GameDirectoryProject: def initialize_project(self, force_import_from_game=False, with_window: ProjectWindow=None, first_time=False): """Also offer to translate events/regions with entity IDs and export entities modules.""" yes_to_all = force_import_from_game for data_type in self.DATA_...
the_stack_v2_python_sparse
soulstruct/darksouls1r/project/core.py
Nahnahchi/soulstruct
train
0
9081a6e1813f9f7726cded26db81dd0d4067d2b6
[ "page = 'address'\nuser = request.user\naddress = Address.objects.get_default_address(user)\nreturn render(request, 'user_center_site.html', {'page': page, 'address': address})", "receiver = request.POST.get('receiver')\naddr = request.POST.get('addr')\nzipcode = request.POST.get('zipcode')\nphone = request.POST....
<|body_start_0|> page = 'address' user = request.user address = Address.objects.get_default_address(user) return render(request, 'user_center_site.html', {'page': page, 'address': address}) <|end_body_0|> <|body_start_1|> receiver = request.POST.get('receiver') addr = re...
UserAddressView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserAddressView: def get(self, request): """显示个人地址""" <|body_0|> def post(self, request): """地址的添加""" <|body_1|> <|end_skeleton|> <|body_start_0|> page = 'address' user = request.user address = Address.objects.get_default_address(use...
stack_v2_sparse_classes_75kplus_train_005595
8,760
no_license
[ { "docstring": "显示个人地址", "name": "get", "signature": "def get(self, request)" }, { "docstring": "地址的添加", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_000219
Implement the Python class `UserAddressView` described below. Class description: Implement the UserAddressView class. Method signatures and docstrings: - def get(self, request): 显示个人地址 - def post(self, request): 地址的添加
Implement the Python class `UserAddressView` described below. Class description: Implement the UserAddressView class. Method signatures and docstrings: - def get(self, request): 显示个人地址 - def post(self, request): 地址的添加 <|skeleton|> class UserAddressView: def get(self, request): """显示个人地址""" <|bod...
f1de495959e03f8b543fc1642b1332e370f1cf28
<|skeleton|> class UserAddressView: def get(self, request): """显示个人地址""" <|body_0|> def post(self, request): """地址的添加""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserAddressView: def get(self, request): """显示个人地址""" page = 'address' user = request.user address = Address.objects.get_default_address(user) return render(request, 'user_center_site.html', {'page': page, 'address': address}) def post(self, request): """地址...
the_stack_v2_python_sparse
apps/user/views.py
Icemelon99/test_project_dailyfresh
train
4
cf9ec76dac9fbe5f467fb8b66415d108fe7eb25e
[ "filter_dict.update({'status': {'$ne': -1}})\npipeline = list()\nproduct_cond = {'$lookup': {'from': 'product_info', 'let': {'pid': '$product_id'}, 'pipeline': [{'$match': {'$expr': {'$eq': ['$_id', '$$pid']}}}, {'$project': {'_id': 0}}], 'as': 'product_item'}}\npipeline.append(product_cond)\nrep1 = {'$replaceRoot'...
<|body_start_0|> filter_dict.update({'status': {'$ne': -1}}) pipeline = list() product_cond = {'$lookup': {'from': 'product_info', 'let': {'pid': '$product_id'}, 'pipeline': [{'$match': {'$expr': {'$eq': ['$_id', '$$pid']}}}, {'$project': {'_id': 0}}], 'as': 'product_item'}} pipeline.app...
生产任务
ProduceTask
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProduceTask: """生产任务""" def paging_info(cls, filter_dict: dict, page_index: int=1, page_size: int=10) -> dict: """分页查看生产任务信息.由于涉及的关系复杂,这里使用了cls.aggregate函数 :param filter_dict: 过滤器,由用户的权限生成 :param page_index: 页码(当前页码) :param page_size: 每页多少条记录 :return:""" <|body_0|> def d...
stack_v2_sparse_classes_75kplus_train_005596
27,644
no_license
[ { "docstring": "分页查看生产任务信息.由于涉及的关系复杂,这里使用了cls.aggregate函数 :param filter_dict: 过滤器,由用户的权限生成 :param page_index: 页码(当前页码) :param page_size: 每页多少条记录 :return:", "name": "paging_info", "signature": "def paging_info(cls, filter_dict: dict, page_index: int=1, page_size: int=10) -> dict" }, { "docstring"...
3
stack_v2_sparse_classes_30k_val_003001
Implement the Python class `ProduceTask` described below. Class description: 生产任务 Method signatures and docstrings: - def paging_info(cls, filter_dict: dict, page_index: int=1, page_size: int=10) -> dict: 分页查看生产任务信息.由于涉及的关系复杂,这里使用了cls.aggregate函数 :param filter_dict: 过滤器,由用户的权限生成 :param page_index: 页码(当前页码) :param pag...
Implement the Python class `ProduceTask` described below. Class description: 生产任务 Method signatures and docstrings: - def paging_info(cls, filter_dict: dict, page_index: int=1, page_size: int=10) -> dict: 分页查看生产任务信息.由于涉及的关系复杂,这里使用了cls.aggregate函数 :param filter_dict: 过滤器,由用户的权限生成 :param page_index: 页码(当前页码) :param pag...
3a2bdfd1598bfcdfe56386ec0c46fcede772cbfe
<|skeleton|> class ProduceTask: """生产任务""" def paging_info(cls, filter_dict: dict, page_index: int=1, page_size: int=10) -> dict: """分页查看生产任务信息.由于涉及的关系复杂,这里使用了cls.aggregate函数 :param filter_dict: 过滤器,由用户的权限生成 :param page_index: 页码(当前页码) :param page_size: 每页多少条记录 :return:""" <|body_0|> def d...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProduceTask: """生产任务""" def paging_info(cls, filter_dict: dict, page_index: int=1, page_size: int=10) -> dict: """分页查看生产任务信息.由于涉及的关系复杂,这里使用了cls.aggregate函数 :param filter_dict: 过滤器,由用户的权限生成 :param page_index: 页码(当前页码) :param page_size: 每页多少条记录 :return:""" filter_dict.update({'status': {'$n...
the_stack_v2_python_sparse
query_server/module/system_module.py
SYYDSN/py_projects
train
0
c02c521b47e5da981596cb6eee5a78100ecbd665
[ "super().__init__(config_entry_id, device)\nself.entity_description = description\nself._attr_unique_id = f'{device.id}-{description.key}'", "sensor_type = self.entity_description.key\nif sensor_type == 'volume':\n return self._device.volume\nif sensor_type == 'battery':\n return self._device.battery_life" ...
<|body_start_0|> super().__init__(config_entry_id, device) self.entity_description = description self._attr_unique_id = f'{device.id}-{description.key}' <|end_body_0|> <|body_start_1|> sensor_type = self.entity_description.key if sensor_type == 'volume': return self....
A sensor implementation for Ring device.
RingSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RingSensor: """A sensor implementation for Ring device.""" def __init__(self, config_entry_id, device, description: RingSensorEntityDescription) -> None: """Initialize a sensor for Ring device.""" <|body_0|> def native_value(self): """Return the state of the sens...
stack_v2_sparse_classes_75kplus_train_005597
7,714
permissive
[ { "docstring": "Initialize a sensor for Ring device.", "name": "__init__", "signature": "def __init__(self, config_entry_id, device, description: RingSensorEntityDescription) -> None" }, { "docstring": "Return the state of the sensor.", "name": "native_value", "signature": "def native_va...
2
stack_v2_sparse_classes_30k_train_047986
Implement the Python class `RingSensor` described below. Class description: A sensor implementation for Ring device. Method signatures and docstrings: - def __init__(self, config_entry_id, device, description: RingSensorEntityDescription) -> None: Initialize a sensor for Ring device. - def native_value(self): Return ...
Implement the Python class `RingSensor` described below. Class description: A sensor implementation for Ring device. Method signatures and docstrings: - def __init__(self, config_entry_id, device, description: RingSensorEntityDescription) -> None: Initialize a sensor for Ring device. - def native_value(self): Return ...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class RingSensor: """A sensor implementation for Ring device.""" def __init__(self, config_entry_id, device, description: RingSensorEntityDescription) -> None: """Initialize a sensor for Ring device.""" <|body_0|> def native_value(self): """Return the state of the sens...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RingSensor: """A sensor implementation for Ring device.""" def __init__(self, config_entry_id, device, description: RingSensorEntityDescription) -> None: """Initialize a sensor for Ring device.""" super().__init__(config_entry_id, device) self.entity_description = description ...
the_stack_v2_python_sparse
homeassistant/components/ring/sensor.py
home-assistant/core
train
35,501
739b536a345bfca29f875fc78d6b8a083759b866
[ "coininfo.query.__init__(self, coin_bw_info.eventname)\nself.interfaces = interfaces\nif self.interfaces == None:\n self.interfaces = []\nself.mode = mode", "ilist = ''\nfor i in self.interfaces:\n ilist += 'interface=\"' + str(i) + '\"'\n ilist += ' or '\nreturn ilist[:-3]", "s = '*'\nif self.mode == ...
<|body_start_0|> coininfo.query.__init__(self, coin_bw_info.eventname) self.interfaces = interfaces if self.interfaces == None: self.interfaces = [] self.mode = mode <|end_body_0|> <|body_start_1|> ilist = '' for i in self.interfaces: ilist += 'in...
Class to query bandwidth @author ykk @date Aug 2011
bandwidth_query
[ "LicenseRef-scancode-x11-stanford" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class bandwidth_query: """Class to query bandwidth @author ykk @date Aug 2011""" def __init__(self, mode, interfaces=None): """Initialize @param interfaces list of interfaces to return result""" <|body_0|> def get_condition(self): """Get conditions""" <|body_1|...
stack_v2_sparse_classes_75kplus_train_005598
8,177
permissive
[ { "docstring": "Initialize @param interfaces list of interfaces to return result", "name": "__init__", "signature": "def __init__(self, mode, interfaces=None)" }, { "docstring": "Get conditions", "name": "get_condition", "signature": "def get_condition(self)" }, { "docstring": "R...
3
stack_v2_sparse_classes_30k_train_031527
Implement the Python class `bandwidth_query` described below. Class description: Class to query bandwidth @author ykk @date Aug 2011 Method signatures and docstrings: - def __init__(self, mode, interfaces=None): Initialize @param interfaces list of interfaces to return result - def get_condition(self): Get conditions...
Implement the Python class `bandwidth_query` described below. Class description: Class to query bandwidth @author ykk @date Aug 2011 Method signatures and docstrings: - def __init__(self, mode, interfaces=None): Initialize @param interfaces list of interfaces to return result - def get_condition(self): Get conditions...
c3f5a31b74d5587671329eea9582ac8aed0c58a4
<|skeleton|> class bandwidth_query: """Class to query bandwidth @author ykk @date Aug 2011""" def __init__(self, mode, interfaces=None): """Initialize @param interfaces list of interfaces to return result""" <|body_0|> def get_condition(self): """Get conditions""" <|body_1|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class bandwidth_query: """Class to query bandwidth @author ykk @date Aug 2011""" def __init__(self, mode, interfaces=None): """Initialize @param interfaces list of interfaces to return result""" coininfo.query.__init__(self, coin_bw_info.eventname) self.interfaces = interfaces i...
the_stack_v2_python_sparse
yapc/local/networkstate.py
yapkke/yapc
train
1
bbe376d29296544abea0cde6f86231aefea73b38
[ "builder = treelite.ModelBuilder(num_feature=sklearn_model.n_features_in_, num_class=sklearn_model.n_classes_, average_tree_output=True, pred_transform='identity_multiclass', threshold_type='float64', leaf_output_type='float64')\nfor i in range(sklearn_model.n_estimators):\n builder.append(cls.process_tree(sklea...
<|body_start_0|> builder = treelite.ModelBuilder(num_feature=sklearn_model.n_features_in_, num_class=sklearn_model.n_classes_, average_tree_output=True, pred_transform='identity_multiclass', threshold_type='float64', leaf_output_type='float64') for i in range(sklearn_model.n_estimators): bui...
Mixin class to implement the converter for RandomForestClassifier (multi-class classifier)
SKLRFMultiClassifierMixin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SKLRFMultiClassifierMixin: """Mixin class to implement the converter for RandomForestClassifier (multi-class classifier)""" def process_model(cls, sklearn_model): """Process a RandomForestClassifier (multi-class classifier) to convert it into a Treelite model""" <|body_0|> ...
stack_v2_sparse_classes_75kplus_train_005599
1,671
permissive
[ { "docstring": "Process a RandomForestClassifier (multi-class classifier) to convert it into a Treelite model", "name": "process_model", "signature": "def process_model(cls, sklearn_model)" }, { "docstring": "Process a test node with a given node ID", "name": "process_leaf_node", "signat...
2
stack_v2_sparse_classes_30k_train_045175
Implement the Python class `SKLRFMultiClassifierMixin` described below. Class description: Mixin class to implement the converter for RandomForestClassifier (multi-class classifier) Method signatures and docstrings: - def process_model(cls, sklearn_model): Process a RandomForestClassifier (multi-class classifier) to ...
Implement the Python class `SKLRFMultiClassifierMixin` described below. Class description: Mixin class to implement the converter for RandomForestClassifier (multi-class classifier) Method signatures and docstrings: - def process_model(cls, sklearn_model): Process a RandomForestClassifier (multi-class classifier) to ...
50a8db523a0d5b1859476995999b8aed394af7a4
<|skeleton|> class SKLRFMultiClassifierMixin: """Mixin class to implement the converter for RandomForestClassifier (multi-class classifier)""" def process_model(cls, sklearn_model): """Process a RandomForestClassifier (multi-class classifier) to convert it into a Treelite model""" <|body_0|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SKLRFMultiClassifierMixin: """Mixin class to implement the converter for RandomForestClassifier (multi-class classifier)""" def process_model(cls, sklearn_model): """Process a RandomForestClassifier (multi-class classifier) to convert it into a Treelite model""" builder = treelite.ModelBu...
the_stack_v2_python_sparse
python/treelite/sklearn/rf_multi_classifier.py
dmlc/treelite
train
700