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
467
8.64k
id
stringlengths
40
40
length_bytes
int64
515
49.7k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
160
3.93k
prompted_full_text
stringlengths
681
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.09k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
331
8.3k
source
stringclasses
1 value
source_path
stringlengths
5
177
source_repo
stringlengths
6
88
split
stringclasses
1 value
star_events_count
int64
0
209k
e1b40f9335eccda2dde8abf4d688c50215f0aa31
[ "self.cloud_domain_id = cloud_domain_id\nself.is_cad_mode = is_cad_mode\nself.migration_uid = migration_uid\nself.vault_id = vault_id\nself.view_box_id = view_box_id", "if dictionary is None:\n return None\ncloud_domain_id = dictionary.get('cloudDomainId')\nis_cad_mode = dictionary.get('isCadMode')\nmigration_...
<|body_start_0|> self.cloud_domain_id = cloud_domain_id self.is_cad_mode = is_cad_mode self.migration_uid = migration_uid self.vault_id = vault_id self.view_box_id = view_box_id <|end_body_0|> <|body_start_1|> if dictionary is None: return None cloud_...
Implementation of the 'CreateCloudDomainMigrationParameters' model. CreateCloudDomainMigrationParameters represents the parameters needed to schedule the cloud domain migration. Attributes: cloud_domain_id (long|int): Specifies the Id of a specific cloud domain present inside the vault, that needs to be migrated. If no...
CreateCloudDomainMigrationParameters
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreateCloudDomainMigrationParameters: """Implementation of the 'CreateCloudDomainMigrationParameters' model. CreateCloudDomainMigrationParameters represents the parameters needed to schedule the cloud domain migration. Attributes: cloud_domain_id (long|int): Specifies the Id of a specific cloud d...
stack_v2_sparse_classes_10k_train_001500
2,951
permissive
[ { "docstring": "Constructor for the CreateCloudDomainMigrationParameters class", "name": "__init__", "signature": "def __init__(self, cloud_domain_id=None, is_cad_mode=None, migration_uid=None, vault_id=None, view_box_id=None)" }, { "docstring": "Creates an instance of this model from a dictiona...
2
null
Implement the Python class `CreateCloudDomainMigrationParameters` described below. Class description: Implementation of the 'CreateCloudDomainMigrationParameters' model. CreateCloudDomainMigrationParameters represents the parameters needed to schedule the cloud domain migration. Attributes: cloud_domain_id (long|int):...
Implement the Python class `CreateCloudDomainMigrationParameters` described below. Class description: Implementation of the 'CreateCloudDomainMigrationParameters' model. CreateCloudDomainMigrationParameters represents the parameters needed to schedule the cloud domain migration. Attributes: cloud_domain_id (long|int):...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class CreateCloudDomainMigrationParameters: """Implementation of the 'CreateCloudDomainMigrationParameters' model. CreateCloudDomainMigrationParameters represents the parameters needed to schedule the cloud domain migration. Attributes: cloud_domain_id (long|int): Specifies the Id of a specific cloud d...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CreateCloudDomainMigrationParameters: """Implementation of the 'CreateCloudDomainMigrationParameters' model. CreateCloudDomainMigrationParameters represents the parameters needed to schedule the cloud domain migration. Attributes: cloud_domain_id (long|int): Specifies the Id of a specific cloud domain present...
the_stack_v2_python_sparse
cohesity_management_sdk/models/create_cloud_domain_migration_parameters.py
cohesity/management-sdk-python
train
24
f79c1fc0d7b3ce46ff545255bcb10a80ce40d2a3
[ "dict = json.loads(request.body.decode())\nreceiver = dict.get('receiver')\nprovince_id = dict.get('province_id')\ncity_id = dict.get('city_id')\ndistrict_id = dict.get('district_id')\nplace = dict.get('place')\nmobile = dict.get('mobile')\nphone = dict.get('tel')\nemail = dict.get('email')\nif not all([receiver, p...
<|body_start_0|> dict = json.loads(request.body.decode()) receiver = dict.get('receiver') province_id = dict.get('province_id') city_id = dict.get('city_id') district_id = dict.get('district_id') place = dict.get('place') mobile = dict.get('mobile') phone ...
UpdateDestroyAddressView
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateDestroyAddressView: def put(self, request, address_id): """更新某一个指定的地址""" <|body_0|> def delete(self, request, address_id): """删除对应的地址""" <|body_1|> <|end_skeleton|> <|body_start_0|> dict = json.loads(request.body.decode()) receiver = d...
stack_v2_sparse_classes_10k_train_001501
22,210
permissive
[ { "docstring": "更新某一个指定的地址", "name": "put", "signature": "def put(self, request, address_id)" }, { "docstring": "删除对应的地址", "name": "delete", "signature": "def delete(self, request, address_id)" } ]
2
stack_v2_sparse_classes_30k_train_004003
Implement the Python class `UpdateDestroyAddressView` described below. Class description: Implement the UpdateDestroyAddressView class. Method signatures and docstrings: - def put(self, request, address_id): 更新某一个指定的地址 - def delete(self, request, address_id): 删除对应的地址
Implement the Python class `UpdateDestroyAddressView` described below. Class description: Implement the UpdateDestroyAddressView class. Method signatures and docstrings: - def put(self, request, address_id): 更新某一个指定的地址 - def delete(self, request, address_id): 删除对应的地址 <|skeleton|> class UpdateDestroyAddressView: ...
e037bd86fd221e1a41a44059d148fe2f980ab0a5
<|skeleton|> class UpdateDestroyAddressView: def put(self, request, address_id): """更新某一个指定的地址""" <|body_0|> def delete(self, request, address_id): """删除对应的地址""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UpdateDestroyAddressView: def put(self, request, address_id): """更新某一个指定的地址""" dict = json.loads(request.body.decode()) receiver = dict.get('receiver') province_id = dict.get('province_id') city_id = dict.get('city_id') district_id = dict.get('district_id') ...
the_stack_v2_python_sparse
meiduo_mall/meiduo_mall/apps/users/views.py
wlyswh2010/meiduo_admin_project
train
0
a17927e3d2953aeb9956b37e9c1924ff3d06a7a1
[ "median = raw_scores[test_key]\nscore = 0\nif 'hostconn' == test_key:\n if median > 2:\n score = 100\n elif median == 2:\n score = 50\n else:\n score = 0\nelif 'maxconn' == test_key:\n if median > 20:\n score = 100\n elif median >= 10:\n score = 50\n else:\n ...
<|body_start_0|> median = raw_scores[test_key] score = 0 if 'hostconn' == test_key: if median > 2: score = 100 elif median == 2: score = 50 else: score = 0 elif 'maxconn' == test_key: if media...
CookiesTestSet
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CookiesTestSet: def GetTestScoreAndDisplayValue(self, test_key, raw_scores): """Get a normalized score (0 to 100) and a value to output to the display. Args: test_key: a key for a test_set test. raw_scores: a dict of raw_scores indexed by test keys. Returns: score, display_value # score ...
stack_v2_sparse_classes_10k_train_001502
7,631
permissive
[ { "docstring": "Get a normalized score (0 to 100) and a value to output to the display. Args: test_key: a key for a test_set test. raw_scores: a dict of raw_scores indexed by test keys. Returns: score, display_value # score is from 0 to 100. # display_value is the text for the cell.", "name": "GetTestScoreA...
2
stack_v2_sparse_classes_30k_train_005708
Implement the Python class `CookiesTestSet` described below. Class description: Implement the CookiesTestSet class. Method signatures and docstrings: - def GetTestScoreAndDisplayValue(self, test_key, raw_scores): Get a normalized score (0 to 100) and a value to output to the display. Args: test_key: a key for a test_...
Implement the Python class `CookiesTestSet` described below. Class description: Implement the CookiesTestSet class. Method signatures and docstrings: - def GetTestScoreAndDisplayValue(self, test_key, raw_scores): Get a normalized score (0 to 100) and a value to output to the display. Args: test_key: a key for a test_...
f0b3670d4692742d5f2e6cf605bce9b1a4b8ca1b
<|skeleton|> class CookiesTestSet: def GetTestScoreAndDisplayValue(self, test_key, raw_scores): """Get a normalized score (0 to 100) and a value to output to the display. Args: test_key: a key for a test_set test. raw_scores: a dict of raw_scores indexed by test keys. Returns: score, display_value # score ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CookiesTestSet: def GetTestScoreAndDisplayValue(self, test_key, raw_scores): """Get a normalized score (0 to 100) and a value to output to the display. Args: test_key: a key for a test_set test. raw_scores: a dict of raw_scores indexed by test keys. Returns: score, display_value # score is from 0 to 1...
the_stack_v2_python_sparse
categories/cookies/test_set.py
IIKovalenko/browserscope
train
1
70a77c4b3080e362ed380a83dca79f6e3af65637
[ "import bisect as bb\nri = [-1, -1]\ntmp_max = total = 0\ntmp_list = []\nbb.insort(tmp_list, (total, -1))\nfor i, v in enumerate(array):\n total += v\n tmp_total = total - tmp_list[0][0]\n if tmp_total > tmp_max:\n tmp_max = tmp_total\n ri[0] = tmp_list[0][1] + 1\n ri[1] = i\n bb.in...
<|body_start_0|> import bisect as bb ri = [-1, -1] tmp_max = total = 0 tmp_list = [] bb.insort(tmp_list, (total, -1)) for i, v in enumerate(array): total += v tmp_total = total - tmp_list[0][0] if tmp_total > tmp_max: tm...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def kadane(self, array): """:type array: List[int] :rtype: int""" <|body_0|> def kadane_2(self, array): """:type array: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> import bisect as bb ri = [-1, -1] ...
stack_v2_sparse_classes_10k_train_001503
1,498
no_license
[ { "docstring": ":type array: List[int] :rtype: int", "name": "kadane", "signature": "def kadane(self, array)" }, { "docstring": ":type array: List[int] :rtype: int", "name": "kadane_2", "signature": "def kadane_2(self, array)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def kadane(self, array): :type array: List[int] :rtype: int - def kadane_2(self, array): :type array: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def kadane(self, array): :type array: List[int] :rtype: int - def kadane_2(self, array): :type array: List[int] :rtype: int <|skeleton|> class Solution: def kadane(self, ar...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def kadane(self, array): """:type array: List[int] :rtype: int""" <|body_0|> def kadane_2(self, array): """:type array: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def kadane(self, array): """:type array: List[int] :rtype: int""" import bisect as bb ri = [-1, -1] tmp_max = total = 0 tmp_list = [] bb.insort(tmp_list, (total, -1)) for i, v in enumerate(array): total += v tmp_total = ...
the_stack_v2_python_sparse
dp/kadane.py
vsdrun/lc_public
train
6
4161be37879990afbde90764f69d9ed3a2e2ee31
[ "if cable not in ['straight', 'loopback']:\n raise ValueError(\"Cable can only be 'straight', or 'loopback'.\")\nsuper().__init__(mb_info, index, direction)\nself.cable = cable", "if cable not in ['straight', 'loopback']:\n raise ValueError(\"Cable can only be 'straight', or 'loopback'.\")\nself.cable = cab...
<|body_start_0|> if cable not in ['straight', 'loopback']: raise ValueError("Cable can only be 'straight', or 'loopback'.") super().__init__(mb_info, index, direction) self.cable = cable <|end_body_0|> <|body_start_1|> if cable not in ['straight', 'loopback']: ra...
This class can be used for a cable connecting Pmod interfaces. This class inherits from the Pmod IO class. Note ---- When 2 Pmods are connected using a cable, the parameter 'cable' decides whether the cable is a 'loopback' or 'straight' cable. The default is a straight cable (no internal wire twisting). For pin mapping...
Pmod_Cable
[ "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Pmod_Cable: """This class can be used for a cable connecting Pmod interfaces. This class inherits from the Pmod IO class. Note ---- When 2 Pmods are connected using a cable, the parameter 'cable' decides whether the cable is a 'loopback' or 'straight' cable. The default is a straight cable (no in...
stack_v2_sparse_classes_10k_train_001504
3,844
permissive
[ { "docstring": "Return a new instance of a Cable object. Only the cable type is checked during initialization, since all the other parameters are checked by Pmod IO class. Parameters ---------- mb_info : dict A dictionary storing Microblaze information, such as the IP name and the reset name. index: int The ind...
3
stack_v2_sparse_classes_30k_train_000140
Implement the Python class `Pmod_Cable` described below. Class description: This class can be used for a cable connecting Pmod interfaces. This class inherits from the Pmod IO class. Note ---- When 2 Pmods are connected using a cable, the parameter 'cable' decides whether the cable is a 'loopback' or 'straight' cable....
Implement the Python class `Pmod_Cable` described below. Class description: This class can be used for a cable connecting Pmod interfaces. This class inherits from the Pmod IO class. Note ---- When 2 Pmods are connected using a cable, the parameter 'cable' decides whether the cable is a 'loopback' or 'straight' cable....
de6b6fc3a803945d59f8f06523addfe0d9b60a1c
<|skeleton|> class Pmod_Cable: """This class can be used for a cable connecting Pmod interfaces. This class inherits from the Pmod IO class. Note ---- When 2 Pmods are connected using a cable, the parameter 'cable' decides whether the cable is a 'loopback' or 'straight' cable. The default is a straight cable (no in...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Pmod_Cable: """This class can be used for a cable connecting Pmod interfaces. This class inherits from the Pmod IO class. Note ---- When 2 Pmods are connected using a cable, the parameter 'cable' decides whether the cable is a 'loopback' or 'straight' cable. The default is a straight cable (no internal wire t...
the_stack_v2_python_sparse
pynq/lib/pmod/pmod_cable.py
schelleg/PYNQ
train
1
b3ea86eaca1c68187c9325ab5dd59af7ec26c478
[ "if isinstance(key, int):\n return Packet(key)\nif key not in Packet._member_map_:\n extend_enum(Packet, key, default)\nreturn Packet[key]", "if not (isinstance(value, int) and 0 <= value <= 127):\n raise ValueError('%r is not a valid %s' % (value, cls.__name__))\nif 5 <= value <= 15:\n extend_enum(cl...
<|body_start_0|> if isinstance(key, int): return Packet(key) if key not in Packet._member_map_: extend_enum(Packet, key, default) return Packet[key] <|end_body_0|> <|body_start_1|> if not (isinstance(value, int) and 0 <= value <= 127): raise ValueErro...
[Packet] HIP Packet Types
Packet
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Packet: """[Packet] HIP Packet Types""" def get(key, default=-1): """Backport support for original codes.""" <|body_0|> def _missing_(cls, value): """Lookup function used when value is not found.""" <|body_1|> <|end_skeleton|> <|body_start_0|> i...
stack_v2_sparse_classes_10k_train_001505
2,001
permissive
[ { "docstring": "Backport support for original codes.", "name": "get", "signature": "def get(key, default=-1)" }, { "docstring": "Lookup function used when value is not found.", "name": "_missing_", "signature": "def _missing_(cls, value)" } ]
2
stack_v2_sparse_classes_30k_train_006961
Implement the Python class `Packet` described below. Class description: [Packet] HIP Packet Types Method signatures and docstrings: - def get(key, default=-1): Backport support for original codes. - def _missing_(cls, value): Lookup function used when value is not found.
Implement the Python class `Packet` described below. Class description: [Packet] HIP Packet Types Method signatures and docstrings: - def get(key, default=-1): Backport support for original codes. - def _missing_(cls, value): Lookup function used when value is not found. <|skeleton|> class Packet: """[Packet] HI...
71363d7948003fec88cedcf5bc80b6befa2ba244
<|skeleton|> class Packet: """[Packet] HIP Packet Types""" def get(key, default=-1): """Backport support for original codes.""" <|body_0|> def _missing_(cls, value): """Lookup function used when value is not found.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Packet: """[Packet] HIP Packet Types""" def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return Packet(key) if key not in Packet._member_map_: extend_enum(Packet, key, default) return Packet[key] def...
the_stack_v2_python_sparse
pcapkit/const/hip/packet.py
hiok2000/PyPCAPKit
train
0
73882da4cba390e7a3e64a9e2c5552b5fc35e03b
[ "if 'user_id' not in in_data:\n in_data['user_id'] = 'us-' + str(uuid4())\nreturn in_data", "if value:\n return pwd_context.encrypt(value)\nreturn None", "if value:\n return int(value * 100)\nreturn None", "if obj.budget:\n return obj.budget / 100.0\nreturn None" ]
<|body_start_0|> if 'user_id' not in in_data: in_data['user_id'] = 'us-' + str(uuid4()) return in_data <|end_body_0|> <|body_start_1|> if value: return pwd_context.encrypt(value) return None <|end_body_1|> <|body_start_2|> if value: return in...
Schema to store details about a user.
UserSchema
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserSchema: """Schema to store details about a user.""" def get_id(self, in_data: dict, **kwargs: Any) -> dict: """Add generated user_id.""" <|body_0|> def get_password_hash(self, value: str) -> Optional[str]: """Convert password to password_hash.""" <|bo...
stack_v2_sparse_classes_10k_train_001506
4,600
permissive
[ { "docstring": "Add generated user_id.", "name": "get_id", "signature": "def get_id(self, in_data: dict, **kwargs: Any) -> dict" }, { "docstring": "Convert password to password_hash.", "name": "get_password_hash", "signature": "def get_password_hash(self, value: str) -> Optional[str]" ...
4
stack_v2_sparse_classes_30k_train_003669
Implement the Python class `UserSchema` described below. Class description: Schema to store details about a user. Method signatures and docstrings: - def get_id(self, in_data: dict, **kwargs: Any) -> dict: Add generated user_id. - def get_password_hash(self, value: str) -> Optional[str]: Convert password to password_...
Implement the Python class `UserSchema` described below. Class description: Schema to store details about a user. Method signatures and docstrings: - def get_id(self, in_data: dict, **kwargs: Any) -> dict: Add generated user_id. - def get_password_hash(self, value: str) -> Optional[str]: Convert password to password_...
822dbd3ccee25180cc48efd2f891504b6b5edc14
<|skeleton|> class UserSchema: """Schema to store details about a user.""" def get_id(self, in_data: dict, **kwargs: Any) -> dict: """Add generated user_id.""" <|body_0|> def get_password_hash(self, value: str) -> Optional[str]: """Convert password to password_hash.""" <|bo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UserSchema: """Schema to store details about a user.""" def get_id(self, in_data: dict, **kwargs: Any) -> dict: """Add generated user_id.""" if 'user_id' not in in_data: in_data['user_id'] = 'us-' + str(uuid4()) return in_data def get_password_hash(self, value: st...
the_stack_v2_python_sparse
services/users/users/schema.py
Open-EO/openeo-eodc-driver
train
3
dfda78681fe7f41c8f6aecdce8fffbffdbf9448f
[ "self.model = model\nself.feature_names = feature_names\nself.feature_types = feature_types", "if name is None:\n name = gen_name_from_class(self)\ny = clean_dimensions(y, 'y')\nif y.ndim != 1:\n raise ValueError('y must be 1 dimensional')\nX, n_samples = preclean_X(X, self.feature_names, self.feature_types...
<|body_start_0|> self.model = model self.feature_names = feature_names self.feature_types = feature_types <|end_body_0|> <|body_start_1|> if name is None: name = gen_name_from_class(self) y = clean_dimensions(y, 'y') if y.ndim != 1: raise ValueErr...
Produces variety of regression metrics (including RMSE, R^2, etc).
RegressionPerf
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegressionPerf: """Produces variety of regression metrics (including RMSE, R^2, etc).""" def __init__(self, model, feature_names=None, feature_types=None): """Initializes class. Args: model: model or prediction function of model (predict_proba for classification or predict for regres...
stack_v2_sparse_classes_10k_train_001507
5,223
permissive
[ { "docstring": "Initializes class. Args: model: model or prediction function of model (predict_proba for classification or predict for regression) feature_names: List of feature names. feature_types: List of feature types.", "name": "__init__", "signature": "def __init__(self, model, feature_names=None,...
2
stack_v2_sparse_classes_30k_train_007096
Implement the Python class `RegressionPerf` described below. Class description: Produces variety of regression metrics (including RMSE, R^2, etc). Method signatures and docstrings: - def __init__(self, model, feature_names=None, feature_types=None): Initializes class. Args: model: model or prediction function of mode...
Implement the Python class `RegressionPerf` described below. Class description: Produces variety of regression metrics (including RMSE, R^2, etc). Method signatures and docstrings: - def __init__(self, model, feature_names=None, feature_types=None): Initializes class. Args: model: model or prediction function of mode...
e6f38ea195aecbbd9d28c7183a83c65ada16e1ae
<|skeleton|> class RegressionPerf: """Produces variety of regression metrics (including RMSE, R^2, etc).""" def __init__(self, model, feature_names=None, feature_types=None): """Initializes class. Args: model: model or prediction function of model (predict_proba for classification or predict for regres...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RegressionPerf: """Produces variety of regression metrics (including RMSE, R^2, etc).""" def __init__(self, model, feature_names=None, feature_types=None): """Initializes class. Args: model: model or prediction function of model (predict_proba for classification or predict for regression) feature...
the_stack_v2_python_sparse
python/interpret-core/interpret/perf/_regression.py
interpretml/interpret
train
3,731
cc11777e512aea4474ca2beb00a4b960d34830d0
[ "self.interval = interval\nthread = threading.Thread(target=self.run, args=())\nthread.daemon = True\nthread.start()", "while True:\n print('Doing something imporant in the background')\n time.sleep(self.interval)" ]
<|body_start_0|> self.interval = interval thread = threading.Thread(target=self.run, args=()) thread.daemon = True thread.start() <|end_body_0|> <|body_start_1|> while True: print('Doing something imporant in the background') time.sleep(self.interval) <|e...
Threading example class The run() method will be started and it will run in the background until the application exits.
ThreadingExample
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ThreadingExample: """Threading example class The run() method will be started and it will run in the background until the application exits.""" def __init__(self, interval=1): """Constructor :type interval: int :param interval: Check interval, in seconds""" <|body_0|> de...
stack_v2_sparse_classes_10k_train_001508
911
permissive
[ { "docstring": "Constructor :type interval: int :param interval: Check interval, in seconds", "name": "__init__", "signature": "def __init__(self, interval=1)" }, { "docstring": "Method that runs forever", "name": "run", "signature": "def run(self)" } ]
2
null
Implement the Python class `ThreadingExample` described below. Class description: Threading example class The run() method will be started and it will run in the background until the application exits. Method signatures and docstrings: - def __init__(self, interval=1): Constructor :type interval: int :param interval:...
Implement the Python class `ThreadingExample` described below. Class description: Threading example class The run() method will be started and it will run in the background until the application exits. Method signatures and docstrings: - def __init__(self, interval=1): Constructor :type interval: int :param interval:...
665d39a2bd82543d5196555f0801ef8fd4a3ee48
<|skeleton|> class ThreadingExample: """Threading example class The run() method will be started and it will run in the background until the application exits.""" def __init__(self, interval=1): """Constructor :type interval: int :param interval: Check interval, in seconds""" <|body_0|> de...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ThreadingExample: """Threading example class The run() method will be started and it will run in the background until the application exits.""" def __init__(self, interval=1): """Constructor :type interval: int :param interval: Check interval, in seconds""" self.interval = interval ...
the_stack_v2_python_sparse
all-gists/832219525541e059aefa/snippet.py
gistable/gistable
train
76
1f47d79c34b7204bef6f06bcdccec706ff4c6a8d
[ "blacklist = ['', None, '-']\nif value in blacklist:\n return\nelif type(value) == tuple and len(value) == 2 and (value[1] == True):\n self.__dict__[name] = value[0]\nelse:\n if type(value) == str:\n value = value.replace(\"'\", '')\n self.__dict__[name] = value", "variableNames = [key for key ...
<|body_start_0|> blacklist = ['', None, '-'] if value in blacklist: return elif type(value) == tuple and len(value) == 2 and (value[1] == True): self.__dict__[name] = value[0] else: if type(value) == str: value = value.replace("'", '') ...
Main
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Main: def __setattr__(self, name, value): """Function doesnt set value if it is in blacklist""" <|body_0|> def insertQuery(self): """Function returns INSERT query with its class variables""" <|body_1|> <|end_skeleton|> <|body_start_0|> blacklist = [...
stack_v2_sparse_classes_10k_train_001509
5,468
permissive
[ { "docstring": "Function doesnt set value if it is in blacklist", "name": "__setattr__", "signature": "def __setattr__(self, name, value)" }, { "docstring": "Function returns INSERT query with its class variables", "name": "insertQuery", "signature": "def insertQuery(self)" } ]
2
stack_v2_sparse_classes_30k_train_000704
Implement the Python class `Main` described below. Class description: Implement the Main class. Method signatures and docstrings: - def __setattr__(self, name, value): Function doesnt set value if it is in blacklist - def insertQuery(self): Function returns INSERT query with its class variables
Implement the Python class `Main` described below. Class description: Implement the Main class. Method signatures and docstrings: - def __setattr__(self, name, value): Function doesnt set value if it is in blacklist - def insertQuery(self): Function returns INSERT query with its class variables <|skeleton|> class Ma...
c296af4934c9e70ce56ccdb23c5998e2d8418cab
<|skeleton|> class Main: def __setattr__(self, name, value): """Function doesnt set value if it is in blacklist""" <|body_0|> def insertQuery(self): """Function returns INSERT query with its class variables""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Main: def __setattr__(self, name, value): """Function doesnt set value if it is in blacklist""" blacklist = ['', None, '-'] if value in blacklist: return elif type(value) == tuple and len(value) == 2 and (value[1] == True): self.__dict__[name] = value[0]...
the_stack_v2_python_sparse
web-app/generate_random_patients.py
sandbernar/corona-prod
train
0
c5ae46f540fcd83f656bdecc2373f998a1158310
[ "self.epsilon = epsilon\nself.epsilon_decay = epsilon_decay\nself.epsilon_min = epsilon_min\nself.possible_actions = possible_actions\nself.continuous = continuous", "if self.epsilon < self.epsilon_min:\n self.epsilon = self.epsilon_min\nif random.random() < self.epsilon:\n return True\nreturn False", "se...
<|body_start_0|> self.epsilon = epsilon self.epsilon_decay = epsilon_decay self.epsilon_min = epsilon_min self.possible_actions = possible_actions self.continuous = continuous <|end_body_0|> <|body_start_1|> if self.epsilon < self.epsilon_min: self.epsilon = ...
An implementation of epsilon greedy exploration. Epsilon greedy exploration selects an explorative action with probability epsilon at each step. The value of epsilon decays at a rate 'epsilon_decay', until it hits the minimum value of 'epsilon_min'
EpsilonGreedyExplorer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EpsilonGreedyExplorer: """An implementation of epsilon greedy exploration. Epsilon greedy exploration selects an explorative action with probability epsilon at each step. The value of epsilon decays at a rate 'epsilon_decay', until it hits the minimum value of 'epsilon_min'""" def __init__(s...
stack_v2_sparse_classes_10k_train_001510
1,590
no_license
[ { "docstring": "Initialises the parameters for the explorer", "name": "__init__", "signature": "def __init__(self, possible_actions, continuous=False, epsilon=0.1, epsilon_decay=0, epsilon_min=0.1)" }, { "docstring": "Determines whether or not to explore in the current time step by comparing eps...
3
stack_v2_sparse_classes_30k_train_007099
Implement the Python class `EpsilonGreedyExplorer` described below. Class description: An implementation of epsilon greedy exploration. Epsilon greedy exploration selects an explorative action with probability epsilon at each step. The value of epsilon decays at a rate 'epsilon_decay', until it hits the minimum value ...
Implement the Python class `EpsilonGreedyExplorer` described below. Class description: An implementation of epsilon greedy exploration. Epsilon greedy exploration selects an explorative action with probability epsilon at each step. The value of epsilon decays at a rate 'epsilon_decay', until it hits the minimum value ...
6dfb342efda4c5ae0dff72bb132a6ce12fbfd8b8
<|skeleton|> class EpsilonGreedyExplorer: """An implementation of epsilon greedy exploration. Epsilon greedy exploration selects an explorative action with probability epsilon at each step. The value of epsilon decays at a rate 'epsilon_decay', until it hits the minimum value of 'epsilon_min'""" def __init__(s...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EpsilonGreedyExplorer: """An implementation of epsilon greedy exploration. Epsilon greedy exploration selects an explorative action with probability epsilon at each step. The value of epsilon decays at a rate 'epsilon_decay', until it hits the minimum value of 'epsilon_min'""" def __init__(self, possible...
the_stack_v2_python_sparse
Software/Agents/Policies/Explorers/EpsilonGreedyExplorer.py
meelement/ArtificialIntelligence
train
0
7518ec57cee1db9011db43c2edee61b1aaee2e03
[ "if registration_enabled():\n return super().is_open_for_signup(request, *args, **kwargs)\nreturn False", "mail_restriction = InvenTreeSetting.get_setting('LOGIN_SIGNUP_MAIL_RESTRICTION', None)\nif not mail_restriction:\n return super().clean_email(email)\nsplit_email = email.split('@')\nif len(split_email)...
<|body_start_0|> if registration_enabled(): return super().is_open_for_signup(request, *args, **kwargs) return False <|end_body_0|> <|body_start_1|> mail_restriction = InvenTreeSetting.get_setting('LOGIN_SIGNUP_MAIL_RESTRICTION', None) if not mail_restriction: re...
Mixin to check if registration should be enabled.
RegistratonMixin
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegistratonMixin: """Mixin to check if registration should be enabled.""" def is_open_for_signup(self, request, *args, **kwargs): """Check if signup is enabled in settings. Configure the class variable `REGISTRATION_SETTING` to set which setting should be used, default: `LOGIN_ENABLE...
stack_v2_sparse_classes_10k_train_001511
12,546
permissive
[ { "docstring": "Check if signup is enabled in settings. Configure the class variable `REGISTRATION_SETTING` to set which setting should be used, default: `LOGIN_ENABLE_REG`.", "name": "is_open_for_signup", "signature": "def is_open_for_signup(self, request, *args, **kwargs)" }, { "docstring": "C...
3
null
Implement the Python class `RegistratonMixin` described below. Class description: Mixin to check if registration should be enabled. Method signatures and docstrings: - def is_open_for_signup(self, request, *args, **kwargs): Check if signup is enabled in settings. Configure the class variable `REGISTRATION_SETTING` to...
Implement the Python class `RegistratonMixin` described below. Class description: Mixin to check if registration should be enabled. Method signatures and docstrings: - def is_open_for_signup(self, request, *args, **kwargs): Check if signup is enabled in settings. Configure the class variable `REGISTRATION_SETTING` to...
e88a8e99a5f0b201c67a95cba097c729f090d5e2
<|skeleton|> class RegistratonMixin: """Mixin to check if registration should be enabled.""" def is_open_for_signup(self, request, *args, **kwargs): """Check if signup is enabled in settings. Configure the class variable `REGISTRATION_SETTING` to set which setting should be used, default: `LOGIN_ENABLE...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RegistratonMixin: """Mixin to check if registration should be enabled.""" def is_open_for_signup(self, request, *args, **kwargs): """Check if signup is enabled in settings. Configure the class variable `REGISTRATION_SETTING` to set which setting should be used, default: `LOGIN_ENABLE_REG`.""" ...
the_stack_v2_python_sparse
InvenTree/InvenTree/forms.py
inventree/InvenTree
train
3,077
816e186e6055271ac2835763078c42f718656f02
[ "if filters is None:\n filters = {}\norm_filters = super(SpecialResource, self).build_filters(filters)\nquery = filters.get('q')\ncategory_pk = filters.get('catpk')\nif query is not None:\n sqs = SearchQuerySet().models(Special).load_all().auto_query(query)\n orm_filters['pk__in'] = [i.pk for i in sqs]\nif...
<|body_start_0|> if filters is None: filters = {} orm_filters = super(SpecialResource, self).build_filters(filters) query = filters.get('q') category_pk = filters.get('catpk') if query is not None: sqs = SearchQuerySet().models(Special).load_all().auto_que...
SpecialResource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpecialResource: def build_filters(self, filters=None): """Custom filters used for category and searching.""" <|body_0|> def dehydrate(self, bundle): """If idonly is specified as a flag, the bundle will be reduced to just the resource id.""" <|body_1|> <|end...
stack_v2_sparse_classes_10k_train_001512
1,770
no_license
[ { "docstring": "Custom filters used for category and searching.", "name": "build_filters", "signature": "def build_filters(self, filters=None)" }, { "docstring": "If idonly is specified as a flag, the bundle will be reduced to just the resource id.", "name": "dehydrate", "signature": "de...
2
stack_v2_sparse_classes_30k_train_003106
Implement the Python class `SpecialResource` described below. Class description: Implement the SpecialResource class. Method signatures and docstrings: - def build_filters(self, filters=None): Custom filters used for category and searching. - def dehydrate(self, bundle): If idonly is specified as a flag, the bundle w...
Implement the Python class `SpecialResource` described below. Class description: Implement the SpecialResource class. Method signatures and docstrings: - def build_filters(self, filters=None): Custom filters used for category and searching. - def dehydrate(self, bundle): If idonly is specified as a flag, the bundle w...
3ed85e856a026001a1d91d09d31d944c64704824
<|skeleton|> class SpecialResource: def build_filters(self, filters=None): """Custom filters used for category and searching.""" <|body_0|> def dehydrate(self, bundle): """If idonly is specified as a flag, the bundle will be reduced to just the resource id.""" <|body_1|> <|end...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SpecialResource: def build_filters(self, filters=None): """Custom filters used for category and searching.""" if filters is None: filters = {} orm_filters = super(SpecialResource, self).build_filters(filters) query = filters.get('q') category_pk = filters.ge...
the_stack_v2_python_sparse
scenable/specials/api.py
gregarious/betasite
train
0
dc5ede1c14d55a3946c904f5acf7db914fc1e712
[ "if not head or not head.next or (not head.next.next):\n return\nhead2 = self.findMid(head)\nhead2 = self.reverseList(head2)\nself.zigZagMerge(head, head2)", "slow, fast = (head, head.next)\nwhile fast:\n slow = slow.next\n fast = fast.next.next if fast.next else None\nhead2, slow.next = (slow.next, None...
<|body_start_0|> if not head or not head.next or (not head.next.next): return head2 = self.findMid(head) head2 = self.reverseList(head2) self.zigZagMerge(head, head2) <|end_body_0|> <|body_start_1|> slow, fast = (head, head.next) while fast: slow ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reorderList(self, head): """:type head: ListNode :rtype: None Do not return anything, modify head in-place instead.""" <|body_0|> def findMid(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> def reverseList(self, head): ...
stack_v2_sparse_classes_10k_train_001513
2,938
no_license
[ { "docstring": ":type head: ListNode :rtype: None Do not return anything, modify head in-place instead.", "name": "reorderList", "signature": "def reorderList(self, head)" }, { "docstring": ":type head: ListNode :rtype: ListNode", "name": "findMid", "signature": "def findMid(self, head)"...
4
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reorderList(self, head): :type head: ListNode :rtype: None Do not return anything, modify head in-place instead. - def findMid(self, head): :type head: ListNode :rtype: ListN...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reorderList(self, head): :type head: ListNode :rtype: None Do not return anything, modify head in-place instead. - def findMid(self, head): :type head: ListNode :rtype: ListN...
3d9e0ad2f6ed92ec969556f75d97c51ea4854719
<|skeleton|> class Solution: def reorderList(self, head): """:type head: ListNode :rtype: None Do not return anything, modify head in-place instead.""" <|body_0|> def findMid(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> def reverseList(self, head): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def reorderList(self, head): """:type head: ListNode :rtype: None Do not return anything, modify head in-place instead.""" if not head or not head.next or (not head.next.next): return head2 = self.findMid(head) head2 = self.reverseList(head2) self....
the_stack_v2_python_sparse
Solutions/0143_reorderList.py
YoupengLi/leetcode-sorting
train
3
73039ce8069918e0f2192da82ae9276e38581553
[ "if dtype not in NUMERIC_TYPES:\n raise ValueError(\"invalid numeric type '{}'\".format(dtype))\nsuper(Numeric, self).__init__(dtype=dtype, name=name, index=index, label=label, help=help, default=default, required=required, group=group)\nself.constraint = constraint", "if value in ['-inf', 'inf']:\n value =...
<|body_start_0|> if dtype not in NUMERIC_TYPES: raise ValueError("invalid numeric type '{}'".format(dtype)) super(Numeric, self).__init__(dtype=dtype, name=name, index=index, label=label, help=help, default=default, required=required, group=group) self.constraint = constraint <|end_b...
Base class for numeric parameter types. Extends the base class with an optional range constraint.
Numeric
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Numeric: """Base class for numeric parameter types. Extends the base class with an optional range constraint.""" def __init__(self, dtype: str, name: str, index: Optional[int]=0, label: Optional[str]=None, help: Optional[str]=None, default: Optional[Union[int, float]]=None, required: Optiona...
stack_v2_sparse_classes_10k_train_001514
16,105
permissive
[ { "docstring": "Initialize the base properties for a numeric parameter declaration. Parameters ---------- dtype: string Parameter type identifier. name: string Unique parameter identifier index: int Index position of the parameter (for display purposes). label: string Human-readable parameter name. help: string...
4
stack_v2_sparse_classes_30k_train_002965
Implement the Python class `Numeric` described below. Class description: Base class for numeric parameter types. Extends the base class with an optional range constraint. Method signatures and docstrings: - def __init__(self, dtype: str, name: str, index: Optional[int]=0, label: Optional[str]=None, help: Optional[str...
Implement the Python class `Numeric` described below. Class description: Base class for numeric parameter types. Extends the base class with an optional range constraint. Method signatures and docstrings: - def __init__(self, dtype: str, name: str, index: Optional[int]=0, label: Optional[str]=None, help: Optional[str...
7116b7060aa68ab36bf08e6393be166dc5db955f
<|skeleton|> class Numeric: """Base class for numeric parameter types. Extends the base class with an optional range constraint.""" def __init__(self, dtype: str, name: str, index: Optional[int]=0, label: Optional[str]=None, help: Optional[str]=None, default: Optional[Union[int, float]]=None, required: Optiona...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Numeric: """Base class for numeric parameter types. Extends the base class with an optional range constraint.""" def __init__(self, dtype: str, name: str, index: Optional[int]=0, label: Optional[str]=None, help: Optional[str]=None, default: Optional[Union[int, float]]=None, required: Optional[bool]=False...
the_stack_v2_python_sparse
flowserv/model/parameter/numeric.py
anrunw/flowserv-core-1
train
0
3c83ab4713119336ab3daa4880399cc30acf5f05
[ "fd_mock = mock.mock_open()\nargs = ['script_name', 'gtest', '--test-exe=out_eve/Release/base_unittests', '--board=eve', '--path-to-outdir=out_eve/Release', '--use-vm' if use_vm else '--device=localhost:2222']\nif stop_ui:\n args.append('--stop-ui')\nwith mock.patch.object(sys, 'argv', args), mock.patch.object(t...
<|body_start_0|> fd_mock = mock.mock_open() args = ['script_name', 'gtest', '--test-exe=out_eve/Release/base_unittests', '--board=eve', '--path-to-outdir=out_eve/Release', '--use-vm' if use_vm else '--device=localhost:2222'] if stop_ui: args.append('--stop-ui') with mock.patc...
GTestTest
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GTestTest: def test_gtest(self, use_vm, stop_ui): """Tests running a gtest.""" <|body_0|> def test_gtest_with_vpython(self): """Tests building a gtest with --vpython-dir.""" <|body_1|> <|end_skeleton|> <|body_start_0|> fd_mock = mock.mock_open() ...
stack_v2_sparse_classes_10k_train_001515
12,985
permissive
[ { "docstring": "Tests running a gtest.", "name": "test_gtest", "signature": "def test_gtest(self, use_vm, stop_ui)" }, { "docstring": "Tests building a gtest with --vpython-dir.", "name": "test_gtest_with_vpython", "signature": "def test_gtest_with_vpython(self)" } ]
2
null
Implement the Python class `GTestTest` described below. Class description: Implement the GTestTest class. Method signatures and docstrings: - def test_gtest(self, use_vm, stop_ui): Tests running a gtest. - def test_gtest_with_vpython(self): Tests building a gtest with --vpython-dir.
Implement the Python class `GTestTest` described below. Class description: Implement the GTestTest class. Method signatures and docstrings: - def test_gtest(self, use_vm, stop_ui): Tests running a gtest. - def test_gtest_with_vpython(self): Tests building a gtest with --vpython-dir. <|skeleton|> class GTestTest: ...
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
<|skeleton|> class GTestTest: def test_gtest(self, use_vm, stop_ui): """Tests running a gtest.""" <|body_0|> def test_gtest_with_vpython(self): """Tests building a gtest with --vpython-dir.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GTestTest: def test_gtest(self, use_vm, stop_ui): """Tests running a gtest.""" fd_mock = mock.mock_open() args = ['script_name', 'gtest', '--test-exe=out_eve/Release/base_unittests', '--board=eve', '--path-to-outdir=out_eve/Release', '--use-vm' if use_vm else '--device=localhost:2222']...
the_stack_v2_python_sparse
build/chromeos/test_runner_test.py
chromium/chromium
train
17,408
2e9fd050211c7e0d9ffa6160a971028a8cf8baa1
[ "self.xd = kwargs['xd']\nself.skip_days = 0\nself.factor_name = '{}:{}'.format(self.__class__.__name__, self.xd)\nself.hit_ml = kwargs['hit_ml']", "ump = self.ump_manger\ndeg_hit_cnt = ump.ump_main_deg.predict_hit_kwargs(**ml_feature_dict)\njump_hit_cnt = ump.ump_main_jump.predict_hit_kwargs(**ml_feature_dict)\nw...
<|body_start_0|> self.xd = kwargs['xd'] self.skip_days = 0 self.factor_name = '{}:{}'.format(self.__class__.__name__, self.xd) self.hit_ml = kwargs['hit_ml'] <|end_body_0|> <|body_start_1|> ump = self.ump_manger deg_hit_cnt = ump.ump_main_deg.predict_hit_kwargs(**ml_feat...
继续继承AbuFactorBuyBreak复写make_ump_block_decision, 区别是使用AbuFactorBuyBreakReocrdHitDemo的学习成果hit_ml 对几个裁判这次交易命中的分类簇个数组成矢量特征进行predict, 拦截预测结果为-1的交易
AbuFactorBuyBreakHitPredictDemo
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AbuFactorBuyBreakHitPredictDemo: """继续继承AbuFactorBuyBreak复写make_ump_block_decision, 区别是使用AbuFactorBuyBreakReocrdHitDemo的学习成果hit_ml 对几个裁判这次交易命中的分类簇个数组成矢量特征进行predict, 拦截预测结果为-1的交易""" def _init_self(self, **kwargs): """与AbuFactorBuyBreak基本相同,唯一区别是关键子参数中添加了通过AbuFactorBuyBreakUmpDemo记录训练好...
stack_v2_sparse_classes_10k_train_001516
9,900
no_license
[ { "docstring": "与AbuFactorBuyBreak基本相同,唯一区别是关键子参数中添加了通过AbuFactorBuyBreakUmpDemo记录训练好的决策器 self.hit_ml = kwargs['hit_ml']", "name": "_init_self", "signature": "def _init_self(self, **kwargs)" }, { "docstring": "用回测的数据进行训练后再次反过来指导回测,结果是没有意义的, 这里的示例只是为了容易理解什么叫做:让裁判自己学习怎么配合, 自己做出最正确的判断,更详细完整的示例会在之后的章...
2
stack_v2_sparse_classes_30k_train_000296
Implement the Python class `AbuFactorBuyBreakHitPredictDemo` described below. Class description: 继续继承AbuFactorBuyBreak复写make_ump_block_decision, 区别是使用AbuFactorBuyBreakReocrdHitDemo的学习成果hit_ml 对几个裁判这次交易命中的分类簇个数组成矢量特征进行predict, 拦截预测结果为-1的交易 Method signatures and docstrings: - def _init_self(self, **kwargs): 与AbuFactorB...
Implement the Python class `AbuFactorBuyBreakHitPredictDemo` described below. Class description: 继续继承AbuFactorBuyBreak复写make_ump_block_decision, 区别是使用AbuFactorBuyBreakReocrdHitDemo的学习成果hit_ml 对几个裁判这次交易命中的分类簇个数组成矢量特征进行predict, 拦截预测结果为-1的交易 Method signatures and docstrings: - def _init_self(self, **kwargs): 与AbuFactorB...
f00a070626407afe87763a50c99241696a38df46
<|skeleton|> class AbuFactorBuyBreakHitPredictDemo: """继续继承AbuFactorBuyBreak复写make_ump_block_decision, 区别是使用AbuFactorBuyBreakReocrdHitDemo的学习成果hit_ml 对几个裁判这次交易命中的分类簇个数组成矢量特征进行predict, 拦截预测结果为-1的交易""" def _init_self(self, **kwargs): """与AbuFactorBuyBreak基本相同,唯一区别是关键子参数中添加了通过AbuFactorBuyBreakUmpDemo记录训练好...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AbuFactorBuyBreakHitPredictDemo: """继续继承AbuFactorBuyBreak复写make_ump_block_decision, 区别是使用AbuFactorBuyBreakReocrdHitDemo的学习成果hit_ml 对几个裁判这次交易命中的分类簇个数组成矢量特征进行predict, 拦截预测结果为-1的交易""" def _init_self(self, **kwargs): """与AbuFactorBuyBreak基本相同,唯一区别是关键子参数中添加了通过AbuFactorBuyBreakUmpDemo记录训练好的决策器 self.hit...
the_stack_v2_python_sparse
abupy/FactorBuyBu/ABuFactorBuyDemo.py
zly111/abu
train
1
2bca047ba68a6efe9e91ac2fcfce1f65f58b554f
[ "positive_mask = (input_img > 0).type_as(input_img)\noutput = torch.addcmul(torch.zeros(input_img.size()).type_as(input_img), input_img, positive_mask)\nself.save_for_backward(input_img, output)\nreturn output", "input_img, output = self.saved_tensors\npositive_mask_1 = (input_img > 0).type_as(grad_output)\nposit...
<|body_start_0|> positive_mask = (input_img > 0).type_as(input_img) output = torch.addcmul(torch.zeros(input_img.size()).type_as(input_img), input_img, positive_mask) self.save_for_backward(input_img, output) return output <|end_body_0|> <|body_start_1|> input_img, output = self...
GuidedBackPropReLU
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GuidedBackPropReLU: def forward(self, input_img): """:param self: :param input_img: :return:""" <|body_0|> def backward(self, grad_output): """:param self: :param grad_output: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> positive_mask = ...
stack_v2_sparse_classes_10k_train_001517
2,971
permissive
[ { "docstring": ":param self: :param input_img: :return:", "name": "forward", "signature": "def forward(self, input_img)" }, { "docstring": ":param self: :param grad_output: :return:", "name": "backward", "signature": "def backward(self, grad_output)" } ]
2
stack_v2_sparse_classes_30k_train_004925
Implement the Python class `GuidedBackPropReLU` described below. Class description: Implement the GuidedBackPropReLU class. Method signatures and docstrings: - def forward(self, input_img): :param self: :param input_img: :return: - def backward(self, grad_output): :param self: :param grad_output: :return:
Implement the Python class `GuidedBackPropReLU` described below. Class description: Implement the GuidedBackPropReLU class. Method signatures and docstrings: - def forward(self, input_img): :param self: :param input_img: :return: - def backward(self, grad_output): :param self: :param grad_output: :return: <|skeleton...
94a402cab47a2bd6241608308371490079af4d53
<|skeleton|> class GuidedBackPropReLU: def forward(self, input_img): """:param self: :param input_img: :return:""" <|body_0|> def backward(self, grad_output): """:param self: :param grad_output: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GuidedBackPropReLU: def forward(self, input_img): """:param self: :param input_img: :return:""" positive_mask = (input_img > 0).type_as(input_img) output = torch.addcmul(torch.zeros(input_img.size()).type_as(input_img), input_img, positive_mask) self.save_for_backward(input_img...
the_stack_v2_python_sparse
draugr/torch_utilities/optimisation/debugging/gradients/guided.py
cnheider/draugr
train
4
64c205c66879ce9b153b5476d91bacf986692feb
[ "super().__init__()\nself.register_buffer('support', torch.linspace(vmin, vmax, n_atoms))\nself.fc1 = nn.Linear(state_size, 256)\nself.fc2 = nn.Linear(256 + action_size, 256)\nself.fc3 = nn.Linear(256, 128)\nself.fc4 = nn.Linear(128, n_atoms)", "x = F.leaky_relu(self.fc1(state))\nx = torch.cat([x, action], dim=1)...
<|body_start_0|> super().__init__() self.register_buffer('support', torch.linspace(vmin, vmax, n_atoms)) self.fc1 = nn.Linear(state_size, 256) self.fc2 = nn.Linear(256 + action_size, 256) self.fc3 = nn.Linear(256, 128) self.fc4 = nn.Linear(128, n_atoms) <|end_body_0|> <|...
Distributional Value Model
Critic
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Critic: """Distributional Value Model""" def __init__(self, state_size, action_size, vmin, vmax, n_atoms=51): """Initialize parameters and build model. Parameters ---------- state_size : int Dimension of each state action_size : int Dimension of each action vmin, vmax : float Upper &...
stack_v2_sparse_classes_10k_train_001518
2,383
no_license
[ { "docstring": "Initialize parameters and build model. Parameters ---------- state_size : int Dimension of each state action_size : int Dimension of each action vmin, vmax : float Upper & Lower bounds of the support n_atoms : int Number of bins in the support", "name": "__init__", "signature": "def __in...
2
stack_v2_sparse_classes_30k_train_002994
Implement the Python class `Critic` described below. Class description: Distributional Value Model Method signatures and docstrings: - def __init__(self, state_size, action_size, vmin, vmax, n_atoms=51): Initialize parameters and build model. Parameters ---------- state_size : int Dimension of each state action_size ...
Implement the Python class `Critic` described below. Class description: Distributional Value Model Method signatures and docstrings: - def __init__(self, state_size, action_size, vmin, vmax, n_atoms=51): Initialize parameters and build model. Parameters ---------- state_size : int Dimension of each state action_size ...
f6d450e0c68236bf493689bffef48a0f3723416d
<|skeleton|> class Critic: """Distributional Value Model""" def __init__(self, state_size, action_size, vmin, vmax, n_atoms=51): """Initialize parameters and build model. Parameters ---------- state_size : int Dimension of each state action_size : int Dimension of each action vmin, vmax : float Upper &...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Critic: """Distributional Value Model""" def __init__(self, state_size, action_size, vmin, vmax, n_atoms=51): """Initialize parameters and build model. Parameters ---------- state_size : int Dimension of each state action_size : int Dimension of each action vmin, vmax : float Upper & Lower bounds...
the_stack_v2_python_sparse
drlnd/p2_continuous-control/control/model.py
jkorge/udacity
train
0
4ece046735739e3557e9a59bdccd0629bd8648e8
[ "Canvas.__init__(self)\nself.configure(width=larg, height=haut)\nself.boss = boss\nself.larg = larg\nself.haut = haut\npas = (larg - 25) / 8\nfor t in range(0, 9):\n stx = 10 + t * pas\n self.create_line(stx, haut - 12, stx, 15, fill='grey')\npas = (haut - 25) / 10\nfor t in range(-5, 6):\n sty = haut / 2 ...
<|body_start_0|> Canvas.__init__(self) self.configure(width=larg, height=haut) self.boss = boss self.larg = larg self.haut = haut pas = (larg - 25) / 8 for t in range(0, 9): stx = 10 + t * pas self.create_line(stx, haut - 12, stx, 15, fill=...
Canevas pour le dessin de courbes élongation/temps
OscilloGraphe
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OscilloGraphe: """Canevas pour le dessin de courbes élongation/temps""" def __init__(self, boss=None, larg=400, haut=350): """Constructeur du graphique : axes et échelle horizontale""" <|body_0|> def axes(self): """Création des axes de références""" <|bod...
stack_v2_sparse_classes_10k_train_001519
3,176
no_license
[ { "docstring": "Constructeur du graphique : axes et échelle horizontale", "name": "__init__", "signature": "def __init__(self, boss=None, larg=400, haut=350)" }, { "docstring": "Création des axes de références", "name": "axes", "signature": "def axes(self)" }, { "docstring": "Tra...
3
stack_v2_sparse_classes_30k_train_004409
Implement the Python class `OscilloGraphe` described below. Class description: Canevas pour le dessin de courbes élongation/temps Method signatures and docstrings: - def __init__(self, boss=None, larg=400, haut=350): Constructeur du graphique : axes et échelle horizontale - def axes(self): Création des axes de référe...
Implement the Python class `OscilloGraphe` described below. Class description: Canevas pour le dessin de courbes élongation/temps Method signatures and docstrings: - def __init__(self, boss=None, larg=400, haut=350): Constructeur du graphique : axes et échelle horizontale - def axes(self): Création des axes de référe...
14b306447e227ddc5cb04b8819f388ca9f91a1d6
<|skeleton|> class OscilloGraphe: """Canevas pour le dessin de courbes élongation/temps""" def __init__(self, boss=None, larg=400, haut=350): """Constructeur du graphique : axes et échelle horizontale""" <|body_0|> def axes(self): """Création des axes de références""" <|bod...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class OscilloGraphe: """Canevas pour le dessin de courbes élongation/temps""" def __init__(self, boss=None, larg=400, haut=350): """Constructeur du graphique : axes et échelle horizontale""" Canvas.__init__(self) self.configure(width=larg, height=haut) self.boss = boss s...
the_stack_v2_python_sparse
Course/Book/Programmer_avec_Python3/13-ClasseEtInterfacesGraphiques/oscillo.py
BjaouiAya/Cours-Python
train
0
15774ba744ea6456b49bca281a0da434323ca343
[ "firebase_token = self.get_token(request)\nif firebase_token is None:\n return None\ntry:\n payload = auth.verify_id_token(firebase_token)\nexcept ValueError:\n msg = _('Signature has expired.')\n raise exceptions.AuthenticationFailed(msg)\nexcept auth.AuthError:\n msg = _('Could not log in.')\n r...
<|body_start_0|> firebase_token = self.get_token(request) if firebase_token is None: return None try: payload = auth.verify_id_token(firebase_token) except ValueError: msg = _('Signature has expired.') raise exceptions.AuthenticationFailed(...
Token based authentication using firebase.
BaseFirebaseuthentication
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseFirebaseuthentication: """Token based authentication using firebase.""" def authenticate(self, request): """Returns a two-tuple of `User` and token if a valid signature has been supplied using Firebase authentication. Otherwise returns `None`.""" <|body_0|> def authe...
stack_v2_sparse_classes_10k_train_001520
5,651
no_license
[ { "docstring": "Returns a two-tuple of `User` and token if a valid signature has been supplied using Firebase authentication. Otherwise returns `None`.", "name": "authenticate", "signature": "def authenticate(self, request)" }, { "docstring": "Returns an active user that matches the payload's us...
2
stack_v2_sparse_classes_30k_train_007274
Implement the Python class `BaseFirebaseuthentication` described below. Class description: Token based authentication using firebase. Method signatures and docstrings: - def authenticate(self, request): Returns a two-tuple of `User` and token if a valid signature has been supplied using Firebase authentication. Other...
Implement the Python class `BaseFirebaseuthentication` described below. Class description: Token based authentication using firebase. Method signatures and docstrings: - def authenticate(self, request): Returns a two-tuple of `User` and token if a valid signature has been supplied using Firebase authentication. Other...
5714b02deb0acc8fa185eb02bd6b561e2f5f185e
<|skeleton|> class BaseFirebaseuthentication: """Token based authentication using firebase.""" def authenticate(self, request): """Returns a two-tuple of `User` and token if a valid signature has been supplied using Firebase authentication. Otherwise returns `None`.""" <|body_0|> def authe...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BaseFirebaseuthentication: """Token based authentication using firebase.""" def authenticate(self, request): """Returns a two-tuple of `User` and token if a valid signature has been supplied using Firebase authentication. Otherwise returns `None`.""" firebase_token = self.get_token(reques...
the_stack_v2_python_sparse
user_repo3/user_management/authentication.py
jyothinaidu/user_management
train
1
e405d7988a62c1d40b8c40719db965e35556ad29
[ "super(VGG16, self).__init__()\nself.vgg16_feature_extractor = VGG16FeatureExtraction(weights_update=True)\nself.max_pool = nn.MaxPool2d(kernel_size=2, stride=2)\nself.classifier = VGG16Classfier()\nself.fc3 = _fc(in_channels=4096, out_channels=num_classes)", "feature_maps = self.vgg16_feature_extractor(x)\nx = s...
<|body_start_0|> super(VGG16, self).__init__() self.vgg16_feature_extractor = VGG16FeatureExtraction(weights_update=True) self.max_pool = nn.MaxPool2d(kernel_size=2, stride=2) self.classifier = VGG16Classfier() self.fc3 = _fc(in_channels=4096, out_channels=num_classes) <|end_body...
VGG16
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VGG16: def __init__(self, num_classes): """VGG16 construct for training backbone""" <|body_0|> def construct(self, x): """:param x: shape=(B, 3, 224, 224) :return: logits, shape=(B, 1000)""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(VGG16, ...
stack_v2_sparse_classes_10k_train_001521
5,998
permissive
[ { "docstring": "VGG16 construct for training backbone", "name": "__init__", "signature": "def __init__(self, num_classes)" }, { "docstring": ":param x: shape=(B, 3, 224, 224) :return: logits, shape=(B, 1000)", "name": "construct", "signature": "def construct(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_006384
Implement the Python class `VGG16` described below. Class description: Implement the VGG16 class. Method signatures and docstrings: - def __init__(self, num_classes): VGG16 construct for training backbone - def construct(self, x): :param x: shape=(B, 3, 224, 224) :return: logits, shape=(B, 1000)
Implement the Python class `VGG16` described below. Class description: Implement the VGG16 class. Method signatures and docstrings: - def __init__(self, num_classes): VGG16 construct for training backbone - def construct(self, x): :param x: shape=(B, 3, 224, 224) :return: logits, shape=(B, 1000) <|skeleton|> class V...
eab643f51336dbf7d711f02d27e6516e5affee59
<|skeleton|> class VGG16: def __init__(self, num_classes): """VGG16 construct for training backbone""" <|body_0|> def construct(self, x): """:param x: shape=(B, 3, 224, 224) :return: logits, shape=(B, 1000)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class VGG16: def __init__(self, num_classes): """VGG16 construct for training backbone""" super(VGG16, self).__init__() self.vgg16_feature_extractor = VGG16FeatureExtraction(weights_update=True) self.max_pool = nn.MaxPool2d(kernel_size=2, stride=2) self.classifier = VGG16Clas...
the_stack_v2_python_sparse
official/cv/CTPN/src/CTPN/vgg16.py
mindspore-ai/models
train
301
cb4c021f77704289820f0c1dec6a99632d8424ad
[ "super().__init__()\nself.dim_head = int(dim / heads) if dim_head is None else dim_head\n_dim = self.dim_head * heads\nself.heads = heads\nself.to_qvk = nn.Linear(dim, _dim * 3, bias=False)\nself.W_0 = nn.Linear(_dim, dim, bias=False)\nself.scale_factor = self.dim_head ** (-0.5)\nself.space_att = space_att\nself.re...
<|body_start_0|> super().__init__() self.dim_head = int(dim / heads) if dim_head is None else dim_head _dim = self.dim_head * heads self.heads = heads self.to_qvk = nn.Linear(dim, _dim * 3, bias=False) self.W_0 = nn.Linear(_dim, dim, bias=False) self.scale_factor ...
SpacetimeMHSA
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpacetimeMHSA: def __init__(self, dim, tokens_to_attend, space_att, heads=8, dim_head=None, classification=True, linear_spatial_attention=False, k=None): """Attention through time and space to process videos choose mode (whether to operate in space and time with space_att (bool) ) CLS to...
stack_v2_sparse_classes_10k_train_001522
4,810
permissive
[ { "docstring": "Attention through time and space to process videos choose mode (whether to operate in space and time with space_att (bool) ) CLS token is used for video classification, which will attend all tokens in both space and time before attention only in time or space. Code is based on lucidrains repo: h...
2
stack_v2_sparse_classes_30k_train_006407
Implement the Python class `SpacetimeMHSA` described below. Class description: Implement the SpacetimeMHSA class. Method signatures and docstrings: - def __init__(self, dim, tokens_to_attend, space_att, heads=8, dim_head=None, classification=True, linear_spatial_attention=False, k=None): Attention through time and sp...
Implement the Python class `SpacetimeMHSA` described below. Class description: Implement the SpacetimeMHSA class. Method signatures and docstrings: - def __init__(self, dim, tokens_to_attend, space_att, heads=8, dim_head=None, classification=True, linear_spatial_attention=False, k=None): Attention through time and sp...
25622d56490ccca60a62a492fe48743e874a3e16
<|skeleton|> class SpacetimeMHSA: def __init__(self, dim, tokens_to_attend, space_att, heads=8, dim_head=None, classification=True, linear_spatial_attention=False, k=None): """Attention through time and space to process videos choose mode (whether to operate in space and time with space_att (bool) ) CLS to...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SpacetimeMHSA: def __init__(self, dim, tokens_to_attend, space_att, heads=8, dim_head=None, classification=True, linear_spatial_attention=False, k=None): """Attention through time and space to process videos choose mode (whether to operate in space and time with space_att (bool) ) CLS token is used fo...
the_stack_v2_python_sparse
self_attention_cv/timesformer/spacetime_attention.py
cumtChenLL/self-attention-cv
train
1
8993e36d53f21eb9675c8dac0716841f699ef201
[ "if coco91_to_80 and include_mask:\n raise ValueError('If masks are included you cannot convert coco from the91 class format to the 80 class format.')\nself._coco91_to_80 = coco91_to_80\nsuper().__init__(include_mask=include_mask, regenerate_source_id=regenerate_source_id, mask_binarize_threshold=mask_binarize_t...
<|body_start_0|> if coco91_to_80 and include_mask: raise ValueError('If masks are included you cannot convert coco from the91 class format to the 80 class format.') self._coco91_to_80 = coco91_to_80 super().__init__(include_mask=include_mask, regenerate_source_id=regenerate_source_id...
Tensorflow Example proto decoder.
TfExampleDecoder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TfExampleDecoder: """Tensorflow Example proto decoder.""" def __init__(self, coco91_to_80=None, include_mask=False, regenerate_source_id=False, mask_binarize_threshold=None): """Initialize the example decoder. Args: coco91_to_80: `bool` indicating whether to convert coco from its 91 ...
stack_v2_sparse_classes_10k_train_001523
4,810
permissive
[ { "docstring": "Initialize the example decoder. Args: coco91_to_80: `bool` indicating whether to convert coco from its 91 class format to the 80 class format. include_mask: `bool` indicating if the decoder should also decode instance masks for instance segmentation. regenerate_source_id: `bool` indicating if th...
2
null
Implement the Python class `TfExampleDecoder` described below. Class description: Tensorflow Example proto decoder. Method signatures and docstrings: - def __init__(self, coco91_to_80=None, include_mask=False, regenerate_source_id=False, mask_binarize_threshold=None): Initialize the example decoder. Args: coco91_to_8...
Implement the Python class `TfExampleDecoder` described below. Class description: Tensorflow Example proto decoder. Method signatures and docstrings: - def __init__(self, coco91_to_80=None, include_mask=False, regenerate_source_id=False, mask_binarize_threshold=None): Initialize the example decoder. Args: coco91_to_8...
d3507b550a3ade40cade60a79eb5b8978b56c7ae
<|skeleton|> class TfExampleDecoder: """Tensorflow Example proto decoder.""" def __init__(self, coco91_to_80=None, include_mask=False, regenerate_source_id=False, mask_binarize_threshold=None): """Initialize the example decoder. Args: coco91_to_80: `bool` indicating whether to convert coco from its 91 ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TfExampleDecoder: """Tensorflow Example proto decoder.""" def __init__(self, coco91_to_80=None, include_mask=False, regenerate_source_id=False, mask_binarize_threshold=None): """Initialize the example decoder. Args: coco91_to_80: `bool` indicating whether to convert coco from its 91 class format ...
the_stack_v2_python_sparse
official/projects/yolo/dataloaders/tf_example_decoder.py
jianzhnie/models
train
2
350652045fbaa57dfe7b38a93a11d750a3601951
[ "if self.path == '/del_config' or self.path == '/del_config/':\n self.server.config = dict()\n self.log_message('Reset Server Configuration.')\n self.send_response(200)\nelse:\n self.send_response(404)", "self.log_message(f'Youtube provider received GET request to path {self.path}')\nif 'get_config' i...
<|body_start_0|> if self.path == '/del_config' or self.path == '/del_config/': self.server.config = dict() self.log_message('Reset Server Configuration.') self.send_response(200) else: self.send_response(404) <|end_body_0|> <|body_start_1|> self.l...
A handler for Youtube GET requests.
StubYouTubeHandler
[ "AGPL-3.0-only", "AGPL-3.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StubYouTubeHandler: """A handler for Youtube GET requests.""" def do_DELETE(self): """Allow callers to delete all the server configurations using the /del_config URL.""" <|body_0|> def do_GET(self): """Handle a GET request from the client and sends response back....
stack_v2_sparse_classes_10k_train_001524
6,207
permissive
[ { "docstring": "Allow callers to delete all the server configurations using the /del_config URL.", "name": "do_DELETE", "signature": "def do_DELETE(self)" }, { "docstring": "Handle a GET request from the client and sends response back.", "name": "do_GET", "signature": "def do_GET(self)" ...
4
null
Implement the Python class `StubYouTubeHandler` described below. Class description: A handler for Youtube GET requests. Method signatures and docstrings: - def do_DELETE(self): Allow callers to delete all the server configurations using the /del_config URL. - def do_GET(self): Handle a GET request from the client and...
Implement the Python class `StubYouTubeHandler` described below. Class description: A handler for Youtube GET requests. Method signatures and docstrings: - def do_DELETE(self): Allow callers to delete all the server configurations using the /del_config URL. - def do_GET(self): Handle a GET request from the client and...
5809eaca7079a15ee56b0b7fcfea425337046c97
<|skeleton|> class StubYouTubeHandler: """A handler for Youtube GET requests.""" def do_DELETE(self): """Allow callers to delete all the server configurations using the /del_config URL.""" <|body_0|> def do_GET(self): """Handle a GET request from the client and sends response back....
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class StubYouTubeHandler: """A handler for Youtube GET requests.""" def do_DELETE(self): """Allow callers to delete all the server configurations using the /del_config URL.""" if self.path == '/del_config' or self.path == '/del_config/': self.server.config = dict() self....
the_stack_v2_python_sparse
Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/common/djangoapps/terrain/stubs/youtube.py
luque/better-ways-of-thinking-about-software
train
3
435f48322403ca8e571f3bccfe8cc3a0a1677b7e
[ "super().__init__()\nself.frequency = frequency\nself.length = length\nself.type = type", "mother_wavelet = self.type\nspread = np.arange(1, self.length + 1, 1)\nscales = central_frequency(mother_wavelet) * self.frequency / spread\ncoeffs, _ = cwt(signal, scales, mother_wavelet, 1.0 / self.frequency)\ncoeffs = np...
<|body_start_0|> super().__init__() self.frequency = frequency self.length = length self.type = type <|end_body_0|> <|body_start_1|> mother_wavelet = self.type spread = np.arange(1, self.length + 1, 1) scales = central_frequency(mother_wavelet) * self.frequency /...
Generate continuous wavelet transform of a signal
SignalContinuousWavelet
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SignalContinuousWavelet: """Generate continuous wavelet transform of a signal""" def __init__(self, type: str='mexh', length: float=125.0, frequency: float=500.0) -> None: """Args: type: mother wavelet type. Available options are: {``"mexh"``, ``"morl"``, ``"cmorB-C"``, , ``"gausP"``...
stack_v2_sparse_classes_10k_train_001525
16,322
permissive
[ { "docstring": "Args: type: mother wavelet type. Available options are: {``\"mexh\"``, ``\"morl\"``, ``\"cmorB-C\"``, , ``\"gausP\"``} see : https://pywavelets.readthedocs.io/en/latest/ref/cwt.html length: expected length, default ``125.0`` frequency: signal frequency, default ``500.0``", "name": "__init__"...
2
stack_v2_sparse_classes_30k_train_005146
Implement the Python class `SignalContinuousWavelet` described below. Class description: Generate continuous wavelet transform of a signal Method signatures and docstrings: - def __init__(self, type: str='mexh', length: float=125.0, frequency: float=500.0) -> None: Args: type: mother wavelet type. Available options a...
Implement the Python class `SignalContinuousWavelet` described below. Class description: Generate continuous wavelet transform of a signal Method signatures and docstrings: - def __init__(self, type: str='mexh', length: float=125.0, frequency: float=500.0) -> None: Args: type: mother wavelet type. Available options a...
e48c3e2c741fa3fc705c4425d17ac4a5afac6c47
<|skeleton|> class SignalContinuousWavelet: """Generate continuous wavelet transform of a signal""" def __init__(self, type: str='mexh', length: float=125.0, frequency: float=500.0) -> None: """Args: type: mother wavelet type. Available options are: {``"mexh"``, ``"morl"``, ``"cmorB-C"``, , ``"gausP"``...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SignalContinuousWavelet: """Generate continuous wavelet transform of a signal""" def __init__(self, type: str='mexh', length: float=125.0, frequency: float=500.0) -> None: """Args: type: mother wavelet type. Available options are: {``"mexh"``, ``"morl"``, ``"cmorB-C"``, , ``"gausP"``} see : https...
the_stack_v2_python_sparse
monai/transforms/signal/array.py
Project-MONAI/MONAI
train
4,805
a3a777a18022111b81a565503bf9a2246dd90bbb
[ "super().__init__()\nif weights is not None and (not np.isclose(weights.sum(), 1)):\n raise ValueError('Weights must sum to 1.')\nself.weights = weights", "if self.weights is None:\n m = scores.shape[-1]\n self.weights = torch.ones(m, device=scores.device) / m\nreturn scores @ self.weights" ]
<|body_start_0|> super().__init__() if weights is not None and (not np.isclose(weights.sum(), 1)): raise ValueError('Weights must sum to 1.') self.weights = weights <|end_body_0|> <|body_start_1|> if self.weights is None: m = scores.shape[-1] self.wei...
AverageAggregator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AverageAggregator: def __init__(self, weights: Optional[torch.Tensor]=None): """Averages the scores of the detectors in an ensemble. Parameters ---------- weights Optional parameter to weight the scores. If `weights` is left ``None`` then will be set to a vector of ones. Raises ------ Va...
stack_v2_sparse_classes_10k_train_001526
9,337
permissive
[ { "docstring": "Averages the scores of the detectors in an ensemble. Parameters ---------- weights Optional parameter to weight the scores. If `weights` is left ``None`` then will be set to a vector of ones. Raises ------ ValueError If `weights` does not sum to ``1``.", "name": "__init__", "signature": ...
2
stack_v2_sparse_classes_30k_train_006412
Implement the Python class `AverageAggregator` described below. Class description: Implement the AverageAggregator class. Method signatures and docstrings: - def __init__(self, weights: Optional[torch.Tensor]=None): Averages the scores of the detectors in an ensemble. Parameters ---------- weights Optional parameter ...
Implement the Python class `AverageAggregator` described below. Class description: Implement the AverageAggregator class. Method signatures and docstrings: - def __init__(self, weights: Optional[torch.Tensor]=None): Averages the scores of the detectors in an ensemble. Parameters ---------- weights Optional parameter ...
4a1b4f74a8590117965421e86c2295bff0f33e89
<|skeleton|> class AverageAggregator: def __init__(self, weights: Optional[torch.Tensor]=None): """Averages the scores of the detectors in an ensemble. Parameters ---------- weights Optional parameter to weight the scores. If `weights` is left ``None`` then will be set to a vector of ones. Raises ------ Va...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AverageAggregator: def __init__(self, weights: Optional[torch.Tensor]=None): """Averages the scores of the detectors in an ensemble. Parameters ---------- weights Optional parameter to weight the scores. If `weights` is left ``None`` then will be set to a vector of ones. Raises ------ ValueError If `w...
the_stack_v2_python_sparse
alibi_detect/od/pytorch/ensemble.py
SeldonIO/alibi-detect
train
1,922
4803cb51431bb469ea5de378fb41ed534113d883
[ "super().__init__(args, functionToRun, **kwargs)\nself.subque = collections.deque()\nself.skipOnCopy.append('subque')\nself.thread = None", "if not self.started:\n return False\nif self.thread is None:\n return True\nelse:\n return not self.thread.is_alive()", "if not self.hasBeenAdded:\n self._coll...
<|body_start_0|> super().__init__(args, functionToRun, **kwargs) self.subque = collections.deque() self.skipOnCopy.append('subque') self.thread = None <|end_body_0|> <|body_start_1|> if not self.started: return False if self.thread is None: return...
Class for running internal objects in a threaded fashion using the built-in threading library
SharedMemoryRunner
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SharedMemoryRunner: """Class for running internal objects in a threaded fashion using the built-in threading library""" def __init__(self, args, functionToRun, **kwargs): """Init method @ In, args, dict, this is a list of arguments that will be passed as function parameters into what...
stack_v2_sparse_classes_10k_train_001527
7,256
permissive
[ { "docstring": "Init method @ In, args, dict, this is a list of arguments that will be passed as function parameters into whatever method is stored in functionToRun. e.g., functionToRun(*args) @ In, functionToRun, method or function, function that needs to be run @ In, kwargs, dict, additional arguments to pass...
6
stack_v2_sparse_classes_30k_train_002305
Implement the Python class `SharedMemoryRunner` described below. Class description: Class for running internal objects in a threaded fashion using the built-in threading library Method signatures and docstrings: - def __init__(self, args, functionToRun, **kwargs): Init method @ In, args, dict, this is a list of argum...
Implement the Python class `SharedMemoryRunner` described below. Class description: Class for running internal objects in a threaded fashion using the built-in threading library Method signatures and docstrings: - def __init__(self, args, functionToRun, **kwargs): Init method @ In, args, dict, this is a list of argum...
2b16e7aa3325fe84cab2477947a951414c635381
<|skeleton|> class SharedMemoryRunner: """Class for running internal objects in a threaded fashion using the built-in threading library""" def __init__(self, args, functionToRun, **kwargs): """Init method @ In, args, dict, this is a list of arguments that will be passed as function parameters into what...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SharedMemoryRunner: """Class for running internal objects in a threaded fashion using the built-in threading library""" def __init__(self, args, functionToRun, **kwargs): """Init method @ In, args, dict, this is a list of arguments that will be passed as function parameters into whatever method i...
the_stack_v2_python_sparse
ravenframework/Runners/SharedMemoryRunner.py
idaholab/raven
train
201
923f9447f414f81193353def17042d5976d2b1bd
[ "text = simplicity.file_opener('sample.rst')\nself.assertNotEqual(text, 'sample.rst')\ntext = simplicity.file_opener('README.rst')\nself.assertNotEqual(text, 'README.rst')", "with open('sample.rst') as f:\n text = f.read()\nself.assertEqual(text, simplicity.file_opener('sample.rst'))" ]
<|body_start_0|> text = simplicity.file_opener('sample.rst') self.assertNotEqual(text, 'sample.rst') text = simplicity.file_opener('README.rst') self.assertNotEqual(text, 'README.rst') <|end_body_0|> <|body_start_1|> with open('sample.rst') as f: text = f.read() ...
FileOpener
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileOpener: def test_basics(self): """I test that file_opener returns more than just itself!""" <|body_0|> def test_open(self): """I test that file_opener gets things correctly!""" <|body_1|> <|end_skeleton|> <|body_start_0|> text = simplicity.file_...
stack_v2_sparse_classes_10k_train_001528
6,339
no_license
[ { "docstring": "I test that file_opener returns more than just itself!", "name": "test_basics", "signature": "def test_basics(self)" }, { "docstring": "I test that file_opener gets things correctly!", "name": "test_open", "signature": "def test_open(self)" } ]
2
null
Implement the Python class `FileOpener` described below. Class description: Implement the FileOpener class. Method signatures and docstrings: - def test_basics(self): I test that file_opener returns more than just itself! - def test_open(self): I test that file_opener gets things correctly!
Implement the Python class `FileOpener` described below. Class description: Implement the FileOpener class. Method signatures and docstrings: - def test_basics(self): I test that file_opener returns more than just itself! - def test_open(self): I test that file_opener gets things correctly! <|skeleton|> class FileOp...
0ac6653219c2701c13c508c5c4fc9bc3437eea06
<|skeleton|> class FileOpener: def test_basics(self): """I test that file_opener returns more than just itself!""" <|body_0|> def test_open(self): """I test that file_opener gets things correctly!""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FileOpener: def test_basics(self): """I test that file_opener returns more than just itself!""" text = simplicity.file_opener('sample.rst') self.assertNotEqual(text, 'sample.rst') text = simplicity.file_opener('README.rst') self.assertNotEqual(text, 'README.rst') d...
the_stack_v2_python_sparse
repoData/pydanny-simplicity/allPythonContent.py
aCoffeeYin/pyreco
train
0
60014608146cb20e89e8802abb2693fffeec27da
[ "res = 0\nfor i in range(len(s) + 1):\n temp = self.helper(s, i)\n res = max(res, temp)\nreturn res", "res = len(s)\nfor i in range(len(s)):\n if s[i] == '0' and i < left_end:\n res += 1\n elif s[i] == '1' and i >= left_end:\n res += 1\nreturn res" ]
<|body_start_0|> res = 0 for i in range(len(s) + 1): temp = self.helper(s, i) res = max(res, temp) return res <|end_body_0|> <|body_start_1|> res = len(s) for i in range(len(s)): if s[i] == '0' and i < left_end: res += 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def func(self, s): """Args: s: list[int] Return: int""" <|body_0|> def helper(self, s, left_end): """Args: s: str left_end: int Return: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = 0 for i in range(len(s) + 1): ...
stack_v2_sparse_classes_10k_train_001529
744
no_license
[ { "docstring": "Args: s: list[int] Return: int", "name": "func", "signature": "def func(self, s)" }, { "docstring": "Args: s: str left_end: int Return: int", "name": "helper", "signature": "def helper(self, s, left_end)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def func(self, s): Args: s: list[int] Return: int - def helper(self, s, left_end): Args: s: str left_end: int Return: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def func(self, s): Args: s: list[int] Return: int - def helper(self, s, left_end): Args: s: str left_end: int Return: int <|skeleton|> class Solution: def func(self, s): ...
101bce2fac8b188a4eb2f5e017293d21ad0ecb21
<|skeleton|> class Solution: def func(self, s): """Args: s: list[int] Return: int""" <|body_0|> def helper(self, s, left_end): """Args: s: str left_end: int Return: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def func(self, s): """Args: s: list[int] Return: int""" res = 0 for i in range(len(s) + 1): temp = self.helper(s, i) res = max(res, temp) return res def helper(self, s, left_end): """Args: s: str left_end: int Return: int""" ...
the_stack_v2_python_sparse
秋招/网易/网易云音乐/1.py
AiZhanghan/Leetcode
train
0
ba93715786f1a6fed25ec3b8d8746d07ccbcefa9
[ "super(DecoderLayer, self).__init__()\nwith self.init_scope():\n self.self_attn = MultiHeadAttention(n_units, h, dropout=dropout, initialW=initialW, initial_bias=initial_bias)\n self.src_attn = MultiHeadAttention(n_units, h, dropout=dropout, initialW=initialW, initial_bias=initial_bias)\n self.feed_forward...
<|body_start_0|> super(DecoderLayer, self).__init__() with self.init_scope(): self.self_attn = MultiHeadAttention(n_units, h, dropout=dropout, initialW=initialW, initial_bias=initial_bias) self.src_attn = MultiHeadAttention(n_units, h, dropout=dropout, initialW=initialW, initial_...
Single decoder layer module. Args: n_units (int): Number of input/output dimension of a FeedForward layer. d_units (int): Number of units of hidden layer in a FeedForward layer. h (int): Number of attention heads. dropout (float): Dropout rate
DecoderLayer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DecoderLayer: """Single decoder layer module. Args: n_units (int): Number of input/output dimension of a FeedForward layer. d_units (int): Number of units of hidden layer in a FeedForward layer. h (int): Number of attention heads. dropout (float): Dropout rate""" def __init__(self, n_units, ...
stack_v2_sparse_classes_10k_train_001530
2,526
permissive
[ { "docstring": "Initialize DecoderLayer.", "name": "__init__", "signature": "def __init__(self, n_units, d_units=0, h=8, dropout=0.1, initialW=None, initial_bias=None)" }, { "docstring": "Compute Encoder layer. Args: e (chainer.Variable): Batch of padded features. (B, Lmax) s (chainer.Variable):...
2
null
Implement the Python class `DecoderLayer` described below. Class description: Single decoder layer module. Args: n_units (int): Number of input/output dimension of a FeedForward layer. d_units (int): Number of units of hidden layer in a FeedForward layer. h (int): Number of attention heads. dropout (float): Dropout ra...
Implement the Python class `DecoderLayer` described below. Class description: Single decoder layer module. Args: n_units (int): Number of input/output dimension of a FeedForward layer. d_units (int): Number of units of hidden layer in a FeedForward layer. h (int): Number of attention heads. dropout (float): Dropout ra...
bcd20948db7846ee523443ef9fd78c7a1248c95e
<|skeleton|> class DecoderLayer: """Single decoder layer module. Args: n_units (int): Number of input/output dimension of a FeedForward layer. d_units (int): Number of units of hidden layer in a FeedForward layer. h (int): Number of attention heads. dropout (float): Dropout rate""" def __init__(self, n_units, ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DecoderLayer: """Single decoder layer module. Args: n_units (int): Number of input/output dimension of a FeedForward layer. d_units (int): Number of units of hidden layer in a FeedForward layer. h (int): Number of attention heads. dropout (float): Dropout rate""" def __init__(self, n_units, d_units=0, h=...
the_stack_v2_python_sparse
espnet/nets/chainer_backend/transformer/decoder_layer.py
espnet/espnet
train
7,242
e8e05023d5d3a4d7d689422fe3aae4b55299e097
[ "ip_dict = {'Address': ['1.1.1.1', '1.2.3.4'], 'Range': ['1.1.1.3-1.1.2.1']}\ndicts = create_ip_list_dicts(ip_dict)\nassert len(dicts[0]) == 2\nassert len(dicts[1]) == 1", "ip_dict = {'Address': '1.1.1.1'}\ndicts = create_ip_list_dicts(ip_dict)\nassert len(dicts) == 1\nassert len(dicts[0]) == 1", "ip_dict = {'A...
<|body_start_0|> ip_dict = {'Address': ['1.1.1.1', '1.2.3.4'], 'Range': ['1.1.1.3-1.1.2.1']} dicts = create_ip_list_dicts(ip_dict) assert len(dicts[0]) == 2 assert len(dicts[1]) == 1 <|end_body_0|> <|body_start_1|> ip_dict = {'Address': '1.1.1.1'} dicts = create_ip_list_...
TestCreateIPListDicts
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCreateIPListDicts: def test_create_ip_list_dicts_expected_format(self): """Given - dictionary of ip list command result When - the dictionary has the expected format Then - create a list of dictionaries""" <|body_0|> def test_create_ip_list_dicts_expected_format_single_v...
stack_v2_sparse_classes_10k_train_001531
44,285
permissive
[ { "docstring": "Given - dictionary of ip list command result When - the dictionary has the expected format Then - create a list of dictionaries", "name": "test_create_ip_list_dicts_expected_format", "signature": "def test_create_ip_list_dicts_expected_format(self)" }, { "docstring": "Given - dic...
6
null
Implement the Python class `TestCreateIPListDicts` described below. Class description: Implement the TestCreateIPListDicts class. Method signatures and docstrings: - def test_create_ip_list_dicts_expected_format(self): Given - dictionary of ip list command result When - the dictionary has the expected format Then - c...
Implement the Python class `TestCreateIPListDicts` described below. Class description: Implement the TestCreateIPListDicts class. Method signatures and docstrings: - def test_create_ip_list_dicts_expected_format(self): Given - dictionary of ip list command result When - the dictionary has the expected format Then - c...
890def5a0e0ae8d6eaa538148249ddbc851dbb6b
<|skeleton|> class TestCreateIPListDicts: def test_create_ip_list_dicts_expected_format(self): """Given - dictionary of ip list command result When - the dictionary has the expected format Then - create a list of dictionaries""" <|body_0|> def test_create_ip_list_dicts_expected_format_single_v...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestCreateIPListDicts: def test_create_ip_list_dicts_expected_format(self): """Given - dictionary of ip list command result When - the dictionary has the expected format Then - create a list of dictionaries""" ip_dict = {'Address': ['1.1.1.1', '1.2.3.4'], 'Range': ['1.1.1.3-1.1.2.1']} ...
the_stack_v2_python_sparse
Packs/qualys/Integrations/Qualysv2/Qualysv2_test.py
demisto/content
train
1,023
69e99b258182a9c78627a6973f04b5d62b13e744
[ "n = len(prices)\ndp = [[None] * 5 for _ in range(n)]\ndp[0][0] = 0\ndp[0][1] = -prices[0]\ndp[0][2] = 0\ndp[0][3] = -prices[0]\ndp[0][4] = 0\nfor idx in range(1, n):\n dp[idx][0] = 0\n dp[idx][1] = max(dp[idx - 1][1], dp[idx - 1][0] - prices[idx])\n dp[idx][2] = max(dp[idx - 1][2], dp[idx - 1][1] + prices...
<|body_start_0|> n = len(prices) dp = [[None] * 5 for _ in range(n)] dp[0][0] = 0 dp[0][1] = -prices[0] dp[0][2] = 0 dp[0][3] = -prices[0] dp[0][4] = 0 for idx in range(1, n): dp[idx][0] = 0 dp[idx][1] = max(dp[idx - 1][1], dp[idx -...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, prices: List[int]) -> int: """动态规划-二维数组""" <|body_0|> def maxProfitDPOpt(self, prices: List[int]) -> int: """动态规划-空间优化""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(prices) dp = [[None] * 5 for _ in ra...
stack_v2_sparse_classes_10k_train_001532
2,661
no_license
[ { "docstring": "动态规划-二维数组", "name": "maxProfit", "signature": "def maxProfit(self, prices: List[int]) -> int" }, { "docstring": "动态规划-空间优化", "name": "maxProfitDPOpt", "signature": "def maxProfitDPOpt(self, prices: List[int]) -> int" } ]
2
stack_v2_sparse_classes_30k_train_006265
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices: List[int]) -> int: 动态规划-二维数组 - def maxProfitDPOpt(self, prices: List[int]) -> int: 动态规划-空间优化
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices: List[int]) -> int: 动态规划-二维数组 - def maxProfitDPOpt(self, prices: List[int]) -> int: 动态规划-空间优化 <|skeleton|> class Solution: def maxProfit(self, pr...
52756b30e9d51794591aca030bc918e707f473f1
<|skeleton|> class Solution: def maxProfit(self, prices: List[int]) -> int: """动态规划-二维数组""" <|body_0|> def maxProfitDPOpt(self, prices: List[int]) -> int: """动态规划-空间优化""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit(self, prices: List[int]) -> int: """动态规划-二维数组""" n = len(prices) dp = [[None] * 5 for _ in range(n)] dp[0][0] = 0 dp[0][1] = -prices[0] dp[0][2] = 0 dp[0][3] = -prices[0] dp[0][4] = 0 for idx in range(1, n): ...
the_stack_v2_python_sparse
123.买卖股票的最佳时机III/solution.py
QtTao/daily_leetcode
train
0
c76bdeb34099414b91b0d717b82c3ec2f2ccfbbc
[ "Component.__init__(self)\nself.name = 'Compressor_default_name'\nself.bus_h2_in = None\nself.bus_h2_out = None\nself.bus_el = None\nself.m_flow_max = 33.6\nself.life_time = 20\nself.temp_in = 293.15\nself.efficiency = 0.88829\nself.set_parameters(params)\nself.spec_compression_energy = None\nself.R = 8.314\nself.M...
<|body_start_0|> Component.__init__(self) self.name = 'Compressor_default_name' self.bus_h2_in = None self.bus_h2_out = None self.bus_el = None self.m_flow_max = 33.6 self.life_time = 20 self.temp_in = 293.15 self.efficiency = 0.88829 self....
:param name: unique name given to the compressor component :type name: str :param bus_h2_in: lower pressure hydrogen bus that is an input of the compressor :type bus_h2_in: str :param bus_el: electricity bus that is an input of the compressor :type bus_el: str :param bus_h2_out: higher pressure hydrogen bus that is the...
CompressorH2
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CompressorH2: """:param name: unique name given to the compressor component :type name: str :param bus_h2_in: lower pressure hydrogen bus that is an input of the compressor :type bus_h2_in: str :param bus_el: electricity bus that is an input of the compressor :type bus_el: str :param bus_h2_out: ...
stack_v2_sparse_classes_10k_train_001533
10,964
permissive
[ { "docstring": "Constructor method", "name": "__init__", "signature": "def __init__(self, params)" }, { "docstring": "Creates an oemof Transformer component using the information given in the CompressorH2 class, to be used in the oemof model :param busses: virtual buses used in the energy system...
4
stack_v2_sparse_classes_30k_train_001757
Implement the Python class `CompressorH2` described below. Class description: :param name: unique name given to the compressor component :type name: str :param bus_h2_in: lower pressure hydrogen bus that is an input of the compressor :type bus_h2_in: str :param bus_el: electricity bus that is an input of the compresso...
Implement the Python class `CompressorH2` described below. Class description: :param name: unique name given to the compressor component :type name: str :param bus_h2_in: lower pressure hydrogen bus that is an input of the compressor :type bus_h2_in: str :param bus_el: electricity bus that is an input of the compresso...
0d4d55d587c18d9e05258f85c1bb41c0b5fdaee7
<|skeleton|> class CompressorH2: """:param name: unique name given to the compressor component :type name: str :param bus_h2_in: lower pressure hydrogen bus that is an input of the compressor :type bus_h2_in: str :param bus_el: electricity bus that is an input of the compressor :type bus_el: str :param bus_h2_out: ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CompressorH2: """:param name: unique name given to the compressor component :type name: str :param bus_h2_in: lower pressure hydrogen bus that is an input of the compressor :type bus_h2_in: str :param bus_el: electricity bus that is an input of the compressor :type bus_el: str :param bus_h2_out: higher pressu...
the_stack_v2_python_sparse
smooth/components/component_compressor_h2.py
rl-institut/smooth
train
7
4af76edc472e5a9d297e4282a38f5c5782d8d3d0
[ "if self.state_model.op_state in [DevState.FAULT, DevState.UNKNOWN, DevState.DISABLE]:\n return False\nreturn True", "device_data = self.target\ncommand_name = 'Abort'\ndevice_data.event_track_time.set()\ncmd_ended_cb = CommandCallBack(self.logger).cmd_ended_cb\ntry:\n this_server = TangoServerHelper.get_in...
<|body_start_0|> if self.state_model.op_state in [DevState.FAULT, DevState.UNKNOWN, DevState.DISABLE]: return False return True <|end_body_0|> <|body_start_1|> device_data = self.target command_name = 'Abort' device_data.event_track_time.set() cmd_ended_cb = ...
A class for DishLeafNode's Abort command.
Abort
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Abort: """A class for DishLeafNode's Abort command.""" def check_allowed(self): """Checks whether this command is allowed to be run in current device state :return: True if this command is allowed to be run in current device state :rtype: boolean""" <|body_0|> def do(sel...
stack_v2_sparse_classes_10k_train_001534
2,704
permissive
[ { "docstring": "Checks whether this command is allowed to be run in current device state :return: True if this command is allowed to be run in current device state :rtype: boolean", "name": "check_allowed", "signature": "def check_allowed(self)" }, { "docstring": "Invokes TrackStop command on th...
2
stack_v2_sparse_classes_30k_test_000243
Implement the Python class `Abort` described below. Class description: A class for DishLeafNode's Abort command. Method signatures and docstrings: - def check_allowed(self): Checks whether this command is allowed to be run in current device state :return: True if this command is allowed to be run in current device st...
Implement the Python class `Abort` described below. Class description: A class for DishLeafNode's Abort command. Method signatures and docstrings: - def check_allowed(self): Checks whether this command is allowed to be run in current device state :return: True if this command is allowed to be run in current device st...
7ee65a9c8dada9b28893144b372a398bd0646195
<|skeleton|> class Abort: """A class for DishLeafNode's Abort command.""" def check_allowed(self): """Checks whether this command is allowed to be run in current device state :return: True if this command is allowed to be run in current device state :rtype: boolean""" <|body_0|> def do(sel...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Abort: """A class for DishLeafNode's Abort command.""" def check_allowed(self): """Checks whether this command is allowed to be run in current device state :return: True if this command is allowed to be run in current device state :rtype: boolean""" if self.state_model.op_state in [DevSta...
the_stack_v2_python_sparse
temp_src/ska_tmc_dishleafnode_mid/abort_command.py
ska-telescope/tmc-prototype
train
4
4f3b0318c630b43da88388ca43e9262bd47dd651
[ "pmf = thinkbayes.MakePoissonPmf(r, high, step=step)\nthinkbayes.Suite.__init__(self, pmf, name=r)\nself.r = r\nself.f = f", "k = data\nn = hypo\np = self.f\nreturn thinkbayes.EvalBinomialPmf(k, n, p)", "total = 0\nfor hypo, prob in self.Items():\n like = self.Likelihood(data, hypo)\n total += prob * like...
<|body_start_0|> pmf = thinkbayes.MakePoissonPmf(r, high, step=step) thinkbayes.Suite.__init__(self, pmf, name=r) self.r = r self.f = f <|end_body_0|> <|body_start_1|> k = data n = hypo p = self.f return thinkbayes.EvalBinomialPmf(k, n, p) <|end_body_1|> ...
Represents hypotheses about n.
Detector
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Detector: """Represents hypotheses about n.""" def __init__(self, r, f, high=500, step=5): """Initializes the suite. r: known emission rate, r f: fraction of particles registered high: maximum number of particles, n step: step size between hypothetical values of n""" <|body_0...
stack_v2_sparse_classes_10k_train_001535
5,605
permissive
[ { "docstring": "Initializes the suite. r: known emission rate, r f: fraction of particles registered high: maximum number of particles, n step: step size between hypothetical values of n", "name": "__init__", "signature": "def __init__(self, r, f, high=500, step=5)" }, { "docstring": "Likelihood...
3
null
Implement the Python class `Detector` described below. Class description: Represents hypotheses about n. Method signatures and docstrings: - def __init__(self, r, f, high=500, step=5): Initializes the suite. r: known emission rate, r f: fraction of particles registered high: maximum number of particles, n step: step ...
Implement the Python class `Detector` described below. Class description: Represents hypotheses about n. Method signatures and docstrings: - def __init__(self, r, f, high=500, step=5): Initializes the suite. r: known emission rate, r f: fraction of particles registered high: maximum number of particles, n step: step ...
53c7ce7ca7da62c9fbb3d991ae9e4e34d07ece5f
<|skeleton|> class Detector: """Represents hypotheses about n.""" def __init__(self, r, f, high=500, step=5): """Initializes the suite. r: known emission rate, r f: fraction of particles registered high: maximum number of particles, n step: step size between hypothetical values of n""" <|body_0...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Detector: """Represents hypotheses about n.""" def __init__(self, r, f, high=500, step=5): """Initializes the suite. r: known emission rate, r f: fraction of particles registered high: maximum number of particles, n step: step size between hypothetical values of n""" pmf = thinkbayes.Make...
the_stack_v2_python_sparse
python/learn/thinkbayes/jaynes.py
qrsforever/workspace
train
2
94dfbea49d648d211a72dbae07fb1d7a9f7e437c
[ "UserSim.__init__(self, error_evaluator)\nself.user_type = 'real'\nself.bool_undo = bool_undo\nself.undo_semantic_units = []", "self.questioned_pointers.append(pointer)\nif self.bool_undo:\n answer = input('Please enter yes(y)/no(n)/undo/exit: ').lower().strip()\n while answer not in {'yes', 'no', 'exit', '...
<|body_start_0|> UserSim.__init__(self, error_evaluator) self.user_type = 'real' self.bool_undo = bool_undo self.undo_semantic_units = [] <|end_body_0|> <|body_start_1|> self.questioned_pointers.append(pointer) if self.bool_undo: answer = input('Please enter ...
This is the class for real users (used in user study).
RealUser
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RealUser: """This is the class for real users (used in user study).""" def __init__(self, error_evaluator, bool_undo=True): """Constructor of RealUser. :param error_evaluator: An instance of ErrorEvaluator.""" <|body_0|> def get_answer(self, pointer, *args): """R...
stack_v2_sparse_classes_10k_train_001536
9,856
permissive
[ { "docstring": "Constructor of RealUser. :param error_evaluator: An instance of ErrorEvaluator.", "name": "__init__", "signature": "def __init__(self, error_evaluator, bool_undo=True)" }, { "docstring": "Request for user answers. :param pointer: the pointer to the questioned semantic unit. :para...
3
stack_v2_sparse_classes_30k_train_003783
Implement the Python class `RealUser` described below. Class description: This is the class for real users (used in user study). Method signatures and docstrings: - def __init__(self, error_evaluator, bool_undo=True): Constructor of RealUser. :param error_evaluator: An instance of ErrorEvaluator. - def get_answer(sel...
Implement the Python class `RealUser` described below. Class description: This is the class for real users (used in user study). Method signatures and docstrings: - def __init__(self, error_evaluator, bool_undo=True): Constructor of RealUser. :param error_evaluator: An instance of ErrorEvaluator. - def get_answer(sel...
7870566ab6b9e121d648478968367bc79c12f7ef
<|skeleton|> class RealUser: """This is the class for real users (used in user study).""" def __init__(self, error_evaluator, bool_undo=True): """Constructor of RealUser. :param error_evaluator: An instance of ErrorEvaluator.""" <|body_0|> def get_answer(self, pointer, *args): """R...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RealUser: """This is the class for real users (used in user study).""" def __init__(self, error_evaluator, bool_undo=True): """Constructor of RealUser. :param error_evaluator: An instance of ErrorEvaluator.""" UserSim.__init__(self, error_evaluator) self.user_type = 'real' ...
the_stack_v2_python_sparse
MISP_SQL/environment.py
sunlab-osu/MISP
train
59
78684c89a06df79f0c2207c4a41c7b4ebdf4a036
[ "y = 0\nfor x in range(len(nums)):\n if nums[x]:\n nums[x], nums[y] = (nums[y], nums[x])\n y += 1", "l = len(nums)\nfor i in range(l):\n if nums[i] == 0:\n j = i + 1\n while j < l and nums[j] == 0:\n j += 1\n if j < l:\n nums[i], nums[j] = (nums[j], n...
<|body_start_0|> y = 0 for x in range(len(nums)): if nums[x]: nums[x], nums[y] = (nums[y], nums[x]) y += 1 <|end_body_0|> <|body_start_1|> l = len(nums) for i in range(l): if nums[i] == 0: j = i + 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def moveZeroes(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.""" <|body_0|> def moveZeroes(self, nums: List[int]) -> None: """Do not return anything, modify nums in-place instead.""" <|body_1...
stack_v2_sparse_classes_10k_train_001537
1,129
no_license
[ { "docstring": ":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.", "name": "moveZeroes", "signature": "def moveZeroes(self, nums)" }, { "docstring": "Do not return anything, modify nums in-place instead.", "name": "moveZeroes", "signature": "def mo...
2
stack_v2_sparse_classes_30k_train_005448
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def moveZeroes(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. - def moveZeroes(self, nums: List[int]) -> None: Do not retur...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def moveZeroes(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. - def moveZeroes(self, nums: List[int]) -> None: Do not retur...
378cb9b53e7710c5cf546f5d75e572060e2a211a
<|skeleton|> class Solution: def moveZeroes(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.""" <|body_0|> def moveZeroes(self, nums: List[int]) -> None: """Do not return anything, modify nums in-place instead.""" <|body_1...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def moveZeroes(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.""" y = 0 for x in range(len(nums)): if nums[x]: nums[x], nums[y] = (nums[y], nums[x]) y += 1 def moveZeroes...
the_stack_v2_python_sparse
283.MoveZeroes.py
RupertMa/LeetCode-Playground
train
0
f61d606639088dd477963fa8ce5e5effb4675a20
[ "res = {}\nfor section in config.sections(issuer=request.environ.get('issuer'), vo=request.environ.get('vo')):\n res[section] = {}\n for item in config.items(section, issuer=request.environ.get('issuer'), vo=request.environ.get('vo')):\n res[section][item[0]] = item[1]\nreturn (jsonify(res), 200)", "...
<|body_start_0|> res = {} for section in config.sections(issuer=request.environ.get('issuer'), vo=request.environ.get('vo')): res[section] = {} for item in config.items(section, issuer=request.environ.get('issuer'), vo=request.environ.get('vo')): res[section][item...
REST API for full configuration.
Config
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Config: """REST API for full configuration.""" def get(self): """--- summary: List description: List the full configuration. tags: - Config responses: 200: description: OK content: application/json: schema: description: A dict with the sections as keys and a dict with the configurati...
stack_v2_sparse_classes_10k_train_001538
10,156
permissive
[ { "docstring": "--- summary: List description: List the full configuration. tags: - Config responses: 200: description: OK content: application/json: schema: description: A dict with the sections as keys and a dict with the configuration as value. type: object 401: description: Invalid Auth Token 406: descripti...
2
stack_v2_sparse_classes_30k_train_004556
Implement the Python class `Config` described below. Class description: REST API for full configuration. Method signatures and docstrings: - def get(self): --- summary: List description: List the full configuration. tags: - Config responses: 200: description: OK content: application/json: schema: description: A dict ...
Implement the Python class `Config` described below. Class description: REST API for full configuration. Method signatures and docstrings: - def get(self): --- summary: List description: List the full configuration. tags: - Config responses: 200: description: OK content: application/json: schema: description: A dict ...
7f0d229ac0b3bc7dec12c6e158bea2b82d414a3b
<|skeleton|> class Config: """REST API for full configuration.""" def get(self): """--- summary: List description: List the full configuration. tags: - Config responses: 200: description: OK content: application/json: schema: description: A dict with the sections as keys and a dict with the configurati...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Config: """REST API for full configuration.""" def get(self): """--- summary: List description: List the full configuration. tags: - Config responses: 200: description: OK content: application/json: schema: description: A dict with the sections as keys and a dict with the configuration as value. ...
the_stack_v2_python_sparse
lib/rucio/web/rest/flaskapi/v1/config.py
rucio/rucio
train
232
9c92976cc44735c8181fda6b49d999cfe9630247
[ "if server_ip == '' and server_port != 0 or (server_ip != '' and server_port == 0):\n raise Exception('server_ip和server_port必须同时指定')\nself._server_ip = server_ip\nself._server_port = server_port\nself._service_name = service_name\nself._host = host", "headers = {'org': org, 'user': user}\nroute_name = ''\nserv...
<|body_start_0|> if server_ip == '' and server_port != 0 or (server_ip != '' and server_port == 0): raise Exception('server_ip和server_port必须同时指定') self._server_ip = server_ip self._server_port = server_port self._service_name = service_name self._host = host <|end_bod...
ExecuteClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExecuteClient: def __init__(self, server_ip='', server_port=0, service_name='', host=''): """初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和servi...
stack_v2_sparse_classes_10k_train_001539
6,070
permissive
[ { "docstring": "初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和service_name同时设置,server_ip优先级更高 :param host: 指定sdk请求服务的host名称, 如cmdb.easyops-only.com", "name": "__ini...
4
stack_v2_sparse_classes_30k_train_001605
Implement the Python class `ExecuteClient` described below. Class description: Implement the ExecuteClient class. Method signatures and docstrings: - def __init__(self, server_ip='', server_port=0, service_name='', host=''): 初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_p...
Implement the Python class `ExecuteClient` described below. Class description: Implement the ExecuteClient class. Method signatures and docstrings: - def __init__(self, server_ip='', server_port=0, service_name='', host=''): 初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_p...
adf6e3bad33fa6266b5fa0a449dd4ac42f8447d0
<|skeleton|> class ExecuteClient: def __init__(self, server_ip='', server_port=0, service_name='', host=''): """初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和servi...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ExecuteClient: def __init__(self, server_ip='', server_port=0, service_name='', host=''): """初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和service_name同时设置,se...
the_stack_v2_python_sparse
flow_sdk/api/execute/execute_client.py
easyopsapis/easyops-api-python
train
5
affb9f2df666928742fb99fae67a15df05a78f37
[ "xml_ele = ET.fromstring(serialized_str)\ncls._remove_xml_etree_namespace(xml_ele, Constants.XML_API_NAMESPACE)\ngroups = []\nfor group in xml_ele.findall('security_group'):\n groups.append(SecurityGroup._xml_ele_to_obj(group))\nreturn groups", "ret = []\njson_dict = json.loads(serialized_str)\ngroups = json_d...
<|body_start_0|> xml_ele = ET.fromstring(serialized_str) cls._remove_xml_etree_namespace(xml_ele, Constants.XML_API_NAMESPACE) groups = [] for group in xml_ele.findall('security_group'): groups.append(SecurityGroup._xml_ele_to_obj(group)) return groups <|end_body_0|> ...
SecurityGroups
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SecurityGroups: def _xml_to_obj(cls, serialized_str): """@summary: Returns a list of a SecurityGroup based on the xml serialized_str passed in. @param serialized_str: xml serialized string. @type serialized_str: String. @return: List. @rtype: List.""" <|body_0|> def _json_to...
stack_v2_sparse_classes_10k_train_001540
5,294
permissive
[ { "docstring": "@summary: Returns a list of a SecurityGroup based on the xml serialized_str passed in. @param serialized_str: xml serialized string. @type serialized_str: String. @return: List. @rtype: List.", "name": "_xml_to_obj", "signature": "def _xml_to_obj(cls, serialized_str)" }, { "docst...
2
null
Implement the Python class `SecurityGroups` described below. Class description: Implement the SecurityGroups class. Method signatures and docstrings: - def _xml_to_obj(cls, serialized_str): @summary: Returns a list of a SecurityGroup based on the xml serialized_str passed in. @param serialized_str: xml serialized str...
Implement the Python class `SecurityGroups` described below. Class description: Implement the SecurityGroups class. Method signatures and docstrings: - def _xml_to_obj(cls, serialized_str): @summary: Returns a list of a SecurityGroup based on the xml serialized_str passed in. @param serialized_str: xml serialized str...
7d49cf6bfd7e1a6e5b739e7de52f2e18e5ccf924
<|skeleton|> class SecurityGroups: def _xml_to_obj(cls, serialized_str): """@summary: Returns a list of a SecurityGroup based on the xml serialized_str passed in. @param serialized_str: xml serialized string. @type serialized_str: String. @return: List. @rtype: List.""" <|body_0|> def _json_to...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SecurityGroups: def _xml_to_obj(cls, serialized_str): """@summary: Returns a list of a SecurityGroup based on the xml serialized_str passed in. @param serialized_str: xml serialized string. @type serialized_str: String. @return: List. @rtype: List.""" xml_ele = ET.fromstring(serialized_str) ...
the_stack_v2_python_sparse
cloudcafe/compute/extensions/security_groups_api/models/security_group.py
kurhula/cloudcafe
train
0
d4c0e4196111b8af34ccf7cdc63f1a47a9a78e9f
[ "assert isinstance(block_string, str)\nops = block_string.split('_')\noptions = {}\nfor op in ops:\n splits = re.split('(\\\\d.*)', op)\n if len(splits) >= 2:\n key, value = splits[:2]\n options[key] = value\nassert 's' in options and len(options['s']) == 1 or (len(options['s']) == 2 and options...
<|body_start_0|> assert isinstance(block_string, str) ops = block_string.split('_') options = {} for op in ops: splits = re.split('(\\d.*)', op) if len(splits) >= 2: key, value = splits[:2] options[key] = value assert 's' in...
Block Decoder for readability, straight from the official TensorFlow repository.
BlockDecoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BlockDecoder: """Block Decoder for readability, straight from the official TensorFlow repository.""" def _decode_block_string(block_string): """Get a block through a string notation of arguments. Args: block_string (str): A string notation of arguments. Examples: 'r1_k3_s11_e1_i32_o1...
stack_v2_sparse_classes_10k_train_001541
42,101
permissive
[ { "docstring": "Get a block through a string notation of arguments. Args: block_string (str): A string notation of arguments. Examples: 'r1_k3_s11_e1_i32_o16_se0.25_noskip'. Returns: BlockArgs: The namedtuple defined at the top of this file.", "name": "_decode_block_string", "signature": "def _decode_bl...
4
stack_v2_sparse_classes_30k_train_003759
Implement the Python class `BlockDecoder` described below. Class description: Block Decoder for readability, straight from the official TensorFlow repository. Method signatures and docstrings: - def _decode_block_string(block_string): Get a block through a string notation of arguments. Args: block_string (str): A str...
Implement the Python class `BlockDecoder` described below. Class description: Block Decoder for readability, straight from the official TensorFlow repository. Method signatures and docstrings: - def _decode_block_string(block_string): Get a block through a string notation of arguments. Args: block_string (str): A str...
a835a21cc45d13bd1da4b7cf4c0a837d52c2844d
<|skeleton|> class BlockDecoder: """Block Decoder for readability, straight from the official TensorFlow repository.""" def _decode_block_string(block_string): """Get a block through a string notation of arguments. Args: block_string (str): A string notation of arguments. Examples: 'r1_k3_s11_e1_i32_o1...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BlockDecoder: """Block Decoder for readability, straight from the official TensorFlow repository.""" def _decode_block_string(block_string): """Get a block through a string notation of arguments. Args: block_string (str): A string notation of arguments. Examples: 'r1_k3_s11_e1_i32_o16_se0.25_nosk...
the_stack_v2_python_sparse
ImitationLearning/backbone.py
Suryavf/SelfDrivingCar
train
13
93798abde17ade54cb4e99b13ed949f519389d80
[ "skill_set = get_object_or_404(InstrumentAnalysis, slug=slug)\nself.check_object_permissions(request, skill_set)\nserializer = InstrumentAnalysisRetrieveUpdateSerializer(skill_set, many=False)\nreturn Response(data=serializer.data, status=status.HTTP_200_OK)", "instrument_analysis = get_object_or_404(InstrumentAn...
<|body_start_0|> skill_set = get_object_or_404(InstrumentAnalysis, slug=slug) self.check_object_permissions(request, skill_set) serializer = InstrumentAnalysisRetrieveUpdateSerializer(skill_set, many=False) return Response(data=serializer.data, status=status.HTTP_200_OK) <|end_body_0|> ...
InstrumentAnalysisRetrieveUpdateDestroyAPIView
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InstrumentAnalysisRetrieveUpdateDestroyAPIView: def get(self, request, slug=None): """Retrieve""" <|body_0|> def put(self, request, slug=None): """Update""" <|body_1|> <|end_skeleton|> <|body_start_0|> skill_set = get_object_or_404(InstrumentAnalysi...
stack_v2_sparse_classes_10k_train_001542
3,789
permissive
[ { "docstring": "Retrieve", "name": "get", "signature": "def get(self, request, slug=None)" }, { "docstring": "Update", "name": "put", "signature": "def put(self, request, slug=None)" } ]
2
stack_v2_sparse_classes_30k_train_000281
Implement the Python class `InstrumentAnalysisRetrieveUpdateDestroyAPIView` described below. Class description: Implement the InstrumentAnalysisRetrieveUpdateDestroyAPIView class. Method signatures and docstrings: - def get(self, request, slug=None): Retrieve - def put(self, request, slug=None): Update
Implement the Python class `InstrumentAnalysisRetrieveUpdateDestroyAPIView` described below. Class description: Implement the InstrumentAnalysisRetrieveUpdateDestroyAPIView class. Method signatures and docstrings: - def get(self, request, slug=None): Retrieve - def put(self, request, slug=None): Update <|skeleton|> ...
98e1ff8bab7dda3492e5ff637bf5aafd111c840c
<|skeleton|> class InstrumentAnalysisRetrieveUpdateDestroyAPIView: def get(self, request, slug=None): """Retrieve""" <|body_0|> def put(self, request, slug=None): """Update""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class InstrumentAnalysisRetrieveUpdateDestroyAPIView: def get(self, request, slug=None): """Retrieve""" skill_set = get_object_or_404(InstrumentAnalysis, slug=slug) self.check_object_permissions(request, skill_set) serializer = InstrumentAnalysisRetrieveUpdateSerializer(skill_set, ma...
the_stack_v2_python_sparse
mikaponics/instrument/views/resource/instrument_analysis_crud_views.py
mikaponics/mikaponics-back
train
4
09dc5b08544f1c579a47c0861aef266f7eb885f8
[ "if n < 3:\n return 0\nelse:\n num_list = [1] * n\n num_list[0], num_list[1] = (0, 0)\n for i in range(2, int(n ** 0.5 + 1)):\n if num_list[i] == 1:\n num_list[i * i:n:i] = [0] * len(num_list[i * i:n:i])\n return sum(num_list)", "pre = None\nwhile head:\n tmp = head.next\n h...
<|body_start_0|> if n < 3: return 0 else: num_list = [1] * n num_list[0], num_list[1] = (0, 0) for i in range(2, int(n ** 0.5 + 1)): if num_list[i] == 1: num_list[i * i:n:i] = [0] * len(num_list[i * i:n:i]) r...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countPrimes(self, n): """:type n: int :rtype: int""" <|body_0|> def reverseList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n < 3: return 0 else: ...
stack_v2_sparse_classes_10k_train_001543
1,059
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "countPrimes", "signature": "def countPrimes(self, n)" }, { "docstring": ":type head: ListNode :rtype: ListNode", "name": "reverseList", "signature": "def reverseList(self, head)" } ]
2
stack_v2_sparse_classes_30k_train_005348
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countPrimes(self, n): :type n: int :rtype: int - def reverseList(self, head): :type head: ListNode :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countPrimes(self, n): :type n: int :rtype: int - def reverseList(self, head): :type head: ListNode :rtype: ListNode <|skeleton|> class Solution: def countPrimes(self, n...
4251f7d8f4b5c30546424f823a0ec527a06dda5d
<|skeleton|> class Solution: def countPrimes(self, n): """:type n: int :rtype: int""" <|body_0|> def reverseList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def countPrimes(self, n): """:type n: int :rtype: int""" if n < 3: return 0 else: num_list = [1] * n num_list[0], num_list[1] = (0, 0) for i in range(2, int(n ** 0.5 + 1)): if num_list[i] == 1: ...
the_stack_v2_python_sparse
leetcode/11-27-test.py
MaLei666/learngit
train
0
9280b8a652b605b6c18b40ac13aa790e819341b4
[ "content_type = ContentType.objects.get_for_model(instance.__class__)\nobject_id = instance.id\nqueryset = super(UserTrackerManager, self).filter(content_type=content_type, object_id=object_id)\nreturn queryset", "if request.user.is_authenticated:\n viewed_item = self.filter_by_model(instance=instance).filter(...
<|body_start_0|> content_type = ContentType.objects.get_for_model(instance.__class__) object_id = instance.id queryset = super(UserTrackerManager, self).filter(content_type=content_type, object_id=object_id) return queryset <|end_body_0|> <|body_start_1|> if request.user.is_auth...
UserTrackerManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserTrackerManager: def filter_by_model(self, instance): """bar assasse model filter mikone""" <|body_0|> def recommended_list(self, request, instance): """ye recommended list bar assasse category va session""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_001544
3,879
permissive
[ { "docstring": "bar assasse model filter mikone", "name": "filter_by_model", "signature": "def filter_by_model(self, instance)" }, { "docstring": "ye recommended list bar assasse category va session", "name": "recommended_list", "signature": "def recommended_list(self, request, instance)...
2
stack_v2_sparse_classes_30k_train_006793
Implement the Python class `UserTrackerManager` described below. Class description: Implement the UserTrackerManager class. Method signatures and docstrings: - def filter_by_model(self, instance): bar assasse model filter mikone - def recommended_list(self, request, instance): ye recommended list bar assasse category...
Implement the Python class `UserTrackerManager` described below. Class description: Implement the UserTrackerManager class. Method signatures and docstrings: - def filter_by_model(self, instance): bar assasse model filter mikone - def recommended_list(self, request, instance): ye recommended list bar assasse category...
aef47922fdd6488550881ed9d42bf30a0d33a32a
<|skeleton|> class UserTrackerManager: def filter_by_model(self, instance): """bar assasse model filter mikone""" <|body_0|> def recommended_list(self, request, instance): """ye recommended list bar assasse category va session""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UserTrackerManager: def filter_by_model(self, instance): """bar assasse model filter mikone""" content_type = ContentType.objects.get_for_model(instance.__class__) object_id = instance.id queryset = super(UserTrackerManager, self).filter(content_type=content_type, object_id=obj...
the_stack_v2_python_sparse
src/usertrackers/models.py
m3h-D/Myinfoblog
train
0
44f771ad2aa9d61407b6fb37a4e9a9cc35dbd7df
[ "if len(s) < k:\n return 0\ncount = collections.Counter(s)\nbefore = 0\nresult = 0\nfor i in range(len(s) + 1):\n if i == len(s) and before == 0:\n return len(s)\n if i == len(s) or count[s[i]] < k:\n current = s[before:i]\n if current:\n result = max(result, self.longestSub...
<|body_start_0|> if len(s) < k: return 0 count = collections.Counter(s) before = 0 result = 0 for i in range(len(s) + 1): if i == len(s) and before == 0: return len(s) if i == len(s) or count[s[i]] < k: current =...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestSubstring(self, s, k): """:type s: str :type k: int :rtype: int""" <|body_0|> def longestSubstring_v2(self, s, k): """:type s: str :type k: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(s) < k: ...
stack_v2_sparse_classes_10k_train_001545
2,118
no_license
[ { "docstring": ":type s: str :type k: int :rtype: int", "name": "longestSubstring", "signature": "def longestSubstring(self, s, k)" }, { "docstring": ":type s: str :type k: int :rtype: int", "name": "longestSubstring_v2", "signature": "def longestSubstring_v2(self, s, k)" } ]
2
stack_v2_sparse_classes_30k_train_005874
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestSubstring(self, s, k): :type s: str :type k: int :rtype: int - def longestSubstring_v2(self, s, k): :type s: str :type k: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestSubstring(self, s, k): :type s: str :type k: int :rtype: int - def longestSubstring_v2(self, s, k): :type s: str :type k: int :rtype: int <|skeleton|> class Solution:...
d6ddbef76dd8630234f669d272d1f8065c6be128
<|skeleton|> class Solution: def longestSubstring(self, s, k): """:type s: str :type k: int :rtype: int""" <|body_0|> def longestSubstring_v2(self, s, k): """:type s: str :type k: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def longestSubstring(self, s, k): """:type s: str :type k: int :rtype: int""" if len(s) < k: return 0 count = collections.Counter(s) before = 0 result = 0 for i in range(len(s) + 1): if i == len(s) and before == 0: ...
the_stack_v2_python_sparse
395. Longest Substring with At Least K Repeating Characters.py
Mang0o/leetcode
train
0
1f11d1aa9246b51483f9f881a0aef16d0bbd2b22
[ "super(VGG19, self).__init__()\nassert len(output_blocks) >= 1, 'Need at least one output block'\nself.output_blocks = sorted(output_blocks)\nlast_needed_block = self.output_blocks[-1]\nassert last_needed_block <= 5, 'VGG19 has at most 6 blocks'\nlayers = models.vgg19(pretrained=True).features\nself.blocks = nn.Mod...
<|body_start_0|> super(VGG19, self).__init__() assert len(output_blocks) >= 1, 'Need at least one output block' self.output_blocks = sorted(output_blocks) last_needed_block = self.output_blocks[-1] assert last_needed_block <= 5, 'VGG19 has at most 6 blocks' layers = model...
Pretrained VGG19 network, without fully connected layers
VGG19
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VGG19: """Pretrained VGG19 network, without fully connected layers""" def __init__(self, output_blocks=[LAST_FEATURE_MAP], requires_grad=False): """Build pretrained VGG19 Parameters ---------- output_blocks : list of int Indices of feature blocks to return. Each feature block ends be...
stack_v2_sparse_classes_10k_train_001546
2,538
permissive
[ { "docstring": "Build pretrained VGG19 Parameters ---------- output_blocks : list of int Indices of feature blocks to return. Each feature block ends before a max-pooling layer, i.e. the output of a feature block is the output of the last convolutional layer and activation right before the feature map is downsc...
2
stack_v2_sparse_classes_30k_train_002674
Implement the Python class `VGG19` described below. Class description: Pretrained VGG19 network, without fully connected layers Method signatures and docstrings: - def __init__(self, output_blocks=[LAST_FEATURE_MAP], requires_grad=False): Build pretrained VGG19 Parameters ---------- output_blocks : list of int Indice...
Implement the Python class `VGG19` described below. Class description: Pretrained VGG19 network, without fully connected layers Method signatures and docstrings: - def __init__(self, output_blocks=[LAST_FEATURE_MAP], requires_grad=False): Build pretrained VGG19 Parameters ---------- output_blocks : list of int Indice...
1df1fd37e7adc812b7a5e3859801d8d4a5ff5905
<|skeleton|> class VGG19: """Pretrained VGG19 network, without fully connected layers""" def __init__(self, output_blocks=[LAST_FEATURE_MAP], requires_grad=False): """Build pretrained VGG19 Parameters ---------- output_blocks : list of int Indices of feature blocks to return. Each feature block ends be...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class VGG19: """Pretrained VGG19 network, without fully connected layers""" def __init__(self, output_blocks=[LAST_FEATURE_MAP], requires_grad=False): """Build pretrained VGG19 Parameters ---------- output_blocks : list of int Indices of feature blocks to return. Each feature block ends before a max-po...
the_stack_v2_python_sparse
srgan/models/vgg.py
ZrbTz/HypernetworkSiren
train
1
ce53712d4bb18831cbad74c8ec18ed70d25130df
[ "if root is None:\n return []\nif root.left is None and root.right is None:\n if sum == root.val:\n return [[root.val]]\n else:\n return []\nreturn [[root.val, *x] for x in self.pathSum(root.left, sum - root.val) + self.pathSum(root.right, sum - root.val)]", "def dfs(node, backtrack, summat...
<|body_start_0|> if root is None: return [] if root.left is None and root.right is None: if sum == root.val: return [[root.val]] else: return [] return [[root.val, *x] for x in self.pathSum(root.left, sum - root.val) + self.path...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def pathSum(self, root, sum): """05/06/2018 21:21""" <|body_0|> def pathSum(self, root: Optional[TreeNode], targetSum: int) -> List[List[int]]: """08/22/2021 22:30""" <|body_1|> def pathSum(self, root: Optional[TreeNode], targetSum: int) -> Lis...
stack_v2_sparse_classes_10k_train_001547
3,394
no_license
[ { "docstring": "05/06/2018 21:21", "name": "pathSum", "signature": "def pathSum(self, root, sum)" }, { "docstring": "08/22/2021 22:30", "name": "pathSum", "signature": "def pathSum(self, root: Optional[TreeNode], targetSum: int) -> List[List[int]]" }, { "docstring": "10/22/2022 0...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def pathSum(self, root, sum): 05/06/2018 21:21 - def pathSum(self, root: Optional[TreeNode], targetSum: int) -> List[List[int]]: 08/22/2021 22:30 - def pathSum(self, root: Option...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def pathSum(self, root, sum): 05/06/2018 21:21 - def pathSum(self, root: Optional[TreeNode], targetSum: int) -> List[List[int]]: 08/22/2021 22:30 - def pathSum(self, root: Option...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def pathSum(self, root, sum): """05/06/2018 21:21""" <|body_0|> def pathSum(self, root: Optional[TreeNode], targetSum: int) -> List[List[int]]: """08/22/2021 22:30""" <|body_1|> def pathSum(self, root: Optional[TreeNode], targetSum: int) -> Lis...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def pathSum(self, root, sum): """05/06/2018 21:21""" if root is None: return [] if root.left is None and root.right is None: if sum == root.val: return [[root.val]] else: return [] return [[root.val, ...
the_stack_v2_python_sparse
leetcode/solved/113_Path_Sum_II/solution.py
sungminoh/algorithms
train
0
f3dfca092894902a32bcede13550df83662b2c97
[ "u = rolemanage(self.driver)\nu.open_rolemanage()\nself.assertEqual(u.verify(), True)\nu.modify_obj()\nself.assertEqual(u.sub_tagname(), '角色管理-修改')\nu.clear_name()\nu.add_role('Update', '')\nself.assertEqual(u.company_status(), False)\nu.add_save()\nself.assertEqual(u.success(), True)\nfunction.screenshot(self.driv...
<|body_start_0|> u = rolemanage(self.driver) u.open_rolemanage() self.assertEqual(u.verify(), True) u.modify_obj() self.assertEqual(u.sub_tagname(), '角色管理-修改') u.clear_name() u.add_role('Update', '') self.assertEqual(u.company_status(), False) u.ad...
Test016_Role_Modify_P1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test016_Role_Modify_P1: def test_modify_name(self): """修改角色名称""" <|body_0|> def test_modify_description(self): """修改角色备注""" <|body_1|> def test_modify_type(self): """修改角色类型""" <|body_2|> def test_modify_back(self): """修改角色并返回...
stack_v2_sparse_classes_10k_train_001548
2,067
no_license
[ { "docstring": "修改角色名称", "name": "test_modify_name", "signature": "def test_modify_name(self)" }, { "docstring": "修改角色备注", "name": "test_modify_description", "signature": "def test_modify_description(self)" }, { "docstring": "修改角色类型", "name": "test_modify_type", "signatur...
4
stack_v2_sparse_classes_30k_train_006988
Implement the Python class `Test016_Role_Modify_P1` described below. Class description: Implement the Test016_Role_Modify_P1 class. Method signatures and docstrings: - def test_modify_name(self): 修改角色名称 - def test_modify_description(self): 修改角色备注 - def test_modify_type(self): 修改角色类型 - def test_modify_back(self): 修改角色...
Implement the Python class `Test016_Role_Modify_P1` described below. Class description: Implement the Test016_Role_Modify_P1 class. Method signatures and docstrings: - def test_modify_name(self): 修改角色名称 - def test_modify_description(self): 修改角色备注 - def test_modify_type(self): 修改角色类型 - def test_modify_back(self): 修改角色...
6f42c25249fc642cecc270578a180820988d45b5
<|skeleton|> class Test016_Role_Modify_P1: def test_modify_name(self): """修改角色名称""" <|body_0|> def test_modify_description(self): """修改角色备注""" <|body_1|> def test_modify_type(self): """修改角色类型""" <|body_2|> def test_modify_back(self): """修改角色并返回...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Test016_Role_Modify_P1: def test_modify_name(self): """修改角色名称""" u = rolemanage(self.driver) u.open_rolemanage() self.assertEqual(u.verify(), True) u.modify_obj() self.assertEqual(u.sub_tagname(), '角色管理-修改') u.clear_name() u.add_role('Update', ''...
the_stack_v2_python_sparse
GlxssLive_web/TestCase/Manage_Role/Test016_role_modify_P1.py
rrmiracle/GlxssLive
train
0
946c0e46b7e3e6b2a39f7d7686a6a31e7051d7df
[ "super(LSTMime, self).__init__()\nself.hidden_size = d_model\nself.lstm = nn.LSTM(input_size=input_size, hidden_size=d_model, num_layers=layers, batch_first=True)\nself.fc1 = nn.Linear(d_model, d_model)\nself.fc2 = nn.Linear(d_model, num_experts)\nself.fc3 = nn.Linear(d_model, out_len)\nself.drop_out = nn.Dropout(d...
<|body_start_0|> super(LSTMime, self).__init__() self.hidden_size = d_model self.lstm = nn.LSTM(input_size=input_size, hidden_size=d_model, num_layers=layers, batch_first=True) self.fc1 = nn.Linear(d_model, d_model) self.fc2 = nn.Linear(d_model, num_experts) self.fc3 = nn...
An implementation of LSTM. This LSTM is used by interpretable mixture of expert as assigner module.
LSTMime
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LSTMime: """An implementation of LSTM. This LSTM is used by interpretable mixture of expert as assigner module.""" def __init__(self, input_size, num_experts, out_len, d_model=512, layers=3, dropout=0.0, device=torch.device('cuda:0')): """Initializes a LSTMime instance. Args: input_s...
stack_v2_sparse_classes_10k_train_001549
4,262
permissive
[ { "docstring": "Initializes a LSTMime instance. Args: input_size: Input features dimension num_experts: Number of experts out_len: Forecasting horizon d_model: Hidden layer dimension layers: Number of LSTM layers. dropout: Fraction of neurons affected by Dropout (default=0.0). device: Device used by the model",...
2
null
Implement the Python class `LSTMime` described below. Class description: An implementation of LSTM. This LSTM is used by interpretable mixture of expert as assigner module. Method signatures and docstrings: - def __init__(self, input_size, num_experts, out_len, d_model=512, layers=3, dropout=0.0, device=torch.device(...
Implement the Python class `LSTMime` described below. Class description: An implementation of LSTM. This LSTM is used by interpretable mixture of expert as assigner module. Method signatures and docstrings: - def __init__(self, input_size, num_experts, out_len, d_model=512, layers=3, dropout=0.0, device=torch.device(...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class LSTMime: """An implementation of LSTM. This LSTM is used by interpretable mixture of expert as assigner module.""" def __init__(self, input_size, num_experts, out_len, d_model=512, layers=3, dropout=0.0, device=torch.device('cuda:0')): """Initializes a LSTMime instance. Args: input_s...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LSTMime: """An implementation of LSTM. This LSTM is used by interpretable mixture of expert as assigner module.""" def __init__(self, input_size, num_experts, out_len, d_model=512, layers=3, dropout=0.0, device=torch.device('cuda:0')): """Initializes a LSTMime instance. Args: input_size: Input fe...
the_stack_v2_python_sparse
ime/models/lstm.py
Jimmy-INL/google-research
train
1
5990ccb1b5f9112ef136e851311cd6ffc554c581
[ "m, n = (len(grid), len(grid[0]))\ndp = [[0] * (n + 1) for _ in range(m + 1)]\nfor i in range(1, m + 1):\n for j in range(1, n + 1):\n dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]) + grid[i - 1][j - 1]\nreturn dp[-1][-1]", "m, n = (len(grid), len(grid[0]))\ndp = [0] * (n + 1)\nfor i in range(1, m + 1):\n ...
<|body_start_0|> m, n = (len(grid), len(grid[0])) dp = [[0] * (n + 1) for _ in range(m + 1)] for i in range(1, m + 1): for j in range(1, n + 1): dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]) + grid[i - 1][j - 1] return dp[-1][-1] <|end_body_0|> <|body_start_1|> ...
Soluton
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Soluton: def maxValue(self, grid): """dp[i][j] 从(0, 0)走到(i, j) 的最大价值 dp[i][j] = max(dp[i-1_最短回文串.py][j], dp[i][j-1_最短回文串.py]) + grid[i][j] 边界 dp[i][0] = 0 dp[0][i] res = dp[-1_最短回文串.py][-1_最短回文串.py] 时间复杂度 O(mn) 空间 O(mn)""" <|body_0|> def maxValue(self, grid): """dp[i...
stack_v2_sparse_classes_10k_train_001550
1,413
no_license
[ { "docstring": "dp[i][j] 从(0, 0)走到(i, j) 的最大价值 dp[i][j] = max(dp[i-1_最短回文串.py][j], dp[i][j-1_最短回文串.py]) + grid[i][j] 边界 dp[i][0] = 0 dp[0][i] res = dp[-1_最短回文串.py][-1_最短回文串.py] 时间复杂度 O(mn) 空间 O(mn)", "name": "maxValue", "signature": "def maxValue(self, grid)" }, { "docstring": "dp[i][j] 从(0, 0)走...
2
null
Implement the Python class `Soluton` described below. Class description: Implement the Soluton class. Method signatures and docstrings: - def maxValue(self, grid): dp[i][j] 从(0, 0)走到(i, j) 的最大价值 dp[i][j] = max(dp[i-1_最短回文串.py][j], dp[i][j-1_最短回文串.py]) + grid[i][j] 边界 dp[i][0] = 0 dp[0][i] res = dp[-1_最短回文串.py][-1_最短回...
Implement the Python class `Soluton` described below. Class description: Implement the Soluton class. Method signatures and docstrings: - def maxValue(self, grid): dp[i][j] 从(0, 0)走到(i, j) 的最大价值 dp[i][j] = max(dp[i-1_最短回文串.py][j], dp[i][j-1_最短回文串.py]) + grid[i][j] 边界 dp[i][0] = 0 dp[0][i] res = dp[-1_最短回文串.py][-1_最短回...
57f303aa6e76f7c5292fa60bffdfddcb4ff9ddfb
<|skeleton|> class Soluton: def maxValue(self, grid): """dp[i][j] 从(0, 0)走到(i, j) 的最大价值 dp[i][j] = max(dp[i-1_最短回文串.py][j], dp[i][j-1_最短回文串.py]) + grid[i][j] 边界 dp[i][0] = 0 dp[0][i] res = dp[-1_最短回文串.py][-1_最短回文串.py] 时间复杂度 O(mn) 空间 O(mn)""" <|body_0|> def maxValue(self, grid): """dp[i...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Soluton: def maxValue(self, grid): """dp[i][j] 从(0, 0)走到(i, j) 的最大价值 dp[i][j] = max(dp[i-1_最短回文串.py][j], dp[i][j-1_最短回文串.py]) + grid[i][j] 边界 dp[i][0] = 0 dp[0][i] res = dp[-1_最短回文串.py][-1_最短回文串.py] 时间复杂度 O(mn) 空间 O(mn)""" m, n = (len(grid), len(grid[0])) dp = [[0] * (n + 1) for _ in r...
the_stack_v2_python_sparse
3_Offer2nd-HandWriting/6_DP/7_礼物的最大价值.py
fzingithub/SwordRefers2Offer
train
1
91dacf26f4827d2e5dca7d9bf3ed15454aafedf7
[ "self.n = n\nself.discount = discount\nself.prices = {k: v for k, v in zip(products, prices)}\nself.c = 1", "s = 0\nfor p, c in zip(product, amount):\n s += self.prices[p] * c\nif self.c == self.n:\n s *= 1 - self.discount / 100.0\n self.c = 1\nelse:\n self.c += 1\nreturn s" ]
<|body_start_0|> self.n = n self.discount = discount self.prices = {k: v for k, v in zip(products, prices)} self.c = 1 <|end_body_0|> <|body_start_1|> s = 0 for p, c in zip(product, amount): s += self.prices[p] * c if self.c == self.n: s *...
Cashier
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cashier: def __init__(self, n, discount, products, prices): """:type n: int :type discount: int :type products: List[int] :type prices: List[int]""" <|body_0|> def getBill(self, product, amount): """:type product: List[int] :type amount: List[int] :rtype: float""" ...
stack_v2_sparse_classes_10k_train_001551
3,686
no_license
[ { "docstring": ":type n: int :type discount: int :type products: List[int] :type prices: List[int]", "name": "__init__", "signature": "def __init__(self, n, discount, products, prices)" }, { "docstring": ":type product: List[int] :type amount: List[int] :rtype: float", "name": "getBill", ...
2
stack_v2_sparse_classes_30k_train_006032
Implement the Python class `Cashier` described below. Class description: Implement the Cashier class. Method signatures and docstrings: - def __init__(self, n, discount, products, prices): :type n: int :type discount: int :type products: List[int] :type prices: List[int] - def getBill(self, product, amount): :type pr...
Implement the Python class `Cashier` described below. Class description: Implement the Cashier class. Method signatures and docstrings: - def __init__(self, n, discount, products, prices): :type n: int :type discount: int :type products: List[int] :type prices: List[int] - def getBill(self, product, amount): :type pr...
f2bf9b13508cd01c8f383789569e55a438f77202
<|skeleton|> class Cashier: def __init__(self, n, discount, products, prices): """:type n: int :type discount: int :type products: List[int] :type prices: List[int]""" <|body_0|> def getBill(self, product, amount): """:type product: List[int] :type amount: List[int] :rtype: float""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Cashier: def __init__(self, n, discount, products, prices): """:type n: int :type discount: int :type products: List[int] :type prices: List[int]""" self.n = n self.discount = discount self.prices = {k: v for k, v in zip(products, prices)} self.c = 1 def getBill(se...
the_stack_v2_python_sparse
version1/1357_Apply_Discount_Every_n_Orders.py
moontree/leetcode
train
1
b788c401a0d172e09009ea433b224665ee1c62da
[ "super().__init__(device=device, env=env, tx_conn=tx_conn, topics_to_subs=topics_to_subs)\nself.done = False\nself.stop_queue = stop_queue\nself.received_event = False", "ev = DummyServiceEvent(self.env, 'aa:aa:aa:aa:aa:aa', 'dummy_value')\nyield self.async_wait_for_event(ev)\nself.received_event = True\nself.sto...
<|body_start_0|> super().__init__(device=device, env=env, tx_conn=tx_conn, topics_to_subs=topics_to_subs) self.done = False self.stop_queue = stop_queue self.received_event = False <|end_body_0|> <|body_start_1|> ev = DummyServiceEvent(self.env, 'aa:aa:aa:aa:aa:aa', 'dummy_value...
WaiterService
[ "Apache-2.0", "GPL-1.0-or-later", "GPL-2.0-or-later", "GPL-2.0-only" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WaiterService: def __init__(self, device, env, tx_conn, topics_to_subs, stop_queue): """Instanciate a Dummy WirelessService that waits for Events to happen. Args: device: WirelessDevice that owns the service env: simpy environment tx_conn: Connection (e.g. pipe end with 'send' method) us...
stack_v2_sparse_classes_10k_train_001552
4,078
permissive
[ { "docstring": "Instanciate a Dummy WirelessService that waits for Events to happen. Args: device: WirelessDevice that owns the service env: simpy environment tx_conn: Connection (e.g. pipe end with 'send' method) used to send packets.", "name": "__init__", "signature": "def __init__(self, device, env, ...
2
stack_v2_sparse_classes_30k_train_001042
Implement the Python class `WaiterService` described below. Class description: Implement the WaiterService class. Method signatures and docstrings: - def __init__(self, device, env, tx_conn, topics_to_subs, stop_queue): Instanciate a Dummy WirelessService that waits for Events to happen. Args: device: WirelessDevice ...
Implement the Python class `WaiterService` described below. Class description: Implement the WaiterService class. Method signatures and docstrings: - def __init__(self, device, env, tx_conn, topics_to_subs, stop_queue): Instanciate a Dummy WirelessService that waits for Events to happen. Args: device: WirelessDevice ...
3a6d63af1ff468f94887a091e3a408a8449cf832
<|skeleton|> class WaiterService: def __init__(self, device, env, tx_conn, topics_to_subs, stop_queue): """Instanciate a Dummy WirelessService that waits for Events to happen. Args: device: WirelessDevice that owns the service env: simpy environment tx_conn: Connection (e.g. pipe end with 'send' method) us...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WaiterService: def __init__(self, device, env, tx_conn, topics_to_subs, stop_queue): """Instanciate a Dummy WirelessService that waits for Events to happen. Args: device: WirelessDevice that owns the service env: simpy environment tx_conn: Connection (e.g. pipe end with 'send' method) used to send pac...
the_stack_v2_python_sparse
scripts/automation/trex_control_plane/interactive/trex/wireless/services/unit_tests/wireless_service_event_test.py
elados93/trex-core
train
1
2333602754edf3221787eeb0323fd210ba613ab9
[ "self.battery_size = battery_size\nif self.battery_size == 70:\n self.range = 240\nelif self.battery_size == 85:\n self.range = 270", "message = 'This car can go approximately ' + str(self.range)\nmessage += ' miles on a full charge.'\nprint(message)" ]
<|body_start_0|> self.battery_size = battery_size if self.battery_size == 70: self.range = 240 elif self.battery_size == 85: self.range = 270 <|end_body_0|> <|body_start_1|> message = 'This car can go approximately ' + str(self.range) message += ' miles o...
A simple model of an electic car battery.
Battery
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Battery: """A simple model of an electic car battery.""" def __init__(self, battery_size): """Initialize the battery's attributes.""" <|body_0|> def get_range(self): """Print the range of the battery.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_001553
2,340
no_license
[ { "docstring": "Initialize the battery's attributes.", "name": "__init__", "signature": "def __init__(self, battery_size)" }, { "docstring": "Print the range of the battery.", "name": "get_range", "signature": "def get_range(self)" } ]
2
stack_v2_sparse_classes_30k_train_003107
Implement the Python class `Battery` described below. Class description: A simple model of an electic car battery. Method signatures and docstrings: - def __init__(self, battery_size): Initialize the battery's attributes. - def get_range(self): Print the range of the battery.
Implement the Python class `Battery` described below. Class description: A simple model of an electic car battery. Method signatures and docstrings: - def __init__(self, battery_size): Initialize the battery's attributes. - def get_range(self): Print the range of the battery. <|skeleton|> class Battery: """A sim...
115f712e0c7e3d02270b8748fcff85f0e3df2c30
<|skeleton|> class Battery: """A simple model of an electic car battery.""" def __init__(self, battery_size): """Initialize the battery's attributes.""" <|body_0|> def get_range(self): """Print the range of the battery.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Battery: """A simple model of an electic car battery.""" def __init__(self, battery_size): """Initialize the battery's attributes.""" self.battery_size = battery_size if self.battery_size == 70: self.range = 240 elif self.battery_size == 85: self.ra...
the_stack_v2_python_sparse
python_crash_course/car_classes.py
keithkay/python
train
0
c3fd0c2b8cda7614eb66345f4411756675d544bb
[ "if len(ransomNote) > len(magazine):\n return False\nif not ransomNote:\n return True\ndic = defaultdict(int)\nfor i in ransomNote:\n dic[i] += 1\nfor k in dic.keys():\n if magazine.count(k) < dic[k]:\n return False\nreturn True", "a = dict(collections.Counter(ransomNote))\nfor k, v in a.items(...
<|body_start_0|> if len(ransomNote) > len(magazine): return False if not ransomNote: return True dic = defaultdict(int) for i in ransomNote: dic[i] += 1 for k in dic.keys(): if magazine.count(k) < dic[k]: return Fals...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canConstruct(self, ransomNote, magazine): """:type ransomNote: str :type magazine: str :rtype: bool""" <|body_0|> def canConstruct(self, ransomNote, magazine): """:type ransomNote: str :type magazine: str :rtype: bool""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_10k_train_001554
869
no_license
[ { "docstring": ":type ransomNote: str :type magazine: str :rtype: bool", "name": "canConstruct", "signature": "def canConstruct(self, ransomNote, magazine)" }, { "docstring": ":type ransomNote: str :type magazine: str :rtype: bool", "name": "canConstruct", "signature": "def canConstruct(...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canConstruct(self, ransomNote, magazine): :type ransomNote: str :type magazine: str :rtype: bool - def canConstruct(self, ransomNote, magazine): :type ransomNote: str :type m...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canConstruct(self, ransomNote, magazine): :type ransomNote: str :type magazine: str :rtype: bool - def canConstruct(self, ransomNote, magazine): :type ransomNote: str :type m...
a509b383a42f54313970168d9faa11f088f18708
<|skeleton|> class Solution: def canConstruct(self, ransomNote, magazine): """:type ransomNote: str :type magazine: str :rtype: bool""" <|body_0|> def canConstruct(self, ransomNote, magazine): """:type ransomNote: str :type magazine: str :rtype: bool""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def canConstruct(self, ransomNote, magazine): """:type ransomNote: str :type magazine: str :rtype: bool""" if len(ransomNote) > len(magazine): return False if not ransomNote: return True dic = defaultdict(int) for i in ransomNote: ...
the_stack_v2_python_sparse
0383_Ransom_Note.py
bingli8802/leetcode
train
0
6731c1d7b9275bf8364ee4f2c2af3919903dc619
[ "super().__init__(imageset, threshold_function, mask, region_of_interest, max_strong_pixel_fraction, compute_mean_background)\nself.min_spot_size = min_spot_size\nself.max_spot_size = max_spot_size\nself.filter_spots = filter_spots", "num_panels = len(self.imageset.get_detector())\npixel_labeller = [PixelListLabe...
<|body_start_0|> super().__init__(imageset, threshold_function, mask, region_of_interest, max_strong_pixel_fraction, compute_mean_background) self.min_spot_size = min_spot_size self.max_spot_size = max_spot_size self.filter_spots = filter_spots <|end_body_0|> <|body_start_1|> nu...
A class to extract pixels from a single image
ExtractPixelsFromImage2DNoShoeboxes
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExtractPixelsFromImage2DNoShoeboxes: """A class to extract pixels from a single image""" def __init__(self, imageset, threshold_function, mask, region_of_interest, max_strong_pixel_fraction, compute_mean_background, min_spot_size, max_spot_size, filter_spots): """Initialise the class...
stack_v2_sparse_classes_10k_train_001555
29,989
permissive
[ { "docstring": "Initialise the class :param imageset: The imageset to extract from :param threshold_function: The function to threshold with :param mask: The image mask :param region_of_interest: A region of interest to process :param max_strong_pixel_fraction: The maximum fraction of pixels allowed", "name...
2
null
Implement the Python class `ExtractPixelsFromImage2DNoShoeboxes` described below. Class description: A class to extract pixels from a single image Method signatures and docstrings: - def __init__(self, imageset, threshold_function, mask, region_of_interest, max_strong_pixel_fraction, compute_mean_background, min_spot...
Implement the Python class `ExtractPixelsFromImage2DNoShoeboxes` described below. Class description: A class to extract pixels from a single image Method signatures and docstrings: - def __init__(self, imageset, threshold_function, mask, region_of_interest, max_strong_pixel_fraction, compute_mean_background, min_spot...
88bf7f7c5ac44defc046ebf0719cde748092cfff
<|skeleton|> class ExtractPixelsFromImage2DNoShoeboxes: """A class to extract pixels from a single image""" def __init__(self, imageset, threshold_function, mask, region_of_interest, max_strong_pixel_fraction, compute_mean_background, min_spot_size, max_spot_size, filter_spots): """Initialise the class...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ExtractPixelsFromImage2DNoShoeboxes: """A class to extract pixels from a single image""" def __init__(self, imageset, threshold_function, mask, region_of_interest, max_strong_pixel_fraction, compute_mean_background, min_spot_size, max_spot_size, filter_spots): """Initialise the class :param image...
the_stack_v2_python_sparse
src/dials/algorithms/spot_finding/finder.py
dials/dials
train
71
533090537ef05fc6faa3738b6a8c8bfa6c2ca461
[ "pos = 0\nwhile pos < len(self.value):\n list_entry_header = self.value[pos:pos + 26]\n if len(list_entry_header) != 26:\n break\n attribute_type_code, record_length, attribute_name_length, attribute_name_offset, lowest_vcn, segment_reference, attribute_instance = struct.unpack('<LHBBQQH', list_entr...
<|body_start_0|> pos = 0 while pos < len(self.value): list_entry_header = self.value[pos:pos + 26] if len(list_entry_header) != 26: break attribute_type_code, record_length, attribute_name_length, attribute_name_offset, lowest_vcn, segment_reference, a...
$ATTRIBUTE_LIST.
AttributeList
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AttributeList: """$ATTRIBUTE_LIST.""" def entries(self): """This method yields each attribute list entry (AttributeListEntry).""" <|body_0|> def print_information(self): """Print all information in a human-readable form.""" <|body_1|> <|end_skeleton|> <...
stack_v2_sparse_classes_10k_train_001556
36,119
permissive
[ { "docstring": "This method yields each attribute list entry (AttributeListEntry).", "name": "entries", "signature": "def entries(self)" }, { "docstring": "Print all information in a human-readable form.", "name": "print_information", "signature": "def print_information(self)" } ]
2
null
Implement the Python class `AttributeList` described below. Class description: $ATTRIBUTE_LIST. Method signatures and docstrings: - def entries(self): This method yields each attribute list entry (AttributeListEntry). - def print_information(self): Print all information in a human-readable form.
Implement the Python class `AttributeList` described below. Class description: $ATTRIBUTE_LIST. Method signatures and docstrings: - def entries(self): This method yields each attribute list entry (AttributeListEntry). - def print_information(self): Print all information in a human-readable form. <|skeleton|> class A...
f9299b8ad0cb2a6bbbd5e65f01d2ba06406c70ac
<|skeleton|> class AttributeList: """$ATTRIBUTE_LIST.""" def entries(self): """This method yields each attribute list entry (AttributeListEntry).""" <|body_0|> def print_information(self): """Print all information in a human-readable form.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AttributeList: """$ATTRIBUTE_LIST.""" def entries(self): """This method yields each attribute list entry (AttributeListEntry).""" pos = 0 while pos < len(self.value): list_entry_header = self.value[pos:pos + 26] if len(list_entry_header) != 26: ...
the_stack_v2_python_sparse
modules/NTFS/dfir_ntfs/Attributes.py
dfrc-korea/carpe
train
75
17b08756a0fd45fe379484af9ec8d98b7a266698
[ "self.lenses_list = lenses_list\nself.sources_list = sources_list\nself.global_dict = global_dict\nself.observation_dict = observation_dict\nself.set_up_global()\nself.set_up_observation()", "self.z_s = self.global_dict['z_s']\nself.z_l = self.global_dict['z_l']\nself.D_s = Planck15.angular_diameter_distance(z=se...
<|body_start_0|> self.lenses_list = lenses_list self.sources_list = sources_list self.global_dict = global_dict self.observation_dict = observation_dict self.set_up_global() self.set_up_observation() <|end_body_0|> <|body_start_1|> self.z_s = self.global_dict['z_...
LensingSim
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LensingSim: def __init__(self, lenses_list=[{}], sources_list=[{}], global_dict={}, observation_dict={}): """Class for simulation of strong lensing images""" <|body_0|> def set_up_global(self): """Set some global variables so don't need to recompute each time""" ...
stack_v2_sparse_classes_10k_train_001557
5,119
permissive
[ { "docstring": "Class for simulation of strong lensing images", "name": "__init__", "signature": "def __init__(self, lenses_list=[{}], sources_list=[{}], global_dict={}, observation_dict={})" }, { "docstring": "Set some global variables so don't need to recompute each time", "name": "set_up_...
4
stack_v2_sparse_classes_30k_train_003894
Implement the Python class `LensingSim` described below. Class description: Implement the LensingSim class. Method signatures and docstrings: - def __init__(self, lenses_list=[{}], sources_list=[{}], global_dict={}, observation_dict={}): Class for simulation of strong lensing images - def set_up_global(self): Set som...
Implement the Python class `LensingSim` described below. Class description: Implement the LensingSim class. Method signatures and docstrings: - def __init__(self, lenses_list=[{}], sources_list=[{}], global_dict={}, observation_dict={}): Class for simulation of strong lensing images - def set_up_global(self): Set som...
8f432b58cecdafd70054fa63f285f3f284fa0720
<|skeleton|> class LensingSim: def __init__(self, lenses_list=[{}], sources_list=[{}], global_dict={}, observation_dict={}): """Class for simulation of strong lensing images""" <|body_0|> def set_up_global(self): """Set some global variables so don't need to recompute each time""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LensingSim: def __init__(self, lenses_list=[{}], sources_list=[{}], global_dict={}, observation_dict={}): """Class for simulation of strong lensing images""" self.lenses_list = lenses_list self.sources_list = sources_list self.global_dict = global_dict self.observation_...
the_stack_v2_python_sparse
simulation/lensing_sim.py
smsharma/mining-for-substructure-lens
train
25
3c26419e5d29474b3dff3181b455a9518d5c97ad
[ "storage = get_storage()\nauth0_id = get_auth0_id_of_user(email)\nuser_id = storage.read_user_id(auth0_id)\nreturn super().post(user_id, role_id)", "storage = get_storage()\nauth0_id = get_auth0_id_of_user(email)\ntry:\n user_id = storage.read_user_id(auth0_id)\nexcept StorageAuthError:\n return ('', 204)\n...
<|body_start_0|> storage = get_storage() auth0_id = get_auth0_id_of_user(email) user_id = storage.read_user_id(auth0_id) return super().post(user_id, role_id) <|end_body_0|> <|body_start_1|> storage = get_storage() auth0_id = get_auth0_id_of_user(email) try: ...
UserRolesManagementByEmailView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserRolesManagementByEmailView: def post(self, email, role_id): """--- summary: Add a Role to a User by email. parameters: - email - role_id tags: - Users-By-Email - Roles responses: 204: description: Role Added Successfully. 401: $ref: '#/components/responses/401-Unauthorized' 404: $ref...
stack_v2_sparse_classes_10k_train_001558
12,608
permissive
[ { "docstring": "--- summary: Add a Role to a User by email. parameters: - email - role_id tags: - Users-By-Email - Roles responses: 204: description: Role Added Successfully. 401: $ref: '#/components/responses/401-Unauthorized' 404: $ref: '#/components/responses/404-NotFound'", "name": "post", "signatur...
2
stack_v2_sparse_classes_30k_train_002794
Implement the Python class `UserRolesManagementByEmailView` described below. Class description: Implement the UserRolesManagementByEmailView class. Method signatures and docstrings: - def post(self, email, role_id): --- summary: Add a Role to a User by email. parameters: - email - role_id tags: - Users-By-Email - Rol...
Implement the Python class `UserRolesManagementByEmailView` described below. Class description: Implement the UserRolesManagementByEmailView class. Method signatures and docstrings: - def post(self, email, role_id): --- summary: Add a Role to a User by email. parameters: - email - role_id tags: - Users-By-Email - Rol...
280800c73eb7cfd49029462b352887e78f1ff91b
<|skeleton|> class UserRolesManagementByEmailView: def post(self, email, role_id): """--- summary: Add a Role to a User by email. parameters: - email - role_id tags: - Users-By-Email - Roles responses: 204: description: Role Added Successfully. 401: $ref: '#/components/responses/401-Unauthorized' 404: $ref...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UserRolesManagementByEmailView: def post(self, email, role_id): """--- summary: Add a Role to a User by email. parameters: - email - role_id tags: - Users-By-Email - Roles responses: 204: description: Role Added Successfully. 401: $ref: '#/components/responses/401-Unauthorized' 404: $ref: '#/component...
the_stack_v2_python_sparse
sfa_api/users.py
SolarArbiter/solarforecastarbiter-api
train
9
9c4bb1ab64b3d3e0cbcc036288cbd4a5e986c27d
[ "try:\n response = Database.Table.get_item(Key={'DocumentID': document_id})\nexcept Exception as e:\n response = None\n Logger.info(f'Database GetDocument : document_id = {document_id} : exception = {e}')\nif response and response.get('Item') and (response['ResponseMetadata']['HTTPStatusCode'] == 200):\n ...
<|body_start_0|> try: response = Database.Table.get_item(Key={'DocumentID': document_id}) except Exception as e: response = None Logger.info(f'Database GetDocument : document_id = {document_id} : exception = {e}') if response and response.get('Item') and (resp...
Database Abstraction Layer
Database
[ "Apache-2.0", "MIT-0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Database: """Database Abstraction Layer""" def GetDocument(document_id: str) -> Document: """Fetch a specific document""" <|body_0|> def GetDocuments(stages: List[Stage], states: List[State]) -> List[Document]: """Fetch a specific document set""" <|body_1...
stack_v2_sparse_classes_10k_train_001559
3,107
permissive
[ { "docstring": "Fetch a specific document", "name": "GetDocument", "signature": "def GetDocument(document_id: str) -> Document" }, { "docstring": "Fetch a specific document set", "name": "GetDocuments", "signature": "def GetDocuments(stages: List[Stage], states: List[State]) -> List[Docu...
4
stack_v2_sparse_classes_30k_train_001957
Implement the Python class `Database` described below. Class description: Database Abstraction Layer Method signatures and docstrings: - def GetDocument(document_id: str) -> Document: Fetch a specific document - def GetDocuments(stages: List[Stage], states: List[State]) -> List[Document]: Fetch a specific document se...
Implement the Python class `Database` described below. Class description: Database Abstraction Layer Method signatures and docstrings: - def GetDocument(document_id: str) -> Document: Fetch a specific document - def GetDocuments(stages: List[Stage], states: List[State]) -> List[Document]: Fetch a specific document se...
633e6291eea95a3933d34cae53b68cf6570b9bbb
<|skeleton|> class Database: """Database Abstraction Layer""" def GetDocument(document_id: str) -> Document: """Fetch a specific document""" <|body_0|> def GetDocuments(stages: List[Stage], states: List[State]) -> List[Document]: """Fetch a specific document set""" <|body_1...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Database: """Database Abstraction Layer""" def GetDocument(document_id: str) -> Document: """Fetch a specific document""" try: response = Database.Table.get_item(Key={'DocumentID': document_id}) except Exception as e: response = None Logger.info...
the_stack_v2_python_sparse
source/lambdas/shared/database.py
jhasatis/TabularDocumentDigitization
train
0
dc92843aa5e5d967194dd284517e082eb1df4776
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn Onenote()", "from .entity import Entity\nfrom .notebook import Notebook\nfrom .onenote_operation import OnenoteOperation\nfrom .onenote_page import OnenotePage\nfrom .onenote_resource import OnenoteResource\nfrom .onenote_section impor...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return Onenote() <|end_body_0|> <|body_start_1|> from .entity import Entity from .notebook import Notebook from .onenote_operation import OnenoteOperation from .onenote_page imp...
Onenote
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Onenote: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Onenote: """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: Onenote"""...
stack_v2_sparse_classes_10k_train_001560
4,865
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: Onenote", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(parse...
3
stack_v2_sparse_classes_30k_train_002802
Implement the Python class `Onenote` described below. Class description: Implement the Onenote class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Onenote: Creates a new instance of the appropriate class based on discriminator value Args: parse_node:...
Implement the Python class `Onenote` described below. Class description: Implement the Onenote class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Onenote: Creates a new instance of the appropriate class based on discriminator value Args: parse_node:...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class Onenote: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Onenote: """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: Onenote"""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Onenote: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Onenote: """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: Onenote""" if no...
the_stack_v2_python_sparse
msgraph/generated/models/onenote.py
microsoftgraph/msgraph-sdk-python
train
135
099cb67cd295cd3c425fc8aaac0ce577b8b72c80
[ "downsample_raito = H // SparseHelper._cur_active.shape[-1]\nactive_ex = SparseHelper._cur_active.repeat_interleave(downsample_raito, 2).repeat_interleave(downsample_raito, 3)\nreturn active_ex if returning_active_map else active_ex.squeeze(1).nonzero(as_tuple=True)", "x = super(type(self), self).forward(x)\nx *=...
<|body_start_0|> downsample_raito = H // SparseHelper._cur_active.shape[-1] active_ex = SparseHelper._cur_active.repeat_interleave(downsample_raito, 2).repeat_interleave(downsample_raito, 3) return active_ex if returning_active_map else active_ex.squeeze(1).nonzero(as_tuple=True) <|end_body_0|> ...
The helper to compute sparse operation with pytorch, such as sparse convlolution, sparse batch norm, etc.
SparseHelper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SparseHelper: """The helper to compute sparse operation with pytorch, such as sparse convlolution, sparse batch norm, etc.""" def _get_active_map_or_index(H: int, returning_active_map: bool=True) -> torch.Tensor: """Get current active map with (B, 1, f, f) shape or index format.""" ...
stack_v2_sparse_classes_10k_train_001561
5,428
permissive
[ { "docstring": "Get current active map with (B, 1, f, f) shape or index format.", "name": "_get_active_map_or_index", "signature": "def _get_active_map_or_index(H: int, returning_active_map: bool=True) -> torch.Tensor" }, { "docstring": "Sparse convolution forward function.", "name": "sp_con...
3
null
Implement the Python class `SparseHelper` described below. Class description: The helper to compute sparse operation with pytorch, such as sparse convlolution, sparse batch norm, etc. Method signatures and docstrings: - def _get_active_map_or_index(H: int, returning_active_map: bool=True) -> torch.Tensor: Get current...
Implement the Python class `SparseHelper` described below. Class description: The helper to compute sparse operation with pytorch, such as sparse convlolution, sparse batch norm, etc. Method signatures and docstrings: - def _get_active_map_or_index(H: int, returning_active_map: bool=True) -> torch.Tensor: Get current...
d2ccc44a2c8e5d49bb26187aff42f2abc90aee28
<|skeleton|> class SparseHelper: """The helper to compute sparse operation with pytorch, such as sparse convlolution, sparse batch norm, etc.""" def _get_active_map_or_index(H: int, returning_active_map: bool=True) -> torch.Tensor: """Get current active map with (B, 1, f, f) shape or index format.""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SparseHelper: """The helper to compute sparse operation with pytorch, such as sparse convlolution, sparse batch norm, etc.""" def _get_active_map_or_index(H: int, returning_active_map: bool=True) -> torch.Tensor: """Get current active map with (B, 1, f, f) shape or index format.""" downsa...
the_stack_v2_python_sparse
mmpretrain/models/utils/sparse_modules.py
open-mmlab/mmpretrain
train
652
02c4f92b4dd013cc5388f23e9fe2a1ca3c54767b
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn HostComponent()", "from .artifact import Artifact\nfrom .host import Host\nfrom .artifact import Artifact\nfrom .host import Host\nfields: Dict[str, Callable[[Any], None]] = {'category': lambda n: setattr(self, 'category', n.get_str_va...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return HostComponent() <|end_body_0|> <|body_start_1|> from .artifact import Artifact from .host import Host from .artifact import Artifact from .host import Host fields...
HostComponent
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HostComponent: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> HostComponent: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns...
stack_v2_sparse_classes_10k_train_001562
3,935
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: HostComponent", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value...
3
null
Implement the Python class `HostComponent` described below. Class description: Implement the HostComponent class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> HostComponent: Creates a new instance of the appropriate class based on discriminator value...
Implement the Python class `HostComponent` described below. Class description: Implement the HostComponent class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> HostComponent: Creates a new instance of the appropriate class based on discriminator value...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class HostComponent: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> HostComponent: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class HostComponent: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> HostComponent: """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: HostComponen...
the_stack_v2_python_sparse
msgraph/generated/models/security/host_component.py
microsoftgraph/msgraph-sdk-python
train
135
6074432aef43e3d3ee1a60fb6a37bcf3f7e1ef42
[ "self._pairs = [(re.compile(x, re.IGNORECASE), y, z) for x, y, z in pairs]\nself._reflections = reflections\nself._regex = self._compile_reflections()", "for pattern, response, callback in self._pairs:\n match = pattern.match(str)\n if match:\n resp = random.choice(response)\n resp = self._wil...
<|body_start_0|> self._pairs = [(re.compile(x, re.IGNORECASE), y, z) for x, y, z in pairs] self._reflections = reflections self._regex = self._compile_reflections() <|end_body_0|> <|body_start_1|> for pattern, response, callback in self._pairs: match = pattern.match(str) ...
MyChat
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyChat: def __init__(self, pairs, reflections={}): """Initialize the chatbot. Pairs is a list of patterns and responses. Each pattern is a regular expression matching the user's statement or question, e.g. r'I like (.*)'. For each such pattern a list of possible responses is given, e.g. ...
stack_v2_sparse_classes_10k_train_001563
3,184
permissive
[ { "docstring": "Initialize the chatbot. Pairs is a list of patterns and responses. Each pattern is a regular expression matching the user's statement or question, e.g. r'I like (.*)'. For each such pattern a list of possible responses is given, e.g. ['Why do you like %1', 'Did you ever dislike %1']. Material wh...
2
stack_v2_sparse_classes_30k_train_000221
Implement the Python class `MyChat` described below. Class description: Implement the MyChat class. Method signatures and docstrings: - def __init__(self, pairs, reflections={}): Initialize the chatbot. Pairs is a list of patterns and responses. Each pattern is a regular expression matching the user's statement or qu...
Implement the Python class `MyChat` described below. Class description: Implement the MyChat class. Method signatures and docstrings: - def __init__(self, pairs, reflections={}): Initialize the chatbot. Pairs is a list of patterns and responses. Each pattern is a regular expression matching the user's statement or qu...
95cb53b664f312e0830f010c0c96be94d4a4db90
<|skeleton|> class MyChat: def __init__(self, pairs, reflections={}): """Initialize the chatbot. Pairs is a list of patterns and responses. Each pattern is a regular expression matching the user's statement or question, e.g. r'I like (.*)'. For each such pattern a list of possible responses is given, e.g. ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MyChat: def __init__(self, pairs, reflections={}): """Initialize the chatbot. Pairs is a list of patterns and responses. Each pattern is a regular expression matching the user's statement or question, e.g. r'I like (.*)'. For each such pattern a list of possible responses is given, e.g. ['Why do you l...
the_stack_v2_python_sparse
__NLTK__/chat-run-function/main.py
furas/python-examples
train
176
27701991639a3d2aeeb7689fba6321c07836db99
[ "pygame.font.init()\nbasicfont = pygame.font.Font(None, fontsize)\nself.linewidths = []\nfor x in text:\n self.texttemp = basicfont.render(x, 0, (1, 1, 1))\n self.linewidths.append(self.texttemp.get_width())\nself.imagewidth = basicfont.render(text[self.linewidths.index(max(self.linewidths))], 0, (1, 1, 1)).g...
<|body_start_0|> pygame.font.init() basicfont = pygame.font.Font(None, fontsize) self.linewidths = [] for x in text: self.texttemp = basicfont.render(x, 0, (1, 1, 1)) self.linewidths.append(self.texttemp.get_width()) self.imagewidth = basicfont.render(text...
Linesoftext
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Linesoftext: def __init__(self, text, position, xmid=False, fontsize=36, backgroundcolor=(200, 200, 200), surface=None): """This object will create an image of text that is passed in as a list of strings. It will put a new line for each element in the list. Use its image attribute to put...
stack_v2_sparse_classes_10k_train_001564
5,935
no_license
[ { "docstring": "This object will create an image of text that is passed in as a list of strings. It will put a new line for each element in the list. Use its image attribute to put this text on your screen", "name": "__init__", "signature": "def __init__(self, text, position, xmid=False, fontsize=36, ba...
2
stack_v2_sparse_classes_30k_train_003016
Implement the Python class `Linesoftext` described below. Class description: Implement the Linesoftext class. Method signatures and docstrings: - def __init__(self, text, position, xmid=False, fontsize=36, backgroundcolor=(200, 200, 200), surface=None): This object will create an image of text that is passed in as a ...
Implement the Python class `Linesoftext` described below. Class description: Implement the Linesoftext class. Method signatures and docstrings: - def __init__(self, text, position, xmid=False, fontsize=36, backgroundcolor=(200, 200, 200), surface=None): This object will create an image of text that is passed in as a ...
3eae1428fdd30fddc66669d40b8bb0a715d5595a
<|skeleton|> class Linesoftext: def __init__(self, text, position, xmid=False, fontsize=36, backgroundcolor=(200, 200, 200), surface=None): """This object will create an image of text that is passed in as a list of strings. It will put a new line for each element in the list. Use its image attribute to put...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Linesoftext: def __init__(self, text, position, xmid=False, fontsize=36, backgroundcolor=(200, 200, 200), surface=None): """This object will create an image of text that is passed in as a list of strings. It will put a new line for each element in the list. Use its image attribute to put this text on ...
the_stack_v2_python_sparse
General Python/Guessing_game_with_gui/pygametools.py
jbm950/personal_projects
train
0
5f938d7858cd85b5b4c68d2639ff06f084747f35
[ "self.rows = []\nself.variables_places = {}\ni = 0\nfor var in variables:\n self.variables_places[var] = i\n i += 1", "if len(values) != len(self.variables_places.keys()):\n raise ValueError('Invalid number of values. Should be equal to a number of variables')\nself.rows.append(self.Row(probability, valu...
<|body_start_0|> self.rows = [] self.variables_places = {} i = 0 for var in variables: self.variables_places[var] = i i += 1 <|end_body_0|> <|body_start_1|> if len(values) != len(self.variables_places.keys()): raise ValueError('Invalid number ...
ProbabilityDistribution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProbabilityDistribution: def __init__(self, variables): """:param variables iterable(str): names of all variables in this probability distribution""" <|body_0|> def set(self, probability, values): """Add probability of variables in probability distribution to have sp...
stack_v2_sparse_classes_10k_train_001565
20,140
no_license
[ { "docstring": ":param variables iterable(str): names of all variables in this probability distribution", "name": "__init__", "signature": "def __init__(self, variables)" }, { "docstring": "Add probability of variables in probability distribution to have specified values. :param probability: pro...
3
stack_v2_sparse_classes_30k_train_006208
Implement the Python class `ProbabilityDistribution` described below. Class description: Implement the ProbabilityDistribution class. Method signatures and docstrings: - def __init__(self, variables): :param variables iterable(str): names of all variables in this probability distribution - def set(self, probability, ...
Implement the Python class `ProbabilityDistribution` described below. Class description: Implement the ProbabilityDistribution class. Method signatures and docstrings: - def __init__(self, variables): :param variables iterable(str): names of all variables in this probability distribution - def set(self, probability, ...
32a9b9158d73dc80b355993a5a5f8fc49ae25334
<|skeleton|> class ProbabilityDistribution: def __init__(self, variables): """:param variables iterable(str): names of all variables in this probability distribution""" <|body_0|> def set(self, probability, values): """Add probability of variables in probability distribution to have sp...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ProbabilityDistribution: def __init__(self, variables): """:param variables iterable(str): names of all variables in this probability distribution""" self.rows = [] self.variables_places = {} i = 0 for var in variables: self.variables_places[var] = i ...
the_stack_v2_python_sparse
aima/core/probability/algorithms.py
afcarl/aima-python-mushketyk
train
1
e04042c5ffbf72824e9a68fd2514ae41abfdc212
[ "RenderableResource.__init__(self, parent)\nself.localeNames = []\nfor locale, translation in self.config.locales.items():\n localeName = locale + ': '\n langName = translation.info().get('x-exe-language', None)\n if langName == None:\n langName = translation.info().get('x-poedit-language', 'English...
<|body_start_0|> RenderableResource.__init__(self, parent) self.localeNames = [] for locale, translation in self.config.locales.items(): localeName = locale + ': ' langName = translation.info().get('x-exe-language', None) if langName == None: l...
The PreferencesPage is responsible for managing eXe preferences
PreferencesPage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PreferencesPage: """The PreferencesPage is responsible for managing eXe preferences""" def __init__(self, parent): """Initialize""" <|body_0|> def getChild(self, name, request): """Try and find the child for the name given""" <|body_1|> def render_GE...
stack_v2_sparse_classes_10k_train_001566
3,657
no_license
[ { "docstring": "Initialize", "name": "__init__", "signature": "def __init__(self, parent)" }, { "docstring": "Try and find the child for the name given", "name": "getChild", "signature": "def getChild(self, name, request)" }, { "docstring": "Render the preferences", "name": "...
4
stack_v2_sparse_classes_30k_train_002769
Implement the Python class `PreferencesPage` described below. Class description: The PreferencesPage is responsible for managing eXe preferences Method signatures and docstrings: - def __init__(self, parent): Initialize - def getChild(self, name, request): Try and find the child for the name given - def render_GET(se...
Implement the Python class `PreferencesPage` described below. Class description: The PreferencesPage is responsible for managing eXe preferences Method signatures and docstrings: - def __init__(self, parent): Initialize - def getChild(self, name, request): Try and find the child for the name given - def render_GET(se...
1a99c1788f0eb9f1e5d8c2ced3892d00cd9449ad
<|skeleton|> class PreferencesPage: """The PreferencesPage is responsible for managing eXe preferences""" def __init__(self, parent): """Initialize""" <|body_0|> def getChild(self, name, request): """Try and find the child for the name given""" <|body_1|> def render_GE...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PreferencesPage: """The PreferencesPage is responsible for managing eXe preferences""" def __init__(self, parent): """Initialize""" RenderableResource.__init__(self, parent) self.localeNames = [] for locale, translation in self.config.locales.items(): localeNam...
the_stack_v2_python_sparse
eXe/rev3426-3513/right-branch-3513/exe/webui/preferencespage.py
joliebig/featurehouse_fstmerge_examples
train
3
fdfb16032d63dccfe736757871f28ac55b96b3da
[ "self._filename = filename\nself._filelayout = filelayout\nself._data = self._parse()", "output = pd.read_csv(self._filename, comment='#', delim_whitespace=True, names=self._filelayout)\noutput_dict = output.to_dict()\nreturn output_dict", "try:\n selected_data = np.array(list(self._data[name].values()))\nex...
<|body_start_0|> self._filename = filename self._filelayout = filelayout self._data = self._parse() <|end_body_0|> <|body_start_1|> output = pd.read_csv(self._filename, comment='#', delim_whitespace=True, names=self._filelayout) output_dict = output.to_dict() return outp...
Parses information for known data files in txt format.
RawData
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RawData: """Parses information for known data files in txt format.""" def __init__(self, filename, filelayout): """Parses information for known data files in txt format. :filename: name of the file to parse :filelayout: list of column names in file""" <|body_0|> def _par...
stack_v2_sparse_classes_10k_train_001567
15,467
no_license
[ { "docstring": "Parses information for known data files in txt format. :filename: name of the file to parse :filelayout: list of column names in file", "name": "__init__", "signature": "def __init__(self, filename, filelayout)" }, { "docstring": "Parse the data form the object's file. :return: a...
3
stack_v2_sparse_classes_30k_train_007318
Implement the Python class `RawData` described below. Class description: Parses information for known data files in txt format. Method signatures and docstrings: - def __init__(self, filename, filelayout): Parses information for known data files in txt format. :filename: name of the file to parse :filelayout: list of...
Implement the Python class `RawData` described below. Class description: Parses information for known data files in txt format. Method signatures and docstrings: - def __init__(self, filename, filelayout): Parses information for known data files in txt format. :filename: name of the file to parse :filelayout: list of...
0c1894ce8d9f5daed539240d3ac86e645d6de44c
<|skeleton|> class RawData: """Parses information for known data files in txt format.""" def __init__(self, filename, filelayout): """Parses information for known data files in txt format. :filename: name of the file to parse :filelayout: list of column names in file""" <|body_0|> def _par...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RawData: """Parses information for known data files in txt format.""" def __init__(self, filename, filelayout): """Parses information for known data files in txt format. :filename: name of the file to parse :filelayout: list of column names in file""" self._filename = filename sel...
the_stack_v2_python_sparse
stan_implementation/analysis_interface/interfaces/data.py
cescalara/soiaporn_model
train
1
e60b9b10d7443ed4c5cbb372a600ff99ee5fc767
[ "session = async_get_clientsession(self.hass)\nweb_account = WebAccount(session, email, password)\nweb_account_info = await web_account.login()\nmobile_account = MobileAccount(session, email, password)\nawait mobile_account.login()\nreturn {CONF_ACCESS_TOKEN: mobile_account.access_token, CONF_EMAIL: web_account_inf...
<|body_start_0|> session = async_get_clientsession(self.hass) web_account = WebAccount(session, email, password) web_account_info = await web_account.login() mobile_account = MobileAccount(session, email, password) await mobile_account.login() return {CONF_ACCESS_TOKEN: m...
Handle a config flow for Aseko Pool Live.
ConfigFlow
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConfigFlow: """Handle a config flow for Aseko Pool Live.""" async def get_account_info(self, email: str, password: str) -> dict: """Get account info from the mobile API and the web API.""" <|body_0|> async def async_step_user(self, user_input: dict[str, Any] | None=None)...
stack_v2_sparse_classes_10k_train_001568
2,634
permissive
[ { "docstring": "Get account info from the mobile API and the web API.", "name": "get_account_info", "signature": "async def get_account_info(self, email: str, password: str) -> dict" }, { "docstring": "Handle the initial step.", "name": "async_step_user", "signature": "async def async_st...
2
null
Implement the Python class `ConfigFlow` described below. Class description: Handle a config flow for Aseko Pool Live. Method signatures and docstrings: - async def get_account_info(self, email: str, password: str) -> dict: Get account info from the mobile API and the web API. - async def async_step_user(self, user_in...
Implement the Python class `ConfigFlow` described below. Class description: Handle a config flow for Aseko Pool Live. Method signatures and docstrings: - async def get_account_info(self, email: str, password: str) -> dict: Get account info from the mobile API and the web API. - async def async_step_user(self, user_in...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class ConfigFlow: """Handle a config flow for Aseko Pool Live.""" async def get_account_info(self, email: str, password: str) -> dict: """Get account info from the mobile API and the web API.""" <|body_0|> async def async_step_user(self, user_input: dict[str, Any] | None=None)...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ConfigFlow: """Handle a config flow for Aseko Pool Live.""" async def get_account_info(self, email: str, password: str) -> dict: """Get account info from the mobile API and the web API.""" session = async_get_clientsession(self.hass) web_account = WebAccount(session, email, passwo...
the_stack_v2_python_sparse
homeassistant/components/aseko_pool_live/config_flow.py
home-assistant/core
train
35,501
ea7b5e46017a612f3f18889cbd7ab408db080af2
[ "include_2D_map = self.get_query_argument('include2DMap', False)\nlocalization = Localization.query_records_accessible_by(self.current_user).filter(Localization.dateobs == dateobs, Localization.localization_name == localization_name).first()\nif localization is None:\n return self.error('Localization not found',...
<|body_start_0|> include_2D_map = self.get_query_argument('include2DMap', False) localization = Localization.query_records_accessible_by(self.current_user).filter(Localization.dateobs == dateobs, Localization.localization_name == localization_name).first() if localization is None: re...
LocalizationHandler
[ "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LocalizationHandler: def get(self, dateobs, localization_name): """--- description: Retrieve a GCN localization tags: - localizations parameters: - in: path name: dateobs required: true schema: type: dateobs - in: path name: localization_name required: true schema: type: localization_nam...
stack_v2_sparse_classes_10k_train_001569
12,885
permissive
[ { "docstring": "--- description: Retrieve a GCN localization tags: - localizations parameters: - in: path name: dateobs required: true schema: type: dateobs - in: path name: localization_name required: true schema: type: localization_name - in: query name: include2DMap nullable: true schema: type: boolean descr...
2
stack_v2_sparse_classes_30k_train_004966
Implement the Python class `LocalizationHandler` described below. Class description: Implement the LocalizationHandler class. Method signatures and docstrings: - def get(self, dateobs, localization_name): --- description: Retrieve a GCN localization tags: - localizations parameters: - in: path name: dateobs required:...
Implement the Python class `LocalizationHandler` described below. Class description: Implement the LocalizationHandler class. Method signatures and docstrings: - def get(self, dateobs, localization_name): --- description: Retrieve a GCN localization tags: - localizations parameters: - in: path name: dateobs required:...
2433d5ae0b2f41faac3c76ed4ae8d9a4da5522fb
<|skeleton|> class LocalizationHandler: def get(self, dateobs, localization_name): """--- description: Retrieve a GCN localization tags: - localizations parameters: - in: path name: dateobs required: true schema: type: dateobs - in: path name: localization_name required: true schema: type: localization_nam...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LocalizationHandler: def get(self, dateobs, localization_name): """--- description: Retrieve a GCN localization tags: - localizations parameters: - in: path name: dateobs required: true schema: type: dateobs - in: path name: localization_name required: true schema: type: localization_name - in: query ...
the_stack_v2_python_sparse
skyportal/handlers/api/gcn.py
dmitryduev/skyportal
train
1
8b5de17457890678b2bf473802ae0182a5d7a447
[ "self.graph = graph\nself.distances = graph.distance\nself.links = graph.links\nself.weighted_edge_list = graph.weighted_edge_list\nself.G = graph.G\nself.sort = sorted(self.weighted_edge_list, key=lambda x: x[2])\nself.ordered_distance = [i[2] for i in self.sort]\nself.ordered_links = [i[0:2] for i in self.sort]\n...
<|body_start_0|> self.graph = graph self.distances = graph.distance self.links = graph.links self.weighted_edge_list = graph.weighted_edge_list self.G = graph.G self.sort = sorted(self.weighted_edge_list, key=lambda x: x[2]) self.ordered_distance = [i[2] for i in ...
Kruskal and prims algorithm.
MST
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MST: """Kruskal and prims algorithm.""" def __init__(self, graph): """Take Graph object from read.py.""" <|body_0|> def kruskal(self): """Find minimum spanning tree using kruskals algorithm.""" <|body_1|> def prims(self, start_node, matrix=None): ...
stack_v2_sparse_classes_10k_train_001570
2,939
no_license
[ { "docstring": "Take Graph object from read.py.", "name": "__init__", "signature": "def __init__(self, graph)" }, { "docstring": "Find minimum spanning tree using kruskals algorithm.", "name": "kruskal", "signature": "def kruskal(self)" }, { "docstring": "Prims algorithm.", "...
3
stack_v2_sparse_classes_30k_val_000160
Implement the Python class `MST` described below. Class description: Kruskal and prims algorithm. Method signatures and docstrings: - def __init__(self, graph): Take Graph object from read.py. - def kruskal(self): Find minimum spanning tree using kruskals algorithm. - def prims(self, start_node, matrix=None): Prims a...
Implement the Python class `MST` described below. Class description: Kruskal and prims algorithm. Method signatures and docstrings: - def __init__(self, graph): Take Graph object from read.py. - def kruskal(self): Find minimum spanning tree using kruskals algorithm. - def prims(self, start_node, matrix=None): Prims a...
1ab79611816cabe8d658d8893e06cab62b2b6af6
<|skeleton|> class MST: """Kruskal and prims algorithm.""" def __init__(self, graph): """Take Graph object from read.py.""" <|body_0|> def kruskal(self): """Find minimum spanning tree using kruskals algorithm.""" <|body_1|> def prims(self, start_node, matrix=None): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MST: """Kruskal and prims algorithm.""" def __init__(self, graph): """Take Graph object from read.py.""" self.graph = graph self.distances = graph.distance self.links = graph.links self.weighted_edge_list = graph.weighted_edge_list self.G = graph.G ...
the_stack_v2_python_sparse
GraphTheory/mst.py
Pullabhatla/M2R
train
0
34c202f078fefacd38f73b7acdf67c9e98897565
[ "super().__init__()\nself.resize_input = resize_input\nself.normalize_input = normalize_input\nself.output_blocks = sorted(output_blocks)\nself.last_needed_block = max(output_blocks)\nassert self.last_needed_block <= 3, 'Last possible output block index is 3'\nself.blocks = nn.ModuleList()\nif use_fid_inception:\n ...
<|body_start_0|> super().__init__() self.resize_input = resize_input self.normalize_input = normalize_input self.output_blocks = sorted(output_blocks) self.last_needed_block = max(output_blocks) assert self.last_needed_block <= 3, 'Last possible output block index is 3' ...
Pretrained InceptionV3 network returning feature maps.
InceptionV3
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InceptionV3: """Pretrained InceptionV3 network returning feature maps.""" def __init__(self, output_blocks=[DEFAULT_BLOCK_INDEX], resize_input=True, normalize_input=True, requires_grad=False, use_fid_inception=True, load_fid_inception=True): """Build pretrained InceptionV3. Args: out...
stack_v2_sparse_classes_10k_train_001571
12,348
permissive
[ { "docstring": "Build pretrained InceptionV3. Args: output_blocks (list[int]): Indices of blocks to return features of. Possible values are: - 0: corresponds to output of first max pooling - 1: corresponds to output of second max pooling - 2: corresponds to output which is fed to aux classifier - 3: corresponds...
2
null
Implement the Python class `InceptionV3` described below. Class description: Pretrained InceptionV3 network returning feature maps. Method signatures and docstrings: - def __init__(self, output_blocks=[DEFAULT_BLOCK_INDEX], resize_input=True, normalize_input=True, requires_grad=False, use_fid_inception=True, load_fid...
Implement the Python class `InceptionV3` described below. Class description: Pretrained InceptionV3 network returning feature maps. Method signatures and docstrings: - def __init__(self, output_blocks=[DEFAULT_BLOCK_INDEX], resize_input=True, normalize_input=True, requires_grad=False, use_fid_inception=True, load_fid...
a382f143c0fd20d227e1e5524831ba26a568190d
<|skeleton|> class InceptionV3: """Pretrained InceptionV3 network returning feature maps.""" def __init__(self, output_blocks=[DEFAULT_BLOCK_INDEX], resize_input=True, normalize_input=True, requires_grad=False, use_fid_inception=True, load_fid_inception=True): """Build pretrained InceptionV3. Args: out...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class InceptionV3: """Pretrained InceptionV3 network returning feature maps.""" def __init__(self, output_blocks=[DEFAULT_BLOCK_INDEX], resize_input=True, normalize_input=True, requires_grad=False, use_fid_inception=True, load_fid_inception=True): """Build pretrained InceptionV3. Args: output_blocks (l...
the_stack_v2_python_sparse
mmagic/evaluation/functional/fid_inception.py
open-mmlab/mmagic
train
1,370
667884fe1789f0822e5d0e5f57f7ed660fa8383a
[ "for row in matrix:\n for col in range(1, len(row)):\n row[col] += row[col - 1]\nself.matrix = matrix", "original = self.matrix[row][col]\nif col != 0:\n original -= self.matrix[row][col - 1]\ndiff = original - val\nfor y in range(col, len(self.matrix[0])):\n self.matrix[row][y] -= diff", "regio...
<|body_start_0|> for row in matrix: for col in range(1, len(row)): row[col] += row[col - 1] self.matrix = matrix <|end_body_0|> <|body_start_1|> original = self.matrix[row][col] if col != 0: original -= self.matrix[row][col - 1] diff = ori...
Your NumMatrix object will be instantiated and called as such: obj = NumMatrix(matrix) obj.update(row,col,val) param_2 = obj.sumRegion(row1,col1,row2,col2) https://leetcode.com/problems/range-sum-query-2d-mutable/discuss/75872/Python-94.5-Simple-sum-array-on-one-dimension-O(n)-for-both-update-and-sum beats 83.86%
NumMatrix
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumMatrix: """Your NumMatrix object will be instantiated and called as such: obj = NumMatrix(matrix) obj.update(row,col,val) param_2 = obj.sumRegion(row1,col1,row2,col2) https://leetcode.com/problems/range-sum-query-2d-mutable/discuss/75872/Python-94.5-Simple-sum-array-on-one-dimension-O(n)-for-b...
stack_v2_sparse_classes_10k_train_001572
8,379
no_license
[ { "docstring": ":type matrix: List[List[int]] element m[i][j] in self.matrix means sum of previous elements in this row, namely sum(m[i][0] + m[i][1] + ... + m[i][j])", "name": "__init__", "signature": "def __init__(self, matrix)" }, { "docstring": "original means the single element value in ori...
3
null
Implement the Python class `NumMatrix` described below. Class description: Your NumMatrix object will be instantiated and called as such: obj = NumMatrix(matrix) obj.update(row,col,val) param_2 = obj.sumRegion(row1,col1,row2,col2) https://leetcode.com/problems/range-sum-query-2d-mutable/discuss/75872/Python-94.5-Simpl...
Implement the Python class `NumMatrix` described below. Class description: Your NumMatrix object will be instantiated and called as such: obj = NumMatrix(matrix) obj.update(row,col,val) param_2 = obj.sumRegion(row1,col1,row2,col2) https://leetcode.com/problems/range-sum-query-2d-mutable/discuss/75872/Python-94.5-Simpl...
035ef08434fa1ca781a6fb2f9eed3538b7d20c02
<|skeleton|> class NumMatrix: """Your NumMatrix object will be instantiated and called as such: obj = NumMatrix(matrix) obj.update(row,col,val) param_2 = obj.sumRegion(row1,col1,row2,col2) https://leetcode.com/problems/range-sum-query-2d-mutable/discuss/75872/Python-94.5-Simple-sum-array-on-one-dimension-O(n)-for-b...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NumMatrix: """Your NumMatrix object will be instantiated and called as such: obj = NumMatrix(matrix) obj.update(row,col,val) param_2 = obj.sumRegion(row1,col1,row2,col2) https://leetcode.com/problems/range-sum-query-2d-mutable/discuss/75872/Python-94.5-Simple-sum-array-on-one-dimension-O(n)-for-both-update-an...
the_stack_v2_python_sparse
leetcode_python/Array/range-sum-query-2d-mutable.py
yennanliu/CS_basics
train
64
d8d4a26c2a05cf21b87e9bc6384a43e3d4f01973
[ "manifest = []\nfor line in manifest_xml_content:\n if 'Scripts' not in line:\n manifest.append(line)\nreturn manifest", "manifest = []\nfor line in manifest_xml_content:\n if '</manifest:manifest>' in line:\n for path in python_file_paths:\n document_path = Manifest.file_path_to_do...
<|body_start_0|> manifest = [] for line in manifest_xml_content: if 'Scripts' not in line: manifest.append(line) return manifest <|end_body_0|> <|body_start_1|> manifest = [] for line in manifest_xml_content: if '</manifest:manifest>' in l...
Manifest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Manifest: def remove_source_paths(cls, manifest_xml_content): """Remove all Python source paths from the given manifest.xml content and return the modified content array.""" <|body_0|> def add_file_paths(cls, manifest_xml_content, python_file_paths): """Add given Pyt...
stack_v2_sparse_classes_10k_train_001573
6,797
permissive
[ { "docstring": "Remove all Python source paths from the given manifest.xml content and return the modified content array.", "name": "remove_source_paths", "signature": "def remove_source_paths(cls, manifest_xml_content)" }, { "docstring": "Add given Python source file paths to manifest.xml so Li...
4
stack_v2_sparse_classes_30k_train_001909
Implement the Python class `Manifest` described below. Class description: Implement the Manifest class. Method signatures and docstrings: - def remove_source_paths(cls, manifest_xml_content): Remove all Python source paths from the given manifest.xml content and return the modified content array. - def add_file_paths...
Implement the Python class `Manifest` described below. Class description: Implement the Manifest class. Method signatures and docstrings: - def remove_source_paths(cls, manifest_xml_content): Remove all Python source paths from the given manifest.xml content and return the modified content array. - def add_file_paths...
d4defdfd6714cfc78667643694999e9e3f4bd5c2
<|skeleton|> class Manifest: def remove_source_paths(cls, manifest_xml_content): """Remove all Python source paths from the given manifest.xml content and return the modified content array.""" <|body_0|> def add_file_paths(cls, manifest_xml_content, python_file_paths): """Add given Pyt...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Manifest: def remove_source_paths(cls, manifest_xml_content): """Remove all Python source paths from the given manifest.xml content and return the modified content array.""" manifest = [] for line in manifest_xml_content: if 'Scripts' not in line: manifest.a...
the_stack_v2_python_sparse
scripts/utils.py
Kazhuu/movelister
train
3
a400a771e9b3dbe12e955e2578d8fe5b7e0628da
[ "super().__init__()\nself.wide = WideLayer(inputs_size=num_fields, output_size=1, dropout_p=wide_dropout_p)\nself.deep = MultilayerPerceptionLayer(inputs_size=embed_size, output_size=1, layer_sizes=deep_layer_sizes, dropout_p=deep_dropout_p, activation=deep_activation)\nself.output = WideLayer(inputs_size=num_field...
<|body_start_0|> super().__init__() self.wide = WideLayer(inputs_size=num_fields, output_size=1, dropout_p=wide_dropout_p) self.deep = MultilayerPerceptionLayer(inputs_size=embed_size, output_size=1, layer_sizes=deep_layer_sizes, dropout_p=deep_dropout_p, activation=deep_activation) self...
Model class of Wide and Deep Model Wide and Deep Model is one of the most famous click-through-rate prediction model which is designed by Google in 2016. :Reference: #. `Heng-Tze Cheng, 2016. Wide & Deep Learning for Recommender Systems <https://arxiv.org/pdf/1606.07792.pdf>`_.
WideAndDeepModel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WideAndDeepModel: """Model class of Wide and Deep Model Wide and Deep Model is one of the most famous click-through-rate prediction model which is designed by Google in 2016. :Reference: #. `Heng-Tze Cheng, 2016. Wide & Deep Learning for Recommender Systems <https://arxiv.org/pdf/1606.07792.pdf>`...
stack_v2_sparse_classes_10k_train_001574
3,948
permissive
[ { "docstring": "Initialize WideAndDeepModel Args: embed_size (int): size of embedding tensor num_fields (int): number of inputs' fields deep_layer_sizes (List[int]): layer sizes of dense network out_dropout_p (float, optional): probability of Dropout in output layer. Defaults to None wide_dropout_p (float, opti...
2
stack_v2_sparse_classes_30k_train_001621
Implement the Python class `WideAndDeepModel` described below. Class description: Model class of Wide and Deep Model Wide and Deep Model is one of the most famous click-through-rate prediction model which is designed by Google in 2016. :Reference: #. `Heng-Tze Cheng, 2016. Wide & Deep Learning for Recommender Systems ...
Implement the Python class `WideAndDeepModel` described below. Class description: Model class of Wide and Deep Model Wide and Deep Model is one of the most famous click-through-rate prediction model which is designed by Google in 2016. :Reference: #. `Heng-Tze Cheng, 2016. Wide & Deep Learning for Recommender Systems ...
751a43b9cd35e951d81c0d9cf46507b1777bb7ff
<|skeleton|> class WideAndDeepModel: """Model class of Wide and Deep Model Wide and Deep Model is one of the most famous click-through-rate prediction model which is designed by Google in 2016. :Reference: #. `Heng-Tze Cheng, 2016. Wide & Deep Learning for Recommender Systems <https://arxiv.org/pdf/1606.07792.pdf>`...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WideAndDeepModel: """Model class of Wide and Deep Model Wide and Deep Model is one of the most famous click-through-rate prediction model which is designed by Google in 2016. :Reference: #. `Heng-Tze Cheng, 2016. Wide & Deep Learning for Recommender Systems <https://arxiv.org/pdf/1606.07792.pdf>`_.""" de...
the_stack_v2_python_sparse
torecsys/models/ctr/wide_and_deep.py
p768lwy3/torecsys
train
98
f2313a5e2139f55fdfd67a66f6eb53b0e706db5d
[ "parser.add_argument('usernames', metavar='USERNAME', nargs='*', help=_('The usernames of users whose tokens will be invalidated.'))\nparser.add_argument('-r', '--reason', default='', help=_('A message indicating why the tokens are no longer valid.'))\nparser.add_argument('-a', '--all', action='store_true', default...
<|body_start_0|> parser.add_argument('usernames', metavar='USERNAME', nargs='*', help=_('The usernames of users whose tokens will be invalidated.')) parser.add_argument('-r', '--reason', default='', help=_('A message indicating why the tokens are no longer valid.')) parser.add_argument('-a', '--...
Management command to invalidate API tokens. Version Added: 5.0
Command
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Command: """Management command to invalidate API tokens. Version Added: 5.0""" def add_arguments(self, parser): """Add arguments to the command. Args: parser (argparse.ArgumentParser): The argument parser for the command.""" <|body_0|> def handle(self, *args, **options):...
stack_v2_sparse_classes_10k_train_001575
3,834
permissive
[ { "docstring": "Add arguments to the command. Args: parser (argparse.ArgumentParser): The argument parser for the command.", "name": "add_arguments", "signature": "def add_arguments(self, parser)" }, { "docstring": "Handle the command. Args: *args (tuple, unused): Arguments parsed on the command...
2
null
Implement the Python class `Command` described below. Class description: Management command to invalidate API tokens. Version Added: 5.0 Method signatures and docstrings: - def add_arguments(self, parser): Add arguments to the command. Args: parser (argparse.ArgumentParser): The argument parser for the command. - def...
Implement the Python class `Command` described below. Class description: Management command to invalidate API tokens. Version Added: 5.0 Method signatures and docstrings: - def add_arguments(self, parser): Add arguments to the command. Args: parser (argparse.ArgumentParser): The argument parser for the command. - def...
c3a991f1e9d7682239a1ab0e8661cee6da01d537
<|skeleton|> class Command: """Management command to invalidate API tokens. Version Added: 5.0""" def add_arguments(self, parser): """Add arguments to the command. Args: parser (argparse.ArgumentParser): The argument parser for the command.""" <|body_0|> def handle(self, *args, **options):...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Command: """Management command to invalidate API tokens. Version Added: 5.0""" def add_arguments(self, parser): """Add arguments to the command. Args: parser (argparse.ArgumentParser): The argument parser for the command.""" parser.add_argument('usernames', metavar='USERNAME', nargs='*', ...
the_stack_v2_python_sparse
reviewboard/webapi/management/commands/invalidate-api-tokens.py
reviewboard/reviewboard
train
1,141
2408c8e28b4bb315cac68c09a501602e50981abc
[ "if not nums:\n return 1\ni = 0\nwhile i < len(nums):\n if nums[i] <= 0 or nums[i] > len(nums) or nums[nums[i] - 1] == nums[i]:\n i += 1\n else:\n nums[nums[i] - 1], nums[i] = (nums[i], nums[nums[i] - 1])\nfor i in range(len(nums)):\n if nums[i] != i + 1:\n return i + 1\nreturn nums...
<|body_start_0|> if not nums: return 1 i = 0 while i < len(nums): if nums[i] <= 0 or nums[i] > len(nums) or nums[nums[i] - 1] == nums[i]: i += 1 else: nums[nums[i] - 1], nums[i] = (nums[i], nums[nums[i] - 1]) for i in ra...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def firstMissingPositive(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def firstMissingPositive_failed(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not nums: ...
stack_v2_sparse_classes_10k_train_001576
2,233
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "firstMissingPositive", "signature": "def firstMissingPositive(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "firstMissingPositive_failed", "signature": "def firstMissingPositive_failed(self, nums)"...
2
stack_v2_sparse_classes_30k_train_005971
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def firstMissingPositive(self, nums): :type nums: List[int] :rtype: int - def firstMissingPositive_failed(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def firstMissingPositive(self, nums): :type nums: List[int] :rtype: int - def firstMissingPositive_failed(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solut...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def firstMissingPositive(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def firstMissingPositive_failed(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def firstMissingPositive(self, nums): """:type nums: List[int] :rtype: int""" if not nums: return 1 i = 0 while i < len(nums): if nums[i] <= 0 or nums[i] > len(nums) or nums[nums[i] - 1] == nums[i]: i += 1 else: ...
the_stack_v2_python_sparse
src/lt_41.py
oxhead/CodingYourWay
train
0
b120b63a4fcac2126041d970782f94c654c95d95
[ "for rasterlayer in queryset:\n rasterlayer.parsestatus.reset()\n rasterlayer.refresh_from_db()\n rasterlayer.save()\nmsg = 'Parsing Rasters, check parse logs for progress'\nself.message_user(request, msg)", "form = None\nlayer = queryset[0]\nif layer.rasterfile:\n self.message_user(request, 'This lay...
<|body_start_0|> for rasterlayer in queryset: rasterlayer.parsestatus.reset() rasterlayer.refresh_from_db() rasterlayer.save() msg = 'Parsing Rasters, check parse logs for progress' self.message_user(request, msg) <|end_body_0|> <|body_start_1|> form ...
Admin action to update filepaths only. Files can be uploadded to the filesystems through any channel and then files can be assigned to the raster objects through this action. This might be useful for large raster files.
RasterLayerModelAdmin
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RasterLayerModelAdmin: """Admin action to update filepaths only. Files can be uploadded to the filesystems through any channel and then files can be assigned to the raster objects through this action. This might be useful for large raster files.""" def reparse_rasters(self, request, queryset...
stack_v2_sparse_classes_10k_train_001577
5,409
permissive
[ { "docstring": "Admin action to re-parse a set of rasterlayers.", "name": "reparse_rasters", "signature": "def reparse_rasters(self, request, queryset)" }, { "docstring": "Admin action to change filepath without uploading new file.", "name": "manually_update_filepath", "signature": "def ...
2
stack_v2_sparse_classes_30k_train_003103
Implement the Python class `RasterLayerModelAdmin` described below. Class description: Admin action to update filepaths only. Files can be uploadded to the filesystems through any channel and then files can be assigned to the raster objects through this action. This might be useful for large raster files. Method sign...
Implement the Python class `RasterLayerModelAdmin` described below. Class description: Admin action to update filepaths only. Files can be uploadded to the filesystems through any channel and then files can be assigned to the raster objects through this action. This might be useful for large raster files. Method sign...
34fffe3d1f921b2850d3cad598a3c9b382e1fec7
<|skeleton|> class RasterLayerModelAdmin: """Admin action to update filepaths only. Files can be uploadded to the filesystems through any channel and then files can be assigned to the raster objects through this action. This might be useful for large raster files.""" def reparse_rasters(self, request, queryset...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RasterLayerModelAdmin: """Admin action to update filepaths only. Files can be uploadded to the filesystems through any channel and then files can be assigned to the raster objects through this action. This might be useful for large raster files.""" def reparse_rasters(self, request, queryset): ""...
the_stack_v2_python_sparse
raster/admin.py
henhuy/django-raster
train
0
6b5e7be9613c16b13e9f1e6e1feaa9b528316d81
[ "super().__init__(*args, **kwargs)\ntry:\n self.idp_hint_param_names = config['allowed_params']\nexcept KeyError:\n raise SATOSAConfigurationError(f\"{self.__class__.__name__} can't find allowed_params\")", "target_entity_id = context.get_decoration(context.KEY_TARGET_ENTITYID)\nqs_params = context.qs_param...
<|body_start_0|> super().__init__(*args, **kwargs) try: self.idp_hint_param_names = config['allowed_params'] except KeyError: raise SATOSAConfigurationError(f"{self.__class__.__name__} can't find allowed_params") <|end_body_0|> <|body_start_1|> target_entity_id =...
Detect if an idp hinting feature have been requested
IdpHinting
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IdpHinting: """Detect if an idp hinting feature have been requested""" def __init__(self, config, *args, **kwargs): """Constructor. :param config: microservice configuration :type config: Dict[str, Dict[str, str]]""" <|body_0|> def process(self, context, data): "...
stack_v2_sparse_classes_10k_train_001578
1,773
permissive
[ { "docstring": "Constructor. :param config: microservice configuration :type config: Dict[str, Dict[str, str]]", "name": "__init__", "signature": "def __init__(self, config, *args, **kwargs)" }, { "docstring": "This intercepts if idp_hint paramenter is in use :param context: request context :par...
2
stack_v2_sparse_classes_30k_train_002914
Implement the Python class `IdpHinting` described below. Class description: Detect if an idp hinting feature have been requested Method signatures and docstrings: - def __init__(self, config, *args, **kwargs): Constructor. :param config: microservice configuration :type config: Dict[str, Dict[str, str]] - def process...
Implement the Python class `IdpHinting` described below. Class description: Detect if an idp hinting feature have been requested Method signatures and docstrings: - def __init__(self, config, *args, **kwargs): Constructor. :param config: microservice configuration :type config: Dict[str, Dict[str, str]] - def process...
d5cac7fc150807f3a42b4ec5942679dd9622cc97
<|skeleton|> class IdpHinting: """Detect if an idp hinting feature have been requested""" def __init__(self, config, *args, **kwargs): """Constructor. :param config: microservice configuration :type config: Dict[str, Dict[str, str]]""" <|body_0|> def process(self, context, data): "...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class IdpHinting: """Detect if an idp hinting feature have been requested""" def __init__(self, config, *args, **kwargs): """Constructor. :param config: microservice configuration :type config: Dict[str, Dict[str, str]]""" super().__init__(*args, **kwargs) try: self.idp_hint...
the_stack_v2_python_sparse
src/satosa/micro_services/idp_hinting.py
IdentityPython/SATOSA
train
139
e84be0586edee80e04b2403c807a77b2ec25fede
[ "if request.user.is_staff or request.method in permissions.SAFE_METHODS:\n return True\ntry:\n org = Organization.objects.get(pk=request.data['organization'])\n is_in_org = org.is_admin(request.user) or org.is_member(request.user)\n return is_in_org and super().has_permission(request, view)\nexcept KeyE...
<|body_start_0|> if request.user.is_staff or request.method in permissions.SAFE_METHODS: return True try: org = Organization.objects.get(pk=request.data['organization']) is_in_org = org.is_admin(request.user) or org.is_member(request.user) return is_in_org...
Custom to check if user belongs to org
IsOrgAdminOrMember
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IsOrgAdminOrMember: """Custom to check if user belongs to org""" def has_permission(self, request, view): """if user is staff or if SAFE request, we're done otherwise check model object perms try for user object if request.user is member or admin of org check perms except: this is or...
stack_v2_sparse_classes_10k_train_001579
5,524
permissive
[ { "docstring": "if user is staff or if SAFE request, we're done otherwise check model object perms try for user object if request.user is member or admin of org check perms except: this is org object, check permissions", "name": "has_permission", "signature": "def has_permission(self, request, view)" ...
2
stack_v2_sparse_classes_30k_train_004447
Implement the Python class `IsOrgAdminOrMember` described below. Class description: Custom to check if user belongs to org Method signatures and docstrings: - def has_permission(self, request, view): if user is staff or if SAFE request, we're done otherwise check model object perms try for user object if request.user...
Implement the Python class `IsOrgAdminOrMember` described below. Class description: Custom to check if user belongs to org Method signatures and docstrings: - def has_permission(self, request, view): if user is staff or if SAFE request, we're done otherwise check model object perms try for user object if request.user...
40d9608295daefc5e1cd83afd84ecb5b0518cc3d
<|skeleton|> class IsOrgAdminOrMember: """Custom to check if user belongs to org""" def has_permission(self, request, view): """if user is staff or if SAFE request, we're done otherwise check model object perms try for user object if request.user is member or admin of org check perms except: this is or...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class IsOrgAdminOrMember: """Custom to check if user belongs to org""" def has_permission(self, request, view): """if user is staff or if SAFE request, we're done otherwise check model object perms try for user object if request.user is member or admin of org check perms except: this is org object, che...
the_stack_v2_python_sparse
app/squac/permissions.py
pnsn/squacapi
train
7
8b44b3e1f7a451cf4076ccc875df59795ae48bc3
[ "time = self.flowsheet().config.time\nt = self.flowsheet().config.time.first()\nself.lift_height = Var(time, initialize=400, domain=NonNegativeReals, units=pyunits.ft, doc='Lift height for pump [ft]')\nself.flow_in = pyunits.convert(self.flow_vol_in[t], to_units=pyunits.m ** 3 / pyunits.hr)\ntry:\n self.lift_hei...
<|body_start_0|> time = self.flowsheet().config.time t = self.flowsheet().config.time.first() self.lift_height = Var(time, initialize=400, domain=NonNegativeReals, units=pyunits.ft, doc='Lift height for pump [ft]') self.flow_in = pyunits.convert(self.flow_vol_in[t], to_units=pyunits.m **...
UnitProcess
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UnitProcess: def fixed_cap(self, unit_params): """Fixed capital cost for deep well injection. :param unit_params: Input parameter dictionary from input sheet. :type unit_params: dict :param lift_height: Lift height for pump [ft] :type lift_height: float :param pipe_distance: Piping dista...
stack_v2_sparse_classes_10k_train_001580
3,523
permissive
[ { "docstring": "Fixed capital cost for deep well injection. :param unit_params: Input parameter dictionary from input sheet. :type unit_params: dict :param lift_height: Lift height for pump [ft] :type lift_height: float :param pipe_distance: Piping distance to deep well injection site :type pipe_distance: float...
3
stack_v2_sparse_classes_30k_train_004418
Implement the Python class `UnitProcess` described below. Class description: Implement the UnitProcess class. Method signatures and docstrings: - def fixed_cap(self, unit_params): Fixed capital cost for deep well injection. :param unit_params: Input parameter dictionary from input sheet. :type unit_params: dict :para...
Implement the Python class `UnitProcess` described below. Class description: Implement the UnitProcess class. Method signatures and docstrings: - def fixed_cap(self, unit_params): Fixed capital cost for deep well injection. :param unit_params: Input parameter dictionary from input sheet. :type unit_params: dict :para...
0e9713a195b50824c4d38ff6ea5db244a6f1ad57
<|skeleton|> class UnitProcess: def fixed_cap(self, unit_params): """Fixed capital cost for deep well injection. :param unit_params: Input parameter dictionary from input sheet. :type unit_params: dict :param lift_height: Lift height for pump [ft] :type lift_height: float :param pipe_distance: Piping dista...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UnitProcess: def fixed_cap(self, unit_params): """Fixed capital cost for deep well injection. :param unit_params: Input parameter dictionary from input sheet. :type unit_params: dict :param lift_height: Lift height for pump [ft] :type lift_height: float :param pipe_distance: Piping distance to deep we...
the_stack_v2_python_sparse
watertap3/watertap3/wt_units/deep_well_injection.py
JamariMurke/WaterTAP3
train
0
bc403fcdd9722d84dd2b72e1f64e8c21370e268f
[ "self.graph = graph\nself.point_dict = dict()\nself.radius = 1", "if root is None:\n algorithm = TreeCenter(self.graph)\n algorithm.run()\n root = algorithm.tree_center[0]\nself.plot(root, 0, 6, level=0)", "assert isinstance(left, (int, Fraction))\nassert isinstance(right, (int, Fraction))\nangle = Fra...
<|body_start_0|> self.graph = graph self.point_dict = dict() self.radius = 1 <|end_body_0|> <|body_start_1|> if root is None: algorithm = TreeCenter(self.graph) algorithm.run() root = algorithm.tree_center[0] self.plot(root, 0, 6, level=0) <|e...
Finding the positions of tree nodes in the plane (radius, angle).
TreePlotRadiusAngle
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TreePlotRadiusAngle: """Finding the positions of tree nodes in the plane (radius, angle).""" def __init__(self, graph): """The algorithm initialization.""" <|body_0|> def run(self, root=None): """Executable pseudocode.""" <|body_1|> def plot(self, so...
stack_v2_sparse_classes_10k_train_001581
3,663
permissive
[ { "docstring": "The algorithm initialization.", "name": "__init__", "signature": "def __init__(self, graph)" }, { "docstring": "Executable pseudocode.", "name": "run", "signature": "def run(self, root=None)" }, { "docstring": "Find node positions (radius, angle). Parameters -----...
3
stack_v2_sparse_classes_30k_train_006559
Implement the Python class `TreePlotRadiusAngle` described below. Class description: Finding the positions of tree nodes in the plane (radius, angle). Method signatures and docstrings: - def __init__(self, graph): The algorithm initialization. - def run(self, root=None): Executable pseudocode. - def plot(self, source...
Implement the Python class `TreePlotRadiusAngle` described below. Class description: Finding the positions of tree nodes in the plane (radius, angle). Method signatures and docstrings: - def __init__(self, graph): The algorithm initialization. - def run(self, root=None): Executable pseudocode. - def plot(self, source...
0ff4ae303e8824e6bb8474d23b29a7b3e5ed8e60
<|skeleton|> class TreePlotRadiusAngle: """Finding the positions of tree nodes in the plane (radius, angle).""" def __init__(self, graph): """The algorithm initialization.""" <|body_0|> def run(self, root=None): """Executable pseudocode.""" <|body_1|> def plot(self, so...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TreePlotRadiusAngle: """Finding the positions of tree nodes in the plane (radius, angle).""" def __init__(self, graph): """The algorithm initialization.""" self.graph = graph self.point_dict = dict() self.radius = 1 def run(self, root=None): """Executable pseu...
the_stack_v2_python_sparse
graphtheory/forests/treeplot.py
kgashok/graphs-dict
train
0
0ef7971de8b5e7700e3bf304c91ead69a8ac9971
[ "if ws is None:\n self.tmp_folder = tempfile.TemporaryDirectory()\n ws = self.tmp_folder.name\nself.ws = ws", "folder = path.join(self.ws, name)\nmakedirs(folder, exist_ok=True)\nmapping_path = path.join(folder, 'mapping.json')\nif path.exists(mapping_path):\n with open(mapping_path, 'r', encoding='utf-8...
<|body_start_0|> if ws is None: self.tmp_folder = tempfile.TemporaryDirectory() ws = self.tmp_folder.name self.ws = ws <|end_body_0|> <|body_start_1|> folder = path.join(self.ws, name) makedirs(folder, exist_ok=True) mapping_path = path.join(folder, 'mapp...
Generate a folder name for caching intermediate variables
CachedWorkspace
[ "Apache-2.0", "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CachedWorkspace: """Generate a folder name for caching intermediate variables""" def __init__(self, ws=None): """Initialization Args: ws (str, optional): Workspace folder If not given, will use a temporary folder.""" <|body_0|> def get_path_for_name_and_kwargs(self, name...
stack_v2_sparse_classes_10k_train_001582
22,314
permissive
[ { "docstring": "Initialization Args: ws (str, optional): Workspace folder If not given, will use a temporary folder.", "name": "__init__", "signature": "def __init__(self, ws=None)" }, { "docstring": "Generate a hashed path in the workspace (self.ws) Args: name (str): a basename (e.g., the inter...
2
stack_v2_sparse_classes_30k_train_006774
Implement the Python class `CachedWorkspace` described below. Class description: Generate a folder name for caching intermediate variables Method signatures and docstrings: - def __init__(self, ws=None): Initialization Args: ws (str, optional): Workspace folder If not given, will use a temporary folder. - def get_pat...
Implement the Python class `CachedWorkspace` described below. Class description: Generate a folder name for caching intermediate variables Method signatures and docstrings: - def __init__(self, ws=None): Initialization Args: ws (str, optional): Workspace folder If not given, will use a temporary folder. - def get_pat...
9aefa13e1cc873cb68801cba49d4e9a48572eeb7
<|skeleton|> class CachedWorkspace: """Generate a folder name for caching intermediate variables""" def __init__(self, ws=None): """Initialization Args: ws (str, optional): Workspace folder If not given, will use a temporary folder.""" <|body_0|> def get_path_for_name_and_kwargs(self, name...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CachedWorkspace: """Generate a folder name for caching intermediate variables""" def __init__(self, ws=None): """Initialization Args: ws (str, optional): Workspace folder If not given, will use a temporary folder.""" if ws is None: self.tmp_folder = tempfile.TemporaryDirectory...
the_stack_v2_python_sparse
pecos/apps/text2text/model.py
zusmani/pecos
train
1
0a63623e867dcd0367f8ab7ea08ba1e903061791
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn Process()", "from .file_hash import FileHash\nfrom .process_integrity_level import ProcessIntegrityLevel\nfrom .file_hash import FileHash\nfrom .process_integrity_level import ProcessIntegrityLevel\nfields: Dict[str, Callable[[Any], No...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return Process() <|end_body_0|> <|body_start_1|> from .file_hash import FileHash from .process_integrity_level import ProcessIntegrityLevel from .file_hash import FileHash from ...
Process
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Process: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Process: """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: Process"""...
stack_v2_sparse_classes_10k_train_001583
6,144
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: Process", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(parse...
3
stack_v2_sparse_classes_30k_train_003172
Implement the Python class `Process` described below. Class description: Implement the Process class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Process: Creates a new instance of the appropriate class based on discriminator value Args: parse_node:...
Implement the Python class `Process` described below. Class description: Implement the Process class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Process: Creates a new instance of the appropriate class based on discriminator value Args: parse_node:...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class Process: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Process: """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: Process"""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Process: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Process: """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: Process""" if no...
the_stack_v2_python_sparse
msgraph/generated/models/process.py
microsoftgraph/msgraph-sdk-python
train
135
c01d79cb05b4f8c46a7f0024c397a22edf3aa765
[ "lock = threading.Lock()\nthreads = []\nfor url in league_urls:\n t = threading.Thread(target=self.crawl_teams_per_league, args=(url, lock))\n t.start()\n threads.append(t)\nfor t in threads:\n t.join()\nreturn self.statistics['teams']", "lock = threading.Lock()\nthreads = []\nfor url in league_result...
<|body_start_0|> lock = threading.Lock() threads = [] for url in league_urls: t = threading.Thread(target=self.crawl_teams_per_league, args=(url, lock)) t.start() threads.append(t) for t in threads: t.join() return self.statistics['...
TODO: not using proper functions anymore TODO: document, fix bugs. TODO: Can be further improved by not blocking results / fixtures by eachother.
SRSCrawlerConcurrent
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SRSCrawlerConcurrent: """TODO: not using proper functions anymore TODO: document, fix bugs. TODO: Can be further improved by not blocking results / fixtures by eachother.""" def crawl_teams(self, league_urls: List[str]): """TODO: write doc.""" <|body_0|> def crawl_result...
stack_v2_sparse_classes_10k_train_001584
2,070
no_license
[ { "docstring": "TODO: write doc.", "name": "crawl_teams", "signature": "def crawl_teams(self, league_urls: List[str])" }, { "docstring": ":param league_results_urls: list of tuples [(league_shortcode, league_url), ..] :param deep_crawl: defaults to False. Set True to follow pagination :return: -...
3
stack_v2_sparse_classes_30k_val_000003
Implement the Python class `SRSCrawlerConcurrent` described below. Class description: TODO: not using proper functions anymore TODO: document, fix bugs. TODO: Can be further improved by not blocking results / fixtures by eachother. Method signatures and docstrings: - def crawl_teams(self, league_urls: List[str]): TOD...
Implement the Python class `SRSCrawlerConcurrent` described below. Class description: TODO: not using proper functions anymore TODO: document, fix bugs. TODO: Can be further improved by not blocking results / fixtures by eachother. Method signatures and docstrings: - def crawl_teams(self, league_urls: List[str]): TOD...
1aeb0ee82ba6052de9a0dee488393bcd79e7d98e
<|skeleton|> class SRSCrawlerConcurrent: """TODO: not using proper functions anymore TODO: document, fix bugs. TODO: Can be further improved by not blocking results / fixtures by eachother.""" def crawl_teams(self, league_urls: List[str]): """TODO: write doc.""" <|body_0|> def crawl_result...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SRSCrawlerConcurrent: """TODO: not using proper functions anymore TODO: document, fix bugs. TODO: Can be further improved by not blocking results / fixtures by eachother.""" def crawl_teams(self, league_urls: List[str]): """TODO: write doc.""" lock = threading.Lock() threads = [] ...
the_stack_v2_python_sparse
swissrugbystats/crawler/crawler/SRSCrawlerConcurrent.py
SwissRugbyStats/swissrugbystats_server
train
0
048562c223f206e16cb9dc4a6975e2ecc5cb2012
[ "tree = []\nqueue = collections.deque([root])\nwhile queue:\n val = queue.popleft()\n if not val:\n tree.append(None)\n else:\n tree.append(str(val.val))\n queue.append(val.left)\n queue.append(val.right)\nreturn ' '.join(tree)", "data = collections.deque(data.split(' '))\nnod...
<|body_start_0|> tree = [] queue = collections.deque([root]) while queue: val = queue.popleft() if not val: tree.append(None) else: tree.append(str(val.val)) queue.append(val.left) queue.append(va...
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_10k_train_001585
2,037
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_005969
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:...
c7a42753b2b16c7b9c66b8d7c2e67b683a15e27d
<|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_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" tree = [] queue = collections.deque([root]) while queue: val = queue.popleft() if not val: tree.append(None) else: ...
the_stack_v2_python_sparse
hard/297.py
brandoneng000/LeetCode
train
0
a2d6aa03aa41ae5fa842219ae37a6dabdfddf0c9
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Missing associated documentation comment in .proto file.
UserFavServicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserFavServicer: """Missing associated documentation comment in .proto file.""" def GetFavList(self, request, context): """过滤收藏信息""" <|body_0|> def AddUserFav(self, request, context): """添加留言""" <|body_1|> def DeleteUserFav(self, request, context): ...
stack_v2_sparse_classes_10k_train_001586
6,939
no_license
[ { "docstring": "过滤收藏信息", "name": "GetFavList", "signature": "def GetFavList(self, request, context)" }, { "docstring": "添加留言", "name": "AddUserFav", "signature": "def AddUserFav(self, request, context)" }, { "docstring": "删除留言", "name": "DeleteUserFav", "signature": "def ...
4
stack_v2_sparse_classes_30k_train_001932
Implement the Python class `UserFavServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def GetFavList(self, request, context): 过滤收藏信息 - def AddUserFav(self, request, context): 添加留言 - def DeleteUserFav(self, request, context): 删除留言 ...
Implement the Python class `UserFavServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def GetFavList(self, request, context): 过滤收藏信息 - def AddUserFav(self, request, context): 添加留言 - def DeleteUserFav(self, request, context): 删除留言 ...
e01c8fc9d9e734578733816669c122dede02489e
<|skeleton|> class UserFavServicer: """Missing associated documentation comment in .proto file.""" def GetFavList(self, request, context): """过滤收藏信息""" <|body_0|> def AddUserFav(self, request, context): """添加留言""" <|body_1|> def DeleteUserFav(self, request, context): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UserFavServicer: """Missing associated documentation comment in .proto file.""" def GetFavList(self, request, context): """过滤收藏信息""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not impleme...
the_stack_v2_python_sparse
other/mxshop_srvs/userop_srv/proto/userfav_pb2_grpc.py
xqmmy/go-fresh
train
1
c00ecc88838314256947875c026edee9048581e6
[ "self.value_stack = []\nwhile root:\n self.value_stack.append(root)\n root = root.left", "temp_root = self.value_stack.pop()\ntemp_value = temp_root.val\ntemp_root = temp_root.right\nwhile temp_root:\n self.value_stack.append(temp_root)\n temp_root = temp_root.left\nreturn temp_value", "if self.valu...
<|body_start_0|> self.value_stack = [] while root: self.value_stack.append(root) root = root.left <|end_body_0|> <|body_start_1|> temp_root = self.value_stack.pop() temp_value = temp_root.val temp_root = temp_root.right while temp_root: ...
BSTIterator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BSTIterator: def __init__(self, root): """:type root: TreeNode""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end_skeleton|> <|body_start_0|> self.value_stack = [] ...
stack_v2_sparse_classes_10k_train_001587
1,145
no_license
[ { "docstring": ":type root: TreeNode", "name": "__init__", "signature": "def __init__(self, root)" }, { "docstring": ":rtype: int", "name": "next", "signature": "def next(self)" }, { "docstring": ":rtype: bool", "name": "hasNext", "signature": "def hasNext(self)" } ]
3
null
Implement the Python class `BSTIterator` described below. Class description: Implement the BSTIterator class. Method signatures and docstrings: - def __init__(self, root): :type root: TreeNode - def next(self): :rtype: int - def hasNext(self): :rtype: bool
Implement the Python class `BSTIterator` described below. Class description: Implement the BSTIterator class. Method signatures and docstrings: - def __init__(self, root): :type root: TreeNode - def next(self): :rtype: int - def hasNext(self): :rtype: bool <|skeleton|> class BSTIterator: def __init__(self, root...
dc45210cb2cc50bfefd8c21c865e6ee2163a022a
<|skeleton|> class BSTIterator: def __init__(self, root): """:type root: TreeNode""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BSTIterator: def __init__(self, root): """:type root: TreeNode""" self.value_stack = [] while root: self.value_stack.append(root) root = root.left def next(self): """:rtype: int""" temp_root = self.value_stack.pop() temp_value = temp...
the_stack_v2_python_sparse
practice/solution/0173_binary_search_tree_iterator.py
kesarb/leetcode-summary-python
train
0
06c9deea268d960d8d0ee98a1bfd9a07619be465
[ "self.n = int(n)\nself.p = float(p)\nif data is None:\n if self.n < 1:\n raise ValueError('n must be a positive value')\n elif self.p <= 0 or self.p >= 1:\n raise ValueError('p must be greater than 0 and less than 1')\nelif isinstance(data, list):\n if len(data) > 1:\n self.data = data...
<|body_start_0|> self.n = int(n) self.p = float(p) if data is None: if self.n < 1: raise ValueError('n must be a positive value') elif self.p <= 0 or self.p >= 1: raise ValueError('p must be greater than 0 and less than 1') elif isi...
Class Binomial
Binomial
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Binomial: """Class Binomial""" def __init__(self, data=None, n=1, p=0.5): """Initializes the distribution. Args: data (list): distribution data n (int): Bernoulli number. p (float): success probability.""" <|body_0|> def pmf(self, k): """Calculates the pmf at a g...
stack_v2_sparse_classes_10k_train_001588
2,389
no_license
[ { "docstring": "Initializes the distribution. Args: data (list): distribution data n (int): Bernoulli number. p (float): success probability.", "name": "__init__", "signature": "def __init__(self, data=None, n=1, p=0.5)" }, { "docstring": "Calculates the pmf at a given k Args: k (int): point to ...
3
stack_v2_sparse_classes_30k_val_000073
Implement the Python class `Binomial` described below. Class description: Class Binomial Method signatures and docstrings: - def __init__(self, data=None, n=1, p=0.5): Initializes the distribution. Args: data (list): distribution data n (int): Bernoulli number. p (float): success probability. - def pmf(self, k): Calc...
Implement the Python class `Binomial` described below. Class description: Class Binomial Method signatures and docstrings: - def __init__(self, data=None, n=1, p=0.5): Initializes the distribution. Args: data (list): distribution data n (int): Bernoulli number. p (float): success probability. - def pmf(self, k): Calc...
5aff923277cfe9f2b5324a773e4e5c3cac810a0c
<|skeleton|> class Binomial: """Class Binomial""" def __init__(self, data=None, n=1, p=0.5): """Initializes the distribution. Args: data (list): distribution data n (int): Bernoulli number. p (float): success probability.""" <|body_0|> def pmf(self, k): """Calculates the pmf at a g...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Binomial: """Class Binomial""" def __init__(self, data=None, n=1, p=0.5): """Initializes the distribution. Args: data (list): distribution data n (int): Bernoulli number. p (float): success probability.""" self.n = int(n) self.p = float(p) if data is None: if s...
the_stack_v2_python_sparse
math/0x03-probability/binomial.py
cmmolanos1/holbertonschool-machine_learning
train
1
43bbf56f80407f5494ca83052d1386aaf2432760
[ "acl.enforce('dynamic_actions:create', context.ctx())\nLOG.debug('Creating dynamic action [action=%s]', dyn_action)\nif not dyn_action.code_source_id and (not dyn_action.code_source_name):\n raise exc.InputException(\"Either 'code_source_id' or 'code_source_name' must be provided.\")\ncode_source = db_api.get_co...
<|body_start_0|> acl.enforce('dynamic_actions:create', context.ctx()) LOG.debug('Creating dynamic action [action=%s]', dyn_action) if not dyn_action.code_source_id and (not dyn_action.code_source_name): raise exc.InputException("Either 'code_source_id' or 'code_source_name' must be p...
DynamicActionsController
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DynamicActionsController: def post(self, dyn_action): """Creates new dynamic action. :param dyn_action: Dynamic action to create.""" <|body_0|> def put(self, dyn_action): """Update dynamic action. :param dyn_action: Dynamic action to create.""" <|body_1|> ...
stack_v2_sparse_classes_10k_train_001589
9,796
permissive
[ { "docstring": "Creates new dynamic action. :param dyn_action: Dynamic action to create.", "name": "post", "signature": "def post(self, dyn_action)" }, { "docstring": "Update dynamic action. :param dyn_action: Dynamic action to create.", "name": "put", "signature": "def put(self, dyn_act...
5
stack_v2_sparse_classes_30k_train_002760
Implement the Python class `DynamicActionsController` described below. Class description: Implement the DynamicActionsController class. Method signatures and docstrings: - def post(self, dyn_action): Creates new dynamic action. :param dyn_action: Dynamic action to create. - def put(self, dyn_action): Update dynamic a...
Implement the Python class `DynamicActionsController` described below. Class description: Implement the DynamicActionsController class. Method signatures and docstrings: - def post(self, dyn_action): Creates new dynamic action. :param dyn_action: Dynamic action to create. - def put(self, dyn_action): Update dynamic a...
7baff017d0cf01d19c44055ad201ca59131b9f94
<|skeleton|> class DynamicActionsController: def post(self, dyn_action): """Creates new dynamic action. :param dyn_action: Dynamic action to create.""" <|body_0|> def put(self, dyn_action): """Update dynamic action. :param dyn_action: Dynamic action to create.""" <|body_1|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DynamicActionsController: def post(self, dyn_action): """Creates new dynamic action. :param dyn_action: Dynamic action to create.""" acl.enforce('dynamic_actions:create', context.ctx()) LOG.debug('Creating dynamic action [action=%s]', dyn_action) if not dyn_action.code_source_i...
the_stack_v2_python_sparse
mistral/api/controllers/v2/dynamic_action.py
openstack/mistral
train
214
0df4bde1b6f4554f89f6ec69b315fe2a45f0786a
[ "self.intent_type = intent_type\nself.domain = domain\nself.service = service\nself.speech = speech", "hass = intent_obj.hass\nslots = self.async_validate_slots(intent_obj.slots)\nstate = async_match_state(hass, slots['name']['value'])\nawait hass.services.async_call(self.domain, self.service, {ATTR_ENTITY_ID: st...
<|body_start_0|> self.intent_type = intent_type self.domain = domain self.service = service self.speech = speech <|end_body_0|> <|body_start_1|> hass = intent_obj.hass slots = self.async_validate_slots(intent_obj.slots) state = async_match_state(hass, slots['name...
Service Intent handler registration. Service specific intent handler that calls a service by name/entity_id.
ServiceIntentHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ServiceIntentHandler: """Service Intent handler registration. Service specific intent handler that calls a service by name/entity_id.""" def __init__(self, intent_type: str, domain: str, service: str, speech: str) -> None: """Create Service Intent Handler.""" <|body_0|> ...
stack_v2_sparse_classes_10k_train_001590
8,241
permissive
[ { "docstring": "Create Service Intent Handler.", "name": "__init__", "signature": "def __init__(self, intent_type: str, domain: str, service: str, speech: str) -> None" }, { "docstring": "Handle the hass intent.", "name": "async_handle", "signature": "async def async_handle(self, intent_...
2
null
Implement the Python class `ServiceIntentHandler` described below. Class description: Service Intent handler registration. Service specific intent handler that calls a service by name/entity_id. Method signatures and docstrings: - def __init__(self, intent_type: str, domain: str, service: str, speech: str) -> None: C...
Implement the Python class `ServiceIntentHandler` described below. Class description: Service Intent handler registration. Service specific intent handler that calls a service by name/entity_id. Method signatures and docstrings: - def __init__(self, intent_type: str, domain: str, service: str, speech: str) -> None: C...
2fee32fce03bc49e86cf2e7b741a15621a97cce5
<|skeleton|> class ServiceIntentHandler: """Service Intent handler registration. Service specific intent handler that calls a service by name/entity_id.""" def __init__(self, intent_type: str, domain: str, service: str, speech: str) -> None: """Create Service Intent Handler.""" <|body_0|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ServiceIntentHandler: """Service Intent handler registration. Service specific intent handler that calls a service by name/entity_id.""" def __init__(self, intent_type: str, domain: str, service: str, speech: str) -> None: """Create Service Intent Handler.""" self.intent_type = intent_typ...
the_stack_v2_python_sparse
homeassistant/helpers/intent.py
BenWoodford/home-assistant
train
11
67b8c381ab3e85c8c39229f626375b11d4acdfe2
[ "super(MultiboxLoss, self).__init__()\nself.iou_threshold = iou_threshold\nself.neg_pos_ratio = neg_pos_ratio\nself.center_variance = center_variance\nself.size_variance = size_variance\nself.priors = priors\nself.priors", "num_classes = confidence.size(2)\nwith torch.no_grad():\n loss = -F.log_softmax(confide...
<|body_start_0|> super(MultiboxLoss, self).__init__() self.iou_threshold = iou_threshold self.neg_pos_ratio = neg_pos_ratio self.center_variance = center_variance self.size_variance = size_variance self.priors = priors self.priors <|end_body_0|> <|body_start_1|> ...
MultiboxLoss
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiboxLoss: def __init__(self, priors, iou_threshold, neg_pos_ratio, center_variance, size_variance, device): """Implement SSD Multibox Loss. Basically, Multibox loss combines classification loss and Smooth L1 regression loss.""" <|body_0|> def forward(self, confidence, pr...
stack_v2_sparse_classes_10k_train_001591
33,668
no_license
[ { "docstring": "Implement SSD Multibox Loss. Basically, Multibox loss combines classification loss and Smooth L1 regression loss.", "name": "__init__", "signature": "def __init__(self, priors, iou_threshold, neg_pos_ratio, center_variance, size_variance, device)" }, { "docstring": "Compute class...
2
null
Implement the Python class `MultiboxLoss` described below. Class description: Implement the MultiboxLoss class. Method signatures and docstrings: - def __init__(self, priors, iou_threshold, neg_pos_ratio, center_variance, size_variance, device): Implement SSD Multibox Loss. Basically, Multibox loss combines classific...
Implement the Python class `MultiboxLoss` described below. Class description: Implement the MultiboxLoss class. Method signatures and docstrings: - def __init__(self, priors, iou_threshold, neg_pos_ratio, center_variance, size_variance, device): Implement SSD Multibox Loss. Basically, Multibox loss combines classific...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class MultiboxLoss: def __init__(self, priors, iou_threshold, neg_pos_ratio, center_variance, size_variance, device): """Implement SSD Multibox Loss. Basically, Multibox loss combines classification loss and Smooth L1 regression loss.""" <|body_0|> def forward(self, confidence, pr...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MultiboxLoss: def __init__(self, priors, iou_threshold, neg_pos_ratio, center_variance, size_variance, device): """Implement SSD Multibox Loss. Basically, Multibox loss combines classification loss and Smooth L1 regression loss.""" super(MultiboxLoss, self).__init__() self.iou_threshol...
the_stack_v2_python_sparse
generated/test_qfgaohao_pytorch_ssd.py
jansel/pytorch-jit-paritybench
train
35
dbe740162d6866df73251f24ee41fbe2a4d30987
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('ckarjadi_johnnyg7', 'ckarjadi_johnnyg7')\nh_Locs = get_Col('h_Locs', repo)\nc_Inc = get_Col('c_Inc', repo)\nw_Jams = get_Col('w_Jams', repo)\nchange = change_hospitals(h_Locs)\ncrimes_close = closest_cri...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('ckarjadi_johnnyg7', 'ckarjadi_johnnyg7') h_Locs = get_Col('h_Locs', repo) c_Inc = get_Col('c_Inc', repo) w_Jams = get_Col('w_Jams', repo) ...
hospitals
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class hospitals: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everything hap...
stack_v2_sparse_classes_10k_train_001592
3,711
no_license
[ { "docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).", "name": "execute", "signature": "def execute(trial=False)" }, { "docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d...
2
stack_v2_sparse_classes_30k_train_002136
Implement the Python class `hospitals` described below. Class description: Implement the hospitals class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=N...
Implement the Python class `hospitals` described below. Class description: Implement the hospitals class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=N...
9cb0ad789b6ff265222cbd3ea3561ff553b4cdff
<|skeleton|> class hospitals: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everything hap...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class hospitals: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('ckarjadi_johnnyg7', 'ckarjadi_johnnyg7') ...
the_stack_v2_python_sparse
ckarjadi_johnnyg7/project2/hospitals_execute.py
yinghang/course-2016-fal-proj
train
1
4fef52fd4a8284eee32ba3cbbb312e12e1593df7
[ "if not builder:\n raise ValueError('Instance builder is not specified')\nself._builder = builder", "osh = self._builder.buildNoNameInstance(number, hostname, system)\nosh.setContainer(containerOsh)\nreturn osh", "if not pdo:\n raise ValueError('Instance information is not specified')\nif not containerOsh...
<|body_start_0|> if not builder: raise ValueError('Instance builder is not specified') self._builder = builder <|end_body_0|> <|body_start_1|> osh = self._builder.buildNoNameInstance(number, hostname, system) osh.setContainer(containerOsh) return osh <|end_body_1|> ...
InstanceReporter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InstanceReporter: def __init__(self, builder): """@types: InstanceBuilder""" <|body_0|> def reportNoNameInst(self, number, hostname, system, containerOsh): """@types: str, str, System, osh -> osh""" <|body_1|> def reportInstance(self, pdo, containerOsh):...
stack_v2_sparse_classes_10k_train_001593
14,040
no_license
[ { "docstring": "@types: InstanceBuilder", "name": "__init__", "signature": "def __init__(self, builder)" }, { "docstring": "@types: str, str, System, osh -> osh", "name": "reportNoNameInst", "signature": "def reportNoNameInst(self, number, hostname, system, containerOsh)" }, { "d...
3
null
Implement the Python class `InstanceReporter` described below. Class description: Implement the InstanceReporter class. Method signatures and docstrings: - def __init__(self, builder): @types: InstanceBuilder - def reportNoNameInst(self, number, hostname, system, containerOsh): @types: str, str, System, osh -> osh - ...
Implement the Python class `InstanceReporter` described below. Class description: Implement the InstanceReporter class. Method signatures and docstrings: - def __init__(self, builder): @types: InstanceBuilder - def reportNoNameInst(self, number, hostname, system, containerOsh): @types: str, str, System, osh -> osh - ...
c431e809e8d0f82e1bca7e3429dd0245560b5680
<|skeleton|> class InstanceReporter: def __init__(self, builder): """@types: InstanceBuilder""" <|body_0|> def reportNoNameInst(self, number, hostname, system, containerOsh): """@types: str, str, System, osh -> osh""" <|body_1|> def reportInstance(self, pdo, containerOsh):...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class InstanceReporter: def __init__(self, builder): """@types: InstanceBuilder""" if not builder: raise ValueError('Instance builder is not specified') self._builder = builder def reportNoNameInst(self, number, hostname, system, containerOsh): """@types: str, str, S...
the_stack_v2_python_sparse
reference/ucmdb/discovery/sap_abap.py
madmonkyang/cda-record
train
0
8af38bc258b027642cf1db7d75621e7c25c195eb
[ "self.model = RandomForestClassifier(bootstrap=True, criterion='gini', min_samples_split=2, max_features='auto', min_samples_leaf=1, n_estimators=1000)\nself.X = X\nself.Y = Y", "if params is None:\n params = [{'n_estimators': [100, 200, 500, 1000], 'criterion': ['entropy'], 'max_features': ['sqrt', 'auto'], '...
<|body_start_0|> self.model = RandomForestClassifier(bootstrap=True, criterion='gini', min_samples_split=2, max_features='auto', min_samples_leaf=1, n_estimators=1000) self.X = X self.Y = Y <|end_body_0|> <|body_start_1|> if params is None: params = [{'n_estimators': [100, 2...
Random forest classifier
RFClassifier
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RFClassifier: """Random forest classifier""" def __init__(self, X, Y): """:param X: :param Y:""" <|body_0|> def tune_and_eval(self, results_file, params=None, feature_names=None, njobs=50, kfold=10): """:param results_file: :param params: :param feature_names: :p...
stack_v2_sparse_classes_10k_train_001594
10,404
permissive
[ { "docstring": ":param X: :param Y:", "name": "__init__", "signature": "def __init__(self, X, Y)" }, { "docstring": ":param results_file: :param params: :param feature_names: :param njobs: :param kfold: :return:", "name": "tune_and_eval", "signature": "def tune_and_eval(self, results_fil...
4
stack_v2_sparse_classes_30k_train_002087
Implement the Python class `RFClassifier` described below. Class description: Random forest classifier Method signatures and docstrings: - def __init__(self, X, Y): :param X: :param Y: - def tune_and_eval(self, results_file, params=None, feature_names=None, njobs=50, kfold=10): :param results_file: :param params: :pa...
Implement the Python class `RFClassifier` described below. Class description: Random forest classifier Method signatures and docstrings: - def __init__(self, X, Y): :param X: :param Y: - def tune_and_eval(self, results_file, params=None, feature_names=None, njobs=50, kfold=10): :param results_file: :param params: :pa...
127177deb630ad66520a2fdae1793417cd77ee99
<|skeleton|> class RFClassifier: """Random forest classifier""" def __init__(self, X, Y): """:param X: :param Y:""" <|body_0|> def tune_and_eval(self, results_file, params=None, feature_names=None, njobs=50, kfold=10): """:param results_file: :param params: :param feature_names: :p...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RFClassifier: """Random forest classifier""" def __init__(self, X, Y): """:param X: :param Y:""" self.model = RandomForestClassifier(bootstrap=True, criterion='gini', min_samples_split=2, max_features='auto', min_samples_leaf=1, n_estimators=1000) self.X = X self.Y = Y ...
the_stack_v2_python_sparse
classifier/classical_classifiers.py
seedpcseed/DiTaxa
train
0
3f57a3105668df5a1e4d8dc2a23ba80f3223ebb7
[ "self.size = size\nself.que_list = [None] * self.size\nself.count = 0", "i = self.count\nself.que_list[i] = enqueue_data\nself.count += 1", "dequeued_value = self.que_list[0]\nfor i in range(0, len(self.que_list) - 1):\n self.que_list[i] = self.que_list[i + 1]\nself.que_list[len(self.que_list) - 1] = None\ns...
<|body_start_0|> self.size = size self.que_list = [None] * self.size self.count = 0 <|end_body_0|> <|body_start_1|> i = self.count self.que_list[i] = enqueue_data self.count += 1 <|end_body_1|> <|body_start_2|> dequeued_value = self.que_list[0] for i in ...
queクラス 引数:リストのサイズ
que
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class que: """queクラス 引数:リストのサイズ""" def __init__(self, size): """引数:リストのサイズ""" <|body_0|> def enqueue(self, enqueue_data): """引数:エンキューしたい数値""" <|body_1|> def dequeue(self): """デキューした値を返す""" <|body_2|> def is_empty(self): """空ならT...
stack_v2_sparse_classes_10k_train_001595
2,175
no_license
[ { "docstring": "引数:リストのサイズ", "name": "__init__", "signature": "def __init__(self, size)" }, { "docstring": "引数:エンキューしたい数値", "name": "enqueue", "signature": "def enqueue(self, enqueue_data)" }, { "docstring": "デキューした値を返す", "name": "dequeue", "signature": "def dequeue(self)...
4
stack_v2_sparse_classes_30k_test_000283
Implement the Python class `que` described below. Class description: queクラス 引数:リストのサイズ Method signatures and docstrings: - def __init__(self, size): 引数:リストのサイズ - def enqueue(self, enqueue_data): 引数:エンキューしたい数値 - def dequeue(self): デキューした値を返す - def is_empty(self): 空ならTrue, 空でないならFalseを返す
Implement the Python class `que` described below. Class description: queクラス 引数:リストのサイズ Method signatures and docstrings: - def __init__(self, size): 引数:リストのサイズ - def enqueue(self, enqueue_data): 引数:エンキューしたい数値 - def dequeue(self): デキューした値を返す - def is_empty(self): 空ならTrue, 空でないならFalseを返す <|skeleton|> class que: ""...
c594461944316b6655ddaf7e877dd6b293649f53
<|skeleton|> class que: """queクラス 引数:リストのサイズ""" def __init__(self, size): """引数:リストのサイズ""" <|body_0|> def enqueue(self, enqueue_data): """引数:エンキューしたい数値""" <|body_1|> def dequeue(self): """デキューした値を返す""" <|body_2|> def is_empty(self): """空ならT...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class que: """queクラス 引数:リストのサイズ""" def __init__(self, size): """引数:リストのサイズ""" self.size = size self.que_list = [None] * self.size self.count = 0 def enqueue(self, enqueue_data): """引数:エンキューしたい数値""" i = self.count self.que_list[i] = enqueue_data ...
the_stack_v2_python_sparse
a0303_stack_que.py
j-d-0630/python
train
0
74769ddb370198b69f3b0b9aa950255f0798fd88
[ "self._num_participants = num_participants\nself._counter = 0\nself._flag = False\nself._local_sense = threading.local()\nself._lock = threading.Lock()\nself._condition = threading.Condition()", "self._local_sense.value = not self._flag\nwith self._lock:\n self._counter += 1\n if self._counter == self._num_...
<|body_start_0|> self._num_participants = num_participants self._counter = 0 self._flag = False self._local_sense = threading.local() self._lock = threading.Lock() self._condition = threading.Condition() <|end_body_0|> <|body_start_1|> self._local_sense.value = n...
A reusable barrier class for worker synchronization.
_Barrier
[ "Apache-2.0", "LicenseRef-scancode-generic-cla", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _Barrier: """A reusable barrier class for worker synchronization.""" def __init__(self, num_participants): """Initializes the barrier object. Args: num_participants: an integer which is the expected number of calls of `wait` pass to through this barrier.""" <|body_0|> de...
stack_v2_sparse_classes_10k_train_001596
34,550
permissive
[ { "docstring": "Initializes the barrier object. Args: num_participants: an integer which is the expected number of calls of `wait` pass to through this barrier.", "name": "__init__", "signature": "def __init__(self, num_participants)" }, { "docstring": "Waits until all other callers reach the sa...
2
stack_v2_sparse_classes_30k_train_002991
Implement the Python class `_Barrier` described below. Class description: A reusable barrier class for worker synchronization. Method signatures and docstrings: - def __init__(self, num_participants): Initializes the barrier object. Args: num_participants: an integer which is the expected number of calls of `wait` pa...
Implement the Python class `_Barrier` described below. Class description: A reusable barrier class for worker synchronization. Method signatures and docstrings: - def __init__(self, num_participants): Initializes the barrier object. Args: num_participants: an integer which is the expected number of calls of `wait` pa...
a7f3934a67900720af3d3b15389551483bee50b8
<|skeleton|> class _Barrier: """A reusable barrier class for worker synchronization.""" def __init__(self, num_participants): """Initializes the barrier object. Args: num_participants: an integer which is the expected number of calls of `wait` pass to through this barrier.""" <|body_0|> de...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class _Barrier: """A reusable barrier class for worker synchronization.""" def __init__(self, num_participants): """Initializes the barrier object. Args: num_participants: an integer which is the expected number of calls of `wait` pass to through this barrier.""" self._num_participants = num_pa...
the_stack_v2_python_sparse
tensorflow/python/distribute/distribute_coordinator.py
tensorflow/tensorflow
train
208,740
db21eaabc1a1319d1e994172a07e5587c1c0cb48
[ "yield mlist.posting_address\nfor destination in sorted(SUBDESTINATIONS):\n yield '{}-{}@{}'.format(mlist.list_name, destination, mlist.mail_host)", "yield mlist.list_name\nfor destination in sorted(SUBDESTINATIONS):\n yield '{}-{}'.format(mlist.list_name, destination)" ]
<|body_start_0|> yield mlist.posting_address for destination in sorted(SUBDESTINATIONS): yield '{}-{}@{}'.format(mlist.list_name, destination, mlist.mail_host) <|end_body_0|> <|body_start_1|> yield mlist.list_name for destination in sorted(SUBDESTINATIONS): yield...
Utility for generating all the aliases of a mailing list.
MailTransportAgentAliases
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MailTransportAgentAliases: """Utility for generating all the aliases of a mailing list.""" def aliases(self, mlist): """See `IMailTransportAgentAliases`.""" <|body_0|> def destinations(self, mlist): """See `IMailTransportAgentAliases`.""" <|body_1|> <|en...
stack_v2_sparse_classes_10k_train_001597
1,771
no_license
[ { "docstring": "See `IMailTransportAgentAliases`.", "name": "aliases", "signature": "def aliases(self, mlist)" }, { "docstring": "See `IMailTransportAgentAliases`.", "name": "destinations", "signature": "def destinations(self, mlist)" } ]
2
stack_v2_sparse_classes_30k_train_002333
Implement the Python class `MailTransportAgentAliases` described below. Class description: Utility for generating all the aliases of a mailing list. Method signatures and docstrings: - def aliases(self, mlist): See `IMailTransportAgentAliases`. - def destinations(self, mlist): See `IMailTransportAgentAliases`.
Implement the Python class `MailTransportAgentAliases` described below. Class description: Utility for generating all the aliases of a mailing list. Method signatures and docstrings: - def aliases(self, mlist): See `IMailTransportAgentAliases`. - def destinations(self, mlist): See `IMailTransportAgentAliases`. <|ske...
7edf8148e34b9f73ca6433ceb43a1770f4fa32c1
<|skeleton|> class MailTransportAgentAliases: """Utility for generating all the aliases of a mailing list.""" def aliases(self, mlist): """See `IMailTransportAgentAliases`.""" <|body_0|> def destinations(self, mlist): """See `IMailTransportAgentAliases`.""" <|body_1|> <|en...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MailTransportAgentAliases: """Utility for generating all the aliases of a mailing list.""" def aliases(self, mlist): """See `IMailTransportAgentAliases`.""" yield mlist.posting_address for destination in sorted(SUBDESTINATIONS): yield '{}-{}@{}'.format(mlist.list_name,...
the_stack_v2_python_sparse
libs/Mailman/mailman/mta/aliases.py
masomel/py-import-analysis
train
1
f7b5d7eaa64b76249b580d82a7e821f923b2a2a2
[ "lesson = Lessons.query.filter_by(id=self.lesson.data).first()\nacademy = Academy.query.filter_by(name=self.academy.data).first()\nstudent = Student.query.filter_by(academy_id=academy.id).filter_by(name=self.name.data).first()\nif student is not None:\n raise ValidationError('Student name is already in the syste...
<|body_start_0|> lesson = Lessons.query.filter_by(id=self.lesson.data).first() academy = Academy.query.filter_by(name=self.academy.data).first() student = Student.query.filter_by(academy_id=academy.id).filter_by(name=self.name.data).first() if student is not None: raise Valid...
Form for getting initial student data
CreateStudentForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreateStudentForm: """Form for getting initial student data""" def validate_name(self, name): """Validate name has yet to be used within the academy""" <|body_0|> def validate_phone2(self, phone): """Validate phone is unique""" <|body_1|> def validat...
stack_v2_sparse_classes_10k_train_001598
19,666
no_license
[ { "docstring": "Validate name has yet to be used within the academy", "name": "validate_name", "signature": "def validate_name(self, name)" }, { "docstring": "Validate phone is unique", "name": "validate_phone2", "signature": "def validate_phone2(self, phone)" }, { "docstring": "...
4
stack_v2_sparse_classes_30k_train_006710
Implement the Python class `CreateStudentForm` described below. Class description: Form for getting initial student data Method signatures and docstrings: - def validate_name(self, name): Validate name has yet to be used within the academy - def validate_phone2(self, phone): Validate phone is unique - def validate_ph...
Implement the Python class `CreateStudentForm` described below. Class description: Form for getting initial student data Method signatures and docstrings: - def validate_name(self, name): Validate name has yet to be used within the academy - def validate_phone2(self, phone): Validate phone is unique - def validate_ph...
e2404fef23258448764aaf9fabb36b6575ddf163
<|skeleton|> class CreateStudentForm: """Form for getting initial student data""" def validate_name(self, name): """Validate name has yet to be used within the academy""" <|body_0|> def validate_phone2(self, phone): """Validate phone is unique""" <|body_1|> def validat...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CreateStudentForm: """Form for getting initial student data""" def validate_name(self, name): """Validate name has yet to be used within the academy""" lesson = Lessons.query.filter_by(id=self.lesson.data).first() academy = Academy.query.filter_by(name=self.academy.data).first() ...
the_stack_v2_python_sparse
app/students/forms.py
Kwsswart/Academy
train
0
dae1b4088ca26ece70dbd91d20a5d5f63fec1c5a
[ "Platform.__init__(self, pos=route[0][:], size=size)\nself._route = route\nself._flying_type = flying_type\nif flying_type == MovingPlatform.LINE:\n self._forward = True\nself._next_point = 1\nself._vector = (Vector2(route[1]) - Vector2(route[0])).normal()", "vector = self._vector * MovingPlatform.SPEED\nself....
<|body_start_0|> Platform.__init__(self, pos=route[0][:], size=size) self._route = route self._flying_type = flying_type if flying_type == MovingPlatform.LINE: self._forward = True self._next_point = 1 self._vector = (Vector2(route[1]) - Vector2(route[0])).nor...
The moving platform class. An instance of this class represents a moving platform of a level. Attributes: _route: The rout of this moving platform. _flying_type: The flying type of the moving platform. _forward: This optional flag, used for the LINE type, determines if the moving platform moves forward or backward in t...
MovingPlatform
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MovingPlatform: """The moving platform class. An instance of this class represents a moving platform of a level. Attributes: _route: The rout of this moving platform. _flying_type: The flying type of the moving platform. _forward: This optional flag, used for the LINE type, determines if the movi...
stack_v2_sparse_classes_10k_train_001599
4,212
no_license
[ { "docstring": "Generates a new instance of this class. Generates a new instance of this class and sets the field information. Args: size: The size of the moving platform. route: The route the moving platform. flying_type: The flying type of the moving platform.", "name": "__init__", "signature": "def _...
2
stack_v2_sparse_classes_30k_train_002357
Implement the Python class `MovingPlatform` described below. Class description: The moving platform class. An instance of this class represents a moving platform of a level. Attributes: _route: The rout of this moving platform. _flying_type: The flying type of the moving platform. _forward: This optional flag, used fo...
Implement the Python class `MovingPlatform` described below. Class description: The moving platform class. An instance of this class represents a moving platform of a level. Attributes: _route: The rout of this moving platform. _flying_type: The flying type of the moving platform. _forward: This optional flag, used fo...
0308785a51bf61d9a4fec2d8370540df502b8178
<|skeleton|> class MovingPlatform: """The moving platform class. An instance of this class represents a moving platform of a level. Attributes: _route: The rout of this moving platform. _flying_type: The flying type of the moving platform. _forward: This optional flag, used for the LINE type, determines if the movi...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MovingPlatform: """The moving platform class. An instance of this class represents a moving platform of a level. Attributes: _route: The rout of this moving platform. _flying_type: The flying type of the moving platform. _forward: This optional flag, used for the LINE type, determines if the moving platform m...
the_stack_v2_python_sparse
game_objects/platform.py
donhilion/JumpAndRun
train
0