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
53cedcd0347ebfbdb87b8b533dc26168ce2ecf39
[ "clone = self.filter(*args, **kwargs)\nclone = clone.order_by()\nif len(clone) >= 1:\n return clone._result_cache[0]\nreturn None", "if model.id and model.id > 0:\n origin = self.first(id=model.id)\n if origin:\n model.create_user = origin.create_user\n model.create_time = origin.create_tim...
<|body_start_0|> clone = self.filter(*args, **kwargs) clone = clone.order_by() if len(clone) >= 1: return clone._result_cache[0] return None <|end_body_0|> <|body_start_1|> if model.id and model.id > 0: origin = self.first(id=model.id) if orig...
自定义模型管理器
BaseManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseManager: """自定义模型管理器""" def first(self, *args, **kwargs): """获取一条数据""" <|body_0|> def save_new(self, model, user): """保存或更新数据""" <|body_1|> <|end_skeleton|> <|body_start_0|> clone = self.filter(*args, **kwargs) clone = clone.order_by...
stack_v2_sparse_classes_75kplus_train_002300
5,734
no_license
[ { "docstring": "获取一条数据", "name": "first", "signature": "def first(self, *args, **kwargs)" }, { "docstring": "保存或更新数据", "name": "save_new", "signature": "def save_new(self, model, user)" } ]
2
stack_v2_sparse_classes_30k_train_029112
Implement the Python class `BaseManager` described below. Class description: 自定义模型管理器 Method signatures and docstrings: - def first(self, *args, **kwargs): 获取一条数据 - def save_new(self, model, user): 保存或更新数据
Implement the Python class `BaseManager` described below. Class description: 自定义模型管理器 Method signatures and docstrings: - def first(self, *args, **kwargs): 获取一条数据 - def save_new(self, model, user): 保存或更新数据 <|skeleton|> class BaseManager: """自定义模型管理器""" def first(self, *args, **kwargs): """获取一条数据""" ...
473e00e6d28baaf6b7b36de62583cf3f749816a2
<|skeleton|> class BaseManager: """自定义模型管理器""" def first(self, *args, **kwargs): """获取一条数据""" <|body_0|> def save_new(self, model, user): """保存或更新数据""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseManager: """自定义模型管理器""" def first(self, *args, **kwargs): """获取一条数据""" clone = self.filter(*args, **kwargs) clone = clone.order_by() if len(clone) >= 1: return clone._result_cache[0] return None def save_new(self, model, user): """保存或更新...
the_stack_v2_python_sparse
web/models.py
WsWHL/blog
train
2
7a2a421e1560482ce26e5c1ed61fc9bd6a4fc115
[ "kwargs['default'] = default\nkwargs['types'] = (int, float, tuple, list)\nsuper().__init__(**kwargs)", "if isinstance(value, (int, float)):\n return (value, value, value, value)\nif isinstance(value, (list, tuple)) and all((isinstance(x, (int, float)) for x in value)):\n if len(value) == 1:\n return...
<|body_start_0|> kwargs['default'] = default kwargs['types'] = (int, float, tuple, list) super().__init__(**kwargs) <|end_body_0|> <|body_start_1|> if isinstance(value, (int, float)): return (value, value, value, value) if isinstance(value, (list, tuple)) and all((is...
Defines a property used for quad-sided connected values like margins, paddings etc. The value must be provided as a single number or as a list or tuple of numbers defining individual values for top, right, bottom and left side. If only a single value is provided, it is used for all the sides. If two values are provided...
QuadProperty
[ "LicenseRef-scancode-philippe-de-muyter", "LicenseRef-scancode-commercial-license", "AGPL-3.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuadProperty: """Defines a property used for quad-sided connected values like margins, paddings etc. The value must be provided as a single number or as a list or tuple of numbers defining individual values for top, right, bottom and left side. If only a single value is provided, it is used for a...
stack_v2_sparse_classes_75kplus_train_002301
11,719
permissive
[ { "docstring": "Initializes a new instance of QuadProperty.", "name": "__init__", "signature": "def __init__(self, default=UNDEF, **kwargs)" }, { "docstring": "Validates and converts given value.", "name": "parse", "signature": "def parse(self, value)" } ]
2
stack_v2_sparse_classes_30k_train_030087
Implement the Python class `QuadProperty` described below. Class description: Defines a property used for quad-sided connected values like margins, paddings etc. The value must be provided as a single number or as a list or tuple of numbers defining individual values for top, right, bottom and left side. If only a sin...
Implement the Python class `QuadProperty` described below. Class description: Defines a property used for quad-sided connected values like margins, paddings etc. The value must be provided as a single number or as a list or tuple of numbers defining individual values for top, right, bottom and left side. If only a sin...
d59b1bc056f3037b7b7ab635b6deb41120612965
<|skeleton|> class QuadProperty: """Defines a property used for quad-sided connected values like margins, paddings etc. The value must be provided as a single number or as a list or tuple of numbers defining individual values for top, right, bottom and left side. If only a single value is provided, it is used for a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class QuadProperty: """Defines a property used for quad-sided connected values like margins, paddings etc. The value must be provided as a single number or as a list or tuple of numbers defining individual values for top, right, bottom and left side. If only a single value is provided, it is used for all the sides....
the_stack_v2_python_sparse
pero/properties/typed.py
xxao/pero
train
31
703fb5e3f80581857434f080005277cbb436dde1
[ "method = method.upper()\nif method not in ['GET', 'POST']:\n raise RuntimeError('Trying to register endpoint {} with a non-supported method {}'.format(name, method))\nif name in cls.endpoints:\n logger.error('Trying to register and endpoint that already exists: %s', name)\n raise RuntimeError('Endpoint wi...
<|body_start_0|> method = method.upper() if method not in ['GET', 'POST']: raise RuntimeError('Trying to register endpoint {} with a non-supported method {}'.format(name, method)) if name in cls.endpoints: logger.error('Trying to register and endpoint that already exists:...
HTTP handler that parses requests and passes them on to the player
Handler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Handler: """HTTP handler that parses requests and passes them on to the player""" def register_endpoint(cls, name, func, method='GET'): """Register a new endpoint and it's corresponding function""" <|body_0|> def output_headers(self): """Utility method that write...
stack_v2_sparse_classes_75kplus_train_002302
6,216
permissive
[ { "docstring": "Register a new endpoint and it's corresponding function", "name": "register_endpoint", "signature": "def register_endpoint(cls, name, func, method='GET')" }, { "docstring": "Utility method that writes the JSON headers that goes in all succesful responses", "name": "output_hea...
4
stack_v2_sparse_classes_30k_train_050032
Implement the Python class `Handler` described below. Class description: HTTP handler that parses requests and passes them on to the player Method signatures and docstrings: - def register_endpoint(cls, name, func, method='GET'): Register a new endpoint and it's corresponding function - def output_headers(self): Util...
Implement the Python class `Handler` described below. Class description: HTTP handler that parses requests and passes them on to the player Method signatures and docstrings: - def register_endpoint(cls, name, func, method='GET'): Register a new endpoint and it's corresponding function - def output_headers(self): Util...
27a46c5535c473f32ebd6089333c22e75b61ebf2
<|skeleton|> class Handler: """HTTP handler that parses requests and passes them on to the player""" def register_endpoint(cls, name, func, method='GET'): """Register a new endpoint and it's corresponding function""" <|body_0|> def output_headers(self): """Utility method that write...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Handler: """HTTP handler that parses requests and passes them on to the player""" def register_endpoint(cls, name, func, method='GET'): """Register a new endpoint and it's corresponding function""" method = method.upper() if method not in ['GET', 'POST']: raise Runtime...
the_stack_v2_python_sparse
backend/main.py
ecampostrini/musicracy-python
train
0
1302e58baa08a2603260d5c737a9804ae140fa9a
[ "current_node = self.head\nwhile current_node is not None:\n if current_node.value[0] == key:\n return current_node.value[1]\n current_node = current_node.next_value\nreturn None", "if self.head is not None:\n current_node = self.head\n idx = 0\n while current_node is not None:\n if c...
<|body_start_0|> current_node = self.head while current_node is not None: if current_node.value[0] == key: return current_node.value[1] current_node = current_node.next_value return None <|end_body_0|> <|body_start_1|> if self.head is not None: ...
This class describes nodes for Hash Table
HashNodeList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HashNodeList: """This class describes nodes for Hash Table""" def check_node_exist(self, key): """This method checks node exist in Hash Table""" <|body_0|> def delete_node(self, key): """This method removes node of Hash Table by key""" <|body_1|> <|end_s...
stack_v2_sparse_classes_75kplus_train_002303
2,293
no_license
[ { "docstring": "This method checks node exist in Hash Table", "name": "check_node_exist", "signature": "def check_node_exist(self, key)" }, { "docstring": "This method removes node of Hash Table by key", "name": "delete_node", "signature": "def delete_node(self, key)" } ]
2
stack_v2_sparse_classes_30k_train_009489
Implement the Python class `HashNodeList` described below. Class description: This class describes nodes for Hash Table Method signatures and docstrings: - def check_node_exist(self, key): This method checks node exist in Hash Table - def delete_node(self, key): This method removes node of Hash Table by key
Implement the Python class `HashNodeList` described below. Class description: This class describes nodes for Hash Table Method signatures and docstrings: - def check_node_exist(self, key): This method checks node exist in Hash Table - def delete_node(self, key): This method removes node of Hash Table by key <|skelet...
9e9fd6583ef4f586c3b4d8cae06c23bdff89c35a
<|skeleton|> class HashNodeList: """This class describes nodes for Hash Table""" def check_node_exist(self, key): """This method checks node exist in Hash Table""" <|body_0|> def delete_node(self, key): """This method removes node of Hash Table by key""" <|body_1|> <|end_s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HashNodeList: """This class describes nodes for Hash Table""" def check_node_exist(self, key): """This method checks node exist in Hash Table""" current_node = self.head while current_node is not None: if current_node.value[0] == key: return current_nod...
the_stack_v2_python_sparse
data_structures/basic_data_structure/hash_table.py
Mariia-Kosorotykova/python-education
train
0
00ab07a35f527a9d368e13d8eca64a87ce80570a
[ "self.device = device_claim(device)\nself.resources_path = resources_path\nself.model_type = model_type\nself.model_name = model_name\nself.scheduler_type = scheduler_type\nself.prompt = prompt\nself.auth_token = auth_token\nself.load_model()", "try:\n model_class = MODEL_TYPES[self.model_type]\nexcept KeyErro...
<|body_start_0|> self.device = device_claim(device) self.resources_path = resources_path self.model_type = model_type self.model_name = model_name self.scheduler_type = scheduler_type self.prompt = prompt self.auth_token = auth_token self.load_model() <|en...
Implementation of a generator.
Generator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Generator: """Implementation of a generator.""" def __init__(self, resources_path: str, model_type: str, model_name: str, scheduler_type: str, auth_token: bool=True, prompt: Optional[Union[str, Dict[str, Any]]]=None, device: Optional[Union[torch.device, str]]=None): """A Diffusers ge...
stack_v2_sparse_classes_75kplus_train_002304
5,391
permissive
[ { "docstring": "A Diffusers generation algorithm. Args: resources_path: path to the cache. model_type: type of the model. model_name: name of the model weights/version. scheduler_type: type of the schedule. auth_token: authentication token for private models. prompt: target for conditional generation. device: d...
3
stack_v2_sparse_classes_30k_train_013506
Implement the Python class `Generator` described below. Class description: Implementation of a generator. Method signatures and docstrings: - def __init__(self, resources_path: str, model_type: str, model_name: str, scheduler_type: str, auth_token: bool=True, prompt: Optional[Union[str, Dict[str, Any]]]=None, device:...
Implement the Python class `Generator` described below. Class description: Implementation of a generator. Method signatures and docstrings: - def __init__(self, resources_path: str, model_type: str, model_name: str, scheduler_type: str, auth_token: bool=True, prompt: Optional[Union[str, Dict[str, Any]]]=None, device:...
0b69b7d5b261f2f9af3984793c1295b9b80cd01a
<|skeleton|> class Generator: """Implementation of a generator.""" def __init__(self, resources_path: str, model_type: str, model_name: str, scheduler_type: str, auth_token: bool=True, prompt: Optional[Union[str, Dict[str, Any]]]=None, device: Optional[Union[torch.device, str]]=None): """A Diffusers ge...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Generator: """Implementation of a generator.""" def __init__(self, resources_path: str, model_type: str, model_name: str, scheduler_type: str, auth_token: bool=True, prompt: Optional[Union[str, Dict[str, Any]]]=None, device: Optional[Union[torch.device, str]]=None): """A Diffusers generation algo...
the_stack_v2_python_sparse
src/gt4sd/algorithms/generation/diffusion/implementation.py
GT4SD/gt4sd-core
train
239
213a3921f28b06aaa7e814b661d5ada9633c3ec4
[ "self.subdomains = subdomains\nself.k_0 = k_0\nself.k_1 = k_1", "if self.subdomains[cell.index] == 1:\n values[0] = self.k_0\nelse:\n values[0] = self.k_1" ]
<|body_start_0|> self.subdomains = subdomains self.k_0 = k_0 self.k_1 = k_1 <|end_body_0|> <|body_start_1|> if self.subdomains[cell.index] == 1: values[0] = self.k_0 else: values[0] = self.k_1 <|end_body_1|>
Defines constant on computational domain respecting the subdomains. Maybe it should be rewritten as C++ code (see https://fenicsproject.org/pub/tutorial/sphinx1/._ftut1005.html)
SubdomainConstant
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubdomainConstant: """Defines constant on computational domain respecting the subdomains. Maybe it should be rewritten as C++ code (see https://fenicsproject.org/pub/tutorial/sphinx1/._ftut1005.html)""" def __init__(self, subdomains, k_0, k_1, **kwargs): """Constructor.""" <|...
stack_v2_sparse_classes_75kplus_train_002305
12,656
no_license
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self, subdomains, k_0, k_1, **kwargs)" }, { "docstring": "Assigns value to the cell. Note that Gmsh indexes subdomains from 1.", "name": "eval_cell", "signature": "def eval_cell(self, values, x, cell)" } ]
2
null
Implement the Python class `SubdomainConstant` described below. Class description: Defines constant on computational domain respecting the subdomains. Maybe it should be rewritten as C++ code (see https://fenicsproject.org/pub/tutorial/sphinx1/._ftut1005.html) Method signatures and docstrings: - def __init__(self, su...
Implement the Python class `SubdomainConstant` described below. Class description: Defines constant on computational domain respecting the subdomains. Maybe it should be rewritten as C++ code (see https://fenicsproject.org/pub/tutorial/sphinx1/._ftut1005.html) Method signatures and docstrings: - def __init__(self, su...
ba08ebbfed25bec742316dcd665c0b9941658232
<|skeleton|> class SubdomainConstant: """Defines constant on computational domain respecting the subdomains. Maybe it should be rewritten as C++ code (see https://fenicsproject.org/pub/tutorial/sphinx1/._ftut1005.html)""" def __init__(self, subdomains, k_0, k_1, **kwargs): """Constructor.""" <|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SubdomainConstant: """Defines constant on computational domain respecting the subdomains. Maybe it should be rewritten as C++ code (see https://fenicsproject.org/pub/tutorial/sphinx1/._ftut1005.html)""" def __init__(self, subdomains, k_0, k_1, **kwargs): """Constructor.""" self.subdomains...
the_stack_v2_python_sparse
applications/PUfoam/MoDeNaModels/FoamConstruction/simulation.py
MoDeNa-EUProject/MoDeNa
train
19
e92308341c7fdc1374457ec4b6a619072cdcf45d
[ "self.log = log\nif e is not None or operation is not None:\n self.handle_exception(e, operation)\nreturn", "result = {'error': None}\nexc_type, exc_obj, exc_tb = exc_info()\nfname = path_split(exc_tb.tb_frame.f_code.co_filename)[frame]\nresult['error'] = '%s, %s, %s' % (str(exc_type), str(fname), str(exc_tb.t...
<|body_start_0|> self.log = log if e is not None or operation is not None: self.handle_exception(e, operation) return <|end_body_0|> <|body_start_1|> result = {'error': None} exc_type, exc_obj, exc_tb = exc_info() fname = path_split(exc_tb.tb_frame.f_code.co_...
Object for exception handling.
ExceptionHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExceptionHandler: """Object for exception handling.""" def __init__(self, log, e=None, operation=None): """Initialize the exception handler object. @param log: an initialized logger object. @param e: the exception (from BaseException, e). @param operation: the action being attempted ...
stack_v2_sparse_classes_75kplus_train_002306
3,299
no_license
[ { "docstring": "Initialize the exception handler object. @param log: an initialized logger object. @param e: the exception (from BaseException, e). @param operation: the action being attempted (that failed). @return: None.", "name": "__init__", "signature": "def __init__(self, log, e=None, operation=Non...
3
stack_v2_sparse_classes_30k_train_007905
Implement the Python class `ExceptionHandler` described below. Class description: Object for exception handling. Method signatures and docstrings: - def __init__(self, log, e=None, operation=None): Initialize the exception handler object. @param log: an initialized logger object. @param e: the exception (from BaseExc...
Implement the Python class `ExceptionHandler` described below. Class description: Object for exception handling. Method signatures and docstrings: - def __init__(self, log, e=None, operation=None): Initialize the exception handler object. @param log: an initialized logger object. @param e: the exception (from BaseExc...
cc14053da99f6671b12e03ef5dc1717c3d9e4aa5
<|skeleton|> class ExceptionHandler: """Object for exception handling.""" def __init__(self, log, e=None, operation=None): """Initialize the exception handler object. @param log: an initialized logger object. @param e: the exception (from BaseException, e). @param operation: the action being attempted ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ExceptionHandler: """Object for exception handling.""" def __init__(self, log, e=None, operation=None): """Initialize the exception handler object. @param log: an initialized logger object. @param e: the exception (from BaseException, e). @param operation: the action being attempted (that failed)...
the_stack_v2_python_sparse
exceptionhandler.py
jslatte/tartaros
train
1
ed56a81673aacebf486225496e002abbfa8e5523
[ "super().__init__()\nself.filename = file\nself.width = 0\nself.height = 0\nself.fps = 0", "if self.filename:\n self.video = cv2.VideoCapture(self.filename)\n self.width = int(self.video.get(cv2.CAP_PROP_FRAME_WIDTH))\n self.height = int(self.video.get(cv2.CAP_PROP_FRAME_HEIGHT))\n self.fps = int(self...
<|body_start_0|> super().__init__() self.filename = file self.width = 0 self.height = 0 self.fps = 0 <|end_body_0|> <|body_start_1|> if self.filename: self.video = cv2.VideoCapture(self.filename) self.width = int(self.video.get(cv2.CAP_PROP_FRAME_...
VideoFile
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VideoFile: def __init__(self, file): """Default constructor.""" <|body_0|> def initialize(self): """Open video file.""" <|body_1|> <|end_skeleton|> <|body_start_0|> super().__init__() self.filename = file self.width = 0 self....
stack_v2_sparse_classes_75kplus_train_002307
4,348
permissive
[ { "docstring": "Default constructor.", "name": "__init__", "signature": "def __init__(self, file)" }, { "docstring": "Open video file.", "name": "initialize", "signature": "def initialize(self)" } ]
2
null
Implement the Python class `VideoFile` described below. Class description: Implement the VideoFile class. Method signatures and docstrings: - def __init__(self, file): Default constructor. - def initialize(self): Open video file.
Implement the Python class `VideoFile` described below. Class description: Implement the VideoFile class. Method signatures and docstrings: - def __init__(self, file): Default constructor. - def initialize(self): Open video file. <|skeleton|> class VideoFile: def __init__(self, file): """Default constru...
65ee6be8d438614d0644b4ea7d384658daeca1c4
<|skeleton|> class VideoFile: def __init__(self, file): """Default constructor.""" <|body_0|> def initialize(self): """Open video file.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VideoFile: def __init__(self, file): """Default constructor.""" super().__init__() self.filename = file self.width = 0 self.height = 0 self.fps = 0 def initialize(self): """Open video file.""" if self.filename: self.video = cv2.V...
the_stack_v2_python_sparse
bach/video.py
isazi/bach
train
2
ff978e29d3376449217df09626b1ba71efcefac9
[ "if 'id' in request.GET:\n feedback = app_models.feedback.objects.get(id=request.GET['id'])\n is_create_new_data = False\n project_id = 'new_app:feedback:%s' % request.GET.get('related_page_id', 0)\nelse:\n feedback = None\n is_create_new_data = True\n project_id = 'new_app:feedback:0'\nc = Reques...
<|body_start_0|> if 'id' in request.GET: feedback = app_models.feedback.objects.get(id=request.GET['id']) is_create_new_data = False project_id = 'new_app:feedback:%s' % request.GET.get('related_page_id', 0) else: feedback = None is_create_new_...
feedback
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class feedback: def get(request): """响应GET""" <|body_0|> def api_put(request): """响应PUT""" <|body_1|> def api_post(request): """响应POST""" <|body_2|> def api_delete(request): """响应DELETE""" <|body_3|> <|end_skeleton|> <|bo...
stack_v2_sparse_classes_75kplus_train_002308
2,469
no_license
[ { "docstring": "响应GET", "name": "get", "signature": "def get(request)" }, { "docstring": "响应PUT", "name": "api_put", "signature": "def api_put(request)" }, { "docstring": "响应POST", "name": "api_post", "signature": "def api_post(request)" }, { "docstring": "响应DELET...
4
null
Implement the Python class `feedback` described below. Class description: Implement the feedback class. Method signatures and docstrings: - def get(request): 响应GET - def api_put(request): 响应PUT - def api_post(request): 响应POST - def api_delete(request): 响应DELETE
Implement the Python class `feedback` described below. Class description: Implement the feedback class. Method signatures and docstrings: - def get(request): 响应GET - def api_put(request): 响应PUT - def api_post(request): 响应POST - def api_delete(request): 响应DELETE <|skeleton|> class feedback: def get(request): ...
8b2f7befe92841bcc35e0e60cac5958ef3f3af54
<|skeleton|> class feedback: def get(request): """响应GET""" <|body_0|> def api_put(request): """响应PUT""" <|body_1|> def api_post(request): """响应POST""" <|body_2|> def api_delete(request): """响应DELETE""" <|body_3|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class feedback: def get(request): """响应GET""" if 'id' in request.GET: feedback = app_models.feedback.objects.get(id=request.GET['id']) is_create_new_data = False project_id = 'new_app:feedback:%s' % request.GET.get('related_page_id', 0) else: f...
the_stack_v2_python_sparse
weapp/apps/customerized_apps/feedback/feedback.py
chengdg/weizoom
train
1
edebdab3c82b1a1ad1219d39f3ce25f59048584f
[ "if sub is None and subpart:\n if isinstance(subpart, six.string_types):\n sub = 'Subpart:{0}'.format(subpart)\n else:\n sub = 'Subpart'\nif sub is None and is_interp:\n sub = 'Interpretations'\nif sub is None and appendix:\n sub = 'Appendix:' + appendix\nif paragraph:\n paragraphs = [p...
<|body_start_0|> if sub is None and subpart: if isinstance(subpart, six.string_types): sub = 'Subpart:{0}'.format(subpart) else: sub = 'Subpart' if sub is None and is_interp: sub = 'Interpretations' if sub is None and appendix: ...
Represents an entity which is being modified by the amendment. Label is a way to locate this paragraph (though see the above note). We might be modifying a field of a paragraph (e.g. intro text only, or title only;) if so, set the `field` parameter.
Paragraph
[ "CC0-1.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Paragraph: """Represents an entity which is being modified by the amendment. Label is a way to locate this paragraph (though see the above note). We might be modifying a field of a paragraph (e.g. intro text only, or title only;) if so, set the `field` parameter.""" def make(cls, label=None,...
stack_v2_sparse_classes_75kplus_train_002309
4,697
permissive
[ { "docstring": "label and field are the only \"materialized\" fields. Everything other field becomes part of the label, offering a more legible API. Particularly useful for writing tests", "name": "make", "signature": "def make(cls, label=None, field=None, part=None, sub=None, section=None, paragraphs=N...
2
null
Implement the Python class `Paragraph` described below. Class description: Represents an entity which is being modified by the amendment. Label is a way to locate this paragraph (though see the above note). We might be modifying a field of a paragraph (e.g. intro text only, or title only;) if so, set the `field` param...
Implement the Python class `Paragraph` described below. Class description: Represents an entity which is being modified by the amendment. Label is a way to locate this paragraph (though see the above note). We might be modifying a field of a paragraph (e.g. intro text only, or title only;) if so, set the `field` param...
ea608ac109a918fdda60491fffa3fbd646928cf4
<|skeleton|> class Paragraph: """Represents an entity which is being modified by the amendment. Label is a way to locate this paragraph (though see the above note). We might be modifying a field of a paragraph (e.g. intro text only, or title only;) if so, set the `field` parameter.""" def make(cls, label=None,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Paragraph: """Represents an entity which is being modified by the amendment. Label is a way to locate this paragraph (though see the above note). We might be modifying a field of a paragraph (e.g. intro text only, or title only;) if so, set the `field` parameter.""" def make(cls, label=None, field=None, ...
the_stack_v2_python_sparse
regparser/grammar/tokens.py
fecgov/regulations-parser
train
1
05ebbe5386164cad10948bb5ee01963dd33e2d17
[ "tree_viewer = ResourceTreeViewer(parent=parent, input=self.workspace, selection_mode='single', show_root=False)\ntree_viewer.on_trait_change(self.on_selection_change, 'selection')\nreturn tree_viewer.control", "if selections:\n selection = selections[0]\n if isinstance(selection, File):\n self.resou...
<|body_start_0|> tree_viewer = ResourceTreeViewer(parent=parent, input=self.workspace, selection_mode='single', show_root=False) tree_viewer.on_trait_change(self.on_selection_change, 'selection') return tree_viewer.control <|end_body_0|> <|body_start_1|> if selections: selec...
Wizard page for resource selection.
ResourceSelectionPage
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResourceSelectionPage: """Wizard page for resource selection.""" def create_page(self, parent): """Create the wizard page.""" <|body_0|> def on_selection_change(self, selections): """Handles the tree viewer selections changing.""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_75kplus_train_002310
3,949
permissive
[ { "docstring": "Create the wizard page.", "name": "create_page", "signature": "def create_page(self, parent)" }, { "docstring": "Handles the tree viewer selections changing.", "name": "on_selection_change", "signature": "def on_selection_change(self, selections)" } ]
2
stack_v2_sparse_classes_30k_train_018329
Implement the Python class `ResourceSelectionPage` described below. Class description: Wizard page for resource selection. Method signatures and docstrings: - def create_page(self, parent): Create the wizard page. - def on_selection_change(self, selections): Handles the tree viewer selections changing.
Implement the Python class `ResourceSelectionPage` described below. Class description: Wizard page for resource selection. Method signatures and docstrings: - def create_page(self, parent): Create the wizard page. - def on_selection_change(self, selections): Handles the tree viewer selections changing. <|skeleton|> ...
e8fc0b2d6b9b08e60389fc4714a5cf51f628b57f
<|skeleton|> class ResourceSelectionPage: """Wizard page for resource selection.""" def create_page(self, parent): """Create the wizard page.""" <|body_0|> def on_selection_change(self, selections): """Handles the tree viewer selections changing.""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ResourceSelectionPage: """Wizard page for resource selection.""" def create_page(self, parent): """Create the wizard page.""" tree_viewer = ResourceTreeViewer(parent=parent, input=self.workspace, selection_mode='single', show_root=False) tree_viewer.on_trait_change(self.on_selecti...
the_stack_v2_python_sparse
puddle/resource/wizard/resource_selection_page.py
rwl/puddle
train
2
31e5f727d55c324bd3931ceb70519d5533cd67e7
[ "pagination = req.context.get('pagination')\npost_collection_dto = PostCollectionV2Dto(posts=[post_to_v2_dto(post, href=PostResource.url_to(req.netloc, post_id=post.id), links=get_post_links(req, post)) for post in get_posts(start=pagination.get('start'), count=pagination.get('count'))])\nresp.body = post_collectio...
<|body_start_0|> pagination = req.context.get('pagination') post_collection_dto = PostCollectionV2Dto(posts=[post_to_v2_dto(post, href=PostResource.url_to(req.netloc, post_id=post.id), links=get_post_links(req, post)) for post in get_posts(start=pagination.get('start'), count=pagination.get('count'))]) ...
PostCollectionResource
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PostCollectionResource: def on_get(self, req, resp): """Fetch grid view for all post resources. Note: This endpoint supports pagination, pagination arguments must be provided via query args.""" <|body_0|> def on_post(self, req, resp): """Create a new post resource.""...
stack_v2_sparse_classes_75kplus_train_002311
7,743
permissive
[ { "docstring": "Fetch grid view for all post resources. Note: This endpoint supports pagination, pagination arguments must be provided via query args.", "name": "on_get", "signature": "def on_get(self, req, resp)" }, { "docstring": "Create a new post resource.", "name": "on_post", "signa...
2
stack_v2_sparse_classes_30k_train_013011
Implement the Python class `PostCollectionResource` described below. Class description: Implement the PostCollectionResource class. Method signatures and docstrings: - def on_get(self, req, resp): Fetch grid view for all post resources. Note: This endpoint supports pagination, pagination arguments must be provided vi...
Implement the Python class `PostCollectionResource` described below. Class description: Implement the PostCollectionResource class. Method signatures and docstrings: - def on_get(self, req, resp): Fetch grid view for all post resources. Note: This endpoint supports pagination, pagination arguments must be provided vi...
e507fe0307d1a7ea29d6c3e20be62fa82a8f109f
<|skeleton|> class PostCollectionResource: def on_get(self, req, resp): """Fetch grid view for all post resources. Note: This endpoint supports pagination, pagination arguments must be provided via query args.""" <|body_0|> def on_post(self, req, resp): """Create a new post resource.""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PostCollectionResource: def on_get(self, req, resp): """Fetch grid view for all post resources. Note: This endpoint supports pagination, pagination arguments must be provided via query args.""" pagination = req.context.get('pagination') post_collection_dto = PostCollectionV2Dto(posts=[...
the_stack_v2_python_sparse
blog/resources/posts.py
neetjn/py-blog
train
0
377682c9e234a8da72d3c1a28a6ddbf1846f0b22
[ "self.list_of_all_labels = find_all_labels(list(frecords()), get_labels_of_record)\nself.k_list = k_list\nPRINTER('[MlKnnFractionalEnsembledStrongest: init] labels: ' + str(self.list_of_all_labels))\nPRINTER('[MlKnnFractionalEnsembledStrongest: init]: START OF TRAINING...')\nself.mlknn_fractionals = {}\nfor k in se...
<|body_start_0|> self.list_of_all_labels = find_all_labels(list(frecords()), get_labels_of_record) self.k_list = k_list PRINTER('[MlKnnFractionalEnsembledStrongest: init] labels: ' + str(self.list_of_all_labels)) PRINTER('[MlKnnFractionalEnsembledStrongest: init]: START OF TRAINING...') ...
@deprecated: use MlknnTEnsembled instead. Naive Bayes with KNN as features. Modification of a classifier based on a publication: Ml-knn: A Lazy Learning Approach to Multi-Label Learning Min-Ling Zhang, Zhi-Hua Zhou. A threshold is being chosen for each class, maximizing the f-measure. Ensemble of such MlKnn's is create...
MlKnnFractionalEnsembledStrongest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MlKnnFractionalEnsembledStrongest: """@deprecated: use MlknnTEnsembled instead. Naive Bayes with KNN as features. Modification of a classifier based on a publication: Ml-knn: A Lazy Learning Approach to Multi-Label Learning Min-Ling Zhang, Zhi-Hua Zhou. A threshold is being chosen for each class,...
stack_v2_sparse_classes_75kplus_train_002312
4,279
no_license
[ { "docstring": "Constructor. @type frecords: list of records @param frecords: used to calculate parameters (probabilities) and nearest neighbours amongst the records it returns; NOTE: if a user wants to manipulate, which codes to consider(e.g. higher or lower level) it is good to give a specific frecords parame...
2
stack_v2_sparse_classes_30k_train_049368
Implement the Python class `MlKnnFractionalEnsembledStrongest` described below. Class description: @deprecated: use MlknnTEnsembled instead. Naive Bayes with KNN as features. Modification of a classifier based on a publication: Ml-knn: A Lazy Learning Approach to Multi-Label Learning Min-Ling Zhang, Zhi-Hua Zhou. A th...
Implement the Python class `MlKnnFractionalEnsembledStrongest` described below. Class description: @deprecated: use MlknnTEnsembled instead. Naive Bayes with KNN as features. Modification of a classifier based on a publication: Ml-knn: A Lazy Learning Approach to Multi-Label Learning Min-Ling Zhang, Zhi-Hua Zhou. A th...
e38508de91f8a7bda3096c6f0a361734207357a5
<|skeleton|> class MlKnnFractionalEnsembledStrongest: """@deprecated: use MlknnTEnsembled instead. Naive Bayes with KNN as features. Modification of a classifier based on a publication: Ml-knn: A Lazy Learning Approach to Multi-Label Learning Min-Ling Zhang, Zhi-Hua Zhou. A threshold is being chosen for each class,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MlKnnFractionalEnsembledStrongest: """@deprecated: use MlknnTEnsembled instead. Naive Bayes with KNN as features. Modification of a classifier based on a publication: Ml-knn: A Lazy Learning Approach to Multi-Label Learning Min-Ling Zhang, Zhi-Hua Zhou. A threshold is being chosen for each class, maximizing t...
the_stack_v2_python_sparse
src/main/python/document_classification/mlknn/mlknn_ensembled_fractional.py
pszostek/research-python-backup
train
0
9a8a675333f7cdf44fa87be733013e2b36063c5b
[ "if n == 0:\n return []\nreturn self.dfs(1, n)", "if start > end:\n return [None]\nres = []\nfor root_val in range(start, end + 1):\n left_tree = self.dfs(start, root_val - 1)\n right_tree = self.dfs(root_val + 1, end)\n for i in left_tree:\n for j in right_tree:\n root = TreeNode...
<|body_start_0|> if n == 0: return [] return self.dfs(1, n) <|end_body_0|> <|body_start_1|> if start > end: return [None] res = [] for root_val in range(start, end + 1): left_tree = self.dfs(start, root_val - 1) right_tree = self.d...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def generateTrees(self, n): """一般这种要求列出所有可能结果的题目都用dfs :type n: int :rtype: List[TreeNode]""" <|body_0|> def dfs(self, start, end): """dfs(start, end)函数返回以start,start+1,...,end为根的二叉查找树。""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n =...
stack_v2_sparse_classes_75kplus_train_002313
1,122
no_license
[ { "docstring": "一般这种要求列出所有可能结果的题目都用dfs :type n: int :rtype: List[TreeNode]", "name": "generateTrees", "signature": "def generateTrees(self, n)" }, { "docstring": "dfs(start, end)函数返回以start,start+1,...,end为根的二叉查找树。", "name": "dfs", "signature": "def dfs(self, start, end)" } ]
2
stack_v2_sparse_classes_30k_test_000663
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def generateTrees(self, n): 一般这种要求列出所有可能结果的题目都用dfs :type n: int :rtype: List[TreeNode] - def dfs(self, start, end): dfs(start, end)函数返回以start,start+1,...,end为根的二叉查找树。
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def generateTrees(self, n): 一般这种要求列出所有可能结果的题目都用dfs :type n: int :rtype: List[TreeNode] - def dfs(self, start, end): dfs(start, end)函数返回以start,start+1,...,end为根的二叉查找树。 <|skeleton...
74550d68cd3fd2cfcc92e1bf6579ac3b8f31aa75
<|skeleton|> class Solution: def generateTrees(self, n): """一般这种要求列出所有可能结果的题目都用dfs :type n: int :rtype: List[TreeNode]""" <|body_0|> def dfs(self, start, end): """dfs(start, end)函数返回以start,start+1,...,end为根的二叉查找树。""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def generateTrees(self, n): """一般这种要求列出所有可能结果的题目都用dfs :type n: int :rtype: List[TreeNode]""" if n == 0: return [] return self.dfs(1, n) def dfs(self, start, end): """dfs(start, end)函数返回以start,start+1,...,end为根的二叉查找树。""" if start > end: ...
the_stack_v2_python_sparse
tree/95_unique_binary_seach_tree_ii.py
lawtech0902/py_imooc_algorithm
train
0
da60763f50898ce774d8bc281289954d11f559f3
[ "svc = self.App.get_service('bspump.PumpService')\nself.Pipeline = UnitTestPipeline(self.App, processor, *args, **kwargs)\nsvc.add_pipeline(self.Pipeline)", "self.Pipeline.Source.Input = input_data\nself.Pipeline.unittest_start()\nself.App.run()\nreturn self.Pipeline.Sink.Output" ]
<|body_start_0|> svc = self.App.get_service('bspump.PumpService') self.Pipeline = UnitTestPipeline(self.App, processor, *args, **kwargs) svc.add_pipeline(self.Pipeline) <|end_body_0|> <|body_start_1|> self.Pipeline.Source.Input = input_data self.Pipeline.unittest_start() ...
A class whose instances are single processor test cases. Test authors should subclass ProcessorTestCase for their own tests. Construction and deconstruction of the test's environment ('fixture') can be implemented by overriding the 'setUp' and 'tearDown' methods respectively. See :class: `unittest.TestCase` for more de...
ProcessorTestCase
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProcessorTestCase: """A class whose instances are single processor test cases. Test authors should subclass ProcessorTestCase for their own tests. Construction and deconstruction of the test's environment ('fixture') can be implemented by overriding the 'setUp' and 'tearDown' methods respectively...
stack_v2_sparse_classes_75kplus_train_002314
2,188
permissive
[ { "docstring": "Construct Pipeline from processor and appends it to PumpService :param processor: Processor you want to test :param args: Optional arguments for processor :param kwargs: Optional key-word arguments for processor", "name": "set_up_processor", "signature": "def set_up_processor(self, proce...
2
stack_v2_sparse_classes_30k_train_018372
Implement the Python class `ProcessorTestCase` described below. Class description: A class whose instances are single processor test cases. Test authors should subclass ProcessorTestCase for their own tests. Construction and deconstruction of the test's environment ('fixture') can be implemented by overriding the 'set...
Implement the Python class `ProcessorTestCase` described below. Class description: A class whose instances are single processor test cases. Test authors should subclass ProcessorTestCase for their own tests. Construction and deconstruction of the test's environment ('fixture') can be implemented by overriding the 'set...
11ee3689d0ff6e9b662deeb3fc5e18bb0aabc8f2
<|skeleton|> class ProcessorTestCase: """A class whose instances are single processor test cases. Test authors should subclass ProcessorTestCase for their own tests. Construction and deconstruction of the test's environment ('fixture') can be implemented by overriding the 'setUp' and 'tearDown' methods respectively...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProcessorTestCase: """A class whose instances are single processor test cases. Test authors should subclass ProcessorTestCase for their own tests. Construction and deconstruction of the test's environment ('fixture') can be implemented by overriding the 'setUp' and 'tearDown' methods respectively. See :class:...
the_stack_v2_python_sparse
bspump/unittest/unit_test_case.py
LibertyAces/BitSwanPump
train
24
3f26ecf96c363269480e66adb644c08f0860e6ec
[ "data = request.json\nnodeid = data.get('nodeid')\nreport = ExecuteTools.invoke(nodeid)\napp.logger.info(f'添加一条task,报告为{report},执行用例为{nodeid}')\ntask = Task(remark=nodeid, report=report)\ndb.session.add(task)\ndb.session.commit()\ndb.session.close()\nreturn {'error': 0, 'msg': 'ok'}", "tasks = Task.query.all()\nt...
<|body_start_0|> data = request.json nodeid = data.get('nodeid') report = ExecuteTools.invoke(nodeid) app.logger.info(f'添加一条task,报告为{report},执行用例为{nodeid}') task = Task(remark=nodeid, report=report) db.session.add(task) db.session.commit() db.session.close...
TaskService
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TaskService: def post(self): """1.调用jenkins执行用例 2.执行用例之后,写入执行记录到数据库表中 :return:""" <|body_0|> def get(self): """:return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> data = request.json nodeid = data.get('nodeid') report = ExecuteT...
stack_v2_sparse_classes_75kplus_train_002315
1,578
no_license
[ { "docstring": "1.调用jenkins执行用例 2.执行用例之后,写入执行记录到数据库表中 :return:", "name": "post", "signature": "def post(self)" }, { "docstring": ":return:", "name": "get", "signature": "def get(self)" } ]
2
stack_v2_sparse_classes_30k_train_034691
Implement the Python class `TaskService` described below. Class description: Implement the TaskService class. Method signatures and docstrings: - def post(self): 1.调用jenkins执行用例 2.执行用例之后,写入执行记录到数据库表中 :return: - def get(self): :return:
Implement the Python class `TaskService` described below. Class description: Implement the TaskService class. Method signatures and docstrings: - def post(self): 1.调用jenkins执行用例 2.执行用例之后,写入执行记录到数据库表中 :return: - def get(self): :return: <|skeleton|> class TaskService: def post(self): """1.调用jenkins执行用例 2....
d32e4af68efc4eb935fe98d1f901f1408ed2e785
<|skeleton|> class TaskService: def post(self): """1.调用jenkins执行用例 2.执行用例之后,写入执行记录到数据库表中 :return:""" <|body_0|> def get(self): """:return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TaskService: def post(self): """1.调用jenkins执行用例 2.执行用例之后,写入执行记录到数据库表中 :return:""" data = request.json nodeid = data.get('nodeid') report = ExecuteTools.invoke(nodeid) app.logger.info(f'添加一条task,报告为{report},执行用例为{nodeid}') task = Task(remark=nodeid, report=report...
the_stack_v2_python_sparse
backend/apis/task.py
yangwei211/HogwartsSDET18
train
0
751ff6d43d6f397a882cc923fb5f50dd40338910
[ "self.filename = filename\nself.pauseBetweenChannels = pauseBetweenChannels\nprint('Using Rigol DP800 at {}'.format(self.filename))\nif type(channelNumbers) != list:\n print(\"Error: RigolDP800 channelNumbers argument is not list: '{}', exiting.\".format(channelNumbers))\n sys.exit(1)\nself.channels = channel...
<|body_start_0|> self.filename = filename self.pauseBetweenChannels = pauseBetweenChannels print('Using Rigol DP800 at {}'.format(self.filename)) if type(channelNumbers) != list: print("Error: RigolDP800 channelNumbers argument is not list: '{}', exiting.".format(channelNumbe...
Interface to Rigol DP800 Power Supply
RigolDP800
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RigolDP800: """Interface to Rigol DP800 Power Supply""" def __init__(self, filename, channelNumbers, pauseBetweenChannels=2.0): """filename is a the path to a usbtmc object like /dev/usbtmc0. channelNumbers is a list of the channels to turn on e.g. ["CH1","CH2","CH3"]. All three chan...
stack_v2_sparse_classes_75kplus_train_002316
4,019
no_license
[ { "docstring": "filename is a the path to a usbtmc object like /dev/usbtmc0. channelNumbers is a list of the channels to turn on e.g. [\"CH1\",\"CH2\",\"CH3\"]. All three channels are turned off no matter what POWERSUPPLYCHANNELS is set to. pauseBetweenChannels is the amount of time in seconds to pause between ...
4
null
Implement the Python class `RigolDP800` described below. Class description: Interface to Rigol DP800 Power Supply Method signatures and docstrings: - def __init__(self, filename, channelNumbers, pauseBetweenChannels=2.0): filename is a the path to a usbtmc object like /dev/usbtmc0. channelNumbers is a list of the cha...
Implement the Python class `RigolDP800` described below. Class description: Interface to Rigol DP800 Power Supply Method signatures and docstrings: - def __init__(self, filename, channelNumbers, pauseBetweenChannels=2.0): filename is a the path to a usbtmc object like /dev/usbtmc0. channelNumbers is a list of the cha...
50bf5ccc9ea9527d4032e0992fb70f598c236d37
<|skeleton|> class RigolDP800: """Interface to Rigol DP800 Power Supply""" def __init__(self, filename, channelNumbers, pauseBetweenChannels=2.0): """filename is a the path to a usbtmc object like /dev/usbtmc0. channelNumbers is a list of the channels to turn on e.g. ["CH1","CH2","CH3"]. All three chan...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RigolDP800: """Interface to Rigol DP800 Power Supply""" def __init__(self, filename, channelNumbers, pauseBetweenChannels=2.0): """filename is a the path to a usbtmc object like /dev/usbtmc0. channelNumbers is a list of the channels to turn on e.g. ["CH1","CH2","CH3"]. All three channels are turn...
the_stack_v2_python_sparse
femb_python/test_instrument_interface/rigol_dp800.py
DUNE/femb_python
train
3
6cc867a52448833c098268ebf4a24ed38281bf6d
[ "self.number = num_cell\nself.name = name\nself.enemy_type = enemy_type\nself.final = final\nif final:\n self.enemy = self.enemy_selector()\n self.loot = None\nelse:\n self.determine_property()", "result = randrange(0, 100)\nif result in range(0, 10):\n self.enemy = None\n self.loot = None\nelif re...
<|body_start_0|> self.number = num_cell self.name = name self.enemy_type = enemy_type self.final = final if final: self.enemy = self.enemy_selector() self.loot = None else: self.determine_property() <|end_body_0|> <|body_start_1|> ...
The Cell class holds all the information about the current cell in a dungeon.
Cell
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cell: """The Cell class holds all the information about the current cell in a dungeon.""" def __init__(self, name, num_cell, enemy_type, final=False): """:param name: The name of the dungeon (used in some cases to determine the cell's enemy). :param num_cell: The cell number (in the ...
stack_v2_sparse_classes_75kplus_train_002317
12,531
no_license
[ { "docstring": ":param name: The name of the dungeon (used in some cases to determine the cell's enemy). :param num_cell: The cell number (in the dungeon). :param enemy_type: The type of the enemy (for enemy selector). :param final: Boolean value that says whether or not we are in the dungeon's final cell. Init...
4
stack_v2_sparse_classes_30k_test_000494
Implement the Python class `Cell` described below. Class description: The Cell class holds all the information about the current cell in a dungeon. Method signatures and docstrings: - def __init__(self, name, num_cell, enemy_type, final=False): :param name: The name of the dungeon (used in some cases to determine the...
Implement the Python class `Cell` described below. Class description: The Cell class holds all the information about the current cell in a dungeon. Method signatures and docstrings: - def __init__(self, name, num_cell, enemy_type, final=False): :param name: The name of the dungeon (used in some cases to determine the...
6efca3dc9b33ad8ca7c4cde3ff032e5292b144a6
<|skeleton|> class Cell: """The Cell class holds all the information about the current cell in a dungeon.""" def __init__(self, name, num_cell, enemy_type, final=False): """:param name: The name of the dungeon (used in some cases to determine the cell's enemy). :param num_cell: The cell number (in the ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Cell: """The Cell class holds all the information about the current cell in a dungeon.""" def __init__(self, name, num_cell, enemy_type, final=False): """:param name: The name of the dungeon (used in some cases to determine the cell's enemy). :param num_cell: The cell number (in the dungeon). :pa...
the_stack_v2_python_sparse
dungeon.py
NairVish/the-destroyers-destiny
train
0
de7634f482ea3720b88610d28484805fb8693ea0
[ "self.Wh = np.random.normal(size=(i + h, h))\nself.Wy = np.random.normal(size=(h, o))\nself.bh = np.zeros((1, h))\nself.by = np.zeros((1, o))", "def softmax(x):\n \"\"\"Function that perform the softmax function\"\"\"\n e_x = np.exp(x - np.max(x, axis=1, keepdims=True))\n softmax = e_x / e_x.sum(axis=1, ...
<|body_start_0|> self.Wh = np.random.normal(size=(i + h, h)) self.Wy = np.random.normal(size=(h, o)) self.bh = np.zeros((1, h)) self.by = np.zeros((1, o)) <|end_body_0|> <|body_start_1|> def softmax(x): """Function that perform the softmax function""" e_x...
Class that represents a cell of a simple RNN
RNNCell
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RNNCell: """Class that represents a cell of a simple RNN""" def __init__(self, i, h, o): """class constructor Args: i is the dimensionality of the data h is the dimensionality of the hidden state o is the dimensionality of the outputs Creates the public instance attributes Wh, Wy, bh...
stack_v2_sparse_classes_75kplus_train_002318
2,107
no_license
[ { "docstring": "class constructor Args: i is the dimensionality of the data h is the dimensionality of the hidden state o is the dimensionality of the outputs Creates the public instance attributes Wh, Wy, bh, by that represent the weights and biases of the cell Wh and bh are for the concatenated hidden state a...
2
stack_v2_sparse_classes_30k_train_011245
Implement the Python class `RNNCell` described below. Class description: Class that represents a cell of a simple RNN Method signatures and docstrings: - def __init__(self, i, h, o): class constructor Args: i is the dimensionality of the data h is the dimensionality of the hidden state o is the dimensionality of the ...
Implement the Python class `RNNCell` described below. Class description: Class that represents a cell of a simple RNN Method signatures and docstrings: - def __init__(self, i, h, o): class constructor Args: i is the dimensionality of the data h is the dimensionality of the hidden state o is the dimensionality of the ...
e8a98d85b3bfd5665cb04bec9ee8c3eb23d6bd58
<|skeleton|> class RNNCell: """Class that represents a cell of a simple RNN""" def __init__(self, i, h, o): """class constructor Args: i is the dimensionality of the data h is the dimensionality of the hidden state o is the dimensionality of the outputs Creates the public instance attributes Wh, Wy, bh...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RNNCell: """Class that represents a cell of a simple RNN""" def __init__(self, i, h, o): """class constructor Args: i is the dimensionality of the data h is the dimensionality of the hidden state o is the dimensionality of the outputs Creates the public instance attributes Wh, Wy, bh, by that rep...
the_stack_v2_python_sparse
supervised_learning/0x0D-RNNs/0-rnn_cell.py
AndrewMiranda/holbertonschool-machine_learning-1
train
0
6602b1676d3bf631d02bd323d232eaaf9ae4c808
[ "self.object = object\nself.object_progress_monitor_task_path = object_progress_monitor_task_path\nself.preprocessing_error = preprocessing_error\nself.task_id = task_id", "if dictionary is None:\n return None\nobject = cohesity_management_sdk.models.restore_object.RestoreObject.from_dictionary(dictionary.get(...
<|body_start_0|> self.object = object self.object_progress_monitor_task_path = object_progress_monitor_task_path self.preprocessing_error = preprocessing_error self.task_id = task_id <|end_body_0|> <|body_start_1|> if dictionary is None: return None object = ...
Implementation of the 'PerformRestoreJobStateProto_RestoreTask' model. Information of the object being restored along with the info of the task tracking the restore of that object. Attributes: object (RestoreObject): Information of the object being restored (along with the snapshot it is being restored from). object_pr...
PerformRestoreJobStateProto_RestoreTask
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PerformRestoreJobStateProto_RestoreTask: """Implementation of the 'PerformRestoreJobStateProto_RestoreTask' model. Information of the object being restored along with the info of the task tracking the restore of that object. Attributes: object (RestoreObject): Information of the object being rest...
stack_v2_sparse_classes_75kplus_train_002319
3,283
permissive
[ { "docstring": "Constructor for the PerformRestoreJobStateProto_RestoreTask class", "name": "__init__", "signature": "def __init__(self, object=None, object_progress_monitor_task_path=None, preprocessing_error=None, task_id=None)" }, { "docstring": "Creates an instance of this model from a dicti...
2
null
Implement the Python class `PerformRestoreJobStateProto_RestoreTask` described below. Class description: Implementation of the 'PerformRestoreJobStateProto_RestoreTask' model. Information of the object being restored along with the info of the task tracking the restore of that object. Attributes: object (RestoreObject...
Implement the Python class `PerformRestoreJobStateProto_RestoreTask` described below. Class description: Implementation of the 'PerformRestoreJobStateProto_RestoreTask' model. Information of the object being restored along with the info of the task tracking the restore of that object. Attributes: object (RestoreObject...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class PerformRestoreJobStateProto_RestoreTask: """Implementation of the 'PerformRestoreJobStateProto_RestoreTask' model. Information of the object being restored along with the info of the task tracking the restore of that object. Attributes: object (RestoreObject): Information of the object being rest...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PerformRestoreJobStateProto_RestoreTask: """Implementation of the 'PerformRestoreJobStateProto_RestoreTask' model. Information of the object being restored along with the info of the task tracking the restore of that object. Attributes: object (RestoreObject): Information of the object being restored (along w...
the_stack_v2_python_sparse
cohesity_management_sdk/models/perform_restore_job_state_proto_restore_task.py
cohesity/management-sdk-python
train
24
5eb1f465536c28027753d5584b067ed8b3fac232
[ "super().__init__(host, port, timeout, **kwargs)\nif hasattr(input, 'read'):\n self.fileobj = input\nelif input == '-':\n self.fileobj = sys.stdin\nelse:\n self.fileobj = open(input, 'rb')\nlogger.debug('tftpy.context.client.upload.__init__()')\nlogger.debug(f' file_to_transfer = {self.file_to_transfer}, o...
<|body_start_0|> super().__init__(host, port, timeout, **kwargs) if hasattr(input, 'read'): self.fileobj = input elif input == '-': self.fileobj = sys.stdin else: self.fileobj = open(input, 'rb') logger.debug('tftpy.context.client.upload.__init...
The upload context for the client during an upload. Note: If input is a hyphen, then we will use stdin.
Upload
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Upload: """The upload context for the client during an upload. Note: If input is a hyphen, then we will use stdin.""" def __init__(self, host: str, port: int, timeout: int, input: Union[IOBase, str], **kwargs) -> None: """Upload context for uploading data to a server. Args: host (str...
stack_v2_sparse_classes_75kplus_train_002320
6,966
permissive
[ { "docstring": "Upload context for uploading data to a server. Args: host (str): Server Address port (int): Server Port timeout (int): socket timeout input ([IOBase,str]): Input data, can be one of - An open file object - A path to a file - a '-' indicating read from STDIN", "name": "__init__", "signatu...
3
stack_v2_sparse_classes_30k_train_023707
Implement the Python class `Upload` described below. Class description: The upload context for the client during an upload. Note: If input is a hyphen, then we will use stdin. Method signatures and docstrings: - def __init__(self, host: str, port: int, timeout: int, input: Union[IOBase, str], **kwargs) -> None: Uploa...
Implement the Python class `Upload` described below. Class description: The upload context for the client during an upload. Note: If input is a hyphen, then we will use stdin. Method signatures and docstrings: - def __init__(self, host: str, port: int, timeout: int, input: Union[IOBase, str], **kwargs) -> None: Uploa...
9c171c7e969b80f2c00728df21d5534b3191620a
<|skeleton|> class Upload: """The upload context for the client during an upload. Note: If input is a hyphen, then we will use stdin.""" def __init__(self, host: str, port: int, timeout: int, input: Union[IOBase, str], **kwargs) -> None: """Upload context for uploading data to a server. Args: host (str...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Upload: """The upload context for the client during an upload. Note: If input is a hyphen, then we will use stdin.""" def __init__(self, host: str, port: int, timeout: int, input: Union[IOBase, str], **kwargs) -> None: """Upload context for uploading data to a server. Args: host (str): Server Add...
the_stack_v2_python_sparse
tftpy/context/client.py
jcarswell/tftpy
train
0
d4ec8f8729eecd0b281f940eee5246c88529ae16
[ "stk = collections.deque()\nret = ''\nwhile root is not None or len(stk):\n if root is not None:\n ret += ',' + str(root.val) + ':' + str(len(root.children))\n if len(root.children):\n stk.append([root, 1])\n root = root.children[0]\n else:\n root = None\n ...
<|body_start_0|> stk = collections.deque() ret = '' while root is not None or len(stk): if root is not None: ret += ',' + str(root.val) + ':' + str(len(root.children)) if len(root.children): stk.append([root, 1]) ...
Codec2
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec2: def serialize(self, root): """Encodes a tree to a single string. :type root: Node :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: Node""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_75kplus_train_002321
4,629
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: Node :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: Node", "name": "deserialize", "signature": "def deserialize(self, ...
2
stack_v2_sparse_classes_30k_train_018126
Implement the Python class `Codec2` described below. Class description: Implement the Codec2 class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: Node :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: N...
Implement the Python class `Codec2` described below. Class description: Implement the Codec2 class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: Node :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: N...
9190d3d178f1733aa226973757ee7e045b7bab00
<|skeleton|> class Codec2: def serialize(self, root): """Encodes a tree to a single string. :type root: Node :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: Node""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec2: def serialize(self, root): """Encodes a tree to a single string. :type root: Node :rtype: str""" stk = collections.deque() ret = '' while root is not None or len(stk): if root is not None: ret += ',' + str(root.val) + ':' + str(len(root.child...
the_stack_v2_python_sparse
SerializeAndDeserializeN-aryTree.py
ellinx/LC-python
train
1
32386b116366ad506499352b7802573b8a14b170
[ "self._hass = hass\nself._recp_nrs = recp_nrs\nself._signal_cli_rest_api = signal_cli_rest_api", "_LOGGER.debug('Sending signal message')\ndata = kwargs.get(ATTR_DATA)\ntry:\n data = DATA_SCHEMA(data)\nexcept vol.Invalid as ex:\n _LOGGER.error('Invalid message data: %s', ex)\n raise ex\nfilenames = self....
<|body_start_0|> self._hass = hass self._recp_nrs = recp_nrs self._signal_cli_rest_api = signal_cli_rest_api <|end_body_0|> <|body_start_1|> _LOGGER.debug('Sending signal message') data = kwargs.get(ATTR_DATA) try: data = DATA_SCHEMA(data) except vol....
Implement the notification service for SignalMessenger.
SignalNotificationService
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SignalNotificationService: """Implement the notification service for SignalMessenger.""" def __init__(self, hass: HomeAssistant, recp_nrs: list[str], signal_cli_rest_api: SignalCliRestApi) -> None: """Initialize the service.""" <|body_0|> def send_message(self, message: ...
stack_v2_sparse_classes_75kplus_train_002322
5,525
permissive
[ { "docstring": "Initialize the service.", "name": "__init__", "signature": "def __init__(self, hass: HomeAssistant, recp_nrs: list[str], signal_cli_rest_api: SignalCliRestApi) -> None" }, { "docstring": "Send a message to a one or more recipients. Additionally a file can be attached.", "name...
4
stack_v2_sparse_classes_30k_train_036035
Implement the Python class `SignalNotificationService` described below. Class description: Implement the notification service for SignalMessenger. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, recp_nrs: list[str], signal_cli_rest_api: SignalCliRestApi) -> None: Initialize the service. - ...
Implement the Python class `SignalNotificationService` described below. Class description: Implement the notification service for SignalMessenger. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, recp_nrs: list[str], signal_cli_rest_api: SignalCliRestApi) -> None: Initialize the service. - ...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class SignalNotificationService: """Implement the notification service for SignalMessenger.""" def __init__(self, hass: HomeAssistant, recp_nrs: list[str], signal_cli_rest_api: SignalCliRestApi) -> None: """Initialize the service.""" <|body_0|> def send_message(self, message: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SignalNotificationService: """Implement the notification service for SignalMessenger.""" def __init__(self, hass: HomeAssistant, recp_nrs: list[str], signal_cli_rest_api: SignalCliRestApi) -> None: """Initialize the service.""" self._hass = hass self._recp_nrs = recp_nrs s...
the_stack_v2_python_sparse
homeassistant/components/signal_messenger/notify.py
home-assistant/core
train
35,501
721c8c17a7cf7a2aab2e991f5334a2b6eb901693
[ "self.data = data\nself.test_data = test_data\nself.validation_data = validation_data\nself.input_shape = input_shape\nself.output_units = output_units\nself.color_mode = color_mode\nself.batch_size = batch_size\nself.class_mode = class_mode\nif self.data.upper() == DATASET_MNIST:\n self.__mnist()\nelif self.dat...
<|body_start_0|> self.data = data self.test_data = test_data self.validation_data = validation_data self.input_shape = input_shape self.output_units = output_units self.color_mode = color_mode self.batch_size = batch_size self.class_mode = class_mode ...
load dataset
Dataset
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dataset: """load dataset""" def __init__(self, data: Text, test_data: Text='', validation_data: Text='', input_shape: Union[None, Tuple[int, int, int]]=None, output_units: int=None, color_mode: Text='rgb', batch_size: int=32, class_mode: Text='categorical'): """:param data: dataset n...
stack_v2_sparse_classes_75kplus_train_002323
5,791
no_license
[ { "docstring": ":param data: dataset name or directory path. If specify detectory path, the sub directory names have to be the class names and the no. of sub directories must be equal to the no. of classes. :param input_shape: input shape in the format (H,W,D). This has to be specified if using own dataset, nam...
4
null
Implement the Python class `Dataset` described below. Class description: load dataset Method signatures and docstrings: - def __init__(self, data: Text, test_data: Text='', validation_data: Text='', input_shape: Union[None, Tuple[int, int, int]]=None, output_units: int=None, color_mode: Text='rgb', batch_size: int=32...
Implement the Python class `Dataset` described below. Class description: load dataset Method signatures and docstrings: - def __init__(self, data: Text, test_data: Text='', validation_data: Text='', input_shape: Union[None, Tuple[int, int, int]]=None, output_units: int=None, color_mode: Text='rgb', batch_size: int=32...
258ba6003e604228a92a1574bcb7f09ee5f3f000
<|skeleton|> class Dataset: """load dataset""" def __init__(self, data: Text, test_data: Text='', validation_data: Text='', input_shape: Union[None, Tuple[int, int, int]]=None, output_units: int=None, color_mode: Text='rgb', batch_size: int=32, class_mode: Text='categorical'): """:param data: dataset n...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Dataset: """load dataset""" def __init__(self, data: Text, test_data: Text='', validation_data: Text='', input_shape: Union[None, Tuple[int, int, int]]=None, output_units: int=None, color_mode: Text='rgb', batch_size: int=32, class_mode: Text='categorical'): """:param data: dataset name or direct...
the_stack_v2_python_sparse
dataset.py
reouno/tf-image-classifiers
train
0
8214ab22672aaa0e876cc392d015f1204961491a
[ "if dataset not in datasets_list:\n print('Existing datasets are: ', datasets_list)\n raise\nself.dataset = datasets_list.index(dataset)\nself.batch = minibatch * num_workers\nself.num_workers = num_workers\nself.num_ps = size - num_workers\nself.rank = rank", "homedir = str(pathlib.Path.home())\nif dataset...
<|body_start_0|> if dataset not in datasets_list: print('Existing datasets are: ', datasets_list) raise self.dataset = datasets_list.index(dataset) self.batch = minibatch * num_workers self.num_workers = num_workers self.num_ps = size - num_workers ...
Manages training and test sets
DatasetManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatasetManager: """Manages training and test sets""" def __init__(self, dataset, minibatch, num_workers, size, rank): """Constrctor of DatasetManager Object Args dataset dataset name to be used batch minibatch size to be employed by each worker num_workers number of works employed in...
stack_v2_sparse_classes_75kplus_train_002324
6,704
permissive
[ { "docstring": "Constrctor of DatasetManager Object Args dataset dataset name to be used batch minibatch size to be employed by each worker num_workers number of works employed in the setup rabk rank of the current worker", "name": "__init__", "signature": "def __init__(self, dataset, minibatch, num_wor...
4
stack_v2_sparse_classes_30k_train_006331
Implement the Python class `DatasetManager` described below. Class description: Manages training and test sets Method signatures and docstrings: - def __init__(self, dataset, minibatch, num_workers, size, rank): Constrctor of DatasetManager Object Args dataset dataset name to be used batch minibatch size to be employ...
Implement the Python class `DatasetManager` described below. Class description: Manages training and test sets Method signatures and docstrings: - def __init__(self, dataset, minibatch, num_workers, size, rank): Constrctor of DatasetManager Object Args dataset dataset name to be used batch minibatch size to be employ...
f784cfd4cc2f34879abb287ef32c586243ee5b0c
<|skeleton|> class DatasetManager: """Manages training and test sets""" def __init__(self, dataset, minibatch, num_workers, size, rank): """Constrctor of DatasetManager Object Args dataset dataset name to be used batch minibatch size to be employed by each worker num_workers number of works employed in...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DatasetManager: """Manages training and test sets""" def __init__(self, dataset, minibatch, num_workers, size, rank): """Constrctor of DatasetManager Object Args dataset dataset name to be used batch minibatch size to be employed by each worker num_workers number of works employed in the setup ra...
the_stack_v2_python_sparse
pytorch_impl/applications/Garfield_CC/datasets.py
yanlili1995/Garfield
train
0
8937ac05dd262b6f6ae235f2d4436c1aa90585fa
[ "self.rule_name = rule_name\nself.rule_index = rule_index\nself.rules = rules", "matched_resources = []\napplies_to_user = True\nfor resource in self.rules['ancestor_resources']:\n if resource in ancestry:\n matched_resources.append(resource)\nif 'users' in list(self.rules.keys()):\n if user_email no...
<|body_start_0|> self.rule_name = rule_name self.rule_index = rule_index self.rules = rules <|end_body_0|> <|body_start_1|> matched_resources = [] applies_to_user = True for resource in self.rules['ancestor_resources']: if resource in ancestry: ...
Rule properties from the rule definition file. Also finds violations.
Rule
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Rule: """Rule properties from the rule definition file. Also finds violations.""" def __init__(self, rule_name, rule_index, rules): """Initialize. Args: rule_name (str): Name of the loaded rule rule_index (int): The index of the rule from the rule definitions rules (dict): The ancest...
stack_v2_sparse_classes_75kplus_train_002325
11,445
permissive
[ { "docstring": "Initialize. Args: rule_name (str): Name of the loaded rule rule_index (int): The index of the rule from the rule definitions rules (dict): The ancestor from the rule from the file", "name": "__init__", "signature": "def __init__(self, rule_name, rule_index, rules)" }, { "docstrin...
2
null
Implement the Python class `Rule` described below. Class description: Rule properties from the rule definition file. Also finds violations. Method signatures and docstrings: - def __init__(self, rule_name, rule_index, rules): Initialize. Args: rule_name (str): Name of the loaded rule rule_index (int): The index of th...
Implement the Python class `Rule` described below. Class description: Rule properties from the rule definition file. Also finds violations. Method signatures and docstrings: - def __init__(self, rule_name, rule_index, rules): Initialize. Args: rule_name (str): Name of the loaded rule rule_index (int): The index of th...
d4421afa50a17ed47cbebe942044ebab3720e0f5
<|skeleton|> class Rule: """Rule properties from the rule definition file. Also finds violations.""" def __init__(self, rule_name, rule_index, rules): """Initialize. Args: rule_name (str): Name of the loaded rule rule_index (int): The index of the rule from the rule definitions rules (dict): The ancest...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Rule: """Rule properties from the rule definition file. Also finds violations.""" def __init__(self, rule_name, rule_index, rules): """Initialize. Args: rule_name (str): Name of the loaded rule rule_index (int): The index of the rule from the rule definitions rules (dict): The ancestor from the r...
the_stack_v2_python_sparse
google/cloud/forseti/scanner/audit/external_project_access_rules_engine.py
kevensen/forseti-security
train
1
4f4f530cda1eff18842990d24468d879711a7aa1
[ "self.input_type = input_type\nif input_type == 'file':\n self.cap = cv2.VideoCapture(file_path)\nelse:\n self.cap = cv2.VideoCapture(0)\n ret, frame = self.cap.read()\ncascPath = configuration.MODEL_PATH + 'haarcascade_frontalface_alt.xml'\nself.faceCascade = cv2.CascadeClassifier(cascPath)\nself.file_nam...
<|body_start_0|> self.input_type = input_type if input_type == 'file': self.cap = cv2.VideoCapture(file_path) else: self.cap = cv2.VideoCapture(0) ret, frame = self.cap.read() cascPath = configuration.MODEL_PATH + 'haarcascade_frontalface_alt.xml' ...
This class is used to return the face data in real time. Attribute: cap: the capture stream faceCascade: model for detecting where the face is. file_name: the file name of the current frame in hard disk delete_queue: the queue is used to save all the delete file name faces: the faces for predicting the emotion, we used...
FaceReader
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FaceReader: """This class is used to return the face data in real time. Attribute: cap: the capture stream faceCascade: model for detecting where the face is. file_name: the file name of the current frame in hard disk delete_queue: the queue is used to save all the delete file name faces: the fac...
stack_v2_sparse_classes_75kplus_train_002326
16,328
permissive
[ { "docstring": "Arguments: input_type: 'file' indicates that the stream is from file. In other case, the stream will from the defalt camera.", "name": "__init__", "signature": "def __init__(self, input_type, file_path=None)" }, { "docstring": "delete files for releasing the resourse.", "name...
5
stack_v2_sparse_classes_30k_train_020294
Implement the Python class `FaceReader` described below. Class description: This class is used to return the face data in real time. Attribute: cap: the capture stream faceCascade: model for detecting where the face is. file_name: the file name of the current frame in hard disk delete_queue: the queue is used to save ...
Implement the Python class `FaceReader` described below. Class description: This class is used to return the face data in real time. Attribute: cap: the capture stream faceCascade: model for detecting where the face is. file_name: the file name of the current frame in hard disk delete_queue: the queue is used to save ...
531f646dcb493dce2575af3b9d77403ebc1f4a35
<|skeleton|> class FaceReader: """This class is used to return the face data in real time. Attribute: cap: the capture stream faceCascade: model for detecting where the face is. file_name: the file name of the current frame in hard disk delete_queue: the queue is used to save all the delete file name faces: the fac...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FaceReader: """This class is used to return the face data in real time. Attribute: cap: the capture stream faceCascade: model for detecting where the face is. file_name: the file name of the current frame in hard disk delete_queue: the queue is used to save all the delete file name faces: the faces for predic...
the_stack_v2_python_sparse
MindLink-Eumpy/real_time_detection/GUI/MLE_tool/tool.py
wozu-dichter/MindLink-Explorer
train
0
d427e69955aec828ab2d5af1b70d9199edcb1b64
[ "if self.image_gravatar:\n return conference.gravatar.gravatar(self.profile.user.email)\nelif self.image_url:\n return self.image_url\nelif self.profile.image:\n return self.profile.image.url\nreturn settings.STATIC_URL + settings.P3_ANONYMOUS_AVATAR", "if self.profile.visibility != 'x':\n url = self....
<|body_start_0|> if self.image_gravatar: return conference.gravatar.gravatar(self.profile.user.email) elif self.image_url: return self.image_url elif self.profile.image: return self.profile.image.url return settings.STATIC_URL + settings.P3_ANONYMOUS_A...
P3Profile
[ "BSD-3-Clause", "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class P3Profile: def profile_image_url(self): """Return the url of the image that the user has associated with his profile.""" <|body_0|> def public_profile_image_url(self): """Like `profile_image_url` but takes into account the visibility rules of the profile.""" ...
stack_v2_sparse_classes_75kplus_train_002327
5,965
permissive
[ { "docstring": "Return the url of the image that the user has associated with his profile.", "name": "profile_image_url", "signature": "def profile_image_url(self)" }, { "docstring": "Like `profile_image_url` but takes into account the visibility rules of the profile.", "name": "public_profi...
2
stack_v2_sparse_classes_30k_train_052503
Implement the Python class `P3Profile` described below. Class description: Implement the P3Profile class. Method signatures and docstrings: - def profile_image_url(self): Return the url of the image that the user has associated with his profile. - def public_profile_image_url(self): Like `profile_image_url` but takes...
Implement the Python class `P3Profile` described below. Class description: Implement the P3Profile class. Method signatures and docstrings: - def profile_image_url(self): Return the url of the image that the user has associated with his profile. - def public_profile_image_url(self): Like `profile_image_url` but takes...
341c22649ff4ec858fc710821303cf3b78aa59e6
<|skeleton|> class P3Profile: def profile_image_url(self): """Return the url of the image that the user has associated with his profile.""" <|body_0|> def public_profile_image_url(self): """Like `profile_image_url` but takes into account the visibility rules of the profile.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class P3Profile: def profile_image_url(self): """Return the url of the image that the user has associated with his profile.""" if self.image_gravatar: return conference.gravatar.gravatar(self.profile.user.email) elif self.image_url: return self.image_url elif ...
the_stack_v2_python_sparse
p3/models.py
EuroPython/epcon
train
40
3aa7615a81264d3449620b439a546b5722c01974
[ "self.city = city\nself.country = country\nself.department = department\nself.designation = designation\nself.graph_uuid = graph_uuid\nself.is_mailbox_enabled = is_mailbox_enabled\nself.is_one_drive_enabled = is_one_drive_enabled\nself.mailbox_size = mailbox_size\nself.mailbox_type = mailbox_type\nself.one_drive_id...
<|body_start_0|> self.city = city self.country = country self.department = department self.designation = designation self.graph_uuid = graph_uuid self.is_mailbox_enabled = is_mailbox_enabled self.is_one_drive_enabled = is_one_drive_enabled self.mailbox_siz...
Implementation of the 'Office365UserInfo' model. Specifies information about an Office365 user. Attributes: city (string): Specifies the city in which the Office365 user is located. country (string): Specifies the country/region in which the Office365 user is located. department (string): Specifies the department withi...
Office365UserInfo
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Office365UserInfo: """Implementation of the 'Office365UserInfo' model. Specifies information about an Office365 user. Attributes: city (string): Specifies the city in which the Office365 user is located. country (string): Specifies the country/region in which the Office365 user is located. depart...
stack_v2_sparse_classes_75kplus_train_002328
4,615
permissive
[ { "docstring": "Constructor for the Office365UserInfo class", "name": "__init__", "signature": "def __init__(self, city=None, country=None, department=None, designation=None, graph_uuid=None, is_mailbox_enabled=None, is_one_drive_enabled=None, mailbox_size=None, mailbox_type=None, one_drive_id=None, one...
2
stack_v2_sparse_classes_30k_train_025157
Implement the Python class `Office365UserInfo` described below. Class description: Implementation of the 'Office365UserInfo' model. Specifies information about an Office365 user. Attributes: city (string): Specifies the city in which the Office365 user is located. country (string): Specifies the country/region in whic...
Implement the Python class `Office365UserInfo` described below. Class description: Implementation of the 'Office365UserInfo' model. Specifies information about an Office365 user. Attributes: city (string): Specifies the city in which the Office365 user is located. country (string): Specifies the country/region in whic...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class Office365UserInfo: """Implementation of the 'Office365UserInfo' model. Specifies information about an Office365 user. Attributes: city (string): Specifies the city in which the Office365 user is located. country (string): Specifies the country/region in which the Office365 user is located. depart...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Office365UserInfo: """Implementation of the 'Office365UserInfo' model. Specifies information about an Office365 user. Attributes: city (string): Specifies the city in which the Office365 user is located. country (string): Specifies the country/region in which the Office365 user is located. department (string)...
the_stack_v2_python_sparse
cohesity_management_sdk/models/office_365_user_info.py
cohesity/management-sdk-python
train
24
9617fb23732c8e85ee2a34c0cab93060000b1f16
[ "self.user_email = user_email\nself.msg = EmailMessage()\nself.user_id = user_id\nself.e_mail = 'mudcakegame@gmail.com'", "with smtplib.SMTP_SSL('smtp.gmail.com', 465, context=ssl.create_default_context()) as server:\n server.login(self.e_mail, bytes(b'$9PLnJ5NsB#!').decode('utf8', 'strict'))\n server.send_...
<|body_start_0|> self.user_email = user_email self.msg = EmailMessage() self.user_id = user_id self.e_mail = 'mudcakegame@gmail.com' <|end_body_0|> <|body_start_1|> with smtplib.SMTP_SSL('smtp.gmail.com', 465, context=ssl.create_default_context()) as server: server.l...
Basic class for interaction to User via email
EmailSender
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmailSender: """Basic class for interaction to User via email""" def __init__(self, user_email, user_id: str): """Constructor for email Sender to initiate needed parameters :param user_email: email of the recipient - String :param token: Token to verify User after email confirmation ...
stack_v2_sparse_classes_75kplus_train_002329
4,834
permissive
[ { "docstring": "Constructor for email Sender to initiate needed parameters :param user_email: email of the recipient - String :param token: Token to verify User after email confirmation - String", "name": "__init__", "signature": "def __init__(self, user_email, user_id: str)" }, { "docstring": "...
3
stack_v2_sparse_classes_30k_train_026758
Implement the Python class `EmailSender` described below. Class description: Basic class for interaction to User via email Method signatures and docstrings: - def __init__(self, user_email, user_id: str): Constructor for email Sender to initiate needed parameters :param user_email: email of the recipient - String :pa...
Implement the Python class `EmailSender` described below. Class description: Basic class for interaction to User via email Method signatures and docstrings: - def __init__(self, user_email, user_id: str): Constructor for email Sender to initiate needed parameters :param user_email: email of the recipient - String :pa...
70144e1436a86c476302754c0233a4e4c8180457
<|skeleton|> class EmailSender: """Basic class for interaction to User via email""" def __init__(self, user_email, user_id: str): """Constructor for email Sender to initiate needed parameters :param user_email: email of the recipient - String :param token: Token to verify User after email confirmation ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EmailSender: """Basic class for interaction to User via email""" def __init__(self, user_email, user_id: str): """Constructor for email Sender to initiate needed parameters :param user_email: email of the recipient - String :param token: Token to verify User after email confirmation - String""" ...
the_stack_v2_python_sparse
Backend/EmailServices/EmailSender.py
LukasKlein00/SWEProjekt2021
train
6
22801a789db6c543f97a0eba0d17f7cc8f0a6a3d
[ "self._release_name = release_name\nprefix_lambda = lambda x: os.path.join(self.RULES_DIR, x) if not self.RULES_DIR in x else x\nself._rules = list(map(prefix_lambda, rules))", "try:\n packages = PackagerUtil.make_packages(self._rules)\nexcept PackagerUtilError:\n raise Error('one or more of the packages co...
<|body_start_0|> self._release_name = release_name prefix_lambda = lambda x: os.path.join(self.RULES_DIR, x) if not self.RULES_DIR in x else x self._rules = list(map(prefix_lambda, rules)) <|end_body_0|> <|body_start_1|> try: packages = PackagerUtil.make_packages(self._rules...
UpdatePackages
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdatePackages: def __init__(self, release_name, rules): """Args: release_name (string) - string name of release in the releases.yaml rules (list) - the list of rules to build OR if the RULES_DIR directory is not specified as part of the path. prefix the path e.g. for client, the package...
stack_v2_sparse_classes_75kplus_train_002330
4,028
permissive
[ { "docstring": "Args: release_name (string) - string name of release in the releases.yaml rules (list) - the list of rules to build OR if the RULES_DIR directory is not specified as part of the path. prefix the path e.g. for client, the package becomes os.path.join(RULES_DIR, 'client')", "name": "__init__",...
2
stack_v2_sparse_classes_30k_train_008455
Implement the Python class `UpdatePackages` described below. Class description: Implement the UpdatePackages class. Method signatures and docstrings: - def __init__(self, release_name, rules): Args: release_name (string) - string name of release in the releases.yaml rules (list) - the list of rules to build OR if the...
Implement the Python class `UpdatePackages` described below. Class description: Implement the UpdatePackages class. Method signatures and docstrings: - def __init__(self, release_name, rules): Args: release_name (string) - string name of release in the releases.yaml rules (list) - the list of rules to build OR if the...
70280110ec342a6f6db1c102e96756fcc3c3c01b
<|skeleton|> class UpdatePackages: def __init__(self, release_name, rules): """Args: release_name (string) - string name of release in the releases.yaml rules (list) - the list of rules to build OR if the RULES_DIR directory is not specified as part of the path. prefix the path e.g. for client, the package...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UpdatePackages: def __init__(self, release_name, rules): """Args: release_name (string) - string name of release in the releases.yaml rules (list) - the list of rules to build OR if the RULES_DIR directory is not specified as part of the path. prefix the path e.g. for client, the package becomes os.pa...
the_stack_v2_python_sparse
pylib/mps/update_packages.py
room77/py77
train
0
03ef2d1b7ccd3387384920667193fdba7791550b
[ "i = 1\nlistUsername = ['185']\nwhile i <= 8:\n Usernamecode = str(random.choice(range(10)))\n listUsername.append(Usernamecode)\n i += 1\nlogging.info(f'手机号为:{listUsername}')\nreturn ''.join(listUsername)", "i = 1\nlist_username_i_d = ['2321']\nwhile i <= 14:\n Usernamecode = str(random.choice(range(...
<|body_start_0|> i = 1 listUsername = ['185'] while i <= 8: Usernamecode = str(random.choice(range(10))) listUsername.append(Usernamecode) i += 1 logging.info(f'手机号为:{listUsername}') return ''.join(listUsername) <|end_body_0|> <|body_start_1|>...
myMethod
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class myMethod: def randomTel(self): """:return: 封装一个随机生成电话号码的方法,默认方法首位字母为185,其余八位随机""" <|body_0|> def randomID(self): """:return:身份证号码""" <|body_1|> def bankId(self): """:return: 银行卡号 6212260200094536345""" <|body_2|> def wait_time(self, ...
stack_v2_sparse_classes_75kplus_train_002331
14,739
no_license
[ { "docstring": ":return: 封装一个随机生成电话号码的方法,默认方法首位字母为185,其余八位随机", "name": "randomTel", "signature": "def randomTel(self)" }, { "docstring": ":return:身份证号码", "name": "randomID", "signature": "def randomID(self)" }, { "docstring": ":return: 银行卡号 6212260200094536345", "name": "bank...
4
stack_v2_sparse_classes_30k_train_014550
Implement the Python class `myMethod` described below. Class description: Implement the myMethod class. Method signatures and docstrings: - def randomTel(self): :return: 封装一个随机生成电话号码的方法,默认方法首位字母为185,其余八位随机 - def randomID(self): :return:身份证号码 - def bankId(self): :return: 银行卡号 6212260200094536345 - def wait_time(self, ...
Implement the Python class `myMethod` described below. Class description: Implement the myMethod class. Method signatures and docstrings: - def randomTel(self): :return: 封装一个随机生成电话号码的方法,默认方法首位字母为185,其余八位随机 - def randomID(self): :return:身份证号码 - def bankId(self): :return: 银行卡号 6212260200094536345 - def wait_time(self, ...
93fe784a3127e76995e9ae018605efbe78238385
<|skeleton|> class myMethod: def randomTel(self): """:return: 封装一个随机生成电话号码的方法,默认方法首位字母为185,其余八位随机""" <|body_0|> def randomID(self): """:return:身份证号码""" <|body_1|> def bankId(self): """:return: 银行卡号 6212260200094536345""" <|body_2|> def wait_time(self, ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class myMethod: def randomTel(self): """:return: 封装一个随机生成电话号码的方法,默认方法首位字母为185,其余八位随机""" i = 1 listUsername = ['185'] while i <= 8: Usernamecode = str(random.choice(range(10))) listUsername.append(Usernamecode) i += 1 logging.info(f'手机号为:{li...
the_stack_v2_python_sparse
早期/熊猫.py
huangno27/learn
train
0
1787709b626fe7ffd6196332cfb472b62d3a2e97
[ "n = len(s)\nans = 0\n\ndef check(x):\n m = len(x)\n f1, f0 = (x[:m / 2].count('1'), x[:m / 2].count('0'))\n l1, l0 = (x[m / 2:].count('1'), x[m / 2:].count('0'))\n return f0 == 0 and l1 == 0 or (f1 == 0 and l0 == 0)\nfor l in xrange(2, n + 1, 2):\n for i in xrange(n - l + 1):\n if check(s[i:i...
<|body_start_0|> n = len(s) ans = 0 def check(x): m = len(x) f1, f0 = (x[:m / 2].count('1'), x[:m / 2].count('0')) l1, l0 = (x[m / 2:].count('1'), x[m / 2:].count('0')) return f0 == 0 and l1 == 0 or (f1 == 0 and l0 == 0) for l in xrange(2,...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countBinarySubstringsTLE(self, s): """:type s: str :rtype: int""" <|body_0|> def countBinarySubstrings(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(s) ans = 0 def check(...
stack_v2_sparse_classes_75kplus_train_002332
1,394
no_license
[ { "docstring": ":type s: str :rtype: int", "name": "countBinarySubstringsTLE", "signature": "def countBinarySubstringsTLE(self, s)" }, { "docstring": ":type s: str :rtype: int", "name": "countBinarySubstrings", "signature": "def countBinarySubstrings(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_008053
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countBinarySubstringsTLE(self, s): :type s: str :rtype: int - def countBinarySubstrings(self, s): :type s: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countBinarySubstringsTLE(self, s): :type s: str :rtype: int - def countBinarySubstrings(self, s): :type s: str :rtype: int <|skeleton|> class Solution: def countBinaryS...
02ebe56cd92b9f4baeee132c5077892590018650
<|skeleton|> class Solution: def countBinarySubstringsTLE(self, s): """:type s: str :rtype: int""" <|body_0|> def countBinarySubstrings(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def countBinarySubstringsTLE(self, s): """:type s: str :rtype: int""" n = len(s) ans = 0 def check(x): m = len(x) f1, f0 = (x[:m / 2].count('1'), x[:m / 2].count('0')) l1, l0 = (x[m / 2:].count('1'), x[m / 2:].count('0')) ...
the_stack_v2_python_sparse
python/leetcode.696.py
CalvinNeo/LeetCode
train
3
3392d4235b89de9132695882634e46305ac64ab3
[ "if not message:\n return (None, None)\nwords = string.split(message)\nlogin = False\nemail = ''\npassword = ''\nreply = ''\nif 'LOGIN' in [word.upper() for word in words]:\n login = True\nif len(words) == 2 and login:\n password = words[1]\nelif len(words) == 3 and login:\n email = words[1]\n passwo...
<|body_start_0|> if not message: return (None, None) words = string.split(message) login = False email = '' password = '' reply = '' if 'LOGIN' in [word.upper() for word in words]: login = True if len(words) == 2 and login: ...
Parser Authorising Framework.
AuthParse
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuthParse: """Parser Authorising Framework.""" def parse_login(message='', sender=''): """Function to call to authenticate a login request""" <|body_0|> def is_session_alive(sender=''): """Function to check alive sessions from the same sender (if any)""" ...
stack_v2_sparse_classes_75kplus_train_002333
5,635
permissive
[ { "docstring": "Function to call to authenticate a login request", "name": "parse_login", "signature": "def parse_login(message='', sender='')" }, { "docstring": "Function to check alive sessions from the same sender (if any)", "name": "is_session_alive", "signature": "def is_session_ali...
2
null
Implement the Python class `AuthParse` described below. Class description: Parser Authorising Framework. Method signatures and docstrings: - def parse_login(message='', sender=''): Function to call to authenticate a login request - def is_session_alive(sender=''): Function to check alive sessions from the same sender...
Implement the Python class `AuthParse` described below. Class description: Parser Authorising Framework. Method signatures and docstrings: - def parse_login(message='', sender=''): Function to call to authenticate a login request - def is_session_alive(sender=''): Function to check alive sessions from the same sender...
716d5e11ec0030493b582fa67d6f1c35de0af50d
<|skeleton|> class AuthParse: """Parser Authorising Framework.""" def parse_login(message='', sender=''): """Function to call to authenticate a login request""" <|body_0|> def is_session_alive(sender=''): """Function to check alive sessions from the same sender (if any)""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AuthParse: """Parser Authorising Framework.""" def parse_login(message='', sender=''): """Function to call to authenticate a login request""" if not message: return (None, None) words = string.split(message) login = False email = '' password = '...
the_stack_v2_python_sparse
modules/s3/s3parser.py
andygimma/eden
train
1
7ee6d4e52f129fa35d6ec7f568a63af4754ad2aa
[ "positive = (dividend < 0) is (divisor < 0)\ndividend, divisor = (abs(dividend), abs(divisor))\nres = 0\nc, sub = (1, divisor)\nwhile dividend >= divisor:\n '\\n for example, if we want to calc (17/2)\\n ret = 0\\n 17-2 ,ret+=1 left=15\\n 15-4 ,ret+=2 left=11\\n ...
<|body_start_0|> positive = (dividend < 0) is (divisor < 0) dividend, divisor = (abs(dividend), abs(divisor)) res = 0 c, sub = (1, divisor) while dividend >= divisor: '\n for example, if we want to calc (17/2)\n ret = 0\n 17-2 ,ret+=1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def divide(self, dividend, divisor): """:param dividend: :param divisor: :return:""" <|body_0|> def divide2(self, dividend, divisor): """效率低 :type dividend: int :type divisor: int :rtype: int""" <|body_1|> def divide3(self, dividend, divisor): ...
stack_v2_sparse_classes_75kplus_train_002334
4,179
no_license
[ { "docstring": ":param dividend: :param divisor: :return:", "name": "divide", "signature": "def divide(self, dividend, divisor)" }, { "docstring": "效率低 :type dividend: int :type divisor: int :rtype: int", "name": "divide2", "signature": "def divide2(self, dividend, divisor)" }, { ...
3
stack_v2_sparse_classes_30k_val_000545
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def divide(self, dividend, divisor): :param dividend: :param divisor: :return: - def divide2(self, dividend, divisor): 效率低 :type dividend: int :type divisor: int :rtype: int - de...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def divide(self, dividend, divisor): :param dividend: :param divisor: :return: - def divide2(self, dividend, divisor): 效率低 :type dividend: int :type divisor: int :rtype: int - de...
5d3574ccd282d0146c83c286ae28d8baaabd4910
<|skeleton|> class Solution: def divide(self, dividend, divisor): """:param dividend: :param divisor: :return:""" <|body_0|> def divide2(self, dividend, divisor): """效率低 :type dividend: int :type divisor: int :rtype: int""" <|body_1|> def divide3(self, dividend, divisor): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def divide(self, dividend, divisor): """:param dividend: :param divisor: :return:""" positive = (dividend < 0) is (divisor < 0) dividend, divisor = (abs(dividend), abs(divisor)) res = 0 c, sub = (1, divisor) while dividend >= divisor: '\n ...
the_stack_v2_python_sparse
29_两数相除.py
lovehhf/LeetCode
train
0
3f2182fed3b446fed3e3b342c1f22ddb93e5d681
[ "self._dbName = os.environ['MOPS_DBINSTANCE']\nself._instance = mopsInstance = Instance(self._dbName)\nself._conn = self._instance.get_dbh()\nself._cursor = self._conn.cursor()\nsql = 'select f.field_id, f.epoch_mjd, f.ra_deg, f.dec_deg, ' + 'f.survey_mode, f.time_start, f.time_stop, f.filter_id, ' + 'f.limiting_ma...
<|body_start_0|> self._dbName = os.environ['MOPS_DBINSTANCE'] self._instance = mopsInstance = Instance(self._dbName) self._conn = self._instance.get_dbh() self._cursor = self._conn.cursor() sql = 'select f.field_id, f.epoch_mjd, f.ra_deg, f.dec_deg, ' + 'f.survey_mode, f.time_sta...
FieldTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FieldTest: def setUp(self): """Just create a Field instance from data in the DB. We will use that instance in our tests. We choose a field with tracklets associated to it.""" <|body_0|> def testInsert(self): """Test the insertion of a dummy Field instance in the DB."...
stack_v2_sparse_classes_75kplus_train_002335
17,613
no_license
[ { "docstring": "Just create a Field instance from data in the DB. We will use that instance in our tests. We choose a field with tracklets associated to it.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test the insertion of a dummy Field instance in the DB.", "name": ...
3
stack_v2_sparse_classes_30k_train_045493
Implement the Python class `FieldTest` described below. Class description: Implement the FieldTest class. Method signatures and docstrings: - def setUp(self): Just create a Field instance from data in the DB. We will use that instance in our tests. We choose a field with tracklets associated to it. - def testInsert(s...
Implement the Python class `FieldTest` described below. Class description: Implement the FieldTest class. Method signatures and docstrings: - def setUp(self): Just create a Field instance from data in the DB. We will use that instance in our tests. We choose a field with tracklets associated to it. - def testInsert(s...
06858b7e935243da7a3f55b3e5097d6440e0c1c2
<|skeleton|> class FieldTest: def setUp(self): """Just create a Field instance from data in the DB. We will use that instance in our tests. We choose a field with tracklets associated to it.""" <|body_0|> def testInsert(self): """Test the insertion of a dummy Field instance in the DB."...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FieldTest: def setUp(self): """Just create a Field instance from data in the DB. We will use that instance in our tests. We choose a field with tracklets associated to it.""" self._dbName = os.environ['MOPS_DBINSTANCE'] self._instance = mopsInstance = Instance(self._dbName) sel...
the_stack_v2_python_sparse
python/MOPS/test.py
ldenneau/mopsng
train
0
dc8b17d6eddc0cf03a64c017651eba809f1e1bda
[ "json_dict = json.loads(request.body.decode())\nreceiver = json_dict.get('receiver')\nprovince_id = json_dict.get('province_id')\ncity_id = json_dict.get('city_id')\ndistrict_id = json_dict.get('district_id')\nplace = json_dict.get('place')\nmobile = json_dict.get('mobile')\ntel = json_dict.get('tel')\nemail = json...
<|body_start_0|> json_dict = json.loads(request.body.decode()) receiver = json_dict.get('receiver') province_id = json_dict.get('province_id') city_id = json_dict.get('city_id') district_id = json_dict.get('district_id') place = json_dict.get('place') mobile = jso...
修改和删除地址
UpdateDestroyAddressView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateDestroyAddressView: """修改和删除地址""" def put(self, request, address_id): """修改地址 :param request: :param address_id: :return:""" <|body_0|> def delete(self, request, address_id): """删除地址 :param request: :param address_id: :return:""" <|body_1|> <|end_s...
stack_v2_sparse_classes_75kplus_train_002336
23,231
permissive
[ { "docstring": "修改地址 :param request: :param address_id: :return:", "name": "put", "signature": "def put(self, request, address_id)" }, { "docstring": "删除地址 :param request: :param address_id: :return:", "name": "delete", "signature": "def delete(self, request, address_id)" } ]
2
stack_v2_sparse_classes_30k_train_040228
Implement the Python class `UpdateDestroyAddressView` described below. Class description: 修改和删除地址 Method signatures and docstrings: - def put(self, request, address_id): 修改地址 :param request: :param address_id: :return: - def delete(self, request, address_id): 删除地址 :param request: :param address_id: :return:
Implement the Python class `UpdateDestroyAddressView` described below. Class description: 修改和删除地址 Method signatures and docstrings: - def put(self, request, address_id): 修改地址 :param request: :param address_id: :return: - def delete(self, request, address_id): 删除地址 :param request: :param address_id: :return: <|skelet...
fecdf074ddb6844f33d6fadf05d40b0e562b46fb
<|skeleton|> class UpdateDestroyAddressView: """修改和删除地址""" def put(self, request, address_id): """修改地址 :param request: :param address_id: :return:""" <|body_0|> def delete(self, request, address_id): """删除地址 :param request: :param address_id: :return:""" <|body_1|> <|end_s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UpdateDestroyAddressView: """修改和删除地址""" def put(self, request, address_id): """修改地址 :param request: :param address_id: :return:""" json_dict = json.loads(request.body.decode()) receiver = json_dict.get('receiver') province_id = json_dict.get('province_id') city_id ...
the_stack_v2_python_sparse
meiduo_mall/meiduo_mall/apps/users/views.py
qls7/dianshang
train
0
2aac94f99ef8c358b455b54d7fecea0063bc9394
[ "self._ps, self._vs = riemann_solve(left, right, g)\nself._left_prof = HydroProf(self._ps, left.Density, left.Pressure, g)\nself._right_prof = HydroProf(self._ps, right.Density, right.Pressure, g)\nself._left = left\nself._right = right\nreturn", "if v > self._vs:\n res = self._right_prof.CalcPrim(v - self._ri...
<|body_start_0|> self._ps, self._vs = riemann_solve(left, right, g) self._left_prof = HydroProf(self._ps, left.Density, left.Pressure, g) self._right_prof = HydroProf(self._ps, right.Density, right.Pressure, g) self._left = left self._right = right return <|end_body_0|> ...
Complete Riemann problem profile
RiemannProfile
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RiemannProfile: """Complete Riemann problem profile""" def __init__(self, left, right, g): """Class constructor Input: left - Primitive variables on the left side right - Primitive variables on the right side g - Adiabatic index""" <|body_0|> def CalcPrim(self, v): ...
stack_v2_sparse_classes_75kplus_train_002337
11,309
no_license
[ { "docstring": "Class constructor Input: left - Primitive variables on the left side right - Primitive variables on the right side g - Adiabatic index", "name": "__init__", "signature": "def __init__(self, left, right, g)" }, { "docstring": "Calculates the primitive variables Input: v - Self sim...
2
stack_v2_sparse_classes_30k_train_008477
Implement the Python class `RiemannProfile` described below. Class description: Complete Riemann problem profile Method signatures and docstrings: - def __init__(self, left, right, g): Class constructor Input: left - Primitive variables on the left side right - Primitive variables on the right side g - Adiabatic inde...
Implement the Python class `RiemannProfile` described below. Class description: Complete Riemann problem profile Method signatures and docstrings: - def __init__(self, left, right, g): Class constructor Input: left - Primitive variables on the left side right - Primitive variables on the right side g - Adiabatic inde...
58ec1a7e71b00ddb387160b39196d8dd9e40bd3f
<|skeleton|> class RiemannProfile: """Complete Riemann problem profile""" def __init__(self, left, right, g): """Class constructor Input: left - Primitive variables on the left side right - Primitive variables on the right side g - Adiabatic index""" <|body_0|> def CalcPrim(self, v): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RiemannProfile: """Complete Riemann problem profile""" def __init__(self, left, right, g): """Class constructor Input: left - Primitive variables on the left side right - Primitive variables on the right side g - Adiabatic index""" self._ps, self._vs = riemann_solve(left, right, g) ...
the_stack_v2_python_sparse
analytic/enrs.py
bolverk/huji-rich
train
16
1d096fc1947750f202922a38cfafd9a0f2499b02
[ "def ser_helper(root):\n if not root:\n return ['#']\n ll = [str(root.val)]\n ll += ser_helper(root.left)\n ll += ser_helper(root.right)\n return ll\nreturn ','.join(ser_helper(root))", "def des_helper(ll, i):\n if i >= len(ll):\n raise Exception('Parsing error')\n elif ll[i] ==...
<|body_start_0|> def ser_helper(root): if not root: return ['#'] ll = [str(root.val)] ll += ser_helper(root.left) ll += ser_helper(root.right) return ll return ','.join(ser_helper(root)) <|end_body_0|> <|body_start_1|> ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_75kplus_train_002338
1,459
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_009416
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
2722c0deafcd094ce64140a9a837b4027d29ed6f
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def ser_helper(root): if not root: return ['#'] ll = [str(root.val)] ll += ser_helper(root.left) ll += ser_helper(root.rig...
the_stack_v2_python_sparse
297_serdes_bst_h/main.py
chao-shi/lclc
train
0
a2b77b9334175e596d10fe8f857b9a014b21bfb6
[ "build = self.context['build']\nif stock_item and stock_item.build != build:\n raise ValidationError(_('Build output must point to the same build'))\nreturn stock_item", "build = self.context['build']\ndata = self.validated_data\nbuild.deallocate_stock(build_line=data['build_line'], output=data['output'])" ]
<|body_start_0|> build = self.context['build'] if stock_item and stock_item.build != build: raise ValidationError(_('Build output must point to the same build')) return stock_item <|end_body_0|> <|body_start_1|> build = self.context['build'] data = self.validated_dat...
DRF serializer for unallocating stock from a BuildOrder. Allocated stock can be unallocated with a number of filters: - output: Filter against a particular build output (blank = untracked stock) - bom_item: Filter against a particular BOM line item
BuildUnallocationSerializer
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BuildUnallocationSerializer: """DRF serializer for unallocating stock from a BuildOrder. Allocated stock can be unallocated with a number of filters: - output: Filter against a particular build output (blank = untracked stock) - bom_item: Filter against a particular BOM line item""" def vali...
stack_v2_sparse_classes_75kplus_train_002339
38,426
permissive
[ { "docstring": "Validation for the output StockItem instance. Stock item must point to the same build order!", "name": "validate_output", "signature": "def validate_output(self, stock_item)" }, { "docstring": "Save the serializer data. This performs the actual unallocation against the build orde...
2
null
Implement the Python class `BuildUnallocationSerializer` described below. Class description: DRF serializer for unallocating stock from a BuildOrder. Allocated stock can be unallocated with a number of filters: - output: Filter against a particular build output (blank = untracked stock) - bom_item: Filter against a pa...
Implement the Python class `BuildUnallocationSerializer` described below. Class description: DRF serializer for unallocating stock from a BuildOrder. Allocated stock can be unallocated with a number of filters: - output: Filter against a particular build output (blank = untracked stock) - bom_item: Filter against a pa...
e88a8e99a5f0b201c67a95cba097c729f090d5e2
<|skeleton|> class BuildUnallocationSerializer: """DRF serializer for unallocating stock from a BuildOrder. Allocated stock can be unallocated with a number of filters: - output: Filter against a particular build output (blank = untracked stock) - bom_item: Filter against a particular BOM line item""" def vali...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BuildUnallocationSerializer: """DRF serializer for unallocating stock from a BuildOrder. Allocated stock can be unallocated with a number of filters: - output: Filter against a particular build output (blank = untracked stock) - bom_item: Filter against a particular BOM line item""" def validate_output(s...
the_stack_v2_python_sparse
InvenTree/build/serializers.py
inventree/InvenTree
train
3,077
50aa354241c37a4f3e6e9094526820aa722c8a60
[ "self._pi = pi\nself.gpioA = gpioA\nself.gpioB = gpioB\nself.callback = callback\nself.levA = 0\nself.levB = 0\nself.lastGpio = None\nself._pi.set_mode(gpioA, pigpio.INPUT)\nself._pi.set_mode(gpioB, pigpio.INPUT)\nself._pi.set_pull_up_down(gpioA, pigpio.PUD_UP)\nself._pi.set_pull_up_down(gpioB, pigpio.PUD_UP)\nself...
<|body_start_0|> self._pi = pi self.gpioA = gpioA self.gpioB = gpioB self.callback = callback self.levA = 0 self.levB = 0 self.lastGpio = None self._pi.set_mode(gpioA, pigpio.INPUT) self._pi.set_mode(gpioB, pigpio.INPUT) self._pi.set_pull_u...
Class to decode mechanical rotary encoder pulses.
Decoder
[ "LicenseRef-scancode-warranty-disclaimer", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Decoder: """Class to decode mechanical rotary encoder pulses.""" def __init__(self, pi, gpioA, gpioB, callback): """Instantiate the class with the pi and gpios connected to rotary encoder contacts A and B. The common contact should be connected to ground. The callback is called when ...
stack_v2_sparse_classes_75kplus_train_002340
4,215
permissive
[ { "docstring": "Instantiate the class with the pi and gpios connected to rotary encoder contacts A and B. The common contact should be connected to ground. The callback is called when the rotary encoder is turned. It takes one parameter which is +1 for clockwise and -1 for counterclockwise. EXAMPLE import time ...
3
stack_v2_sparse_classes_30k_train_014337
Implement the Python class `Decoder` described below. Class description: Class to decode mechanical rotary encoder pulses. Method signatures and docstrings: - def __init__(self, pi, gpioA, gpioB, callback): Instantiate the class with the pi and gpios connected to rotary encoder contacts A and B. The common contact sh...
Implement the Python class `Decoder` described below. Class description: Class to decode mechanical rotary encoder pulses. Method signatures and docstrings: - def __init__(self, pi, gpioA, gpioB, callback): Instantiate the class with the pi and gpios connected to rotary encoder contacts A and B. The common contact sh...
5dc6e23a280e1283de7b38f35116332a79ca33d2
<|skeleton|> class Decoder: """Class to decode mechanical rotary encoder pulses.""" def __init__(self, pi, gpioA, gpioB, callback): """Instantiate the class with the pi and gpios connected to rotary encoder contacts A and B. The common contact should be connected to ground. The callback is called when ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Decoder: """Class to decode mechanical rotary encoder pulses.""" def __init__(self, pi, gpioA, gpioB, callback): """Instantiate the class with the pi and gpios connected to rotary encoder contacts A and B. The common contact should be connected to ground. The callback is called when the rotary en...
the_stack_v2_python_sparse
lib/rotary_encoder.py
bopopescu/ros
train
0
5de6bd2a4c10705121b1334a795e857450d708bb
[ "self.type = self.__class__.__name__\nself.name = name\nself.hardwareComm = hardwareComm\nself.modelLock = modelLock", "self.modelLock.Acquire()\npReturn1 = pGetFunction(False)\nself.modelLock.Release()\nreturn pReturn1", "self.modelLock.Acquire()\npReturn1, pReturn2 = pGetFunction(False)\nself.modelLock.Releas...
<|body_start_0|> self.type = self.__class__.__name__ self.name = name self.hardwareComm = hardwareComm self.modelLock = modelLock <|end_body_0|> <|body_start_1|> self.modelLock.Acquire() pReturn1 = pGetFunction(False) self.modelLock.Release() return pRetu...
ComponentModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ComponentModel: def __init__(self, name, hardwareComm, modelLock): """ComponentModel base class constructor""" <|body_0|> def protectedReturn1(self, pGetFunction): """Returns the value of the variable as protected by the model lock""" <|body_1|> def prot...
stack_v2_sparse_classes_75kplus_train_002341
1,492
no_license
[ { "docstring": "ComponentModel base class constructor", "name": "__init__", "signature": "def __init__(self, name, hardwareComm, modelLock)" }, { "docstring": "Returns the value of the variable as protected by the model lock", "name": "protectedReturn1", "signature": "def protectedReturn...
5
stack_v2_sparse_classes_30k_train_023386
Implement the Python class `ComponentModel` described below. Class description: Implement the ComponentModel class. Method signatures and docstrings: - def __init__(self, name, hardwareComm, modelLock): ComponentModel base class constructor - def protectedReturn1(self, pGetFunction): Returns the value of the variable...
Implement the Python class `ComponentModel` described below. Class description: Implement the ComponentModel class. Method signatures and docstrings: - def __init__(self, name, hardwareComm, modelLock): ComponentModel base class constructor - def protectedReturn1(self, pGetFunction): Returns the value of the variable...
c6954ca0fff935ce1eb8154744f6307743765dc5
<|skeleton|> class ComponentModel: def __init__(self, name, hardwareComm, modelLock): """ComponentModel base class constructor""" <|body_0|> def protectedReturn1(self, pGetFunction): """Returns the value of the variable as protected by the model lock""" <|body_1|> def prot...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ComponentModel: def __init__(self, name, hardwareComm, modelLock): """ComponentModel base class constructor""" self.type = self.__class__.__name__ self.name = name self.hardwareComm = hardwareComm self.modelLock = modelLock def protectedReturn1(self, pGetFunction):...
the_stack_v2_python_sparse
server/core/ComponentModel.py
henryeherman/elixys
train
1
600bba583a2e5abeddbbe7e794de01e6180ec40d
[ "self._table = [[] for x in range(size)]\nif not func:\n func = naive\nself._hash = func", "hash_val = self._hash(key) % len(self._table)\nfor item in self._table[hash_val]:\n if item[0] == key:\n return item[1]", "hash_val = self._hash(key) % len(self._table)\nfor item in self._table[hash_val]:\n ...
<|body_start_0|> self._table = [[] for x in range(size)] if not func: func = naive self._hash = func <|end_body_0|> <|body_start_1|> hash_val = self._hash(key) % len(self._table) for item in self._table[hash_val]: if item[0] == key: return...
Hash class for data structure.
HashTable
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HashTable: """Hash class for data structure.""" def __init__(self, size=17, func=None): """Initialize the hash.""" <|body_0|> def get(self, key): """Return the value stored at hash of given key.""" <|body_1|> def set(self, key, val): """Store...
stack_v2_sparse_classes_75kplus_train_002342
1,185
permissive
[ { "docstring": "Initialize the hash.", "name": "__init__", "signature": "def __init__(self, size=17, func=None)" }, { "docstring": "Return the value stored at hash of given key.", "name": "get", "signature": "def get(self, key)" }, { "docstring": "Store value based on given key."...
3
stack_v2_sparse_classes_30k_train_010035
Implement the Python class `HashTable` described below. Class description: Hash class for data structure. Method signatures and docstrings: - def __init__(self, size=17, func=None): Initialize the hash. - def get(self, key): Return the value stored at hash of given key. - def set(self, key, val): Store value based on...
Implement the Python class `HashTable` described below. Class description: Hash class for data structure. Method signatures and docstrings: - def __init__(self, size=17, func=None): Initialize the hash. - def get(self, key): Return the value stored at hash of given key. - def set(self, key, val): Store value based on...
b9b07656a2ca6fa8cda7d44be9112bb7c2782fb0
<|skeleton|> class HashTable: """Hash class for data structure.""" def __init__(self, size=17, func=None): """Initialize the hash.""" <|body_0|> def get(self, key): """Return the value stored at hash of given key.""" <|body_1|> def set(self, key, val): """Store...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HashTable: """Hash class for data structure.""" def __init__(self, size=17, func=None): """Initialize the hash.""" self._table = [[] for x in range(size)] if not func: func = naive self._hash = func def get(self, key): """Return the value stored at...
the_stack_v2_python_sparse
src/hash_table.py
Casey0Kane/data-structures
train
1
b6925741ffa695a891c2c1d7db9109d4a177179f
[ "i = j = max_num = 0\nused = set()\nwhile i < len(s) and j < len(s):\n if s[j] in used:\n used.remove(s[i])\n i += 1\n else:\n used.add(s[j])\n j += 1\n max_num = max(max_num, j - i)\nreturn max_num", "used = dict()\nmax_num = start = 0\nfor i, c in enumerate(s):\n if c...
<|body_start_0|> i = j = max_num = 0 used = set() while i < len(s) and j < len(s): if s[j] in used: used.remove(s[i]) i += 1 else: used.add(s[j]) j += 1 max_num = max(max_num, j - i) r...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lengthOfLongestSubstring1(self, s: str) -> int: """滑动窗口,i,j不停滑动。 当j遇到的字符没有出现过,则记录当前字符,j继续向前移动。 当碰到出现过的字符时,从记录的set中移除s[i],i向前移动。""" <|body_0|> def lengthOfLongestSubstring(self, s: str) -> int: """滑动窗口优化:使用字典记录出现过的字符及其索引。 1. 如果字符出现过,则start从出现过的索引+1开始重新计算...
stack_v2_sparse_classes_75kplus_train_002343
2,108
no_license
[ { "docstring": "滑动窗口,i,j不停滑动。 当j遇到的字符没有出现过,则记录当前字符,j继续向前移动。 当碰到出现过的字符时,从记录的set中移除s[i],i向前移动。", "name": "lengthOfLongestSubstring1", "signature": "def lengthOfLongestSubstring1(self, s: str) -> int" }, { "docstring": "滑动窗口优化:使用字典记录出现过的字符及其索引。 1. 如果字符出现过,则start从出现过的索引+1开始重新计算。 需要增加判断start是否比出现的索引要...
2
stack_v2_sparse_classes_30k_train_023501
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLongestSubstring1(self, s: str) -> int: 滑动窗口,i,j不停滑动。 当j遇到的字符没有出现过,则记录当前字符,j继续向前移动。 当碰到出现过的字符时,从记录的set中移除s[i],i向前移动。 - def lengthOfLongestSubstring(self, s: str) -> i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLongestSubstring1(self, s: str) -> int: 滑动窗口,i,j不停滑动。 当j遇到的字符没有出现过,则记录当前字符,j继续向前移动。 当碰到出现过的字符时,从记录的set中移除s[i],i向前移动。 - def lengthOfLongestSubstring(self, s: str) -> i...
2bbb1640589aab34f2bc42489283033cc11fb885
<|skeleton|> class Solution: def lengthOfLongestSubstring1(self, s: str) -> int: """滑动窗口,i,j不停滑动。 当j遇到的字符没有出现过,则记录当前字符,j继续向前移动。 当碰到出现过的字符时,从记录的set中移除s[i],i向前移动。""" <|body_0|> def lengthOfLongestSubstring(self, s: str) -> int: """滑动窗口优化:使用字典记录出现过的字符及其索引。 1. 如果字符出现过,则start从出现过的索引+1开始重新计算...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def lengthOfLongestSubstring1(self, s: str) -> int: """滑动窗口,i,j不停滑动。 当j遇到的字符没有出现过,则记录当前字符,j继续向前移动。 当碰到出现过的字符时,从记录的set中移除s[i],i向前移动。""" i = j = max_num = 0 used = set() while i < len(s) and j < len(s): if s[j] in used: used.remove(s[i]) ...
the_stack_v2_python_sparse
003_longest-substring-without-repeating-characters.py
helloocc/algorithm
train
1
9cd1c6de0850e310866db7e527f55a15e92827db
[ "self.img_to_points = img_to_points\nself.env = env\nself.base_proposal = base_proposal\nself.POS_STD = 0.01\nself.PHI_STD = 0.1\nself.points = {}\nself.DEBUG_STOP_PROPOSING = 50", "if n in self.points:\n return self.points[n]\nself.points[n] = self.img_to_points(y)\nreturn self.points[n]", "candidate_points...
<|body_start_0|> self.img_to_points = img_to_points self.env = env self.base_proposal = base_proposal self.POS_STD = 0.01 self.PHI_STD = 0.1 self.points = {} self.DEBUG_STOP_PROPOSING = 50 <|end_body_0|> <|body_start_1|> if n in self.points: r...
Multimodal kernel -- takes in N points in latent-state-space and propose!
MultimodalData
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultimodalData: """Multimodal kernel -- takes in N points in latent-state-space and propose!""" def __init__(self, env, img_to_points, base_proposal): """img_to_points is a feature-extractor that takes in a image and returns a list of candidate points. Sometimes it might return zero,...
stack_v2_sparse_classes_75kplus_train_002344
11,517
no_license
[ { "docstring": "img_to_points is a feature-extractor that takes in a image and returns a list of candidate points. Sometimes it might return zero, in which case we go with the base proposal kernel", "name": "__init__", "signature": "def __init__(self, env, img_to_points, base_proposal)" }, { "do...
4
stack_v2_sparse_classes_30k_train_040096
Implement the Python class `MultimodalData` described below. Class description: Multimodal kernel -- takes in N points in latent-state-space and propose! Method signatures and docstrings: - def __init__(self, env, img_to_points, base_proposal): img_to_points is a feature-extractor that takes in a image and returns a ...
Implement the Python class `MultimodalData` described below. Class description: Multimodal kernel -- takes in N points in latent-state-space and propose! Method signatures and docstrings: - def __init__(self, env, img_to_points, base_proposal): img_to_points is a feature-extractor that takes in a image and returns a ...
1eae11a3251686d41b8dcb11a55e55ab8342ec78
<|skeleton|> class MultimodalData: """Multimodal kernel -- takes in N points in latent-state-space and propose!""" def __init__(self, env, img_to_points, base_proposal): """img_to_points is a feature-extractor that takes in a image and returns a list of candidate points. Sometimes it might return zero,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MultimodalData: """Multimodal kernel -- takes in N points in latent-state-space and propose!""" def __init__(self, env, img_to_points, base_proposal): """img_to_points is a feature-extractor that takes in a image and returns a list of candidate points. Sometimes it might return zero, in which cas...
the_stack_v2_python_sparse
proposals.py
fegonda/franktrack
train
0
ad43ee5d8ab6339bba4a77d26f598b85ab5c7ab5
[ "self._member_authority_resource_manager = pm.getService('omemberauthorityrm')\nself._delegate_tools = pm.getService('delegatetools')\nself._member_whitelist = self._delegate_tools.get_whitelist('MEMBER')\nself._key_whitelist = self._delegate_tools.get_whitelist('KEY')", "version = self._delegate_tools.get_versio...
<|body_start_0|> self._member_authority_resource_manager = pm.getService('omemberauthorityrm') self._delegate_tools = pm.getService('delegatetools') self._member_whitelist = self._delegate_tools.get_whitelist('MEMBER') self._key_whitelist = self._delegate_tools.get_whitelist('KEY') <|end...
Implements Member Authority methods. Does validity checking on passed options.
OMAv2Delegate
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OMAv2Delegate: """Implements Member Authority methods. Does validity checking on passed options.""" def __init__(self): """Get plugins for use in other class methods. Retrieve whitelists for use in validity checking.""" <|body_0|> def get_version(self): """Get im...
stack_v2_sparse_classes_75kplus_train_002345
4,199
permissive
[ { "docstring": "Get plugins for use in other class methods. Retrieve whitelists for use in validity checking.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Get implementation details from resource manager. Supplement these with additional details specific to the dele...
6
stack_v2_sparse_classes_30k_train_002324
Implement the Python class `OMAv2Delegate` described below. Class description: Implements Member Authority methods. Does validity checking on passed options. Method signatures and docstrings: - def __init__(self): Get plugins for use in other class methods. Retrieve whitelists for use in validity checking. - def get_...
Implement the Python class `OMAv2Delegate` described below. Class description: Implements Member Authority methods. Does validity checking on passed options. Method signatures and docstrings: - def __init__(self): Get plugins for use in other class methods. Retrieve whitelists for use in validity checking. - def get_...
695c6f72490a02bbb308d44526631dbf426ab900
<|skeleton|> class OMAv2Delegate: """Implements Member Authority methods. Does validity checking on passed options.""" def __init__(self): """Get plugins for use in other class methods. Retrieve whitelists for use in validity checking.""" <|body_0|> def get_version(self): """Get im...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OMAv2Delegate: """Implements Member Authority methods. Does validity checking on passed options.""" def __init__(self): """Get plugins for use in other class methods. Retrieve whitelists for use in validity checking.""" self._member_authority_resource_manager = pm.getService('omemberautho...
the_stack_v2_python_sparse
Ohouse/src/plugins/ofed2/omavtwodelegate.py
zanetworker/C-BAS
train
1
bac400346d1c11b90f3bcb9ed8dc7ed23563d4c5
[ "fieldsets = super(ModelAdmin, self).get_fieldsets(request, obj=obj)\nif self.autopopulate and (not request.user.is_superuser):\n for fieldset in fieldsets:\n fieldset[1]['fields'] = [f for f in fieldset[1]['fields'] if f not in self.autopopulate]\nreturn fieldsets", "if self.autopopulate and (not reque...
<|body_start_0|> fieldsets = super(ModelAdmin, self).get_fieldsets(request, obj=obj) if self.autopopulate and (not request.user.is_superuser): for fieldset in fieldsets: fieldset[1]['fields'] = [f for f in fieldset[1]['fields'] if f not in self.autopopulate] return fi...
Adds options to ModelAdmin that allow automatic filtering, restricting and field-populating for non-superusers
ModelAdmin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModelAdmin: """Adds options to ModelAdmin that allow automatic filtering, restricting and field-populating for non-superusers""" def get_fieldsets(self, request, obj=None): """Removes any autofilter fields from generated fieldsets""" <|body_0|> def get_form(self, request...
stack_v2_sparse_classes_75kplus_train_002346
14,007
no_license
[ { "docstring": "Removes any autofilter fields from generated fieldsets", "name": "get_fieldsets", "signature": "def get_fieldsets(self, request, obj=None)" }, { "docstring": "Configures model form to fill in autopopulate fields (removing those fields from the form) and restricts querysets for mu...
6
null
Implement the Python class `ModelAdmin` described below. Class description: Adds options to ModelAdmin that allow automatic filtering, restricting and field-populating for non-superusers Method signatures and docstrings: - def get_fieldsets(self, request, obj=None): Removes any autofilter fields from generated fields...
Implement the Python class `ModelAdmin` described below. Class description: Adds options to ModelAdmin that allow automatic filtering, restricting and field-populating for non-superusers Method signatures and docstrings: - def get_fieldsets(self, request, obj=None): Removes any autofilter fields from generated fields...
9f49ef6e7de9b8c3a0000fdb4b9dbd0b3ddae9a8
<|skeleton|> class ModelAdmin: """Adds options to ModelAdmin that allow automatic filtering, restricting and field-populating for non-superusers""" def get_fieldsets(self, request, obj=None): """Removes any autofilter fields from generated fieldsets""" <|body_0|> def get_form(self, request...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ModelAdmin: """Adds options to ModelAdmin that allow automatic filtering, restricting and field-populating for non-superusers""" def get_fieldsets(self, request, obj=None): """Removes any autofilter fields from generated fieldsets""" fieldsets = super(ModelAdmin, self).get_fieldsets(reque...
the_stack_v2_python_sparse
admin_extensions/main.py
map0logo/albastryde
train
0
e08e1e9a6b4947132c58e3e7ebe5539e99683b6b
[ "http = r.http\nmethod = r.method\nrepresentation = r.representation\noutput = {}\nif method == 'mdata':\n if representation == 'json':\n if http == 'GET':\n r.error(501, current.ERROR.NOT_IMPLEMENTED)\n elif http == 'POST':\n r.error(501, current.ERROR.NOT_IMPLEMENTED)\n ...
<|body_start_0|> http = r.http method = r.method representation = r.representation output = {} if method == 'mdata': if representation == 'json': if http == 'GET': r.error(501, current.ERROR.NOT_IMPLEMENTED) elif htt...
Mobile Data Handler responds to GET /prefix/name/mdata.json (Data download) POST /prefix/name/mdata.json (Data upload) GET /prefix/name/mform.json (Schema download) GET /prefix/name/xform.xml (XForms analogously, later...)
S3MobileCRUD
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class S3MobileCRUD: """Mobile Data Handler responds to GET /prefix/name/mdata.json (Data download) POST /prefix/name/mdata.json (Data upload) GET /prefix/name/mform.json (Schema download) GET /prefix/name/xform.xml (XForms analogously, later...)""" def apply_method(self, r, **attr): """Ent...
stack_v2_sparse_classes_75kplus_train_002347
11,178
permissive
[ { "docstring": "Entry point for REST interface. @param r: the S3Request instance @param attr: controller attributes", "name": "apply_method", "signature": "def apply_method(self, r, **attr)" }, { "docstring": "Get the schema definition (as JSON) @param r: the S3Request instance @param attr: cont...
2
stack_v2_sparse_classes_30k_train_034110
Implement the Python class `S3MobileCRUD` described below. Class description: Mobile Data Handler responds to GET /prefix/name/mdata.json (Data download) POST /prefix/name/mdata.json (Data upload) GET /prefix/name/mform.json (Schema download) GET /prefix/name/xform.xml (XForms analogously, later...) Method signatures...
Implement the Python class `S3MobileCRUD` described below. Class description: Mobile Data Handler responds to GET /prefix/name/mdata.json (Data download) POST /prefix/name/mdata.json (Data upload) GET /prefix/name/mform.json (Schema download) GET /prefix/name/xform.xml (XForms analogously, later...) Method signatures...
3f753a20ce2b7cedd2c55770ed333c069df50cf1
<|skeleton|> class S3MobileCRUD: """Mobile Data Handler responds to GET /prefix/name/mdata.json (Data download) POST /prefix/name/mdata.json (Data upload) GET /prefix/name/mform.json (Schema download) GET /prefix/name/xform.xml (XForms analogously, later...)""" def apply_method(self, r, **attr): """Ent...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class S3MobileCRUD: """Mobile Data Handler responds to GET /prefix/name/mdata.json (Data download) POST /prefix/name/mdata.json (Data upload) GET /prefix/name/mform.json (Schema download) GET /prefix/name/xform.xml (XForms analogously, later...)""" def apply_method(self, r, **attr): """Entry point for ...
the_stack_v2_python_sparse
modules/s3/s3mobile.py
mswdresden/eden
train
0
e3e373dca38def5b549d4340cfe676d11bd436d6
[ "self.pokemon = pokemon\nself.targets = targets\nself.environment = environment\nself.action = None\nentries = []\nfor attack in self.pokemon.getAttacks():\n entries.append(AttackMenuEntry(attack, self.setAction))\nself.menu = Menu(entries, columns=2)\nscreen.setBottomView(ActionMenuWidget(self.menu, self.getWin...
<|body_start_0|> self.pokemon = pokemon self.targets = targets self.environment = environment self.action = None entries = [] for attack in self.pokemon.getAttacks(): entries.append(AttackMenuEntry(attack, self.setAction)) self.menu = Menu(entries, col...
Controller for Attack Menu
AttackMenuController
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AttackMenuController: """Controller for Attack Menu""" def __init__(self, pokemon, targets, environment, screen): """Initialize the Attack Menu""" <|body_0|> def setAction(self, entry): """Set the Chosen Action""" <|body_1|> <|end_skeleton|> <|body_star...
stack_v2_sparse_classes_75kplus_train_002348
2,031
no_license
[ { "docstring": "Initialize the Attack Menu", "name": "__init__", "signature": "def __init__(self, pokemon, targets, environment, screen)" }, { "docstring": "Set the Chosen Action", "name": "setAction", "signature": "def setAction(self, entry)" } ]
2
stack_v2_sparse_classes_30k_train_034811
Implement the Python class `AttackMenuController` described below. Class description: Controller for Attack Menu Method signatures and docstrings: - def __init__(self, pokemon, targets, environment, screen): Initialize the Attack Menu - def setAction(self, entry): Set the Chosen Action
Implement the Python class `AttackMenuController` described below. Class description: Controller for Attack Menu Method signatures and docstrings: - def __init__(self, pokemon, targets, environment, screen): Initialize the Attack Menu - def setAction(self, entry): Set the Chosen Action <|skeleton|> class AttackMenuC...
3931eee5fd04e18bb1738a0b27a4c6979dc4db01
<|skeleton|> class AttackMenuController: """Controller for Attack Menu""" def __init__(self, pokemon, targets, environment, screen): """Initialize the Attack Menu""" <|body_0|> def setAction(self, entry): """Set the Chosen Action""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AttackMenuController: """Controller for Attack Menu""" def __init__(self, pokemon, targets, environment, screen): """Initialize the Attack Menu""" self.pokemon = pokemon self.targets = targets self.environment = environment self.action = None entries = [] ...
the_stack_v2_python_sparse
src/Screen/Pygame/Menu/ActionMenu/AttackMenu/attack_menu_controller.py
sgtnourry/Pokemon-Project
train
0
ca92d368ab50f16b736a3b6ad0ebb54ab61b9efe
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn ServiceAnnouncementAttachment()", "from .entity import Entity\nfrom .entity import Entity\nfields: Dict[str, Callable[[Any], None]] = {'content': lambda n: setattr(self, 'content', n.get_bytes_value()), 'contentType': lambda n: setattr...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return ServiceAnnouncementAttachment() <|end_body_0|> <|body_start_1|> from .entity import Entity from .entity import Entity fields: Dict[str, Callable[[Any], None]] = {'content': lambd...
ServiceAnnouncementAttachment
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ServiceAnnouncementAttachment: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ServiceAnnouncementAttachment: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator val...
stack_v2_sparse_classes_75kplus_train_002349
2,908
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: ServiceAnnouncementAttachment", "name": "create_from_discriminator_value", "signature": "def create_from_dis...
3
stack_v2_sparse_classes_30k_train_025783
Implement the Python class `ServiceAnnouncementAttachment` described below. Class description: Implement the ServiceAnnouncementAttachment class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ServiceAnnouncementAttachment: Creates a new instance of th...
Implement the Python class `ServiceAnnouncementAttachment` described below. Class description: Implement the ServiceAnnouncementAttachment class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ServiceAnnouncementAttachment: Creates a new instance of th...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class ServiceAnnouncementAttachment: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ServiceAnnouncementAttachment: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator val...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ServiceAnnouncementAttachment: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ServiceAnnouncementAttachment: """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_stack_v2_python_sparse
msgraph/generated/models/service_announcement_attachment.py
microsoftgraph/msgraph-sdk-python
train
135
d0239edfececd9fb7ec784c388cab3f90f0868ca
[ "min_level = 3\nmax_level = 7\ninput_specs = {}\nfor level in range(min_level, max_level):\n input_specs[str(level)] = tf.TensorShape([1, 128 // 2 ** level, 128 // 2 ** level, 3])\nnetwork = decoders.FPN(input_specs=input_specs, num_filters=num_filters, use_separable_conv=use_separable_conv, use_sync_bn=True)\nm...
<|body_start_0|> min_level = 3 max_level = 7 input_specs = {} for level in range(min_level, max_level): input_specs[str(level)] = tf.TensorShape([1, 128 // 2 ** level, 128 // 2 ** level, 3]) network = decoders.FPN(input_specs=input_specs, num_filters=num_filters, use_...
FactoryTest
[ "Apache-2.0", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FactoryTest: def test_fpn_decoder_creation(self, num_filters, use_separable_conv): """Test creation of FPN decoder.""" <|body_0|> def test_nasfpn_decoder_creation(self, num_filters, num_repeats, use_separable_conv): """Test creation of NASFPN decoder.""" <|bo...
stack_v2_sparse_classes_75kplus_train_002350
5,621
permissive
[ { "docstring": "Test creation of FPN decoder.", "name": "test_fpn_decoder_creation", "signature": "def test_fpn_decoder_creation(self, num_filters, use_separable_conv)" }, { "docstring": "Test creation of NASFPN decoder.", "name": "test_nasfpn_decoder_creation", "signature": "def test_na...
4
null
Implement the Python class `FactoryTest` described below. Class description: Implement the FactoryTest class. Method signatures and docstrings: - def test_fpn_decoder_creation(self, num_filters, use_separable_conv): Test creation of FPN decoder. - def test_nasfpn_decoder_creation(self, num_filters, num_repeats, use_s...
Implement the Python class `FactoryTest` described below. Class description: Implement the FactoryTest class. Method signatures and docstrings: - def test_fpn_decoder_creation(self, num_filters, use_separable_conv): Test creation of FPN decoder. - def test_nasfpn_decoder_creation(self, num_filters, num_repeats, use_s...
d3507b550a3ade40cade60a79eb5b8978b56c7ae
<|skeleton|> class FactoryTest: def test_fpn_decoder_creation(self, num_filters, use_separable_conv): """Test creation of FPN decoder.""" <|body_0|> def test_nasfpn_decoder_creation(self, num_filters, num_repeats, use_separable_conv): """Test creation of NASFPN decoder.""" <|bo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FactoryTest: def test_fpn_decoder_creation(self, num_filters, use_separable_conv): """Test creation of FPN decoder.""" min_level = 3 max_level = 7 input_specs = {} for level in range(min_level, max_level): input_specs[str(level)] = tf.TensorShape([1, 128 // ...
the_stack_v2_python_sparse
official/vision/modeling/decoders/factory_test.py
jianzhnie/models
train
2
0c654b50811f0c70510ee3449bbeaafe90ed57fc
[ "with open(tst_file, 'w') as writer:\n for test_case in project.test_space.get_test_cases():\n test_case: jcmuta.TestCase\n writer.write('{}\\n'.format(test_case.get_test_id()))\nreturn", "space = project.muta_space\nwith open(mut_file, 'w') as writer:\n for mutant in space.get_mutants():\n ...
<|body_start_0|> with open(tst_file, 'w') as writer: for test_case in project.test_space.get_test_cases(): test_case: jcmuta.TestCase writer.write('{}\n'.format(test_case.get_test_id())) return <|end_body_0|> <|body_start_1|> space = project.muta_spac...
It implements the encoding of MerDocument data from CProject
MerDocumentEncoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MerDocumentEncoder: """It implements the encoding of MerDocument data from CProject""" def __encode_tst_file__(project: jcmuta.CProject, tst_file: str): """:param project: :param tst_file: :return:""" <|body_0|> def __encode_mut_file__(project: jcmuta.CProject, mut_file:...
stack_v2_sparse_classes_75kplus_train_002351
16,948
no_license
[ { "docstring": ":param project: :param tst_file: :return:", "name": "__encode_tst_file__", "signature": "def __encode_tst_file__(project: jcmuta.CProject, tst_file: str)" }, { "docstring": ":param project: :param mut_file: {mid cid wid sid res }+ :return:", "name": "__encode_mut_file__", ...
5
stack_v2_sparse_classes_30k_train_031889
Implement the Python class `MerDocumentEncoder` described below. Class description: It implements the encoding of MerDocument data from CProject Method signatures and docstrings: - def __encode_tst_file__(project: jcmuta.CProject, tst_file: str): :param project: :param tst_file: :return: - def __encode_mut_file__(pro...
Implement the Python class `MerDocumentEncoder` described below. Class description: It implements the encoding of MerDocument data from CProject Method signatures and docstrings: - def __encode_tst_file__(project: jcmuta.CProject, tst_file: str): :param project: :param tst_file: :return: - def __encode_mut_file__(pro...
e5d877f98e36d5fc24175f14f53c7fc969844a65
<|skeleton|> class MerDocumentEncoder: """It implements the encoding of MerDocument data from CProject""" def __encode_tst_file__(project: jcmuta.CProject, tst_file: str): """:param project: :param tst_file: :return:""" <|body_0|> def __encode_mut_file__(project: jcmuta.CProject, mut_file:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MerDocumentEncoder: """It implements the encoding of MerDocument data from CProject""" def __encode_tst_file__(project: jcmuta.CProject, tst_file: str): """:param project: :param tst_file: :return:""" with open(tst_file, 'w') as writer: for test_case in project.test_space.get_...
the_stack_v2_python_sparse
PyMuta/com/jcsa/pymuta2/encode.py
dzt2/jcsa
train
0
be142f7992b7d27046142538c8f7a70a6e073f6a
[ "if theJSON.has('matchHostPK') or theJSON.has('matchHostSignature'):\n raise RuntimeException('Already signed JSON! Cannot sign again.')\ntheJSON.put('matchHostPK', thePK)\ntheSignature = BaseCryptography.signData(theSK, CanonicalJSON.getCanonicalForm(theJSON, CanonicalizationStrategy.SIMPLE))\ntheJSON.put('matc...
<|body_start_0|> if theJSON.has('matchHostPK') or theJSON.has('matchHostSignature'): raise RuntimeException('Already signed JSON! Cannot sign again.') theJSON.put('matchHostPK', thePK) theSignature = BaseCryptography.signData(theSK, CanonicalJSON.getCanonicalForm(theJSON, Canonicaliz...
generated source for class SignableJSON
SignableJSON
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SignableJSON: """generated source for class SignableJSON""" def signJSON(cls, theJSON, thePK, theSK): """generated source for method signJSON""" <|body_0|> def isSignedJSON(cls, theJSON): """generated source for method isSignedJSON""" <|body_1|> def ...
stack_v2_sparse_classes_75kplus_train_002352
2,578
permissive
[ { "docstring": "generated source for method signJSON", "name": "signJSON", "signature": "def signJSON(cls, theJSON, thePK, theSK)" }, { "docstring": "generated source for method isSignedJSON", "name": "isSignedJSON", "signature": "def isSignedJSON(cls, theJSON)" }, { "docstring":...
3
stack_v2_sparse_classes_30k_train_020385
Implement the Python class `SignableJSON` described below. Class description: generated source for class SignableJSON Method signatures and docstrings: - def signJSON(cls, theJSON, thePK, theSK): generated source for method signJSON - def isSignedJSON(cls, theJSON): generated source for method isSignedJSON - def veri...
Implement the Python class `SignableJSON` described below. Class description: generated source for class SignableJSON Method signatures and docstrings: - def signJSON(cls, theJSON, thePK, theSK): generated source for method signJSON - def isSignedJSON(cls, theJSON): generated source for method isSignedJSON - def veri...
4e6e6e876c3a4294cd711647051da2d9c1836b60
<|skeleton|> class SignableJSON: """generated source for class SignableJSON""" def signJSON(cls, theJSON, thePK, theSK): """generated source for method signJSON""" <|body_0|> def isSignedJSON(cls, theJSON): """generated source for method isSignedJSON""" <|body_1|> def ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SignableJSON: """generated source for class SignableJSON""" def signJSON(cls, theJSON, thePK, theSK): """generated source for method signJSON""" if theJSON.has('matchHostPK') or theJSON.has('matchHostSignature'): raise RuntimeException('Already signed JSON! Cannot sign again.'...
the_stack_v2_python_sparse
ggpy/cruft/autocode/SignableJSON.py
hobson/ggpy
train
1
c7fec254c6fa3a109f6b2b603bca9e8848ce56b5
[ "super().__init__()\nself._img_shape = img_shape\nself.model = torch.nn.Sequential(torch.nn.Linear(latent_dim, 512), torch.nn.LeakyReLU(0.2, inplace=True), torch.nn.Linear(512, 512), torch.nn.BatchNorm1d(512), torch.nn.LeakyReLU(0.2, inplace=True), torch.nn.Linear(512, int(reduce(mul, img_shape, 1))), torch.nn.Tanh...
<|body_start_0|> super().__init__() self._img_shape = img_shape self.model = torch.nn.Sequential(torch.nn.Linear(latent_dim, 512), torch.nn.LeakyReLU(0.2, inplace=True), torch.nn.Linear(512, 512), torch.nn.BatchNorm1d(512), torch.nn.LeakyReLU(0.2, inplace=True), torch.nn.Linear(512, int(reduce(m...
Decodes an already encoded image signal
Decoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Decoder: """Decodes an already encoded image signal""" def __init__(self, latent_dim, img_shape): """Parameters ---------- latent_dim : int the size of the latent dimension img_shape : tuple the shape of the input image""" <|body_0|> def forward(self, z): """Feed...
stack_v2_sparse_classes_75kplus_train_002353
5,204
permissive
[ { "docstring": "Parameters ---------- latent_dim : int the size of the latent dimension img_shape : tuple the shape of the input image", "name": "__init__", "signature": "def __init__(self, latent_dim, img_shape)" }, { "docstring": "Feeds an encoded signal through the network for decoding Parame...
2
stack_v2_sparse_classes_30k_train_034593
Implement the Python class `Decoder` described below. Class description: Decodes an already encoded image signal Method signatures and docstrings: - def __init__(self, latent_dim, img_shape): Parameters ---------- latent_dim : int the size of the latent dimension img_shape : tuple the shape of the input image - def f...
Implement the Python class `Decoder` described below. Class description: Decodes an already encoded image signal Method signatures and docstrings: - def __init__(self, latent_dim, img_shape): Parameters ---------- latent_dim : int the size of the latent dimension img_shape : tuple the shape of the input image - def f...
1078f5030b8aac2bf022daf5fa14d66f74c3c893
<|skeleton|> class Decoder: """Decodes an already encoded image signal""" def __init__(self, latent_dim, img_shape): """Parameters ---------- latent_dim : int the size of the latent dimension img_shape : tuple the shape of the input image""" <|body_0|> def forward(self, z): """Feed...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Decoder: """Decodes an already encoded image signal""" def __init__(self, latent_dim, img_shape): """Parameters ---------- latent_dim : int the size of the latent dimension img_shape : tuple the shape of the input image""" super().__init__() self._img_shape = img_shape sel...
the_stack_v2_python_sparse
dlutils/models/gans/adversarial_autoencoder/models.py
justusschock/dl-utils
train
15
40156aeda5db65df5bac7d87240906e4c30c5f1b
[ "super().__init__(num_heads, block)\nself.num_sliding_window_blocks = num_sliding_window_blocks\nself.attention = attention", "num_blocks = layout.shape[1]\nif num_blocks < self.num_sliding_window_blocks:\n raise ValueError(f'Number of sliding window blocks, {self.num_sliding_window_blocks}, must be smaller th...
<|body_start_0|> super().__init__(num_heads, block) self.num_sliding_window_blocks = num_sliding_window_blocks self.attention = attention <|end_body_0|> <|body_start_1|> num_blocks = layout.shape[1] if num_blocks < self.num_sliding_window_blocks: raise ValueError(f'N...
Configuration class to store `Local Sliding Window` sparsity configuration - a purely-local sliding window attention. This class extends parent class of `SparsityConfig` and customizes it for `Local` sparsity.
LocalSlidingWindowSparsityConfig
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LocalSlidingWindowSparsityConfig: """Configuration class to store `Local Sliding Window` sparsity configuration - a purely-local sliding window attention. This class extends parent class of `SparsityConfig` and customizes it for `Local` sparsity.""" def __init__(self, num_heads, block=16, nu...
stack_v2_sparse_classes_75kplus_train_002354
42,463
permissive
[ { "docstring": "Initialize the Local Sliding Window Sparsity Pattern Config. For usage example please see, TODO DeepSpeed Sparse Transformer Tutorial Arguments: num_heads: required: an integer determining number of attention heads of the layer. block: optional: an integer determining the block size. Current imp...
3
stack_v2_sparse_classes_30k_train_047976
Implement the Python class `LocalSlidingWindowSparsityConfig` described below. Class description: Configuration class to store `Local Sliding Window` sparsity configuration - a purely-local sliding window attention. This class extends parent class of `SparsityConfig` and customizes it for `Local` sparsity. Method sig...
Implement the Python class `LocalSlidingWindowSparsityConfig` described below. Class description: Configuration class to store `Local Sliding Window` sparsity configuration - a purely-local sliding window attention. This class extends parent class of `SparsityConfig` and customizes it for `Local` sparsity. Method sig...
55d9964c59c0c6e23158b5789a5c36c28939a7b0
<|skeleton|> class LocalSlidingWindowSparsityConfig: """Configuration class to store `Local Sliding Window` sparsity configuration - a purely-local sliding window attention. This class extends parent class of `SparsityConfig` and customizes it for `Local` sparsity.""" def __init__(self, num_heads, block=16, nu...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LocalSlidingWindowSparsityConfig: """Configuration class to store `Local Sliding Window` sparsity configuration - a purely-local sliding window attention. This class extends parent class of `SparsityConfig` and customizes it for `Local` sparsity.""" def __init__(self, num_heads, block=16, num_sliding_win...
the_stack_v2_python_sparse
deepspeed/ops/sparse_attention/sparsity_config.py
microsoft/DeepSpeed
train
27,557
fc3d20d98d6429a6d9762bd109bb6365389373cc
[ "token = su.requestToken(self.email)\nself.granted = datetime.now()\nself.save()\nreturn token", "if self.granted:\n self.formatedGranted = datetime.strftime(self.granted, '%b %d, %Y')\nself.formatedCreated = datetime.strftime(self.created, '%b %d, %Y')", "foundrequest = []\nfor request in items:\n if req...
<|body_start_0|> token = su.requestToken(self.email) self.granted = datetime.now() self.save() return token <|end_body_0|> <|body_start_1|> if self.granted: self.formatedGranted = datetime.strftime(self.granted, '%b %d, %Y') self.formatedCreated = datetime.st...
requestORM
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class requestORM: def generateToken(self): """Generates an invite token to be sent to and used for registering, along with saves the time the request was granted. :return: The invite token which is a URL save, serialized version of their email signed with a secret and a salt.""" <|body...
stack_v2_sparse_classes_75kplus_train_002355
2,120
permissive
[ { "docstring": "Generates an invite token to be sent to and used for registering, along with saves the time the request was granted. :return: The invite token which is a URL save, serialized version of their email signed with a secret and a salt.", "name": "generateToken", "signature": "def generateToke...
3
null
Implement the Python class `requestORM` described below. Class description: Implement the requestORM class. Method signatures and docstrings: - def generateToken(self): Generates an invite token to be sent to and used for registering, along with saves the time the request was granted. :return: The invite token which ...
Implement the Python class `requestORM` described below. Class description: Implement the requestORM class. Method signatures and docstrings: - def generateToken(self): Generates an invite token to be sent to and used for registering, along with saves the time the request was granted. :return: The invite token which ...
fbf9d0c5278a23f18b586dee89bb054794b3d452
<|skeleton|> class requestORM: def generateToken(self): """Generates an invite token to be sent to and used for registering, along with saves the time the request was granted. :return: The invite token which is a URL save, serialized version of their email signed with a secret and a salt.""" <|body...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class requestORM: def generateToken(self): """Generates an invite token to be sent to and used for registering, along with saves the time the request was granted. :return: The invite token which is a URL save, serialized version of their email signed with a secret and a salt.""" token = su.requestTo...
the_stack_v2_python_sparse
flagr_core/models/couch/request/requestModel.py
JoshAshby/Fla.gr
train
0
9cc209a5a67157117eb2120a8ce4877a89a3d86a
[ "passwordAuth = v3.Password(auth_url=osAuthUrl, user_domain_name='default', username=username, password=password, project_domain_name=osProjectDomain, project_name=osProjectName, unscoped=False)\nscopedSession = session.Session(auth=passwordAuth)\nreturn scopedSession", "for k, v in kwargs:\n if k == 'configPa...
<|body_start_0|> passwordAuth = v3.Password(auth_url=osAuthUrl, user_domain_name='default', username=username, password=password, project_domain_name=osProjectDomain, project_name=osProjectName, unscoped=False) scopedSession = session.Session(auth=passwordAuth) return scopedSession <|end_body_0|...
SwiftHandler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SwiftHandler: def _getScopedSession(self, osAuthUrl, username, password, osProjectDomain, osProjectName): """Uses keystone authentication to create and return a scoped session""" <|body_0|> def _initiateSwiftConnection(self, **kwargs): """Initiates a Swift connection...
stack_v2_sparse_classes_75kplus_train_002356
2,405
permissive
[ { "docstring": "Uses keystone authentication to create and return a scoped session", "name": "_getScopedSession", "signature": "def _getScopedSession(self, osAuthUrl, username, password, osProjectDomain, osProjectName)" }, { "docstring": "Initiates a Swift connection and returns a Swift connecti...
3
stack_v2_sparse_classes_30k_train_010298
Implement the Python class `SwiftHandler` described below. Class description: Implement the SwiftHandler class. Method signatures and docstrings: - def _getScopedSession(self, osAuthUrl, username, password, osProjectDomain, osProjectName): Uses keystone authentication to create and return a scoped session - def _init...
Implement the Python class `SwiftHandler` described below. Class description: Implement the SwiftHandler class. Method signatures and docstrings: - def _getScopedSession(self, osAuthUrl, username, password, osProjectDomain, osProjectName): Uses keystone authentication to create and return a scoped session - def _init...
886e28081db453977f1ea6ba6e3bde7efe0de6f0
<|skeleton|> class SwiftHandler: def _getScopedSession(self, osAuthUrl, username, password, osProjectDomain, osProjectName): """Uses keystone authentication to create and return a scoped session""" <|body_0|> def _initiateSwiftConnection(self, **kwargs): """Initiates a Swift connection...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SwiftHandler: def _getScopedSession(self, osAuthUrl, username, password, osProjectDomain, osProjectName): """Uses keystone authentication to create and return a scoped session""" passwordAuth = v3.Password(auth_url=osAuthUrl, user_domain_name='default', username=username, password=password, pr...
the_stack_v2_python_sparse
openshift/pman-swift-publisher/swift_handler.py
Chris210634/pman
train
0
a67513f277511b882cb7d915c72ee52d4a728f86
[ "self.img_width = img_width\nself.img_height = img_height\nself.flip_horiz = flip_horiz\nself.inter = inter", "crops = []\nheight, width = image.shape[:2]\ncorners = [[0, 0, self.img_width, self.img_height], [width - self.img_width, 0, width, self.img_height], [width - self.img_width, height - self.img_height, wi...
<|body_start_0|> self.img_width = img_width self.img_height = img_height self.flip_horiz = flip_horiz self.inter = inter <|end_body_0|> <|body_start_1|> crops = [] height, width = image.shape[:2] corners = [[0, 0, self.img_width, self.img_height], [width - self.i...
CropPreprocessor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CropPreprocessor: def __init__(self, img_width, img_height, flip_horiz=True, inter=cv2.INTER_AREA): """Initialise the class :param img_width: desired image width :param img_height: desired image height :param flip_horiz: whether horizontal flips are also required :param inter: desired in...
stack_v2_sparse_classes_75kplus_train_002357
2,378
no_license
[ { "docstring": "Initialise the class :param img_width: desired image width :param img_height: desired image height :param flip_horiz: whether horizontal flips are also required :param inter: desired interpolation method", "name": "__init__", "signature": "def __init__(self, img_width, img_height, flip_h...
2
stack_v2_sparse_classes_30k_train_012350
Implement the Python class `CropPreprocessor` described below. Class description: Implement the CropPreprocessor class. Method signatures and docstrings: - def __init__(self, img_width, img_height, flip_horiz=True, inter=cv2.INTER_AREA): Initialise the class :param img_width: desired image width :param img_height: de...
Implement the Python class `CropPreprocessor` described below. Class description: Implement the CropPreprocessor class. Method signatures and docstrings: - def __init__(self, img_width, img_height, flip_horiz=True, inter=cv2.INTER_AREA): Initialise the class :param img_width: desired image width :param img_height: de...
e9f2010715fa06f50095d05684617c86e18ca661
<|skeleton|> class CropPreprocessor: def __init__(self, img_width, img_height, flip_horiz=True, inter=cv2.INTER_AREA): """Initialise the class :param img_width: desired image width :param img_height: desired image height :param flip_horiz: whether horizontal flips are also required :param inter: desired in...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CropPreprocessor: def __init__(self, img_width, img_height, flip_horiz=True, inter=cv2.INTER_AREA): """Initialise the class :param img_width: desired image width :param img_height: desired image height :param flip_horiz: whether horizontal flips are also required :param inter: desired interpolation me...
the_stack_v2_python_sparse
dltoolkit/preprocess/crop.py
GeoffBreemer/DLToolkit
train
2
53772cf4d9b6bde55203337166f037dae8982452
[ "arg_raw.prog = 'ExampleScript.py'\narg_raw.description = 'New Example Description.'\narg_raw.add_argument('-z', '--example', dest='str_new_variable_to_play_with', default='Hello', help='An example help text.')", "str_dir_1 = os.path.join(args_parsed.str_file_base, 'dir1')\nstr_dir_2 = os.path.join(args_parsed.st...
<|body_start_0|> arg_raw.prog = 'ExampleScript.py' arg_raw.description = 'New Example Description.' arg_raw.add_argument('-z', '--example', dest='str_new_variable_to_play_with', default='Hello', help='An example help text.') <|end_body_0|> <|body_start_1|> str_dir_1 = os.path.join(args_...
An example script to run as a test or use as an example. This script creates a small directory hierarchy and creates files in those directories. Output dir is given by arguments. output_dir - dir1 - dir4 - file2.txt - file3.txt - dir5 - file1.txt - dir2 - dir6 - file4.txt - dir3 - file5.txt - file6.txt - file7.txt Depe...
ExampleScript
[ "BSD-2-Clause", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExampleScript: """An example script to run as a test or use as an example. This script creates a small directory hierarchy and creates files in those directories. Output dir is given by arguments. output_dir - dir1 - dir4 - file2.txt - file3.txt - dir5 - file1.txt - dir2 - dir6 - file4.txt - dir3...
stack_v2_sparse_classes_75kplus_train_002358
5,401
permissive
[ { "docstring": "Updates to the arg parser, command line options * arg_raw : Arguments ( not yet parsed ) : Arguments * return : Updated Arguments : Arguments", "name": "func_update_arguments", "signature": "def func_update_arguments(self, arg_raw)" }, { "docstring": "Allows: - the creation of co...
2
stack_v2_sparse_classes_30k_train_047480
Implement the Python class `ExampleScript` described below. Class description: An example script to run as a test or use as an example. This script creates a small directory hierarchy and creates files in those directories. Output dir is given by arguments. output_dir - dir1 - dir4 - file2.txt - file3.txt - dir5 - fil...
Implement the Python class `ExampleScript` described below. Class description: An example script to run as a test or use as an example. This script creates a small directory hierarchy and creates files in those directories. Output dir is given by arguments. output_dir - dir1 - dir4 - file2.txt - file3.txt - dir5 - fil...
416ab3415b0d11ca13b9f35a61a6a5d0c319fd3a
<|skeleton|> class ExampleScript: """An example script to run as a test or use as an example. This script creates a small directory hierarchy and creates files in those directories. Output dir is given by arguments. output_dir - dir1 - dir4 - file2.txt - file3.txt - dir5 - file1.txt - dir2 - dir6 - file4.txt - dir3...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ExampleScript: """An example script to run as a test or use as an example. This script creates a small directory hierarchy and creates files in those directories. Output dir is given by arguments. output_dir - dir1 - dir4 - file2.txt - file3.txt - dir5 - file1.txt - dir2 - dir6 - file4.txt - dir3 - file5.txt ...
the_stack_v2_python_sparse
demo/ExampleWDLScript.py
SciEDPipeR/SciEDPipeR
train
5
d2584a376812fc29eef7e5777707c81ae348b5bf
[ "max_1 = 0\nl = len(s)\ndp = [[-1] * l for _ in range(l)]\nfor i in range(l):\n if s[i] == ')':\n dp[i][i] = -1\n continue\n else:\n dp[i][i] = 1\n for j in range(i + 1, l):\n if s[j] == '(':\n dp[i][j] = dp[i][j - 1] + 1\n else:\n dp[i][j] = dp[i][j...
<|body_start_0|> max_1 = 0 l = len(s) dp = [[-1] * l for _ in range(l)] for i in range(l): if s[i] == ')': dp[i][i] = -1 continue else: dp[i][i] = 1 for j in range(i + 1, l): if s[j] == '(...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestValidParentheses(self, s): """:type s: str :rtype: int time_limit_over""" <|body_0|> def longestValidParentheses_1(self, s): """79ms :param s: :return:""" <|body_1|> def longestValidParentheses_2(self, s): """:type s: str :rt...
stack_v2_sparse_classes_75kplus_train_002359
3,220
no_license
[ { "docstring": ":type s: str :rtype: int time_limit_over", "name": "longestValidParentheses", "signature": "def longestValidParentheses(self, s)" }, { "docstring": "79ms :param s: :return:", "name": "longestValidParentheses_1", "signature": "def longestValidParentheses_1(self, s)" }, ...
4
stack_v2_sparse_classes_30k_train_052238
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestValidParentheses(self, s): :type s: str :rtype: int time_limit_over - def longestValidParentheses_1(self, s): 79ms :param s: :return: - def longestValidParentheses_2(s...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestValidParentheses(self, s): :type s: str :rtype: int time_limit_over - def longestValidParentheses_1(self, s): 79ms :param s: :return: - def longestValidParentheses_2(s...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def longestValidParentheses(self, s): """:type s: str :rtype: int time_limit_over""" <|body_0|> def longestValidParentheses_1(self, s): """79ms :param s: :return:""" <|body_1|> def longestValidParentheses_2(self, s): """:type s: str :rt...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def longestValidParentheses(self, s): """:type s: str :rtype: int time_limit_over""" max_1 = 0 l = len(s) dp = [[-1] * l for _ in range(l)] for i in range(l): if s[i] == ')': dp[i][i] = -1 continue else: ...
the_stack_v2_python_sparse
LongestValidParentheses_HARD_32.py
953250587/leetcode-python
train
2
e67e4e412d280ff36b1a73f4eb01962d5d0f7c81
[ "super(SelectBox, self).__init__(parent)\nself._leftBrushColor = QColor()\nself._rightBrushColor = QColor()\nself._leftPenColor = QColor()\nself._rightPenColor = QColor()\nself._alpha = 255\nself._dirBrush = QBrush()\nself._leftBrush = QBrush()\nself._rightBrush = QBrush()\nself._dirPen = QPen()\nself._leftPen = QP...
<|body_start_0|> super(SelectBox, self).__init__(parent) self._leftBrushColor = QColor() self._rightBrushColor = QColor() self._leftPenColor = QColor() self._rightPenColor = QColor() self._alpha = 255 self._dirBrush = QBrush() self._leftBrush = QBrush() ...
Subclass of `QRubberBand`_ TOWRITE
SelectBox
[ "Zlib", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SelectBox: """Subclass of `QRubberBand`_ TOWRITE""" def __init__(self, s, parent=None): """Default class constructor. :param `s`: TOWRITE :type `s`: QRubberBand.Shape :param `parent`: Pointer to a parent widget instance. :type `parent`: `QWidget`_""" <|body_0|> def setDi...
stack_v2_sparse_classes_75kplus_train_002360
4,928
permissive
[ { "docstring": "Default class constructor. :param `s`: TOWRITE :type `s`: QRubberBand.Shape :param `parent`: Pointer to a parent widget instance. :type `parent`: `QWidget`_", "name": "__init__", "signature": "def __init__(self, s, parent=None)" }, { "docstring": "TOWRITE :param `dir`: TOWRITE :t...
5
stack_v2_sparse_classes_30k_train_044449
Implement the Python class `SelectBox` described below. Class description: Subclass of `QRubberBand`_ TOWRITE Method signatures and docstrings: - def __init__(self, s, parent=None): Default class constructor. :param `s`: TOWRITE :type `s`: QRubberBand.Shape :param `parent`: Pointer to a parent widget instance. :type ...
Implement the Python class `SelectBox` described below. Class description: Subclass of `QRubberBand`_ TOWRITE Method signatures and docstrings: - def __init__(self, s, parent=None): Default class constructor. :param `s`: TOWRITE :type `s`: QRubberBand.Shape :param `parent`: Pointer to a parent widget instance. :type ...
9c5c2baea3bf3897470495e2a50eb70ee1363637
<|skeleton|> class SelectBox: """Subclass of `QRubberBand`_ TOWRITE""" def __init__(self, s, parent=None): """Default class constructor. :param `s`: TOWRITE :type `s`: QRubberBand.Shape :param `parent`: Pointer to a parent widget instance. :type `parent`: `QWidget`_""" <|body_0|> def setDi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SelectBox: """Subclass of `QRubberBand`_ TOWRITE""" def __init__(self, s, parent=None): """Default class constructor. :param `s`: TOWRITE :type `s`: QRubberBand.Shape :param `parent`: Pointer to a parent widget instance. :type `parent`: `QWidget`_""" super(SelectBox, self).__init__(parent...
the_stack_v2_python_sparse
experimental/python/gui/selectbox.py
Fran89/Embroidermodder
train
1
97032bdad21397d70f35eb09edc775f4072e11f6
[ "diff_terms = {}\ndifferentiated_terms = self.finite_differences(dvar.data, ivar.spacing, self.diff_order)\nfor i in range(differentiated_terms.shape[1]):\n descriptor = self.format_diff_descriptor(ivar.name, dvar.name, i + 1)\n diff_data = differentiated_terms[:, i].flatten()\n diff_terms[descriptor] = di...
<|body_start_0|> diff_terms = {} differentiated_terms = self.finite_differences(dvar.data, ivar.spacing, self.diff_order) for i in range(differentiated_terms.shape[1]): descriptor = self.format_diff_descriptor(ivar.name, dvar.name, i + 1) diff_data = differentiated_terms[...
Differentiator class which implements Finite Differences.
FiniteDifferences
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FiniteDifferences: """Differentiator class which implements Finite Differences.""" def differentiate(self, ivar: IndVar, dvar: DepVar): """Differentiate the dependent variable data with respect to ind var. Keyword arguments: ivar -- IndependentVariable instance to differentiate w.r.t...
stack_v2_sparse_classes_75kplus_train_002361
3,839
permissive
[ { "docstring": "Differentiate the dependent variable data with respect to ind var. Keyword arguments: ivar -- IndependentVariable instance to differentiate w.r.t. dvar -- DependentVariable instance to differentiate Returns: diff_terms -- dictionary of numerically differentiated terms", "name": "differentiat...
3
null
Implement the Python class `FiniteDifferences` described below. Class description: Differentiator class which implements Finite Differences. Method signatures and docstrings: - def differentiate(self, ivar: IndVar, dvar: DepVar): Differentiate the dependent variable data with respect to ind var. Keyword arguments: iv...
Implement the Python class `FiniteDifferences` described below. Class description: Differentiator class which implements Finite Differences. Method signatures and docstrings: - def differentiate(self, ivar: IndVar, dvar: DepVar): Differentiate the dependent variable data with respect to ind var. Keyword arguments: iv...
ac5b2bb4854bb311e4f6f26b180dde87cc10c13d
<|skeleton|> class FiniteDifferences: """Differentiator class which implements Finite Differences.""" def differentiate(self, ivar: IndVar, dvar: DepVar): """Differentiate the dependent variable data with respect to ind var. Keyword arguments: ivar -- IndependentVariable instance to differentiate w.r.t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FiniteDifferences: """Differentiator class which implements Finite Differences.""" def differentiate(self, ivar: IndVar, dvar: DepVar): """Differentiate the dependent variable data with respect to ind var. Keyword arguments: ivar -- IndependentVariable instance to differentiate w.r.t. dvar -- Dep...
the_stack_v2_python_sparse
sindy_bvp/differentiators/finite_differences.py
AI-and-ML/SINDy-BVP
train
0
3b015eb59532f512ab2aab084c2d59d635c5a009
[ "if k > len(nums):\n return ()\npreSum = 0\nmaxSum = -float('Inf')\nfor i in range(0, len(nums) - k + 1):\n preSum = sum(nums[i:i + k])\n maxSum = max(maxSum, preSum)\nreturn maxSum / k", "if k > len(nums):\n return ()\npreSum = sum(nums[0:k])\nmaxSum = preSum\nfor i in range(k, len(nums)):\n preSu...
<|body_start_0|> if k > len(nums): return () preSum = 0 maxSum = -float('Inf') for i in range(0, len(nums) - k + 1): preSum = sum(nums[i:i + k]) maxSum = max(maxSum, preSum) return maxSum / k <|end_body_0|> <|body_start_1|> if k > len(...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMaxAverage(self, nums, k): """:type nums: List[int] :type k: int :rtype: float""" <|body_0|> def findMaxAverage2(self, nums, k): """:type nums: List[int] :type k: int :rtype: float""" <|body_1|> <|end_skeleton|> <|body_start_0|> if...
stack_v2_sparse_classes_75kplus_train_002362
1,288
no_license
[ { "docstring": ":type nums: List[int] :type k: int :rtype: float", "name": "findMaxAverage", "signature": "def findMaxAverage(self, nums, k)" }, { "docstring": ":type nums: List[int] :type k: int :rtype: float", "name": "findMaxAverage2", "signature": "def findMaxAverage2(self, nums, k)"...
2
stack_v2_sparse_classes_30k_train_026885
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMaxAverage(self, nums, k): :type nums: List[int] :type k: int :rtype: float - def findMaxAverage2(self, nums, k): :type nums: List[int] :type k: int :rtype: float
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMaxAverage(self, nums, k): :type nums: List[int] :type k: int :rtype: float - def findMaxAverage2(self, nums, k): :type nums: List[int] :type k: int :rtype: float <|skel...
604efd2c53c369fb262f42f7f7f31997ea4d029b
<|skeleton|> class Solution: def findMaxAverage(self, nums, k): """:type nums: List[int] :type k: int :rtype: float""" <|body_0|> def findMaxAverage2(self, nums, k): """:type nums: List[int] :type k: int :rtype: float""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def findMaxAverage(self, nums, k): """:type nums: List[int] :type k: int :rtype: float""" if k > len(nums): return () preSum = 0 maxSum = -float('Inf') for i in range(0, len(nums) - k + 1): preSum = sum(nums[i:i + k]) maxSum...
the_stack_v2_python_sparse
643_MaximumAverageSubarrayI.py
fxy1018/Leetcode
train
1
03bd4ffbbe35eebeffc6257a761aa7d5fb7d13a7
[ "self.fields[name] = typ(label='', required=False)\nif value is not None:\n self.fields[name].initial = value\nif pos:\n order = list(self.fields.keys())\n order.remove(name)\n order.insert(pos, name)\n self.fields = OrderedDict(((key, self.fields[key]) for key in order))", "expr = re.compile('%s_\...
<|body_start_0|> self.fields[name] = typ(label='', required=False) if value is not None: self.fields[name].initial = value if pos: order = list(self.fields.keys()) order.remove(name) order.insert(pos, name) self.fields = OrderedDict(((k...
A form which accepts dynamic fields. We consider a field to be dynamic when it can appear multiple times within the same request.
DynamicForm
[ "ISC" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DynamicForm: """A form which accepts dynamic fields. We consider a field to be dynamic when it can appear multiple times within the same request.""" def _create_field(self, typ, name, value=None, pos=None): """Create a new form field.""" <|body_0|> def _load_from_qdict(s...
stack_v2_sparse_classes_75kplus_train_002363
11,908
permissive
[ { "docstring": "Create a new form field.", "name": "_create_field", "signature": "def _create_field(self, typ, name, value=None, pos=None)" }, { "docstring": "Load all instances of a field from a ``QueryDict`` object. :param ``QueryDict`` qdict: a QueryDict object :param string pattern: pattern ...
2
stack_v2_sparse_classes_30k_train_044291
Implement the Python class `DynamicForm` described below. Class description: A form which accepts dynamic fields. We consider a field to be dynamic when it can appear multiple times within the same request. Method signatures and docstrings: - def _create_field(self, typ, name, value=None, pos=None): Create a new form...
Implement the Python class `DynamicForm` described below. Class description: A form which accepts dynamic fields. We consider a field to be dynamic when it can appear multiple times within the same request. Method signatures and docstrings: - def _create_field(self, typ, name, value=None, pos=None): Create a new form...
df699aab0799ec1725b6b89be38e56285821c889
<|skeleton|> class DynamicForm: """A form which accepts dynamic fields. We consider a field to be dynamic when it can appear multiple times within the same request.""" def _create_field(self, typ, name, value=None, pos=None): """Create a new form field.""" <|body_0|> def _load_from_qdict(s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DynamicForm: """A form which accepts dynamic fields. We consider a field to be dynamic when it can appear multiple times within the same request.""" def _create_field(self, typ, name, value=None, pos=None): """Create a new form field.""" self.fields[name] = typ(label='', required=False) ...
the_stack_v2_python_sparse
modoboa/lib/form_utils.py
modoboa/modoboa
train
2,201
69d9d58a9ba83a6337092f15bad56672e3365243
[ "size = len(nums)\ndp = [0] * (size + 1)\nif size:\n dp[1] = nums[0]\nfor i in range(2, size + 1):\n dp[i] = max(dp[i - 1], dp[i - 2] + nums[i - 1])\nreturn dp[size]", "last, now = (0, 0)\nfor num in nums:\n last, now = (now, max(last + num, now))\nreturn now" ]
<|body_start_0|> size = len(nums) dp = [0] * (size + 1) if size: dp[1] = nums[0] for i in range(2, size + 1): dp[i] = max(dp[i - 1], dp[i - 2] + nums[i - 1]) return dp[size] <|end_body_0|> <|body_start_1|> last, now = (0, 0) for num in num...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def houseRobber(self, nums): """动态转移方程:dp[i] = max(dp[i-1], dp[i-2]+nums[i]) dp[i]表示打劫到第i家的时候,累计取得的金钱最大值 :param nums: :return:""" <|body_0|> def house_robber(self, nums): """:param nums: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_002364
928
no_license
[ { "docstring": "动态转移方程:dp[i] = max(dp[i-1], dp[i-2]+nums[i]) dp[i]表示打劫到第i家的时候,累计取得的金钱最大值 :param nums: :return:", "name": "houseRobber", "signature": "def houseRobber(self, nums)" }, { "docstring": ":param nums: :return:", "name": "house_robber", "signature": "def house_robber(self, nums)...
2
stack_v2_sparse_classes_30k_train_026816
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def houseRobber(self, nums): 动态转移方程:dp[i] = max(dp[i-1], dp[i-2]+nums[i]) dp[i]表示打劫到第i家的时候,累计取得的金钱最大值 :param nums: :return: - def house_robber(self, nums): :param nums: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def houseRobber(self, nums): 动态转移方程:dp[i] = max(dp[i-1], dp[i-2]+nums[i]) dp[i]表示打劫到第i家的时候,累计取得的金钱最大值 :param nums: :return: - def house_robber(self, nums): :param nums: :return: ...
215d513b3564a7a76db3d2b29e4acc341a68e8ee
<|skeleton|> class Solution: def houseRobber(self, nums): """动态转移方程:dp[i] = max(dp[i-1], dp[i-2]+nums[i]) dp[i]表示打劫到第i家的时候,累计取得的金钱最大值 :param nums: :return:""" <|body_0|> def house_robber(self, nums): """:param nums: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def houseRobber(self, nums): """动态转移方程:dp[i] = max(dp[i-1], dp[i-2]+nums[i]) dp[i]表示打劫到第i家的时候,累计取得的金钱最大值 :param nums: :return:""" size = len(nums) dp = [0] * (size + 1) if size: dp[1] = nums[0] for i in range(2, size + 1): dp[i] = max(d...
the_stack_v2_python_sparse
python/dp/house-robber.py
euxuoh/leetcode
train
0
5fd2736f5e027f80c7070dea2b8f80325764ed59
[ "self.queues = {}\nself.queues['tasks'] = Queue()\nself.queues['trans'] = Queue()\nself.queues['blocks'] = Queue()\nfor _ in range(num_threads):\n Worker(metadata, self.queues)\nMiner(metadata, self.queues)", "try:\n action = THREAD_FUNCTIONS[task['action']]\n params = task['params']\n self.queues['ta...
<|body_start_0|> self.queues = {} self.queues['tasks'] = Queue() self.queues['trans'] = Queue() self.queues['blocks'] = Queue() for _ in range(num_threads): Worker(metadata, self.queues) Miner(metadata, self.queues) <|end_body_0|> <|body_start_1|> try...
ThreadHandler
ThreadHandler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ThreadHandler: """ThreadHandler""" def __init__(self, metadata, num_threads): """__init__() The constructor for the ThreadHandler object. :param metadata: <dict> The metadata for the node. :param num_threads: <int> The number of threads to create.""" <|body_0|> def add_t...
stack_v2_sparse_classes_75kplus_train_002365
3,135
permissive
[ { "docstring": "__init__() The constructor for the ThreadHandler object. :param metadata: <dict> The metadata for the node. :param num_threads: <int> The number of threads to create.", "name": "__init__", "signature": "def __init__(self, metadata, num_threads)" }, { "docstring": "add_task() This...
2
stack_v2_sparse_classes_30k_train_022369
Implement the Python class `ThreadHandler` described below. Class description: ThreadHandler Method signatures and docstrings: - def __init__(self, metadata, num_threads): __init__() The constructor for the ThreadHandler object. :param metadata: <dict> The metadata for the node. :param num_threads: <int> The number o...
Implement the Python class `ThreadHandler` described below. Class description: ThreadHandler Method signatures and docstrings: - def __init__(self, metadata, num_threads): __init__() The constructor for the ThreadHandler object. :param metadata: <dict> The metadata for the node. :param num_threads: <int> The number o...
c6186aa7e4de0392788ab890e93b59f416b81a10
<|skeleton|> class ThreadHandler: """ThreadHandler""" def __init__(self, metadata, num_threads): """__init__() The constructor for the ThreadHandler object. :param metadata: <dict> The metadata for the node. :param num_threads: <int> The number of threads to create.""" <|body_0|> def add_t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ThreadHandler: """ThreadHandler""" def __init__(self, metadata, num_threads): """__init__() The constructor for the ThreadHandler object. :param metadata: <dict> The metadata for the node. :param num_threads: <int> The number of threads to create.""" self.queues = {} self.queues['...
the_stack_v2_python_sparse
thread.py
sjpacwa/SBChain
train
1
feca7da6c9d767b56d4471369542a0eab199548c
[ "BackPropagation.__init__(self, neural_network, learning_rate, max_error, max_iterations)\nself.momentum = momentum\nself.previous_weight_values = {}\n':type : dict[synapyse.base.connection.Connection, float]'", "for connection in neuron.input_connections.values():\n connection_input = connection.origin.output...
<|body_start_0|> BackPropagation.__init__(self, neural_network, learning_rate, max_error, max_iterations) self.momentum = momentum self.previous_weight_values = {} ':type : dict[synapyse.base.connection.Connection, float]' <|end_body_0|> <|body_start_1|> for connection in neuron...
MomentumBackPropagation
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MomentumBackPropagation: def __init__(self, neural_network, learning_rate, momentum, max_error, max_iterations=None): """:type neural_network: synapyse.base.neural_network.NeuralNetwork :type learning_rate: float :type momentum: float :type max_error: float :type max_iterations: int""" ...
stack_v2_sparse_classes_75kplus_train_002366
1,483
permissive
[ { "docstring": ":type neural_network: synapyse.base.neural_network.NeuralNetwork :type learning_rate: float :type momentum: float :type max_error: float :type max_iterations: int", "name": "__init__", "signature": "def __init__(self, neural_network, learning_rate, momentum, max_error, max_iterations=Non...
2
stack_v2_sparse_classes_30k_train_020777
Implement the Python class `MomentumBackPropagation` described below. Class description: Implement the MomentumBackPropagation class. Method signatures and docstrings: - def __init__(self, neural_network, learning_rate, momentum, max_error, max_iterations=None): :type neural_network: synapyse.base.neural_network.Neur...
Implement the Python class `MomentumBackPropagation` described below. Class description: Implement the MomentumBackPropagation class. Method signatures and docstrings: - def __init__(self, neural_network, learning_rate, momentum, max_error, max_iterations=None): :type neural_network: synapyse.base.neural_network.Neur...
8c9ff53ede2d83af27ce771ce1b6ea6a32155b02
<|skeleton|> class MomentumBackPropagation: def __init__(self, neural_network, learning_rate, momentum, max_error, max_iterations=None): """:type neural_network: synapyse.base.neural_network.NeuralNetwork :type learning_rate: float :type momentum: float :type max_error: float :type max_iterations: int""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MomentumBackPropagation: def __init__(self, neural_network, learning_rate, momentum, max_error, max_iterations=None): """:type neural_network: synapyse.base.neural_network.NeuralNetwork :type learning_rate: float :type momentum: float :type max_error: float :type max_iterations: int""" BackPro...
the_stack_v2_python_sparse
synapyse/impl/learning/momentum_back_propagation.py
dougefr/synapyse
train
4
cc8161ff336ab5dfec256f4aaf2b906862a9917e
[ "data = [1, 2, 3, 4, 5, 6, 7, 8]\nout = sliding_window(data, 3)\nnp.testing.assert_array_equal(out, [[1, 2, 3], [2, 3, 4], [3, 4, 5], [4, 5, 6], [5, 6, 7], [6, 7, 8]])\nout = sliding_window(data, 3, hop=2)\nnp.testing.assert_array_equal(out, [[1, 2, 3], [3, 4, 5], [5, 6, 7]])\nout = sliding_window(data, 4, hop=3)\n...
<|body_start_0|> data = [1, 2, 3, 4, 5, 6, 7, 8] out = sliding_window(data, 3) np.testing.assert_array_equal(out, [[1, 2, 3], [2, 3, 4], [3, 4, 5], [4, 5, 6], [5, 6, 7], [6, 7, 8]]) out = sliding_window(data, 3, hop=2) np.testing.assert_array_equal(out, [[1, 2, 3], [3, 4, 5], [5,...
SlidingWindowTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SlidingWindowTest: def test_sliding_window_basic(self): """Test basic calls of sliding_window where the input is 1D.""" <|body_0|> def test_sliding_window_multichannel(self): """Test where input is 2D, representing multiple channels.""" <|body_1|> def te...
stack_v2_sparse_classes_75kplus_train_002367
3,580
permissive
[ { "docstring": "Test basic calls of sliding_window where the input is 1D.", "name": "test_sliding_window_basic", "signature": "def test_sliding_window_basic(self)" }, { "docstring": "Test where input is 2D, representing multiple channels.", "name": "test_sliding_window_multichannel", "si...
4
stack_v2_sparse_classes_30k_train_025046
Implement the Python class `SlidingWindowTest` described below. Class description: Implement the SlidingWindowTest class. Method signatures and docstrings: - def test_sliding_window_basic(self): Test basic calls of sliding_window where the input is 1D. - def test_sliding_window_multichannel(self): Test where input is...
Implement the Python class `SlidingWindowTest` described below. Class description: Implement the SlidingWindowTest class. Method signatures and docstrings: - def test_sliding_window_basic(self): Test basic calls of sliding_window where the input is 1D. - def test_sliding_window_multichannel(self): Test where input is...
c13611b7a8d2ea80349be24bf54b2b50b9431347
<|skeleton|> class SlidingWindowTest: def test_sliding_window_basic(self): """Test basic calls of sliding_window where the input is 1D.""" <|body_0|> def test_sliding_window_multichannel(self): """Test where input is 2D, representing multiple channels.""" <|body_1|> def te...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SlidingWindowTest: def test_sliding_window_basic(self): """Test basic calls of sliding_window where the input is 1D.""" data = [1, 2, 3, 4, 5, 6, 7, 8] out = sliding_window(data, 3) np.testing.assert_array_equal(out, [[1, 2, 3], [2, 3, 4], [3, 4, 5], [4, 5, 6], [5, 6, 7], [6, 7...
the_stack_v2_python_sparse
extras/python/phonetics/sliding_window_test.py
google/audio-to-tactile
train
92
c7926cf5b6f542f9a08e18c13c0fc43279c34759
[ "self._picker = picker\nself._filters = filters\nself._uploader = uploader", "self._picker.initialize()\nself._picker.scan()\ntotal_picked = len(self._picker.picked_file_paths)\nself._uploader.initialize()\nfor key, filepath in enumerate(self._picker.picked_file_paths):\n rank = key + 1\n if len(self._filte...
<|body_start_0|> self._picker = picker self._filters = filters self._uploader = uploader <|end_body_0|> <|body_start_1|> self._picker.initialize() self._picker.scan() total_picked = len(self._picker.picked_file_paths) self._uploader.initialize() for key, ...
Select photos accorting to a chosen strategy and copy them to a chosen destination
PhotosPicker
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PhotosPicker: """Select photos accorting to a chosen strategy and copy them to a chosen destination""" def __init__(self, picker, filters, uploader): """Constructor :param AbstractPicker picker: photo selection strategy :param tuple filters: filters :param AbstractUploader uploader: ...
stack_v2_sparse_classes_75kplus_train_002368
2,479
permissive
[ { "docstring": "Constructor :param AbstractPicker picker: photo selection strategy :param tuple filters: filters :param AbstractUploader uploader: upload strategy", "name": "__init__", "signature": "def __init__(self, picker, filters, uploader)" }, { "docstring": "Run photo selection and upload"...
2
stack_v2_sparse_classes_30k_train_054047
Implement the Python class `PhotosPicker` described below. Class description: Select photos accorting to a chosen strategy and copy them to a chosen destination Method signatures and docstrings: - def __init__(self, picker, filters, uploader): Constructor :param AbstractPicker picker: photo selection strategy :param ...
Implement the Python class `PhotosPicker` described below. Class description: Select photos accorting to a chosen strategy and copy them to a chosen destination Method signatures and docstrings: - def __init__(self, picker, filters, uploader): Constructor :param AbstractPicker picker: photo selection strategy :param ...
6790e0411bb46e3206ca778dbd83ddd1d4f90f21
<|skeleton|> class PhotosPicker: """Select photos accorting to a chosen strategy and copy them to a chosen destination""" def __init__(self, picker, filters, uploader): """Constructor :param AbstractPicker picker: photo selection strategy :param tuple filters: filters :param AbstractUploader uploader: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PhotosPicker: """Select photos accorting to a chosen strategy and copy them to a chosen destination""" def __init__(self, picker, filters, uploader): """Constructor :param AbstractPicker picker: photo selection strategy :param tuple filters: filters :param AbstractUploader uploader: upload strate...
the_stack_v2_python_sparse
photospicker/photos_picker.py
l-vo/photos-picker
train
0
284b845b668cfc0d72c8a860873b77fe70f512b4
[ "self.output_dir = output_dir\nself.postfix = postfix\nself.ext = extension\nself.parent = parent\nself.makedirs = makedirs\nself.data_root_dir = data_root_dir", "full_name = create_file_basename(postfix=self.postfix, input_file_name=subject, folder_path=self.output_dir, data_root_dir=self.data_root_dir, separate...
<|body_start_0|> self.output_dir = output_dir self.postfix = postfix self.ext = extension self.parent = parent self.makedirs = makedirs self.data_root_dir = data_root_dir <|end_body_0|> <|body_start_1|> full_name = create_file_basename(postfix=self.postfix, input...
A utility class to create organized filenames within ``output_dir``. The ``filename`` method could be used to create a filename following the folder structure. Example: .. code-block:: python from monai.data import FolderLayout layout = FolderLayout( output_dir="/test_run_1/", postfix="seg", extension="nii", makedirs=F...
FolderLayout
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FolderLayout: """A utility class to create organized filenames within ``output_dir``. The ``filename`` method could be used to create a filename following the folder structure. Example: .. code-block:: python from monai.data import FolderLayout layout = FolderLayout( output_dir="/test_run_1/", po...
stack_v2_sparse_classes_75kplus_train_002369
6,344
permissive
[ { "docstring": "Args: output_dir: output directory. postfix: a postfix string for output file name appended to ``subject``. extension: output file extension to be appended to the end of an output filename. parent: whether to add a level of parent folder to contain each image to the output filename. makedirs: wh...
2
stack_v2_sparse_classes_30k_train_013733
Implement the Python class `FolderLayout` described below. Class description: A utility class to create organized filenames within ``output_dir``. The ``filename`` method could be used to create a filename following the folder structure. Example: .. code-block:: python from monai.data import FolderLayout layout = Fold...
Implement the Python class `FolderLayout` described below. Class description: A utility class to create organized filenames within ``output_dir``. The ``filename`` method could be used to create a filename following the folder structure. Example: .. code-block:: python from monai.data import FolderLayout layout = Fold...
e48c3e2c741fa3fc705c4425d17ac4a5afac6c47
<|skeleton|> class FolderLayout: """A utility class to create organized filenames within ``output_dir``. The ``filename`` method could be used to create a filename following the folder structure. Example: .. code-block:: python from monai.data import FolderLayout layout = FolderLayout( output_dir="/test_run_1/", po...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FolderLayout: """A utility class to create organized filenames within ``output_dir``. The ``filename`` method could be used to create a filename following the folder structure. Example: .. code-block:: python from monai.data import FolderLayout layout = FolderLayout( output_dir="/test_run_1/", postfix="seg", ...
the_stack_v2_python_sparse
monai/data/folder_layout.py
Project-MONAI/MONAI
train
4,805
221775e46bfc9a94113b43a325336df42cc86b26
[ "fields = df[cluster].unique()\ncluster_color = ['red', 'blue', 'green', 'orange', 'purple', 'yellow', 'skyblue', 'brown', 'black', 'grey']\nfig = df[df[cluster] == fields[0]].plot.scatter(x=field_x, y=field_y, color=cluster_color[0], label=cluster)\nfor i in range(len(fields) - 1):\n df[df[cluster] == fields[i ...
<|body_start_0|> fields = df[cluster].unique() cluster_color = ['red', 'blue', 'green', 'orange', 'purple', 'yellow', 'skyblue', 'brown', 'black', 'grey'] fig = df[df[cluster] == fields[0]].plot.scatter(x=field_x, y=field_y, color=cluster_color[0], label=cluster) for i in range(len(field...
Introduction --- 데이터 시각화 기능을 제공합니다. graph()로 초기화하는 것을 권장합니다. Methods --- plot(): 점 그래프 생성 violin_plot(): 바이올린 분포 그래프 생성 histogram(): 도수 분포 그래프 생성 heatmap(): 히트맵 생성
graph
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class graph: """Introduction --- 데이터 시각화 기능을 제공합니다. graph()로 초기화하는 것을 권장합니다. Methods --- plot(): 점 그래프 생성 violin_plot(): 바이올린 분포 그래프 생성 histogram(): 도수 분포 그래프 생성 heatmap(): 히트맵 생성""" def plot(self, df, field_x, field_y, cluster): """점 그래프를 생성합니다. 10가지 점 색상을 지원합니다. Parameters --- df: read()...
stack_v2_sparse_classes_75kplus_train_002370
5,109
no_license
[ { "docstring": "점 그래프를 생성합니다. 10가지 점 색상을 지원합니다. Parameters --- df: read()로부터 불러온 csv 파일이 저장된 객체 field_x: 그래프 x축으로 지정될 필드. \"필드 이름\" 형태로 입력 field_y: 그래프 y축으로 지정될 필드. \"필드 이름\" 형태로 입력 cluster: 점 그래프 위에 표시될 필드. \"필드 이름\" 형태로 입력", "name": "plot", "signature": "def plot(self, df, field_x, field_y, cluster)" ...
4
stack_v2_sparse_classes_30k_train_002593
Implement the Python class `graph` described below. Class description: Introduction --- 데이터 시각화 기능을 제공합니다. graph()로 초기화하는 것을 권장합니다. Methods --- plot(): 점 그래프 생성 violin_plot(): 바이올린 분포 그래프 생성 histogram(): 도수 분포 그래프 생성 heatmap(): 히트맵 생성 Method signatures and docstrings: - def plot(self, df, field_x, field_y, cluster): ...
Implement the Python class `graph` described below. Class description: Introduction --- 데이터 시각화 기능을 제공합니다. graph()로 초기화하는 것을 권장합니다. Methods --- plot(): 점 그래프 생성 violin_plot(): 바이올린 분포 그래프 생성 histogram(): 도수 분포 그래프 생성 heatmap(): 히트맵 생성 Method signatures and docstrings: - def plot(self, df, field_x, field_y, cluster): ...
de55db3b29500a365c7587c066887c192988b192
<|skeleton|> class graph: """Introduction --- 데이터 시각화 기능을 제공합니다. graph()로 초기화하는 것을 권장합니다. Methods --- plot(): 점 그래프 생성 violin_plot(): 바이올린 분포 그래프 생성 histogram(): 도수 분포 그래프 생성 heatmap(): 히트맵 생성""" def plot(self, df, field_x, field_y, cluster): """점 그래프를 생성합니다. 10가지 점 색상을 지원합니다. Parameters --- df: read()...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class graph: """Introduction --- 데이터 시각화 기능을 제공합니다. graph()로 초기화하는 것을 권장합니다. Methods --- plot(): 점 그래프 생성 violin_plot(): 바이올린 분포 그래프 생성 histogram(): 도수 분포 그래프 생성 heatmap(): 히트맵 생성""" def plot(self, df, field_x, field_y, cluster): """점 그래프를 생성합니다. 10가지 점 색상을 지원합니다. Parameters --- df: read()로부터 불러온 csv 파...
the_stack_v2_python_sparse
anna/aiclasslib.py
syool/sketchbook
train
0
42bdc6d18d3394296c471f8f39f4cd62f052516a
[ "super(TransformerFFN, self).__init__()\nself._dropout_rate = dropout_rate\nself._dense1 = nn.Linear(input_size, filter_size, bias=True)\nself._dense2 = nn.Linear(filter_size, output_size, bias=True)\nself._activation_fn = get_activation(activation)", "output = self._activation_fn(self._dense1(inputs))\noutput = ...
<|body_start_0|> super(TransformerFFN, self).__init__() self._dropout_rate = dropout_rate self._dense1 = nn.Linear(input_size, filter_size, bias=True) self._dense2 = nn.Linear(filter_size, output_size, bias=True) self._activation_fn = get_activation(activation) <|end_body_0|> <|...
Applies the position-wise feed-forward as described in https://arxiv.org/abs/1706.03762
TransformerFFN
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransformerFFN: """Applies the position-wise feed-forward as described in https://arxiv.org/abs/1706.03762""" def __init__(self, input_size, filter_size, output_size, dropout_rate, activation='relu'): """Initializes Transformer FFN. Args: input_size: The dimension of the input tensor...
stack_v2_sparse_classes_75kplus_train_002371
15,012
permissive
[ { "docstring": "Initializes Transformer FFN. Args: input_size: The dimension of the input tensor. filter_size: The hidden size of the relu layer. output_size: The output size. dropout_rate: The dropout rate. activation: The activation of internal layer.", "name": "__init__", "signature": "def __init__(s...
2
stack_v2_sparse_classes_30k_train_038713
Implement the Python class `TransformerFFN` described below. Class description: Applies the position-wise feed-forward as described in https://arxiv.org/abs/1706.03762 Method signatures and docstrings: - def __init__(self, input_size, filter_size, output_size, dropout_rate, activation='relu'): Initializes Transformer...
Implement the Python class `TransformerFFN` described below. Class description: Applies the position-wise feed-forward as described in https://arxiv.org/abs/1706.03762 Method signatures and docstrings: - def __init__(self, input_size, filter_size, output_size, dropout_rate, activation='relu'): Initializes Transformer...
06613a99305f02312a0e64ee3c3c50e7b00dcf0e
<|skeleton|> class TransformerFFN: """Applies the position-wise feed-forward as described in https://arxiv.org/abs/1706.03762""" def __init__(self, input_size, filter_size, output_size, dropout_rate, activation='relu'): """Initializes Transformer FFN. Args: input_size: The dimension of the input tensor...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TransformerFFN: """Applies the position-wise feed-forward as described in https://arxiv.org/abs/1706.03762""" def __init__(self, input_size, filter_size, output_size, dropout_rate, activation='relu'): """Initializes Transformer FFN. Args: input_size: The dimension of the input tensor. filter_size...
the_stack_v2_python_sparse
neurst/neurst_pt/layers/common_layers.py
ohlionel/Prune-Tune
train
12
e0257a70c0582da5e48164379ca164b518268c0e
[ "self.Path = '/proc/device-tree/aliases/mpr121'\nself.Mpr121Init = '/sys/bus/i2c/drivers/mpr121/2-005b/mpr121_init'\nself.Mpr121Data = '/sys/bus/i2c/drivers/mpr121/2-005b/mpr121_data'\ntry:\n if not os.path.exists(self.Path):\n InstallDTBO('BB-I2C2-mpr121')\n while not os.path.exists(self.Path):\n ...
<|body_start_0|> self.Path = '/proc/device-tree/aliases/mpr121' self.Mpr121Init = '/sys/bus/i2c/drivers/mpr121/2-005b/mpr121_init' self.Mpr121Data = '/sys/bus/i2c/drivers/mpr121/2-005b/mpr121_data' try: if not os.path.exists(self.Path): InstallDTBO('BB-I2C2-mp...
MPR121 12 Key Capacitive I2C Touch Sensor
MPR121
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MPR121: """MPR121 12 Key Capacitive I2C Touch Sensor""" def __init__(self): """Initialize the MPR121 using file python library""" <|body_0|> def parse_and_print_Input(self, Input): """Parse the raw data form MPR121 to List that describes which one is touched on 1...
stack_v2_sparse_classes_75kplus_train_002372
3,487
permissive
[ { "docstring": "Initialize the MPR121 using file python library", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Parse the raw data form MPR121 to List that describes which one is touched on 12 Key Capacitive I2C Touch Sensor. Input:raw data form MPR121 return:List that...
3
stack_v2_sparse_classes_30k_train_022170
Implement the Python class `MPR121` described below. Class description: MPR121 12 Key Capacitive I2C Touch Sensor Method signatures and docstrings: - def __init__(self): Initialize the MPR121 using file python library - def parse_and_print_Input(self, Input): Parse the raw data form MPR121 to List that describes whic...
Implement the Python class `MPR121` described below. Class description: MPR121 12 Key Capacitive I2C Touch Sensor Method signatures and docstrings: - def __init__(self): Initialize the MPR121 using file python library - def parse_and_print_Input(self, Input): Parse the raw data form MPR121 to List that describes whic...
48236dd6d24885b0d06287d47b1c31e4b55fd1bf
<|skeleton|> class MPR121: """MPR121 12 Key Capacitive I2C Touch Sensor""" def __init__(self): """Initialize the MPR121 using file python library""" <|body_0|> def parse_and_print_Input(self, Input): """Parse the raw data form MPR121 to List that describes which one is touched on 1...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MPR121: """MPR121 12 Key Capacitive I2C Touch Sensor""" def __init__(self): """Initialize the MPR121 using file python library""" self.Path = '/proc/device-tree/aliases/mpr121' self.Mpr121Init = '/sys/bus/i2c/drivers/mpr121/2-005b/mpr121_init' self.Mpr121Data = '/sys/bus/i...
the_stack_v2_python_sparse
PocketBeagle/Grove/Captouch.py
beagleboard/cloud9-examples
train
51
5dda1119c91fae0e6debdb8b063b15bbb6b35331
[ "self.k = k\nself.matrix = matrix\nself.standardMatrix = np.array(self.matrix.getMatrix())", "sl = self.matrix.getDivideStatus()\nnewMatrix = Matrix(con, self.matrix.getdivk())\ncl = newMatrix.getDivideStatus()\ncompareX = []\ncompareY = []\nnsl = np.array(sl)\nncl = np.array(cl)\nncompare = np.abs(nsl - ncl)\nif...
<|body_start_0|> self.k = k self.matrix = matrix self.standardMatrix = np.array(self.matrix.getMatrix()) <|end_body_0|> <|body_start_1|> sl = self.matrix.getDivideStatus() newMatrix = Matrix(con, self.matrix.getdivk()) cl = newMatrix.getDivideStatus() compareX = ...
groupTestController
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class groupTestController: def __init__(self, matrix, k): """Matrix 방법을 이용한 그룹화 진행 Args: matrix :: Matrix object 기준이 되는 메트릭스 k :: int 오차율을 조절""" <|body_0|> def conCheckGroup2(self, con): """현재의 메트릭스에 대하여 새로운 Contour에 대하여 같은 그룹인지 조사 Args: con :: RContour 조사하고자 하는 컨투어 Return...
stack_v2_sparse_classes_75kplus_train_002373
3,955
no_license
[ { "docstring": "Matrix 방법을 이용한 그룹화 진행 Args: matrix :: Matrix object 기준이 되는 메트릭스 k :: int 오차율을 조절", "name": "__init__", "signature": "def __init__(self, matrix, k)" }, { "docstring": "현재의 메트릭스에 대하여 새로운 Contour에 대하여 같은 그룹인지 조사 Args: con :: RContour 조사하고자 하는 컨투어 Returns: 포함 여부 :: Boolean 포함 - True,...
4
null
Implement the Python class `groupTestController` described below. Class description: Implement the groupTestController class. Method signatures and docstrings: - def __init__(self, matrix, k): Matrix 방법을 이용한 그룹화 진행 Args: matrix :: Matrix object 기준이 되는 메트릭스 k :: int 오차율을 조절 - def conCheckGroup2(self, con): 현재의 메트릭스에 대...
Implement the Python class `groupTestController` described below. Class description: Implement the groupTestController class. Method signatures and docstrings: - def __init__(self, matrix, k): Matrix 방법을 이용한 그룹화 진행 Args: matrix :: Matrix object 기준이 되는 메트릭스 k :: int 오차율을 조절 - def conCheckGroup2(self, con): 현재의 메트릭스에 대...
4c33179c8a820c9b08d95071f88e57db26238c60
<|skeleton|> class groupTestController: def __init__(self, matrix, k): """Matrix 방법을 이용한 그룹화 진행 Args: matrix :: Matrix object 기준이 되는 메트릭스 k :: int 오차율을 조절""" <|body_0|> def conCheckGroup2(self, con): """현재의 메트릭스에 대하여 새로운 Contour에 대하여 같은 그룹인지 조사 Args: con :: RContour 조사하고자 하는 컨투어 Return...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class groupTestController: def __init__(self, matrix, k): """Matrix 방법을 이용한 그룹화 진행 Args: matrix :: Matrix object 기준이 되는 메트릭스 k :: int 오차율을 조절""" self.k = k self.matrix = matrix self.standardMatrix = np.array(self.matrix.getMatrix()) def conCheckGroup2(self, con): """현재의 ...
the_stack_v2_python_sparse
groupingTool/tMatrix/groupTestController.py
louis-cho/StemFont-Plugin
train
0
3c30d4554b1013af19b7b35b68268411715019ec
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn EntitlementManagementSettings()", "from .access_package_external_user_lifecycle_action import AccessPackageExternalUserLifecycleAction\nfrom .entity import Entity\nfrom .access_package_external_user_lifecycle_action import AccessPackag...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return EntitlementManagementSettings() <|end_body_0|> <|body_start_1|> from .access_package_external_user_lifecycle_action import AccessPackageExternalUserLifecycleAction from .entity import En...
EntitlementManagementSettings
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EntitlementManagementSettings: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EntitlementManagementSettings: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator val...
stack_v2_sparse_classes_75kplus_train_002374
3,282
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: EntitlementManagementSettings", "name": "create_from_discriminator_value", "signature": "def create_from_dis...
3
stack_v2_sparse_classes_30k_train_012533
Implement the Python class `EntitlementManagementSettings` described below. Class description: Implement the EntitlementManagementSettings class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EntitlementManagementSettings: Creates a new instance of th...
Implement the Python class `EntitlementManagementSettings` described below. Class description: Implement the EntitlementManagementSettings class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EntitlementManagementSettings: Creates a new instance of th...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class EntitlementManagementSettings: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EntitlementManagementSettings: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator val...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EntitlementManagementSettings: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> EntitlementManagementSettings: """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_stack_v2_python_sparse
msgraph/generated/models/entitlement_management_settings.py
microsoftgraph/msgraph-sdk-python
train
135
707746385e561414d52c7e2c36c23d0979c010d8
[ "self.column = column\nself.colour1 = colour1\nself.colour2 = colour2\nself.categorical = False", "x = data[self.column].iget(index)\na = min(data[self.column])\nb = max(data[self.column])\nr1, g1, b1 = self.colour1\nr2, g2, b2 = self.colour2\nx_scaled = (x - a) / (b - a)\nreturn (r1 + (r2 - r1) * x_scaled, g1 + ...
<|body_start_0|> self.column = column self.colour1 = colour1 self.colour2 = colour2 self.categorical = False <|end_body_0|> <|body_start_1|> x = data[self.column].iget(index) a = min(data[self.column]) b = max(data[self.column]) r1, g1, b1 = self.colour1 ...
A mapping between a data attribute value and a point in colour space between two specified colours.
ScaleGradient
[ "Python-2.0", "Apache-2.0", "BSD-3-Clause", "LicenseRef-scancode-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScaleGradient: """A mapping between a data attribute value and a point in colour space between two specified colours.""" def __init__(self, column, colour1, colour2): """Initialize ScaleGradient instance. Parameters: ----------- column: string, pandas DataFrame column name colour1: t...
stack_v2_sparse_classes_75kplus_train_002375
30,022
permissive
[ { "docstring": "Initialize ScaleGradient instance. Parameters: ----------- column: string, pandas DataFrame column name colour1: tuple 3 element tuple with float values representing an RGB colour colour2: tuple 3 element tuple with float values representing an RGB colour", "name": "__init__", "signature...
2
null
Implement the Python class `ScaleGradient` described below. Class description: A mapping between a data attribute value and a point in colour space between two specified colours. Method signatures and docstrings: - def __init__(self, column, colour1, colour2): Initialize ScaleGradient instance. Parameters: ----------...
Implement the Python class `ScaleGradient` described below. Class description: A mapping between a data attribute value and a point in colour space between two specified colours. Method signatures and docstrings: - def __init__(self, column, colour1, colour2): Initialize ScaleGradient instance. Parameters: ----------...
2c9002f16bb5c265e0d14f4a2314c86eeaa35cb6
<|skeleton|> class ScaleGradient: """A mapping between a data attribute value and a point in colour space between two specified colours.""" def __init__(self, column, colour1, colour2): """Initialize ScaleGradient instance. Parameters: ----------- column: string, pandas DataFrame column name colour1: t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ScaleGradient: """A mapping between a data attribute value and a point in colour space between two specified colours.""" def __init__(self, column, colour1, colour2): """Initialize ScaleGradient instance. Parameters: ----------- column: string, pandas DataFrame column name colour1: tuple 3 elemen...
the_stack_v2_python_sparse
lib/python2.7/site-packages/pandas/tools/rplot.py
wangyum/Anaconda
train
11
cd45939921a9137f3d1bd6b5ff6846ec36087f3c
[ "output_file_name = 'sshd_config_analysis.txt'\noutput_file_path = os.path.join(self.output_dir, output_file_name)\noutput_evidence = ReportText(source_path=output_file_path)\nwith open(evidence.local_path, 'r') as input_file:\n sshd_config = input_file.read()\nreport, priority, summary = self.analyse_sshd_confi...
<|body_start_0|> output_file_name = 'sshd_config_analysis.txt' output_file_path = os.path.join(self.output_dir, output_file_name) output_evidence = ReportText(source_path=output_file_path) with open(evidence.local_path, 'r') as input_file: sshd_config = input_file.read() ...
Task to analyze a sshd_config file.
SSHDAnalysisTask
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SSHDAnalysisTask: """Task to analyze a sshd_config file.""" def run(self, evidence, result): """Run the sshd_config analysis worker. Args: evidence (Evidence object): The evidence we will process. result (TurbiniaTaskResult): The object to place task results into. Returns: TurbiniaTa...
stack_v2_sparse_classes_75kplus_train_002376
3,612
permissive
[ { "docstring": "Run the sshd_config analysis worker. Args: evidence (Evidence object): The evidence we will process. result (TurbiniaTaskResult): The object to place task results into. Returns: TurbiniaTaskResult object.", "name": "run", "signature": "def run(self, evidence, result)" }, { "docst...
2
stack_v2_sparse_classes_30k_train_034499
Implement the Python class `SSHDAnalysisTask` described below. Class description: Task to analyze a sshd_config file. Method signatures and docstrings: - def run(self, evidence, result): Run the sshd_config analysis worker. Args: evidence (Evidence object): The evidence we will process. result (TurbiniaTaskResult): T...
Implement the Python class `SSHDAnalysisTask` described below. Class description: Task to analyze a sshd_config file. Method signatures and docstrings: - def run(self, evidence, result): Run the sshd_config analysis worker. Args: evidence (Evidence object): The evidence we will process. result (TurbiniaTaskResult): T...
e73717549c6919e869ce4963449c36f227e3ccd6
<|skeleton|> class SSHDAnalysisTask: """Task to analyze a sshd_config file.""" def run(self, evidence, result): """Run the sshd_config analysis worker. Args: evidence (Evidence object): The evidence we will process. result (TurbiniaTaskResult): The object to place task results into. Returns: TurbiniaTa...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SSHDAnalysisTask: """Task to analyze a sshd_config file.""" def run(self, evidence, result): """Run the sshd_config analysis worker. Args: evidence (Evidence object): The evidence we will process. result (TurbiniaTaskResult): The object to place task results into. Returns: TurbiniaTaskResult obje...
the_stack_v2_python_sparse
turbinia/workers/sshd.py
Ash515/turbinia
train
6
07e722aad14f035fc6c4408b2b49093b6fcc10f9
[ "super().__init__(compute_on_call=compute_on_call, prefix=prefix, suffix=suffix, num_classes=num_classes)\nself.compute_per_class_metrics = compute_per_class_metrics\nself.zero_division = zero_division\nself.num_classes = num_classes\nself.reset()", "kv_metrics = {}\nfor aggregation_name, aggregated_metrics in zi...
<|body_start_0|> super().__init__(compute_on_call=compute_on_call, prefix=prefix, suffix=suffix, num_classes=num_classes) self.compute_per_class_metrics = compute_per_class_metrics self.zero_division = zero_division self.num_classes = num_classes self.reset() <|end_body_0|> <|bo...
Metric that can collect statistics and count precision, recall, f1_score and support with it. Args: zero_division: value to set in case of zero division during metrics (precision, recall) computation; should be one of 0 or 1 compute_on_call: if True, allows compute metric's value on call compute_per_class_metrics: bool...
MulticlassPrecisionRecallF1SupportMetric
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MulticlassPrecisionRecallF1SupportMetric: """Metric that can collect statistics and count precision, recall, f1_score and support with it. Args: zero_division: value to set in case of zero division during metrics (precision, recall) computation; should be one of 0 or 1 compute_on_call: if True, a...
stack_v2_sparse_classes_75kplus_train_002377
34,447
permissive
[ { "docstring": "Init PrecisionRecallF1SupportMetric instance", "name": "__init__", "signature": "def __init__(self, zero_division: int=0, compute_on_call: bool=True, compute_per_class_metrics: bool=SETTINGS.compute_per_class_metrics, prefix: str=None, suffix: str=None, num_classes: Optional[int]=None) -...
6
stack_v2_sparse_classes_30k_train_049773
Implement the Python class `MulticlassPrecisionRecallF1SupportMetric` described below. Class description: Metric that can collect statistics and count precision, recall, f1_score and support with it. Args: zero_division: value to set in case of zero division during metrics (precision, recall) computation; should be on...
Implement the Python class `MulticlassPrecisionRecallF1SupportMetric` described below. Class description: Metric that can collect statistics and count precision, recall, f1_score and support with it. Args: zero_division: value to set in case of zero division during metrics (precision, recall) computation; should be on...
e99f90655d0efcf22559a46e928f0f98c9807ebf
<|skeleton|> class MulticlassPrecisionRecallF1SupportMetric: """Metric that can collect statistics and count precision, recall, f1_score and support with it. Args: zero_division: value to set in case of zero division during metrics (precision, recall) computation; should be one of 0 or 1 compute_on_call: if True, a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MulticlassPrecisionRecallF1SupportMetric: """Metric that can collect statistics and count precision, recall, f1_score and support with it. Args: zero_division: value to set in case of zero division during metrics (precision, recall) computation; should be one of 0 or 1 compute_on_call: if True, allows compute...
the_stack_v2_python_sparse
catalyst/metrics/_classification.py
catalyst-team/catalyst
train
3,038
e676da7c7facb9873ec2ee425eab071aa7704612
[ "super().__init__()\nself.alpha = alpha\nself.opponent_is_random = False\nself.next_random_defection_turn = None", "if not self.history:\n return C\nif len(self.history) < 56:\n if opponent.history[-1] == D or len(self.history) == 50:\n return D\n return C\np_value = chisquare([opponent.cooperatio...
<|body_start_0|> super().__init__() self.alpha = alpha self.opponent_is_random = False self.next_random_defection_turn = None <|end_body_0|> <|body_start_1|> if not self.history: return C if len(self.history) < 56: if opponent.history[-1] == D or ...
Submitted to Axelrod's first tournament by James Graaskamp. The description written in [Axelrod1980]_ is: > "This rule plays tit for tat for 50 moves, defects on move 51, and then > plays 5 more moves of tit for tat. A check is then made to see if the player > seems to be RANDOM, in which case it defects from then on. ...
FirstByGraaskamp
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FirstByGraaskamp: """Submitted to Axelrod's first tournament by James Graaskamp. The description written in [Axelrod1980]_ is: > "This rule plays tit for tat for 50 moves, defects on move 51, and then > plays 5 more moves of tit for tat. A check is then made to see if the player > seems to be RAN...
stack_v2_sparse_classes_75kplus_train_002378
38,204
permissive
[ { "docstring": "Parameters ---------- alpha: float The significant level of p-value from chi-squared test with alpha == 0.05 by default.", "name": "__init__", "signature": "def __init__(self, alpha: float=0.05) -> None" }, { "docstring": "This is the actual strategy", "name": "strategy", ...
2
null
Implement the Python class `FirstByGraaskamp` described below. Class description: Submitted to Axelrod's first tournament by James Graaskamp. The description written in [Axelrod1980]_ is: > "This rule plays tit for tat for 50 moves, defects on move 51, and then > plays 5 more moves of tit for tat. A check is then made...
Implement the Python class `FirstByGraaskamp` described below. Class description: Submitted to Axelrod's first tournament by James Graaskamp. The description written in [Axelrod1980]_ is: > "This rule plays tit for tat for 50 moves, defects on move 51, and then > plays 5 more moves of tit for tat. A check is then made...
fa748627cd4f0333bb2dbfcb1454372a78a9098a
<|skeleton|> class FirstByGraaskamp: """Submitted to Axelrod's first tournament by James Graaskamp. The description written in [Axelrod1980]_ is: > "This rule plays tit for tat for 50 moves, defects on move 51, and then > plays 5 more moves of tit for tat. A check is then made to see if the player > seems to be RAN...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FirstByGraaskamp: """Submitted to Axelrod's first tournament by James Graaskamp. The description written in [Axelrod1980]_ is: > "This rule plays tit for tat for 50 moves, defects on move 51, and then > plays 5 more moves of tit for tat. A check is then made to see if the player > seems to be RANDOM, in which...
the_stack_v2_python_sparse
axelrod/strategies/axelrod_first.py
Axelrod-Python/Axelrod
train
673
952ee74ca7e71f12727d19039de8fb972798ee3a
[ "if value.replace(tzinfo=None) < datetime.utcnow():\n raise ValueError('must be greater than `now`')\nchallenge_end: Optional[datetime] = values.get('challenge_end')\nif not challenge_end:\n return value\nif value > challenge_end:\n return value\nraise ValueError('must be greater than `challenge_end`')", ...
<|body_start_0|> if value.replace(tzinfo=None) < datetime.utcnow(): raise ValueError('must be greater than `now`') challenge_end: Optional[datetime] = values.get('challenge_end') if not challenge_end: return value if value > challenge_end: return value...
ChallengeIn
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChallengeIn: def vote_end_validator(cls, value: datetime, values: Dict[str, Any]) -> datetime: """Validate vote end date.""" <|body_0|> def challenge_end_validator(cls, value: datetime) -> datetime: """Validate challenge end date.""" <|body_1|> def name_...
stack_v2_sparse_classes_75kplus_train_002379
1,879
permissive
[ { "docstring": "Validate vote end date.", "name": "vote_end_validator", "signature": "def vote_end_validator(cls, value: datetime, values: Dict[str, Any]) -> datetime" }, { "docstring": "Validate challenge end date.", "name": "challenge_end_validator", "signature": "def challenge_end_val...
3
stack_v2_sparse_classes_30k_train_046497
Implement the Python class `ChallengeIn` described below. Class description: Implement the ChallengeIn class. Method signatures and docstrings: - def vote_end_validator(cls, value: datetime, values: Dict[str, Any]) -> datetime: Validate vote end date. - def challenge_end_validator(cls, value: datetime) -> datetime: V...
Implement the Python class `ChallengeIn` described below. Class description: Implement the ChallengeIn class. Method signatures and docstrings: - def vote_end_validator(cls, value: datetime, values: Dict[str, Any]) -> datetime: Validate vote end date. - def challenge_end_validator(cls, value: datetime) -> datetime: V...
82270d16835c970e42530133668e2a8ab047af31
<|skeleton|> class ChallengeIn: def vote_end_validator(cls, value: datetime, values: Dict[str, Any]) -> datetime: """Validate vote end date.""" <|body_0|> def challenge_end_validator(cls, value: datetime) -> datetime: """Validate challenge end date.""" <|body_1|> def name_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ChallengeIn: def vote_end_validator(cls, value: datetime, values: Dict[str, Any]) -> datetime: """Validate vote end date.""" if value.replace(tzinfo=None) < datetime.utcnow(): raise ValueError('must be greater than `now`') challenge_end: Optional[datetime] = values.get('cha...
the_stack_v2_python_sparse
app/models/api/challenge.py
beatMeDev/beatMeBackend
train
0
29a8ef5d16d36a084aa48b844086decb2d46544d
[ "print(validated_data)\nobj = Function.objects.create(**validated_data)\nreturn obj", "print(validated_data)\ni = instance[0]\nif validated_data['default_page'] == True:\n i.default_page = validated_data['default_page']\n i.save()\n return i\nelse:\n i.default_page = validated_data['default_page']\n ...
<|body_start_0|> print(validated_data) obj = Function.objects.create(**validated_data) return obj <|end_body_0|> <|body_start_1|> print(validated_data) i = instance[0] if validated_data['default_page'] == True: i.default_page = validated_data['default_page'] ...
首页功能
DefaultSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DefaultSerializer: """首页功能""" def create(self, validated_data): """保存操作""" <|body_0|> def update(self, instance, validated_data): """更新操作""" <|body_1|> <|end_skeleton|> <|body_start_0|> print(validated_data) obj = Function.objects.create...
stack_v2_sparse_classes_75kplus_train_002380
3,862
no_license
[ { "docstring": "保存操作", "name": "create", "signature": "def create(self, validated_data)" }, { "docstring": "更新操作", "name": "update", "signature": "def update(self, instance, validated_data)" } ]
2
null
Implement the Python class `DefaultSerializer` described below. Class description: 首页功能 Method signatures and docstrings: - def create(self, validated_data): 保存操作 - def update(self, instance, validated_data): 更新操作
Implement the Python class `DefaultSerializer` described below. Class description: 首页功能 Method signatures and docstrings: - def create(self, validated_data): 保存操作 - def update(self, instance, validated_data): 更新操作 <|skeleton|> class DefaultSerializer: """首页功能""" def create(self, validated_data): """...
3c18d5d5727db1562438edea66ef15f54b378e33
<|skeleton|> class DefaultSerializer: """首页功能""" def create(self, validated_data): """保存操作""" <|body_0|> def update(self, instance, validated_data): """更新操作""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DefaultSerializer: """首页功能""" def create(self, validated_data): """保存操作""" print(validated_data) obj = Function.objects.create(**validated_data) return obj def update(self, instance, validated_data): """更新操作""" print(validated_data) i = instanc...
the_stack_v2_python_sparse
up_down_chain/up_down_chain/app/Enterprise/serializables.py
wang18722/Up_down_chain
train
0
b8280732d0d27e1a21e673da020fd984020a8717
[ "self.capacity = capacity\nself.cache = {}\nself.cache_queue = collections.deque()", "if key not in self.cache:\n return -1\nself.cache_queue.remove(key)\nself.cache_queue.appendleft(key)\nreturn self.cache[key]", "if key in self.cache:\n self.cache[key] = value\n self.cache_queue.remove(key)\n self...
<|body_start_0|> self.capacity = capacity self.cache = {} self.cache_queue = collections.deque() <|end_body_0|> <|body_start_1|> if key not in self.cache: return -1 self.cache_queue.remove(key) self.cache_queue.appendleft(key) return self.cache[key] <...
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_75kplus_train_002381
1,182
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: None", "name": "pu...
3
null
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None <|sk...
5c2473f859da5efec73120256faad06ab8e0e359
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LRUCache: def __init__(self, capacity): """:type capacity: int""" self.capacity = capacity self.cache = {} self.cache_queue = collections.deque() def get(self, key): """:type key: int :rtype: int""" if key not in self.cache: return -1 se...
the_stack_v2_python_sparse
leetcode/lru_cache_deque.py
chlos/exercises_in_futility
train
0
0d8fc72faa7efe5cd73d236fe4e37f63d2f6370e
[ "request_data = request.GET\nsearch_value = request_data.get('search_value', '')\nper_page = int(request_data.get('per_page', 10))\npage = int(request_data.get('page', 1))\ntoken_result_object_list, msg = AccountBaseService().get_token_list(search_value, page, per_page)\nif token_result_object_list is not False:\n ...
<|body_start_0|> request_data = request.GET search_value = request_data.get('search_value', '') per_page = int(request_data.get('per_page', 10)) page = int(request_data.get('page', 1)) token_result_object_list, msg = AccountBaseService().get_token_list(search_value, page, per_pag...
LoonAppTokenView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoonAppTokenView: def get(self, request, *args, **kwargs): """调用权限列表 :param request: :param args: :param kwargs: :return:""" <|body_0|> def post(self, request, *args, **kwargs): """新增调用权限记录 :param request: :param args: :param kwargs: :return:""" <|body_1|> <...
stack_v2_sparse_classes_75kplus_train_002382
8,689
permissive
[ { "docstring": "调用权限列表 :param request: :param args: :param kwargs: :return:", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "新增调用权限记录 :param request: :param args: :param kwargs: :return:", "name": "post", "signature": "def post(self, request, *ar...
2
stack_v2_sparse_classes_30k_val_001629
Implement the Python class `LoonAppTokenView` described below. Class description: Implement the LoonAppTokenView class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): 调用权限列表 :param request: :param args: :param kwargs: :return: - def post(self, request, *args, **kwargs): 新增调用权限记录 :param r...
Implement the Python class `LoonAppTokenView` described below. Class description: Implement the LoonAppTokenView class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): 调用权限列表 :param request: :param args: :param kwargs: :return: - def post(self, request, *args, **kwargs): 新增调用权限记录 :param r...
14d29d6669a6538fe176792d001710616719d050
<|skeleton|> class LoonAppTokenView: def get(self, request, *args, **kwargs): """调用权限列表 :param request: :param args: :param kwargs: :return:""" <|body_0|> def post(self, request, *args, **kwargs): """新增调用权限记录 :param request: :param args: :param kwargs: :return:""" <|body_1|> <...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LoonAppTokenView: def get(self, request, *args, **kwargs): """调用权限列表 :param request: :param args: :param kwargs: :return:""" request_data = request.GET search_value = request_data.get('search_value', '') per_page = int(request_data.get('per_page', 10)) page = int(reques...
the_stack_v2_python_sparse
apps/account/views.py
Rgcsh/loonflow_custom
train
2
58866ee60673eaf9f16a9b87092f67b90f6198da
[ "Report.__init__(self, database, options, user)\nself._user = user\nmenu = options.menu\nself.title_string = menu.get_option_by_name('title').get_value()\nself.image_size = menu.get_option_by_name('imgsize').get_value()\nself.subtitle_string = menu.get_option_by_name('subtitle').get_value()\nself.footer_string = me...
<|body_start_0|> Report.__init__(self, database, options, user) self._user = user menu = options.menu self.title_string = menu.get_option_by_name('title').get_value() self.image_size = menu.get_option_by_name('imgsize').get_value() self.subtitle_string = menu.get_option_b...
This report class generates a title page for a book.
SimpleBookTitle
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleBookTitle: """This report class generates a title page for a book.""" def __init__(self, database, options, user): """Create SimpleBookTitle object that produces the report. The arguments are: database - the GRAMPS database instance options - instance of the Options class for t...
stack_v2_sparse_classes_75kplus_train_002383
7,532
no_license
[ { "docstring": "Create SimpleBookTitle object that produces the report. The arguments are: database - the GRAMPS database instance options - instance of the Options class for this report user - a gen.user.User() instance This report needs the following parameters (class variables) that come in the options class...
2
stack_v2_sparse_classes_30k_train_049671
Implement the Python class `SimpleBookTitle` described below. Class description: This report class generates a title page for a book. Method signatures and docstrings: - def __init__(self, database, options, user): Create SimpleBookTitle object that produces the report. The arguments are: database - the GRAMPS databa...
Implement the Python class `SimpleBookTitle` described below. Class description: This report class generates a title page for a book. Method signatures and docstrings: - def __init__(self, database, options, user): Create SimpleBookTitle object that produces the report. The arguments are: database - the GRAMPS databa...
0c79561bed7ff42c88714edbc85197fa9235e188
<|skeleton|> class SimpleBookTitle: """This report class generates a title page for a book.""" def __init__(self, database, options, user): """Create SimpleBookTitle object that produces the report. The arguments are: database - the GRAMPS database instance options - instance of the Options class for t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SimpleBookTitle: """This report class generates a title page for a book.""" def __init__(self, database, options, user): """Create SimpleBookTitle object that produces the report. The arguments are: database - the GRAMPS database instance options - instance of the Options class for this report us...
the_stack_v2_python_sparse
plugins/textreport/simplebooktitle.py
balrok/gramps_addon
train
2
78ca57b0cd4b5e98763cc8cb9d1a436220c8082f
[ "if isinstance(infr_type, Infraction):\n return infr_type\nreturn Infraction[infr_type.replace(' ', '_').upper()]", "if self.infraction_type == Infraction.NONE and (ctx.dm_content or ctx.dm_embed):\n dm_content = ctx.dm_content\n dm_embed = ctx.dm_embed\nelse:\n dm_content = self.dm_content\n dm_em...
<|body_start_0|> if isinstance(infr_type, Infraction): return infr_type return Infraction[infr_type.replace(' ', '_').upper()] <|end_body_0|> <|body_start_1|> if self.infraction_type == Infraction.NONE and (ctx.dm_content or ctx.dm_embed): dm_content = ctx.dm_content ...
A setting entry which specifies what infraction to issue and the notification to DM the user. Since a DM cannot be sent when a user is banned or kicked, these two functions need to be grouped together.
InfractionAndNotification
[ "MIT", "BSD-3-Clause", "Python-2.0", "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InfractionAndNotification: """A setting entry which specifies what infraction to issue and the notification to DM the user. Since a DM cannot be sent when a user is banned or kicked, these two functions need to be grouped together.""" def convert_infraction_name(cls, infr_type: str | Infract...
stack_v2_sparse_classes_75kplus_train_002384
10,642
permissive
[ { "docstring": "Convert the string to an Infraction by name.", "name": "convert_infraction_name", "signature": "def convert_infraction_name(cls, infr_type: str | Infraction) -> Infraction" }, { "docstring": "Send the notification to the user.", "name": "send_message", "signature": "async...
4
stack_v2_sparse_classes_30k_train_029346
Implement the Python class `InfractionAndNotification` described below. Class description: A setting entry which specifies what infraction to issue and the notification to DM the user. Since a DM cannot be sent when a user is banned or kicked, these two functions need to be grouped together. Method signatures and doc...
Implement the Python class `InfractionAndNotification` described below. Class description: A setting entry which specifies what infraction to issue and the notification to DM the user. Since a DM cannot be sent when a user is banned or kicked, these two functions need to be grouped together. Method signatures and doc...
f2048684291cc6358565e96ef3562512fbeb2505
<|skeleton|> class InfractionAndNotification: """A setting entry which specifies what infraction to issue and the notification to DM the user. Since a DM cannot be sent when a user is banned or kicked, these two functions need to be grouped together.""" def convert_infraction_name(cls, infr_type: str | Infract...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InfractionAndNotification: """A setting entry which specifies what infraction to issue and the notification to DM the user. Since a DM cannot be sent when a user is banned or kicked, these two functions need to be grouped together.""" def convert_infraction_name(cls, infr_type: str | Infraction) -> Infra...
the_stack_v2_python_sparse
bot/exts/filtering/_settings_types/actions/infraction_and_notification.py
python-discord/bot
train
1,479
dea0c1b489c3656fe8604479cde8034634debd39
[ "self.experiments = experiments\nself.job_method = job_method\nnp.random.seed(os.getpid())", "completed_experiments = []\nt0 = time()\nfor i, ex in enumerate(self.experiments):\n completed_experiments.append(self.job_method(ex))\n t1 = time()\n avg_runtime = (t1 - t0) / (i + 1)\n tot_runtime = avg_run...
<|body_start_0|> self.experiments = experiments self.job_method = job_method np.random.seed(os.getpid()) <|end_body_0|> <|body_start_1|> completed_experiments = [] t0 = time() for i, ex in enumerate(self.experiments): completed_experiments.append(self.job_met...
ExperimentDispatcher
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExperimentDispatcher: def __init__(self, experiments, job_method): """Set up a batch of experiments, aka job :param experiments: List of experiment objects :param job_method: Method to call on the experiment objects. It is expected to return the experiment object itself.""" <|bod...
stack_v2_sparse_classes_75kplus_train_002385
9,967
permissive
[ { "docstring": "Set up a batch of experiments, aka job :param experiments: List of experiment objects :param job_method: Method to call on the experiment objects. It is expected to return the experiment object itself.", "name": "__init__", "signature": "def __init__(self, experiments, job_method)" }, ...
3
stack_v2_sparse_classes_30k_train_040806
Implement the Python class `ExperimentDispatcher` described below. Class description: Implement the ExperimentDispatcher class. Method signatures and docstrings: - def __init__(self, experiments, job_method): Set up a batch of experiments, aka job :param experiments: List of experiment objects :param job_method: Meth...
Implement the Python class `ExperimentDispatcher` described below. Class description: Implement the ExperimentDispatcher class. Method signatures and docstrings: - def __init__(self, experiments, job_method): Set up a batch of experiments, aka job :param experiments: List of experiment objects :param job_method: Meth...
7c0625846678f3c9e678b85ef77c9922ad91b257
<|skeleton|> class ExperimentDispatcher: def __init__(self, experiments, job_method): """Set up a batch of experiments, aka job :param experiments: List of experiment objects :param job_method: Method to call on the experiment objects. It is expected to return the experiment object itself.""" <|bod...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ExperimentDispatcher: def __init__(self, experiments, job_method): """Set up a batch of experiments, aka job :param experiments: List of experiment objects :param job_method: Method to call on the experiment objects. It is expected to return the experiment object itself.""" self.experiments = ...
the_stack_v2_python_sparse
RunExperiments.py
yiboliu31/non-overlapping-extrinsic-cameracalibration
train
0
9f344c3bcd548ec71334236123307fc83592908a
[ "self.setpoint_time_scale = setpoint_time_scale\nself.price_time_scale = price_time_scale\nself.price_data = None\nself.setpoint_data = None\nif price_data_path is not None:\n self.price_data = pd.read_csv(price_data_path).values\n print('START TIME: ', self.price_data[0][0].replace('.', ':'))\nif setpoint_da...
<|body_start_0|> self.setpoint_time_scale = setpoint_time_scale self.price_time_scale = price_time_scale self.price_data = None self.setpoint_data = None if price_data_path is not None: self.price_data = pd.read_csv(price_data_path).values print('START TIM...
Market data (price and setpoints) loader.
MarketDataLoader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MarketDataLoader: """Market data (price and setpoints) loader.""" def __init__(self, price_data_path=None, setpoint_data_path=None, config=None, setpoint_time_scale=1, price_time_scale=60): """Market data loader builder. Args: price_data_path(str): setpoint_data_path(str):""" ...
stack_v2_sparse_classes_75kplus_train_002386
9,167
no_license
[ { "docstring": "Market data loader builder. Args: price_data_path(str): setpoint_data_path(str):", "name": "__init__", "signature": "def __init__(self, price_data_path=None, setpoint_data_path=None, config=None, setpoint_time_scale=1, price_time_scale=60)" }, { "docstring": "Get setpoint data of...
3
null
Implement the Python class `MarketDataLoader` described below. Class description: Market data (price and setpoints) loader. Method signatures and docstrings: - def __init__(self, price_data_path=None, setpoint_data_path=None, config=None, setpoint_time_scale=1, price_time_scale=60): Market data loader builder. Args: ...
Implement the Python class `MarketDataLoader` described below. Class description: Market data (price and setpoints) loader. Method signatures and docstrings: - def __init__(self, price_data_path=None, setpoint_data_path=None, config=None, setpoint_time_scale=1, price_time_scale=60): Market data loader builder. Args: ...
6eebe17ef55d3e35acb4ae761ef4d2340f8212e6
<|skeleton|> class MarketDataLoader: """Market data (price and setpoints) loader.""" def __init__(self, price_data_path=None, setpoint_data_path=None, config=None, setpoint_time_scale=1, price_time_scale=60): """Market data loader builder. Args: price_data_path(str): setpoint_data_path(str):""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MarketDataLoader: """Market data (price and setpoints) loader.""" def __init__(self, price_data_path=None, setpoint_data_path=None, config=None, setpoint_time_scale=1, price_time_scale=60): """Market data loader builder. Args: price_data_path(str): setpoint_data_path(str):""" self.setpoin...
the_stack_v2_python_sparse
algo/market.py
verahsu860604/aesda
train
1
a1648c1a2bb9f3e5b92a87bc73a7821785155aea
[ "encryption_validator = EncryptionValidationHandler()\nencryption_processor = EncryptionProccessorHandler()\nencryption_resulter = EncryptionResultHandler()\nencryption_validator.set_handler(encryption_processor)\nencryption_processor.set_handler(encryption_resulter)\ndecryption_validator = DecryptionValidationHand...
<|body_start_0|> encryption_validator = EncryptionValidationHandler() encryption_processor = EncryptionProccessorHandler() encryption_resulter = EncryptionResultHandler() encryption_validator.set_handler(encryption_processor) encryption_processor.set_handler(encryption_resulter) ...
Crypto
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Crypto: def __init__(self): """Sets up the chain of responsibility.""" <|body_0|> def execute_request(self, request: Request): """Execute the corrrect chain of responsibility handler depending on Encryption or Decryption Mode. :param request: the Request to pass to h...
stack_v2_sparse_classes_75kplus_train_002387
11,978
no_license
[ { "docstring": "Sets up the chain of responsibility.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Execute the corrrect chain of responsibility handler depending on Encryption or Decryption Mode. :param request: the Request to pass to handlers. :return:", "name":...
2
stack_v2_sparse_classes_30k_train_023398
Implement the Python class `Crypto` described below. Class description: Implement the Crypto class. Method signatures and docstrings: - def __init__(self): Sets up the chain of responsibility. - def execute_request(self, request: Request): Execute the corrrect chain of responsibility handler depending on Encryption o...
Implement the Python class `Crypto` described below. Class description: Implement the Crypto class. Method signatures and docstrings: - def __init__(self): Sets up the chain of responsibility. - def execute_request(self, request: Request): Execute the corrrect chain of responsibility handler depending on Encryption o...
00fb890bb9d39859af2211db1f2bd783fcb04d2d
<|skeleton|> class Crypto: def __init__(self): """Sets up the chain of responsibility.""" <|body_0|> def execute_request(self, request: Request): """Execute the corrrect chain of responsibility handler depending on Encryption or Decryption Mode. :param request: the Request to pass to h...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Crypto: def __init__(self): """Sets up the chain of responsibility.""" encryption_validator = EncryptionValidationHandler() encryption_processor = EncryptionProccessorHandler() encryption_resulter = EncryptionResultHandler() encryption_validator.set_handler(encryption_p...
the_stack_v2_python_sparse
Labs/Lab9/crypto.py
ZenenHornstein/3522_A01185704
train
0
bccb9f94cd6ab24551ad1aa5b0aebb88c3673991
[ "self.setMassFrac('NI', 0.325)\nself.setMassFrac('CR', 0.21)\nself.setMassFrac('C', 0.00075)\nself.setMassFrac('MN', 0.015)\nself.setMassFrac('S', 0.00015)\nself.setMassFrac('SI', 0.01)\nself.setMassFrac('CU', 0.0075)\nself.setMassFrac('AL', 0.00375)\nself.setMassFrac('TI', 0.00375)\nself.setMassFrac('FE', 1.0 - su...
<|body_start_0|> self.setMassFrac('NI', 0.325) self.setMassFrac('CR', 0.21) self.setMassFrac('C', 0.00075) self.setMassFrac('MN', 0.015) self.setMassFrac('S', 0.00015) self.setMassFrac('SI', 0.01) self.setMassFrac('CU', 0.0075) self.setMassFrac('AL', 0.003...
Incoloy 800/800H (UNS N08800/N08810). .. [SM] Special Metals - Incoloy alloy 800 (https://www.specialmetals.com/assets/smc/documents/alloys/incoloy/incoloy-alloy-800.pdf)
Inconel800
[ "Apache-2.0", "GPL-1.0-or-later", "BSD-3-Clause", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Inconel800: """Incoloy 800/800H (UNS N08800/N08810). .. [SM] Special Metals - Incoloy alloy 800 (https://www.specialmetals.com/assets/smc/documents/alloys/incoloy/incoloy-alloy-800.pdf)""" def setDefaultMassFracs(self): """Incoloy 800H mass fractions. From [SM]_.""" <|body_0|...
stack_v2_sparse_classes_75kplus_train_002388
2,857
permissive
[ { "docstring": "Incoloy 800H mass fractions. From [SM]_.", "name": "setDefaultMassFracs", "signature": "def setDefaultMassFracs(self)" }, { "docstring": "average thermal expansion dL/L. Used for computing hot dimensions. Parameters ---------- Tk : float temperature in (K) Tc : float Temperature ...
3
stack_v2_sparse_classes_30k_train_015037
Implement the Python class `Inconel800` described below. Class description: Incoloy 800/800H (UNS N08800/N08810). .. [SM] Special Metals - Incoloy alloy 800 (https://www.specialmetals.com/assets/smc/documents/alloys/incoloy/incoloy-alloy-800.pdf) Method signatures and docstrings: - def setDefaultMassFracs(self): Inco...
Implement the Python class `Inconel800` described below. Class description: Incoloy 800/800H (UNS N08800/N08810). .. [SM] Special Metals - Incoloy alloy 800 (https://www.specialmetals.com/assets/smc/documents/alloys/incoloy/incoloy-alloy-800.pdf) Method signatures and docstrings: - def setDefaultMassFracs(self): Inco...
360791847227df3f3a337a996ef561e00f846a09
<|skeleton|> class Inconel800: """Incoloy 800/800H (UNS N08800/N08810). .. [SM] Special Metals - Incoloy alloy 800 (https://www.specialmetals.com/assets/smc/documents/alloys/incoloy/incoloy-alloy-800.pdf)""" def setDefaultMassFracs(self): """Incoloy 800H mass fractions. From [SM]_.""" <|body_0|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Inconel800: """Incoloy 800/800H (UNS N08800/N08810). .. [SM] Special Metals - Incoloy alloy 800 (https://www.specialmetals.com/assets/smc/documents/alloys/incoloy/incoloy-alloy-800.pdf)""" def setDefaultMassFracs(self): """Incoloy 800H mass fractions. From [SM]_.""" self.setMassFrac('NI',...
the_stack_v2_python_sparse
armi/materials/inconel800.py
terrapower/armi
train
204
77541a206df1eade4bd31f98a04bacaf070e4b71
[ "super().__init__(coordinator, serial)\nself._attr_unique_id = f'{serial}_{description.key}'\nself.entity_description = description\nself._attr_is_on = False\nself._delay_listener: Callable | None = None", "if not (last_state := (await self.async_get_last_state())):\n return\nself._attr_is_on = last_state.stat...
<|body_start_0|> super().__init__(coordinator, serial) self._attr_unique_id = f'{serial}_{description.key}' self.entity_description = description self._attr_is_on = False self._delay_listener: Callable | None = None <|end_body_0|> <|body_start_1|> if not (last_state := (...
Representation of a EZVIZ Siren entity.
EzvizSirenEntity
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EzvizSirenEntity: """Representation of a EZVIZ Siren entity.""" def __init__(self, coordinator: EzvizDataUpdateCoordinator, serial: str, description: SirenEntityDescription) -> None: """Initialize the Siren.""" <|body_0|> async def async_added_to_hass(self) -> None: ...
stack_v2_sparse_classes_75kplus_train_002389
4,462
permissive
[ { "docstring": "Initialize the Siren.", "name": "__init__", "signature": "def __init__(self, coordinator: EzvizDataUpdateCoordinator, serial: str, description: SirenEntityDescription) -> None" }, { "docstring": "Run when entity about to be added to hass.", "name": "async_added_to_hass", ...
5
stack_v2_sparse_classes_30k_train_015724
Implement the Python class `EzvizSirenEntity` described below. Class description: Representation of a EZVIZ Siren entity. Method signatures and docstrings: - def __init__(self, coordinator: EzvizDataUpdateCoordinator, serial: str, description: SirenEntityDescription) -> None: Initialize the Siren. - async def async_a...
Implement the Python class `EzvizSirenEntity` described below. Class description: Representation of a EZVIZ Siren entity. Method signatures and docstrings: - def __init__(self, coordinator: EzvizDataUpdateCoordinator, serial: str, description: SirenEntityDescription) -> None: Initialize the Siren. - async def async_a...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class EzvizSirenEntity: """Representation of a EZVIZ Siren entity.""" def __init__(self, coordinator: EzvizDataUpdateCoordinator, serial: str, description: SirenEntityDescription) -> None: """Initialize the Siren.""" <|body_0|> async def async_added_to_hass(self) -> None: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EzvizSirenEntity: """Representation of a EZVIZ Siren entity.""" def __init__(self, coordinator: EzvizDataUpdateCoordinator, serial: str, description: SirenEntityDescription) -> None: """Initialize the Siren.""" super().__init__(coordinator, serial) self._attr_unique_id = f'{serial...
the_stack_v2_python_sparse
homeassistant/components/ezviz/siren.py
home-assistant/core
train
35,501
94bca1698cb0999e911343a71874afa9ae7d63ae
[ "if graph.is_directed():\n raise ValueError('the graph is directed')\nself.graph = graph\nself.mate = dict(((node, None) for node in self.graph.iternodes()))\nself.cardinality = 0", "for edge in self.graph.iteredges():\n if self.mate[edge.source] is None and self.mate[edge.target] is None:\n self.mat...
<|body_start_0|> if graph.is_directed(): raise ValueError('the graph is directed') self.graph = graph self.mate = dict(((node, None) for node in self.graph.iternodes())) self.cardinality = 0 <|end_body_0|> <|body_start_1|> for edge in self.graph.iteredges(): ...
Find a maximal cardinality matching using a greedy method. Attributes ---------- graph : input undirected graph mate : dict with nodes (values are nodes or None) cardinality : number Notes ----- Based on ideas from NetworkX library: http://networkx.github.io/documentation/networkx-1.9.1/ _modules/networkx/algorithms/ma...
MaximalMatching
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MaximalMatching: """Find a maximal cardinality matching using a greedy method. Attributes ---------- graph : input undirected graph mate : dict with nodes (values are nodes or None) cardinality : number Notes ----- Based on ideas from NetworkX library: http://networkx.github.io/documentation/netw...
stack_v2_sparse_classes_75kplus_train_002390
3,502
permissive
[ { "docstring": "The algorithm initialization.", "name": "__init__", "signature": "def __init__(self, graph)" }, { "docstring": "Executable pseudocode.", "name": "run", "signature": "def run(self)" } ]
2
stack_v2_sparse_classes_30k_train_018696
Implement the Python class `MaximalMatching` described below. Class description: Find a maximal cardinality matching using a greedy method. Attributes ---------- graph : input undirected graph mate : dict with nodes (values are nodes or None) cardinality : number Notes ----- Based on ideas from NetworkX library: http:...
Implement the Python class `MaximalMatching` described below. Class description: Find a maximal cardinality matching using a greedy method. Attributes ---------- graph : input undirected graph mate : dict with nodes (values are nodes or None) cardinality : number Notes ----- Based on ideas from NetworkX library: http:...
0ff4ae303e8824e6bb8474d23b29a7b3e5ed8e60
<|skeleton|> class MaximalMatching: """Find a maximal cardinality matching using a greedy method. Attributes ---------- graph : input undirected graph mate : dict with nodes (values are nodes or None) cardinality : number Notes ----- Based on ideas from NetworkX library: http://networkx.github.io/documentation/netw...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MaximalMatching: """Find a maximal cardinality matching using a greedy method. Attributes ---------- graph : input undirected graph mate : dict with nodes (values are nodes or None) cardinality : number Notes ----- Based on ideas from NetworkX library: http://networkx.github.io/documentation/networkx-1.9.1/ _...
the_stack_v2_python_sparse
graphtheory/algorithms/matching.py
kgashok/graphs-dict
train
0
0f3e18a6db60a54ee705e25d88090299b13cadc2
[ "tok = line.strip().split()\nassert len(tok) == 10\nassert tok[0] == 'sugar:'\nself.uid = uid\nself.qid = tok[1]\nself.qstart = int(tok[2])\nself.qend = int(tok[3])\nself.qstrand = tok[4]\nself.sid = tok[5]\nself.sstart = int(tok[6])\nself.send = int(tok[7])\nself.sstrand = tok[8]\nself.score = int(tok[9])\nself.li...
<|body_start_0|> tok = line.strip().split() assert len(tok) == 10 assert tok[0] == 'sugar:' self.uid = uid self.qid = tok[1] self.qstart = int(tok[2]) self.qend = int(tok[3]) self.qstrand = tok[4] self.sid = tok[5] self.sstart = int(tok[6])...
exoneratehit
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class exoneratehit: def __init__(self, line, uid): """parse SUGAR hit from a line""" <|body_0|> def append(self, line, uid): """append a gff line to the result""" <|body_1|> <|end_skeleton|> <|body_start_0|> tok = line.strip().split() assert len(t...
stack_v2_sparse_classes_75kplus_train_002391
11,936
no_license
[ { "docstring": "parse SUGAR hit from a line", "name": "__init__", "signature": "def __init__(self, line, uid)" }, { "docstring": "append a gff line to the result", "name": "append", "signature": "def append(self, line, uid)" } ]
2
stack_v2_sparse_classes_30k_train_008422
Implement the Python class `exoneratehit` described below. Class description: Implement the exoneratehit class. Method signatures and docstrings: - def __init__(self, line, uid): parse SUGAR hit from a line - def append(self, line, uid): append a gff line to the result
Implement the Python class `exoneratehit` described below. Class description: Implement the exoneratehit class. Method signatures and docstrings: - def __init__(self, line, uid): parse SUGAR hit from a line - def append(self, line, uid): append a gff line to the result <|skeleton|> class exoneratehit: def __ini...
e006354ce41e6db029fb8cda02efaae60afc5327
<|skeleton|> class exoneratehit: def __init__(self, line, uid): """parse SUGAR hit from a line""" <|body_0|> def append(self, line, uid): """append a gff line to the result""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class exoneratehit: def __init__(self, line, uid): """parse SUGAR hit from a line""" tok = line.strip().split() assert len(tok) == 10 assert tok[0] == 'sugar:' self.uid = uid self.qid = tok[1] self.qstart = int(tok[2]) self.qend = int(tok[3]) s...
the_stack_v2_python_sparse
seq.py
robertvi/rjvbio
train
0
51653c73abb927b5bfcc8e093555351e79cb2e85
[ "super(TypeVerifier, self).__init__(**kwargs)\nif none_ok:\n self._valid_types = (type(None),) + valid_types\nelse:\n self._valid_types = valid_types", "if not isinstance(value, self._valid_types):\n raise errors.Config.InvalidValue('Invalid {0} value: \"{1}\" (of type \"{2}\"). Value must be one of the ...
<|body_start_0|> super(TypeVerifier, self).__init__(**kwargs) if none_ok: self._valid_types = (type(None),) + valid_types else: self._valid_types = valid_types <|end_body_0|> <|body_start_1|> if not isinstance(value, self._valid_types): raise errors.C...
Verifies that a config option value's type belongs to an allowed set. Passes value through unmodified.
TypeVerifier
[ "Classpath-exception-2.0", "BSD-3-Clause", "AGPL-3.0-only", "MIT", "GPL-2.0-only", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TypeVerifier: """Verifies that a config option value's type belongs to an allowed set. Passes value through unmodified.""" def __init__(self, valid_types, none_ok=False, **kwargs): """Initializes a TypeVerifier. Args: valid_types: tuple of allowed types. none_ok: boolean. If True, No...
stack_v2_sparse_classes_75kplus_train_002392
13,456
permissive
[ { "docstring": "Initializes a TypeVerifier. Args: valid_types: tuple of allowed types. none_ok: boolean. If True, None is also an allowed option value. **kwargs: Keyword arguments to pass to the base class.", "name": "__init__", "signature": "def __init__(self, valid_types, none_ok=False, **kwargs)" }...
2
stack_v2_sparse_classes_30k_train_013095
Implement the Python class `TypeVerifier` described below. Class description: Verifies that a config option value's type belongs to an allowed set. Passes value through unmodified. Method signatures and docstrings: - def __init__(self, valid_types, none_ok=False, **kwargs): Initializes a TypeVerifier. Args: valid_typ...
Implement the Python class `TypeVerifier` described below. Class description: Verifies that a config option value's type belongs to an allowed set. Passes value through unmodified. Method signatures and docstrings: - def __init__(self, valid_types, none_ok=False, **kwargs): Initializes a TypeVerifier. Args: valid_typ...
d0699f32998898757b036704fba39e5471641f01
<|skeleton|> class TypeVerifier: """Verifies that a config option value's type belongs to an allowed set. Passes value through unmodified.""" def __init__(self, valid_types, none_ok=False, **kwargs): """Initializes a TypeVerifier. Args: valid_types: tuple of allowed types. none_ok: boolean. If True, No...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TypeVerifier: """Verifies that a config option value's type belongs to an allowed set. Passes value through unmodified.""" def __init__(self, valid_types, none_ok=False, **kwargs): """Initializes a TypeVerifier. Args: valid_types: tuple of allowed types. none_ok: boolean. If True, None is also an...
the_stack_v2_python_sparse
perfkitbenchmarker/configs/option_decoders.py
GoogleCloudPlatform/PerfKitBenchmarker
train
1,923
0f761daf0f2f8a5e82eda6ed3436e3996294a8b0
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')" ]
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
定义域名类服务
DomainServicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DomainServicer: """定义域名类服务""" def Resolv(self, request, context): """定义域名解析方法, 资产需要解析IP存表""" <|body_0|> def Analysis(self, request, context): """定义域名查询、子域爆破方法""" <|body_1|> <|end_skeleton|> <|body_start_0|> context.set_code(grpc.StatusCode.UNIMP...
stack_v2_sparse_classes_75kplus_train_002393
15,079
no_license
[ { "docstring": "定义域名解析方法, 资产需要解析IP存表", "name": "Resolv", "signature": "def Resolv(self, request, context)" }, { "docstring": "定义域名查询、子域爆破方法", "name": "Analysis", "signature": "def Analysis(self, request, context)" } ]
2
stack_v2_sparse_classes_30k_val_001047
Implement the Python class `DomainServicer` described below. Class description: 定义域名类服务 Method signatures and docstrings: - def Resolv(self, request, context): 定义域名解析方法, 资产需要解析IP存表 - def Analysis(self, request, context): 定义域名查询、子域爆破方法
Implement the Python class `DomainServicer` described below. Class description: 定义域名类服务 Method signatures and docstrings: - def Resolv(self, request, context): 定义域名解析方法, 资产需要解析IP存表 - def Analysis(self, request, context): 定义域名查询、子域爆破方法 <|skeleton|> class DomainServicer: """定义域名类服务""" def Resolv(self, request...
c2389b6d9c47d9a1a2e63c8e0dc3fc132943b444
<|skeleton|> class DomainServicer: """定义域名类服务""" def Resolv(self, request, context): """定义域名解析方法, 资产需要解析IP存表""" <|body_0|> def Analysis(self, request, context): """定义域名查询、子域爆破方法""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DomainServicer: """定义域名类服务""" def Resolv(self, request, context): """定义域名解析方法, 资产需要解析IP存表""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') def Analysis(self, request,...
the_stack_v2_python_sparse
micro/proto/grpc/aquaman_pb2_grpc.py
jstang9527/buoy
train
2
68f426523efe3faa1262c0459a2b05294d258f7c
[ "kwargs = {}\ncurrent_key = None\nargs = deque(argv)\nwhile args:\n arg = args.popleft()\n if arg == '--':\n ArgumentHelper.set_kwargs_flag(kwargs, current_key)\n elif arg.startswith('--'):\n ArgumentHelper.set_kwargs_flag(kwargs, current_key)\n current_key = arg[2:]\n if '=' in...
<|body_start_0|> kwargs = {} current_key = None args = deque(argv) while args: arg = args.popleft() if arg == '--': ArgumentHelper.set_kwargs_flag(kwargs, current_key) elif arg.startswith('--'): ArgumentHelper.set_kwargs...
Helper for handling command line arguments.
ArgumentHelper
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArgumentHelper: """Helper for handling command line arguments.""" def argv_to_dict(argv): """Given a list of keyword arguments, parse into a kwargs dictionary. Each argument should either start with '--' indicating a key, or not, indicating a value. Also supports "--key=value" syntax...
stack_v2_sparse_classes_75kplus_train_002394
2,740
no_license
[ { "docstring": "Given a list of keyword arguments, parse into a kwargs dictionary. Each argument should either start with '--' indicating a key, or not, indicating a value. Also supports \"--key=value\" syntax. True will be used for the value of a key that does not have a given value. Multiple values will be jo...
3
stack_v2_sparse_classes_30k_train_002286
Implement the Python class `ArgumentHelper` described below. Class description: Helper for handling command line arguments. Method signatures and docstrings: - def argv_to_dict(argv): Given a list of keyword arguments, parse into a kwargs dictionary. Each argument should either start with '--' indicating a key, or no...
Implement the Python class `ArgumentHelper` described below. Class description: Helper for handling command line arguments. Method signatures and docstrings: - def argv_to_dict(argv): Given a list of keyword arguments, parse into a kwargs dictionary. Each argument should either start with '--' indicating a key, or no...
48a539bee8a58a007b20e6c034eb2145ec4e2a88
<|skeleton|> class ArgumentHelper: """Helper for handling command line arguments.""" def argv_to_dict(argv): """Given a list of keyword arguments, parse into a kwargs dictionary. Each argument should either start with '--' indicating a key, or not, indicating a value. Also supports "--key=value" syntax...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ArgumentHelper: """Helper for handling command line arguments.""" def argv_to_dict(argv): """Given a list of keyword arguments, parse into a kwargs dictionary. Each argument should either start with '--' indicating a key, or not, indicating a value. Also supports "--key=value" syntax. True will b...
the_stack_v2_python_sparse
herring/argument_helper.py
royw/Herring
train
0
c0709c5c31e7f9d512437e0ac0fe066f69e96560
[ "self.filters = filters\nself.kernel_size = kernel_size\nself.strides = [1] + list(strides) + [1]\nself.padding = padding\nself.use_bias = use_bias\nself.prior_std0 = prior_std\nself.learn_prior = learn_prior", "n_samples, (height, width, channels) = self._get_X_dims(X)\nW_shp, b_shp = self._weight_shapes(channel...
<|body_start_0|> self.filters = filters self.kernel_size = kernel_size self.strides = [1] + list(strides) + [1] self.padding = padding self.use_bias = use_bias self.prior_std0 = prior_std self.learn_prior = learn_prior <|end_body_0|> <|body_start_1|> n_sa...
A 2D convolution layer, with variational inference. (Does not currently support full covariance weights.) Parameters ---------- filters : int the dimension of the output of this layer (i.e. the number of filters in the convolution). kernel_size : int, tuple or list width and height of the 2D convolution window. Can be ...
Conv2DVariational
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Conv2DVariational: """A 2D convolution layer, with variational inference. (Does not currently support full covariance weights.) Parameters ---------- filters : int the dimension of the output of this layer (i.e. the number of filters in the convolution). kernel_size : int, tuple or list width and...
stack_v2_sparse_classes_75kplus_train_002395
43,510
permissive
[ { "docstring": "Create and instance of a variational Conv2D layer.", "name": "__init__", "signature": "def __init__(self, filters, kernel_size, strides=(1, 1), padding='SAME', prior_std='glorot', learn_prior=False, use_bias=True)" }, { "docstring": "Build the graph of this layer.", "name": "...
3
null
Implement the Python class `Conv2DVariational` described below. Class description: A 2D convolution layer, with variational inference. (Does not currently support full covariance weights.) Parameters ---------- filters : int the dimension of the output of this layer (i.e. the number of filters in the convolution). ker...
Implement the Python class `Conv2DVariational` described below. Class description: A 2D convolution layer, with variational inference. (Does not currently support full covariance weights.) Parameters ---------- filters : int the dimension of the output of this layer (i.e. the number of filters in the convolution). ker...
53a3de23dce4d607ffec92be936e83d2dd7ebb3c
<|skeleton|> class Conv2DVariational: """A 2D convolution layer, with variational inference. (Does not currently support full covariance weights.) Parameters ---------- filters : int the dimension of the output of this layer (i.e. the number of filters in the convolution). kernel_size : int, tuple or list width and...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Conv2DVariational: """A 2D convolution layer, with variational inference. (Does not currently support full covariance weights.) Parameters ---------- filters : int the dimension of the output of this layer (i.e. the number of filters in the convolution). kernel_size : int, tuple or list width and height of th...
the_stack_v2_python_sparse
aboleth/layers.py
LaplaceKorea/aboleth
train
0
85f5dcb94f83efee37f22eb98b701da3916b82d5
[ "data = {'lang': lang, 'sents': sents, 'engine': cf.engine(lang)}\ndoc_jsonify, resp = parse_sents(data)\ndomains = get_subj_domain(doc_jsonify)\nps = PredictSamples()\ntc.emp('cyan', f'result: {ps.check_domains(domains, lang)}')", "data = {'lang': lang, 'sents': sents, 'engine': cf.engine(lang)}\ndoc_jsonify, re...
<|body_start_0|> data = {'lang': lang, 'sents': sents, 'engine': cf.engine(lang)} doc_jsonify, resp = parse_sents(data) domains = get_subj_domain(doc_jsonify) ps = PredictSamples() tc.emp('cyan', f'result: {ps.check_domains(domains, lang)}') <|end_body_0|> <|body_start_1|> ...
PredictsCli
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PredictsCli: def check_subj(self, sents, lang): """$ python -m sagas.nlu.predicts_cli check_subj 'Яблоко - это здоровый фрукт.' ru :param sents: :param lang: :return:""" <|body_0|> def check_aux(self, sents, lang): """$ python -m sagas.nlu.predicts_cli check_aux 'wha...
stack_v2_sparse_classes_75kplus_train_002396
1,950
permissive
[ { "docstring": "$ python -m sagas.nlu.predicts_cli check_subj 'Яблоко - это здоровый фрукт.' ru :param sents: :param lang: :return:", "name": "check_subj", "signature": "def check_subj(self, sents, lang)" }, { "docstring": "$ python -m sagas.nlu.predicts_cli check_aux 'what will be the weather i...
2
null
Implement the Python class `PredictsCli` described below. Class description: Implement the PredictsCli class. Method signatures and docstrings: - def check_subj(self, sents, lang): $ python -m sagas.nlu.predicts_cli check_subj 'Яблоко - это здоровый фрукт.' ru :param sents: :param lang: :return: - def check_aux(self,...
Implement the Python class `PredictsCli` described below. Class description: Implement the PredictsCli class. Method signatures and docstrings: - def check_subj(self, sents, lang): $ python -m sagas.nlu.predicts_cli check_subj 'Яблоко - это здоровый фрукт.' ru :param sents: :param lang: :return: - def check_aux(self,...
9958d18ee5e75cf9794f546c904097dc1ff4f3a0
<|skeleton|> class PredictsCli: def check_subj(self, sents, lang): """$ python -m sagas.nlu.predicts_cli check_subj 'Яблоко - это здоровый фрукт.' ru :param sents: :param lang: :return:""" <|body_0|> def check_aux(self, sents, lang): """$ python -m sagas.nlu.predicts_cli check_aux 'wha...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PredictsCli: def check_subj(self, sents, lang): """$ python -m sagas.nlu.predicts_cli check_subj 'Яблоко - это здоровый фрукт.' ru :param sents: :param lang: :return:""" data = {'lang': lang, 'sents': sents, 'engine': cf.engine(lang)} doc_jsonify, resp = parse_sents(data) domai...
the_stack_v2_python_sparse
sagas/nlu/predicts_cli.py
samlet/stack
train
3
169c8e128077799fe50386bbcb79dcabe1cea2fb
[ "multiprocessing.Process.__init__(self)\nself.__tasks = tasks\nself.__results = results", "while True:\n task = self.__tasks.get()\n if task is None:\n self.__tasks.task_done()\n break\n data = 'Error'\n try:\n data = task.run()\n except Exception as e:\n print('Error: '...
<|body_start_0|> multiprocessing.Process.__init__(self) self.__tasks = tasks self.__results = results <|end_body_0|> <|body_start_1|> while True: task = self.__tasks.get() if task is None: self.__tasks.task_done() break ...
Worker Process
Worker
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Worker: """Worker Process""" def __init__(self, tasks, results): """constructor: init worker with task and result queue""" <|body_0|> def run(self): """gain tasks and compute them until ThreadPool sends termination signal""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_75kplus_train_002397
3,824
permissive
[ { "docstring": "constructor: init worker with task and result queue", "name": "__init__", "signature": "def __init__(self, tasks, results)" }, { "docstring": "gain tasks and compute them until ThreadPool sends termination signal", "name": "run", "signature": "def run(self)" } ]
2
stack_v2_sparse_classes_30k_train_015772
Implement the Python class `Worker` described below. Class description: Worker Process Method signatures and docstrings: - def __init__(self, tasks, results): constructor: init worker with task and result queue - def run(self): gain tasks and compute them until ThreadPool sends termination signal
Implement the Python class `Worker` described below. Class description: Worker Process Method signatures and docstrings: - def __init__(self, tasks, results): constructor: init worker with task and result queue - def run(self): gain tasks and compute them until ThreadPool sends termination signal <|skeleton|> class ...
995eea5145db9e35374c0bac9d6347c623f5c7f9
<|skeleton|> class Worker: """Worker Process""" def __init__(self, tasks, results): """constructor: init worker with task and result queue""" <|body_0|> def run(self): """gain tasks and compute them until ThreadPool sends termination signal""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Worker: """Worker Process""" def __init__(self, tasks, results): """constructor: init worker with task and result queue""" multiprocessing.Process.__init__(self) self.__tasks = tasks self.__results = results def run(self): """gain tasks and compute them until ...
the_stack_v2_python_sparse
networkit/profiling/multiprocessing_helper.py
networkit/networkit
train
505
ffbee323973492468ea5f4001cfd8cbb4fa7be35
[ "entity_id = GenericUUID(data.pop('id'))\nentity_dict = {'id': entity_id, **data}\nreturn entity_class(**entity_dict)", "data = dict(**entity.__dict__)\nentity_id = str(data.pop('id'))\nreturn model_class(**{'id': entity_id, 'data': data})" ]
<|body_start_0|> entity_id = GenericUUID(data.pop('id')) entity_dict = {'id': entity_id, **data} return entity_class(**entity_dict) <|end_body_0|> <|body_start_1|> data = dict(**entity.__dict__) entity_id = str(data.pop('id')) return model_class(**{'id': entity_id, 'data...
Used to serialize/deserialize entities from/to JSON data format
JSONDataMapper
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JSONDataMapper: """Used to serialize/deserialize entities from/to JSON data format""" def data_to_entity(self, data: dict, entity_class: type[Entity]) -> Entity: """Creates business entity from dictionary with a `data` attribute""" <|body_0|> def entity_to_data(self, ent...
stack_v2_sparse_classes_75kplus_train_002398
835
permissive
[ { "docstring": "Creates business entity from dictionary with a `data` attribute", "name": "data_to_entity", "signature": "def data_to_entity(self, data: dict, entity_class: type[Entity]) -> Entity" }, { "docstring": "Stores entity attributes in dictionary with a `data` attribute", "name": "e...
2
null
Implement the Python class `JSONDataMapper` described below. Class description: Used to serialize/deserialize entities from/to JSON data format Method signatures and docstrings: - def data_to_entity(self, data: dict, entity_class: type[Entity]) -> Entity: Creates business entity from dictionary with a `data` attribut...
Implement the Python class `JSONDataMapper` described below. Class description: Used to serialize/deserialize entities from/to JSON data format Method signatures and docstrings: - def data_to_entity(self, data: dict, entity_class: type[Entity]) -> Entity: Creates business entity from dictionary with a `data` attribut...
79f9558a8d6a7e97e7f7b3fdb084517fd43ee6b1
<|skeleton|> class JSONDataMapper: """Used to serialize/deserialize entities from/to JSON data format""" def data_to_entity(self, data: dict, entity_class: type[Entity]) -> Entity: """Creates business entity from dictionary with a `data` attribute""" <|body_0|> def entity_to_data(self, ent...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class JSONDataMapper: """Used to serialize/deserialize entities from/to JSON data format""" def data_to_entity(self, data: dict, entity_class: type[Entity]) -> Entity: """Creates business entity from dictionary with a `data` attribute""" entity_id = GenericUUID(data.pop('id')) entity_di...
the_stack_v2_python_sparse
src/seedwork/infrastructure/json_data_mapper.py
pgorecki/python-ddd
train
359
38bcb668b6e7c80f69241e27f5c6b76633808dd5
[ "if len(nums) == 0:\n return 0\npos = 0\nwhile pos < len(nums):\n if nums[pos] >= target:\n return pos\n pos += 1\nreturn len(nums)", "if len(nums) == 1:\n return int(target >= nums[0])\nelif len(nums) == 2:\n if target > nums[1]:\n return 2\n elif nums[0] < target <= nums[1]:\n ...
<|body_start_0|> if len(nums) == 0: return 0 pos = 0 while pos < len(nums): if nums[pos] >= target: return pos pos += 1 return len(nums) <|end_body_0|> <|body_start_1|> if len(nums) == 1: return int(target >= nums[0...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def searchInsert(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_0|> def searchInsert2(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_75kplus_train_002399
1,138
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: int", "name": "searchInsert", "signature": "def searchInsert(self, nums, target)" }, { "docstring": ":type nums: List[int] :type target: int :rtype: int", "name": "searchInsert2", "signature": "def searchInsert2(self, nums, ...
2
stack_v2_sparse_classes_30k_train_021982
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchInsert(self, nums, target): :type nums: List[int] :type target: int :rtype: int - def searchInsert2(self, nums, target): :type nums: List[int] :type target: int :rtype:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchInsert(self, nums, target): :type nums: List[int] :type target: int :rtype: int - def searchInsert2(self, nums, target): :type nums: List[int] :type target: int :rtype:...
9f53994d8a123003d5f12a76cf375982cee52806
<|skeleton|> class Solution: def searchInsert(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_0|> def searchInsert2(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def searchInsert(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" if len(nums) == 0: return 0 pos = 0 while pos < len(nums): if nums[pos] >= target: return pos pos += 1 return le...
the_stack_v2_python_sparse
Algorithms/Q35_Search_Insert_Position.py
filosfino/leetcode
train
1