blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
378
8.64k
id
stringlengths
44
44
length_bytes
int64
505
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.88k
prompted_full_text
stringlengths
565
12.5k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
5.05k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
snapshot_total_rows
int64
75.8k
75.8k
solution
stringlengths
242
8.3k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
cf5c73a6ada2e212d01ac21e5f13166de7ce32cf
[ "predicted_positives = logits > 0\npositives_binary = positives > 0\nctx.save_for_backward(logits, predicted_positives.float(), positives, negatives, weight)\nintersection = (predicted_positives * positives_binary).sum().float()\nunion = (predicted_positives | positives_binary).sum().float().clamp(min=1)\nreturn in...
<|body_start_0|> predicted_positives = logits > 0 positives_binary = positives > 0 ctx.save_for_backward(logits, predicted_positives.float(), positives, negatives, weight) intersection = (predicted_positives * positives_binary).sum().float() union = (predicted_positives | positiv...
FocalTypeLoss
[ "Apache-2.0", "BSD-2-Clause-Views" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FocalTypeLoss: def forward(ctx, logits, positives, negatives, weight): """:param logits: Any shape, dtype float :param positives: Same shape as logits, dtype float :param negatives: Same shape as logits, dtype float :return: scalar, an IoU type quantity Note that the output is only for c...
stack_v2_sparse_classes_75kplus_train_067600
12,587
permissive
[ { "docstring": ":param logits: Any shape, dtype float :param positives: Same shape as logits, dtype float :param negatives: Same shape as logits, dtype float :return: scalar, an IoU type quantity Note that the output is only for collecting statistic. It is not differentiable, and the backward pass is independen...
2
stack_v2_sparse_classes_30k_train_032771
Implement the Python class `FocalTypeLoss` described below. Class description: Implement the FocalTypeLoss class. Method signatures and docstrings: - def forward(ctx, logits, positives, negatives, weight): :param logits: Any shape, dtype float :param positives: Same shape as logits, dtype float :param negatives: Same...
Implement the Python class `FocalTypeLoss` described below. Class description: Implement the FocalTypeLoss class. Method signatures and docstrings: - def forward(ctx, logits, positives, negatives, weight): :param logits: Any shape, dtype float :param positives: Same shape as logits, dtype float :param negatives: Same...
a266bc16d682832aa854348fa557a30d86b84674
<|skeleton|> class FocalTypeLoss: def forward(ctx, logits, positives, negatives, weight): """:param logits: Any shape, dtype float :param positives: Same shape as logits, dtype float :param negatives: Same shape as logits, dtype float :return: scalar, an IoU type quantity Note that the output is only for c...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FocalTypeLoss: def forward(ctx, logits, positives, negatives, weight): """:param logits: Any shape, dtype float :param positives: Same shape as logits, dtype float :param negatives: Same shape as logits, dtype float :return: scalar, an IoU type quantity Note that the output is only for collecting stat...
the_stack_v2_python_sparse
source/losses/loss_utils.py
allenai/learning_from_interaction
train
12
439fad91b1165b3a014d3773b862998b26e60461
[ "dict.__init__(self)\nself[META_EVENT_ID] = id\nself[META_EVENT_COMP] = comp\nself[META_EVENT_MSG] = None\nself[META_EVENT_DESCRIPTION] = None\nreturn", "if key in self:\n self[key] = value\nelse:\n raise XMLParsingError('Event metadata file {0} error: unexpected element {1}'.format(file, key))\nreturn", ...
<|body_start_0|> dict.__init__(self) self[META_EVENT_ID] = id self[META_EVENT_COMP] = comp self[META_EVENT_MSG] = None self[META_EVENT_DESCRIPTION] = None return <|end_body_0|> <|body_start_1|> if key in self: self[key] = value else: ...
Individual event metadata Access attributes directly. See xsd for field descriptions
MetadataEvent
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MetadataEvent: """Individual event metadata Access attributes directly. See xsd for field descriptions""" def __init__(self, comp, id): """Construct the event metadata from the id and set""" <|body_0|> def update_entry(self, key, value): """Update the entry ... i...
stack_v2_sparse_classes_75kplus_train_067601
7,967
no_license
[ { "docstring": "Construct the event metadata from the id and set", "name": "__init__", "signature": "def __init__(self, comp, id)" }, { "docstring": "Update the entry ... if entry for key donesn't exist then fail", "name": "update_entry", "signature": "def update_entry(self, key, value)"...
3
stack_v2_sparse_classes_30k_train_043154
Implement the Python class `MetadataEvent` described below. Class description: Individual event metadata Access attributes directly. See xsd for field descriptions Method signatures and docstrings: - def __init__(self, comp, id): Construct the event metadata from the id and set - def update_entry(self, key, value): U...
Implement the Python class `MetadataEvent` described below. Class description: Individual event metadata Access attributes directly. See xsd for field descriptions Method signatures and docstrings: - def __init__(self, comp, id): Construct the event metadata from the id and set - def update_entry(self, key, value): U...
eba6c1489b503fdcf040a126942643b355867bcd
<|skeleton|> class MetadataEvent: """Individual event metadata Access attributes directly. See xsd for field descriptions""" def __init__(self, comp, id): """Construct the event metadata from the id and set""" <|body_0|> def update_entry(self, key, value): """Update the entry ... i...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MetadataEvent: """Individual event metadata Access attributes directly. See xsd for field descriptions""" def __init__(self, comp, id): """Construct the event metadata from the id and set""" dict.__init__(self) self[META_EVENT_ID] = id self[META_EVENT_COMP] = comp ...
the_stack_v2_python_sparse
src/ibm/teal/metadata.py
ppjsand/pyteal
train
1
605cf44045eff1fee0680146b103b3ee41f487d0
[ "form = SingleGetForm({'image_id': image_id})\nif not form.is_valid():\n e = BadRequestException()\n e.detail = image_id\n raise e\nreturn Response(form.submit(request))", "params = dict(((key, val) for key, val in request.DATA.iteritems()))\nparams['image_id'] = image_id\nform = PutForm(params)\nif not ...
<|body_start_0|> form = SingleGetForm({'image_id': image_id}) if not form.is_valid(): e = BadRequestException() e.detail = image_id raise e return Response(form.submit(request)) <|end_body_0|> <|body_start_1|> params = dict(((key, val) for key, val in...
Class for rendering the view for getting a Image, deleting a Image and updating a Image.
ImageSingle
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageSingle: """Class for rendering the view for getting a Image, deleting a Image and updating a Image.""" def get(self, request, image_id): """Method for getting multiple Images either through search or general listing.""" <|body_0|> def put(self, request, image_id): ...
stack_v2_sparse_classes_75kplus_train_067602
2,360
no_license
[ { "docstring": "Method for getting multiple Images either through search or general listing.", "name": "get", "signature": "def get(self, request, image_id)" }, { "docstring": "Method for updating a Image's information.", "name": "put", "signature": "def put(self, request, image_id)" }...
3
stack_v2_sparse_classes_30k_train_025774
Implement the Python class `ImageSingle` described below. Class description: Class for rendering the view for getting a Image, deleting a Image and updating a Image. Method signatures and docstrings: - def get(self, request, image_id): Method for getting multiple Images either through search or general listing. - def...
Implement the Python class `ImageSingle` described below. Class description: Class for rendering the view for getting a Image, deleting a Image and updating a Image. Method signatures and docstrings: - def get(self, request, image_id): Method for getting multiple Images either through search or general listing. - def...
22c1ce3c5a8e4ed99c2f014672d60ad3c5a4003c
<|skeleton|> class ImageSingle: """Class for rendering the view for getting a Image, deleting a Image and updating a Image.""" def get(self, request, image_id): """Method for getting multiple Images either through search or general listing.""" <|body_0|> def put(self, request, image_id): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ImageSingle: """Class for rendering the view for getting a Image, deleting a Image and updating a Image.""" def get(self, request, image_id): """Method for getting multiple Images either through search or general listing.""" form = SingleGetForm({'image_id': image_id}) if not form...
the_stack_v2_python_sparse
biodig/rest/v2/Images/views.py
asmariyaz23/BioDIG
train
0
0b8e38dcafb0b1a1d2a9e3df8a0873a8681916a1
[ "invoice_line_obj = self.pool.get('account.invoice.line')\ninvoice_obj = self.pool.get('account.invoice')\nacc_mv_obj = self.pool.get('account.move')\nacc_mv_l_obj = self.pool.get('account.move.line')\ntax_obj = self.pool.get('account.invoice.tax')\ninvoice = {}\nif inv_brw.nro_ctrl:\n invoice.update({'name': 'P...
<|body_start_0|> invoice_line_obj = self.pool.get('account.invoice.line') invoice_obj = self.pool.get('account.invoice') acc_mv_obj = self.pool.get('account.move') acc_mv_l_obj = self.pool.get('account.move.line') tax_obj = self.pool.get('account.invoice.tax') invoice = {...
WizardInvoiceNroCtrl
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WizardInvoiceNroCtrl: def action_invoice_create(self, cr, uid, ids, wizard_brw, inv_brw, context=None): """If the invoice has control number, this function is responsible for passing the bill to damaged paper @param wizard_brw: nothing for now @param inv_brw: damaged paper""" <|b...
stack_v2_sparse_classes_75kplus_train_067603
6,304
no_license
[ { "docstring": "If the invoice has control number, this function is responsible for passing the bill to damaged paper @param wizard_brw: nothing for now @param inv_brw: damaged paper", "name": "action_invoice_create", "signature": "def action_invoice_create(self, cr, uid, ids, wizard_brw, inv_brw, conte...
3
stack_v2_sparse_classes_30k_train_043746
Implement the Python class `WizardInvoiceNroCtrl` described below. Class description: Implement the WizardInvoiceNroCtrl class. Method signatures and docstrings: - def action_invoice_create(self, cr, uid, ids, wizard_brw, inv_brw, context=None): If the invoice has control number, this function is responsible for pass...
Implement the Python class `WizardInvoiceNroCtrl` described below. Class description: Implement the WizardInvoiceNroCtrl class. Method signatures and docstrings: - def action_invoice_create(self, cr, uid, ids, wizard_brw, inv_brw, context=None): If the invoice has control number, this function is responsible for pass...
718327d01e5b4408add58682c5ad1901fa35b450
<|skeleton|> class WizardInvoiceNroCtrl: def action_invoice_create(self, cr, uid, ids, wizard_brw, inv_brw, context=None): """If the invoice has control number, this function is responsible for passing the bill to damaged paper @param wizard_brw: nothing for now @param inv_brw: damaged paper""" <|b...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WizardInvoiceNroCtrl: def action_invoice_create(self, cr, uid, ids, wizard_brw, inv_brw, context=None): """If the invoice has control number, this function is responsible for passing the bill to damaged paper @param wizard_brw: nothing for now @param inv_brw: damaged paper""" invoice_line_obj ...
the_stack_v2_python_sparse
l10n_ve_fiscal_requirements/wizard/wizard_invoice_nro_ctrl.py
Vauxoo/odoo-venezuela
train
15
30f0bf9ea9e1102f441545bda407a19df9afa903
[ "if os.path.isfile(file_path):\n self.file_path = file_path\nelse:\n raise OSError('file path provided does not have a file')\nif type(test_size) is float:\n self.test_size = test_size\nelse:\n self.test_size = 0.2", "with open(self.file_path) as json_file:\n dictionary = json.load(json_file)\npath...
<|body_start_0|> if os.path.isfile(file_path): self.file_path = file_path else: raise OSError('file path provided does not have a file') if type(test_size) is float: self.test_size = test_size else: self.test_size = 0.2 <|end_body_0|> <|bo...
Implementation of DataReader for the files containing all 278 features.
DataReader278Features
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataReader278Features: """Implementation of DataReader for the files containing all 278 features.""" def __init__(self, file_path, test_size): """Init method :param file_path: file path containing a file of data. :param test_size (optional): fraction of the data to be used for testin...
stack_v2_sparse_classes_75kplus_train_067604
2,736
no_license
[ { "docstring": "Init method :param file_path: file path containing a file of data. :param test_size (optional): fraction of the data to be used for testing.", "name": "__init__", "signature": "def __init__(self, file_path, test_size)" }, { "docstring": "Extracts 278 features from the specified f...
2
stack_v2_sparse_classes_30k_train_026254
Implement the Python class `DataReader278Features` described below. Class description: Implementation of DataReader for the files containing all 278 features. Method signatures and docstrings: - def __init__(self, file_path, test_size): Init method :param file_path: file path containing a file of data. :param test_si...
Implement the Python class `DataReader278Features` described below. Class description: Implementation of DataReader for the files containing all 278 features. Method signatures and docstrings: - def __init__(self, file_path, test_size): Init method :param file_path: file path containing a file of data. :param test_si...
9d751f6d6434fb9b418037cbaf928b0edd20a784
<|skeleton|> class DataReader278Features: """Implementation of DataReader for the files containing all 278 features.""" def __init__(self, file_path, test_size): """Init method :param file_path: file path containing a file of data. :param test_size (optional): fraction of the data to be used for testin...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DataReader278Features: """Implementation of DataReader for the files containing all 278 features.""" def __init__(self, file_path, test_size): """Init method :param file_path: file path containing a file of data. :param test_size (optional): fraction of the data to be used for testing.""" ...
the_stack_v2_python_sparse
reco_code/datareader_278_features.py
martheveldhuis/ReCo
train
1
39fe60b6b9c68cc322b2a74ec48c2355a79d5613
[ "def is_palindrome(i, j):\n while i < j:\n if s[i] != s[j - 1]:\n return False\n i += 1\n j -= 1\n return True\n\n@lru_cache(None)\ndef part(i):\n if i == len(s):\n return [[]]\n ret = []\n for j in range(i + 1, len(s) + 1):\n if is_palindrome(i, j):\n ...
<|body_start_0|> def is_palindrome(i, j): while i < j: if s[i] != s[j - 1]: return False i += 1 j -= 1 return True @lru_cache(None) def part(i): if i == len(s): return [[]] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def partition(self, s): """07/08/2018 03:52""" <|body_0|> def partition(self, s: str) -> List[List[str]]: """12/04/2021 10:59""" <|body_1|> def partition(self, s: str) -> List[List[str]]: """Jan 28, 2022 23:57""" <|body_2|> ...
stack_v2_sparse_classes_75kplus_train_067605
3,522
no_license
[ { "docstring": "07/08/2018 03:52", "name": "partition", "signature": "def partition(self, s)" }, { "docstring": "12/04/2021 10:59", "name": "partition", "signature": "def partition(self, s: str) -> List[List[str]]" }, { "docstring": "Jan 28, 2022 23:57", "name": "partition", ...
4
stack_v2_sparse_classes_30k_train_005017
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def partition(self, s): 07/08/2018 03:52 - def partition(self, s: str) -> List[List[str]]: 12/04/2021 10:59 - def partition(self, s: str) -> List[List[str]]: Jan 28, 2022 23:57 -...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def partition(self, s): 07/08/2018 03:52 - def partition(self, s: str) -> List[List[str]]: 12/04/2021 10:59 - def partition(self, s: str) -> List[List[str]]: Jan 28, 2022 23:57 -...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def partition(self, s): """07/08/2018 03:52""" <|body_0|> def partition(self, s: str) -> List[List[str]]: """12/04/2021 10:59""" <|body_1|> def partition(self, s: str) -> List[List[str]]: """Jan 28, 2022 23:57""" <|body_2|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def partition(self, s): """07/08/2018 03:52""" def is_palindrome(i, j): while i < j: if s[i] != s[j - 1]: return False i += 1 j -= 1 return True @lru_cache(None) def part(i): ...
the_stack_v2_python_sparse
leetcode/solved/131_Palindrome_Partitioning/solution.py
sungminoh/algorithms
train
0
d0a124d707ac2e293eded8fb6e30d7a749f4d04c
[ "dist_id = self.parameter_value('id', kwargs)\nif dist_id:\n return self.new_query(distribution.Distribution).get(dist_id)", "value = self.fetch_distribution(kwargs)\nif not value:\n return self.set_status(404)\nLOGGER.warning('Deleting distribution %s', value.id)\nself.database.delete(value)\nself.database...
<|body_start_0|> dist_id = self.parameter_value('id', kwargs) if dist_id: return self.new_query(distribution.Distribution).get(dist_id) <|end_body_0|> <|body_start_1|> value = self.fetch_distribution(kwargs) if not value: return self.set_status(404) LOGGE...
API interface for managing distribution data
Distribution
[ "BSD-3-Clause", "CC-BY-3.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Distribution: """API interface for managing distribution data""" def fetch_distribution(self, kwargs): """Get a single distribution from the database. :param dict kwargs: Keyword arguments from the request :rtype: apiary.mappers.distribution.Distribution""" <|body_0|> de...
stack_v2_sparse_classes_75kplus_train_067606
3,056
permissive
[ { "docstring": "Get a single distribution from the database. :param dict kwargs: Keyword arguments from the request :rtype: apiary.mappers.distribution.Distribution", "name": "fetch_distribution", "signature": "def fetch_distribution(self, kwargs)" }, { "docstring": "Delete a distribution from t...
4
stack_v2_sparse_classes_30k_train_047216
Implement the Python class `Distribution` described below. Class description: API interface for managing distribution data Method signatures and docstrings: - def fetch_distribution(self, kwargs): Get a single distribution from the database. :param dict kwargs: Keyword arguments from the request :rtype: apiary.mapper...
Implement the Python class `Distribution` described below. Class description: API interface for managing distribution data Method signatures and docstrings: - def fetch_distribution(self, kwargs): Get a single distribution from the database. :param dict kwargs: Keyword arguments from the request :rtype: apiary.mapper...
0acd513b2bcbc9bb5f7c5a657b41ed6601fcd002
<|skeleton|> class Distribution: """API interface for managing distribution data""" def fetch_distribution(self, kwargs): """Get a single distribution from the database. :param dict kwargs: Keyword arguments from the request :rtype: apiary.mappers.distribution.Distribution""" <|body_0|> de...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Distribution: """API interface for managing distribution data""" def fetch_distribution(self, kwargs): """Get a single distribution from the database. :param dict kwargs: Keyword arguments from the request :rtype: apiary.mappers.distribution.Distribution""" dist_id = self.parameter_value(...
the_stack_v2_python_sparse
apiary/api/distribution.py
gmr/apiary
train
0
06abbd63077e91e11f67e3665441490a61bd2b0b
[ "self.a = ap\nself.x = xp\nself.c = cp\nself.m = mp\nself.result = (self.a * self.x + self.c) % self.m", "firstresult = self.result\nself.x = (self.a * self.x + self.c) % self.m\nself.result = (self.a * self.x + self.c) % self.m\nreturn firstresult" ]
<|body_start_0|> self.a = ap self.x = xp self.c = cp self.m = mp self.result = (self.a * self.x + self.c) % self.m <|end_body_0|> <|body_start_1|> firstresult = self.result self.x = (self.a * self.x + self.c) % self.m self.result = (self.a * self.x + self...
Generates a sequence of pseudo-random integers using linear congruential generator
Pseudorandom
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Pseudorandom: """Generates a sequence of pseudo-random integers using linear congruential generator""" def __init__(self, ap, xp, cp, mp): """Constructor: takes a, x, c, and m and initializes a Pseudo-random object""" <|body_0|> def next(self): """Generates and r...
stack_v2_sparse_classes_75kplus_train_067607
37,378
no_license
[ { "docstring": "Constructor: takes a, x, c, and m and initializes a Pseudo-random object", "name": "__init__", "signature": "def __init__(self, ap, xp, cp, mp)" }, { "docstring": "Generates and returns the next number in the Pseudo-random sequence", "name": "next", "signature": "def next...
2
null
Implement the Python class `Pseudorandom` described below. Class description: Generates a sequence of pseudo-random integers using linear congruential generator Method signatures and docstrings: - def __init__(self, ap, xp, cp, mp): Constructor: takes a, x, c, and m and initializes a Pseudo-random object - def next(s...
Implement the Python class `Pseudorandom` described below. Class description: Generates a sequence of pseudo-random integers using linear congruential generator Method signatures and docstrings: - def __init__(self, ap, xp, cp, mp): Constructor: takes a, x, c, and m and initializes a Pseudo-random object - def next(s...
15a8d4aebc53ccd02f2c7ba36ae8d2abae7eb4c8
<|skeleton|> class Pseudorandom: """Generates a sequence of pseudo-random integers using linear congruential generator""" def __init__(self, ap, xp, cp, mp): """Constructor: takes a, x, c, and m and initializes a Pseudo-random object""" <|body_0|> def next(self): """Generates and r...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Pseudorandom: """Generates a sequence of pseudo-random integers using linear congruential generator""" def __init__(self, ap, xp, cp, mp): """Constructor: takes a, x, c, and m and initializes a Pseudo-random object""" self.a = ap self.x = xp self.c = cp self.m = mp...
the_stack_v2_python_sparse
ch08/Perkovic_Ch_08.py
testowy4u/L_Python_Perkovic_Introduction-to-Computing-Using-Python_Edition-1
train
0
cca77157033c806c8fd8a168a9feec25e1ad6429
[ "self.auth = auth\nif isinstance(sid, PracticeSchool):\n self.school = sid\nelse:\n self.school = self.get_school_model(sid)", "if not sid:\n return None\nschool = PracticeSchool.objects.get_once(pk=sid)\nif not school:\n raise PracticeSchoolInfoExcept.school_is_not_exists()\nreturn school", "if not...
<|body_start_0|> self.auth = auth if isinstance(sid, PracticeSchool): self.school = sid else: self.school = self.get_school_model(sid) <|end_body_0|> <|body_start_1|> if not sid: return None school = PracticeSchool.objects.get_once(pk=sid) ...
SchoolLogic
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SchoolLogic: def __init__(self, auth, sid): """INIT :param auth: :param sid:""" <|body_0|> def get_school_model(self, sid): """获取学校model :param sid: :return:""" <|body_1|> def get_school_info(self): """获取学校信息 :return:""" <|body_2|> <|end...
stack_v2_sparse_classes_75kplus_train_067608
1,120
no_license
[ { "docstring": "INIT :param auth: :param sid:", "name": "__init__", "signature": "def __init__(self, auth, sid)" }, { "docstring": "获取学校model :param sid: :return:", "name": "get_school_model", "signature": "def get_school_model(self, sid)" }, { "docstring": "获取学校信息 :return:", ...
3
stack_v2_sparse_classes_30k_train_015543
Implement the Python class `SchoolLogic` described below. Class description: Implement the SchoolLogic class. Method signatures and docstrings: - def __init__(self, auth, sid): INIT :param auth: :param sid: - def get_school_model(self, sid): 获取学校model :param sid: :return: - def get_school_info(self): 获取学校信息 :return:
Implement the Python class `SchoolLogic` described below. Class description: Implement the SchoolLogic class. Method signatures and docstrings: - def __init__(self, auth, sid): INIT :param auth: :param sid: - def get_school_model(self, sid): 获取学校model :param sid: :return: - def get_school_info(self): 获取学校信息 :return: ...
7467cd66e1fc91f0b3a264f8fc9b93f22f09fe7b
<|skeleton|> class SchoolLogic: def __init__(self, auth, sid): """INIT :param auth: :param sid:""" <|body_0|> def get_school_model(self, sid): """获取学校model :param sid: :return:""" <|body_1|> def get_school_info(self): """获取学校信息 :return:""" <|body_2|> <|end...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SchoolLogic: def __init__(self, auth, sid): """INIT :param auth: :param sid:""" self.auth = auth if isinstance(sid, PracticeSchool): self.school = sid else: self.school = self.get_school_model(sid) def get_school_model(self, sid): """获取学校mod...
the_stack_v2_python_sparse
FireHydrant/server/practice/logics/school.py
shoogoome/FireHydrant
train
4
3e9a70f2bb3186f5131a38c2b73f67a7b582a5f0
[ "super(Recorder, self).__init__()\nself.symbols = symbols\nself.timer_frequency = SNAPSHOT_RATE\nself.workers = dict()\nself.current_time = dt.now()\nself.daemon = False", "coinbase, bitfinex = self.symbols\nself.workers[coinbase] = CoinbaseClient(sym=coinbase)\nself.workers[bitfinex] = BitfinexClient(sym=bitfine...
<|body_start_0|> super(Recorder, self).__init__() self.symbols = symbols self.timer_frequency = SNAPSHOT_RATE self.workers = dict() self.current_time = dt.now() self.daemon = False <|end_body_0|> <|body_start_1|> coinbase, bitfinex = self.symbols self.wor...
Recorder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Recorder: def __init__(self, symbols): """Constructor of Recorder. :param symbols: basket of securities to record... Example: symbols = [('BTC-USD, 'tBTCUSD')]""" <|body_0|> def run(self) -> None: """New process created to instantiate limit order books for (1) Coinba...
stack_v2_sparse_classes_75kplus_train_067609
4,752
no_license
[ { "docstring": "Constructor of Recorder. :param symbols: basket of securities to record... Example: symbols = [('BTC-USD, 'tBTCUSD')]", "name": "__init__", "signature": "def __init__(self, symbols)" }, { "docstring": "New process created to instantiate limit order books for (1) Coinbase Pro, and...
3
stack_v2_sparse_classes_30k_train_012898
Implement the Python class `Recorder` described below. Class description: Implement the Recorder class. Method signatures and docstrings: - def __init__(self, symbols): Constructor of Recorder. :param symbols: basket of securities to record... Example: symbols = [('BTC-USD, 'tBTCUSD')] - def run(self) -> None: New pr...
Implement the Python class `Recorder` described below. Class description: Implement the Recorder class. Method signatures and docstrings: - def __init__(self, symbols): Constructor of Recorder. :param symbols: basket of securities to record... Example: symbols = [('BTC-USD, 'tBTCUSD')] - def run(self) -> None: New pr...
078081e5715cadeae9c798a3d759c9d59d2041bc
<|skeleton|> class Recorder: def __init__(self, symbols): """Constructor of Recorder. :param symbols: basket of securities to record... Example: symbols = [('BTC-USD, 'tBTCUSD')]""" <|body_0|> def run(self) -> None: """New process created to instantiate limit order books for (1) Coinba...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Recorder: def __init__(self, symbols): """Constructor of Recorder. :param symbols: basket of securities to record... Example: symbols = [('BTC-USD, 'tBTCUSD')]""" super(Recorder, self).__init__() self.symbols = symbols self.timer_frequency = SNAPSHOT_RATE self.workers =...
the_stack_v2_python_sparse
recorder.py
sadighian/crypto-rl
train
676
1b585b2aceb3f79ffa82ffe93720519d8c079ba2
[ "Simulator.__init__(self, state_set, action_set, modules)\nassert 'auctions' in modules.keys()\nassert 'clicks' in modules.keys()\nassert 'rpc' in modules.keys()\nassert 'cpc' in modules.keys()", "assert a in self.action_set\nhow = self.s_ix\nN_A = self.modules['auctions'].sample(how=how)\nN_c = self.modules['cli...
<|body_start_0|> Simulator.__init__(self, state_set, action_set, modules) assert 'auctions' in modules.keys() assert 'clicks' in modules.keys() assert 'rpc' in modules.keys() assert 'cpc' in modules.keys() <|end_body_0|> <|body_start_1|> assert a in self.action_set ...
Auction simulator using hours of week (encoded as a value in the range 0-167) as states and a constant revenue per click for every hour of week. :ivar list state_set: List of possible states. :ivar list action_set: List of valid actions. :ivar dict modules: Dictionary of modules used to model stochastic variables in th...
SimulatorConstRPCHoW
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimulatorConstRPCHoW: """Auction simulator using hours of week (encoded as a value in the range 0-167) as states and a constant revenue per click for every hour of week. :ivar list state_set: List of possible states. :ivar list action_set: List of valid actions. :ivar dict modules: Dictionary of ...
stack_v2_sparse_classes_75kplus_train_067610
40,659
permissive
[ { "docstring": ":param list state_set: List of possible states. :param list action_set: List of valid actions. :param dict modules: Dictionary of modules used to model stochastic variables in the simulator.", "name": "__init__", "signature": "def __init__(self, state_set, action_set, modules)" }, { ...
2
stack_v2_sparse_classes_30k_train_029850
Implement the Python class `SimulatorConstRPCHoW` described below. Class description: Auction simulator using hours of week (encoded as a value in the range 0-167) as states and a constant revenue per click for every hour of week. :ivar list state_set: List of possible states. :ivar list action_set: List of valid acti...
Implement the Python class `SimulatorConstRPCHoW` described below. Class description: Auction simulator using hours of week (encoded as a value in the range 0-167) as states and a constant revenue per click for every hour of week. :ivar list state_set: List of possible states. :ivar list action_set: List of valid acti...
ade886e9dcbde9fcea218a19f0130cc09f81e55e
<|skeleton|> class SimulatorConstRPCHoW: """Auction simulator using hours of week (encoded as a value in the range 0-167) as states and a constant revenue per click for every hour of week. :ivar list state_set: List of possible states. :ivar list action_set: List of valid actions. :ivar dict modules: Dictionary of ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SimulatorConstRPCHoW: """Auction simulator using hours of week (encoded as a value in the range 0-167) as states and a constant revenue per click for every hour of week. :ivar list state_set: List of possible states. :ivar list action_set: List of valid actions. :ivar dict modules: Dictionary of modules used ...
the_stack_v2_python_sparse
ssa_sim_v2/simulator/simulator.py
donghun2018/adclick-simulator-v2
train
0
cb7b5fd81f0690f6d9021f456f0557777257857b
[ "self.tg_context = tg_context\nself.query = query\nself.tags = get_tags_from_text(query, limit=10)\nself.user = user\nself.mode = Context.STICKER_MODE\nself.determine_special_search()\nself.inline_query_id = None\nself.offset = None\nself.fuzzy_offset = None\nself.extract_info_from_offset(offset_payload)\nself.swit...
<|body_start_0|> self.tg_context = tg_context self.query = query self.tags = get_tags_from_text(query, limit=10) self.user = user self.mode = Context.STICKER_MODE self.determine_special_search() self.inline_query_id = None self.offset = None self.f...
Object representing a inline query search for easier parameter handling.
Context
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Context: """Object representing a inline query search for easier parameter handling.""" def __init__(self, tg_context, query, offset_payload, user): """Create a new context instance.""" <|body_0|> def __str__(self): """Debug string for class.""" <|body_1|...
stack_v2_sparse_classes_75kplus_train_067611
2,919
permissive
[ { "docstring": "Create a new context instance.", "name": "__init__", "signature": "def __init__(self, tg_context, query, offset_payload, user)" }, { "docstring": "Debug string for class.", "name": "__str__", "signature": "def __str__(self)" }, { "docstring": "Extract all importan...
5
null
Implement the Python class `Context` described below. Class description: Object representing a inline query search for easier parameter handling. Method signatures and docstrings: - def __init__(self, tg_context, query, offset_payload, user): Create a new context instance. - def __str__(self): Debug string for class....
Implement the Python class `Context` described below. Class description: Object representing a inline query search for easier parameter handling. Method signatures and docstrings: - def __init__(self, tg_context, query, offset_payload, user): Create a new context instance. - def __str__(self): Debug string for class....
873468f8de26cc32d1de9b688140569b8086ab5b
<|skeleton|> class Context: """Object representing a inline query search for easier parameter handling.""" def __init__(self, tg_context, query, offset_payload, user): """Create a new context instance.""" <|body_0|> def __str__(self): """Debug string for class.""" <|body_1|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Context: """Object representing a inline query search for easier parameter handling.""" def __init__(self, tg_context, query, offset_payload, user): """Create a new context instance.""" self.tg_context = tg_context self.query = query self.tags = get_tags_from_text(query, l...
the_stack_v2_python_sparse
stickerfinder/telegram/inline_query/context.py
arlessweschler/sticker-finder
train
0
d412ec8ddcc4a76fcedf9d8f1cb3534559652fbd
[ "g_circuits, g_parameter_values, g_parameters = self._preprocess(circuits, parameter_values, parameters, self.SUPPORTED_GATES)\nresults = self._run_unique(g_circuits, observables, g_parameter_values, g_parameters, **options)\nreturn self._postprocess(results, circuits, parameter_values, parameters)", "job_circuit...
<|body_start_0|> g_circuits, g_parameter_values, g_parameters = self._preprocess(circuits, parameter_values, parameters, self.SUPPORTED_GATES) results = self._run_unique(g_circuits, observables, g_parameter_values, g_parameters, **options) return self._postprocess(results, circuits, parameter_va...
Compute the gradients of the expectation values by the parameter shift rule [1]. **Reference:** [1] Schuld, M., Bergholm, V., Gogolin, C., Izaac, J., and Killoran, N. Evaluating analytic gradients on quantum hardware, `DOI <https://doi.org/10.1103/PhysRevA.99.032331>`_
ParamShiftEstimatorGradient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ParamShiftEstimatorGradient: """Compute the gradients of the expectation values by the parameter shift rule [1]. **Reference:** [1] Schuld, M., Bergholm, V., Gogolin, C., Izaac, J., and Killoran, N. Evaluating analytic gradients on quantum hardware, `DOI <https://doi.org/10.1103/PhysRevA.99.03233...
stack_v2_sparse_classes_75kplus_train_067612
4,346
permissive
[ { "docstring": "Compute the gradients of the expectation values by the parameter shift rule.", "name": "_run", "signature": "def _run(self, circuits: Sequence[QuantumCircuit], observables: Sequence[BaseOperator | PauliSumOp], parameter_values: Sequence[Sequence[float]], parameters: Sequence[Sequence[Par...
2
stack_v2_sparse_classes_30k_train_010244
Implement the Python class `ParamShiftEstimatorGradient` described below. Class description: Compute the gradients of the expectation values by the parameter shift rule [1]. **Reference:** [1] Schuld, M., Bergholm, V., Gogolin, C., Izaac, J., and Killoran, N. Evaluating analytic gradients on quantum hardware, `DOI <ht...
Implement the Python class `ParamShiftEstimatorGradient` described below. Class description: Compute the gradients of the expectation values by the parameter shift rule [1]. **Reference:** [1] Schuld, M., Bergholm, V., Gogolin, C., Izaac, J., and Killoran, N. Evaluating analytic gradients on quantum hardware, `DOI <ht...
0b51250e219ca303654fc28a318c21366584ccd3
<|skeleton|> class ParamShiftEstimatorGradient: """Compute the gradients of the expectation values by the parameter shift rule [1]. **Reference:** [1] Schuld, M., Bergholm, V., Gogolin, C., Izaac, J., and Killoran, N. Evaluating analytic gradients on quantum hardware, `DOI <https://doi.org/10.1103/PhysRevA.99.03233...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ParamShiftEstimatorGradient: """Compute the gradients of the expectation values by the parameter shift rule [1]. **Reference:** [1] Schuld, M., Bergholm, V., Gogolin, C., Izaac, J., and Killoran, N. Evaluating analytic gradients on quantum hardware, `DOI <https://doi.org/10.1103/PhysRevA.99.032331>`_""" ...
the_stack_v2_python_sparse
qiskit/algorithms/gradients/param_shift/param_shift_estimator_gradient.py
1ucian0/qiskit-terra
train
6
1ca6ffc4d995faa8ae0f9e740058edb53e917779
[ "normalizer = running_statistics.FixedMeanStd(mean, std)\nstrategy = test_utils.create_distribution_strategy(use_tpu=self.primary_device == 'TPU')\nself.assertEqual(strategy.num_replicas_in_sync, 2)\nwith strategy.scope():\n normalizer.init(size)\nreturn (normalizer, strategy)", "dataset = tf.data.Dataset.from...
<|body_start_0|> normalizer = running_statistics.FixedMeanStd(mean, std) strategy = test_utils.create_distribution_strategy(use_tpu=self.primary_device == 'TPU') self.assertEqual(strategy.num_replicas_in_sync, 2) with strategy.scope(): normalizer.init(size) return (no...
FixedMeanStdTest
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FixedMeanStdTest: def _setup_normalizer(self, size, mean, std): """Sets up the input normalizer and a distribution strategy to run.""" <|body_0|> def _update(self, normalizer, strategy, tensor): """Updates the normalization statistics via the strategy.""" <|b...
stack_v2_sparse_classes_75kplus_train_067613
13,061
permissive
[ { "docstring": "Sets up the input normalizer and a distribution strategy to run.", "name": "_setup_normalizer", "signature": "def _setup_normalizer(self, size, mean, std)" }, { "docstring": "Updates the normalization statistics via the strategy.", "name": "_update", "signature": "def _up...
5
null
Implement the Python class `FixedMeanStdTest` described below. Class description: Implement the FixedMeanStdTest class. Method signatures and docstrings: - def _setup_normalizer(self, size, mean, std): Sets up the input normalizer and a distribution strategy to run. - def _update(self, normalizer, strategy, tensor): ...
Implement the Python class `FixedMeanStdTest` described below. Class description: Implement the FixedMeanStdTest class. Method signatures and docstrings: - def _setup_normalizer(self, size, mean, std): Sets up the input normalizer and a distribution strategy to run. - def _update(self, normalizer, strategy, tensor): ...
0e1e0ac9178a670ad1e1463baed92020e88905ec
<|skeleton|> class FixedMeanStdTest: def _setup_normalizer(self, size, mean, std): """Sets up the input normalizer and a distribution strategy to run.""" <|body_0|> def _update(self, normalizer, strategy, tensor): """Updates the normalization statistics via the strategy.""" <|b...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FixedMeanStdTest: def _setup_normalizer(self, size, mean, std): """Sets up the input normalizer and a distribution strategy to run.""" normalizer = running_statistics.FixedMeanStd(mean, std) strategy = test_utils.create_distribution_strategy(use_tpu=self.primary_device == 'TPU') ...
the_stack_v2_python_sparse
agents/policy_gradient/modules/running_statistics_test.py
google-research/seed_rl
train
818
4d2c91807260d1324f2a557c8118c767e6633261
[ "filename_queue = tf.train.string_input_producer(paths)\nreader = tf.TFRecordReader()\n_, serialized_example = reader.read(filename_queue)\nfeatures = tf.parse_single_example(serialized_example, features={'image': tf.FixedLenFeature([], tf.string), 'label': tf.FixedLenFeature([], tf.int64)})\nimage = tf.decode_raw(...
<|body_start_0|> filename_queue = tf.train.string_input_producer(paths) reader = tf.TFRecordReader() _, serialized_example = reader.read(filename_queue) features = tf.parse_single_example(serialized_example, features={'image': tf.FixedLenFeature([], tf.string), 'label': tf.FixedLenFeatur...
DataSetReader
[ "CC-BY-3.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataSetReader: def read_tfrecords(paths: [], data_set_image_size: int): """- Returns labels and images from the TFRecords files. :param data_set_image_size: Image size in the data set. :param paths: List with the paths to the TFRecords files. :return: labels, images""" <|body_0|>...
stack_v2_sparse_classes_75kplus_train_067614
3,695
permissive
[ { "docstring": "- Returns labels and images from the TFRecords files. :param data_set_image_size: Image size in the data set. :param paths: List with the paths to the TFRecords files. :return: labels, images", "name": "read_tfrecords", "signature": "def read_tfrecords(paths: [], data_set_image_size: int...
3
null
Implement the Python class `DataSetReader` described below. Class description: Implement the DataSetReader class. Method signatures and docstrings: - def read_tfrecords(paths: [], data_set_image_size: int): - Returns labels and images from the TFRecords files. :param data_set_image_size: Image size in the data set. :...
Implement the Python class `DataSetReader` described below. Class description: Implement the DataSetReader class. Method signatures and docstrings: - def read_tfrecords(paths: [], data_set_image_size: int): - Returns labels and images from the TFRecords files. :param data_set_image_size: Image size in the data set. :...
138c7fa83e084ccb8f5c2ad8827f1fbb2527c00c
<|skeleton|> class DataSetReader: def read_tfrecords(paths: [], data_set_image_size: int): """- Returns labels and images from the TFRecords files. :param data_set_image_size: Image size in the data set. :param paths: List with the paths to the TFRecords files. :return: labels, images""" <|body_0|>...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DataSetReader: def read_tfrecords(paths: [], data_set_image_size: int): """- Returns labels and images from the TFRecords files. :param data_set_image_size: Image size in the data set. :param paths: List with the paths to the TFRecords files. :return: labels, images""" filename_queue = tf.trai...
the_stack_v2_python_sparse
file_experts/data_set/data_set_reader.py
iliesidaniel/image-classification
train
0
ee2c16e77bae27854b7f286bbcd6490cc65b4467
[ "dict_ql = {}\ndict_qu = {}\ncount = int_fmt % 10\nfor i in range(0, count):\n str_qu = str_quanta[i * 3:i * 3 + 2]\n str_ql = str_quanta[(i + count) * 3:(i + count) * 3 + 2]\n headers = quanta_headers(int_fmt)\n dict_ql[headers[i]] = int(str_ql)\n dict_qu[headers[i]] = int(str_qu)\nreturn (dict_qu, ...
<|body_start_0|> dict_ql = {} dict_qu = {} count = int_fmt % 10 for i in range(0, count): str_qu = str_quanta[i * 3:i * 3 + 2] str_ql = str_quanta[(i + count) * 3:(i + count) * 3 + 2] headers = quanta_headers(int_fmt) dict_ql[headers[i]] = ...
Manages entries of .lin files
PGopherLinConverter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PGopherLinConverter: """Manages entries of .lin files""" def __read_quanta(str_quanta, int_fmt): """convert quanta from .cat to dict returns (dict_upper, dict_lower)""" <|body_0|> def str2line(str_line, int_fmt): """str to Line object""" <|body_1|> <|end...
stack_v2_sparse_classes_75kplus_train_067615
11,597
no_license
[ { "docstring": "convert quanta from .cat to dict returns (dict_upper, dict_lower)", "name": "__read_quanta", "signature": "def __read_quanta(str_quanta, int_fmt)" }, { "docstring": "str to Line object", "name": "str2line", "signature": "def str2line(str_line, int_fmt)" } ]
2
stack_v2_sparse_classes_30k_train_038603
Implement the Python class `PGopherLinConverter` described below. Class description: Manages entries of .lin files Method signatures and docstrings: - def __read_quanta(str_quanta, int_fmt): convert quanta from .cat to dict returns (dict_upper, dict_lower) - def str2line(str_line, int_fmt): str to Line object
Implement the Python class `PGopherLinConverter` described below. Class description: Manages entries of .lin files Method signatures and docstrings: - def __read_quanta(str_quanta, int_fmt): convert quanta from .cat to dict returns (dict_upper, dict_lower) - def str2line(str_line, int_fmt): str to Line object <|skel...
57bda76b211c8efd3bd24bd2895bd57ea855003e
<|skeleton|> class PGopherLinConverter: """Manages entries of .lin files""" def __read_quanta(str_quanta, int_fmt): """convert quanta from .cat to dict returns (dict_upper, dict_lower)""" <|body_0|> def str2line(str_line, int_fmt): """str to Line object""" <|body_1|> <|end...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PGopherLinConverter: """Manages entries of .lin files""" def __read_quanta(str_quanta, int_fmt): """convert quanta from .cat to dict returns (dict_upper, dict_lower)""" dict_ql = {} dict_qu = {} count = int_fmt % 10 for i in range(0, count): str_qu = st...
the_stack_v2_python_sparse
pickett/converters.py
kiraboris/scanner
train
0
e02fc93e1f8e11a252e2220bc27da44260e751ee
[ "self.client = Client()\nself.mechanic = get_sample_mechanic_data()\nself.client.post('/workshop/api/mechanic/signup', self.mechanic, content_type='application/json')\nuser_data = get_sample_user_data()\nself.user = User.objects.create(id=2, email=user_data['email'], number=user_data['number'], password=bcrypt.hash...
<|body_start_0|> self.client = Client() self.mechanic = get_sample_mechanic_data() self.client.post('/workshop/api/mechanic/signup', self.mechanic, content_type='application/json') user_data = get_sample_user_data() self.user = User.objects.create(id=2, email=user_data['email'], ...
contains all the test cases related to merchant Attributes: client: Client object used for testing mechanic: sample mechanic sign up request body user: dummy user object user_auth_headers: Auth headers for dummy user mechanic_auth_headers: Auth headers for dummy mechanic vehicle: dummy vehicle object contact_mechanic_r...
MerchantTestCase
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MerchantTestCase: """contains all the test cases related to merchant Attributes: client: Client object used for testing mechanic: sample mechanic sign up request body user: dummy user object user_auth_headers: Auth headers for dummy user mechanic_auth_headers: Auth headers for dummy mechanic vehi...
stack_v2_sparse_classes_75kplus_train_067616
7,919
permissive
[ { "docstring": "stores a sample request body for mechanic signup creates a dummy mechanic, a dummy user, a dummy vehicle and corresponding auth tokens stores a sample request body for contact mechanic :return: None", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "increases nu...
6
stack_v2_sparse_classes_30k_train_010802
Implement the Python class `MerchantTestCase` described below. Class description: contains all the test cases related to merchant Attributes: client: Client object used for testing mechanic: sample mechanic sign up request body user: dummy user object user_auth_headers: Auth headers for dummy user mechanic_auth_header...
Implement the Python class `MerchantTestCase` described below. Class description: contains all the test cases related to merchant Attributes: client: Client object used for testing mechanic: sample mechanic sign up request body user: dummy user object user_auth_headers: Auth headers for dummy user mechanic_auth_header...
45e98d77b2fef6004dd36c640bd95b25395d0948
<|skeleton|> class MerchantTestCase: """contains all the test cases related to merchant Attributes: client: Client object used for testing mechanic: sample mechanic sign up request body user: dummy user object user_auth_headers: Auth headers for dummy user mechanic_auth_headers: Auth headers for dummy mechanic vehi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MerchantTestCase: """contains all the test cases related to merchant Attributes: client: Client object used for testing mechanic: sample mechanic sign up request body user: dummy user object user_auth_headers: Auth headers for dummy user mechanic_auth_headers: Auth headers for dummy mechanic vehicle: dummy ve...
the_stack_v2_python_sparse
services/workshop/crapi/merchant/tests.py
OWASP/crAPI
train
772
e785c85afa12588ea4d8003148057f66ca8c7497
[ "credentials = authorized_user.Credentials.from_authorized_user_info({'client_id': 'client_id', 'client_secret': 'client_secret', 'refresh_token': 'refresh_token'})\nentity = TestModel(id='foo', credentials=credentials)\nentity.put()\nretrieved = TestModel.get_by_id('foo')\nself.assertIsNotNone(retrieved.credential...
<|body_start_0|> credentials = authorized_user.Credentials.from_authorized_user_info({'client_id': 'client_id', 'client_secret': 'client_secret', 'refresh_token': 'refresh_token'}) entity = TestModel(id='foo', credentials=credentials) entity.put() retrieved = TestModel.get_by_id('foo') ...
Tests for oauth2_util.CredentialsProperty.
CredentialsPropertyTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CredentialsPropertyTest: """Tests for oauth2_util.CredentialsProperty.""" def testStore(self): """Tests that credentials can be stored and retrieved.""" <|body_0|> def testValidate(self): """Tests that the credentials type is validated.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_067617
2,907
permissive
[ { "docstring": "Tests that credentials can be stored and retrieved.", "name": "testStore", "signature": "def testStore(self)" }, { "docstring": "Tests that the credentials type is validated.", "name": "testValidate", "signature": "def testValidate(self)" }, { "docstring": "Tests ...
3
stack_v2_sparse_classes_30k_train_047067
Implement the Python class `CredentialsPropertyTest` described below. Class description: Tests for oauth2_util.CredentialsProperty. Method signatures and docstrings: - def testStore(self): Tests that credentials can be stored and retrieved. - def testValidate(self): Tests that the credentials type is validated. - def...
Implement the Python class `CredentialsPropertyTest` described below. Class description: Tests for oauth2_util.CredentialsProperty. Method signatures and docstrings: - def testStore(self): Tests that credentials can be stored and retrieved. - def testValidate(self): Tests that the credentials type is validated. - def...
5e10bed02089e4cf29ae4d9d67e127f77e8fb3c9
<|skeleton|> class CredentialsPropertyTest: """Tests for oauth2_util.CredentialsProperty.""" def testStore(self): """Tests that credentials can be stored and retrieved.""" <|body_0|> def testValidate(self): """Tests that the credentials type is validated.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CredentialsPropertyTest: """Tests for oauth2_util.CredentialsProperty.""" def testStore(self): """Tests that credentials can be stored and retrieved.""" credentials = authorized_user.Credentials.from_authorized_user_info({'client_id': 'client_id', 'client_secret': 'client_secret', 'refres...
the_stack_v2_python_sparse
multitest_transport/util/oauth2_util_test.py
maksonlee/multitest_transport
train
0
0b55c5d84ee26f11cc18460b2254ad0c99c82f28
[ "self.request.errors.add('body', 'data', \"Can't update lot for tender stage2\")\nself.request.errors.status = 403\nreturn", "self.request.errors.add('body', 'data', \"Can't create lot for tender stage2\")\nself.request.errors.status = 403\nreturn", "self.request.errors.add('body', 'data', \"Can't delete lot fo...
<|body_start_0|> self.request.errors.add('body', 'data', "Can't update lot for tender stage2") self.request.errors.status = 403 return <|end_body_0|> <|body_start_1|> self.request.errors.add('body', 'data', "Can't create lot for tender stage2") self.request.errors.status = 403 ...
TenderStage2EULotResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TenderStage2EULotResource: def patch(self): """Update of lot""" <|body_0|> def collection_post(self): """Add a lot""" <|body_1|> def delete(self): """Lot deleting""" <|body_2|> <|end_skeleton|> <|body_start_0|> self.request.erro...
stack_v2_sparse_classes_75kplus_train_067618
2,757
permissive
[ { "docstring": "Update of lot", "name": "patch", "signature": "def patch(self)" }, { "docstring": "Add a lot", "name": "collection_post", "signature": "def collection_post(self)" }, { "docstring": "Lot deleting", "name": "delete", "signature": "def delete(self)" } ]
3
stack_v2_sparse_classes_30k_train_009946
Implement the Python class `TenderStage2EULotResource` described below. Class description: Implement the TenderStage2EULotResource class. Method signatures and docstrings: - def patch(self): Update of lot - def collection_post(self): Add a lot - def delete(self): Lot deleting
Implement the Python class `TenderStage2EULotResource` described below. Class description: Implement the TenderStage2EULotResource class. Method signatures and docstrings: - def patch(self): Update of lot - def collection_post(self): Add a lot - def delete(self): Lot deleting <|skeleton|> class TenderStage2EULotReso...
fb955c110ceb40ca7b82b11280602145385a017f
<|skeleton|> class TenderStage2EULotResource: def patch(self): """Update of lot""" <|body_0|> def collection_post(self): """Add a lot""" <|body_1|> def delete(self): """Lot deleting""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TenderStage2EULotResource: def patch(self): """Update of lot""" self.request.errors.add('body', 'data', "Can't update lot for tender stage2") self.request.errors.status = 403 return def collection_post(self): """Add a lot""" self.request.errors.add('body', ...
the_stack_v2_python_sparse
openprocurement/tender/competitivedialogue/views/stage2/lot.py
VDigitall/openprocurement.tender.competitivedialogue
train
0
8d6d0e55c271ac7df25c5791d771120863bccd2d
[ "super().__init__()\nself._config_entry = config_entry\nself._entry_id = config_entry.entry_id", "errors = {}\nif user_input is not None:\n return self.async_create_entry(title='', data=user_input)\nreturn self.async_show_form(step_id='init', data_schema=create_schema(self._config_entry, step='init'), errors=e...
<|body_start_0|> super().__init__() self._config_entry = config_entry self._entry_id = config_entry.entry_id <|end_body_0|> <|body_start_1|> errors = {} if user_input is not None: return self.async_create_entry(title='', data=user_input) return self.async_sho...
Changing options flow.
SleepAsAndroidOptionsFlow
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SleepAsAndroidOptionsFlow: """Changing options flow.""" def __init__(self, config_entry): """Initialize options flow.""" <|body_0|> async def async_step_init(self, user_input=None): """Manage the options.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_067619
3,504
no_license
[ { "docstring": "Initialize options flow.", "name": "__init__", "signature": "def __init__(self, config_entry)" }, { "docstring": "Manage the options.", "name": "async_step_init", "signature": "async def async_step_init(self, user_input=None)" } ]
2
stack_v2_sparse_classes_30k_train_034815
Implement the Python class `SleepAsAndroidOptionsFlow` described below. Class description: Changing options flow. Method signatures and docstrings: - def __init__(self, config_entry): Initialize options flow. - async def async_step_init(self, user_input=None): Manage the options.
Implement the Python class `SleepAsAndroidOptionsFlow` described below. Class description: Changing options flow. Method signatures and docstrings: - def __init__(self, config_entry): Initialize options flow. - async def async_step_init(self, user_input=None): Manage the options. <|skeleton|> class SleepAsAndroidOpt...
3c985391265c94c733cf333201c72010c6296900
<|skeleton|> class SleepAsAndroidOptionsFlow: """Changing options flow.""" def __init__(self, config_entry): """Initialize options flow.""" <|body_0|> async def async_step_init(self, user_input=None): """Manage the options.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SleepAsAndroidOptionsFlow: """Changing options flow.""" def __init__(self, config_entry): """Initialize options flow.""" super().__init__() self._config_entry = config_entry self._entry_id = config_entry.entry_id async def async_step_init(self, user_input=None): ...
the_stack_v2_python_sparse
custom_components/sleep_as_android/config_flow.py
SeLLeRoNe/HA-Config
train
80
65af826a38b585370c8030a8852221ba9a78c0aa
[ "N = len(nums)\ntotal = 0\nS = [0]\nfor num in nums:\n total += num\n S.append(total)\nfor i in xrange(0, N - 1, 1):\n for j in xrange(i + 2, N + 1, 1):\n tmp = S[j] - S[i]\n if k == 0 and tmp == 0:\n return True\n elif k != 0 and tmp % k == 0:\n return True\nretu...
<|body_start_0|> N = len(nums) total = 0 S = [0] for num in nums: total += num S.append(total) for i in xrange(0, N - 1, 1): for j in xrange(i + 2, N + 1, 1): tmp = S[j] - S[i] if k == 0 and tmp == 0: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def checkSubarraySum(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool""" <|body_0|> def checkSubarraySum2(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_067620
1,274
no_license
[ { "docstring": ":type nums: List[int] :type k: int :rtype: bool", "name": "checkSubarraySum", "signature": "def checkSubarraySum(self, nums, k)" }, { "docstring": ":type nums: List[int] :type k: int :rtype: bool", "name": "checkSubarraySum2", "signature": "def checkSubarraySum2(self, num...
2
stack_v2_sparse_classes_30k_train_030643
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def checkSubarraySum(self, nums, k): :type nums: List[int] :type k: int :rtype: bool - def checkSubarraySum2(self, nums, k): :type nums: List[int] :type k: int :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def checkSubarraySum(self, nums, k): :type nums: List[int] :type k: int :rtype: bool - def checkSubarraySum2(self, nums, k): :type nums: List[int] :type k: int :rtype: bool <|sk...
70a580603d996d9843cda3c167c6e63c29df6656
<|skeleton|> class Solution: def checkSubarraySum(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool""" <|body_0|> def checkSubarraySum2(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def checkSubarraySum(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool""" N = len(nums) total = 0 S = [0] for num in nums: total += num S.append(total) for i in xrange(0, N - 1, 1): for j in xrange(i...
the_stack_v2_python_sparse
src/code/code_523.py
fanzijian/leet-code-practice
train
1
f87425751fa98f2c33671d5fa3caa80064e6460f
[ "self.s1 = []\nself.s2 = []\nself.front = None", "if not self.s1:\n self.front = x\nself.s1.append(x)", "if not self.s2:\n while self.s1:\n self.s2.append(self.s1.pop())\nreturn self.s2.pop()", "if self.s2:\n return self.s2[-1]\nreturn self.front", "if not self.s1 and (not self.s2):\n ret...
<|body_start_0|> self.s1 = [] self.s2 = [] self.front = None <|end_body_0|> <|body_start_1|> if not self.s1: self.front = x self.s1.append(x) <|end_body_1|> <|body_start_2|> if not self.s2: while self.s1: self.s2.append(self.s1.po...
MyQueue
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyQueue: def __init__(self): """Initialize your data structure here.""" <|body_0|> def push(self, x: int) -> None: """Push element x to the back of queue.""" <|body_1|> def pop(self) -> int: """Removes the element from in front of queue and retur...
stack_v2_sparse_classes_75kplus_train_067621
3,995
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Push element x to the back of queue.", "name": "push", "signature": "def push(self, x: int) -> None" }, { "docstring": "Removes the element from in fron...
5
stack_v2_sparse_classes_30k_test_000086
Implement the Python class `MyQueue` described below. Class description: Implement the MyQueue class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def push(self, x: int) -> None: Push element x to the back of queue. - def pop(self) -> int: Removes the element from in ...
Implement the Python class `MyQueue` described below. Class description: Implement the MyQueue class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def push(self, x: int) -> None: Push element x to the back of queue. - def pop(self) -> int: Removes the element from in ...
2e68822e82df37e8347a7c16616a0a99a8075c3f
<|skeleton|> class MyQueue: def __init__(self): """Initialize your data structure here.""" <|body_0|> def push(self, x: int) -> None: """Push element x to the back of queue.""" <|body_1|> def pop(self) -> int: """Removes the element from in front of queue and retur...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MyQueue: def __init__(self): """Initialize your data structure here.""" self.s1 = [] self.s2 = [] self.front = None def push(self, x: int) -> None: """Push element x to the back of queue.""" if not self.s1: self.front = x self.s1.append(...
the_stack_v2_python_sparse
leet_code/232. 用栈实现队列.py
muyisanshuiliang/python
train
0
e710866c25556a517c642ffd913fdc2cf2a02d67
[ "print('ScreenshotPipeline: process_item')\nencoded_item_url = quote(item['url'])\nscreenshot_url = self.SPLASH_URL.format(encoded_item_url)\nrequest = scrapy.Request(screenshot_url)\ndfd = spider.crawler.engine.download(request, spider)\ndfd.addBoth(self.return_item, item)\nreturn dfd", "print('ScreenshotPipelin...
<|body_start_0|> print('ScreenshotPipeline: process_item') encoded_item_url = quote(item['url']) screenshot_url = self.SPLASH_URL.format(encoded_item_url) request = scrapy.Request(screenshot_url) dfd = spider.crawler.engine.download(request, spider) dfd.addBoth(self.retur...
Pipeline that uses Splash to render screenshot of every Scrapy item. Attributes: SPLASH_URL (TYPE): Description
ScreenshotPipeline
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScreenshotPipeline: """Pipeline that uses Splash to render screenshot of every Scrapy item. Attributes: SPLASH_URL (TYPE): Description""" def process_item(self, item, spider): """Summary Args: item (TYPE): Description spider (TYPE): Description Returns: TYPE: Description""" <...
stack_v2_sparse_classes_75kplus_train_067622
3,297
no_license
[ { "docstring": "Summary Args: item (TYPE): Description spider (TYPE): Description Returns: TYPE: Description", "name": "process_item", "signature": "def process_item(self, item, spider)" }, { "docstring": "Summary Args: response (TYPE): Description item (TYPE): Description Returns: TYPE: Descrip...
2
stack_v2_sparse_classes_30k_train_023536
Implement the Python class `ScreenshotPipeline` described below. Class description: Pipeline that uses Splash to render screenshot of every Scrapy item. Attributes: SPLASH_URL (TYPE): Description Method signatures and docstrings: - def process_item(self, item, spider): Summary Args: item (TYPE): Description spider (T...
Implement the Python class `ScreenshotPipeline` described below. Class description: Pipeline that uses Splash to render screenshot of every Scrapy item. Attributes: SPLASH_URL (TYPE): Description Method signatures and docstrings: - def process_item(self, item, spider): Summary Args: item (TYPE): Description spider (T...
68649c57613591ca0c5a1804d0d7ca618f2ddf40
<|skeleton|> class ScreenshotPipeline: """Pipeline that uses Splash to render screenshot of every Scrapy item. Attributes: SPLASH_URL (TYPE): Description""" def process_item(self, item, spider): """Summary Args: item (TYPE): Description spider (TYPE): Description Returns: TYPE: Description""" <...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ScreenshotPipeline: """Pipeline that uses Splash to render screenshot of every Scrapy item. Attributes: SPLASH_URL (TYPE): Description""" def process_item(self, item, spider): """Summary Args: item (TYPE): Description spider (TYPE): Description Returns: TYPE: Description""" print('Screens...
the_stack_v2_python_sparse
batdongsan_crawler/batdongsan_crawler/pipelines.py
hatttruong/crawler-webpage
train
7
1e9cd7834cc161411638219dec8a3bbb8fab9953
[ "pos_markers = []\npix_markers = []\nfor box in boxes:\n (pt1_w, pt1_h), (pt2_w, pt2_h) = box\n pix_marker = ((pt1_w + pt2_w) // 2, max(pt1_h, pt2_h))\n pix_markers.append(pix_marker)\n pos_marker = np.array(pix_marker).reshape(1, 1, 2).astype('float32')\n pos_marker = cv2.perspectiveTransform(pos_ma...
<|body_start_0|> pos_markers = [] pix_markers = [] for box in boxes: (pt1_w, pt1_h), (pt2_w, pt2_h) = box pix_marker = ((pt1_w + pt2_w) // 2, max(pt1_h, pt2_h)) pix_markers.append(pix_marker) pos_marker = np.array(pix_marker).reshape(1, 1, 2).astyp...
A mixin to calculate distances between detected boxes/pedastrians
SocialDistancingMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SocialDistancingMixin: """A mixin to calculate distances between detected boxes/pedastrians""" def _calculate_distances(boxes, homography): """Calculate a reference marker for each box and calculate bird eye distances between boxes Args: boxes (list): A list of boxes defined as a tup...
stack_v2_sparse_classes_75kplus_train_067623
9,664
permissive
[ { "docstring": "Calculate a reference marker for each box and calculate bird eye distances between boxes Args: boxes (list): A list of boxes defined as a tuple of 2D points. homography (np.array): A 3x3 numpy array. Returns: pix_markers (list): A list of marker coordinates defined as tuples, distances (np.array...
5
stack_v2_sparse_classes_30k_train_003239
Implement the Python class `SocialDistancingMixin` described below. Class description: A mixin to calculate distances between detected boxes/pedastrians Method signatures and docstrings: - def _calculate_distances(boxes, homography): Calculate a reference marker for each box and calculate bird eye distances between b...
Implement the Python class `SocialDistancingMixin` described below. Class description: A mixin to calculate distances between detected boxes/pedastrians Method signatures and docstrings: - def _calculate_distances(boxes, homography): Calculate a reference marker for each box and calculate bird eye distances between b...
2e29ab2d3deb81fd999b74a2f6844c54a836c6d8
<|skeleton|> class SocialDistancingMixin: """A mixin to calculate distances between detected boxes/pedastrians""" def _calculate_distances(boxes, homography): """Calculate a reference marker for each box and calculate bird eye distances between boxes Args: boxes (list): A list of boxes defined as a tup...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SocialDistancingMixin: """A mixin to calculate distances between detected boxes/pedastrians""" def _calculate_distances(boxes, homography): """Calculate a reference marker for each box and calculate bird eye distances between boxes Args: boxes (list): A list of boxes defined as a tuple of 2D poin...
the_stack_v2_python_sparse
service/mixins.py
ai404/esafe-platform
train
0
bf0a30387469fe3617ad31766c28da0c30e6f179
[ "super().__init__(prev_node)\nself.in_var = prev_node.out_var\nself.in_dim = prev_node.out_dim\nself.out_dim = self.in_dim\nself.out_var = Allocation.allocate_var('float', 'x', self.out_dim)", "loops, idxs = LoopNode.create_loops(self.in_var.dim)\nin_var_idx = IndexedVariable(self.in_var)\nout_var_idx = IndexedVa...
<|body_start_0|> super().__init__(prev_node) self.in_var = prev_node.out_var self.in_dim = prev_node.out_dim self.out_dim = self.in_dim self.out_var = Allocation.allocate_var('float', 'x', self.out_dim) <|end_body_0|> <|body_start_1|> loops, idxs = LoopNode.create_loops(...
A Sigmoid node. It must be lowered to be writeable as C code but should not be removed from graph to provide the meta information.
SigmoidNode
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SigmoidNode: """A Sigmoid node. It must be lowered to be writeable as C code but should not be removed from graph to provide the meta information.""" def __init__(self, prev_node): """Initialize the SigmoidNode. :param prev_node:""" <|body_0|> def lowering(self): ...
stack_v2_sparse_classes_75kplus_train_067624
20,388
permissive
[ { "docstring": "Initialize the SigmoidNode. :param prev_node:", "name": "__init__", "signature": "def __init__(self, prev_node)" }, { "docstring": "Create the loops required to express this node in ANSI C code without SIMD. This loop will stay in graph to provide meta information. :return: None....
2
stack_v2_sparse_classes_30k_train_050118
Implement the Python class `SigmoidNode` described below. Class description: A Sigmoid node. It must be lowered to be writeable as C code but should not be removed from graph to provide the meta information. Method signatures and docstrings: - def __init__(self, prev_node): Initialize the SigmoidNode. :param prev_nod...
Implement the Python class `SigmoidNode` described below. Class description: A Sigmoid node. It must be lowered to be writeable as C code but should not be removed from graph to provide the meta information. Method signatures and docstrings: - def __init__(self, prev_node): Initialize the SigmoidNode. :param prev_nod...
987b0efeb56cd150b3a34b672fd5eba05e6d491f
<|skeleton|> class SigmoidNode: """A Sigmoid node. It must be lowered to be writeable as C code but should not be removed from graph to provide the meta information.""" def __init__(self, prev_node): """Initialize the SigmoidNode. :param prev_node:""" <|body_0|> def lowering(self): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SigmoidNode: """A Sigmoid node. It must be lowered to be writeable as C code but should not be removed from graph to provide the meta information.""" def __init__(self, prev_node): """Initialize the SigmoidNode. :param prev_node:""" super().__init__(prev_node) self.in_var = prev_n...
the_stack_v2_python_sparse
nncg/nodes/cnn.py
iml130/nncg
train
34
52ac453229e5cc5dd40e68818aa0f97b355e5f70
[ "self.path_input = path_input\nself.grid_interpolation = grid_interpolation\nself.svd_method = svd_method\nself.ldbg = load_data_bin_gp(path_input=self.path_input)\nself.ldbg.build_difference_mean()\nself.sn_name = self.ldbg.sn_name\nself.wavelength = self.ldbg.wavelength\nif double_average:\n self.diff = self.l...
<|body_start_0|> self.path_input = path_input self.grid_interpolation = grid_interpolation self.svd_method = svd_method self.ldbg = load_data_bin_gp(path_input=self.path_input) self.ldbg.build_difference_mean() self.sn_name = self.ldbg.sn_name self.wavelength = se...
Interpolate snia sed using gaussian process.
gp_sed
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class gp_sed: """Interpolate snia sed using gaussian process.""" def __init__(self, path_input='data_input/', grid_interpolation=np.linspace(-12, 48, 21), svd_method=False, average=True, double_average=True): """Inteporlation of sed with gaussian process. Will interpolate using sugargp and...
stack_v2_sparse_classes_75kplus_train_067625
10,271
no_license
[ { "docstring": "Inteporlation of sed with gaussian process. Will interpolate using sugargp and a squared exponential kernel. It will fit hyperparameters in terms of wavelength by assuming no correlation in wavelength.", "name": "__init__", "signature": "def __init__(self, path_input='data_input/', grid_...
3
stack_v2_sparse_classes_30k_train_035785
Implement the Python class `gp_sed` described below. Class description: Interpolate snia sed using gaussian process. Method signatures and docstrings: - def __init__(self, path_input='data_input/', grid_interpolation=np.linspace(-12, 48, 21), svd_method=False, average=True, double_average=True): Inteporlation of sed ...
Implement the Python class `gp_sed` described below. Class description: Interpolate snia sed using gaussian process. Method signatures and docstrings: - def __init__(self, path_input='data_input/', grid_interpolation=np.linspace(-12, 48, 21), svd_method=False, average=True, double_average=True): Inteporlation of sed ...
acc0a317ab3fe9bdc09112bfa3189175e3778b29
<|skeleton|> class gp_sed: """Interpolate snia sed using gaussian process.""" def __init__(self, path_input='data_input/', grid_interpolation=np.linspace(-12, 48, 21), svd_method=False, average=True, double_average=True): """Inteporlation of sed with gaussian process. Will interpolate using sugargp and...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class gp_sed: """Interpolate snia sed using gaussian process.""" def __init__(self, path_input='data_input/', grid_interpolation=np.linspace(-12, 48, 21), svd_method=False, average=True, double_average=True): """Inteporlation of sed with gaussian process. Will interpolate using sugargp and a squared ex...
the_stack_v2_python_sparse
sugar_training/gaussian_process.py
PFLeget/sugar_training
train
0
1d0a918f7a28391400a1f83e8899989bbe9d5096
[ "self.reqparser = reqparse.RequestParser()\nself.reqparser.add_argument('current_name', required=True, type=str, help='Current theme name required', location=['form', 'json'])\nself.reqparser.add_argument('new_name', required=True, type=str, help='New theme name required', location=['form', 'json'])", "if not get...
<|body_start_0|> self.reqparser = reqparse.RequestParser() self.reqparser.add_argument('current_name', required=True, type=str, help='Current theme name required', location=['form', 'json']) self.reqparser.add_argument('new_name', required=True, type=str, help='New theme name required', location...
Rename an existing Theme
RenameTheme
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RenameTheme: """Rename an existing Theme""" def __init__(self) -> None: """Set required arguments for POST request""" <|body_0|> def post(self) -> ({str: str}, HTTPStatus): """Rename an existing Theme :post_argument current_name: name of SubTheme :post_argument n...
stack_v2_sparse_classes_75kplus_train_067626
2,853
permissive
[ { "docstring": "Set required arguments for POST request", "name": "__init__", "signature": "def __init__(self) -> None" }, { "docstring": "Rename an existing Theme :post_argument current_name: name of SubTheme :post_argument new_name: new name of SubTheme :post_type current_name: str :post_type ...
2
stack_v2_sparse_classes_30k_train_041552
Implement the Python class `RenameTheme` described below. Class description: Rename an existing Theme Method signatures and docstrings: - def __init__(self) -> None: Set required arguments for POST request - def post(self) -> ({str: str}, HTTPStatus): Rename an existing Theme :post_argument current_name: name of SubT...
Implement the Python class `RenameTheme` described below. Class description: Rename an existing Theme Method signatures and docstrings: - def __init__(self) -> None: Set required arguments for POST request - def post(self) -> ({str: str}, HTTPStatus): Rename an existing Theme :post_argument current_name: name of SubT...
5d123691d1f25d0b85e20e4e8293266bf23c9f8a
<|skeleton|> class RenameTheme: """Rename an existing Theme""" def __init__(self) -> None: """Set required arguments for POST request""" <|body_0|> def post(self) -> ({str: str}, HTTPStatus): """Rename an existing Theme :post_argument current_name: name of SubTheme :post_argument n...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RenameTheme: """Rename an existing Theme""" def __init__(self) -> None: """Set required arguments for POST request""" self.reqparser = reqparse.RequestParser() self.reqparser.add_argument('current_name', required=True, type=str, help='Current theme name required', location=['form'...
the_stack_v2_python_sparse
Analytics/resources/themes/rename_theme.py
thanosbnt/SharingCitiesDashboard
train
0
9be488b230958c2ee455b7c4d5ccfc1f609b4d2d
[ "self.uid, self.qid = (uid, qid)\nself.text, self.index = (params[0], None)\nself.candidates, self.weights = (None, None)\nif len(params) > 1:\n self.parse(params[1:])", "for param in params:\n if param.isdigit():\n self.candidates = int(param)\n elif param.replace('.', '').isdigit():\n sel...
<|body_start_0|> self.uid, self.qid = (uid, qid) self.text, self.index = (params[0], None) self.candidates, self.weights = (None, None) if len(params) > 1: self.parse(params[1:]) <|end_body_0|> <|body_start_1|> for param in params: if param.isdigit(): ...
Parses and stores query clause parameters.
Clause
[ "Apache-2.0", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Clause: """Parses and stores query clause parameters.""" def __init__(self, uid, qid, params): """Creates a new query clause. Args: uid: query clause id qid: query id clause is a part of params: query parameters to parse""" <|body_0|> def parse(self, params): """...
stack_v2_sparse_classes_75kplus_train_067627
4,931
permissive
[ { "docstring": "Creates a new query clause. Args: uid: query clause id qid: query id clause is a part of params: query parameters to parse", "name": "__init__", "signature": "def __init__(self, uid, qid, params)" }, { "docstring": "Parses clause parameters into this instance. Args: params: query...
2
null
Implement the Python class `Clause` described below. Class description: Parses and stores query clause parameters. Method signatures and docstrings: - def __init__(self, uid, qid, params): Creates a new query clause. Args: uid: query clause id qid: query id clause is a part of params: query parameters to parse - def ...
Implement the Python class `Clause` described below. Class description: Parses and stores query clause parameters. Method signatures and docstrings: - def __init__(self, uid, qid, params): Creates a new query clause. Args: uid: query clause id qid: query id clause is a part of params: query parameters to parse - def ...
789a4555cb60ee9cdfa69afae5a5236d197e2b07
<|skeleton|> class Clause: """Parses and stores query clause parameters.""" def __init__(self, uid, qid, params): """Creates a new query clause. Args: uid: query clause id qid: query id clause is a part of params: query parameters to parse""" <|body_0|> def parse(self, params): """...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Clause: """Parses and stores query clause parameters.""" def __init__(self, uid, qid, params): """Creates a new query clause. Args: uid: query clause id qid: query id clause is a part of params: query parameters to parse""" self.uid, self.qid = (uid, qid) self.text, self.index = (...
the_stack_v2_python_sparse
src/python/txtai/embeddings/search/scan.py
neuml/txtai
train
4,804
ee2163444009e02b30dd264718be56eeedbe166b
[ "self.num_classes = num_classes\nself.num_shots = num_shots\nself.num_queries = num_queries\nself.shape_x = shape_x\nself.dataset = dataset\nself.batch_size = batch_size\nself.rng = np.random.RandomState(706)", "num_classes = self.num_classes\nnum_shots = self.num_shots\nnum_queries = self.num_queries\nshape_x = ...
<|body_start_0|> self.num_classes = num_classes self.num_shots = num_shots self.num_queries = num_queries self.shape_x = shape_x self.dataset = dataset self.batch_size = batch_size self.rng = np.random.RandomState(706) <|end_body_0|> <|body_start_1|> num_...
DataGenerator
[ "BSD-3-Clause", "MIT", "LicenseRef-scancode-proprietary-license", "Apache-2.0", "CC-BY-NC-4.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataGenerator: def __init__(self, num_classes, num_shots, num_queries, shape_x, dataset, batch_size): """Create episode function Args: num_classes (int): number of support classes, generally called n_way in one-shot literatuer num_shots (int): number of shots per class num_queries (int):...
stack_v2_sparse_classes_75kplus_train_067628
3,834
permissive
[ { "docstring": "Create episode function Args: num_classes (int): number of support classes, generally called n_way in one-shot literatuer num_shots (int): number of shots per class num_queries (int): numper of queries per class. shape_x (tuple): dimension of the input image. dataset(nd_array): nd_array of (clas...
2
stack_v2_sparse_classes_30k_train_048170
Implement the Python class `DataGenerator` described below. Class description: Implement the DataGenerator class. Method signatures and docstrings: - def __init__(self, num_classes, num_shots, num_queries, shape_x, dataset, batch_size): Create episode function Args: num_classes (int): number of support classes, gener...
Implement the Python class `DataGenerator` described below. Class description: Implement the DataGenerator class. Method signatures and docstrings: - def __init__(self, num_classes, num_shots, num_queries, shape_x, dataset, batch_size): Create episode function Args: num_classes (int): number of support classes, gener...
41f71faa6efff7774a76bbd5af3198322a90a6ab
<|skeleton|> class DataGenerator: def __init__(self, num_classes, num_shots, num_queries, shape_x, dataset, batch_size): """Create episode function Args: num_classes (int): number of support classes, generally called n_way in one-shot literatuer num_shots (int): number of shots per class num_queries (int):...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DataGenerator: def __init__(self, num_classes, num_shots, num_queries, shape_x, dataset, batch_size): """Create episode function Args: num_classes (int): number of support classes, generally called n_way in one-shot literatuer num_shots (int): number of shots per class num_queries (int): numper of que...
the_stack_v2_python_sparse
meta-learning/maml/data_generator_maml.py
sony/nnabla-examples
train
308
50018e0589ac31dfd781fb7d6a81e9629900a6c1
[ "self.form = form\nif form == 'r':\n self.uR = data_tuple\nelif form == 'rs':\n self.uR = data_tuple[0]\n self.uS = data_tuple[1]\nelif form == 'ave':\n self.uR = data_tuple[0]\n self.W = self.calc_W(data_tuple[0], data_tuple[1], data_tuple[2])", "n_var = len(times)\nN_W = len(u[0])\nir = zeros(n_v...
<|body_start_0|> self.form = form if form == 'r': self.uR = data_tuple elif form == 'rs': self.uR = data_tuple[0] self.uS = data_tuple[1] elif form == 'ave': self.uR = data_tuple[0] self.W = self.calc_W(data_tuple[0], data_tuple...
Allow users to create an object containing information of a covariates uncertainty values and form :Attributes: :form: str specifics correlation form of uncertainty, can have values: > "r" - random form > "rs" - random + systematic form > "ave" - averaging form + additional attribute/s containing uncertainty data depen...
CorrelForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CorrelForm: """Allow users to create an object containing information of a covariates uncertainty values and form :Attributes: :form: str specifics correlation form of uncertainty, can have values: > "r" - random form > "rs" - random + systematic form > "ave" - averaging form + additional attribu...
stack_v2_sparse_classes_75kplus_train_067629
6,145
no_license
[ { "docstring": "Take user input covariate uncertainty correlation form and data and apply as attributes of the class :param form: str user specifies correlation form of covariate uncertainty (specified in class description) :param data_tuple: user specifies uncertainty values, structure depends on correlation f...
3
stack_v2_sparse_classes_30k_train_053602
Implement the Python class `CorrelForm` described below. Class description: Allow users to create an object containing information of a covariates uncertainty values and form :Attributes: :form: str specifics correlation form of uncertainty, can have values: > "r" - random form > "rs" - random + systematic form > "ave...
Implement the Python class `CorrelForm` described below. Class description: Allow users to create an object containing information of a covariates uncertainty values and form :Attributes: :form: str specifics correlation form of uncertainty, can have values: > "r" - random form > "rs" - random + systematic form > "ave...
31b8bd5a0da8c6fc4a31453cf7801fcca25d4951
<|skeleton|> class CorrelForm: """Allow users to create an object containing information of a covariates uncertainty values and form :Attributes: :form: str specifics correlation form of uncertainty, can have values: > "r" - random form > "rs" - random + systematic form > "ave" - averaging form + additional attribu...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CorrelForm: """Allow users to create an object containing information of a covariates uncertainty values and form :Attributes: :form: str specifics correlation form of uncertainty, can have values: > "r" - random form > "rs" - random + systematic form > "ave" - averaging form + additional attribute/s containi...
the_stack_v2_python_sparse
src/main/harmonisation_diagnostics/src/main/correl_forms.py
gerritholl/Harmonisation
train
0
6790bf1ac068967fa0b35fd8143b7bffc436e685
[ "if self.getImage():\n if not 'scale' in kwargs:\n kwargs['scale'] = self.getImage_scale() or 'normal'\n return self.getWrappedField('image').tag(self, **kwargs)\nreturn None", "if name.startswith('image'):\n field = self.getField('image')\n image = None\n if name == 'image':\n image ...
<|body_start_0|> if self.getImage(): if not 'scale' in kwargs: kwargs['scale'] = self.getImage_scale() or 'normal' return self.getWrappedField('image').tag(self, **kwargs) return None <|end_body_0|> <|body_start_1|> if name.startswith('image'): ...
A very simple paragraph inside a chapter
SimpleParagraph
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleParagraph: """A very simple paragraph inside a chapter""" def tag(self, **kwargs): """Generates an image tag using the api of the ImageField. We use it here to provide a convenient way to display thumbnail and also to fit the summary_view requirement""" <|body_0|> ...
stack_v2_sparse_classes_75kplus_train_067630
2,070
no_license
[ { "docstring": "Generates an image tag using the api of the ImageField. We use it here to provide a convenient way to display thumbnail and also to fit the summary_view requirement", "name": "tag", "signature": "def tag(self, **kwargs)" }, { "docstring": "Transparent access to image scales", ...
2
stack_v2_sparse_classes_30k_val_001925
Implement the Python class `SimpleParagraph` described below. Class description: A very simple paragraph inside a chapter Method signatures and docstrings: - def tag(self, **kwargs): Generates an image tag using the api of the ImageField. We use it here to provide a convenient way to display thumbnail and also to fit...
Implement the Python class `SimpleParagraph` described below. Class description: A very simple paragraph inside a chapter Method signatures and docstrings: - def tag(self, **kwargs): Generates an image tag using the api of the ImageField. We use it here to provide a convenient way to display thumbnail and also to fit...
d505267bb4a709166f2c2ecceea2f09f610a7c5d
<|skeleton|> class SimpleParagraph: """A very simple paragraph inside a chapter""" def tag(self, **kwargs): """Generates an image tag using the api of the ImageField. We use it here to provide a convenient way to display thumbnail and also to fit the summary_view requirement""" <|body_0|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SimpleParagraph: """A very simple paragraph inside a chapter""" def tag(self, **kwargs): """Generates an image tag using the api of the ImageField. We use it here to provide a convenient way to display thumbnail and also to fit the summary_view requirement""" if self.getImage(): ...
the_stack_v2_python_sparse
sd/app/contents/paragraphs.py
trollfot/sd.app
train
0
f851fd3482dc59d93a51352ea545290cf26595b5
[ "self.application_id = application_id\nself.application_key = application_key\nself.azure_type = azure_type\nself.domain_name = domain_name\nself.region = region\nself.subscription_id = subscription_id\nself.subscription_type = subscription_type\nself.tenant_id = tenant_id", "if dictionary is None:\n return No...
<|body_start_0|> self.application_id = application_id self.application_key = application_key self.azure_type = azure_type self.domain_name = domain_name self.region = region self.subscription_id = subscription_id self.subscription_type = subscription_type ...
Implementation of the 'AzureCredentials' model. Specifies the credentials to authenticate with Azure Cloud Platform. Attributes: application_id (string): Specifies Application Id of the active directory of Azure account. application_key (string): Specifies Application key of the active directory of Azure account. azure...
AzureCredentials
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AzureCredentials: """Implementation of the 'AzureCredentials' model. Specifies the credentials to authenticate with Azure Cloud Platform. Attributes: application_id (string): Specifies Application Id of the active directory of Azure account. application_key (string): Specifies Application key of ...
stack_v2_sparse_classes_75kplus_train_067631
5,383
permissive
[ { "docstring": "Constructor for the AzureCredentials class", "name": "__init__", "signature": "def __init__(self, application_id=None, application_key=None, azure_type=None, domain_name=None, region=None, subscription_id=None, subscription_type=None, tenant_id=None)" }, { "docstring": "Creates a...
2
null
Implement the Python class `AzureCredentials` described below. Class description: Implementation of the 'AzureCredentials' model. Specifies the credentials to authenticate with Azure Cloud Platform. Attributes: application_id (string): Specifies Application Id of the active directory of Azure account. application_key ...
Implement the Python class `AzureCredentials` described below. Class description: Implementation of the 'AzureCredentials' model. Specifies the credentials to authenticate with Azure Cloud Platform. Attributes: application_id (string): Specifies Application Id of the active directory of Azure account. application_key ...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class AzureCredentials: """Implementation of the 'AzureCredentials' model. Specifies the credentials to authenticate with Azure Cloud Platform. Attributes: application_id (string): Specifies Application Id of the active directory of Azure account. application_key (string): Specifies Application key of ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AzureCredentials: """Implementation of the 'AzureCredentials' model. Specifies the credentials to authenticate with Azure Cloud Platform. Attributes: application_id (string): Specifies Application Id of the active directory of Azure account. application_key (string): Specifies Application key of the active di...
the_stack_v2_python_sparse
cohesity_management_sdk/models/azure_credentials.py
cohesity/management-sdk-python
train
24
ded52555f12874d113bb9d60b0eb20395ef4820d
[ "self.minHeap = []\nself.k = k\nif not nums:\n return\nfor i in range(k):\n if self.minHeap and len(self.minHeap) >= k:\n heapq.heappop(self.minHeap)\n if len(nums) > i:\n heapq.heappush(self.minHeap, nums[i])\n else:\n return\nfor i in range(k, len(nums)):\n if nums[i] > self.mi...
<|body_start_0|> self.minHeap = [] self.k = k if not nums: return for i in range(k): if self.minHeap and len(self.minHeap) >= k: heapq.heappop(self.minHeap) if len(nums) > i: heapq.heappush(self.minHeap, nums[i]) ...
KthLargest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.minHeap = [] self.k = k if not nums: ...
stack_v2_sparse_classes_75kplus_train_067632
1,191
permissive
[ { "docstring": ":type k: int :type nums: List[int]", "name": "__init__", "signature": "def __init__(self, k, nums)" }, { "docstring": ":type val: int :rtype: int", "name": "add", "signature": "def add(self, val)" } ]
2
stack_v2_sparse_classes_30k_test_001327
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int <|skeleton|> class KthLargest: def __init__(self, k, nu...
20ae1a048eddbc9a32c819cf61258e2b57572f05
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" self.minHeap = [] self.k = k if not nums: return for i in range(k): if self.minHeap and len(self.minHeap) >= k: heapq.heappop(self.minHeap) ...
the_stack_v2_python_sparse
leetcode.com/python/703_Kth_Largest_Element_in_a_Stream.py
partho-maple/coding-interview-gym
train
862
34725e46b81bebc569953c20c9ab09eedc7576e0
[ "self.name = name\nself.subnet = subnet\nself.appliance_ip = appliance_ip\nself.vpn_nat_subnet = vpn_nat_subnet\nself.dhcp_handling = dhcp_handling\nself.dhcp_relay_server_ips = dhcp_relay_server_ips\nself.dhcp_lease_time = dhcp_lease_time\nself.dhcp_boot_options_enabled = dhcp_boot_options_enabled\nself.dhcp_boot_...
<|body_start_0|> self.name = name self.subnet = subnet self.appliance_ip = appliance_ip self.vpn_nat_subnet = vpn_nat_subnet self.dhcp_handling = dhcp_handling self.dhcp_relay_server_ips = dhcp_relay_server_ips self.dhcp_lease_time = dhcp_lease_time self.d...
Implementation of the 'updateNetworkVlan' model. TODO: type model description here. Attributes: name (string): The name of the VLAN subnet (string): The subnet of the VLAN appliance_ip (string): The local IP of the appliance on the VLAN vpn_nat_subnet (string): The translated VPN subnet if VPN and VPN subnet translatio...
UpdateNetworkVlanModel
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateNetworkVlanModel: """Implementation of the 'updateNetworkVlan' model. TODO: type model description here. Attributes: name (string): The name of the VLAN subnet (string): The subnet of the VLAN appliance_ip (string): The local IP of the appliance on the VLAN vpn_nat_subnet (string): The tran...
stack_v2_sparse_classes_75kplus_train_067633
7,095
permissive
[ { "docstring": "Constructor for the UpdateNetworkVlanModel class", "name": "__init__", "signature": "def __init__(self, name=None, subnet=None, appliance_ip=None, vpn_nat_subnet=None, dhcp_handling=None, dhcp_relay_server_ips=None, dhcp_lease_time=None, dhcp_boot_options_enabled=None, dhcp_boot_next_ser...
2
stack_v2_sparse_classes_30k_val_001086
Implement the Python class `UpdateNetworkVlanModel` described below. Class description: Implementation of the 'updateNetworkVlan' model. TODO: type model description here. Attributes: name (string): The name of the VLAN subnet (string): The subnet of the VLAN appliance_ip (string): The local IP of the appliance on the...
Implement the Python class `UpdateNetworkVlanModel` described below. Class description: Implementation of the 'updateNetworkVlan' model. TODO: type model description here. Attributes: name (string): The name of the VLAN subnet (string): The subnet of the VLAN appliance_ip (string): The local IP of the appliance on the...
9894089eb013318243ae48869cc5130eb37f80c0
<|skeleton|> class UpdateNetworkVlanModel: """Implementation of the 'updateNetworkVlan' model. TODO: type model description here. Attributes: name (string): The name of the VLAN subnet (string): The subnet of the VLAN appliance_ip (string): The local IP of the appliance on the VLAN vpn_nat_subnet (string): The tran...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UpdateNetworkVlanModel: """Implementation of the 'updateNetworkVlan' model. TODO: type model description here. Attributes: name (string): The name of the VLAN subnet (string): The subnet of the VLAN appliance_ip (string): The local IP of the appliance on the VLAN vpn_nat_subnet (string): The translated VPN su...
the_stack_v2_python_sparse
meraki_sdk/models/update_network_vlan_model.py
RaulCatalano/meraki-python-sdk
train
1
c2f251a1be2fe7ad385aa44f93ff959f89e19f39
[ "args = parser.parse_args()\nrole = args.get('role')\nusername = args.get('username')\nusers_df = df\nif role:\n users_df = users_df[users_df['role'] == role]\nif username:\n users_df = users_df[users_df['username'] == username]\njson_str = users_df.to_json(orient='index')\nds = json.loads(json_str)\nret = []...
<|body_start_0|> args = parser.parse_args() role = args.get('role') username = args.get('username') users_df = df if role: users_df = users_df[users_df['role'] == role] if username: users_df = users_df[users_df['username'] == username] json...
Users
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Users: def get(self): """Returns a list of users""" <|body_0|> def post(self): """Creates a new user""" <|body_1|> <|end_skeleton|> <|body_start_0|> args = parser.parse_args() role = args.get('role') username = args.get('username') ...
stack_v2_sparse_classes_75kplus_train_067634
8,237
no_license
[ { "docstring": "Returns a list of users", "name": "get", "signature": "def get(self)" }, { "docstring": "Creates a new user", "name": "post", "signature": "def post(self)" } ]
2
null
Implement the Python class `Users` described below. Class description: Implement the Users class. Method signatures and docstrings: - def get(self): Returns a list of users - def post(self): Creates a new user
Implement the Python class `Users` described below. Class description: Implement the Users class. Method signatures and docstrings: - def get(self): Returns a list of users - def post(self): Creates a new user <|skeleton|> class Users: def get(self): """Returns a list of users""" <|body_0|> ...
703f0b132fe11ec343cbe999322927bc2036702d
<|skeleton|> class Users: def get(self): """Returns a list of users""" <|body_0|> def post(self): """Creates a new user""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Users: def get(self): """Returns a list of users""" args = parser.parse_args() role = args.get('role') username = args.get('username') users_df = df if role: users_df = users_df[users_df['role'] == role] if username: users_df = us...
the_stack_v2_python_sparse
API/users/users.py
pingchoy/Sydney-Suburbs-Information-API
train
0
33c5f28443948561a104e84f9b587988a9c1aa23
[ "user_id = request._request.uid\nwhich_model = Answer if request.data.get('type', '') == 'answer' else QAComment\nwhich_object = which_model.objects.filter(pk=request.data.get('id', None)).first()\nif not which_object:\n return self.error(errorcode.MSG_NO_DATA, errorcode.NO_DATA)\nvalue = request.data.get('value...
<|body_start_0|> user_id = request._request.uid which_model = Answer if request.data.get('type', '') == 'answer' else QAComment which_object = which_model.objects.filter(pk=request.data.get('id', None)).first() if not which_object: return self.error(errorcode.MSG_NO_DATA, err...
VoteView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VoteView: def post(self, request): """对回答、问答评论进行投票或者修改已有的投票""" <|body_0|> def delete(self, request): """撤销投票""" <|body_1|> <|end_skeleton|> <|body_start_0|> user_id = request._request.uid which_model = Answer if request.data.get('type', '') ...
stack_v2_sparse_classes_75kplus_train_067635
19,130
no_license
[ { "docstring": "对回答、问答评论进行投票或者修改已有的投票", "name": "post", "signature": "def post(self, request)" }, { "docstring": "撤销投票", "name": "delete", "signature": "def delete(self, request)" } ]
2
null
Implement the Python class `VoteView` described below. Class description: Implement the VoteView class. Method signatures and docstrings: - def post(self, request): 对回答、问答评论进行投票或者修改已有的投票 - def delete(self, request): 撤销投票
Implement the Python class `VoteView` described below. Class description: Implement the VoteView class. Method signatures and docstrings: - def post(self, request): 对回答、问答评论进行投票或者修改已有的投票 - def delete(self, request): 撤销投票 <|skeleton|> class VoteView: def post(self, request): """对回答、问答评论进行投票或者修改已有的投票""" ...
6a68fb207f43e5ed65299cc08535b35d5e934ead
<|skeleton|> class VoteView: def post(self, request): """对回答、问答评论进行投票或者修改已有的投票""" <|body_0|> def delete(self, request): """撤销投票""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VoteView: def post(self, request): """对回答、问答评论进行投票或者修改已有的投票""" user_id = request._request.uid which_model = Answer if request.data.get('type', '') == 'answer' else QAComment which_object = which_model.objects.filter(pk=request.data.get('id', None)).first() if not which_...
the_stack_v2_python_sparse
apps/questions/views.py
Slowhalfframe/fanyijiang-API
train
0
53f8b4e2d4f91f8c63931242138d7bca69b6a5ed
[ "dQp_x = np.atleast_1d(dQp_x)\ndQp_y = np.atleast_1d(dQp_y)\nself.calc_detuning_x = self._make_calc_detuning(dQp_x)\nself.calc_detuning_y = self._make_calc_detuning(dQp_y)", "dQ_x = self.calc_detuning_x(beam.dp)\ndQ_y = self.calc_detuning_y(beam.dp)\nreturn (dQ_x, dQ_y)", "order = len(Qp)\ncoeffs = [Qp[i] / flo...
<|body_start_0|> dQp_x = np.atleast_1d(dQp_x) dQp_y = np.atleast_1d(dQp_y) self.calc_detuning_x = self._make_calc_detuning(dQp_x) self.calc_detuning_y = self._make_calc_detuning(dQp_y) <|end_body_0|> <|body_start_1|> dQ_x = self.calc_detuning_x(beam.dp) dQ_y = self.calc_...
Detuning object for a segment of the accelerator ring to describe the detuning introduced by chromaticity effects.
ChromaticitySegment
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChromaticitySegment: """Detuning object for a segment of the accelerator ring to describe the detuning introduced by chromaticity effects.""" def __init__(self, dQp_x, dQp_y): """Return an instance of a ChromaticitySegment. The dQp_{x,y} denote resp. scalars / lists (or tuples, numpy...
stack_v2_sparse_classes_75kplus_train_067636
12,981
permissive
[ { "docstring": "Return an instance of a ChromaticitySegment. The dQp_{x,y} denote resp. scalars / lists (or tuples, numpy arrays) containing first, second, third, ... order chromaticity coefficients scaled to the relative bare phase advance.", "name": "__init__", "signature": "def __init__(self, dQp_x, ...
3
null
Implement the Python class `ChromaticitySegment` described below. Class description: Detuning object for a segment of the accelerator ring to describe the detuning introduced by chromaticity effects. Method signatures and docstrings: - def __init__(self, dQp_x, dQp_y): Return an instance of a ChromaticitySegment. The...
Implement the Python class `ChromaticitySegment` described below. Class description: Detuning object for a segment of the accelerator ring to describe the detuning introduced by chromaticity effects. Method signatures and docstrings: - def __init__(self, dQp_x, dQp_y): Return an instance of a ChromaticitySegment. The...
b238bf3fbea02fcfaf8795ee54cc0e3134de477a
<|skeleton|> class ChromaticitySegment: """Detuning object for a segment of the accelerator ring to describe the detuning introduced by chromaticity effects.""" def __init__(self, dQp_x, dQp_y): """Return an instance of a ChromaticitySegment. The dQp_{x,y} denote resp. scalars / lists (or tuples, numpy...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ChromaticitySegment: """Detuning object for a segment of the accelerator ring to describe the detuning introduced by chromaticity effects.""" def __init__(self, dQp_x, dQp_y): """Return an instance of a ChromaticitySegment. The dQp_{x,y} denote resp. scalars / lists (or tuples, numpy arrays) cont...
the_stack_v2_python_sparse
PyHEADTAIL/trackers/detuners.py
PyCOMPLETE/PyHEADTAIL
train
39
e2e62781b2e18105e9f03d7aaa41e4f329819820
[ "super().__init__()\nnum_grad_steps = params.num_grad_steps\nnum_resblocks = params.num_resblocks\nnum_features = params.num_features\nkernel_size = params.kernel_size\ndrop_prob = params.drop_prob\ncircular_pad = params.circular_pad\nfix_step_size = params.fix_step_size\nshare_weights = params.share_weights\nself....
<|body_start_0|> super().__init__() num_grad_steps = params.num_grad_steps num_resblocks = params.num_resblocks num_features = params.num_features kernel_size = params.kernel_size drop_prob = params.drop_prob circular_pad = params.circular_pad fix_step_siz...
PyTorch implementation of Unrolled Compressed Sensing. Implementation is based on: CM Sandino, et al. "DL-ESPIRiT: Accelerating 2D cardiac cine beyond compressed sensing" arXiv:1911.05845 [eess.SP]
UnrolledModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UnrolledModel: """PyTorch implementation of Unrolled Compressed Sensing. Implementation is based on: CM Sandino, et al. "DL-ESPIRiT: Accelerating 2D cardiac cine beyond compressed sensing" arXiv:1911.05845 [eess.SP]""" def __init__(self, params): """Args: params (dict): Dictionary co...
stack_v2_sparse_classes_75kplus_train_067637
3,758
no_license
[ { "docstring": "Args: params (dict): Dictionary containing network parameters", "name": "__init__", "signature": "def __init__(self, params)" }, { "docstring": "Args: kspace (torch.Tensor): Input tensor of shape [batch_size, height, width, time, num_coils, 2] maps (torch.Tensor): Input tensor of...
2
stack_v2_sparse_classes_30k_train_005392
Implement the Python class `UnrolledModel` described below. Class description: PyTorch implementation of Unrolled Compressed Sensing. Implementation is based on: CM Sandino, et al. "DL-ESPIRiT: Accelerating 2D cardiac cine beyond compressed sensing" arXiv:1911.05845 [eess.SP] Method signatures and docstrings: - def _...
Implement the Python class `UnrolledModel` described below. Class description: PyTorch implementation of Unrolled Compressed Sensing. Implementation is based on: CM Sandino, et al. "DL-ESPIRiT: Accelerating 2D cardiac cine beyond compressed sensing" arXiv:1911.05845 [eess.SP] Method signatures and docstrings: - def _...
2e5b7ff7370e980c015d52465a05c37b8b28d291
<|skeleton|> class UnrolledModel: """PyTorch implementation of Unrolled Compressed Sensing. Implementation is based on: CM Sandino, et al. "DL-ESPIRiT: Accelerating 2D cardiac cine beyond compressed sensing" arXiv:1911.05845 [eess.SP]""" def __init__(self, params): """Args: params (dict): Dictionary co...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UnrolledModel: """PyTorch implementation of Unrolled Compressed Sensing. Implementation is based on: CM Sandino, et al. "DL-ESPIRiT: Accelerating 2D cardiac cine beyond compressed sensing" arXiv:1911.05845 [eess.SP]""" def __init__(self, params): """Args: params (dict): Dictionary containing netw...
the_stack_v2_python_sparse
models/DCSNet/unrolled3D.py
mikgroup/DCSNet
train
1
e47bfa7c393f7986728d05fc668c133b54a675c6
[ "if option_dict is None:\n return None\noption_dict.update(kwargs)\nlogger.info(f'create {cls.__name__} from dict')\nreturn cls(**option_dict)", "if option_file is None:\n return None\noption_dict = load_yaml(option_file)\noption_dict.update(kwargs)\nlogger.info(f'create {cls.__name__} from file {option_fil...
<|body_start_0|> if option_dict is None: return None option_dict.update(kwargs) logger.info(f'create {cls.__name__} from dict') return cls(**option_dict) <|end_body_0|> <|body_start_1|> if option_file is None: return None option_dict = load_yaml(o...
_Base
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _Base: def from_dict(cls: Type[T], option_dict: dict, **kwargs) -> T: """Build option from a dict of arguments :param option_dict: Dict of arguments :param kwargs: extra keyword arguments :return: T instance""" <|body_0|> def from_file(cls: Type[T], option_file: str, **kwarg...
stack_v2_sparse_classes_75kplus_train_067638
2,323
no_license
[ { "docstring": "Build option from a dict of arguments :param option_dict: Dict of arguments :param kwargs: extra keyword arguments :return: T instance", "name": "from_dict", "signature": "def from_dict(cls: Type[T], option_dict: dict, **kwargs) -> T" }, { "docstring": "Build option from a yaml f...
2
stack_v2_sparse_classes_30k_train_030169
Implement the Python class `_Base` described below. Class description: Implement the _Base class. Method signatures and docstrings: - def from_dict(cls: Type[T], option_dict: dict, **kwargs) -> T: Build option from a dict of arguments :param option_dict: Dict of arguments :param kwargs: extra keyword arguments :retur...
Implement the Python class `_Base` described below. Class description: Implement the _Base class. Method signatures and docstrings: - def from_dict(cls: Type[T], option_dict: dict, **kwargs) -> T: Build option from a dict of arguments :param option_dict: Dict of arguments :param kwargs: extra keyword arguments :retur...
c9c2e32b484687ef5b110af3dd39f86ecfcb5337
<|skeleton|> class _Base: def from_dict(cls: Type[T], option_dict: dict, **kwargs) -> T: """Build option from a dict of arguments :param option_dict: Dict of arguments :param kwargs: extra keyword arguments :return: T instance""" <|body_0|> def from_file(cls: Type[T], option_file: str, **kwarg...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class _Base: def from_dict(cls: Type[T], option_dict: dict, **kwargs) -> T: """Build option from a dict of arguments :param option_dict: Dict of arguments :param kwargs: extra keyword arguments :return: T instance""" if option_dict is None: return None option_dict.update(kwargs) ...
the_stack_v2_python_sparse
src/pytorch_helper/settings/options/base.py
Aaronswei/BEVNet
train
0
7392fa97ce9e3303a318008b1a56948c22613bac
[ "dp = [[[0 for _ in range(3)] for _ in range(2)] for _ in range(n + 1)]\ndp[1][0][0] = 1\ndp[1][0][1] = 1\ndp[1][0][2] = 0\ndp[1][1][0] = 1\ndp[1][1][1] = 0\ndp[1][1][2] = 0\nmod = 10 ** 9 + 7\nfor i in range(2, n + 1):\n dp[i][0][0] = (dp[i - 1][0][0] + dp[i - 1][0][1] + dp[i - 1][0][2]) % mod\n dp[i][0][1] ...
<|body_start_0|> dp = [[[0 for _ in range(3)] for _ in range(2)] for _ in range(n + 1)] dp[1][0][0] = 1 dp[1][0][1] = 1 dp[1][0][2] = 0 dp[1][1][0] = 1 dp[1][1][1] = 0 dp[1][1][2] = 0 mod = 10 ** 9 + 7 for i in range(2, n + 1): dp[i][0]...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def checkRecord(self, n: int) -> int: """动态规划, dp[i][j][k] i 表示第i个字符,j 表示 A出现的次数, k表示L连续出现的次数 合法状态 1. 没有出现过A,且前2次没有出现L 2. 没有出现过A,且最近一次是L 3. 没有出现过A,且最近两次是L 4. 出现过A,且前2次没有出现L 5. 出现过A,且最近一次是L 6. 出现过A,且最近两次是L :param n: :return:""" <|body_0|> def checkRecord1(self, n: i...
stack_v2_sparse_classes_75kplus_train_067639
3,117
no_license
[ { "docstring": "动态规划, dp[i][j][k] i 表示第i个字符,j 表示 A出现的次数, k表示L连续出现的次数 合法状态 1. 没有出现过A,且前2次没有出现L 2. 没有出现过A,且最近一次是L 3. 没有出现过A,且最近两次是L 4. 出现过A,且前2次没有出现L 5. 出现过A,且最近一次是L 6. 出现过A,且最近两次是L :param n: :return:", "name": "checkRecord", "signature": "def checkRecord(self, n: int) -> int" }, { "docstring": "空...
2
stack_v2_sparse_classes_30k_train_046081
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def checkRecord(self, n: int) -> int: 动态规划, dp[i][j][k] i 表示第i个字符,j 表示 A出现的次数, k表示L连续出现的次数 合法状态 1. 没有出现过A,且前2次没有出现L 2. 没有出现过A,且最近一次是L 3. 没有出现过A,且最近两次是L 4. 出现过A,且前2次没有出现L 5. 出现过A,...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def checkRecord(self, n: int) -> int: 动态规划, dp[i][j][k] i 表示第i个字符,j 表示 A出现的次数, k表示L连续出现的次数 合法状态 1. 没有出现过A,且前2次没有出现L 2. 没有出现过A,且最近一次是L 3. 没有出现过A,且最近两次是L 4. 出现过A,且前2次没有出现L 5. 出现过A,...
9acba92695c06406f12f997a720bfe1deb9464a8
<|skeleton|> class Solution: def checkRecord(self, n: int) -> int: """动态规划, dp[i][j][k] i 表示第i个字符,j 表示 A出现的次数, k表示L连续出现的次数 合法状态 1. 没有出现过A,且前2次没有出现L 2. 没有出现过A,且最近一次是L 3. 没有出现过A,且最近两次是L 4. 出现过A,且前2次没有出现L 5. 出现过A,且最近一次是L 6. 出现过A,且最近两次是L :param n: :return:""" <|body_0|> def checkRecord1(self, n: i...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def checkRecord(self, n: int) -> int: """动态规划, dp[i][j][k] i 表示第i个字符,j 表示 A出现的次数, k表示L连续出现的次数 合法状态 1. 没有出现过A,且前2次没有出现L 2. 没有出现过A,且最近一次是L 3. 没有出现过A,且最近两次是L 4. 出现过A,且前2次没有出现L 5. 出现过A,且最近一次是L 6. 出现过A,且最近两次是L :param n: :return:""" dp = [[[0 for _ in range(3)] for _ in range(2)] for _ in ...
the_stack_v2_python_sparse
datastructure/dp_exercise/CheckRecord.py
yinhuax/leet_code
train
0
a643bf4325bc53edc7d006664416e43ca94e44d7
[ "for t in threads:\n t.start()\nfor t in threads:\n t.join()", "assert self.sess is not None\nwith self.sess.graph.as_default():\n f()" ]
<|body_start_0|> for t in threads: t.start() for t in threads: t.join() <|end_body_0|> <|body_start_1|> assert self.sess is not None with self.sess.graph.as_default(): f() <|end_body_1|>
Abstract agent which can run the main process in several python threads. Allows for a standardized way of exiting cleanly, without losing any data at Ctrl+C
ThreadedAgent
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ThreadedAgent: """Abstract agent which can run the main process in several python threads. Allows for a standardized way of exiting cleanly, without losing any data at Ctrl+C""" def _run_threads(self, threads): """Run `threads` Args: threads: list of threads to start and join""" ...
stack_v2_sparse_classes_75kplus_train_067640
4,697
permissive
[ { "docstring": "Run `threads` Args: threads: list of threads to start and join", "name": "_run_threads", "signature": "def _run_threads(self, threads)" }, { "docstring": "Share the default graph over threads", "name": "_thread", "signature": "def _thread(self, f)" } ]
2
stack_v2_sparse_classes_30k_test_000456
Implement the Python class `ThreadedAgent` described below. Class description: Abstract agent which can run the main process in several python threads. Allows for a standardized way of exiting cleanly, without losing any data at Ctrl+C Method signatures and docstrings: - def _run_threads(self, threads): Run `threads`...
Implement the Python class `ThreadedAgent` described below. Class description: Abstract agent which can run the main process in several python threads. Allows for a standardized way of exiting cleanly, without losing any data at Ctrl+C Method signatures and docstrings: - def _run_threads(self, threads): Run `threads`...
d56714494f73e53ed4b41d6376d942332b406885
<|skeleton|> class ThreadedAgent: """Abstract agent which can run the main process in several python threads. Allows for a standardized way of exiting cleanly, without losing any data at Ctrl+C""" def _run_threads(self, threads): """Run `threads` Args: threads: list of threads to start and join""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ThreadedAgent: """Abstract agent which can run the main process in several python threads. Allows for a standardized way of exiting cleanly, without losing any data at Ctrl+C""" def _run_threads(self, threads): """Run `threads` Args: threads: list of threads to start and join""" for t in ...
the_stack_v2_python_sparse
rltf/agents/base_agents.py
arita37/rltf
train
1
9ceeaecd6eb28b8e2a803aeca3251367da63b365
[ "TextStaticPanel.__init__(self, container, *args, **kwargs)\nself.attributes[-1].Destroy()\nself.attributes[-1] = wx.CheckBox(self, wx.ID_ANY)\nself._set_attributes(self.attributes)", "attributes = []\nfor atr in self.attributes:\n attributes.append(atr.GetValue())\nreturn attributes", "for text in self.get_...
<|body_start_0|> TextStaticPanel.__init__(self, container, *args, **kwargs) self.attributes[-1].Destroy() self.attributes[-1] = wx.CheckBox(self, wx.ID_ANY) self._set_attributes(self.attributes) <|end_body_0|> <|body_start_1|> attributes = [] for atr in self.attributes: ...
StaticWorkplacePanel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StaticWorkplacePanel: def __init__(self, container, *args, **kwargs): """The default constructor container: a data container object""" <|body_0|> def get_attributes(self): """Return a list of all attributes. return: a list, that contains this panel's attribute values...
stack_v2_sparse_classes_75kplus_train_067641
11,497
no_license
[ { "docstring": "The default constructor container: a data container object", "name": "__init__", "signature": "def __init__(self, container, *args, **kwargs)" }, { "docstring": "Return a list of all attributes. return: a list, that contains this panel's attribute values.", "name": "get_attri...
3
stack_v2_sparse_classes_30k_train_038672
Implement the Python class `StaticWorkplacePanel` described below. Class description: Implement the StaticWorkplacePanel class. Method signatures and docstrings: - def __init__(self, container, *args, **kwargs): The default constructor container: a data container object - def get_attributes(self): Return a list of al...
Implement the Python class `StaticWorkplacePanel` described below. Class description: Implement the StaticWorkplacePanel class. Method signatures and docstrings: - def __init__(self, container, *args, **kwargs): The default constructor container: a data container object - def get_attributes(self): Return a list of al...
781ce419b51b5bd99bbd1b155c03843cb434cb8c
<|skeleton|> class StaticWorkplacePanel: def __init__(self, container, *args, **kwargs): """The default constructor container: a data container object""" <|body_0|> def get_attributes(self): """Return a list of all attributes. return: a list, that contains this panel's attribute values...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StaticWorkplacePanel: def __init__(self, container, *args, **kwargs): """The default constructor container: a data container object""" TextStaticPanel.__init__(self, container, *args, **kwargs) self.attributes[-1].Destroy() self.attributes[-1] = wx.CheckBox(self, wx.ID_ANY) ...
the_stack_v2_python_sparse
gui/static_data.py
mcepar1/Scheduler
train
0
076781e3a52da0ef1f0e8d64a3c29b56131ccec8
[ "@self.logged_in\ndef new_post():\n obj = {'success': True, 'result': self.render_str('newpost.html', user=self.user)}\n self.json(obj)\nnew_post()", "subject = self.request.get('subject')\ncontent = self.request.get('content')\n\n@self.logged_in\ndef make_post(subject, content):\n if not subject or not ...
<|body_start_0|> @self.logged_in def new_post(): obj = {'success': True, 'result': self.render_str('newpost.html', user=self.user)} self.json(obj) new_post() <|end_body_0|> <|body_start_1|> subject = self.request.get('subject') content = self.request.get(...
NewPostHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NewPostHandler: def get(self): """Sends new post form if user is logged in, else redirects to /login""" <|body_0|> def post(self): """Takes data from newpost form. If all fields are populated the content field will go through a custom escape function that allows some...
stack_v2_sparse_classes_75kplus_train_067642
1,602
no_license
[ { "docstring": "Sends new post form if user is logged in, else redirects to /login", "name": "get", "signature": "def get(self)" }, { "docstring": "Takes data from newpost form. If all fields are populated the content field will go through a custom escape function that allows some formatting htm...
2
stack_v2_sparse_classes_30k_train_011013
Implement the Python class `NewPostHandler` described below. Class description: Implement the NewPostHandler class. Method signatures and docstrings: - def get(self): Sends new post form if user is logged in, else redirects to /login - def post(self): Takes data from newpost form. If all fields are populated the cont...
Implement the Python class `NewPostHandler` described below. Class description: Implement the NewPostHandler class. Method signatures and docstrings: - def get(self): Sends new post form if user is logged in, else redirects to /login - def post(self): Takes data from newpost form. If all fields are populated the cont...
e376e53bbd364c52d1028b578a332253c635441b
<|skeleton|> class NewPostHandler: def get(self): """Sends new post form if user is logged in, else redirects to /login""" <|body_0|> def post(self): """Takes data from newpost form. If all fields are populated the content field will go through a custom escape function that allows some...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NewPostHandler: def get(self): """Sends new post form if user is logged in, else redirects to /login""" @self.logged_in def new_post(): obj = {'success': True, 'result': self.render_str('newpost.html', user=self.user)} self.json(obj) new_post() def ...
the_stack_v2_python_sparse
handlers/NewPost.py
jamesmanone/pointlessgripes
train
0
00101883039da528f46212b989e9a65d29ff0dd1
[ "res = []\ni, j = (1, n)\nwhile i <= j:\n if k > 1:\n if k % 2 > 0:\n res.append(i)\n i += 1\n else:\n res.append(j)\n j -= 1\n k -= 1\n else:\n res.append(i)\n i += 1\nreturn res", "visited = [0] * (n + 1)\ndistinct = {}\nself.r...
<|body_start_0|> res = [] i, j = (1, n) while i <= j: if k > 1: if k % 2 > 0: res.append(i) i += 1 else: res.append(j) j -= 1 k -= 1 else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def constructArray(self, n, k): """:type n: int :type k: int :rtype: List[int]""" <|body_0|> def constructArrayTLE(self, n, k): """:type n: int :type k: int :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = [] ...
stack_v2_sparse_classes_75kplus_train_067643
2,816
no_license
[ { "docstring": ":type n: int :type k: int :rtype: List[int]", "name": "constructArray", "signature": "def constructArray(self, n, k)" }, { "docstring": ":type n: int :type k: int :rtype: List[int]", "name": "constructArrayTLE", "signature": "def constructArrayTLE(self, n, k)" } ]
2
stack_v2_sparse_classes_30k_train_017606
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def constructArray(self, n, k): :type n: int :type k: int :rtype: List[int] - def constructArrayTLE(self, n, k): :type n: int :type k: int :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def constructArray(self, n, k): :type n: int :type k: int :rtype: List[int] - def constructArrayTLE(self, n, k): :type n: int :type k: int :rtype: List[int] <|skeleton|> class S...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def constructArray(self, n, k): """:type n: int :type k: int :rtype: List[int]""" <|body_0|> def constructArrayTLE(self, n, k): """:type n: int :type k: int :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def constructArray(self, n, k): """:type n: int :type k: int :rtype: List[int]""" res = [] i, j = (1, n) while i <= j: if k > 1: if k % 2 > 0: res.append(i) i += 1 else: ...
the_stack_v2_python_sparse
B/BeautifulArrangementII.py
bssrdf/pyleet
train
2
92836280dd9151eb3043d2ffd9b6f10bd91f7b27
[ "if isinstance(bing_key, str):\n self.bing_key = bing_key\nelse:\n raise TypeError(\"'bing_key' must be type of string\")\nself.access_token = self.__get_access_token()\nif language is None:\n self.language = 'germany'\nelif isinstance(language, str):\n self.language = language\nelse:\n raise TypeErr...
<|body_start_0|> if isinstance(bing_key, str): self.bing_key = bing_key else: raise TypeError("'bing_key' must be type of string") self.access_token = self.__get_access_token() if language is None: self.language = 'germany' elif isinstance(lang...
TextToSpeech
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextToSpeech: def __init__(self, bing_key, language=None, gender=None, output_mode='riff-16khz-16bit-mono-pcm'): """constructor to initialize bing_key, language, gender and output mode :param bing_key: string, bing api key to get the access token :param language: string, select appropria...
stack_v2_sparse_classes_75kplus_train_067644
5,760
permissive
[ { "docstring": "constructor to initialize bing_key, language, gender and output mode :param bing_key: string, bing api key to get the access token :param language: string, select appropriate language for the output speech :param gender: string, gender of the speaker, can be 'Female' or 'Male' :param output_mode...
4
stack_v2_sparse_classes_30k_train_011109
Implement the Python class `TextToSpeech` described below. Class description: Implement the TextToSpeech class. Method signatures and docstrings: - def __init__(self, bing_key, language=None, gender=None, output_mode='riff-16khz-16bit-mono-pcm'): constructor to initialize bing_key, language, gender and output mode :p...
Implement the Python class `TextToSpeech` described below. Class description: Implement the TextToSpeech class. Method signatures and docstrings: - def __init__(self, bing_key, language=None, gender=None, output_mode='riff-16khz-16bit-mono-pcm'): constructor to initialize bing_key, language, gender and output mode :p...
f6bd9e68365797351dfc7a4cb17ee5141ec77f97
<|skeleton|> class TextToSpeech: def __init__(self, bing_key, language=None, gender=None, output_mode='riff-16khz-16bit-mono-pcm'): """constructor to initialize bing_key, language, gender and output mode :param bing_key: string, bing api key to get the access token :param language: string, select appropria...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TextToSpeech: def __init__(self, bing_key, language=None, gender=None, output_mode='riff-16khz-16bit-mono-pcm'): """constructor to initialize bing_key, language, gender and output mode :param bing_key: string, bing api key to get the access token :param language: string, select appropriate language fo...
the_stack_v2_python_sparse
speech_control/text_to_speech.py
NikoKalbitzer/speech_processing_v2
train
0
10843307ee80326445ea78fd42c70ef9331d52a4
[ "state_zip = ' '.join([s for s in (self.state, self.zipcode) if s])\ncity_state_zip = ', '.join([s for s in (self.city, state_zip, self.country) if s])\nreturn '%s %s %s' % (self.address, self.address2, city_state_zip)", "state_zip = ' '.join([s for s in (self.state_2, self.zipcode_2) if s])\ncity_state_zip = ', ...
<|body_start_0|> state_zip = ' '.join([s for s in (self.state, self.zipcode) if s]) city_state_zip = ', '.join([s for s in (self.city, state_zip, self.country) if s]) return '%s %s %s' % (self.address, self.address2, city_state_zip) <|end_body_0|> <|body_start_1|> state_zip = ' '.join([...
Person
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Person: def get_address(self): """Returns full address depending on which attributes are available.""" <|body_0|> def get_alternate_address(self): """Returns full alternate address depending on which attributes are available.""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_75kplus_train_067645
7,184
no_license
[ { "docstring": "Returns full address depending on which attributes are available.", "name": "get_address", "signature": "def get_address(self)" }, { "docstring": "Returns full alternate address depending on which attributes are available.", "name": "get_alternate_address", "signature": "...
2
stack_v2_sparse_classes_30k_train_033361
Implement the Python class `Person` described below. Class description: Implement the Person class. Method signatures and docstrings: - def get_address(self): Returns full address depending on which attributes are available. - def get_alternate_address(self): Returns full alternate address depending on which attribut...
Implement the Python class `Person` described below. Class description: Implement the Person class. Method signatures and docstrings: - def get_address(self): Returns full address depending on which attributes are available. - def get_alternate_address(self): Returns full alternate address depending on which attribut...
f2ac4ecc076b223c262f2cde4fa3b35b4a5cd54e
<|skeleton|> class Person: def get_address(self): """Returns full address depending on which attributes are available.""" <|body_0|> def get_alternate_address(self): """Returns full alternate address depending on which attributes are available.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Person: def get_address(self): """Returns full address depending on which attributes are available.""" state_zip = ' '.join([s for s in (self.state, self.zipcode) if s]) city_state_zip = ', '.join([s for s in (self.city, state_zip, self.country) if s]) return '%s %s %s' % (self...
the_stack_v2_python_sparse
tendenci/libs/abstracts/models.py
chendong0444/ams
train
0
50893a8b3042df00ed29eb9bfb38c65750eafe95
[ "directory, name, extension = self._split_file_name(file_name)\nextension = self.extension if extension == '' else extension\nfile_name = directory + os.sep + name + extension\nif not file_name.endswith(self.extension):\n raise FileFormatError(\"Invalid file format. '{}' file expected.\".format(self.extension))\...
<|body_start_0|> directory, name, extension = self._split_file_name(file_name) extension = self.extension if extension == '' else extension file_name = directory + os.sep + name + extension if not file_name.endswith(self.extension): raise FileFormatError("Invalid file format....
Reads a Sudoku game file.
SudokuGameReader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SudokuGameReader: """Reads a Sudoku game file.""" def read_game(self, file_name): """Reads a Sudoku game file and returns a Sudoku game object. @param file_name: the name of the file.""" <|body_0|> def open_sudoku_file(self, file_name, mode='r'): """Opens a file ...
stack_v2_sparse_classes_75kplus_train_067646
1,940
no_license
[ { "docstring": "Reads a Sudoku game file and returns a Sudoku game object. @param file_name: the name of the file.", "name": "read_game", "signature": "def read_game(self, file_name)" }, { "docstring": "Opens a file using a context manager. @param file_name: the name of the file. @param mode: th...
3
stack_v2_sparse_classes_30k_train_049034
Implement the Python class `SudokuGameReader` described below. Class description: Reads a Sudoku game file. Method signatures and docstrings: - def read_game(self, file_name): Reads a Sudoku game file and returns a Sudoku game object. @param file_name: the name of the file. - def open_sudoku_file(self, file_name, mod...
Implement the Python class `SudokuGameReader` described below. Class description: Reads a Sudoku game file. Method signatures and docstrings: - def read_game(self, file_name): Reads a Sudoku game file and returns a Sudoku game object. @param file_name: the name of the file. - def open_sudoku_file(self, file_name, mod...
27cc2f7cb52ea787191095c2e581729c22bba62a
<|skeleton|> class SudokuGameReader: """Reads a Sudoku game file.""" def read_game(self, file_name): """Reads a Sudoku game file and returns a Sudoku game object. @param file_name: the name of the file.""" <|body_0|> def open_sudoku_file(self, file_name, mode='r'): """Opens a file ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SudokuGameReader: """Reads a Sudoku game file.""" def read_game(self, file_name): """Reads a Sudoku game file and returns a Sudoku game object. @param file_name: the name of the file.""" directory, name, extension = self._split_file_name(file_name) extension = self.extension if ex...
the_stack_v2_python_sparse
src/sudoku/reader/game_reader.py
pysudoku/sudoku
train
1
dd8936693b5bf6ca6f798326144b82cd1d987753
[ "if not s:\n return []\nfrom collections import Counter as cc\nresult = []\np_len = len(p)\npc = cc(p)\ntmp_cc = cc()\nfor i in range(len(s)):\n tmp_cc.update([s[i]])\n if i >= p_len - 1:\n if pc == tmp_cc:\n result += (i - p_len + 1,)\n tmp_cc.subtract([s[i - p_len + 1]])\nreturn ...
<|body_start_0|> if not s: return [] from collections import Counter as cc result = [] p_len = len(p) pc = cc(p) tmp_cc = cc() for i in range(len(s)): tmp_cc.update([s[i]]) if i >= p_len - 1: if pc == tmp_cc: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findAnagrams(self, s, p): """:type s: str :type p: str :rtype: List[int] looking for signature.""" <|body_0|> def rewrite(self, s, p): """:type s: str :type p: str :rtype: List[int] looking for signature.""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_75kplus_train_067647
2,356
no_license
[ { "docstring": ":type s: str :type p: str :rtype: List[int] looking for signature.", "name": "findAnagrams", "signature": "def findAnagrams(self, s, p)" }, { "docstring": ":type s: str :type p: str :rtype: List[int] looking for signature.", "name": "rewrite", "signature": "def rewrite(se...
2
stack_v2_sparse_classes_30k_train_020605
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findAnagrams(self, s, p): :type s: str :type p: str :rtype: List[int] looking for signature. - def rewrite(self, s, p): :type s: str :type p: str :rtype: List[int] looking fo...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findAnagrams(self, s, p): :type s: str :type p: str :rtype: List[int] looking for signature. - def rewrite(self, s, p): :type s: str :type p: str :rtype: List[int] looking fo...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def findAnagrams(self, s, p): """:type s: str :type p: str :rtype: List[int] looking for signature.""" <|body_0|> def rewrite(self, s, p): """:type s: str :type p: str :rtype: List[int] looking for signature.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def findAnagrams(self, s, p): """:type s: str :type p: str :rtype: List[int] looking for signature.""" if not s: return [] from collections import Counter as cc result = [] p_len = len(p) pc = cc(p) tmp_cc = cc() for i in ra...
the_stack_v2_python_sparse
co_amazon/438_Find_All_Anagrams_in_a_String.py
vsdrun/lc_public
train
6
ff8ece3607fc902cfea168fba8283dce281f53f0
[ "if request.method != 'POST':\n return None\nif 'HTTP_X_APPENGINE_CRON' in os.environ or 'HTTP_X_APPENGINE_QUEUENAME' in os.environ:\n return None\npost_token = request.POST.get('xsrf_token')\nif not post_token:\n logging.warn('Missing XSRF token for post data %s', request.POST)\n return http.HttpRespon...
<|body_start_0|> if request.method != 'POST': return None if 'HTTP_X_APPENGINE_CRON' in os.environ or 'HTTP_X_APPENGINE_QUEUENAME' in os.environ: return None post_token = request.POST.get('xsrf_token') if not post_token: logging.warn('Missing XSRF toke...
Middleware for preventing cross-site request forgery attacks. This class implements the specification defined at https://docs.djangoproject.com/en/dev/topics/http/middleware/.
XsrfMiddleware
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XsrfMiddleware: """Middleware for preventing cross-site request forgery attacks. This class implements the specification defined at https://docs.djangoproject.com/en/dev/topics/http/middleware/.""" def process_request(self, request): """Requires a valid XSRF token on POST requests.""...
stack_v2_sparse_classes_75kplus_train_067648
3,853
permissive
[ { "docstring": "Requires a valid XSRF token on POST requests.", "name": "process_request", "signature": "def process_request(self, request)" }, { "docstring": "Alters HTML responses containing <form> tags to embed the XSRF token.", "name": "process_response", "signature": "def process_re...
2
stack_v2_sparse_classes_30k_train_049425
Implement the Python class `XsrfMiddleware` described below. Class description: Middleware for preventing cross-site request forgery attacks. This class implements the specification defined at https://docs.djangoproject.com/en/dev/topics/http/middleware/. Method signatures and docstrings: - def process_request(self, ...
Implement the Python class `XsrfMiddleware` described below. Class description: Middleware for preventing cross-site request forgery attacks. This class implements the specification defined at https://docs.djangoproject.com/en/dev/topics/http/middleware/. Method signatures and docstrings: - def process_request(self, ...
f581989f168189fa3a58c028eff327a16c03e438
<|skeleton|> class XsrfMiddleware: """Middleware for preventing cross-site request forgery attacks. This class implements the specification defined at https://docs.djangoproject.com/en/dev/topics/http/middleware/.""" def process_request(self, request): """Requires a valid XSRF token on POST requests.""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class XsrfMiddleware: """Middleware for preventing cross-site request forgery attacks. This class implements the specification defined at https://docs.djangoproject.com/en/dev/topics/http/middleware/.""" def process_request(self, request): """Requires a valid XSRF token on POST requests.""" if ...
the_stack_v2_python_sparse
app/soc/middleware/xsrf.py
sambitgaan/nupic.son
train
0
a321abfc612e56695ff34d12616d47f984048a3b
[ "left = 0\nright = len(arr) - 1\nremove_size = len(arr) - k\nwhile remove_size > 0:\n if abs(arr[left] - x) <= abs(arr[right] - x):\n right -= 1\n else:\n left += 1\n remove_size -= 1\nreturn arr[left:left + k]", "left = 0\nright = len(arr) - k\nwhile left < right:\n mid = left + right >...
<|body_start_0|> left = 0 right = len(arr) - 1 remove_size = len(arr) - k while remove_size > 0: if abs(arr[left] - x) <= abs(arr[right] - x): right -= 1 else: left += 1 remove_size -= 1 return arr[left:left + k]...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findClosestElements(self, arr: List[int], k: int, x: int) -> List[int]: """保留 k 个差值最小元素 :param arr: :param k: :param x: :return:""" <|body_0|> def findClosestElements1(self, arr: List[int], k: int, x: int) -> List[int]: """二分查找 :param arr: :param k: :pa...
stack_v2_sparse_classes_75kplus_train_067649
1,883
no_license
[ { "docstring": "保留 k 个差值最小元素 :param arr: :param k: :param x: :return:", "name": "findClosestElements", "signature": "def findClosestElements(self, arr: List[int], k: int, x: int) -> List[int]" }, { "docstring": "二分查找 :param arr: :param k: :param x: :return:", "name": "findClosestElements1", ...
2
stack_v2_sparse_classes_30k_val_000944
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findClosestElements(self, arr: List[int], k: int, x: int) -> List[int]: 保留 k 个差值最小元素 :param arr: :param k: :param x: :return: - def findClosestElements1(self, arr: List[int],...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findClosestElements(self, arr: List[int], k: int, x: int) -> List[int]: 保留 k 个差值最小元素 :param arr: :param k: :param x: :return: - def findClosestElements1(self, arr: List[int],...
9acba92695c06406f12f997a720bfe1deb9464a8
<|skeleton|> class Solution: def findClosestElements(self, arr: List[int], k: int, x: int) -> List[int]: """保留 k 个差值最小元素 :param arr: :param k: :param x: :return:""" <|body_0|> def findClosestElements1(self, arr: List[int], k: int, x: int) -> List[int]: """二分查找 :param arr: :param k: :pa...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def findClosestElements(self, arr: List[int], k: int, x: int) -> List[int]: """保留 k 个差值最小元素 :param arr: :param k: :param x: :return:""" left = 0 right = len(arr) - 1 remove_size = len(arr) - k while remove_size > 0: if abs(arr[left] - x) <= abs(arr...
the_stack_v2_python_sparse
datastructure/binary_array/FindClosestElements.py
yinhuax/leet_code
train
0
7d15c584f0ab635e7a0d7799c049fd24c0975909
[ "if self._is_red:\n return Red_Knight\nelse:\n return BLACK_Knight", "pre_moves = [(+1, +2), (+1, -2), (-1, +2), (-1, -2), (+2, +1), (+2, -1), (-2, +1), (-2, -1)]\nblocks = [(self._x, self._y + 1), (self._x, self._y - 1), (self._x, self._y + 1), (self._x, self._y + 1), (self._x + 1, self._y), (self._x + 1, ...
<|body_start_0|> if self._is_red: return Red_Knight else: return BLACK_Knight <|end_body_0|> <|body_start_1|> pre_moves = [(+1, +2), (+1, -2), (-1, +2), (-1, -2), (+2, +1), (+2, -1), (-2, +1), (-2, -1)] blocks = [(self._x, self._y + 1), (self._x, self._y - 1), (s...
马类
Knight
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Knight: """马类""" def image(self): """获取棋子图像""" <|body_0|> def get_moves(self, pieces: dict): """获取能移动的位置""" <|body_1|> <|end_skeleton|> <|body_start_0|> if self._is_red: return Red_Knight else: return BLACK_Knight...
stack_v2_sparse_classes_75kplus_train_067650
1,373
permissive
[ { "docstring": "获取棋子图像", "name": "image", "signature": "def image(self)" }, { "docstring": "获取能移动的位置", "name": "get_moves", "signature": "def get_moves(self, pieces: dict)" } ]
2
stack_v2_sparse_classes_30k_train_040107
Implement the Python class `Knight` described below. Class description: 马类 Method signatures and docstrings: - def image(self): 获取棋子图像 - def get_moves(self, pieces: dict): 获取能移动的位置
Implement the Python class `Knight` described below. Class description: 马类 Method signatures and docstrings: - def image(self): 获取棋子图像 - def get_moves(self, pieces: dict): 获取能移动的位置 <|skeleton|> class Knight: """马类""" def image(self): """获取棋子图像""" <|body_0|> def get_moves(self, pieces: d...
af9aa36d9f46452b38433580253c7e2853bb6478
<|skeleton|> class Knight: """马类""" def image(self): """获取棋子图像""" <|body_0|> def get_moves(self, pieces: dict): """获取能移动的位置""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Knight: """马类""" def image(self): """获取棋子图像""" if self._is_red: return Red_Knight else: return BLACK_Knight def get_moves(self, pieces: dict): """获取能移动的位置""" pre_moves = [(+1, +2), (+1, -2), (-1, +2), (-1, -2), (+2, +1), (+2, -1), (-2, ...
the_stack_v2_python_sparse
chess/chessman/knight.py
kimi9527/chess-yi
train
0
8468781f8f7a635aeed37c2cecc7b910c18d6efb
[ "testing_config.sign_in('user@example.com', 111)\nwith test_app.test_request_context(self.request_path):\n json_data = self.handler.get_template_data()\nself.assertEqual(1, len(json_data))\nself.assertEqual('feature one', json_data[0]['name'])", "self.fe_1.unlisted = True\nself.fe_1.put()\ntesting_config.sign_...
<|body_start_0|> testing_config.sign_in('user@example.com', 111) with test_app.test_request_context(self.request_path): json_data = self.handler.get_template_data() self.assertEqual(1, len(json_data)) self.assertEqual('feature one', json_data[0]['name']) <|end_body_0|> <|bod...
FeaturesJsonHandlerTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FeaturesJsonHandlerTest: def test_get_template_data(self): """User can get a JSON feed of all features.""" <|body_0|> def test_get_template_data__unlisted_no_perms(self): """JSON feed does not include unlisted features for users who can't edit.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_067651
5,241
permissive
[ { "docstring": "User can get a JSON feed of all features.", "name": "test_get_template_data", "signature": "def test_get_template_data(self)" }, { "docstring": "JSON feed does not include unlisted features for users who can't edit.", "name": "test_get_template_data__unlisted_no_perms", "...
3
stack_v2_sparse_classes_30k_train_028651
Implement the Python class `FeaturesJsonHandlerTest` described below. Class description: Implement the FeaturesJsonHandlerTest class. Method signatures and docstrings: - def test_get_template_data(self): User can get a JSON feed of all features. - def test_get_template_data__unlisted_no_perms(self): JSON feed does no...
Implement the Python class `FeaturesJsonHandlerTest` described below. Class description: Implement the FeaturesJsonHandlerTest class. Method signatures and docstrings: - def test_get_template_data(self): User can get a JSON feed of all features. - def test_get_template_data__unlisted_no_perms(self): JSON feed does no...
17f9886d064da5bda84006d5866077727646fff2
<|skeleton|> class FeaturesJsonHandlerTest: def test_get_template_data(self): """User can get a JSON feed of all features.""" <|body_0|> def test_get_template_data__unlisted_no_perms(self): """JSON feed does not include unlisted features for users who can't edit.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FeaturesJsonHandlerTest: def test_get_template_data(self): """User can get a JSON feed of all features.""" testing_config.sign_in('user@example.com', 111) with test_app.test_request_context(self.request_path): json_data = self.handler.get_template_data() self.assert...
the_stack_v2_python_sparse
pages/featurelist_test.py
GoogleChrome/chromium-dashboard
train
574
ad29b1837ce39a4be0200f090d59eb124731e5f3
[ "self.number = number\nself.current_color = '000000'\nself.log = logging.getLogger('RASPLed')\nself.strip = strip", "new_color = '{0}{1}{2}'.format(hex(int(color[0]))[2:].zfill(2), hex(int(color[1]))[2:].zfill(2), hex(int(color[2]))[2:].zfill(2))\ntry:\n self.current_color = new_color\n self.strip.setPixelC...
<|body_start_0|> self.number = number self.current_color = '000000' self.log = logging.getLogger('RASPLed') self.strip = strip <|end_body_0|> <|body_start_1|> new_color = '{0}{1}{2}'.format(hex(int(color[0]))[2:].zfill(2), hex(int(color[1]))[2:].zfill(2), hex(int(color[2]))[2:]....
RASPLed
[ "MIT", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RASPLed: def __init__(self, config, number, strip): """Initialise led.""" <|body_0|> def color(self, color): """Set the LED to the specified color. Args: color: a list of int colors. one for each channel. Returns: None""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_75kplus_train_067652
20,244
permissive
[ { "docstring": "Initialise led.", "name": "__init__", "signature": "def __init__(self, config, number, strip)" }, { "docstring": "Set the LED to the specified color. Args: color: a list of int colors. one for each channel. Returns: None", "name": "color", "signature": "def color(self, co...
2
stack_v2_sparse_classes_30k_train_051891
Implement the Python class `RASPLed` described below. Class description: Implement the RASPLed class. Method signatures and docstrings: - def __init__(self, config, number, strip): Initialise led. - def color(self, color): Set the LED to the specified color. Args: color: a list of int colors. one for each channel. Re...
Implement the Python class `RASPLed` described below. Class description: Implement the RASPLed class. Method signatures and docstrings: - def __init__(self, config, number, strip): Initialise led. - def color(self, color): Set the LED to the specified color. Args: color: a list of int colors. one for each channel. Re...
00937ab2ff51b1dc668bf465282ffa8ff1eebbd8
<|skeleton|> class RASPLed: def __init__(self, config, number, strip): """Initialise led.""" <|body_0|> def color(self, color): """Set the LED to the specified color. Args: color: a list of int colors. one for each channel. Returns: None""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RASPLed: def __init__(self, config, number, strip): """Initialise led.""" self.number = number self.current_color = '000000' self.log = logging.getLogger('RASPLed') self.strip = strip def color(self, color): """Set the LED to the specified color. Args: colo...
the_stack_v2_python_sparse
mpf/platforms/rasppinball/rasppinball.py
vgrillot/mpf
train
0
6b1f20183348126fa7f33590af3de59ea14b89ae
[ "f = open(filename, 'r')\nfor line in f:\n parsedSent = []\n words = line.split(' ')\n for word in words:\n parsedSent.append(self.parseWord(word, workspace, words))\n workspace.add_sentence(parsedSent)", "wordStatus = word.split('-|-')\nwordCar = {}\nwordCar['word'] = wordStatus.pop(0)\nwordCa...
<|body_start_0|> f = open(filename, 'r') for line in f: parsedSent = [] words = line.split(' ') for word in words: parsedSent.append(self.parseWord(word, workspace, words)) workspace.add_sentence(parsedSent) <|end_body_0|> <|body_start_1|>...
@class Adapter @brief Takes an article analyzed by systran and pours elements from it into a workspace. To use it : @code adapter.parse(filename, workspace) @endcode
Adapter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Adapter: """@class Adapter @brief Takes an article analyzed by systran and pours elements from it into a workspace. To use it : @code adapter.parse(filename, workspace) @endcode""" def parse(self, filename, workspace): """Parses a syntactic tree (systran format) and fills workspace g...
stack_v2_sparse_classes_75kplus_train_067653
4,469
no_license
[ { "docstring": "Parses a syntactic tree (systran format) and fills workspace given as argument with new information. @param filename Name of the file to parse. @param workspace Current workspace.", "name": "parse", "signature": "def parse(self, filename, workspace)" }, { "docstring": "Takes a cu...
4
stack_v2_sparse_classes_30k_train_030721
Implement the Python class `Adapter` described below. Class description: @class Adapter @brief Takes an article analyzed by systran and pours elements from it into a workspace. To use it : @code adapter.parse(filename, workspace) @endcode Method signatures and docstrings: - def parse(self, filename, workspace): Parse...
Implement the Python class `Adapter` described below. Class description: @class Adapter @brief Takes an article analyzed by systran and pours elements from it into a workspace. To use it : @code adapter.parse(filename, workspace) @endcode Method signatures and docstrings: - def parse(self, filename, workspace): Parse...
78954841f245fcbc9f14b4d5bcd88c59efe1b7a0
<|skeleton|> class Adapter: """@class Adapter @brief Takes an article analyzed by systran and pours elements from it into a workspace. To use it : @code adapter.parse(filename, workspace) @endcode""" def parse(self, filename, workspace): """Parses a syntactic tree (systran format) and fills workspace g...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Adapter: """@class Adapter @brief Takes an article analyzed by systran and pours elements from it into a workspace. To use it : @code adapter.parse(filename, workspace) @endcode""" def parse(self, filename, workspace): """Parses a syntactic tree (systran format) and fills workspace given as argum...
the_stack_v2_python_sparse
src/abstracter/adapter/adapter.py
PSC-INF02/psc
train
0
75971c7aecda5cbda87112a436c52f9dc4bbfa2a
[ "gtk.ComboBox.__init__(self, gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING))\ncell = gtk.CellRendererText()\nself.pack_start(cell, True)\nself.add_attribute(cell, 'text', 0)\nself.set_size_request(width, heigth)\nself.set_border_width(margin)\nself.set_items(items)", "p_tree_model = self.get_model()\np_t...
<|body_start_0|> gtk.ComboBox.__init__(self, gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING)) cell = gtk.CellRendererText() self.pack_start(cell, True) self.add_attribute(cell, 'text', 0) self.set_size_request(width, heigth) self.set_border_width(margin) s...
Simple GTK ComboBox using a fullfilled GtkTree, with 2 columns - first columns is used to display the human-readable value, - second to stock the non-readable value. Methods: LbxComboBox(self, list): instantiate a ComboBox using the given list set_items(self, list): display list in the ComboBox
LbxComboBox
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LbxComboBox: """Simple GTK ComboBox using a fullfilled GtkTree, with 2 columns - first columns is used to display the human-readable value, - second to stock the non-readable value. Methods: LbxComboBox(self, list): instantiate a ComboBox using the given list set_items(self, list): display list i...
stack_v2_sparse_classes_75kplus_train_067654
13,120
no_license
[ { "docstring": "Instantiate a new LbxComboBox Returns a new LbxComboBox pre-filled with list ComboBox geometry default to 200x30 + 10 margin list should be a list of tuples", "name": "__init__", "signature": "def __init__(self, items=None, width=200, heigth=30, margin=10)" }, { "docstring": "Fil...
2
stack_v2_sparse_classes_30k_test_001449
Implement the Python class `LbxComboBox` described below. Class description: Simple GTK ComboBox using a fullfilled GtkTree, with 2 columns - first columns is used to display the human-readable value, - second to stock the non-readable value. Methods: LbxComboBox(self, list): instantiate a ComboBox using the given lis...
Implement the Python class `LbxComboBox` described below. Class description: Simple GTK ComboBox using a fullfilled GtkTree, with 2 columns - first columns is used to display the human-readable value, - second to stock the non-readable value. Methods: LbxComboBox(self, list): instantiate a ComboBox using the given lis...
53c26e3c03c5054fb9d5730cf98716442a07464a
<|skeleton|> class LbxComboBox: """Simple GTK ComboBox using a fullfilled GtkTree, with 2 columns - first columns is used to display the human-readable value, - second to stock the non-readable value. Methods: LbxComboBox(self, list): instantiate a ComboBox using the given list set_items(self, list): display list i...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LbxComboBox: """Simple GTK ComboBox using a fullfilled GtkTree, with 2 columns - first columns is used to display the human-readable value, - second to stock the non-readable value. Methods: LbxComboBox(self, list): instantiate a ComboBox using the given list set_items(self, list): display list in the ComboBo...
the_stack_v2_python_sparse
lbx_gtk_widgets.py
mandriva-management-console/beam
train
0
eea133e6694403d356b3668ef8247a1520737e08
[ "self._LATLONG = ''\nself._preFormat = []\nself._path = None", "latOrientation = 'N'\nlngOrientation = 'W'\nself._path = json['route']['legs']\nfor latlong in range(len(self._path)):\n self._preFormat.append(self._path[latlong]['maneuvers'][0]['startPoint'])\nself._preFormat.append(self._path[latlong]['maneuve...
<|body_start_0|> self._LATLONG = '' self._preFormat = [] self._path = None <|end_body_0|> <|body_start_1|> latOrientation = 'N' lngOrientation = 'W' self._path = json['route']['legs'] for latlong in range(len(self._path)): self._preFormat.append(self....
LATLONG
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LATLONG: def __init__(self): """Initializes a JSON path and an outline for the output""" <|body_0|> def generate(self, json: 'json'): """Generates an output for the latitude and longitude for each of the locations specified in the input, in the order specified in the...
stack_v2_sparse_classes_75kplus_train_067655
3,285
no_license
[ { "docstring": "Initializes a JSON path and an outline for the output", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Generates an output for the latitude and longitude for each of the locations specified in the input, in the order specified in the input", "name": ...
2
stack_v2_sparse_classes_30k_train_026607
Implement the Python class `LATLONG` described below. Class description: Implement the LATLONG class. Method signatures and docstrings: - def __init__(self): Initializes a JSON path and an outline for the output - def generate(self, json: 'json'): Generates an output for the latitude and longitude for each of the loc...
Implement the Python class `LATLONG` described below. Class description: Implement the LATLONG class. Method signatures and docstrings: - def __init__(self): Initializes a JSON path and an outline for the output - def generate(self, json: 'json'): Generates an output for the latitude and longitude for each of the loc...
e0e7e733209a57d83bb92106e5f7e943b1e1b088
<|skeleton|> class LATLONG: def __init__(self): """Initializes a JSON path and an outline for the output""" <|body_0|> def generate(self, json: 'json'): """Generates an output for the latitude and longitude for each of the locations specified in the input, in the order specified in the...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LATLONG: def __init__(self): """Initializes a JSON path and an outline for the output""" self._LATLONG = '' self._preFormat = [] self._path = None def generate(self, json: 'json'): """Generates an output for the latitude and longitude for each of the locations spec...
the_stack_v2_python_sparse
old/ICS32/Project 3/output_mapquest.py
khuongTiet/UCISchoolProjects
train
0
dc2d63c1db9724acd31993330852deba674cd983
[ "m = 'Setting %s, %s identify to %s' % (self.name, self.address, value)\nq = self._build_command(self.address, 'pulse', value)\nself.info(m)\nself.ask(q)", "if typetag == 'pressure':\n s = 'PR1'\nelif typetag == 'filament':\n s = 'FS'\nelif typetag == 'setpoint_value':\n s = 'SP%i' % setpointindex\nelif ...
<|body_start_0|> m = 'Setting %s, %s identify to %s' % (self.name, self.address, value) q = self._build_command(self.address, 'pulse', value) self.info(m) self.ask(q) <|end_body_0|> <|body_start_1|> if typetag == 'pressure': s = 'PR1' elif typetag == 'filamen...
BaseMKSGauge
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseMKSGauge: def set_transducer_identify(self, value): """sends command to transducer to toggle LED pulse @type value: C{str} @param value: ON or OFF @see: L{MKSComs}""" <|body_0|> def _build_query(self, addr, typetag, setpointindex=1): """build a query @type addr: ...
stack_v2_sparse_classes_75kplus_train_067656
5,075
permissive
[ { "docstring": "sends command to transducer to toggle LED pulse @type value: C{str} @param value: ON or OFF @see: L{MKSComs}", "name": "set_transducer_identify", "signature": "def set_transducer_identify(self, value)" }, { "docstring": "build a query @type addr: C{s} @param addr: RS-485 address ...
4
stack_v2_sparse_classes_30k_train_028773
Implement the Python class `BaseMKSGauge` described below. Class description: Implement the BaseMKSGauge class. Method signatures and docstrings: - def set_transducer_identify(self, value): sends command to transducer to toggle LED pulse @type value: C{str} @param value: ON or OFF @see: L{MKSComs} - def _build_query(...
Implement the Python class `BaseMKSGauge` described below. Class description: Implement the BaseMKSGauge class. Method signatures and docstrings: - def set_transducer_identify(self, value): sends command to transducer to toggle LED pulse @type value: C{str} @param value: ON or OFF @see: L{MKSComs} - def _build_query(...
8cfc8085393ace2aee6b98d36bfd6fba0bcb41c6
<|skeleton|> class BaseMKSGauge: def set_transducer_identify(self, value): """sends command to transducer to toggle LED pulse @type value: C{str} @param value: ON or OFF @see: L{MKSComs}""" <|body_0|> def _build_query(self, addr, typetag, setpointindex=1): """build a query @type addr: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseMKSGauge: def set_transducer_identify(self, value): """sends command to transducer to toggle LED pulse @type value: C{str} @param value: ON or OFF @see: L{MKSComs}""" m = 'Setting %s, %s identify to %s' % (self.name, self.address, value) q = self._build_command(self.address, 'pulse...
the_stack_v2_python_sparse
pychron/hardware/gauges/mks/base_mks_gauge.py
NMGRL/pychron
train
38
7f9579cec51eae360518ae957b933d74f01ab2ec
[ "account = self.model(*args, email=self.normalize_email(email), **kwargs)\naccount.save()\naccount.set_password(password)\naccount.save()\nreturn account", "account = self.create_user(email, *args, password=password, **kwargs)\naccount.is_admin = True\naccount.save()\nreturn account" ]
<|body_start_0|> account = self.model(*args, email=self.normalize_email(email), **kwargs) account.save() account.set_password(password) account.save() return account <|end_body_0|> <|body_start_1|> account = self.create_user(email, *args, password=password, **kwargs) ...
Account Manager Extends django.contrib.auth.models.BaseUserManager
AccountManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccountManager: """Account Manager Extends django.contrib.auth.models.BaseUserManager""" def create_user(self, email, password=None, *args, **kwargs): """Create a new Account Also assign the user an auth_token https://docs.djangoproject.com/en/dev/topics/auth/customizing/#django.cont...
stack_v2_sparse_classes_75kplus_train_067657
3,971
no_license
[ { "docstring": "Create a new Account Also assign the user an auth_token https://docs.djangoproject.com/en/dev/topics/auth/customizing/#django.contrib.auth.models.CustomUserManager.create_user", "name": "create_user", "signature": "def create_user(self, email, password=None, *args, **kwargs)" }, { ...
2
stack_v2_sparse_classes_30k_train_027158
Implement the Python class `AccountManager` described below. Class description: Account Manager Extends django.contrib.auth.models.BaseUserManager Method signatures and docstrings: - def create_user(self, email, password=None, *args, **kwargs): Create a new Account Also assign the user an auth_token https://docs.djan...
Implement the Python class `AccountManager` described below. Class description: Account Manager Extends django.contrib.auth.models.BaseUserManager Method signatures and docstrings: - def create_user(self, email, password=None, *args, **kwargs): Create a new Account Also assign the user an auth_token https://docs.djan...
f97c07bf62776ba965affe832caa099f423328fd
<|skeleton|> class AccountManager: """Account Manager Extends django.contrib.auth.models.BaseUserManager""" def create_user(self, email, password=None, *args, **kwargs): """Create a new Account Also assign the user an auth_token https://docs.djangoproject.com/en/dev/topics/auth/customizing/#django.cont...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AccountManager: """Account Manager Extends django.contrib.auth.models.BaseUserManager""" def create_user(self, email, password=None, *args, **kwargs): """Create a new Account Also assign the user an auth_token https://docs.djangoproject.com/en/dev/topics/auth/customizing/#django.contrib.auth.mode...
the_stack_v2_python_sparse
guru_api/core/models/account.py
mroyce/guru_api
train
0
c2deb0fd50c36fd72deaff9809b8fc3e3a3b040f
[ "self.src = src\nself.tgt = tgt\nself.src_lengths = src_lengths\nself.tgt_lengths = tgt_lengths", "self.src = self.src.to(**kwargs)\nself.tgt = self.tgt.to(**kwargs)\nself.src_lengths = self.src_lengths.to(**kwargs)\nself.tgt_lengths = self.tgt_lengths.to(**kwargs)" ]
<|body_start_0|> self.src = src self.tgt = tgt self.src_lengths = src_lengths self.tgt_lengths = tgt_lengths <|end_body_0|> <|body_start_1|> self.src = self.src.to(**kwargs) self.tgt = self.tgt.to(**kwargs) self.src_lengths = self.src_lengths.to(**kwargs) ...
A data structure
IWSLTExample
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IWSLTExample: """A data structure""" def __init__(self, src, tgt, src_lengths, tgt_lengths): """A constructor""" <|body_0|> def to(self, **kwargs): """Change device""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.src = src self.tgt ...
stack_v2_sparse_classes_75kplus_train_067658
5,003
no_license
[ { "docstring": "A constructor", "name": "__init__", "signature": "def __init__(self, src, tgt, src_lengths, tgt_lengths)" }, { "docstring": "Change device", "name": "to", "signature": "def to(self, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_004797
Implement the Python class `IWSLTExample` described below. Class description: A data structure Method signatures and docstrings: - def __init__(self, src, tgt, src_lengths, tgt_lengths): A constructor - def to(self, **kwargs): Change device
Implement the Python class `IWSLTExample` described below. Class description: A data structure Method signatures and docstrings: - def __init__(self, src, tgt, src_lengths, tgt_lengths): A constructor - def to(self, **kwargs): Change device <|skeleton|> class IWSLTExample: """A data structure""" def __init_...
858559c7e39ad82a87ac2546162c7dbadf7d4de8
<|skeleton|> class IWSLTExample: """A data structure""" def __init__(self, src, tgt, src_lengths, tgt_lengths): """A constructor""" <|body_0|> def to(self, **kwargs): """Change device""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IWSLTExample: """A data structure""" def __init__(self, src, tgt, src_lengths, tgt_lengths): """A constructor""" self.src = src self.tgt = tgt self.src_lengths = src_lengths self.tgt_lengths = tgt_lengths def to(self, **kwargs): """Change device""" ...
the_stack_v2_python_sparse
ld_research/text/iwslt.py
JACKHAHA363/translation_game_drift
train
2
3e05973f6ac5ea06f6720404166b62a28046930a
[ "left = []\nself.rt = 0\n\ndef dfs(root, pos, level):\n if not root:\n return\n if len(left) < level + 1:\n left.append(pos)\n self.rt = max(self.rt, pos - left[level] + 1)\n dfs(root.left, pos * 2 + 1, level + 1)\n dfs(root.right, pos * 2 + 2, level + 1)\ndfs(root, 0, 0)\nreturn self.r...
<|body_start_0|> left = [] self.rt = 0 def dfs(root, pos, level): if not root: return if len(left) < level + 1: left.append(pos) self.rt = max(self.rt, pos - left[level] + 1) dfs(root.left, pos * 2 + 1, level + 1) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def widthOfBinaryTree_dfs(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def widthOfBinaryTree_bfs(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> left = [] self.rt =...
stack_v2_sparse_classes_75kplus_train_067659
1,553
no_license
[ { "docstring": ":type root: TreeNode :rtype: int", "name": "widthOfBinaryTree_dfs", "signature": "def widthOfBinaryTree_dfs(self, root)" }, { "docstring": ":type root: TreeNode :rtype: int", "name": "widthOfBinaryTree_bfs", "signature": "def widthOfBinaryTree_bfs(self, root)" } ]
2
stack_v2_sparse_classes_30k_train_052552
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def widthOfBinaryTree_dfs(self, root): :type root: TreeNode :rtype: int - def widthOfBinaryTree_bfs(self, root): :type root: TreeNode :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def widthOfBinaryTree_dfs(self, root): :type root: TreeNode :rtype: int - def widthOfBinaryTree_bfs(self, root): :type root: TreeNode :rtype: int <|skeleton|> class Solution: ...
0e99f9a5226507706b3ee66fd04bae813755ef40
<|skeleton|> class Solution: def widthOfBinaryTree_dfs(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def widthOfBinaryTree_bfs(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def widthOfBinaryTree_dfs(self, root): """:type root: TreeNode :rtype: int""" left = [] self.rt = 0 def dfs(root, pos, level): if not root: return if len(left) < level + 1: left.append(pos) self.rt =...
the_stack_v2_python_sparse
medium/tree/test_662_Maximum_Width_of_Binary_Tree.py
wuxu1019/leetcode_sophia
train
1
2cef6fb2b668c333be11e85155c5bdaf29d0dfcd
[ "super().__init__()\nself.criterion = criterion\nself.weight = weight\nself.independent_perm = independent_perm\nself.solver = PITSolver(criterion, weight, independent_perm)\nself.layer_weights = layer_weights", "losses = 0.0\nif not isinstance(infs[0], (tuple, list)) and len(infs) == len(ref):\n loss, stats, ...
<|body_start_0|> super().__init__() self.criterion = criterion self.weight = weight self.independent_perm = independent_perm self.solver = PITSolver(criterion, weight, independent_perm) self.layer_weights = layer_weights <|end_body_0|> <|body_start_1|> losses = 0...
MultiLayerPITSolver
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiLayerPITSolver: def __init__(self, criterion: AbsEnhLoss, weight=1.0, independent_perm=True, layer_weights=None): """Multi-Layer Permutation Invariant Training Solver. Compute the PIT loss given inferences of multiple layers and a single reference. It also support single inference a...
stack_v2_sparse_classes_75kplus_train_067660
3,042
permissive
[ { "docstring": "Multi-Layer Permutation Invariant Training Solver. Compute the PIT loss given inferences of multiple layers and a single reference. It also support single inference and single reference in evaluation stage. Args: criterion (AbsEnhLoss): an instance of AbsEnhLoss weight (float): weight (between 0...
2
stack_v2_sparse_classes_30k_train_035171
Implement the Python class `MultiLayerPITSolver` described below. Class description: Implement the MultiLayerPITSolver class. Method signatures and docstrings: - def __init__(self, criterion: AbsEnhLoss, weight=1.0, independent_perm=True, layer_weights=None): Multi-Layer Permutation Invariant Training Solver. Compute...
Implement the Python class `MultiLayerPITSolver` described below. Class description: Implement the MultiLayerPITSolver class. Method signatures and docstrings: - def __init__(self, criterion: AbsEnhLoss, weight=1.0, independent_perm=True, layer_weights=None): Multi-Layer Permutation Invariant Training Solver. Compute...
bcd20948db7846ee523443ef9fd78c7a1248c95e
<|skeleton|> class MultiLayerPITSolver: def __init__(self, criterion: AbsEnhLoss, weight=1.0, independent_perm=True, layer_weights=None): """Multi-Layer Permutation Invariant Training Solver. Compute the PIT loss given inferences of multiple layers and a single reference. It also support single inference a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MultiLayerPITSolver: def __init__(self, criterion: AbsEnhLoss, weight=1.0, independent_perm=True, layer_weights=None): """Multi-Layer Permutation Invariant Training Solver. Compute the PIT loss given inferences of multiple layers and a single reference. It also support single inference and single refe...
the_stack_v2_python_sparse
espnet2/enh/loss/wrappers/multilayer_pit_solver.py
espnet/espnet
train
7,242
167216284f1dfadc1945e9c6c3b251891f16145a
[ "for i in range(len(nums)):\n if nums[i] == 0:\n continue\n direction = nums[i] > 0\n slow = fast = i\n while nums[slow] != 0 or nums[fast] != 0:\n slow = self.__next(nums, slow, direction)\n fast = self.__next(nums, self.__next(nums, fast, direction), direction)\n if slow ==...
<|body_start_0|> for i in range(len(nums)): if nums[i] == 0: continue direction = nums[i] > 0 slow = fast = i while nums[slow] != 0 or nums[fast] != 0: slow = self.__next(nums, slow, direction) fast = self.__next(num...
Array
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Array: def is_circular(self, nums: List[int]) -> bool: """Approach: Fast and Slow Pointer Time Complexity: O(N) Space Complexity: O(1) :param nums: :return:""" <|body_0|> def __next(self, nums, index, direction) -> int: """:param nums: :param index: :param direction:...
stack_v2_sparse_classes_75kplus_train_067661
1,551
no_license
[ { "docstring": "Approach: Fast and Slow Pointer Time Complexity: O(N) Space Complexity: O(1) :param nums: :return:", "name": "is_circular", "signature": "def is_circular(self, nums: List[int]) -> bool" }, { "docstring": ":param nums: :param index: :param direction: :return:", "name": "__next...
2
null
Implement the Python class `Array` described below. Class description: Implement the Array class. Method signatures and docstrings: - def is_circular(self, nums: List[int]) -> bool: Approach: Fast and Slow Pointer Time Complexity: O(N) Space Complexity: O(1) :param nums: :return: - def __next(self, nums, index, direc...
Implement the Python class `Array` described below. Class description: Implement the Array class. Method signatures and docstrings: - def is_circular(self, nums: List[int]) -> bool: Approach: Fast and Slow Pointer Time Complexity: O(N) Space Complexity: O(1) :param nums: :return: - def __next(self, nums, index, direc...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class Array: def is_circular(self, nums: List[int]) -> bool: """Approach: Fast and Slow Pointer Time Complexity: O(N) Space Complexity: O(1) :param nums: :return:""" <|body_0|> def __next(self, nums, index, direction) -> int: """:param nums: :param index: :param direction:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Array: def is_circular(self, nums: List[int]) -> bool: """Approach: Fast and Slow Pointer Time Complexity: O(N) Space Complexity: O(1) :param nums: :return:""" for i in range(len(nums)): if nums[i] == 0: continue direction = nums[i] > 0 slow ...
the_stack_v2_python_sparse
goldman_sachs/circular_array_loop.py
Shiv2157k/leet_code
train
1
f779f1789ca057735e73b0cf0d3db3563ce35647
[ "super().__init__(self.PROBLEM_NAME)\nself.input_list1 = input_list1\nself.input_list2 = input_list2", "print('Solving {} problem ...'.format(self.PROBLEM_NAME))\nlen1 = len(self.input_list1)\nlen2 = len(self.input_list2)\ni = 0\nj = 0\nresult = []\nwhile i < len1 and j < len2:\n if self.input_list1[i] < self....
<|body_start_0|> super().__init__(self.PROBLEM_NAME) self.input_list1 = input_list1 self.input_list2 = input_list2 <|end_body_0|> <|body_start_1|> print('Solving {} problem ...'.format(self.PROBLEM_NAME)) len1 = len(self.input_list1) len2 = len(self.input_list2) ...
Two Sum
IntersectionOfSortedArrays
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IntersectionOfSortedArrays: """Two Sum""" def __init__(self, input_list1, input_list2): """Intersection of sorted arrays Args: input_list1: First array input_list2: Second array Returns: None Raises: None""" <|body_0|> def solve(self): """Solve the problem Note: ...
stack_v2_sparse_classes_75kplus_train_067662
1,518
no_license
[ { "docstring": "Intersection of sorted arrays Args: input_list1: First array input_list2: Second array Returns: None Raises: None", "name": "__init__", "signature": "def __init__(self, input_list1, input_list2)" }, { "docstring": "Solve the problem Note: O(m+n) (runtime) Args: Returns: list Rais...
2
null
Implement the Python class `IntersectionOfSortedArrays` described below. Class description: Two Sum Method signatures and docstrings: - def __init__(self, input_list1, input_list2): Intersection of sorted arrays Args: input_list1: First array input_list2: Second array Returns: None Raises: None - def solve(self): Sol...
Implement the Python class `IntersectionOfSortedArrays` described below. Class description: Two Sum Method signatures and docstrings: - def __init__(self, input_list1, input_list2): Intersection of sorted arrays Args: input_list1: First array input_list2: Second array Returns: None Raises: None - def solve(self): Sol...
11f4d25cb211740514c119a60962d075a0817abd
<|skeleton|> class IntersectionOfSortedArrays: """Two Sum""" def __init__(self, input_list1, input_list2): """Intersection of sorted arrays Args: input_list1: First array input_list2: Second array Returns: None Raises: None""" <|body_0|> def solve(self): """Solve the problem Note: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IntersectionOfSortedArrays: """Two Sum""" def __init__(self, input_list1, input_list2): """Intersection of sorted arrays Args: input_list1: First array input_list2: Second array Returns: None Raises: None""" super().__init__(self.PROBLEM_NAME) self.input_list1 = input_list1 ...
the_stack_v2_python_sparse
python/problems/array/intersection_of_sorted_arrays.py
santhosh-kumar/AlgorithmsAndDataStructures
train
2
c3dc6cd043e0090e952807ebd3dbb1b9792ac85a
[ "action_or_method = getattr(self.view, getattr(self.view, 'action', self.method.lower()), None)\nif not action_or_method:\n return (None, None)\nview_permissions = self.view.get_permissions()\npermission_classes = [clean_permission(perm) for perm in view_permissions if perm]\npermission_docstrings = {}\nfor perm...
<|body_start_0|> action_or_method = getattr(self.view, getattr(self.view, 'action', self.method.lower()), None) if not action_or_method: return (None, None) view_permissions = self.view.get_permissions() permission_classes = [clean_permission(perm) for perm in view_permission...
Marsha specific AutoSchema to add the permission to the schema description.
MarshaAutoSchema
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MarshaAutoSchema: """Marsha specific AutoSchema to add the permission to the schema description.""" def get_permission_description(self): """Get the permission description.""" <|body_0|> def get_description(self): """Append the permission description to the schem...
stack_v2_sparse_classes_75kplus_train_067663
3,497
permissive
[ { "docstring": "Get the permission description.", "name": "get_permission_description", "signature": "def get_permission_description(self)" }, { "docstring": "Append the permission description to the schema description.", "name": "get_description", "signature": "def get_description(self)...
2
null
Implement the Python class `MarshaAutoSchema` described below. Class description: Marsha specific AutoSchema to add the permission to the schema description. Method signatures and docstrings: - def get_permission_description(self): Get the permission description. - def get_description(self): Append the permission des...
Implement the Python class `MarshaAutoSchema` described below. Class description: Marsha specific AutoSchema to add the permission to the schema description. Method signatures and docstrings: - def get_permission_description(self): Get the permission description. - def get_description(self): Append the permission des...
f767f1bdc12c9712f26ea17cb8b19f536389f0ed
<|skeleton|> class MarshaAutoSchema: """Marsha specific AutoSchema to add the permission to the schema description.""" def get_permission_description(self): """Get the permission description.""" <|body_0|> def get_description(self): """Append the permission description to the schem...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MarshaAutoSchema: """Marsha specific AutoSchema to add the permission to the schema description.""" def get_permission_description(self): """Get the permission description.""" action_or_method = getattr(self.view, getattr(self.view, 'action', self.method.lower()), None) if not act...
the_stack_v2_python_sparse
src/backend/marsha/core/api/schema.py
openfun/marsha
train
92
308e2384af6fe6d7e3f1738f30e6175879c6fe2b
[ "houses.sort()\nheaters.sort()\nr = 0\ni = 0\nfor h in houses:\n i = bisect.bisect(heaters, h)\n left = max(0, i - 1)\n right = min(len(heaters) - 1, i)\n r_cur = min(abs(heaters[left] - h), abs(heaters[right] - h))\n r = max(r, r_cur)\nreturn r", "houses.sort()\nheaters.sort()\nheaters.append(floa...
<|body_start_0|> houses.sort() heaters.sort() r = 0 i = 0 for h in houses: i = bisect.bisect(heaters, h) left = max(0, i - 1) right = min(len(heaters) - 1, i) r_cur = min(abs(heaters[left] - h), abs(heaters[right] - h)) ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findRadius(self, houses, heaters): """check the responsibility use bisect :type houses: List[int] :type heaters: List[int] :rtype: int""" <|body_0|> def findRadius_naive(self, houses, heaters): """check the responsibility :type houses: List[int] :type h...
stack_v2_sparse_classes_75kplus_train_067664
2,057
permissive
[ { "docstring": "check the responsibility use bisect :type houses: List[int] :type heaters: List[int] :rtype: int", "name": "findRadius", "signature": "def findRadius(self, houses, heaters)" }, { "docstring": "check the responsibility :type houses: List[int] :type heaters: List[int] :rtype: int",...
2
stack_v2_sparse_classes_30k_train_049005
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findRadius(self, houses, heaters): check the responsibility use bisect :type houses: List[int] :type heaters: List[int] :rtype: int - def findRadius_naive(self, houses, heate...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findRadius(self, houses, heaters): check the responsibility use bisect :type houses: List[int] :type heaters: List[int] :rtype: int - def findRadius_naive(self, houses, heate...
cbbd4a67ab342ada2421e13f82d660b1d47d4d20
<|skeleton|> class Solution: def findRadius(self, houses, heaters): """check the responsibility use bisect :type houses: List[int] :type heaters: List[int] :rtype: int""" <|body_0|> def findRadius_naive(self, houses, heaters): """check the responsibility :type houses: List[int] :type h...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def findRadius(self, houses, heaters): """check the responsibility use bisect :type houses: List[int] :type heaters: List[int] :rtype: int""" houses.sort() heaters.sort() r = 0 i = 0 for h in houses: i = bisect.bisect(heaters, h) ...
the_stack_v2_python_sparse
475 Heaters.py
Aminaba123/LeetCode
train
1
e73f6f03de31540061c0dbab0caf0f7c9f09522c
[ "filename = base_utils.getFileName(file)\nresource = f'/inspection/api/v1/content/{id}'\nresponse = item_fixture.request('POST', resource, files={'file': (filename, open(file, 'rb'), fileType)})\nreturn response", "resource = f'/inspection/api/v1/formInstances/{id}/document'\nresponse = item_fixture.request('GET'...
<|body_start_0|> filename = base_utils.getFileName(file) resource = f'/inspection/api/v1/content/{id}' response = item_fixture.request('POST', resource, files={'file': (filename, open(file, 'rb'), fileType)}) return response <|end_body_0|> <|body_start_1|> resource = f'/inspecti...
文档
Content
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Content: """文档""" def contentPOST(self, item_fixture, id, file, fileType=None): """上次表单""" <|body_0|> def contentGET(self, item_fixture, id): """获取表单""" <|body_1|> def downcontentGET(self, item_fixture, id): """下载表单附件""" <|body_2|> ...
stack_v2_sparse_classes_75kplus_train_067665
2,417
no_license
[ { "docstring": "上次表单", "name": "contentPOST", "signature": "def contentPOST(self, item_fixture, id, file, fileType=None)" }, { "docstring": "获取表单", "name": "contentGET", "signature": "def contentGET(self, item_fixture, id)" }, { "docstring": "下载表单附件", "name": "downcontentGET"...
5
stack_v2_sparse_classes_30k_train_042182
Implement the Python class `Content` described below. Class description: 文档 Method signatures and docstrings: - def contentPOST(self, item_fixture, id, file, fileType=None): 上次表单 - def contentGET(self, item_fixture, id): 获取表单 - def downcontentGET(self, item_fixture, id): 下载表单附件 - def documentsPOST(self, item_fixture,...
Implement the Python class `Content` described below. Class description: 文档 Method signatures and docstrings: - def contentPOST(self, item_fixture, id, file, fileType=None): 上次表单 - def contentGET(self, item_fixture, id): 获取表单 - def downcontentGET(self, item_fixture, id): 下载表单附件 - def documentsPOST(self, item_fixture,...
f875de62f7f505c596ea5567e1fc2c8a64010f87
<|skeleton|> class Content: """文档""" def contentPOST(self, item_fixture, id, file, fileType=None): """上次表单""" <|body_0|> def contentGET(self, item_fixture, id): """获取表单""" <|body_1|> def downcontentGET(self, item_fixture, id): """下载表单附件""" <|body_2|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Content: """文档""" def contentPOST(self, item_fixture, id, file, fileType=None): """上次表单""" filename = base_utils.getFileName(file) resource = f'/inspection/api/v1/content/{id}' response = item_fixture.request('POST', resource, files={'file': (filename, open(file, 'rb'), fi...
the_stack_v2_python_sparse
swagger/api/inspection/content.py
zhangjingwen198817/pytest-api-allure
train
1
83d6e2c4b6caa67128e23742ba3e9a47ff5664d6
[ "if dtype:\n pyKeOps_Warning('keyword argument dtype in KernelSolve is deprecated ; argument is ignored.')\nreduction_op = 'Sum'\nif opt_arg:\n self.formula = reduction_op + '_Reduction(' + formula + ',' + str(opt_arg) + ',' + str(axis2cat(axis)) + ')'\nelse:\n self.formula = reduction_op + '_Reduction(' +...
<|body_start_0|> if dtype: pyKeOps_Warning('keyword argument dtype in KernelSolve is deprecated ; argument is ignored.') reduction_op = 'Sum' if opt_arg: self.formula = reduction_op + '_Reduction(' + formula + ',' + str(opt_arg) + ',' + str(axis2cat(axis)) + ')' e...
Creates a new conjugate gradient solver. Supporting the same :ref:`generic syntax <part.generic_formulas>` as :class:`numpy.Genred <pykeops.numpy.Genred>`, this module allows you to solve generic optimization problems of the form: .. math:: & & a^{\\star} & =\\operatorname*{argmin}_a \\tfrac 1 2 \\langle a,( \\alpha \\...
KernelSolve
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KernelSolve: """Creates a new conjugate gradient solver. Supporting the same :ref:`generic syntax <part.generic_formulas>` as :class:`numpy.Genred <pykeops.numpy.Genred>`, this module allows you to solve generic optimization problems of the form: .. math:: & & a^{\\star} & =\\operatorname*{argmin...
stack_v2_sparse_classes_75kplus_train_067666
12,274
permissive
[ { "docstring": "Instantiate a new KernelSolve operation. Note: :class:`KernelSolve` relies on C++ or CUDA kernels that are compiled on-the-fly and stored in a :ref:`cache directory <part.cache>` as shared libraries (\".so\" files) for later use. Args: formula (string): The scalar- or vector-valued expression th...
2
stack_v2_sparse_classes_30k_train_023461
Implement the Python class `KernelSolve` described below. Class description: Creates a new conjugate gradient solver. Supporting the same :ref:`generic syntax <part.generic_formulas>` as :class:`numpy.Genred <pykeops.numpy.Genred>`, this module allows you to solve generic optimization problems of the form: .. math:: &...
Implement the Python class `KernelSolve` described below. Class description: Creates a new conjugate gradient solver. Supporting the same :ref:`generic syntax <part.generic_formulas>` as :class:`numpy.Genred <pykeops.numpy.Genred>`, this module allows you to solve generic optimization problems of the form: .. math:: &...
52ed22a7fbbcf4bd02dbdf5dc2b00bf79cceddf5
<|skeleton|> class KernelSolve: """Creates a new conjugate gradient solver. Supporting the same :ref:`generic syntax <part.generic_formulas>` as :class:`numpy.Genred <pykeops.numpy.Genred>`, this module allows you to solve generic optimization problems of the form: .. math:: & & a^{\\star} & =\\operatorname*{argmin...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class KernelSolve: """Creates a new conjugate gradient solver. Supporting the same :ref:`generic syntax <part.generic_formulas>` as :class:`numpy.Genred <pykeops.numpy.Genred>`, this module allows you to solve generic optimization problems of the form: .. math:: & & a^{\\star} & =\\operatorname*{argmin}_a \\tfrac 1...
the_stack_v2_python_sparse
pykeops/pykeops/numpy/operations.py
getkeops/keops
train
910
a820f58510b9b3fa26bb432e8d112051d353ee61
[ "row_update = queryset.update(archived=False)\nif row_update == '1':\n msg = 'Была заархивирована 1 пара'\nelse:\n msg = f'Были заархивированы {row_update} пар(/ы)'\nself.message_user(request, msg)", "row_update = queryset.update(archived=True)\nif row_update == '1':\n msg = 'Была разархивирована 1 пара'...
<|body_start_0|> row_update = queryset.update(archived=False) if row_update == '1': msg = 'Была заархивирована 1 пара' else: msg = f'Были заархивированы {row_update} пар(/ы)' self.message_user(request, msg) <|end_body_0|> <|body_start_1|> row_update = que...
LessonAdmin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LessonAdmin: def archive(self, request, queryset): """Заархивировать пары""" <|body_0|> def unarchive(self, request, queryset): """Разархивировать пары""" <|body_1|> <|end_skeleton|> <|body_start_0|> row_update = queryset.update(archived=False) ...
stack_v2_sparse_classes_75kplus_train_067667
1,694
no_license
[ { "docstring": "Заархивировать пары", "name": "archive", "signature": "def archive(self, request, queryset)" }, { "docstring": "Разархивировать пары", "name": "unarchive", "signature": "def unarchive(self, request, queryset)" } ]
2
null
Implement the Python class `LessonAdmin` described below. Class description: Implement the LessonAdmin class. Method signatures and docstrings: - def archive(self, request, queryset): Заархивировать пары - def unarchive(self, request, queryset): Разархивировать пары
Implement the Python class `LessonAdmin` described below. Class description: Implement the LessonAdmin class. Method signatures and docstrings: - def archive(self, request, queryset): Заархивировать пары - def unarchive(self, request, queryset): Разархивировать пары <|skeleton|> class LessonAdmin: def archive(s...
f9dfb82d795e4367b74dfd0d9f88a5fc082a5e53
<|skeleton|> class LessonAdmin: def archive(self, request, queryset): """Заархивировать пары""" <|body_0|> def unarchive(self, request, queryset): """Разархивировать пары""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LessonAdmin: def archive(self, request, queryset): """Заархивировать пары""" row_update = queryset.update(archived=False) if row_update == '1': msg = 'Была заархивирована 1 пара' else: msg = f'Были заархивированы {row_update} пар(/ы)' self.messag...
the_stack_v2_python_sparse
schedule/admin.py
Marik28/univer_api
train
0
5b46c3ee5beb97f0cc2cb2251ea23c1ee3bee172
[ "skeinforge_profile.addListsToCraftTypeRepository('skeinforge_application.skeinforge_plugins.craft_plugins.feed.html', self)\nself.fileNameInput = settings.FileNameInput().getFromFileName(fabmetheus_interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File for Feed', self, '')\nself.activateFeed = settings.Boolea...
<|body_start_0|> skeinforge_profile.addListsToCraftTypeRepository('skeinforge_application.skeinforge_plugins.craft_plugins.feed.html', self) self.fileNameInput = settings.FileNameInput().getFromFileName(fabmetheus_interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File for Feed', self, '') s...
A class to handle the feed settings.
FeedRepository
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FeedRepository: """A class to handle the feed settings.""" def __init__(self): """Set the default settings, execute title & settings fileName.""" <|body_0|> def execute(self): """Feed button has been clicked.""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_75kplus_train_067668
6,966
no_license
[ { "docstring": "Set the default settings, execute title & settings fileName.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Feed button has been clicked.", "name": "execute", "signature": "def execute(self)" } ]
2
null
Implement the Python class `FeedRepository` described below. Class description: A class to handle the feed settings. Method signatures and docstrings: - def __init__(self): Set the default settings, execute title & settings fileName. - def execute(self): Feed button has been clicked.
Implement the Python class `FeedRepository` described below. Class description: A class to handle the feed settings. Method signatures and docstrings: - def __init__(self): Set the default settings, execute title & settings fileName. - def execute(self): Feed button has been clicked. <|skeleton|> class FeedRepositor...
c1b00a76f1550df2cbb457248205159e51fd4308
<|skeleton|> class FeedRepository: """A class to handle the feed settings.""" def __init__(self): """Set the default settings, execute title & settings fileName.""" <|body_0|> def execute(self): """Feed button has been clicked.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FeedRepository: """A class to handle the feed settings.""" def __init__(self): """Set the default settings, execute title & settings fileName.""" skeinforge_profile.addListsToCraftTypeRepository('skeinforge_application.skeinforge_plugins.craft_plugins.feed.html', self) self.fileNa...
the_stack_v2_python_sparse
skeinforge_application/skeinforge_plugins/craft_plugins/feed.py
amsler/skeinforge
train
10
7611ea96121ce2d49e363ff7e31acec61cf009f7
[ "new_grouping = Grouping()\nnew_grouping.student = request.data['student']\nnew_grouping.employee = request.data['employee']\nnew_grouping.start_date = request.data['start_date']\nnew_grouping.end_date = request.data['end_date']\nnew_grouping.save()\nserializer = GroupingSerializer(new_grouping, context={'request':...
<|body_start_0|> new_grouping = Grouping() new_grouping.student = request.data['student'] new_grouping.employee = request.data['employee'] new_grouping.start_date = request.data['start_date'] new_grouping.end_date = request.data['end_date'] new_grouping.save() ser...
Groupings
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Groupings: def create(self, request): """Handle POST operations Returns: Response -- JSON serialized equipment instance""" <|body_0|> def retrieve(self, request, pk=None): """Handle GET requests for single equipment""" <|body_1|> def destroy(self, reques...
stack_v2_sparse_classes_75kplus_train_067669
2,882
no_license
[ { "docstring": "Handle POST operations Returns: Response -- JSON serialized equipment instance", "name": "create", "signature": "def create(self, request)" }, { "docstring": "Handle GET requests for single equipment", "name": "retrieve", "signature": "def retrieve(self, request, pk=None)...
4
stack_v2_sparse_classes_30k_train_049055
Implement the Python class `Groupings` described below. Class description: Implement the Groupings class. Method signatures and docstrings: - def create(self, request): Handle POST operations Returns: Response -- JSON serialized equipment instance - def retrieve(self, request, pk=None): Handle GET requests for single...
Implement the Python class `Groupings` described below. Class description: Implement the Groupings class. Method signatures and docstrings: - def create(self, request): Handle POST operations Returns: Response -- JSON serialized equipment instance - def retrieve(self, request, pk=None): Handle GET requests for single...
640979a97e6efcbab6f20dbff5dbd41e4f77c021
<|skeleton|> class Groupings: def create(self, request): """Handle POST operations Returns: Response -- JSON serialized equipment instance""" <|body_0|> def retrieve(self, request, pk=None): """Handle GET requests for single equipment""" <|body_1|> def destroy(self, reques...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Groupings: def create(self, request): """Handle POST operations Returns: Response -- JSON serialized equipment instance""" new_grouping = Grouping() new_grouping.student = request.data['student'] new_grouping.employee = request.data['employee'] new_grouping.start_date =...
the_stack_v2_python_sparse
capstoneapi/views/grouping.py
medlenmage/capstonebackend
train
0
5b67436c74d98a0caf2670889c0dc81bf8b5a7b3
[ "self._validate_perm(request.user.username, project_id, cluster_id, None, DashboardAction.View)\nclient = CustomResourceDefinition(request.ctx_cluster)\nresponse_data = ListApiRespBuilder(client).build()\nreturn Response(response_data)", "self._validate_perm(request.user.username, project_id, cluster_id, None, Da...
<|body_start_0|> self._validate_perm(request.user.username, project_id, cluster_id, None, DashboardAction.View) client = CustomResourceDefinition(request.ctx_cluster) response_data = ListApiRespBuilder(client).build() return Response(response_data) <|end_body_0|> <|body_start_1|> ...
自定义资源定义
CRDViewSet
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "CC0-1.0", "BSD-3-Clause", "ISC", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CRDViewSet: """自定义资源定义""" def list(self, request, project_id, cluster_id): """获取所有自定义资源列表""" <|body_0|> def retrieve(self, request, project_id, cluster_id, crd_name): """获取单个自定义资源详情""" <|body_1|> <|end_skeleton|> <|body_start_0|> self._validate_...
stack_v2_sparse_classes_75kplus_train_067670
9,014
permissive
[ { "docstring": "获取所有自定义资源列表", "name": "list", "signature": "def list(self, request, project_id, cluster_id)" }, { "docstring": "获取单个自定义资源详情", "name": "retrieve", "signature": "def retrieve(self, request, project_id, cluster_id, crd_name)" } ]
2
null
Implement the Python class `CRDViewSet` described below. Class description: 自定义资源定义 Method signatures and docstrings: - def list(self, request, project_id, cluster_id): 获取所有自定义资源列表 - def retrieve(self, request, project_id, cluster_id, crd_name): 获取单个自定义资源详情
Implement the Python class `CRDViewSet` described below. Class description: 自定义资源定义 Method signatures and docstrings: - def list(self, request, project_id, cluster_id): 获取所有自定义资源列表 - def retrieve(self, request, project_id, cluster_id, crd_name): 获取单个自定义资源详情 <|skeleton|> class CRDViewSet: """自定义资源定义""" def l...
859a415ef35ea1c01f0ed040956afa849a4cb7be
<|skeleton|> class CRDViewSet: """自定义资源定义""" def list(self, request, project_id, cluster_id): """获取所有自定义资源列表""" <|body_0|> def retrieve(self, request, project_id, cluster_id, crd_name): """获取单个自定义资源详情""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CRDViewSet: """自定义资源定义""" def list(self, request, project_id, cluster_id): """获取所有自定义资源列表""" self._validate_perm(request.user.username, project_id, cluster_id, None, DashboardAction.View) client = CustomResourceDefinition(request.ctx_cluster) response_data = ListApiRespBui...
the_stack_v2_python_sparse
bcs-ui/backend/dashboard/custom_object_v2/views.py
DeveloperJim/bk-bcs
train
5
c27875be53bfd0cfd53c72f1e5aa11975c794404
[ "password = self.cleaned_data['password']\npassword_repeat = self.cleaned_data['password_repeat']\nif password_repeat != password:\n raise forms.ValidationError('La contraseña no coincide')\nreturn password_repeat", "cedula = self.cleaned_data['cedula']\nif validate_cedula(cedula):\n raise forms.ValidationE...
<|body_start_0|> password = self.cleaned_data['password'] password_repeat = self.cleaned_data['password_repeat'] if password_repeat != password: raise forms.ValidationError('La contraseña no coincide') return password_repeat <|end_body_0|> <|body_start_1|> cedula = s...
! Formulario de Registro para la API @author Antonio Araujo (aaraujo at cenditel.gob.ve) @author Rodrigo Boet (rboet at cenditel.gob.ve) @copyright <a href='https://www.gnu.org/licenses/gpl-3.0.en.html'>GNU Public License versión 3 (GPLv3)</a> @date 19-09-2017 @version 1.0.0
UserForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserForm: """! Formulario de Registro para la API @author Antonio Araujo (aaraujo at cenditel.gob.ve) @author Rodrigo Boet (rboet at cenditel.gob.ve) @copyright <a href='https://www.gnu.org/licenses/gpl-3.0.en.html'>GNU Public License versión 3 (GPLv3)</a> @date 19-09-2017 @version 1.0.0""" ...
stack_v2_sparse_classes_75kplus_train_067671
15,690
no_license
[ { "docstring": "! Método que valida si las contraseñas coinciden @author Rodrigo Boet (rboet at cenditel.gob.ve) @copyright GNU/GPLv2 @date 01-03-2017 @param self <b>{object}</b> Objeto que instancia la clase @return Retorna el campo con la validacion", "name": "clean_password_repeat", "signature": "def...
4
stack_v2_sparse_classes_30k_train_050871
Implement the Python class `UserForm` described below. Class description: ! Formulario de Registro para la API @author Antonio Araujo (aaraujo at cenditel.gob.ve) @author Rodrigo Boet (rboet at cenditel.gob.ve) @copyright <a href='https://www.gnu.org/licenses/gpl-3.0.en.html'>GNU Public License versión 3 (GPLv3)</a> @...
Implement the Python class `UserForm` described below. Class description: ! Formulario de Registro para la API @author Antonio Araujo (aaraujo at cenditel.gob.ve) @author Rodrigo Boet (rboet at cenditel.gob.ve) @copyright <a href='https://www.gnu.org/licenses/gpl-3.0.en.html'>GNU Public License versión 3 (GPLv3)</a> @...
93cefc3c94c62e66b103510a2f668a419e5c5cae
<|skeleton|> class UserForm: """! Formulario de Registro para la API @author Antonio Araujo (aaraujo at cenditel.gob.ve) @author Rodrigo Boet (rboet at cenditel.gob.ve) @copyright <a href='https://www.gnu.org/licenses/gpl-3.0.en.html'>GNU Public License versión 3 (GPLv3)</a> @date 19-09-2017 @version 1.0.0""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserForm: """! Formulario de Registro para la API @author Antonio Araujo (aaraujo at cenditel.gob.ve) @author Rodrigo Boet (rboet at cenditel.gob.ve) @copyright <a href='https://www.gnu.org/licenses/gpl-3.0.en.html'>GNU Public License versión 3 (GPLv3)</a> @date 19-09-2017 @version 1.0.0""" def clean_pas...
the_stack_v2_python_sparse
users/forms.py
rudmanmrrod/gestor_consulta
train
1
cf5f58d2facfaba8079acc45d8d726aacda7dd7e
[ "if not nums:\n return 0\ndp = [[0 for _ in range(2)] for _ in range(2)]\ndp[0][1], dp[0][0], res = (nums[0], nums[0], nums[0])\nfor i in range(1, len(nums)):\n x, y = (i % 2, (i - 1) % 2)\n dp[x][0] = max(dp[y][0] * nums[i], dp[y][1] * nums[i], nums[i])\n dp[x][1] = min(dp[y][0] * nums[i], dp[y][1] * n...
<|body_start_0|> if not nums: return 0 dp = [[0 for _ in range(2)] for _ in range(2)] dp[0][1], dp[0][0], res = (nums[0], nums[0], nums[0]) for i in range(1, len(nums)): x, y = (i % 2, (i - 1) % 2) dp[x][0] = max(dp[y][0] * nums[i], dp[y][1] * nums[i],...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProduct1(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def maxProduct(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not nums: return 0 dp =...
stack_v2_sparse_classes_75kplus_train_067672
1,717
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "maxProduct1", "signature": "def maxProduct1(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "maxProduct", "signature": "def maxProduct(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProduct1(self, nums): :type nums: List[int] :rtype: int - def maxProduct(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 maxProduct1(self, nums): :type nums: List[int] :rtype: int - def maxProduct(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def maxProduct1(...
aa285d16bc96d30a632fae5c7578d0e7a5f51e7c
<|skeleton|> class Solution: def maxProduct1(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def maxProduct(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def maxProduct1(self, nums): """:type nums: List[int] :rtype: int""" if not nums: return 0 dp = [[0 for _ in range(2)] for _ in range(2)] dp[0][1], dp[0][0], res = (nums[0], nums[0], nums[0]) for i in range(1, len(nums)): x, y = (i % 2,...
the_stack_v2_python_sparse
package_101_200/package_141_160/152. Maximum Product Subarray.py
morindaz/leecode_morindaz
train
4
4909ef970a4dfeec5c2ca464b732514312046901
[ "self.namespace = namespace\n\ndef call_get_storage_key(context):\n key = self.get_storage_key(context)\n if key is None:\n raise AttributeError(self.no_key_error_message)\n else:\n return key\nsuper(UserState, self).__init__(storage, 'UserState')", "activity = context.activity\nchannel_id ...
<|body_start_0|> self.namespace = namespace def call_get_storage_key(context): key = self.get_storage_key(context) if key is None: raise AttributeError(self.no_key_error_message) else: return key super(UserState, self).__init__...
Reads and writes user state for your bot to storage.
UserState
[ "MIT", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserState: """Reads and writes user state for your bot to storage.""" def __init__(self, storage: Storage, namespace=''): """Creates a new UserState instance. :param storage: :param namespace:""" <|body_0|> def get_storage_key(self, context: TurnContext) -> str: ...
stack_v2_sparse_classes_75kplus_train_067673
1,444
permissive
[ { "docstring": "Creates a new UserState instance. :param storage: :param namespace:", "name": "__init__", "signature": "def __init__(self, storage: Storage, namespace='')" }, { "docstring": "Returns the storage key for the current user state. :param context: :return:", "name": "get_storage_k...
2
stack_v2_sparse_classes_30k_train_021945
Implement the Python class `UserState` described below. Class description: Reads and writes user state for your bot to storage. Method signatures and docstrings: - def __init__(self, storage: Storage, namespace=''): Creates a new UserState instance. :param storage: :param namespace: - def get_storage_key(self, contex...
Implement the Python class `UserState` described below. Class description: Reads and writes user state for your bot to storage. Method signatures and docstrings: - def __init__(self, storage: Storage, namespace=''): Creates a new UserState instance. :param storage: :param namespace: - def get_storage_key(self, contex...
bcc85a49f1426ccf682205566fd03937ee6d315c
<|skeleton|> class UserState: """Reads and writes user state for your bot to storage.""" def __init__(self, storage: Storage, namespace=''): """Creates a new UserState instance. :param storage: :param namespace:""" <|body_0|> def get_storage_key(self, context: TurnContext) -> str: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserState: """Reads and writes user state for your bot to storage.""" def __init__(self, storage: Storage, namespace=''): """Creates a new UserState instance. :param storage: :param namespace:""" self.namespace = namespace def call_get_storage_key(context): key = self...
the_stack_v2_python_sparse
libraries/botbuilder-core/botbuilder/core/user_state.py
zigri2612/botbuilder-python
train
1
a740ab51a24397adceb53ccaa891a0e4e5ea9d18
[ "filters = {}\nts_model = self.model.timesheet.field.rel.to\nstatus = querystring.get('status')\nif status == 'approved':\n filters['timesheet__status'] = ts_model.STATUS_APPROVED\nelif status == 'issued':\n filters['timesheet__status'] = ts_model.STATUS_ISSUED\ndate_start = querystring.get('from_date')\ndate...
<|body_start_0|> filters = {} ts_model = self.model.timesheet.field.rel.to status = querystring.get('status') if status == 'approved': filters['timesheet__status'] = ts_model.STATUS_APPROVED elif status == 'issued': filters['timesheet__status'] = ts_model....
WorkLogQuerySet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkLogQuerySet: def filter_for_querystring(self, querystring): """Apply a bunch of filters according to the passed querystring.""" <|body_0|> def group_for_querystring(self, main_groups): """Apply a bunch of group_bys according to the passed querystring.""" ...
stack_v2_sparse_classes_75kplus_train_067674
2,351
no_license
[ { "docstring": "Apply a bunch of filters according to the passed querystring.", "name": "filter_for_querystring", "signature": "def filter_for_querystring(self, querystring)" }, { "docstring": "Apply a bunch of group_bys according to the passed querystring.", "name": "group_for_querystring",...
2
stack_v2_sparse_classes_30k_train_008503
Implement the Python class `WorkLogQuerySet` described below. Class description: Implement the WorkLogQuerySet class. Method signatures and docstrings: - def filter_for_querystring(self, querystring): Apply a bunch of filters according to the passed querystring. - def group_for_querystring(self, main_groups): Apply a...
Implement the Python class `WorkLogQuerySet` described below. Class description: Implement the WorkLogQuerySet class. Method signatures and docstrings: - def filter_for_querystring(self, querystring): Apply a bunch of filters according to the passed querystring. - def group_for_querystring(self, main_groups): Apply a...
4dcf0e6a37e8753ae9d69d663c0c280fcca0a26c
<|skeleton|> class WorkLogQuerySet: def filter_for_querystring(self, querystring): """Apply a bunch of filters according to the passed querystring.""" <|body_0|> def group_for_querystring(self, main_groups): """Apply a bunch of group_bys according to the passed querystring.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WorkLogQuerySet: def filter_for_querystring(self, querystring): """Apply a bunch of filters according to the passed querystring.""" filters = {} ts_model = self.model.timesheet.field.rel.to status = querystring.get('status') if status == 'approved': filters[...
the_stack_v2_python_sparse
apps/deployment/query.py
ESCL/pjtracker
train
1
5b186c322c227e4b43cb3d23140285875cf69ec2
[ "contents = file_prefix.string_io()\nwhile True:\n line = contents.readline()\n if line is None or not line.startswith('<?'):\n break\npattern = '^<(\\\\w*:)?%s' % self.root\nreturn line is not None and re.match(pattern, line) is not None", "if not dataset.dataset.purged:\n dataset.peek = data.get...
<|body_start_0|> contents = file_prefix.string_io() while True: line = contents.readline() if line is None or not line.startswith('<?'): break pattern = '^<(\\w*:)?%s' % self.root return line is not None and re.match(pattern, line) is not None <|en...
An enhanced XML datatype used to reuse code across several proteomic/mass-spec datatypes.
ProteomicsXml
[ "CC-BY-2.5", "AFL-2.1", "AFL-3.0", "CC-BY-3.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProteomicsXml: """An enhanced XML datatype used to reuse code across several proteomic/mass-spec datatypes.""" def sniff_prefix(self, file_prefix): """Determines whether the file is the correct XML type.""" <|body_0|> def set_peek(self, dataset, is_multi_byte=False): ...
stack_v2_sparse_classes_75kplus_train_067675
17,692
permissive
[ { "docstring": "Determines whether the file is the correct XML type.", "name": "sniff_prefix", "signature": "def sniff_prefix(self, file_prefix)" }, { "docstring": "Set the peek and blurb text", "name": "set_peek", "signature": "def set_peek(self, dataset, is_multi_byte=False)" } ]
2
null
Implement the Python class `ProteomicsXml` described below. Class description: An enhanced XML datatype used to reuse code across several proteomic/mass-spec datatypes. Method signatures and docstrings: - def sniff_prefix(self, file_prefix): Determines whether the file is the correct XML type. - def set_peek(self, da...
Implement the Python class `ProteomicsXml` described below. Class description: An enhanced XML datatype used to reuse code across several proteomic/mass-spec datatypes. Method signatures and docstrings: - def sniff_prefix(self, file_prefix): Determines whether the file is the correct XML type. - def set_peek(self, da...
d194520fdfe08e48c0b3d0d2299cd2adcb8f5952
<|skeleton|> class ProteomicsXml: """An enhanced XML datatype used to reuse code across several proteomic/mass-spec datatypes.""" def sniff_prefix(self, file_prefix): """Determines whether the file is the correct XML type.""" <|body_0|> def set_peek(self, dataset, is_multi_byte=False): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProteomicsXml: """An enhanced XML datatype used to reuse code across several proteomic/mass-spec datatypes.""" def sniff_prefix(self, file_prefix): """Determines whether the file is the correct XML type.""" contents = file_prefix.string_io() while True: line = contents...
the_stack_v2_python_sparse
lib/galaxy/datatypes/proteomics.py
bwlang/galaxy
train
0
84fdc216ac729bf8994f83bebcfbe0d1d5b566c5
[ "try:\n self.teaClass = []\n self.sqlhandler = None\n if not utils.isUIDValid(self):\n self.write('no uid')\n return\n if self.getTeaClass():\n self.write(json.dumps(self.teaClass) if len(self.teaClass) != 0 else '[]')\n self.finish()\n else:\n raise RuntimeError\ne...
<|body_start_0|> try: self.teaClass = [] self.sqlhandler = None if not utils.isUIDValid(self): self.write('no uid') return if self.getTeaClass(): self.write(json.dumps(self.teaClass) if len(self.teaClass) != 0 else '...
TeaGetClassListRequestHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TeaGetClassListRequestHandler: def get(self): """获取练习题列表,返回给老师客户端""" <|body_0|> def getTeaClass(self): """返回老师的习题列表""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: self.teaClass = [] self.sqlhandler = None if...
stack_v2_sparse_classes_75kplus_train_067676
2,430
no_license
[ { "docstring": "获取练习题列表,返回给老师客户端", "name": "get", "signature": "def get(self)" }, { "docstring": "返回老师的习题列表", "name": "getTeaClass", "signature": "def getTeaClass(self)" } ]
2
stack_v2_sparse_classes_30k_train_010670
Implement the Python class `TeaGetClassListRequestHandler` described below. Class description: Implement the TeaGetClassListRequestHandler class. Method signatures and docstrings: - def get(self): 获取练习题列表,返回给老师客户端 - def getTeaClass(self): 返回老师的习题列表
Implement the Python class `TeaGetClassListRequestHandler` described below. Class description: Implement the TeaGetClassListRequestHandler class. Method signatures and docstrings: - def get(self): 获取练习题列表,返回给老师客户端 - def getTeaClass(self): 返回老师的习题列表 <|skeleton|> class TeaGetClassListRequestHandler: def get(self)...
b28eb4163b02bd0a931653b94851592f2654b199
<|skeleton|> class TeaGetClassListRequestHandler: def get(self): """获取练习题列表,返回给老师客户端""" <|body_0|> def getTeaClass(self): """返回老师的习题列表""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TeaGetClassListRequestHandler: def get(self): """获取练习题列表,返回给老师客户端""" try: self.teaClass = [] self.sqlhandler = None if not utils.isUIDValid(self): self.write('no uid') return if self.getTeaClass(): ...
the_stack_v2_python_sparse
server/teacher/TeaGetClassListRequestHandler.py
lyh-ADT/edu-app
train
1
87d8af001e1e793d176229143164fffc74e88989
[ "super(DeepDiscreteActor, self).__init__()\nself.device = device\nself.layer1 = torch.nn.Sequential(torch.nn.Conv2d(input_shape[2], 32, 8, stride=4, padding=0), torch.nn.ReLU())\nself.layer2 = torch.nn.Sequential(torch.nn.Conv2d(32, 64, 3, stride=2, padding=0), torch.nn.ReLU())\nself.layer3 = torch.nn.Sequential(to...
<|body_start_0|> super(DeepDiscreteActor, self).__init__() self.device = device self.layer1 = torch.nn.Sequential(torch.nn.Conv2d(input_shape[2], 32, 8, stride=4, padding=0), torch.nn.ReLU()) self.layer2 = torch.nn.Sequential(torch.nn.Conv2d(32, 64, 3, stride=2, padding=0), torch.nn.ReLU...
DeepDiscreteActor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeepDiscreteActor: def __init__(self, input_shape, output_shape, device=torch.device('cpu')): """Una red neorunal convolucional profunda que utilizará una función logística para discriminar la acción del espacio de acciones discreto usando una CNN. Se utiliza para representar el papel de...
stack_v2_sparse_classes_75kplus_train_067677
8,297
permissive
[ { "docstring": "Una red neorunal convolucional profunda que utilizará una función logística para discriminar la acción del espacio de acciones discreto usando una CNN. Se utiliza para representar el papel del actor en A2C. :param input_shape: Forma de los datos de entrada (representan las observaciones del acto...
2
stack_v2_sparse_classes_30k_train_027425
Implement the Python class `DeepDiscreteActor` described below. Class description: Implement the DeepDiscreteActor class. Method signatures and docstrings: - def __init__(self, input_shape, output_shape, device=torch.device('cpu')): Una red neorunal convolucional profunda que utilizará una función logística para disc...
Implement the Python class `DeepDiscreteActor` described below. Class description: Implement the DeepDiscreteActor class. Method signatures and docstrings: - def __init__(self, input_shape, output_shape, device=torch.device('cpu')): Una red neorunal convolucional profunda que utilizará una función logística para disc...
5e987fac269afcb8f43aa9da1d07e34e1e036948
<|skeleton|> class DeepDiscreteActor: def __init__(self, input_shape, output_shape, device=torch.device('cpu')): """Una red neorunal convolucional profunda que utilizará una función logística para discriminar la acción del espacio de acciones discreto usando una CNN. Se utiliza para representar el papel de...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DeepDiscreteActor: def __init__(self, input_shape, output_shape, device=torch.device('cpu')): """Una red neorunal convolucional profunda que utilizará una función logística para discriminar la acción del espacio de acciones discreto usando una CNN. Se utiliza para representar el papel del actor en A2C...
the_stack_v2_python_sparse
tema5/function_aproximator/deep.py
dabamascodes/ia-course
train
1
ce8cfea56d093523232c421dd323a9133ec30a75
[ "if len(digits) == 0:\n return []\nletters = ['', '', 'abc', 'def', 'ghi', 'jkl', 'mno', 'pqrs', 'tuv', 'wxyz']\nret = []\n\ndef go(current_s, nxt_digits_idx):\n if nxt_digits_idx == len(digits):\n ret.append(current_s)\n return\n for nxt_c in letters[int(digits[nxt_digits_idx])]:\n go...
<|body_start_0|> if len(digits) == 0: return [] letters = ['', '', 'abc', 'def', 'ghi', 'jkl', 'mno', 'pqrs', 'tuv', 'wxyz'] ret = [] def go(current_s, nxt_digits_idx): if nxt_digits_idx == len(digits): ret.append(current_s) return...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def letterCombinations(self, digits): """:type digits: str :rtype: List[str]""" <|body_0|> def letterCombinationsString(self, digits): """:type digits: str :rtype: List[str]""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(digits) ==...
stack_v2_sparse_classes_75kplus_train_067678
1,174
no_license
[ { "docstring": ":type digits: str :rtype: List[str]", "name": "letterCombinations", "signature": "def letterCombinations(self, digits)" }, { "docstring": ":type digits: str :rtype: List[str]", "name": "letterCombinationsString", "signature": "def letterCombinationsString(self, digits)" ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def letterCombinations(self, digits): :type digits: str :rtype: List[str] - def letterCombinationsString(self, digits): :type digits: str :rtype: List[str]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def letterCombinations(self, digits): :type digits: str :rtype: List[str] - def letterCombinationsString(self, digits): :type digits: str :rtype: List[str] <|skeleton|> class So...
ac53dd9bf2c4c9d17c9dc5f7fdda32e386658fdd
<|skeleton|> class Solution: def letterCombinations(self, digits): """:type digits: str :rtype: List[str]""" <|body_0|> def letterCombinationsString(self, digits): """:type digits: str :rtype: List[str]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def letterCombinations(self, digits): """:type digits: str :rtype: List[str]""" if len(digits) == 0: return [] letters = ['', '', 'abc', 'def', 'ghi', 'jkl', 'mno', 'pqrs', 'tuv', 'wxyz'] ret = [] def go(current_s, nxt_digits_idx): if ...
the_stack_v2_python_sparse
cs_notes/backtracking/letter_combinations_of_a_phone_number.py
hwc1824/LeetCodeSolution
train
0
99a7e9e05edfb1e381a22f2708ee162206fa45fe
[ "if end > start:\n mid = (start + end) // 2\n self.mergeSort(arr, start, mid)\n self.mergeSort(arr, mid + 1, end)\n self.merge(arr, start, mid, end)\n print('start={}, mid={}, end={}\\narr={}'.format(start, mid, end, arr))", "left_start = start\nleft_end = mid\nright_start = mid + 1\nright_end = en...
<|body_start_0|> if end > start: mid = (start + end) // 2 self.mergeSort(arr, start, mid) self.mergeSort(arr, mid + 1, end) self.merge(arr, start, mid, end) print('start={}, mid={}, end={}\narr={}'.format(start, mid, end, arr)) <|end_body_0|> <|body_s...
Sort
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Sort: def mergeSort(self, arr, start, end): """分治子序列 arr[start:end + 1]""" <|body_0|> def merge(self, arr, start, mid, end): """合并有序的左子序列 arr[start:mid + 1] 与右子序列 arr[mid + 1:end + 1],并使之有序。""" <|body_1|> <|end_skeleton|> <|body_start_0|> if end > s...
stack_v2_sparse_classes_75kplus_train_067679
2,057
permissive
[ { "docstring": "分治子序列 arr[start:end + 1]", "name": "mergeSort", "signature": "def mergeSort(self, arr, start, end)" }, { "docstring": "合并有序的左子序列 arr[start:mid + 1] 与右子序列 arr[mid + 1:end + 1],并使之有序。", "name": "merge", "signature": "def merge(self, arr, start, mid, end)" } ]
2
null
Implement the Python class `Sort` described below. Class description: Implement the Sort class. Method signatures and docstrings: - def mergeSort(self, arr, start, end): 分治子序列 arr[start:end + 1] - def merge(self, arr, start, mid, end): 合并有序的左子序列 arr[start:mid + 1] 与右子序列 arr[mid + 1:end + 1],并使之有序。
Implement the Python class `Sort` described below. Class description: Implement the Sort class. Method signatures and docstrings: - def mergeSort(self, arr, start, end): 分治子序列 arr[start:end + 1] - def merge(self, arr, start, mid, end): 合并有序的左子序列 arr[start:mid + 1] 与右子序列 arr[mid + 1:end + 1],并使之有序。 <|skeleton|> class...
889d8fa489f1f2719c5a0dafd3ae51df7b4bf978
<|skeleton|> class Sort: def mergeSort(self, arr, start, end): """分治子序列 arr[start:end + 1]""" <|body_0|> def merge(self, arr, start, mid, end): """合并有序的左子序列 arr[start:mid + 1] 与右子序列 arr[mid + 1:end + 1],并使之有序。""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Sort: def mergeSort(self, arr, start, end): """分治子序列 arr[start:end + 1]""" if end > start: mid = (start + end) // 2 self.mergeSort(arr, start, mid) self.mergeSort(arr, mid + 1, end) self.merge(arr, start, mid, end) print('start={}, mi...
the_stack_v2_python_sparse
dataStructure/sort/mergeSort.py
jinbooooom/coding-for-algorithms
train
14
394828d907cf0f2b3ee48f0e5351684adb771078
[ "assert bias.shape[0] == 4\nassert weight_hh.shape[0] == 4\nassert weight_hh.shape[1] == 1\nself.hidden_size: int = 1\nself.input_size: int = input_size\nself.bias: np.ndarray = bias\nself.weight_hh: np.ndarray = weight_hh\nself.weight_xh: np.ndarray = weight_xh\nself.hx: np.ndarray = np.asarray([])\nself.c: np.nda...
<|body_start_0|> assert bias.shape[0] == 4 assert weight_hh.shape[0] == 4 assert weight_hh.shape[1] == 1 self.hidden_size: int = 1 self.input_size: int = input_size self.bias: np.ndarray = bias self.weight_hh: np.ndarray = weight_hh self.weight_xh: np.ndar...
Custom implementation of the single LSTM-cell.
LSTMCell
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LSTMCell: """Custom implementation of the single LSTM-cell.""" def __init__(self, input_size: int, bias: np.ndarray, weight_hh: np.ndarray, weight_xh: np.ndarray): """Create the LSTM-cell with the provided parameters. :param input_size: Number of inputs going into the cell :param bia...
stack_v2_sparse_classes_75kplus_train_067680
2,345
permissive
[ { "docstring": "Create the LSTM-cell with the provided parameters. :param input_size: Number of inputs going into the cell :param bias: Bias-vector from each of the internal nodes :param weight_hh: Weight-vector from hidden to hidden states :param weight_xh: Weight-vector from input to hidden states", "name...
2
stack_v2_sparse_classes_30k_train_016575
Implement the Python class `LSTMCell` described below. Class description: Custom implementation of the single LSTM-cell. Method signatures and docstrings: - def __init__(self, input_size: int, bias: np.ndarray, weight_hh: np.ndarray, weight_xh: np.ndarray): Create the LSTM-cell with the provided parameters. :param in...
Implement the Python class `LSTMCell` described below. Class description: Custom implementation of the single LSTM-cell. Method signatures and docstrings: - def __init__(self, input_size: int, bias: np.ndarray, weight_hh: np.ndarray, weight_xh: np.ndarray): Create the LSTM-cell with the provided parameters. :param in...
818a4ce941536611c0f1780f7c4a6238f0e1884e
<|skeleton|> class LSTMCell: """Custom implementation of the single LSTM-cell.""" def __init__(self, input_size: int, bias: np.ndarray, weight_hh: np.ndarray, weight_xh: np.ndarray): """Create the LSTM-cell with the provided parameters. :param input_size: Number of inputs going into the cell :param bia...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LSTMCell: """Custom implementation of the single LSTM-cell.""" def __init__(self, input_size: int, bias: np.ndarray, weight_hh: np.ndarray, weight_xh: np.ndarray): """Create the LSTM-cell with the provided parameters. :param input_size: Number of inputs going into the cell :param bias: Bias-vecto...
the_stack_v2_python_sparse
population/utils/rnn_cell_util/lstm.py
RubenPants/EvolvableRNN
train
1
19e4fc9460815b206f011efa53c505e10a0b0432
[ "if num <= 0 or data.empty:\n return []\nmean = sum(data) / len(data)\nbreaks = [mean] + self._classify(data[data < mean], num - 1) + self._classify(data[data >= mean], num - 1)\nreturn breaks", "if len(data) < number_of_classes:\n return [min(data), max(data)]\nbreaks = [min(data), max(data)] + self._class...
<|body_start_0|> if num <= 0 or data.empty: return [] mean = sum(data) / len(data) breaks = [mean] + self._classify(data[data < mean], num - 1) + self._classify(data[data >= mean], num - 1) return breaks <|end_body_0|> <|body_start_1|> if len(data) < number_of_classe...
NestedMeans
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NestedMeans: def _classify(self, data, num): """recursive helper function of nested-means""" <|body_0|> def classify(self, data, number_of_classes=4): """Data is divided by nested-means. :param data: values to bin :param number_of_classes: divide values into this man...
stack_v2_sparse_classes_75kplus_train_067681
3,573
no_license
[ { "docstring": "recursive helper function of nested-means", "name": "_classify", "signature": "def _classify(self, data, num)" }, { "docstring": "Data is divided by nested-means. :param data: values to bin :param number_of_classes: divide values into this many bins, has to be a power of 2", ...
2
stack_v2_sparse_classes_30k_train_036709
Implement the Python class `NestedMeans` described below. Class description: Implement the NestedMeans class. Method signatures and docstrings: - def _classify(self, data, num): recursive helper function of nested-means - def classify(self, data, number_of_classes=4): Data is divided by nested-means. :param data: val...
Implement the Python class `NestedMeans` described below. Class description: Implement the NestedMeans class. Method signatures and docstrings: - def _classify(self, data, num): recursive helper function of nested-means - def classify(self, data, number_of_classes=4): Data is divided by nested-means. :param data: val...
a915b47b85494879b3cf74cb102088dea7753146
<|skeleton|> class NestedMeans: def _classify(self, data, num): """recursive helper function of nested-means""" <|body_0|> def classify(self, data, number_of_classes=4): """Data is divided by nested-means. :param data: values to bin :param number_of_classes: divide values into this man...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NestedMeans: def _classify(self, data, num): """recursive helper function of nested-means""" if num <= 0 or data.empty: return [] mean = sum(data) / len(data) breaks = [mean] + self._classify(data[data < mean], num - 1) + self._classify(data[data >= mean], num - 1) ...
the_stack_v2_python_sparse
libs/classification_methods.py
dionysio/SlepemapyAnalysis
train
0
7534ec5ecc67dc1d91ba1d96e64a77ce0bdcf492
[ "super(EncoderCNN, self).__init__()\nself.img_ext_model = img_ext_model\nif img_ext_model == 'resnet':\n resnet = models.resnet152(pretrained=True)\n modules = list(resnet.children())[:-1]\n self.img_ext = nn.Sequential(*modules)\nelif self.img_ext_model == 'complex_resnet':\n resnet = models.resnet101(...
<|body_start_0|> super(EncoderCNN, self).__init__() self.img_ext_model = img_ext_model if img_ext_model == 'resnet': resnet = models.resnet152(pretrained=True) modules = list(resnet.children())[:-1] self.img_ext = nn.Sequential(*modules) elif self.img_...
EncoderCNN
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncoderCNN: def __init__(self, img_ext_model): """Load the pretrained ResNet-152 and replace top fc layer.""" <|body_0|> def forward(self, images): """Extract feature vectors from input images.""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(E...
stack_v2_sparse_classes_75kplus_train_067682
1,662
permissive
[ { "docstring": "Load the pretrained ResNet-152 and replace top fc layer.", "name": "__init__", "signature": "def __init__(self, img_ext_model)" }, { "docstring": "Extract feature vectors from input images.", "name": "forward", "signature": "def forward(self, images)" } ]
2
null
Implement the Python class `EncoderCNN` described below. Class description: Implement the EncoderCNN class. Method signatures and docstrings: - def __init__(self, img_ext_model): Load the pretrained ResNet-152 and replace top fc layer. - def forward(self, images): Extract feature vectors from input images.
Implement the Python class `EncoderCNN` described below. Class description: Implement the EncoderCNN class. Method signatures and docstrings: - def __init__(self, img_ext_model): Load the pretrained ResNet-152 and replace top fc layer. - def forward(self, images): Extract feature vectors from input images. <|skeleto...
4e8348283fad9a2a4c605959c79bc2922171b753
<|skeleton|> class EncoderCNN: def __init__(self, img_ext_model): """Load the pretrained ResNet-152 and replace top fc layer.""" <|body_0|> def forward(self, images): """Extract feature vectors from input images.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EncoderCNN: def __init__(self, img_ext_model): """Load the pretrained ResNet-152 and replace top fc layer.""" super(EncoderCNN, self).__init__() self.img_ext_model = img_ext_model if img_ext_model == 'resnet': resnet = models.resnet152(pretrained=True) m...
the_stack_v2_python_sparse
ext_feats/infer_visual_feat/model.py
yuewang-cuhk/CMKP
train
22
1cfa58eb3c2ce4ffcc8b347603fdd842979abbee
[ "Parametre.__init__(self, 'voir', 'view')\nself.schema = '<cle>'\nself.aide_courte = 'visionne un banc particulier'\nself.aide_longue = \"Cette commande offre un affichage détaillé d'un banc de poisson.\"", "cle = dic_masques['cle'].cle\nif cle not in importeur.peche.bancs:\n personnage << \"|err|Ce banc n'exi...
<|body_start_0|> Parametre.__init__(self, 'voir', 'view') self.schema = '<cle>' self.aide_courte = 'visionne un banc particulier' self.aide_longue = "Cette commande offre un affichage détaillé d'un banc de poisson." <|end_body_0|> <|body_start_1|> cle = dic_masques['cle'].cle ...
Commande 'banc voir'.
PrmVoir
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrmVoir: """Commande 'banc voir'.""" def __init__(self): """Constructeur du paramètre""" <|body_0|> def interpreter(self, personnage, dic_masques): """Interprétation du paramètre""" <|body_1|> <|end_skeleton|> <|body_start_0|> Parametre.__init__...
stack_v2_sparse_classes_75kplus_train_067683
3,205
permissive
[ { "docstring": "Constructeur du paramètre", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Interprétation du paramètre", "name": "interpreter", "signature": "def interpreter(self, personnage, dic_masques)" } ]
2
stack_v2_sparse_classes_30k_train_032397
Implement the Python class `PrmVoir` described below. Class description: Commande 'banc voir'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre - def interpreter(self, personnage, dic_masques): Interprétation du paramètre
Implement the Python class `PrmVoir` described below. Class description: Commande 'banc voir'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre - def interpreter(self, personnage, dic_masques): Interprétation du paramètre <|skeleton|> class PrmVoir: """Commande 'banc voir'.""" ...
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class PrmVoir: """Commande 'banc voir'.""" def __init__(self): """Constructeur du paramètre""" <|body_0|> def interpreter(self, personnage, dic_masques): """Interprétation du paramètre""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PrmVoir: """Commande 'banc voir'.""" def __init__(self): """Constructeur du paramètre""" Parametre.__init__(self, 'voir', 'view') self.schema = '<cle>' self.aide_courte = 'visionne un banc particulier' self.aide_longue = "Cette commande offre un affichage détaillé ...
the_stack_v2_python_sparse
src/secondaires/peche/commandes/banc/voir.py
vincent-lg/tsunami
train
5
477b9f8e018061905403b3a844301cd94893fc3a
[ "maxsum = -float('inf')\nslow = 0\nwhile slow < len(nums):\n for fast in range(slow, len(nums)):\n tmp = sum(nums[slow:fast + 1])\n maxsum = max(maxsum, sum(nums[slow:fast + 1]))\n slow += 1\nreturn maxsum", "for i in range(1, len(nums)):\n nums[i] = nums[i] + max(nums[i - 1], 0)\nreturn ma...
<|body_start_0|> maxsum = -float('inf') slow = 0 while slow < len(nums): for fast in range(slow, len(nums)): tmp = sum(nums[slow:fast + 1]) maxsum = max(maxsum, sum(nums[slow:fast + 1])) slow += 1 return maxsum <|end_body_0|> <|bod...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSubArrayBrute(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def maxSubArray(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> maxsum = -float('inf') slow = 0 ...
stack_v2_sparse_classes_75kplus_train_067684
840
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "maxSubArrayBrute", "signature": "def maxSubArrayBrute(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "maxSubArray", "signature": "def maxSubArray(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_042949
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArrayBrute(self, nums): :type nums: List[int] :rtype: int - def maxSubArray(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 maxSubArrayBrute(self, nums): :type nums: List[int] :rtype: int - def maxSubArray(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def maxSub...
673fb7bb900e65844b68b5826a259eb6932c5fc4
<|skeleton|> class Solution: def maxSubArrayBrute(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def maxSubArray(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def maxSubArrayBrute(self, nums): """:type nums: List[int] :rtype: int""" maxsum = -float('inf') slow = 0 while slow < len(nums): for fast in range(slow, len(nums)): tmp = sum(nums[slow:fast + 1]) maxsum = max(maxsum, sum(nu...
the_stack_v2_python_sparse
53. Maximum Subarray.py
MysticEEEE/LeetCodeProblems
train
0
da5043827812397b259ce424fd45b1aaf199c515
[ "super().__init__(scales=scales, kernel=kernel, reduction=reduction, name=name)\nassert 0 <= neg_weight <= 1\nself.binary = binary\nself.neg_weight = neg_weight", "if self.binary:\n y_true = tf.cast(y_true >= 0.5, dtype=y_true.dtype)\n y_pred = tf.cast(y_pred >= 0.5, dtype=y_pred.dtype)\ny_true = tf.keras.l...
<|body_start_0|> super().__init__(scales=scales, kernel=kernel, reduction=reduction, name=name) assert 0 <= neg_weight <= 1 self.binary = binary self.neg_weight = neg_weight <|end_body_0|> <|body_start_1|> if self.binary: y_true = tf.cast(y_true >= 0.5, dtype=y_true....
Define dice score. The formulation is: 0. pos_w + neg_w = 1 1. let y_prod = y_true * y_pred and y_sum = y_true + y_pred 2. num = 2 * (pos_w * y_true * y_pred + neg_w * (1−y_true) * (1−y_pred)) = 2 * ((pos_w+neg_w) * y_prod - neg_w * y_sum + neg_w) = 2 * (y_prod - neg_w * y_sum + neg_w) 3. denom = (pos_w * (y_true + y_p...
DiceScore
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DiceScore: """Define dice score. The formulation is: 0. pos_w + neg_w = 1 1. let y_prod = y_true * y_pred and y_sum = y_true + y_pred 2. num = 2 * (pos_w * y_true * y_pred + neg_w * (1−y_true) * (1−y_pred)) = 2 * ((pos_w+neg_w) * y_prod - neg_w * y_sum + neg_w) = 2 * (y_prod - neg_w * y_sum + neg...
stack_v2_sparse_classes_75kplus_train_067685
13,758
permissive
[ { "docstring": "Init. :param binary: if True, project y_true, y_pred to 0 or 1. :param neg_weight: weight for negative class. :param scales: list of scalars or None, if None, do not apply any scaling. :param kernel: gaussian or cauchy. :param reduction: using AUTO reduction, calling the loss like `loss(y_true, ...
3
stack_v2_sparse_classes_30k_train_019472
Implement the Python class `DiceScore` described below. Class description: Define dice score. The formulation is: 0. pos_w + neg_w = 1 1. let y_prod = y_true * y_pred and y_sum = y_true + y_pred 2. num = 2 * (pos_w * y_true * y_pred + neg_w * (1−y_true) * (1−y_pred)) = 2 * ((pos_w+neg_w) * y_prod - neg_w * y_sum + neg...
Implement the Python class `DiceScore` described below. Class description: Define dice score. The formulation is: 0. pos_w + neg_w = 1 1. let y_prod = y_true * y_pred and y_sum = y_true + y_pred 2. num = 2 * (pos_w * y_true * y_pred + neg_w * (1−y_true) * (1−y_pred)) = 2 * ((pos_w+neg_w) * y_prod - neg_w * y_sum + neg...
456731e51b69548b7f529c24b4de6d96c406ed60
<|skeleton|> class DiceScore: """Define dice score. The formulation is: 0. pos_w + neg_w = 1 1. let y_prod = y_true * y_pred and y_sum = y_true + y_pred 2. num = 2 * (pos_w * y_true * y_pred + neg_w * (1−y_true) * (1−y_pred)) = 2 * ((pos_w+neg_w) * y_prod - neg_w * y_sum + neg_w) = 2 * (y_prod - neg_w * y_sum + neg...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DiceScore: """Define dice score. The formulation is: 0. pos_w + neg_w = 1 1. let y_prod = y_true * y_pred and y_sum = y_true + y_pred 2. num = 2 * (pos_w * y_true * y_pred + neg_w * (1−y_true) * (1−y_pred)) = 2 * ((pos_w+neg_w) * y_prod - neg_w * y_sum + neg_w) = 2 * (y_prod - neg_w * y_sum + neg_w) 3. denom ...
the_stack_v2_python_sparse
deepreg/model/loss/label.py
usmanumar2010/DeepReg
train
0
d012d2083ea1917d8f2c253e40c55b1355a4eb63
[ "self.gate_set = gate_set\nself.mode = mode\nrandom.seed(seed)", "matrix = copy.deepcopy(self.gate_set.qubit_set.PAULI_I.matrix)\nrands = []\nfor i in range(N - 1):\n rand = random.randrange(0, self.gate_set.size)\n matrix *= self.gate_set.load_clifford_gate(segment, rand, self.mode)\n rands.append(rand)...
<|body_start_0|> self.gate_set = gate_set self.mode = mode random.seed(seed) <|end_body_0|> <|body_start_1|> matrix = copy.deepcopy(self.gate_set.qubit_set.PAULI_I.matrix) rands = [] for i in range(N - 1): rand = random.randrange(0, self.gate_set.size) ...
Function that loads RB sequences
RB_mgr
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RB_mgr: """Function that loads RB sequences""" def __init__(self, gate_set, mode, seed=None): """init rb manager Args: gate_set (TODO :: make parent type) : set of gate to be used in the RB sequence mode (str) : mode for single qubit gates (e.g. allow Z gates) ('XY'/'XZ') seed (int) ...
stack_v2_sparse_classes_75kplus_train_067686
2,050
no_license
[ { "docstring": "init rb manager Args: gate_set (TODO :: make parent type) : set of gate to be used in the RB sequence mode (str) : mode for single qubit gates (e.g. allow Z gates) ('XY'/'XZ') seed (int) : seed to start from, if None : system clock will be used", "name": "__init__", "signature": "def __i...
2
null
Implement the Python class `RB_mgr` described below. Class description: Function that loads RB sequences Method signatures and docstrings: - def __init__(self, gate_set, mode, seed=None): init rb manager Args: gate_set (TODO :: make parent type) : set of gate to be used in the RB sequence mode (str) : mode for single...
Implement the Python class `RB_mgr` described below. Class description: Function that loads RB sequences Method signatures and docstrings: - def __init__(self, gate_set, mode, seed=None): init rb manager Args: gate_set (TODO :: make parent type) : set of gate to be used in the RB sequence mode (str) : mode for single...
1f045e43344c690521ef0683eb31ac8325f9e668
<|skeleton|> class RB_mgr: """Function that loads RB sequences""" def __init__(self, gate_set, mode, seed=None): """init rb manager Args: gate_set (TODO :: make parent type) : set of gate to be used in the RB sequence mode (str) : mode for single qubit gates (e.g. allow Z gates) ('XY'/'XZ') seed (int) ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RB_mgr: """Function that loads RB sequences""" def __init__(self, gate_set, mode, seed=None): """init rb manager Args: gate_set (TODO :: make parent type) : set of gate to be used in the RB sequence mode (str) : mode for single qubit gates (e.g. allow Z gates) ('XY'/'XZ') seed (int) : seed to sta...
the_stack_v2_python_sparse
pulse_templates/coherent_control/RB_generic/RB_mgr.py
stephanlphilips/spin-qubit-operations
train
0
5b2c71c3ff88ea7174987d35667887f97c8a5b37
[ "super(BasicLSTMBasedDecoderModel, self).__init__()\nself.embedding_layer = nn.Embedding(vocabulary_size, embedding_size)\nself.lstm_layer = nn.LSTM(embedding_size, hidden_layer_size, num_layers, batch_first=True)\nif init_lstm_biases_to_one:\n init_lstm_forget_gate_biases(self.lstm_layer, value=1.0)\nself.linea...
<|body_start_0|> super(BasicLSTMBasedDecoderModel, self).__init__() self.embedding_layer = nn.Embedding(vocabulary_size, embedding_size) self.lstm_layer = nn.LSTM(embedding_size, hidden_layer_size, num_layers, batch_first=True) if init_lstm_biases_to_one: init_lstm_forget_gat...
BasicLSTMBasedDecoderModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BasicLSTMBasedDecoderModel: def __init__(self, embedding_size, hidden_layer_size, vocabulary_size, num_layers, max_seq_len=20, init_lstm_biases_to_one: bool=False): """Set the hyper-parameters and build the layers.""" <|body_0|> def forward(self, input_features, capts, lens)...
stack_v2_sparse_classes_75kplus_train_067687
11,758
no_license
[ { "docstring": "Set the hyper-parameters and build the layers.", "name": "__init__", "signature": "def __init__(self, embedding_size, hidden_layer_size, vocabulary_size, num_layers, max_seq_len=20, init_lstm_biases_to_one: bool=False)" }, { "docstring": "Decode image feature vectors and generate...
3
stack_v2_sparse_classes_30k_train_024785
Implement the Python class `BasicLSTMBasedDecoderModel` described below. Class description: Implement the BasicLSTMBasedDecoderModel class. Method signatures and docstrings: - def __init__(self, embedding_size, hidden_layer_size, vocabulary_size, num_layers, max_seq_len=20, init_lstm_biases_to_one: bool=False): Set t...
Implement the Python class `BasicLSTMBasedDecoderModel` described below. Class description: Implement the BasicLSTMBasedDecoderModel class. Method signatures and docstrings: - def __init__(self, embedding_size, hidden_layer_size, vocabulary_size, num_layers, max_seq_len=20, init_lstm_biases_to_one: bool=False): Set t...
55775a895f8feb7b603eac91e3fe0d61314fd648
<|skeleton|> class BasicLSTMBasedDecoderModel: def __init__(self, embedding_size, hidden_layer_size, vocabulary_size, num_layers, max_seq_len=20, init_lstm_biases_to_one: bool=False): """Set the hyper-parameters and build the layers.""" <|body_0|> def forward(self, input_features, capts, lens)...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BasicLSTMBasedDecoderModel: def __init__(self, embedding_size, hidden_layer_size, vocabulary_size, num_layers, max_seq_len=20, init_lstm_biases_to_one: bool=False): """Set the hyper-parameters and build the layers.""" super(BasicLSTMBasedDecoderModel, self).__init__() self.embedding_la...
the_stack_v2_python_sparse
src/main/mscoco/utils_and_models.py
asaxena30/deep-nlp
train
0
ea8121a54b5b2caa22f5d479eb911057149648e5
[ "self.possible_steps = step_list\nself.all_combinations = []\nself.slice_with_multiple_scales(range(n), self.possible_steps)\nreturn len(self.all_combinations)", "target_length = len(target)\nfor step in step_list:\n clone_pieces = current_pieces[:]\n slice_index = current_index + step\n piece = target[c...
<|body_start_0|> self.possible_steps = step_list self.all_combinations = [] self.slice_with_multiple_scales(range(n), self.possible_steps) return len(self.all_combinations) <|end_body_0|> <|body_start_1|> target_length = len(target) for step in step_list: clo...
目前此种方法failed了,超时, 在输入值为35的时候。此方法可以获得解,但算法复杂度太高。但是此种方法可以显示出所有的组合。
SolutionFailed1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SolutionFailed1: """目前此种方法failed了,超时, 在输入值为35的时候。此方法可以获得解,但算法复杂度太高。但是此种方法可以显示出所有的组合。""" def climbStairs(self, n, step_list=[1, 2]): """:type n: int :rtype: int""" <|body_0|> def slice_with_multiple_scales(self, target, step_list, current_index=0, current_pieces=[]): ...
stack_v2_sparse_classes_75kplus_train_067688
4,780
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "climbStairs", "signature": "def climbStairs(self, n, step_list=[1, 2])" }, { "docstring": "一个任意长度的有序列表,可以按照参数列表里提供的n种尺度进行连续切分,返回最后可能的切分结果总数", "name": "slice_with_multiple_scales", "signature": "def slice_with_multiple_scales(self, targe...
2
stack_v2_sparse_classes_30k_train_006054
Implement the Python class `SolutionFailed1` described below. Class description: 目前此种方法failed了,超时, 在输入值为35的时候。此方法可以获得解,但算法复杂度太高。但是此种方法可以显示出所有的组合。 Method signatures and docstrings: - def climbStairs(self, n, step_list=[1, 2]): :type n: int :rtype: int - def slice_with_multiple_scales(self, target, step_list, current_i...
Implement the Python class `SolutionFailed1` described below. Class description: 目前此种方法failed了,超时, 在输入值为35的时候。此方法可以获得解,但算法复杂度太高。但是此种方法可以显示出所有的组合。 Method signatures and docstrings: - def climbStairs(self, n, step_list=[1, 2]): :type n: int :rtype: int - def slice_with_multiple_scales(self, target, step_list, current_i...
2a7401c6e407db533877de6e20a2b523f7964fdb
<|skeleton|> class SolutionFailed1: """目前此种方法failed了,超时, 在输入值为35的时候。此方法可以获得解,但算法复杂度太高。但是此种方法可以显示出所有的组合。""" def climbStairs(self, n, step_list=[1, 2]): """:type n: int :rtype: int""" <|body_0|> def slice_with_multiple_scales(self, target, step_list, current_index=0, current_pieces=[]): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SolutionFailed1: """目前此种方法failed了,超时, 在输入值为35的时候。此方法可以获得解,但算法复杂度太高。但是此种方法可以显示出所有的组合。""" def climbStairs(self, n, step_list=[1, 2]): """:type n: int :rtype: int""" self.possible_steps = step_list self.all_combinations = [] self.slice_with_multiple_scales(range(n), self.poss...
the_stack_v2_python_sparse
THEORIES/algorithm/leetcode/Y70_Climbing_Stairs.py
bb2qqq/tech_notes
train
0
8b365895bffca77df0dfe3daa1dedcb0d9f517bc
[ "self.id = id\nself.len = 0\nself.policy_class = policy\nself.round = 0\nself.unresponsive_count = 0\nself.too_slow = False\nself.sq = mp.Queue()\nself.aq = mp.Queue()\nself.mq = mp.Queue()\nself.policy = policy(policy_args, board_size, self.sq, self.aq, self.mq, logq, id, game_duration, score_scope, snakes)\nself....
<|body_start_0|> self.id = id self.len = 0 self.policy_class = policy self.round = 0 self.unresponsive_count = 0 self.too_slow = False self.sq = mp.Queue() self.aq = mp.Queue() self.mq = mp.Queue() self.policy = policy(policy_args, board_si...
Agent
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Agent: def __init__(self, id, policy, policy_args, board_size, logq, game_duration, score_scope, snakes): """Construct a new player :param id: the player id (the value of the player positions in the board :param policy: the class of the policy to be used by the player :param policy_args:...
stack_v2_sparse_classes_75kplus_train_067689
6,026
no_license
[ { "docstring": "Construct a new player :param id: the player id (the value of the player positions in the board :param policy: the class of the policy to be used by the player :param policy_args: string (name, value) pairs that the policy can parse to arguments :param board_size: the size of the game board (hei...
4
null
Implement the Python class `Agent` described below. Class description: Implement the Agent class. Method signatures and docstrings: - def __init__(self, id, policy, policy_args, board_size, logq, game_duration, score_scope, snakes): Construct a new player :param id: the player id (the value of the player positions in...
Implement the Python class `Agent` described below. Class description: Implement the Agent class. Method signatures and docstrings: - def __init__(self, id, policy, policy_args, board_size, logq, game_duration, score_scope, snakes): Construct a new player :param id: the player id (the value of the player positions in...
d42d64300da96ac3c9c5378b1faba9693e93f14d
<|skeleton|> class Agent: def __init__(self, id, policy, policy_args, board_size, logq, game_duration, score_scope, snakes): """Construct a new player :param id: the player id (the value of the player positions in the board :param policy: the class of the policy to be used by the player :param policy_args:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Agent: def __init__(self, id, policy, policy_args, board_size, logq, game_duration, score_scope, snakes): """Construct a new player :param id: the player id (the value of the player positions in the board :param policy: the class of the policy to be used by the player :param policy_args: string (name,...
the_stack_v2_python_sparse
GameComponants.py
LotanLevy/snake_game
train
0
fd53216b8f8c6c2c42afaf2b49cc676028458638
[ "random.seed(4)\nexpected_value = \"Looks like there's something shiny behind a tree. You head towards the tree and find a Big Pearl.\\nThe pearlescent sheen is irresistible, so you put it in your bag.\\n\"\nrandom_message()\nself.assertEqual(mock_stdout.getvalue(), expected_value)\nrandom.seed()", "random.seed(1...
<|body_start_0|> random.seed(4) expected_value = "Looks like there's something shiny behind a tree. You head towards the tree and find a Big Pearl.\nThe pearlescent sheen is irresistible, so you put it in your bag.\n" random_message() self.assertEqual(mock_stdout.getvalue(), expected_val...
TestRandomMessage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestRandomMessage: def test_random_message_output(self, mock_stdout): """Assert random string output.""" <|body_0|> def test_random_message_random(self, mock_stdout): """Assert random string output.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ra...
stack_v2_sparse_classes_75kplus_train_067690
1,213
no_license
[ { "docstring": "Assert random string output.", "name": "test_random_message_output", "signature": "def test_random_message_output(self, mock_stdout)" }, { "docstring": "Assert random string output.", "name": "test_random_message_random", "signature": "def test_random_message_random(self,...
2
stack_v2_sparse_classes_30k_val_001536
Implement the Python class `TestRandomMessage` described below. Class description: Implement the TestRandomMessage class. Method signatures and docstrings: - def test_random_message_output(self, mock_stdout): Assert random string output. - def test_random_message_random(self, mock_stdout): Assert random string output...
Implement the Python class `TestRandomMessage` described below. Class description: Implement the TestRandomMessage class. Method signatures and docstrings: - def test_random_message_output(self, mock_stdout): Assert random string output. - def test_random_message_random(self, mock_stdout): Assert random string output...
4053046fffb170104ea4209b156ee97185ef4f6f
<|skeleton|> class TestRandomMessage: def test_random_message_output(self, mock_stdout): """Assert random string output.""" <|body_0|> def test_random_message_random(self, mock_stdout): """Assert random string output.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestRandomMessage: def test_random_message_output(self, mock_stdout): """Assert random string output.""" random.seed(4) expected_value = "Looks like there's something shiny behind a tree. You head towards the tree and find a Big Pearl.\nThe pearlescent sheen is irresistible, so you put...
the_stack_v2_python_sparse
A3/test_random_message.py
truongnguyenlinh/procedural_python
train
0
f293e995798043f7762271848af4a97fd2196df8
[ "suites = []\nfor s in cls.SUITES:\n s['tests'] = cls._get_tests(s)\n s['approxRunTime'] = cls._get_average_run_time(suite_model)\n suites.append(s)\nreturn suites", "suite_file_name = '{}.py'.format(str(suite['id']).replace('.', os.path.sep))\nwith open(suite_file_name) as f:\n file_contents = f.read...
<|body_start_0|> suites = [] for s in cls.SUITES: s['tests'] = cls._get_tests(s) s['approxRunTime'] = cls._get_average_run_time(suite_model) suites.append(s) return suites <|end_body_0|> <|body_start_1|> suite_file_name = '{}.py'.format(str(suite['id'...
Available test suites provider
SuiteProvider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SuiteProvider: """Available test suites provider""" def get_list(cls, suite_model) -> list: """Return list of available test suites""" <|body_0|> def _get_tests(cls, suite: dict): """Get suite available tests""" <|body_1|> def _get_average_run_time(c...
stack_v2_sparse_classes_75kplus_train_067691
2,492
no_license
[ { "docstring": "Return list of available test suites", "name": "get_list", "signature": "def get_list(cls, suite_model) -> list" }, { "docstring": "Get suite available tests", "name": "_get_tests", "signature": "def _get_tests(cls, suite: dict)" }, { "docstring": "Get suite avera...
3
stack_v2_sparse_classes_30k_train_041674
Implement the Python class `SuiteProvider` described below. Class description: Available test suites provider Method signatures and docstrings: - def get_list(cls, suite_model) -> list: Return list of available test suites - def _get_tests(cls, suite: dict): Get suite available tests - def _get_average_run_time(cls, ...
Implement the Python class `SuiteProvider` described below. Class description: Available test suites provider Method signatures and docstrings: - def get_list(cls, suite_model) -> list: Return list of available test suites - def _get_tests(cls, suite: dict): Get suite available tests - def _get_average_run_time(cls, ...
4b9c65cf06912fe92d94b3989e0220aae3a31db4
<|skeleton|> class SuiteProvider: """Available test suites provider""" def get_list(cls, suite_model) -> list: """Return list of available test suites""" <|body_0|> def _get_tests(cls, suite: dict): """Get suite available tests""" <|body_1|> def _get_average_run_time(c...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SuiteProvider: """Available test suites provider""" def get_list(cls, suite_model) -> list: """Return list of available test suites""" suites = [] for s in cls.SUITES: s['tests'] = cls._get_tests(s) s['approxRunTime'] = cls._get_average_run_time(suite_model...
the_stack_v2_python_sparse
project/applications/platform-tests/app/suite_provider.py
trustedanalytics/platform-tests
train
2
c570b89332ebcfa5b6aee651c4b0a0c773dac507
[ "super().__init__(self.PROBLEM_NAME)\nself.root_node = root_node\nself.label1 = label1\nself.label2 = label2", "print('Solving {} problem ...'.format(self.PROBLEM_NAME))\npath1 = []\nself.path_to_node(self.root_node, path1, self.label1)\npath2 = []\nself.path_to_node(self.root_node, path2, self.label2)\ni = 0\nwh...
<|body_start_0|> super().__init__(self.PROBLEM_NAME) self.root_node = root_node self.label1 = label1 self.label2 = label2 <|end_body_0|> <|body_start_1|> print('Solving {} problem ...'.format(self.PROBLEM_NAME)) path1 = [] self.path_to_node(self.root_node, path1,...
Find Distance Between Two Nodes
FindDistanceBetweenTwoNodes
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FindDistanceBetweenTwoNodes: """Find Distance Between Two Nodes""" def __init__(self, root_node, label1, label2): """Find Distance Between Two Nodes Args: root_node: node of the tree label1: First node's label label2: Second node's label Returns: None Raises: None""" <|body_0...
stack_v2_sparse_classes_75kplus_train_067692
2,695
no_license
[ { "docstring": "Find Distance Between Two Nodes Args: root_node: node of the tree label1: First node's label label2: Second node's label Returns: None Raises: None", "name": "__init__", "signature": "def __init__(self, root_node, label1, label2)" }, { "docstring": "Solve the problem Note: O(n) (...
3
stack_v2_sparse_classes_30k_train_049054
Implement the Python class `FindDistanceBetweenTwoNodes` described below. Class description: Find Distance Between Two Nodes Method signatures and docstrings: - def __init__(self, root_node, label1, label2): Find Distance Between Two Nodes Args: root_node: node of the tree label1: First node's label label2: Second no...
Implement the Python class `FindDistanceBetweenTwoNodes` described below. Class description: Find Distance Between Two Nodes Method signatures and docstrings: - def __init__(self, root_node, label1, label2): Find Distance Between Two Nodes Args: root_node: node of the tree label1: First node's label label2: Second no...
11f4d25cb211740514c119a60962d075a0817abd
<|skeleton|> class FindDistanceBetweenTwoNodes: """Find Distance Between Two Nodes""" def __init__(self, root_node, label1, label2): """Find Distance Between Two Nodes Args: root_node: node of the tree label1: First node's label label2: Second node's label Returns: None Raises: None""" <|body_0...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FindDistanceBetweenTwoNodes: """Find Distance Between Two Nodes""" def __init__(self, root_node, label1, label2): """Find Distance Between Two Nodes Args: root_node: node of the tree label1: First node's label label2: Second node's label Returns: None Raises: None""" super().__init__(self...
the_stack_v2_python_sparse
python/problems/binary_tree/find_distance_between_two_nodes.py
santhosh-kumar/AlgorithmsAndDataStructures
train
2
8a811a0ece610f3c3f50cf6a572fa198a6b2a4be
[ "if sk:\n self.n = sk.n\n self.h = sk.h\nelif n and h:\n self.n = n\n self.h = h\nelse:\n raise Exception('Public Key construction failed: insufficient/wrong arguments')\nself.signature_bound = Params[self.n]['sig_bound']\nself.sig_bytelen = Params[self.n]['sig_bytelen']", "rep = 'Public for n = {n...
<|body_start_0|> if sk: self.n = sk.n self.h = sk.h elif n and h: self.n = n self.h = h else: raise Exception('Public Key construction failed: insufficient/wrong arguments') self.signature_bound = Params[self.n]['sig_bound'] ...
This class contains methods for performing public key operations in Falcon.
PublicKey
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PublicKey: """This class contains methods for performing public key operations in Falcon.""" def __init__(self, sk=None, n=None, h=None): """Initialize a public key.""" <|body_0|> def __repr__(self): """Print the object in readable form.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_067693
15,043
permissive
[ { "docstring": "Initialize a public key.", "name": "__init__", "signature": "def __init__(self, sk=None, n=None, h=None)" }, { "docstring": "Print the object in readable form.", "name": "__repr__", "signature": "def __repr__(self)" }, { "docstring": "Hash a message to a point in ...
4
stack_v2_sparse_classes_30k_train_049570
Implement the Python class `PublicKey` described below. Class description: This class contains methods for performing public key operations in Falcon. Method signatures and docstrings: - def __init__(self, sk=None, n=None, h=None): Initialize a public key. - def __repr__(self): Print the object in readable form. - de...
Implement the Python class `PublicKey` described below. Class description: This class contains methods for performing public key operations in Falcon. Method signatures and docstrings: - def __init__(self, sk=None, n=None, h=None): Initialize a public key. - def __repr__(self): Print the object in readable form. - de...
1480c1e71b624a147dc0a18aa043f1101435ba85
<|skeleton|> class PublicKey: """This class contains methods for performing public key operations in Falcon.""" def __init__(self, sk=None, n=None, h=None): """Initialize a public key.""" <|body_0|> def __repr__(self): """Print the object in readable form.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PublicKey: """This class contains methods for performing public key operations in Falcon.""" def __init__(self, sk=None, n=None, h=None): """Initialize a public key.""" if sk: self.n = sk.n self.h = sk.h elif n and h: self.n = n self...
the_stack_v2_python_sparse
falcon/falcon.py
samuelgoh1525/falcon-blockchain
train
4
1eae3ce8ad70a92cf051e1ed8bc11a106e0287f2
[ "new_library = Library()\nnew_library.title = request.data['title']\nnew_library.link = request.data['link']\nnew_library.image = request.data['image']\nnew_library.image_title = request.data['image_title']\nnew_library.parent_library_id = request.data['parent_library_id']\nnew_library.library_type_id = request.dat...
<|body_start_0|> new_library = Library() new_library.title = request.data['title'] new_library.link = request.data['link'] new_library.image = request.data['image'] new_library.image_title = request.data['image_title'] new_library.parent_library_id = request.data['parent_...
Libraries for codeArchive
Libraries
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Libraries: """Libraries for codeArchive""" def create(self, request): """Handle POST operations Returns: Response -- JSON serialized Library instance""" <|body_0|> def destroy(self, request, pk=None): """Handle DELETE requests for a single library Returns: Respon...
stack_v2_sparse_classes_75kplus_train_067694
4,662
no_license
[ { "docstring": "Handle POST operations Returns: Response -- JSON serialized Library instance", "name": "create", "signature": "def create(self, request)" }, { "docstring": "Handle DELETE requests for a single library Returns: Response -- 200, 404, or 500 status code", "name": "destroy", ...
5
stack_v2_sparse_classes_30k_train_025124
Implement the Python class `Libraries` described below. Class description: Libraries for codeArchive Method signatures and docstrings: - def create(self, request): Handle POST operations Returns: Response -- JSON serialized Library instance - def destroy(self, request, pk=None): Handle DELETE requests for a single li...
Implement the Python class `Libraries` described below. Class description: Libraries for codeArchive Method signatures and docstrings: - def create(self, request): Handle POST operations Returns: Response -- JSON serialized Library instance - def destroy(self, request, pk=None): Handle DELETE requests for a single li...
2bd984d13baaa9e12bba63a3bf39c2ff93619e59
<|skeleton|> class Libraries: """Libraries for codeArchive""" def create(self, request): """Handle POST operations Returns: Response -- JSON serialized Library instance""" <|body_0|> def destroy(self, request, pk=None): """Handle DELETE requests for a single library Returns: Respon...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Libraries: """Libraries for codeArchive""" def create(self, request): """Handle POST operations Returns: Response -- JSON serialized Library instance""" new_library = Library() new_library.title = request.data['title'] new_library.link = request.data['link'] new_li...
the_stack_v2_python_sparse
codearchiveAPIapp/views/library_view.py
shanemiller89/codeArchive_API
train
0
b11606da32428dba8dc7dc9ec53a0840c864e270
[ "self.weights = weights if weights is not None else np.random.randn(n_input, n_neurons) * np.sqrt(1 / n_neurons)\nself.bias = bias if bias is not None else np.random.rand(n_neurons) * 0.1\nself.activation = activation\nself.last_activation = None\nself.error = None\nself.delta = None\npass", "r = np.dot(x, self.w...
<|body_start_0|> self.weights = weights if weights is not None else np.random.randn(n_input, n_neurons) * np.sqrt(1 / n_neurons) self.bias = bias if bias is not None else np.random.rand(n_neurons) * 0.1 self.activation = activation self.last_activation = None self.error = None ...
Layer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Layer: def __init__(self, n_input, n_neurons, activation=None, weights=None, bias=None): """:param n_input: 输入节点数 :param n_neurons: 输出节点数 :param activation: 激活函数 :param weights: 权重 :param bias: 偏差""" <|body_0|> def activate(self, x): """last_activation 保存当前层的输出值 :par...
stack_v2_sparse_classes_75kplus_train_067695
6,919
no_license
[ { "docstring": ":param n_input: 输入节点数 :param n_neurons: 输出节点数 :param activation: 激活函数 :param weights: 权重 :param bias: 偏差", "name": "__init__", "signature": "def __init__(self, n_input, n_neurons, activation=None, weights=None, bias=None)" }, { "docstring": "last_activation 保存当前层的输出值 :param x: :r...
4
stack_v2_sparse_classes_30k_train_024856
Implement the Python class `Layer` described below. Class description: Implement the Layer class. Method signatures and docstrings: - def __init__(self, n_input, n_neurons, activation=None, weights=None, bias=None): :param n_input: 输入节点数 :param n_neurons: 输出节点数 :param activation: 激活函数 :param weights: 权重 :param bias: ...
Implement the Python class `Layer` described below. Class description: Implement the Layer class. Method signatures and docstrings: - def __init__(self, n_input, n_neurons, activation=None, weights=None, bias=None): :param n_input: 输入节点数 :param n_neurons: 输出节点数 :param activation: 激活函数 :param weights: 权重 :param bias: ...
f5973727e23c364c08e661ed9765837cf1ca7ed9
<|skeleton|> class Layer: def __init__(self, n_input, n_neurons, activation=None, weights=None, bias=None): """:param n_input: 输入节点数 :param n_neurons: 输出节点数 :param activation: 激活函数 :param weights: 权重 :param bias: 偏差""" <|body_0|> def activate(self, x): """last_activation 保存当前层的输出值 :par...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Layer: def __init__(self, n_input, n_neurons, activation=None, weights=None, bias=None): """:param n_input: 输入节点数 :param n_neurons: 输出节点数 :param activation: 激活函数 :param weights: 权重 :param bias: 偏差""" self.weights = weights if weights is not None else np.random.randn(n_input, n_neurons) * np.sq...
the_stack_v2_python_sparse
practical/back_propagation.py
hearecho/VisualTF
train
4
16f9664f34326755cc256a0606a3f32728fae5f3
[ "if not tf.executing_eagerly():\n self.skipTest('Skipping test due to NUFFT segfault.')\nimage_shape = [256, 256]\nimage = image_ops.phantom(shape=image_shape)\nimage = tf.expand_dims(image, -1)\nlayer = preproc_layers.KSpaceResampling(image_shape=image_shape, traj_type='radial', views=403, angle_range='half', d...
<|body_start_0|> if not tf.executing_eagerly(): self.skipTest('Skipping test due to NUFFT segfault.') image_shape = [256, 256] image = image_ops.phantom(shape=image_shape) image = tf.expand_dims(image, -1) layer = preproc_layers.KSpaceResampling(image_shape=image_shap...
Tests for layer `KSpaceResampling`.
KSpaceResamplingTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KSpaceResamplingTest: """Tests for layer `KSpaceResampling`.""" def test_radial_2d(self, dens_algo): """Test radial 2D configuration.""" <|body_0|> def test_radial_2d_impulse(self, dens_algo): """Test radial 2D with impulse function.""" <|body_1|> <|end_...
stack_v2_sparse_classes_75kplus_train_067696
6,474
permissive
[ { "docstring": "Test radial 2D configuration.", "name": "test_radial_2d", "signature": "def test_radial_2d(self, dens_algo)" }, { "docstring": "Test radial 2D with impulse function.", "name": "test_radial_2d_impulse", "signature": "def test_radial_2d_impulse(self, dens_algo)" } ]
2
stack_v2_sparse_classes_30k_train_017143
Implement the Python class `KSpaceResamplingTest` described below. Class description: Tests for layer `KSpaceResampling`. Method signatures and docstrings: - def test_radial_2d(self, dens_algo): Test radial 2D configuration. - def test_radial_2d_impulse(self, dens_algo): Test radial 2D with impulse function.
Implement the Python class `KSpaceResamplingTest` described below. Class description: Tests for layer `KSpaceResampling`. Method signatures and docstrings: - def test_radial_2d(self, dens_algo): Test radial 2D configuration. - def test_radial_2d_impulse(self, dens_algo): Test radial 2D with impulse function. <|skele...
cfd8930ee5281e7f6dceb17c4a5acaf625fd3243
<|skeleton|> class KSpaceResamplingTest: """Tests for layer `KSpaceResampling`.""" def test_radial_2d(self, dens_algo): """Test radial 2D configuration.""" <|body_0|> def test_radial_2d_impulse(self, dens_algo): """Test radial 2D with impulse function.""" <|body_1|> <|end_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class KSpaceResamplingTest: """Tests for layer `KSpaceResampling`.""" def test_radial_2d(self, dens_algo): """Test radial 2D configuration.""" if not tf.executing_eagerly(): self.skipTest('Skipping test due to NUFFT segfault.') image_shape = [256, 256] image = image_...
the_stack_v2_python_sparse
tensorflow_mri/python/layers/preproc_layers_test.py
mrphys/tensorflow-mri
train
29
7e97ea6164f8126e8aeda62ee58122bc0718f4d2
[ "super(GROVEREmbedding, self).__init__()\nself.embedding_output_type = args.embedding_output_type\nedge_dim = get_bond_fdim() + get_atom_fdim()\nnode_dim = get_atom_fdim()\nif not hasattr(args, 'backbone'):\n print('No backbone specified in args, use gtrans backbone.')\n args.backbone = 'gtrans'\nif args.back...
<|body_start_0|> super(GROVEREmbedding, self).__init__() self.embedding_output_type = args.embedding_output_type edge_dim = get_bond_fdim() + get_atom_fdim() node_dim = get_atom_fdim() if not hasattr(args, 'backbone'): print('No backbone specified in args, use gtrans ...
The GROVER Embedding class. It contains the GTransEncoder. This GTransEncoder can be replaced by any validate encoders.
GROVEREmbedding
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GROVEREmbedding: """The GROVER Embedding class. It contains the GTransEncoder. This GTransEncoder can be replaced by any validate encoders.""" def __init__(self, args: Namespace): """Initialize the GROVEREmbedding class. :param args:""" <|body_0|> def forward(self, graph...
stack_v2_sparse_classes_75kplus_train_067697
23,044
permissive
[ { "docstring": "Initialize the GROVEREmbedding class. :param args:", "name": "__init__", "signature": "def __init__(self, args: Namespace)" }, { "docstring": "The forward function takes graph_batch as input and output a dict. The content of the dict is decided by self.embedding_output_type. :par...
2
stack_v2_sparse_classes_30k_train_018931
Implement the Python class `GROVEREmbedding` described below. Class description: The GROVER Embedding class. It contains the GTransEncoder. This GTransEncoder can be replaced by any validate encoders. Method signatures and docstrings: - def __init__(self, args: Namespace): Initialize the GROVEREmbedding class. :param...
Implement the Python class `GROVEREmbedding` described below. Class description: The GROVER Embedding class. It contains the GTransEncoder. This GTransEncoder can be replaced by any validate encoders. Method signatures and docstrings: - def __init__(self, args: Namespace): Initialize the GROVEREmbedding class. :param...
b62138429f592a97e3bfc58f5fde5e488714e281
<|skeleton|> class GROVEREmbedding: """The GROVER Embedding class. It contains the GTransEncoder. This GTransEncoder can be replaced by any validate encoders.""" def __init__(self, args: Namespace): """Initialize the GROVEREmbedding class. :param args:""" <|body_0|> def forward(self, graph...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GROVEREmbedding: """The GROVER Embedding class. It contains the GTransEncoder. This GTransEncoder can be replaced by any validate encoders.""" def __init__(self, args: Namespace): """Initialize the GROVEREmbedding class. :param args:""" super(GROVEREmbedding, self).__init__() self...
the_stack_v2_python_sparse
embeddings/grover/grover/model/models.py
theislab/chemCPA
train
67
1355983a357b06f92978274bbff0de03e623eb92
[ "m, n = (len(M), len(M[0]))\ndp = [[[0] * 4 for _ in range(n)] for _ in range(m)]\nres = 0\ndirections = [(0, -1), (-1, -1), (-1, 0), (-1, 1)]\nfor i in range(m):\n for j in range(n):\n if M[i][j] == 0:\n continue\n k = 0\n for dir in directions:\n row = i + dir[0]\n ...
<|body_start_0|> m, n = (len(M), len(M[0])) dp = [[[0] * 4 for _ in range(n)] for _ in range(m)] res = 0 directions = [(0, -1), (-1, -1), (-1, 0), (-1, 1)] for i in range(m): for j in range(n): if M[i][j] == 0: continue ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestLine(self, M): """:type M: List[List[int]] :rtype: int""" <|body_0|> def longestLine2(self, M): """:type M: List[List[int]] :rtype: int 2D to 1D""" <|body_1|> <|end_skeleton|> <|body_start_0|> m, n = (len(M), len(M[0])) ...
stack_v2_sparse_classes_75kplus_train_067698
1,804
no_license
[ { "docstring": ":type M: List[List[int]] :rtype: int", "name": "longestLine", "signature": "def longestLine(self, M)" }, { "docstring": ":type M: List[List[int]] :rtype: int 2D to 1D", "name": "longestLine2", "signature": "def longestLine2(self, M)" } ]
2
stack_v2_sparse_classes_30k_train_015531
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestLine(self, M): :type M: List[List[int]] :rtype: int - def longestLine2(self, M): :type M: List[List[int]] :rtype: int 2D to 1D
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestLine(self, M): :type M: List[List[int]] :rtype: int - def longestLine2(self, M): :type M: List[List[int]] :rtype: int 2D to 1D <|skeleton|> class Solution: def l...
2e1751263f484709102f7f2caf18776a004c8230
<|skeleton|> class Solution: def longestLine(self, M): """:type M: List[List[int]] :rtype: int""" <|body_0|> def longestLine2(self, M): """:type M: List[List[int]] :rtype: int 2D to 1D""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def longestLine(self, M): """:type M: List[List[int]] :rtype: int""" m, n = (len(M), len(M[0])) dp = [[[0] * 4 for _ in range(n)] for _ in range(m)] res = 0 directions = [(0, -1), (-1, -1), (-1, 0), (-1, 1)] for i in range(m): for j in rang...
the_stack_v2_python_sparse
Python/Leetcode Daily Practice/unclassified/562. Longest Line of Consecutive One in Matrix.py
YaqianQi/Algorithm-and-Data-Structure
train
1
a182e3402afbf0420add7f1b52ca6fd8606d34f4
[ "self.distance = distance\nself.num_words = num_words\nself.n_ann_terms = n_ann_terms\nself.diagonal = diagonal\nself.annotation = annotation\nself.normed = normed\nself.logger = logger\nself.viz_env = viz_env\nself.title = title", "super(ConvergenceMetric, self).set_parameters(**kwargs)\ndiff_diagonal, _ = self....
<|body_start_0|> self.distance = distance self.num_words = num_words self.n_ann_terms = n_ann_terms self.diagonal = diagonal self.annotation = annotation self.normed = normed self.logger = logger self.viz_env = viz_env self.title = title <|end_body...
Metric class for convergence evaluation
ConvergenceMetric
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConvergenceMetric: """Metric class for convergence evaluation""" def __init__(self, distance='jaccard', num_words=100, n_ann_terms=10, diagonal=True, annotation=False, normed=True, logger=None, viz_env=None, title=None): """Args: distance : measure used to calculate difference betwee...
stack_v2_sparse_classes_75kplus_train_067699
16,817
permissive
[ { "docstring": "Args: distance : measure used to calculate difference between any topic pair. Available values: `kullback_leibler` `hellinger` `jaccard` num_words : is quantity of most relevant words that used if distance == `jaccard` (also used for annotation) n_ann_terms : max quantity of words in intersectio...
2
stack_v2_sparse_classes_30k_train_008569
Implement the Python class `ConvergenceMetric` described below. Class description: Metric class for convergence evaluation Method signatures and docstrings: - def __init__(self, distance='jaccard', num_words=100, n_ann_terms=10, diagonal=True, annotation=False, normed=True, logger=None, viz_env=None, title=None): Arg...
Implement the Python class `ConvergenceMetric` described below. Class description: Metric class for convergence evaluation Method signatures and docstrings: - def __init__(self, distance='jaccard', num_words=100, n_ann_terms=10, diagonal=True, annotation=False, normed=True, logger=None, viz_env=None, title=None): Arg...
1bc3390770ddafbba2e2779ba91998643df6d9ec
<|skeleton|> class ConvergenceMetric: """Metric class for convergence evaluation""" def __init__(self, distance='jaccard', num_words=100, n_ann_terms=10, diagonal=True, annotation=False, normed=True, logger=None, viz_env=None, title=None): """Args: distance : measure used to calculate difference betwee...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ConvergenceMetric: """Metric class for convergence evaluation""" def __init__(self, distance='jaccard', num_words=100, n_ann_terms=10, diagonal=True, annotation=False, normed=True, logger=None, viz_env=None, title=None): """Args: distance : measure used to calculate difference between any topic p...
the_stack_v2_python_sparse
p3/Lib/site-packages/gensim/models/callbacks.py
fpark7/Native2Native
train
1