blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 7.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 467 8.64k | id stringlengths 40 40 | length_bytes int64 515 49.7k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 160 3.93k | prompted_full_text stringlengths 681 10.7k | revision_id stringlengths 40 40 | skeleton stringlengths 162 4.09k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | solution stringlengths 331 8.3k | source stringclasses 1
value | source_path stringlengths 5 177 | source_repo stringlengths 6 88 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9255d3e6c8a5225f3c6444051b220bf9674194dd | [
"for line in self.move_line_ids:\n if line.lot_id:\n stock = self.env['stock.quant'].search([('quantity', '>', 0), ('lot_id', '=', line.lot_id.id)])\n line.lot_id.qty_location = [(5, 0, 0)]\n if len(stock.ids) > 0:\n line.lot_id.qty_location = [(6, 0, stock.location_id.ids)]",
"... | <|body_start_0|>
for line in self.move_line_ids:
if line.lot_id:
stock = self.env['stock.quant'].search([('quantity', '>', 0), ('lot_id', '=', line.lot_id.id)])
line.lot_id.qty_location = [(5, 0, 0)]
if len(stock.ids) > 0:
line.lot_... | class_name: FlspStockPickingFilterSn inherit: stock.picking Purpose: To change the stock.production.lot field qty_location depending on transfer Date: Mar/30th/2021/T Author: Sami Byaruhanga | FlspStockPickingFilterSn | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FlspStockPickingFilterSn:
"""class_name: FlspStockPickingFilterSn inherit: stock.picking Purpose: To change the stock.production.lot field qty_location depending on transfer Date: Mar/30th/2021/T Author: Sami Byaruhanga"""
def change_product_qty_in_lot_table(self):
"""Purpose: To wri... | stack_v2_sparse_classes_10k_train_006100 | 7,672 | no_license | [
{
"docstring": "Purpose: To write the qty_location on stock,production.lot table",
"name": "change_product_qty_in_lot_table",
"signature": "def change_product_qty_in_lot_table(self)"
},
{
"docstring": "Purpose: To call method to change the stock.production table Note: Used method because its sho... | 2 | null | Implement the Python class `FlspStockPickingFilterSn` described below.
Class description:
class_name: FlspStockPickingFilterSn inherit: stock.picking Purpose: To change the stock.production.lot field qty_location depending on transfer Date: Mar/30th/2021/T Author: Sami Byaruhanga
Method signatures and docstrings:
- d... | Implement the Python class `FlspStockPickingFilterSn` described below.
Class description:
class_name: FlspStockPickingFilterSn inherit: stock.picking Purpose: To change the stock.production.lot field qty_location depending on transfer Date: Mar/30th/2021/T Author: Sami Byaruhanga
Method signatures and docstrings:
- d... | 4a82cd5cfd1898c6da860cb68dff3a14e037bbad | <|skeleton|>
class FlspStockPickingFilterSn:
"""class_name: FlspStockPickingFilterSn inherit: stock.picking Purpose: To change the stock.production.lot field qty_location depending on transfer Date: Mar/30th/2021/T Author: Sami Byaruhanga"""
def change_product_qty_in_lot_table(self):
"""Purpose: To wri... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FlspStockPickingFilterSn:
"""class_name: FlspStockPickingFilterSn inherit: stock.picking Purpose: To change the stock.production.lot field qty_location depending on transfer Date: Mar/30th/2021/T Author: Sami Byaruhanga"""
def change_product_qty_in_lot_table(self):
"""Purpose: To write the qty_lo... | the_stack_v2_python_sparse | flsp_mrp_filter_sn/models/filter_sn_method.py | odoo-smg/firstlight | train | 3 |
57d658de3cd5a91ef154229145d54b8fa981f381 | [
"self.venue_id = venue_id\nself.timestamp_utc = timestamp_utc\nself.measurement_type = measurement_type\nself.operator = operator\nself.number_of_people = number_of_people\nself.metadata = metadata\nself._validate_input()",
"try:\n expected_type(str, self.venue_id, 'venue_id')\n expected_type(datetime.datet... | <|body_start_0|>
self.venue_id = venue_id
self.timestamp_utc = timestamp_utc
self.measurement_type = measurement_type
self.operator = operator
self.number_of_people = number_of_people
self.metadata = metadata
self._validate_input()
<|end_body_0|>
<|body_start_1|>... | Convenience data-class to hold a venue measurement. The purpose of this class is to encapsulate data that has just arrived at a gate, make it easy to searialize and deserialize the contents. | RawVenueMeasurement | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RawVenueMeasurement:
"""Convenience data-class to hold a venue measurement. The purpose of this class is to encapsulate data that has just arrived at a gate, make it easy to searialize and deserialize the contents."""
def __init__(self, venue_id, timestamp_utc, number_of_people, measurement_... | stack_v2_sparse_classes_10k_train_006101 | 4,101 | no_license | [
{
"docstring": ":param venue_id - the name of the venue. str. :param timestamp_utc - the UTC time at which the measurement was made. datetime :param measurement_type - the type of data - i.e. gyms send events, bibs send absolute number of people :type VenueStreamType :param number_of_people - the number of peop... | 2 | stack_v2_sparse_classes_30k_val_000297 | Implement the Python class `RawVenueMeasurement` described below.
Class description:
Convenience data-class to hold a venue measurement. The purpose of this class is to encapsulate data that has just arrived at a gate, make it easy to searialize and deserialize the contents.
Method signatures and docstrings:
- def __... | Implement the Python class `RawVenueMeasurement` described below.
Class description:
Convenience data-class to hold a venue measurement. The purpose of this class is to encapsulate data that has just arrived at a gate, make it easy to searialize and deserialize the contents.
Method signatures and docstrings:
- def __... | 49e23966fa8ae6b7b6b44d4b4465a658533b40ab | <|skeleton|>
class RawVenueMeasurement:
"""Convenience data-class to hold a venue measurement. The purpose of this class is to encapsulate data that has just arrived at a gate, make it easy to searialize and deserialize the contents."""
def __init__(self, venue_id, timestamp_utc, number_of_people, measurement_... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RawVenueMeasurement:
"""Convenience data-class to hold a venue measurement. The purpose of this class is to encapsulate data that has just arrived at a gate, make it easy to searialize and deserialize the contents."""
def __init__(self, venue_id, timestamp_utc, number_of_people, measurement_type, operato... | the_stack_v2_python_sparse | thesis_common/incoming_pipeline/raw_venue_measurement.py | jorotenev/thesis_common | train | 0 |
25a53beeab38801c2d4c974c3f286abf2b50afdb | [
"self._buffer = ObservationBuffer()\nself._lock = Lock()\nself._empty_action = empty_action\nself._memory_threshold = memory_threshold",
"flushed_store = None\nwith self._lock:\n self._buffer.insert(*ts)\n mem = self._buffer.estimate_memory_lower_bound()\n if mem > self._memory_threshold:\n flushe... | <|body_start_0|>
self._buffer = ObservationBuffer()
self._lock = Lock()
self._empty_action = empty_action
self._memory_threshold = memory_threshold
<|end_body_0|>
<|body_start_1|>
flushed_store = None
with self._lock:
self._buffer.insert(*ts)
mem ... | Wraps an observation store to make it thread-safe and periodically empty it to reclaim memory. It makes the store work like a (memory) bucket, when the bucket is full, it gets emptied into a sink, an ``ObservationStoreAction`` that takes the store's content and saves it away from memory. Examples: Create a bucket with ... | ObservationBucket | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ObservationBucket:
"""Wraps an observation store to make it thread-safe and periodically empty it to reclaim memory. It makes the store work like a (memory) bucket, when the bucket is full, it gets emptied into a sink, an ``ObservationStoreAction`` that takes the store's content and saves it away... | stack_v2_sparse_classes_10k_train_006102 | 13,152 | permissive | [
{
"docstring": "Create a new instance. :param empty_action: a function to store the data collected so far. It takes a single ``ObservationStore`` and returns nothing. Called when the ``memory_threshold`` is reached or the ``empty`` method is called. :param memory_threshold: the amount of bytes past which the st... | 3 | stack_v2_sparse_classes_30k_train_000965 | Implement the Python class `ObservationBucket` described below.
Class description:
Wraps an observation store to make it thread-safe and periodically empty it to reclaim memory. It makes the store work like a (memory) bucket, when the bucket is full, it gets emptied into a sink, an ``ObservationStoreAction`` that take... | Implement the Python class `ObservationBucket` described below.
Class description:
Wraps an observation store to make it thread-safe and periodically empty it to reclaim memory. It makes the store work like a (memory) bucket, when the bucket is full, it gets emptied into a sink, an ``ObservationStoreAction`` that take... | 505acbfcfdbd6d944a682a54a6c96a5816468675 | <|skeleton|>
class ObservationBucket:
"""Wraps an observation store to make it thread-safe and periodically empty it to reclaim memory. It makes the store work like a (memory) bucket, when the bucket is full, it gets emptied into a sink, an ``ObservationStoreAction`` that takes the store's content and saves it away... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ObservationBucket:
"""Wraps an observation store to make it thread-safe and periodically empty it to reclaim memory. It makes the store work like a (memory) bucket, when the bucket is full, it gets emptied into a sink, an ``ObservationStoreAction`` that takes the store's content and saves it away from memory.... | the_stack_v2_python_sparse | src/server/telemetry/observation.py | FIWARE-GEs/quantum-leap | train | 0 |
b1bf98d5a2673a7878b261bdf63093cff0a8f234 | [
"obj = self.get_object()\nserializer = self.serializer_class(obj, data=request.data, partial=True, context={'request': request})\nreturn update(serializer)",
"cluster = self.get_object()\ncm.api.delete_cluster(cluster)\nreturn Response(status=status.HTTP_204_NO_CONTENT)"
] | <|body_start_0|>
obj = self.get_object()
serializer = self.serializer_class(obj, data=request.data, partial=True, context={'request': request})
return update(serializer)
<|end_body_0|>
<|body_start_1|>
cluster = self.get_object()
cm.api.delete_cluster(cluster)
return Res... | get: Show cluster | ClusterDetail | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClusterDetail:
"""get: Show cluster"""
def patch(self, request, *args, **kwargs):
"""Edit cluster"""
<|body_0|>
def delete(self, request, *args, **kwargs):
"""Remove cluster"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
obj = self.get_object()... | stack_v2_sparse_classes_10k_train_006103 | 32,530 | permissive | [
{
"docstring": "Edit cluster",
"name": "patch",
"signature": "def patch(self, request, *args, **kwargs)"
},
{
"docstring": "Remove cluster",
"name": "delete",
"signature": "def delete(self, request, *args, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_val_000288 | Implement the Python class `ClusterDetail` described below.
Class description:
get: Show cluster
Method signatures and docstrings:
- def patch(self, request, *args, **kwargs): Edit cluster
- def delete(self, request, *args, **kwargs): Remove cluster | Implement the Python class `ClusterDetail` described below.
Class description:
get: Show cluster
Method signatures and docstrings:
- def patch(self, request, *args, **kwargs): Edit cluster
- def delete(self, request, *args, **kwargs): Remove cluster
<|skeleton|>
class ClusterDetail:
"""get: Show cluster"""
... | e1c67e3041437ad9e17dccc6c95c5ac02184eddb | <|skeleton|>
class ClusterDetail:
"""get: Show cluster"""
def patch(self, request, *args, **kwargs):
"""Edit cluster"""
<|body_0|>
def delete(self, request, *args, **kwargs):
"""Remove cluster"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ClusterDetail:
"""get: Show cluster"""
def patch(self, request, *args, **kwargs):
"""Edit cluster"""
obj = self.get_object()
serializer = self.serializer_class(obj, data=request.data, partial=True, context={'request': request})
return update(serializer)
def delete(sel... | the_stack_v2_python_sparse | api/cluster_views.py | amleshkov/adcm | train | 0 |
530c3caf382aea00d488095b7433da047e1bf838 | [
"home_page = login[1]\nprofile_page = login[3]\nhome_page.select_menu(menu='settings')\nprofile_page.add_worker(name, phone, department)\nactual = profile_page.get_add_text()\nprint('expect:{},actual:{}'.format(expect, actual))\nassert expect in actual, '添加成功, 断言失败'",
"profile_page = login[3]\nprofile_page.add_wo... | <|body_start_0|>
home_page = login[1]
profile_page = login[3]
home_page.select_menu(menu='settings')
profile_page.add_worker(name, phone, department)
actual = profile_page.get_add_text()
print('expect:{},actual:{}'.format(expect, actual))
assert expect in actual, ... | 添加业务员 | TestAddworker | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestAddworker:
"""添加业务员"""
def test_a_add_success(self, login, refresh_page, name, phone, department, expect):
"""验证添加业务员"""
<|body_0|>
def test_b_add_fail(self, login, refresh_page, name, phone, department, expect):
"""验证添加业务员唯一"""
<|body_1|>
def te... | stack_v2_sparse_classes_10k_train_006104 | 2,739 | no_license | [
{
"docstring": "验证添加业务员",
"name": "test_a_add_success",
"signature": "def test_a_add_success(self, login, refresh_page, name, phone, department, expect)"
},
{
"docstring": "验证添加业务员唯一",
"name": "test_b_add_fail",
"signature": "def test_b_add_fail(self, login, refresh_page, name, phone, de... | 4 | stack_v2_sparse_classes_30k_train_004734 | Implement the Python class `TestAddworker` described below.
Class description:
添加业务员
Method signatures and docstrings:
- def test_a_add_success(self, login, refresh_page, name, phone, department, expect): 验证添加业务员
- def test_b_add_fail(self, login, refresh_page, name, phone, department, expect): 验证添加业务员唯一
- def test_c... | Implement the Python class `TestAddworker` described below.
Class description:
添加业务员
Method signatures and docstrings:
- def test_a_add_success(self, login, refresh_page, name, phone, department, expect): 验证添加业务员
- def test_b_add_fail(self, login, refresh_page, name, phone, department, expect): 验证添加业务员唯一
- def test_c... | 0024e3dbc50f95d13a145460bbf8ff151be7e6a6 | <|skeleton|>
class TestAddworker:
"""添加业务员"""
def test_a_add_success(self, login, refresh_page, name, phone, department, expect):
"""验证添加业务员"""
<|body_0|>
def test_b_add_fail(self, login, refresh_page, name, phone, department, expect):
"""验证添加业务员唯一"""
<|body_1|>
def te... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestAddworker:
"""添加业务员"""
def test_a_add_success(self, login, refresh_page, name, phone, department, expect):
"""验证添加业务员"""
home_page = login[1]
profile_page = login[3]
home_page.select_menu(menu='settings')
profile_page.add_worker(name, phone, department)
... | the_stack_v2_python_sparse | TestCases/test_ProfileCase.py | zlj1124/UITestFrameWork | train | 3 |
98563d5f71f5565532860c96cb91a660e54cca54 | [
"new_objects = self.row_converter.block_converter.converter.new_objects\nnew_people = new_objects[Person]\npeople = []\nemails = []\nfor email in self.raw_value.splitlines():\n email = email.strip()\n if not email:\n continue\n if email in new_people:\n people.append(new_people[email].id or 0... | <|body_start_0|>
new_objects = self.row_converter.block_converter.converter.new_objects
new_people = new_objects[Person]
people = []
emails = []
for email in self.raw_value.splitlines():
email = email.strip()
if not email:
continue
... | Handler for default verifiers and assessors. | DefaultPersonColumnHandler | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DefaultPersonColumnHandler:
"""Handler for default verifiers and assessors."""
def _parse_email_values(self):
"""Parse an email list of default assessors. This is the "other" option in the default assessor dropdown menu."""
<|body_0|>
def _parse_label_values(self):
... | stack_v2_sparse_classes_10k_train_006105 | 4,359 | permissive | [
{
"docstring": "Parse an email list of default assessors. This is the \"other\" option in the default assessor dropdown menu.",
"name": "_parse_email_values",
"signature": "def _parse_email_values(self)"
},
{
"docstring": "Parse predefined default assessors. These values are the normal selection... | 5 | null | Implement the Python class `DefaultPersonColumnHandler` described below.
Class description:
Handler for default verifiers and assessors.
Method signatures and docstrings:
- def _parse_email_values(self): Parse an email list of default assessors. This is the "other" option in the default assessor dropdown menu.
- def ... | Implement the Python class `DefaultPersonColumnHandler` described below.
Class description:
Handler for default verifiers and assessors.
Method signatures and docstrings:
- def _parse_email_values(self): Parse an email list of default assessors. This is the "other" option in the default assessor dropdown menu.
- def ... | 9bdc0fc6ca9e252f4919db682d80e360d5581eb4 | <|skeleton|>
class DefaultPersonColumnHandler:
"""Handler for default verifiers and assessors."""
def _parse_email_values(self):
"""Parse an email list of default assessors. This is the "other" option in the default assessor dropdown menu."""
<|body_0|>
def _parse_label_values(self):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DefaultPersonColumnHandler:
"""Handler for default verifiers and assessors."""
def _parse_email_values(self):
"""Parse an email list of default assessors. This is the "other" option in the default assessor dropdown menu."""
new_objects = self.row_converter.block_converter.converter.new_ob... | the_stack_v2_python_sparse | src/ggrc/converters/handlers/default_people.py | HLD/ggrc-core | train | 0 |
1afe17321fd8eec6ba7f92c00aac9f6d3ab2a5f4 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"conte... | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | Missing associated documentation comment in .proto file. | ExperimentManagerRPCServicer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExperimentManagerRPCServicer:
"""Missing associated documentation comment in .proto file."""
def CreateTable(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def SendText(self, request, context):
"""Missing associ... | stack_v2_sparse_classes_10k_train_006106 | 10,693 | permissive | [
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "CreateTable",
"signature": "def CreateTable(self, request, context)"
},
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "SendText",
"signature": "def SendText(self, requ... | 6 | stack_v2_sparse_classes_30k_train_007005 | Implement the Python class `ExperimentManagerRPCServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def CreateTable(self, request, context): Missing associated documentation comment in .proto file.
- def SendText(self, request, con... | Implement the Python class `ExperimentManagerRPCServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def CreateTable(self, request, context): Missing associated documentation comment in .proto file.
- def SendText(self, request, con... | 1c7ca1819325796a6ec604aa1ae8c771708fc50c | <|skeleton|>
class ExperimentManagerRPCServicer:
"""Missing associated documentation comment in .proto file."""
def CreateTable(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def SendText(self, request, context):
"""Missing associ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ExperimentManagerRPCServicer:
"""Missing associated documentation comment in .proto file."""
def CreateTable(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not impl... | the_stack_v2_python_sparse | malib/rpc/proto/exprmanager_pb2_grpc.py | zhihaolyu/malib | train | 0 |
4452bdd6dfb8fc893905d51d144a1ef8303241ac | [
"self.weight_model = weight_model\nif survival_model is None:\n self.survival_model = UnivariateCurveFitter()\nelif isinstance(survival_model, SKLearnBaseEstimator):\n self.survival_model = UnivariateCurveFitter(survival_model)\nelse:\n self.survival_model = survival_model",
"a, _, y, _, X = canonize_dty... | <|body_start_0|>
self.weight_model = weight_model
if survival_model is None:
self.survival_model = UnivariateCurveFitter()
elif isinstance(survival_model, SKLearnBaseEstimator):
self.survival_model = UnivariateCurveFitter(survival_model)
else:
self.sur... | Weighted survival estimator | WeightedSurvival | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WeightedSurvival:
"""Weighted survival estimator"""
def __init__(self, weight_model: WeightEstimator=None, survival_model: Any=None):
"""Weighted survival estimator. Args: weight_model: causallib compatible weight model (e.g., IPW) survival_model: Three alternatives: 1. None - comput... | stack_v2_sparse_classes_10k_train_006107 | 5,765 | permissive | [
{
"docstring": "Weighted survival estimator. Args: weight_model: causallib compatible weight model (e.g., IPW) survival_model: Three alternatives: 1. None - compute non-parametric KaplanMeier survival curve 2. Scikit-Learn estimator (needs to implement `predict_proba`) - compute parametric curve by fitting a ti... | 3 | stack_v2_sparse_classes_30k_train_005809 | Implement the Python class `WeightedSurvival` described below.
Class description:
Weighted survival estimator
Method signatures and docstrings:
- def __init__(self, weight_model: WeightEstimator=None, survival_model: Any=None): Weighted survival estimator. Args: weight_model: causallib compatible weight model (e.g., ... | Implement the Python class `WeightedSurvival` described below.
Class description:
Weighted survival estimator
Method signatures and docstrings:
- def __init__(self, weight_model: WeightEstimator=None, survival_model: Any=None): Weighted survival estimator. Args: weight_model: causallib compatible weight model (e.g., ... | 9f0ddb4696d580cf0a529a6c6ce98b40b34e3796 | <|skeleton|>
class WeightedSurvival:
"""Weighted survival estimator"""
def __init__(self, weight_model: WeightEstimator=None, survival_model: Any=None):
"""Weighted survival estimator. Args: weight_model: causallib compatible weight model (e.g., IPW) survival_model: Three alternatives: 1. None - comput... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class WeightedSurvival:
"""Weighted survival estimator"""
def __init__(self, weight_model: WeightEstimator=None, survival_model: Any=None):
"""Weighted survival estimator. Args: weight_model: causallib compatible weight model (e.g., IPW) survival_model: Three alternatives: 1. None - compute non-paramet... | the_stack_v2_python_sparse | causallib/survival/weighted_survival.py | vishalbelsare/causallib | train | 0 |
d0d6c82a0961feb100260b07864f0f72deb5dd69 | [
"N = len(a0)\nself.N = N\nself.nt = [[None] * N for i in range(M.bit_length() + 1)]\nfor i, a in enumerate(a0):\n self.nt[0][i] = a\nfor i in range(1, len(self.nt)):\n for j in range(N):\n if self.nt[i - 1][j] is None:\n self.nt[i][j] = None\n else:\n self.nt[i][j] = self.n... | <|body_start_0|>
N = len(a0)
self.N = N
self.nt = [[None] * N for i in range(M.bit_length() + 1)]
for i, a in enumerate(a0):
self.nt[0][i] = a
for i in range(1, len(self.nt)):
for j in range(N):
if self.nt[i - 1][j] is None:
... | Doubling | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Doubling:
def __init__(self, a0, M):
"""a0 is an array-like object which contains ai, 0 <= i < N. ai is the next value of i."""
<|body_0|>
def apply(self, i, n):
"""Apply n times from i"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
N = len(a0)
... | stack_v2_sparse_classes_10k_train_006108 | 4,141 | permissive | [
{
"docstring": "a0 is an array-like object which contains ai, 0 <= i < N. ai is the next value of i.",
"name": "__init__",
"signature": "def __init__(self, a0, M)"
},
{
"docstring": "Apply n times from i",
"name": "apply",
"signature": "def apply(self, i, n)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000044 | Implement the Python class `Doubling` described below.
Class description:
Implement the Doubling class.
Method signatures and docstrings:
- def __init__(self, a0, M): a0 is an array-like object which contains ai, 0 <= i < N. ai is the next value of i.
- def apply(self, i, n): Apply n times from i | Implement the Python class `Doubling` described below.
Class description:
Implement the Doubling class.
Method signatures and docstrings:
- def __init__(self, a0, M): a0 is an array-like object which contains ai, 0 <= i < N. ai is the next value of i.
- def apply(self, i, n): Apply n times from i
<|skeleton|>
class ... | 79a16474a8f21310e0fb47e536d527dd5dc6d655 | <|skeleton|>
class Doubling:
def __init__(self, a0, M):
"""a0 is an array-like object which contains ai, 0 <= i < N. ai is the next value of i."""
<|body_0|>
def apply(self, i, n):
"""Apply n times from i"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Doubling:
def __init__(self, a0, M):
"""a0 is an array-like object which contains ai, 0 <= i < N. ai is the next value of i."""
N = len(a0)
self.N = N
self.nt = [[None] * N for i in range(M.bit_length() + 1)]
for i, a in enumerate(a0):
self.nt[0][i] = a
... | the_stack_v2_python_sparse | src/data/1224.py | NULLCT/LOMC | train | 0 | |
2da6cb965ab51ba0afb0232d51e91849485b4ca1 | [
"params = {} if params is None else params\nself.time = None\nself.timestep = None\nself.level_number = None\nself.iteration = None\nself.node = None\nself.problem_pos = None\nself.bit = None\nself.rank = None\nself.target = 0\nself.when = 'after'\nfor k, v in params.items():\n setattr(self, k, v)\nself._freeze"... | <|body_start_0|>
params = {} if params is None else params
self.time = None
self.timestep = None
self.level_number = None
self.iteration = None
self.node = None
self.problem_pos = None
self.bit = None
self.rank = None
self.target = 0
... | Class for storing all the data that belongs to a fault, i.e. when and where it happens | Fault | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Fault:
"""Class for storing all the data that belongs to a fault, i.e. when and where it happens"""
def __init__(self, params=None):
"""Initialization routine for faults Args: params (dict): Parameters regarding when the fault will be inserted"""
<|body_0|>
def random(cl... | stack_v2_sparse_classes_10k_train_006109 | 22,259 | permissive | [
{
"docstring": "Initialization routine for faults Args: params (dict): Parameters regarding when the fault will be inserted",
"name": "__init__",
"signature": "def __init__(self, params=None)"
},
{
"docstring": "Classmethod to initialize a random fault Args: args (dict): Supply variables that wi... | 3 | null | Implement the Python class `Fault` described below.
Class description:
Class for storing all the data that belongs to a fault, i.e. when and where it happens
Method signatures and docstrings:
- def __init__(self, params=None): Initialization routine for faults Args: params (dict): Parameters regarding when the fault ... | Implement the Python class `Fault` described below.
Class description:
Class for storing all the data that belongs to a fault, i.e. when and where it happens
Method signatures and docstrings:
- def __init__(self, params=None): Initialization routine for faults Args: params (dict): Parameters regarding when the fault ... | 1a51834bedffd4472e344bed28f4d766614b1537 | <|skeleton|>
class Fault:
"""Class for storing all the data that belongs to a fault, i.e. when and where it happens"""
def __init__(self, params=None):
"""Initialization routine for faults Args: params (dict): Parameters regarding when the fault will be inserted"""
<|body_0|>
def random(cl... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Fault:
"""Class for storing all the data that belongs to a fault, i.e. when and where it happens"""
def __init__(self, params=None):
"""Initialization routine for faults Args: params (dict): Parameters regarding when the fault will be inserted"""
params = {} if params is None else params
... | the_stack_v2_python_sparse | pySDC/projects/Resilience/fault_injection.py | Parallel-in-Time/pySDC | train | 30 |
14f9107b4b32b556eadb69bd9b22c17ac433e0b1 | [
"db = shell.props.db\nresult = {}\ntry:\n for prop, key in cls.props.iteritems():\n result[prop] = db.entry_get(entry, key)\nexcept:\n pass\nreturn result",
"result = {}\ntry:\n for prop, key in cls.props.iteritems():\n result[prop] = db.entry_get(entry, key)\nexcept:\n pass\nreturn resu... | <|body_start_0|>
db = shell.props.db
result = {}
try:
for prop, key in cls.props.iteritems():
result[prop] = db.entry_get(entry, key)
except:
pass
return result
<|end_body_0|>
<|body_start_1|>
result = {}
try:
f... | Helper functions for song database entries | EntryHelper | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EntryHelper:
"""Helper functions for song database entries"""
def track_details(cls, shell, entry):
"""Retrieves details associated with a db entry @return: (artist, title)"""
<|body_0|>
def track_details2(cls, db, entry):
"""Retrieves details associated with a d... | stack_v2_sparse_classes_10k_train_006110 | 1,449 | no_license | [
{
"docstring": "Retrieves details associated with a db entry @return: (artist, title)",
"name": "track_details",
"signature": "def track_details(cls, shell, entry)"
},
{
"docstring": "Retrieves details associated with a db entry @return: (artist, title)",
"name": "track_details2",
"signa... | 2 | stack_v2_sparse_classes_30k_train_002111 | Implement the Python class `EntryHelper` described below.
Class description:
Helper functions for song database entries
Method signatures and docstrings:
- def track_details(cls, shell, entry): Retrieves details associated with a db entry @return: (artist, title)
- def track_details2(cls, db, entry): Retrieves detail... | Implement the Python class `EntryHelper` described below.
Class description:
Helper functions for song database entries
Method signatures and docstrings:
- def track_details(cls, shell, entry): Retrieves details associated with a db entry @return: (artist, title)
- def track_details2(cls, db, entry): Retrieves detail... | d01d41dafdf9a1ea1b09e52eb3301da7652865fb | <|skeleton|>
class EntryHelper:
"""Helper functions for song database entries"""
def track_details(cls, shell, entry):
"""Retrieves details associated with a db entry @return: (artist, title)"""
<|body_0|>
def track_details2(cls, db, entry):
"""Retrieves details associated with a d... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class EntryHelper:
"""Helper functions for song database entries"""
def track_details(cls, shell, entry):
"""Retrieves details associated with a db entry @return: (artist, title)"""
db = shell.props.db
result = {}
try:
for prop, key in cls.props.iteritems():
... | the_stack_v2_python_sparse | src/synclastfm/helpers.py | jldupont/rb_synclastfm | train | 5 |
38ba1d971ae5588a2cb144c3285cc379a600d60a | [
"from . import _vtk\nimage_data = pyvista.read(image_path)\nsuper().__init__(parent, border=False)\nself.SetLayer(0)\nself.InteractiveOff()\nself.SetBackground(self.parent.renderer.GetBackground())\nself._scale = scale\nself._modified_observer = None\nself._prior_window_size = None\nif view_port is not None:\n s... | <|body_start_0|>
from . import _vtk
image_data = pyvista.read(image_path)
super().__init__(parent, border=False)
self.SetLayer(0)
self.InteractiveOff()
self.SetBackground(self.parent.renderer.GetBackground())
self._scale = scale
self._modified_observer = N... | BackgroundRenderer for visualizing a background image. | BackgroundRenderer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BackgroundRenderer:
"""BackgroundRenderer for visualizing a background image."""
def __init__(self, parent, image_path, scale=1, view_port=None):
"""Initialize BackgroundRenderer with an image."""
<|body_0|>
def resize(self, *args):
"""Resize a background rendere... | stack_v2_sparse_classes_10k_train_006111 | 2,566 | permissive | [
{
"docstring": "Initialize BackgroundRenderer with an image.",
"name": "__init__",
"signature": "def __init__(self, parent, image_path, scale=1, view_port=None)"
},
{
"docstring": "Resize a background renderer.",
"name": "resize",
"signature": "def resize(self, *args)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003347 | Implement the Python class `BackgroundRenderer` described below.
Class description:
BackgroundRenderer for visualizing a background image.
Method signatures and docstrings:
- def __init__(self, parent, image_path, scale=1, view_port=None): Initialize BackgroundRenderer with an image.
- def resize(self, *args): Resize... | Implement the Python class `BackgroundRenderer` described below.
Class description:
BackgroundRenderer for visualizing a background image.
Method signatures and docstrings:
- def __init__(self, parent, image_path, scale=1, view_port=None): Initialize BackgroundRenderer with an image.
- def resize(self, *args): Resize... | 1b450b23340f367315fc914075d551e0a4df8cc3 | <|skeleton|>
class BackgroundRenderer:
"""BackgroundRenderer for visualizing a background image."""
def __init__(self, parent, image_path, scale=1, view_port=None):
"""Initialize BackgroundRenderer with an image."""
<|body_0|>
def resize(self, *args):
"""Resize a background rendere... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BackgroundRenderer:
"""BackgroundRenderer for visualizing a background image."""
def __init__(self, parent, image_path, scale=1, view_port=None):
"""Initialize BackgroundRenderer with an image."""
from . import _vtk
image_data = pyvista.read(image_path)
super().__init__(pa... | the_stack_v2_python_sparse | pyvista/plotting/background_renderer.py | pyvista/pyvista | train | 1,885 |
39b2c46ebe665b6b8a12e7e522c2d6549927d612 | [
"self.num = numerator\nself.denom = denominator\nif self.denom == 0:\n raise ZeroDivisionError('you cannot divide by zero')\nself._reduce()",
"d = gcd(self.num, self.denom)\nself.num /= d\nself.denom /= d\nif self.denom < 0:\n self.num = -self.num\n self.denom = -self.denom\nif self.num == 0:\n self.d... | <|body_start_0|>
self.num = numerator
self.denom = denominator
if self.denom == 0:
raise ZeroDivisionError('you cannot divide by zero')
self._reduce()
<|end_body_0|>
<|body_start_1|>
d = gcd(self.num, self.denom)
self.num /= d
self.denom /= d
... | This class represents a franctional value. E.g. 1/10 | Fraction | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Fraction:
"""This class represents a franctional value. E.g. 1/10"""
def __init__(self, numerator, denominator):
"""Initialize this fraction to (numerator / denominator)."""
<|body_0|>
def _reduce(self):
"""Reduce the fraction to its canonical (simplified) form. ... | stack_v2_sparse_classes_10k_train_006112 | 960 | no_license | [
{
"docstring": "Initialize this fraction to (numerator / denominator).",
"name": "__init__",
"signature": "def __init__(self, numerator, denominator)"
},
{
"docstring": "Reduce the fraction to its canonical (simplified) form. E.g. 2/4 becomes 1/2.",
"name": "_reduce",
"signature": "def _... | 2 | stack_v2_sparse_classes_30k_train_004454 | Implement the Python class `Fraction` described below.
Class description:
This class represents a franctional value. E.g. 1/10
Method signatures and docstrings:
- def __init__(self, numerator, denominator): Initialize this fraction to (numerator / denominator).
- def _reduce(self): Reduce the fraction to its canonica... | Implement the Python class `Fraction` described below.
Class description:
This class represents a franctional value. E.g. 1/10
Method signatures and docstrings:
- def __init__(self, numerator, denominator): Initialize this fraction to (numerator / denominator).
- def _reduce(self): Reduce the fraction to its canonica... | eb67298353f763da82ea6498e5c254e2b246faf8 | <|skeleton|>
class Fraction:
"""This class represents a franctional value. E.g. 1/10"""
def __init__(self, numerator, denominator):
"""Initialize this fraction to (numerator / denominator)."""
<|body_0|>
def _reduce(self):
"""Reduce the fraction to its canonical (simplified) form. ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Fraction:
"""This class represents a franctional value. E.g. 1/10"""
def __init__(self, numerator, denominator):
"""Initialize this fraction to (numerator / denominator)."""
self.num = numerator
self.denom = denominator
if self.denom == 0:
raise ZeroDivisionErr... | the_stack_v2_python_sparse | OOP/ryan_henning/demo1/fraction.py | wmarshall484/DSI_LECTURES_2 | train | 1 |
3426ce021077b9f136c04fb2e0254e26b2bcce31 | [
"container = self\nparent_item = None\nfor item_name in item_names:\n item = ui.Block(By.XPATH, self._item_selector.format(item_name))\n item.container = container\n if not item.webelement.is_displayed() and parent_item:\n parent_item.click()\n wait(item.webelement.is_displayed, timeout_secon... | <|body_start_0|>
container = self
parent_item = None
for item_name in item_names:
item = ui.Block(By.XPATH, self._item_selector.format(item_name))
item.container = container
if not item.webelement.is_displayed() and parent_item:
parent_item.cli... | Navigate menu. | NavigateMenu | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NavigateMenu:
"""Navigate menu."""
def go_to(self, item_names):
"""Go to page via navigate menu. Arguments: - item_names: list of items of navigate menu."""
<|body_0|>
def has_item(self, item_names):
"""Check that navigate menu has item. Args: item_names (list): ... | stack_v2_sparse_classes_10k_train_006113 | 2,545 | no_license | [
{
"docstring": "Go to page via navigate menu. Arguments: - item_names: list of items of navigate menu.",
"name": "go_to",
"signature": "def go_to(self, item_names)"
},
{
"docstring": "Check that navigate menu has item. Args: item_names (list): list of items of navigate menu. Returns: bool: is it... | 2 | null | Implement the Python class `NavigateMenu` described below.
Class description:
Navigate menu.
Method signatures and docstrings:
- def go_to(self, item_names): Go to page via navigate menu. Arguments: - item_names: list of items of navigate menu.
- def has_item(self, item_names): Check that navigate menu has item. Args... | Implement the Python class `NavigateMenu` described below.
Class description:
Navigate menu.
Method signatures and docstrings:
- def go_to(self, item_names): Go to page via navigate menu. Arguments: - item_names: list of items of navigate menu.
- def has_item(self, item_names): Check that navigate menu has item. Args... | e7583444cd24893ec6ae237b47db7c605b99b0c5 | <|skeleton|>
class NavigateMenu:
"""Navigate menu."""
def go_to(self, item_names):
"""Go to page via navigate menu. Arguments: - item_names: list of items of navigate menu."""
<|body_0|>
def has_item(self, item_names):
"""Check that navigate menu has item. Args: item_names (list): ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class NavigateMenu:
"""Navigate menu."""
def go_to(self, item_names):
"""Go to page via navigate menu. Arguments: - item_names: list of items of navigate menu."""
container = self
parent_item = None
for item_name in item_names:
item = ui.Block(By.XPATH, self._item_se... | the_stack_v2_python_sparse | stepler/horizon/app/ui/navigate_menu.py | Mirantis/stepler | train | 16 |
a635c9433a2fc54177c8f5a94edeaef0dddf5a3a | [
"msg = request.json\nif not msg:\n logger.debug(\"/testing-farm/results: we haven't received any JSON data.\")\n return (\"We haven't received any JSON data.\", HTTPStatus.BAD_REQUEST)\ntry:\n self.validate_testing_farm_request()\nexcept ValidationFailed as exc:\n logger.info(f'/testing-farm/results {ex... | <|body_start_0|>
msg = request.json
if not msg:
logger.debug("/testing-farm/results: we haven't received any JSON data.")
return ("We haven't received any JSON data.", HTTPStatus.BAD_REQUEST)
try:
self.validate_testing_farm_request()
except ValidationF... | TestingFarmResults | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestingFarmResults:
def post(self):
"""Submit Testing Farm results"""
<|body_0|>
def validate_testing_farm_request():
"""Validate testing farm token received in request with the one in packit-service.yaml :raises ValidationFailed"""
<|body_1|>
<|end_skeleton... | stack_v2_sparse_classes_10k_train_006114 | 4,956 | permissive | [
{
"docstring": "Submit Testing Farm results",
"name": "post",
"signature": "def post(self)"
},
{
"docstring": "Validate testing farm token received in request with the one in packit-service.yaml :raises ValidationFailed",
"name": "validate_testing_farm_request",
"signature": "def validat... | 2 | stack_v2_sparse_classes_30k_train_002320 | Implement the Python class `TestingFarmResults` described below.
Class description:
Implement the TestingFarmResults class.
Method signatures and docstrings:
- def post(self): Submit Testing Farm results
- def validate_testing_farm_request(): Validate testing farm token received in request with the one in packit-serv... | Implement the Python class `TestingFarmResults` described below.
Class description:
Implement the TestingFarmResults class.
Method signatures and docstrings:
- def post(self): Submit Testing Farm results
- def validate_testing_farm_request(): Validate testing farm token received in request with the one in packit-serv... | 03f840cdfbcc129582a2ec2a20f069c85fea0c56 | <|skeleton|>
class TestingFarmResults:
def post(self):
"""Submit Testing Farm results"""
<|body_0|>
def validate_testing_farm_request():
"""Validate testing farm token received in request with the one in packit-service.yaml :raises ValidationFailed"""
<|body_1|>
<|end_skeleton... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestingFarmResults:
def post(self):
"""Submit Testing Farm results"""
msg = request.json
if not msg:
logger.debug("/testing-farm/results: we haven't received any JSON data.")
return ("We haven't received any JSON data.", HTTPStatus.BAD_REQUEST)
try:
... | the_stack_v2_python_sparse | packit_service/service/api/testing_farm.py | FalseG0d/packit-service | train | 2 | |
76ce83894187cfc171dc9f92cbb72c68ebc74cb5 | [
"self.listedQValuesDict = {}\nself.inputFiles = inputFiles\nself.pertQValuesDict = self.scientificNotation(pertDict)\nself.fileReconstruction()\nself.printInput(workingDir)",
"for key, value in pertDict.items():\n pertDict[key] = '%.3E' % Decimal(str(value))\nreturn pertDict",
"for line in lines:\n line =... | <|body_start_0|>
self.listedQValuesDict = {}
self.inputFiles = inputFiles
self.pertQValuesDict = self.scientificNotation(pertDict)
self.fileReconstruction()
self.printInput(workingDir)
<|end_body_0|>
<|body_start_1|>
for key, value in pertDict.items():
pertDi... | Parses the PHISICS Qvalues library and replaces the nominal values by the perturbed values. | QValuesParser | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-2-Clause",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QValuesParser:
"""Parses the PHISICS Qvalues library and replaces the nominal values by the perturbed values."""
def __init__(self, inputFiles, workingDir, **pertDict):
"""Constructor. @ In, inputFiles, string, Qvalues library file. @ In, workingDir, string, path to working directory... | stack_v2_sparse_classes_10k_train_006115 | 4,140 | permissive | [
{
"docstring": "Constructor. @ In, inputFiles, string, Qvalues library file. @ In, workingDir, string, path to working directory @ In, pertDict, dictionary, dictionary of perturbed variables @ Out, None",
"name": "__init__",
"signature": "def __init__(self, inputFiles, workingDir, **pertDict)"
},
{
... | 6 | null | Implement the Python class `QValuesParser` described below.
Class description:
Parses the PHISICS Qvalues library and replaces the nominal values by the perturbed values.
Method signatures and docstrings:
- def __init__(self, inputFiles, workingDir, **pertDict): Constructor. @ In, inputFiles, string, Qvalues library ... | Implement the Python class `QValuesParser` described below.
Class description:
Parses the PHISICS Qvalues library and replaces the nominal values by the perturbed values.
Method signatures and docstrings:
- def __init__(self, inputFiles, workingDir, **pertDict): Constructor. @ In, inputFiles, string, Qvalues library ... | 2b16e7aa3325fe84cab2477947a951414c635381 | <|skeleton|>
class QValuesParser:
"""Parses the PHISICS Qvalues library and replaces the nominal values by the perturbed values."""
def __init__(self, inputFiles, workingDir, **pertDict):
"""Constructor. @ In, inputFiles, string, Qvalues library file. @ In, workingDir, string, path to working directory... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class QValuesParser:
"""Parses the PHISICS Qvalues library and replaces the nominal values by the perturbed values."""
def __init__(self, inputFiles, workingDir, **pertDict):
"""Constructor. @ In, inputFiles, string, Qvalues library file. @ In, workingDir, string, path to working directory @ In, pertDi... | the_stack_v2_python_sparse | ravenframework/CodeInterfaceClasses/PHISICS/QValuesParser.py | idaholab/raven | train | 201 |
1a55c6789e5d75c60c38e232bfa5b6b43938252d | [
"if len(s) < 2:\n return s\nss = s + '#' + s[::-1]\nlength, M = (0, len(ss))\ni, lps = (1, [0] * M)\nwhile i < M:\n if ss[i] == ss[length]:\n length += 1\n lps[i] = length\n i += 1\n elif length == 0:\n lps[i] = 0\n i += 1\n else:\n length = lps[length - 1]\nret... | <|body_start_0|>
if len(s) < 2:
return s
ss = s + '#' + s[::-1]
length, M = (0, len(ss))
i, lps = (1, [0] * M)
while i < M:
if ss[i] == ss[length]:
length += 1
lps[i] = length
i += 1
elif length =... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def shortestPalindrome(self, s):
""":type s: str :rtype: str"""
<|body_0|>
def shortestPalindrome2(self, s):
""":type s: str :rtype: str"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if len(s) < 2:
return s
ss = s + '... | stack_v2_sparse_classes_10k_train_006116 | 2,505 | no_license | [
{
"docstring": ":type s: str :rtype: str",
"name": "shortestPalindrome",
"signature": "def shortestPalindrome(self, s)"
},
{
"docstring": ":type s: str :rtype: str",
"name": "shortestPalindrome2",
"signature": "def shortestPalindrome2(self, s)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def shortestPalindrome(self, s): :type s: str :rtype: str
- def shortestPalindrome2(self, s): :type s: str :rtype: str | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def shortestPalindrome(self, s): :type s: str :rtype: str
- def shortestPalindrome2(self, s): :type s: str :rtype: str
<|skeleton|>
class Solution:
def shortestPalindrome(s... | 635af6e22aa8eef8e7920a585d43a45a891a8157 | <|skeleton|>
class Solution:
def shortestPalindrome(self, s):
""":type s: str :rtype: str"""
<|body_0|>
def shortestPalindrome2(self, s):
""":type s: str :rtype: str"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def shortestPalindrome(self, s):
""":type s: str :rtype: str"""
if len(s) < 2:
return s
ss = s + '#' + s[::-1]
length, M = (0, len(ss))
i, lps = (1, [0] * M)
while i < M:
if ss[i] == ss[length]:
length += 1
... | the_stack_v2_python_sparse | code214ShortestPalindrome.py | cybelewang/leetcode-python | train | 0 | |
d6ad663f1a8334a2aadae0904b309e22d3ef6a45 | [
"self.hdfs_entity_id = hdfs_entity_id\nself.kerberos_principal = kerberos_principal\nself.metastore = metastore\nself.thrift_port = thrift_port",
"if dictionary is None:\n return None\nhdfs_entity_id = dictionary.get('hdfsEntityId')\nkerberos_principal = dictionary.get('kerberosPrincipal')\nmetastore = diction... | <|body_start_0|>
self.hdfs_entity_id = hdfs_entity_id
self.kerberos_principal = kerberos_principal
self.metastore = metastore
self.thrift_port = thrift_port
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
hdfs_entity_id = dictionary.get('hd... | Implementation of the 'HiveConnectParams' model. Specifies an Object containing information about a registered Hive source. Attributes: hdfs_entity_id (long|int): Specifies the entity id of the HDFS source for this Hive kerberos_principal (string): Specifies the kerberos principal. metastore (string): Specifies the Hiv... | HiveConnectParams | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HiveConnectParams:
"""Implementation of the 'HiveConnectParams' model. Specifies an Object containing information about a registered Hive source. Attributes: hdfs_entity_id (long|int): Specifies the entity id of the HDFS source for this Hive kerberos_principal (string): Specifies the kerberos pri... | stack_v2_sparse_classes_10k_train_006117 | 2,242 | permissive | [
{
"docstring": "Constructor for the HiveConnectParams class",
"name": "__init__",
"signature": "def __init__(self, hdfs_entity_id=None, kerberos_principal=None, metastore=None, thrift_port=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary)... | 2 | null | Implement the Python class `HiveConnectParams` described below.
Class description:
Implementation of the 'HiveConnectParams' model. Specifies an Object containing information about a registered Hive source. Attributes: hdfs_entity_id (long|int): Specifies the entity id of the HDFS source for this Hive kerberos_princip... | Implement the Python class `HiveConnectParams` described below.
Class description:
Implementation of the 'HiveConnectParams' model. Specifies an Object containing information about a registered Hive source. Attributes: hdfs_entity_id (long|int): Specifies the entity id of the HDFS source for this Hive kerberos_princip... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class HiveConnectParams:
"""Implementation of the 'HiveConnectParams' model. Specifies an Object containing information about a registered Hive source. Attributes: hdfs_entity_id (long|int): Specifies the entity id of the HDFS source for this Hive kerberos_principal (string): Specifies the kerberos pri... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class HiveConnectParams:
"""Implementation of the 'HiveConnectParams' model. Specifies an Object containing information about a registered Hive source. Attributes: hdfs_entity_id (long|int): Specifies the entity id of the HDFS source for this Hive kerberos_principal (string): Specifies the kerberos principal. metas... | the_stack_v2_python_sparse | cohesity_management_sdk/models/hive_connect_params.py | cohesity/management-sdk-python | train | 24 |
33112e4a63f4035ddb0defd25cda9086d12ef5d7 | [
"is_optional, game_name = _is_optional_game(basename)\nif is_optional:\n if game_name not in _AVAILABLE_GAMES:\n logging.info('Skipping %s because %s is not built in.', basename, game_name)\n return\nfile_path = os.path.join(path, basename)\nexpected, actual = generate_playthrough.replay(file_path)... | <|body_start_0|>
is_optional, game_name = _is_optional_game(basename)
if is_optional:
if game_name not in _AVAILABLE_GAMES:
logging.info('Skipping %s because %s is not built in.', basename, game_name)
return
file_path = os.path.join(path, basename)
... | PlaythroughTest | [
"LicenseRef-scancode-generic-cla",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PlaythroughTest:
def run_test(self, path, basename):
"""Instantiated for each test case in main, below."""
<|body_0|>
def test_all_games_tested(self):
"""Verify that every game is present in the playthroughs."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_10k_train_006118 | 4,203 | permissive | [
{
"docstring": "Instantiated for each test case in main, below.",
"name": "run_test",
"signature": "def run_test(self, path, basename)"
},
{
"docstring": "Verify that every game is present in the playthroughs.",
"name": "test_all_games_tested",
"signature": "def test_all_games_tested(sel... | 2 | null | Implement the Python class `PlaythroughTest` described below.
Class description:
Implement the PlaythroughTest class.
Method signatures and docstrings:
- def run_test(self, path, basename): Instantiated for each test case in main, below.
- def test_all_games_tested(self): Verify that every game is present in the play... | Implement the Python class `PlaythroughTest` described below.
Class description:
Implement the PlaythroughTest class.
Method signatures and docstrings:
- def run_test(self, path, basename): Instantiated for each test case in main, below.
- def test_all_games_tested(self): Verify that every game is present in the play... | 6f3551fd990053cf2287b380fb9ad0b2a2607c18 | <|skeleton|>
class PlaythroughTest:
def run_test(self, path, basename):
"""Instantiated for each test case in main, below."""
<|body_0|>
def test_all_games_tested(self):
"""Verify that every game is present in the playthroughs."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PlaythroughTest:
def run_test(self, path, basename):
"""Instantiated for each test case in main, below."""
is_optional, game_name = _is_optional_game(basename)
if is_optional:
if game_name not in _AVAILABLE_GAMES:
logging.info('Skipping %s because %s is not ... | the_stack_v2_python_sparse | open_spiel/integration_tests/playthrough_test.py | sarahperrin/open_spiel | train | 3 | |
641545540bcfb7496d5a8ce06bae2ef61738eee0 | [
"tp = type(e)\ntb = e.__traceback__\ntraceback_str = 'Traceback (most recent call last):\\n' + ''.join(traceback.format_tb(tb))\ntry:\n attributes = e.get_attributes()\nexcept AttributeError:\n attributes = {}\nreturn (sy.serde.msgpack.serde._simplify(worker, tp.__name__), sy.serde.msgpack.serde._simplify(wor... | <|body_start_0|>
tp = type(e)
tb = e.__traceback__
traceback_str = 'Traceback (most recent call last):\n' + ''.join(traceback.format_tb(tb))
try:
attributes = e.get_attributes()
except AttributeError:
attributes = {}
return (sy.serde.msgpack.serde.... | Raised when calling get on a pointer to a tensor which does not allow get to be called on it. This can happen do to sensitivity being too high | GetNotPermittedError | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GetNotPermittedError:
"""Raised when calling get on a pointer to a tensor which does not allow get to be called on it. This can happen do to sensitivity being too high"""
def simplify(worker: 'sy.workers.AbstractWorker', e):
"""Serialize information about an Exception which was raise... | stack_v2_sparse_classes_10k_train_006119 | 15,166 | permissive | [
{
"docstring": "Serialize information about an Exception which was raised to forward it",
"name": "simplify",
"signature": "def simplify(worker: 'sy.workers.AbstractWorker', e)"
},
{
"docstring": "Detail and re-raise an Exception forwarded by another worker",
"name": "detail",
"signature... | 2 | stack_v2_sparse_classes_30k_train_006331 | Implement the Python class `GetNotPermittedError` described below.
Class description:
Raised when calling get on a pointer to a tensor which does not allow get to be called on it. This can happen do to sensitivity being too high
Method signatures and docstrings:
- def simplify(worker: 'sy.workers.AbstractWorker', e):... | Implement the Python class `GetNotPermittedError` described below.
Class description:
Raised when calling get on a pointer to a tensor which does not allow get to be called on it. This can happen do to sensitivity being too high
Method signatures and docstrings:
- def simplify(worker: 'sy.workers.AbstractWorker', e):... | cc4765bed880ad38a02505834f63df39e0815328 | <|skeleton|>
class GetNotPermittedError:
"""Raised when calling get on a pointer to a tensor which does not allow get to be called on it. This can happen do to sensitivity being too high"""
def simplify(worker: 'sy.workers.AbstractWorker', e):
"""Serialize information about an Exception which was raise... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GetNotPermittedError:
"""Raised when calling get on a pointer to a tensor which does not allow get to be called on it. This can happen do to sensitivity being too high"""
def simplify(worker: 'sy.workers.AbstractWorker', e):
"""Serialize information about an Exception which was raised to forward ... | the_stack_v2_python_sparse | syft/exceptions.py | tudorcebere/PySyft | train | 2 |
3e4e4a6e4292c2b9b9273c02670d58e775c63732 | [
"argument_group.add_argument('--profilers', dest='profilers', type=str, action='store', default='', metavar='PROFILERS_LIST', help='List of profilers to use by the tool. This is a comma separated list where each entry is the name of a profiler. Use \"--profilers list\" to list the available profilers.')\nargument_g... | <|body_start_0|>
argument_group.add_argument('--profilers', dest='profilers', type=str, action='store', default='', metavar='PROFILERS_LIST', help='List of profilers to use by the tool. This is a comma separated list where each entry is the name of a profiler. Use "--profilers list" to list the available profil... | Profiling CLI arguments helper. | ProfilingArgumentsHelper | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProfilingArgumentsHelper:
"""Profiling CLI arguments helper."""
def AddArguments(cls, argument_group):
"""Adds command line arguments to an argument group. This function takes an argument parser or an argument group object and adds to it all the command line arguments this helper sup... | stack_v2_sparse_classes_10k_train_006120 | 4,561 | permissive | [
{
"docstring": "Adds command line arguments to an argument group. This function takes an argument parser or an argument group object and adds to it all the command line arguments this helper supports. Args: argument_group (argparse._ArgumentGroup|argparse.ArgumentParser): argparse group.",
"name": "AddArgum... | 2 | null | Implement the Python class `ProfilingArgumentsHelper` described below.
Class description:
Profiling CLI arguments helper.
Method signatures and docstrings:
- def AddArguments(cls, argument_group): Adds command line arguments to an argument group. This function takes an argument parser or an argument group object and ... | Implement the Python class `ProfilingArgumentsHelper` described below.
Class description:
Profiling CLI arguments helper.
Method signatures and docstrings:
- def AddArguments(cls, argument_group): Adds command line arguments to an argument group. This function takes an argument parser or an argument group object and ... | d6022f8cfebfddf2d08ab2d300a41b61f3349933 | <|skeleton|>
class ProfilingArgumentsHelper:
"""Profiling CLI arguments helper."""
def AddArguments(cls, argument_group):
"""Adds command line arguments to an argument group. This function takes an argument parser or an argument group object and adds to it all the command line arguments this helper sup... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ProfilingArgumentsHelper:
"""Profiling CLI arguments helper."""
def AddArguments(cls, argument_group):
"""Adds command line arguments to an argument group. This function takes an argument parser or an argument group object and adds to it all the command line arguments this helper supports. Args: ... | the_stack_v2_python_sparse | plaso/cli/helpers/profiling.py | log2timeline/plaso | train | 1,506 |
a16403fcf0714da7e9242cdb04eeba1445888cdb | [
"if n < 0:\n n = -n\n x = 1 / x\nres = 1\nwhile n:\n if n & 1:\n res *= x\n x *= x\n n >>= 1\nreturn res",
"if n == 0:\n return 1\nif n < 0:\n return 1 / self.myPow1(x, -n)\nif n & 1:\n return x * self.myPow1(x * x, n >> 1)\nelse:\n return self.myPow1(x * x, n >> 1)"
] | <|body_start_0|>
if n < 0:
n = -n
x = 1 / x
res = 1
while n:
if n & 1:
res *= x
x *= x
n >>= 1
return res
<|end_body_0|>
<|body_start_1|>
if n == 0:
return 1
if n < 0:
ret... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def myPow(self, x, n):
""":type x: float :type n: int :rtype: float"""
<|body_0|>
def myPow1(self, x, n):
""":type x: float :type n: int :rtype: float"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if n < 0:
n = -n
... | stack_v2_sparse_classes_10k_train_006121 | 714 | no_license | [
{
"docstring": ":type x: float :type n: int :rtype: float",
"name": "myPow",
"signature": "def myPow(self, x, n)"
},
{
"docstring": ":type x: float :type n: int :rtype: float",
"name": "myPow1",
"signature": "def myPow1(self, x, n)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000800 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def myPow(self, x, n): :type x: float :type n: int :rtype: float
- def myPow1(self, x, n): :type x: float :type n: int :rtype: float | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def myPow(self, x, n): :type x: float :type n: int :rtype: float
- def myPow1(self, x, n): :type x: float :type n: int :rtype: float
<|skeleton|>
class Solution:
def myPow(... | f1d780b7e8b91b4df704651514018143c6931f9d | <|skeleton|>
class Solution:
def myPow(self, x, n):
""":type x: float :type n: int :rtype: float"""
<|body_0|>
def myPow1(self, x, n):
""":type x: float :type n: int :rtype: float"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def myPow(self, x, n):
""":type x: float :type n: int :rtype: float"""
if n < 0:
n = -n
x = 1 / x
res = 1
while n:
if n & 1:
res *= x
x *= x
n >>= 1
return res
def myPow1(self, x,... | the_stack_v2_python_sparse | ProgramForLeetCode/LeetCode/50_myPow.py | DQDH/Algorithm_Code | train | 0 | |
c3ae9ba7ad2c5c3460f2bb4e281835bf267f2ef8 | [
"np.random.seed(6589)\nn = 100\ndtypes = [np.float32, np.float64]\nfor dtype in dtypes:\n volatilities = np.exp(np.random.randn(n) / 2)\n forwards = np.exp(np.random.randn(n))\n strikes = forwards * (1 + (np.random.rand(n) - 0.5) * 0.2)\n expiries = np.exp(np.random.randn(n))\n prices = self.evaluate... | <|body_start_0|>
np.random.seed(6589)
n = 100
dtypes = [np.float32, np.float64]
for dtype in dtypes:
volatilities = np.exp(np.random.randn(n) / 2)
forwards = np.exp(np.random.randn(n))
strikes = forwards * (1 + (np.random.rand(n) - 0.5) * 0.2)
... | Tests for methods in implied_vol module. | ImpliedVolTest | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImpliedVolTest:
"""Tests for methods in implied_vol module."""
def test_implied_vol(self):
"""Basic test of the implied vol calculation."""
<|body_0|>
def test_validate(self):
"""Test the algorithm doesn't raise where it shouldn't."""
<|body_1|>
def ... | stack_v2_sparse_classes_10k_train_006122 | 4,993 | permissive | [
{
"docstring": "Basic test of the implied vol calculation.",
"name": "test_implied_vol",
"signature": "def test_implied_vol(self)"
},
{
"docstring": "Test the algorithm doesn't raise where it shouldn't.",
"name": "test_validate",
"signature": "def test_validate(self)"
},
{
"docst... | 3 | null | Implement the Python class `ImpliedVolTest` described below.
Class description:
Tests for methods in implied_vol module.
Method signatures and docstrings:
- def test_implied_vol(self): Basic test of the implied vol calculation.
- def test_validate(self): Test the algorithm doesn't raise where it shouldn't.
- def test... | Implement the Python class `ImpliedVolTest` described below.
Class description:
Tests for methods in implied_vol module.
Method signatures and docstrings:
- def test_implied_vol(self): Basic test of the implied vol calculation.
- def test_validate(self): Test the algorithm doesn't raise where it shouldn't.
- def test... | 0d3a2193c0f2d320b65e602cf01d7a617da484df | <|skeleton|>
class ImpliedVolTest:
"""Tests for methods in implied_vol module."""
def test_implied_vol(self):
"""Basic test of the implied vol calculation."""
<|body_0|>
def test_validate(self):
"""Test the algorithm doesn't raise where it shouldn't."""
<|body_1|>
def ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ImpliedVolTest:
"""Tests for methods in implied_vol module."""
def test_implied_vol(self):
"""Basic test of the implied vol calculation."""
np.random.seed(6589)
n = 100
dtypes = [np.float32, np.float64]
for dtype in dtypes:
volatilities = np.exp(np.rand... | the_stack_v2_python_sparse | tf_quant_finance/black_scholes/implied_vol_lib_test.py | google/tf-quant-finance | train | 4,165 |
9fc802374ab633245ea8ef5d10208cd15e294317 | [
"def dfs(index, num, digit):\n if index == digit:\n res.append(int(''.join(num)))\n return\n for i in range(10):\n num.append(str(i))\n dfs(index + 1, num, digit)\n num.pop()\nres = []\nfor digit in range(1, n + 1):\n for first in range(1, 10):\n num = [str(first)]... | <|body_start_0|>
def dfs(index, num, digit):
if index == digit:
res.append(int(''.join(num)))
return
for i in range(10):
num.append(str(i))
dfs(index + 1, num, digit)
num.pop()
res = []
for di... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def printNumbers(self, n):
""":type n: int :rtype: List[int] 全排列"""
<|body_0|>
def printNumbers0(self, n):
""":type n: int :rtype: List[int] 队列"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
def dfs(index, num, digit):
if inde... | stack_v2_sparse_classes_10k_train_006123 | 1,638 | no_license | [
{
"docstring": ":type n: int :rtype: List[int] 全排列",
"name": "printNumbers",
"signature": "def printNumbers(self, n)"
},
{
"docstring": ":type n: int :rtype: List[int] 队列",
"name": "printNumbers0",
"signature": "def printNumbers0(self, n)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def printNumbers(self, n): :type n: int :rtype: List[int] 全排列
- def printNumbers0(self, n): :type n: int :rtype: List[int] 队列 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def printNumbers(self, n): :type n: int :rtype: List[int] 全排列
- def printNumbers0(self, n): :type n: int :rtype: List[int] 队列
<|skeleton|>
class Solution:
def printNumbers(... | 6e18c5d257840489cc3fb1079ae3804c743982a4 | <|skeleton|>
class Solution:
def printNumbers(self, n):
""":type n: int :rtype: List[int] 全排列"""
<|body_0|>
def printNumbers0(self, n):
""":type n: int :rtype: List[int] 队列"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def printNumbers(self, n):
""":type n: int :rtype: List[int] 全排列"""
def dfs(index, num, digit):
if index == digit:
res.append(int(''.join(num)))
return
for i in range(10):
num.append(str(i))
dfs(i... | the_stack_v2_python_sparse | 剑指 Offer 17. 打印从1到最大的n位数.py | yangyuxiang1996/leetcode | train | 0 | |
a2a597bf72c9644aa73e96cefbf998a4507f28af | [
"if len(seed_bytes) < Bip32Slip10MstKeyGeneratorConst.SEED_MIN_BYTE_LEN:\n raise ValueError(f'Invalid seed length ({len(seed_bytes)})')\nkey_bytes = Pbkdf2HmacSha512.DeriveKey(CardanoIcarusMasterKeyGeneratorConst.PBKDF2_PASSWORD, seed_bytes, CardanoIcarusMasterKeyGeneratorConst.PBKDF2_ROUNDS, CardanoIcarusMaster... | <|body_start_0|>
if len(seed_bytes) < Bip32Slip10MstKeyGeneratorConst.SEED_MIN_BYTE_LEN:
raise ValueError(f'Invalid seed length ({len(seed_bytes)})')
key_bytes = Pbkdf2HmacSha512.DeriveKey(CardanoIcarusMasterKeyGeneratorConst.PBKDF2_PASSWORD, seed_bytes, CardanoIcarusMasterKeyGeneratorConst.... | Cardano Icarus master key generator class. It allows master keys generation in according to Cardano Icarus. | CardanoIcarusMstKeyGenerator | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CardanoIcarusMstKeyGenerator:
"""Cardano Icarus master key generator class. It allows master keys generation in according to Cardano Icarus."""
def GenerateFromSeed(cls, seed_bytes: bytes) -> Tuple[bytes, bytes]:
"""Generate a master key from the specified seed. Args: seed_bytes (byt... | stack_v2_sparse_classes_10k_train_006124 | 4,048 | permissive | [
{
"docstring": "Generate a master key from the specified seed. Args: seed_bytes (bytes): Seed bytes Returns: tuple[bytes, bytes]: Private key bytes (index 0) and chain code bytes (index 1) Raises: Bip32KeyError: If the seed is not suitable for master key generation ValueError: If seed length is not valid",
... | 2 | stack_v2_sparse_classes_30k_train_006454 | Implement the Python class `CardanoIcarusMstKeyGenerator` described below.
Class description:
Cardano Icarus master key generator class. It allows master keys generation in according to Cardano Icarus.
Method signatures and docstrings:
- def GenerateFromSeed(cls, seed_bytes: bytes) -> Tuple[bytes, bytes]: Generate a ... | Implement the Python class `CardanoIcarusMstKeyGenerator` described below.
Class description:
Cardano Icarus master key generator class. It allows master keys generation in according to Cardano Icarus.
Method signatures and docstrings:
- def GenerateFromSeed(cls, seed_bytes: bytes) -> Tuple[bytes, bytes]: Generate a ... | d15c75ddd74e4838c396a0d036ef6faf11b06a4b | <|skeleton|>
class CardanoIcarusMstKeyGenerator:
"""Cardano Icarus master key generator class. It allows master keys generation in according to Cardano Icarus."""
def GenerateFromSeed(cls, seed_bytes: bytes) -> Tuple[bytes, bytes]:
"""Generate a master key from the specified seed. Args: seed_bytes (byt... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CardanoIcarusMstKeyGenerator:
"""Cardano Icarus master key generator class. It allows master keys generation in according to Cardano Icarus."""
def GenerateFromSeed(cls, seed_bytes: bytes) -> Tuple[bytes, bytes]:
"""Generate a master key from the specified seed. Args: seed_bytes (bytes): Seed byt... | the_stack_v2_python_sparse | bip_utils/cardano/bip32/cardano_icarus_mst_key_generator.py | ebellocchia/bip_utils | train | 244 |
edddea86721a367327de295a3eaefb20a33720d1 | [
"tag_ptn = '[A-Z][A-Z_]*'\noutput = re.sub('\\\\s', '', output)\nxml = re.sub(f'<({tag_ptn})>', '[\\\\1 ', output)\nxml = re.sub(f'</{tag_ptn}>', '] ', xml)\n\ndef _convert_to_xml(text):\n for _ in range(max(text.count('['), text.count(']'))):\n text = re.sub(f'(?s)[({tag_ptn})([^[]]+?)]', '<\\\\1>\\\\2 <... | <|body_start_0|>
tag_ptn = '[A-Z][A-Z_]*'
output = re.sub('\\s', '', output)
xml = re.sub(f'<({tag_ptn})>', '[\\1 ', output)
xml = re.sub(f'</{tag_ptn}>', '] ', xml)
def _convert_to_xml(text):
for _ in range(max(text.count('['), text.count(']'))):
tex... | Constituency Parsing base class containinig various methods related to Const. Parsing | PororoConstBase | [
"Apache-2.0",
"LicenseRef-scancode-secret-labs-2011",
"HPND",
"ISC",
"MIT",
"Unlicense",
"BSD-2-Clause",
"Python-2.0",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PororoConstBase:
"""Constituency Parsing base class containinig various methods related to Const. Parsing"""
def _fix_tree(self, output: str):
"""Fix tree when XML conversion is not conducted Args: output (str): string to fix Returns: text: fixed tree string"""
<|body_0|>
... | stack_v2_sparse_classes_10k_train_006125 | 17,917 | permissive | [
{
"docstring": "Fix tree when XML conversion is not conducted Args: output (str): string to fix Returns: text: fixed tree string",
"name": "_fix_tree",
"signature": "def _fix_tree(self, output: str)"
},
{
"docstring": "Prettify model result using XML tree Args: output (str): string to make tree ... | 3 | stack_v2_sparse_classes_30k_train_004825 | Implement the Python class `PororoConstBase` described below.
Class description:
Constituency Parsing base class containinig various methods related to Const. Parsing
Method signatures and docstrings:
- def _fix_tree(self, output: str): Fix tree when XML conversion is not conducted Args: output (str): string to fix R... | Implement the Python class `PororoConstBase` described below.
Class description:
Constituency Parsing base class containinig various methods related to Const. Parsing
Method signatures and docstrings:
- def _fix_tree(self, output: str): Fix tree when XML conversion is not conducted Args: output (str): string to fix R... | 99d04d131479150a53a2e2f58b9f667258e02f9b | <|skeleton|>
class PororoConstBase:
"""Constituency Parsing base class containinig various methods related to Const. Parsing"""
def _fix_tree(self, output: str):
"""Fix tree when XML conversion is not conducted Args: output (str): string to fix Returns: text: fixed tree string"""
<|body_0|>
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PororoConstBase:
"""Constituency Parsing base class containinig various methods related to Const. Parsing"""
def _fix_tree(self, output: str):
"""Fix tree when XML conversion is not conducted Args: output (str): string to fix Returns: text: fixed tree string"""
tag_ptn = '[A-Z][A-Z_]*'
... | the_stack_v2_python_sparse | pororo/tasks/constituency_parsing.py | HarshCasper/pororo | train | 0 |
c6190809a6a1b826e35fece80e89d6b72d38b44a | [
"self.app = app\nself.client_prefix = client_prefix\nself.repo_prefix = repo_prefix\nself.pb = PubSub(self.app, self.client_prefix)",
"file = File()\nfile.file_name = file_name\nfile.desired_copies = desired_copies\nfile.packets = packets\nfile.size = size\nfetch_path = FetchPath()\nfetch_path.prefix = fetch_pref... | <|body_start_0|>
self.app = app
self.client_prefix = client_prefix
self.repo_prefix = repo_prefix
self.pb = PubSub(self.app, self.client_prefix)
<|end_body_0|>
<|body_start_1|>
file = File()
file.file_name = file_name
file.desired_copies = desired_copies
... | InsertClient | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InsertClient:
def __init__(self, app: NDNApp, client_prefix: FormalName, repo_prefix: FormalName):
"""This client inserts data packets from the remote repo. :param app: NDNApp. :param repo_name: NonStrictName. Routable name to remote repo."""
<|body_0|>
async def insert_file... | stack_v2_sparse_classes_10k_train_006126 | 2,215 | permissive | [
{
"docstring": "This client inserts data packets from the remote repo. :param app: NDNApp. :param repo_name: NonStrictName. Routable name to remote repo.",
"name": "__init__",
"signature": "def __init__(self, app: NDNApp, client_prefix: FormalName, repo_prefix: FormalName)"
},
{
"docstring": "In... | 2 | stack_v2_sparse_classes_30k_test_000113 | Implement the Python class `InsertClient` described below.
Class description:
Implement the InsertClient class.
Method signatures and docstrings:
- def __init__(self, app: NDNApp, client_prefix: FormalName, repo_prefix: FormalName): This client inserts data packets from the remote repo. :param app: NDNApp. :param rep... | Implement the Python class `InsertClient` described below.
Class description:
Implement the InsertClient class.
Method signatures and docstrings:
- def __init__(self, app: NDNApp, client_prefix: FormalName, repo_prefix: FormalName): This client inserts data packets from the remote repo. :param app: NDNApp. :param rep... | 4377074833a3515666a5ddeaaba15f4972e5d812 | <|skeleton|>
class InsertClient:
def __init__(self, app: NDNApp, client_prefix: FormalName, repo_prefix: FormalName):
"""This client inserts data packets from the remote repo. :param app: NDNApp. :param repo_name: NonStrictName. Routable name to remote repo."""
<|body_0|>
async def insert_file... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class InsertClient:
def __init__(self, app: NDNApp, client_prefix: FormalName, repo_prefix: FormalName):
"""This client inserts data packets from the remote repo. :param app: NDNApp. :param repo_name: NonStrictName. Routable name to remote repo."""
self.app = app
self.client_prefix = client_... | the_stack_v2_python_sparse | client/insert.py | daniel-achee/ndn-distributed-repo | train | 1 | |
c7482a4492bc592cc99600fee56a50122fb06b53 | [
"super().__init__(dev=dev, qubits=qubits, **kw)\nif len(qubits) > 1:\n raise ValueError('Currently only one qubit is allowed.')\nself.delta_f = np.Infinity\nself.iteration = 1\nself.final_init(**kw)",
"super().create_routine_template()\ntransition_name = self.get_param_value('transition_name', qubit=self.qubit... | <|body_start_0|>
super().__init__(dev=dev, qubits=qubits, **kw)
if len(qubits) > 1:
raise ValueError('Currently only one qubit is allowed.')
self.delta_f = np.Infinity
self.iteration = 1
self.final_init(**kw)
<|end_body_0|>
<|body_start_1|>
super().create_rou... | Routine to find frequency of a given transmon transition. Routine steps: 1) Short (maximum 2 repetitions) :obj:`AdaptiveQubitSpectroscopy` 2) :obj:`PiPulseCalibration` (Rabi + Ramsey) 3) Decision: checks whether the new frequency of the qubit found after the Ramsey experiment is within a specified threshold with respec... | FindFrequency | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FindFrequency:
"""Routine to find frequency of a given transmon transition. Routine steps: 1) Short (maximum 2 repetitions) :obj:`AdaptiveQubitSpectroscopy` 2) :obj:`PiPulseCalibration` (Rabi + Ramsey) 3) Decision: checks whether the new frequency of the qubit found after the Ramsey experiment is... | stack_v2_sparse_classes_10k_train_006127 | 48,290 | permissive | [
{
"docstring": "Routine to find frequency of a given transmon transition. Args: dev (Device): The device which is currently measured. qubits (list): List of qubits to be calibrated. FIXME: currently only one qubit is supported. E.g., qubits = [qb1]. Keyword args: autorun (bool): Whether to run the routine autom... | 3 | stack_v2_sparse_classes_30k_train_003123 | Implement the Python class `FindFrequency` described below.
Class description:
Routine to find frequency of a given transmon transition. Routine steps: 1) Short (maximum 2 repetitions) :obj:`AdaptiveQubitSpectroscopy` 2) :obj:`PiPulseCalibration` (Rabi + Ramsey) 3) Decision: checks whether the new frequency of the qub... | Implement the Python class `FindFrequency` described below.
Class description:
Routine to find frequency of a given transmon transition. Routine steps: 1) Short (maximum 2 repetitions) :obj:`AdaptiveQubitSpectroscopy` 2) :obj:`PiPulseCalibration` (Rabi + Ramsey) 3) Decision: checks whether the new frequency of the qub... | bc6733d774fe31a23f4c7e73e5eb0beed8d30e7d | <|skeleton|>
class FindFrequency:
"""Routine to find frequency of a given transmon transition. Routine steps: 1) Short (maximum 2 repetitions) :obj:`AdaptiveQubitSpectroscopy` 2) :obj:`PiPulseCalibration` (Rabi + Ramsey) 3) Decision: checks whether the new frequency of the qubit found after the Ramsey experiment is... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FindFrequency:
"""Routine to find frequency of a given transmon transition. Routine steps: 1) Short (maximum 2 repetitions) :obj:`AdaptiveQubitSpectroscopy` 2) :obj:`PiPulseCalibration` (Rabi + Ramsey) 3) Decision: checks whether the new frequency of the qubit found after the Ramsey experiment is within a spe... | the_stack_v2_python_sparse | pycqed/measurement/calibration/automatic_calibration_routines/single_qubit_routines.py | QudevETH/PycQED_py3 | train | 8 |
141859457fa78a8eaab25190c403812050348147 | [
"self._schema = customer_schema\nself.tracing_id = tracing_id\nwith ProviderDBAccessor(provider_uuid) as provider_accessor:\n self._provider = provider_accessor.get_provider()\ntry:\n self._updater = self._set_updater()\nexcept Exception as err:\n raise CostModelCostUpdaterError(err)",
"if self._provider... | <|body_start_0|>
self._schema = customer_schema
self.tracing_id = tracing_id
with ProviderDBAccessor(provider_uuid) as provider_accessor:
self._provider = provider_accessor.get_provider()
try:
self._updater = self._set_updater()
except Exception as err:
... | Update reporting summary tables. | CostModelCostUpdater | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CostModelCostUpdater:
"""Update reporting summary tables."""
def __init__(self, customer_schema, provider_uuid, tracing_id=None):
"""Initializer. Args: customer_schema (str): Schema name for given customer. provider_uuid (str): The provider uuid."""
<|body_0|>
def _set_u... | stack_v2_sparse_classes_10k_train_006128 | 3,840 | permissive | [
{
"docstring": "Initializer. Args: customer_schema (str): Schema name for given customer. provider_uuid (str): The provider uuid.",
"name": "__init__",
"signature": "def __init__(self, customer_schema, provider_uuid, tracing_id=None)"
},
{
"docstring": "Create the report charge updater object. O... | 4 | null | Implement the Python class `CostModelCostUpdater` described below.
Class description:
Update reporting summary tables.
Method signatures and docstrings:
- def __init__(self, customer_schema, provider_uuid, tracing_id=None): Initializer. Args: customer_schema (str): Schema name for given customer. provider_uuid (str):... | Implement the Python class `CostModelCostUpdater` described below.
Class description:
Update reporting summary tables.
Method signatures and docstrings:
- def __init__(self, customer_schema, provider_uuid, tracing_id=None): Initializer. Args: customer_schema (str): Schema name for given customer. provider_uuid (str):... | 0416e5216eb1ec4b41c8dd4999adde218b1ab2e1 | <|skeleton|>
class CostModelCostUpdater:
"""Update reporting summary tables."""
def __init__(self, customer_schema, provider_uuid, tracing_id=None):
"""Initializer. Args: customer_schema (str): Schema name for given customer. provider_uuid (str): The provider uuid."""
<|body_0|>
def _set_u... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CostModelCostUpdater:
"""Update reporting summary tables."""
def __init__(self, customer_schema, provider_uuid, tracing_id=None):
"""Initializer. Args: customer_schema (str): Schema name for given customer. provider_uuid (str): The provider uuid."""
self._schema = customer_schema
... | the_stack_v2_python_sparse | koku/masu/processor/cost_model_cost_updater.py | project-koku/koku | train | 225 |
eb25d567e7d7e5cad66ecabbfd34512f96383a31 | [
"if root.val >= val:\n if root.left:\n self.insertIntoBST(root.left, val)\n else:\n node = TreeNode(val)\n root.left = node\nelif root.right:\n self.insertIntoBST(root.right, val)\nelse:\n node = TreeNode(val)\n root.right = node\nreturn root",
"if not root:\n return TreeNod... | <|body_start_0|>
if root.val >= val:
if root.left:
self.insertIntoBST(root.left, val)
else:
node = TreeNode(val)
root.left = node
elif root.right:
self.insertIntoBST(root.right, val)
else:
node = Tree... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def _insertIntoBST(self, root, val):
""":type root: TreeNode :type val: int :rtype: TreeNode"""
<|body_0|>
def __insertIntoBST(self, root, val):
""":type root: TreeNode :type val: int :rtype: TreeNode"""
<|body_1|>
def ___insertIntoBST(self, ro... | stack_v2_sparse_classes_10k_train_006129 | 4,559 | permissive | [
{
"docstring": ":type root: TreeNode :type val: int :rtype: TreeNode",
"name": "_insertIntoBST",
"signature": "def _insertIntoBST(self, root, val)"
},
{
"docstring": ":type root: TreeNode :type val: int :rtype: TreeNode",
"name": "__insertIntoBST",
"signature": "def __insertIntoBST(self,... | 5 | stack_v2_sparse_classes_30k_train_001879 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _insertIntoBST(self, root, val): :type root: TreeNode :type val: int :rtype: TreeNode
- def __insertIntoBST(self, root, val): :type root: TreeNode :type val: int :rtype: Tree... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _insertIntoBST(self, root, val): :type root: TreeNode :type val: int :rtype: TreeNode
- def __insertIntoBST(self, root, val): :type root: TreeNode :type val: int :rtype: Tree... | 0dd67edca4e0b0323cb5a7239f02ea46383cd15a | <|skeleton|>
class Solution:
def _insertIntoBST(self, root, val):
""":type root: TreeNode :type val: int :rtype: TreeNode"""
<|body_0|>
def __insertIntoBST(self, root, val):
""":type root: TreeNode :type val: int :rtype: TreeNode"""
<|body_1|>
def ___insertIntoBST(self, ro... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def _insertIntoBST(self, root, val):
""":type root: TreeNode :type val: int :rtype: TreeNode"""
if root.val >= val:
if root.left:
self.insertIntoBST(root.left, val)
else:
node = TreeNode(val)
root.left = node
... | the_stack_v2_python_sparse | 701.insert-into-a-binary-search-tree.py | windard/leeeeee | train | 0 | |
c05882a28031ccf5fc36bd308f02b7355d765e1f | [
"method_map = kwargs['method_map'] if kwargs.get('method_map', None) else self.method_map\nfor request_method, mapped_method in method_map.items():\n mapped_method = getattr(self, mapped_method)\n method_proxy = self.view_proxy(mapped_method)\n setattr(self, request_method, method_proxy)\nsuper(APIMethodMa... | <|body_start_0|>
method_map = kwargs['method_map'] if kwargs.get('method_map', None) else self.method_map
for request_method, mapped_method in method_map.items():
mapped_method = getattr(self, mapped_method)
method_proxy = self.view_proxy(mapped_method)
setattr(self, ... | map request method to Mixin method :method_map: dict, if we map GET to list mixin,then dict should be {'get':'list'} | APIMethodMapMixin | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class APIMethodMapMixin:
"""map request method to Mixin method :method_map: dict, if we map GET to list mixin,then dict should be {'get':'list'}"""
def __init__(self, *args, **kwargs):
"""map request method. search for method_map args. expected dict. find corresponding value. if method_map... | stack_v2_sparse_classes_10k_train_006130 | 7,548 | no_license | [
{
"docstring": "map request method. search for method_map args. expected dict. find corresponding value. if method_map is passed in,then refer to pass-in method_map :param args: position args :param kwargs: keyword args",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
... | 2 | stack_v2_sparse_classes_30k_train_007268 | Implement the Python class `APIMethodMapMixin` described below.
Class description:
map request method to Mixin method :method_map: dict, if we map GET to list mixin,then dict should be {'get':'list'}
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): map request method. search for method_map arg... | Implement the Python class `APIMethodMapMixin` described below.
Class description:
map request method to Mixin method :method_map: dict, if we map GET to list mixin,then dict should be {'get':'list'}
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): map request method. search for method_map arg... | 86bc4d3466d648caa93f8591619b5ca3b06a6470 | <|skeleton|>
class APIMethodMapMixin:
"""map request method to Mixin method :method_map: dict, if we map GET to list mixin,then dict should be {'get':'list'}"""
def __init__(self, *args, **kwargs):
"""map request method. search for method_map args. expected dict. find corresponding value. if method_map... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class APIMethodMapMixin:
"""map request method to Mixin method :method_map: dict, if we map GET to list mixin,then dict should be {'get':'list'}"""
def __init__(self, *args, **kwargs):
"""map request method. search for method_map args. expected dict. find corresponding value. if method_map is passed in... | the_stack_v2_python_sparse | Python/04_Restful/online_intepreter_project/online_intepreter_app/mixins.py | xiaolongjia/techTrees | train | 0 |
49340d701dbab51a459efe295fb9b8e7ab9b697e | [
"self.desiredTypes = desiredTypes\nself.result = []\nsuper(_Finder, self).__init__()",
"todo = [(0, node)]\ncurrentStack = []\nchildrenTypes = TRAVERSAL_TYPES + self.desiredTypes\nwhile todo:\n index, node = todo[0]\n del todo[0]\n del currentStack[index:]\n is_desired = isinstance(node, self.desiredT... | <|body_start_0|>
self.desiredTypes = desiredTypes
self.result = []
super(_Finder, self).__init__()
<|end_body_0|>
<|body_start_1|>
todo = [(0, node)]
currentStack = []
childrenTypes = TRAVERSAL_TYPES + self.desiredTypes
while todo:
index, node = todo[... | Traverse a scenegraph looking for bindable nodes This is a simple implementation of a scenegraph-search which looks for all nodes which are instances of any of a given set of classes/types. Attributes: result -- the resulting set of node-paths desiredTypes -- the node-types being searched for See the find function for ... | _Finder | [
"LicenseRef-scancode-warranty-disclaimer",
"GPL-1.0-or-later",
"LicenseRef-scancode-other-copyleft",
"LGPL-2.1-or-later",
"GPL-3.0-only",
"LGPL-2.0-or-later",
"GPL-3.0-or-later",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _Finder:
"""Traverse a scenegraph looking for bindable nodes This is a simple implementation of a scenegraph-search which looks for all nodes which are instances of any of a given set of classes/types. Attributes: result -- the resulting set of node-paths desiredTypes -- the node-types being sear... | stack_v2_sparse_classes_10k_train_006131 | 14,994 | permissive | [
{
"docstring": "Initialize the _Finder object desiredTypes -- sequence of types to be searched for",
"name": "__init__",
"signature": "def __init__(self, desiredTypes=())"
},
{
"docstring": "Visit an individual node, search for self.desiredTypes This is a heavily trimmed version of the superclas... | 2 | null | Implement the Python class `_Finder` described below.
Class description:
Traverse a scenegraph looking for bindable nodes This is a simple implementation of a scenegraph-search which looks for all nodes which are instances of any of a given set of classes/types. Attributes: result -- the resulting set of node-paths de... | Implement the Python class `_Finder` described below.
Class description:
Traverse a scenegraph looking for bindable nodes This is a simple implementation of a scenegraph-search which looks for all nodes which are instances of any of a given set of classes/types. Attributes: result -- the resulting set of node-paths de... | 7f600ad153270feff12aa7aa86d7ed0a49ebc71c | <|skeleton|>
class _Finder:
"""Traverse a scenegraph looking for bindable nodes This is a simple implementation of a scenegraph-search which looks for all nodes which are instances of any of a given set of classes/types. Attributes: result -- the resulting set of node-paths desiredTypes -- the node-types being sear... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class _Finder:
"""Traverse a scenegraph looking for bindable nodes This is a simple implementation of a scenegraph-search which looks for all nodes which are instances of any of a given set of classes/types. Attributes: result -- the resulting set of node-paths desiredTypes -- the node-types being searched for See ... | the_stack_v2_python_sparse | pythonAnimations/pyOpenGLChess/engineDirectory/oglc-env/lib/python2.7/site-packages/OpenGLContext/visitor.py | alexus37/AugmentedRealityChess | train | 1 |
8bb727379c55d713997ece11dc926255177042b3 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')"
] | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | A set of methods for managing ResourcePreset resources. | ResourcePresetServiceServicer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResourcePresetServiceServicer:
"""A set of methods for managing ResourcePreset resources."""
def Get(self, request, context):
"""Returns the specified ResourcePreset resource. To get the list of available ResourcePreset resources, make a [List] request."""
<|body_0|>
def... | stack_v2_sparse_classes_10k_train_006132 | 5,129 | permissive | [
{
"docstring": "Returns the specified ResourcePreset resource. To get the list of available ResourcePreset resources, make a [List] request.",
"name": "Get",
"signature": "def Get(self, request, context)"
},
{
"docstring": "Retrieves the list of available ResourcePreset resources.",
"name": ... | 2 | stack_v2_sparse_classes_30k_train_005715 | Implement the Python class `ResourcePresetServiceServicer` described below.
Class description:
A set of methods for managing ResourcePreset resources.
Method signatures and docstrings:
- def Get(self, request, context): Returns the specified ResourcePreset resource. To get the list of available ResourcePreset resourc... | Implement the Python class `ResourcePresetServiceServicer` described below.
Class description:
A set of methods for managing ResourcePreset resources.
Method signatures and docstrings:
- def Get(self, request, context): Returns the specified ResourcePreset resource. To get the list of available ResourcePreset resourc... | b906a014dd893e2697864e1e48e814a8d9fbc48c | <|skeleton|>
class ResourcePresetServiceServicer:
"""A set of methods for managing ResourcePreset resources."""
def Get(self, request, context):
"""Returns the specified ResourcePreset resource. To get the list of available ResourcePreset resources, make a [List] request."""
<|body_0|>
def... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ResourcePresetServiceServicer:
"""A set of methods for managing ResourcePreset resources."""
def Get(self, request, context):
"""Returns the specified ResourcePreset resource. To get the list of available ResourcePreset resources, make a [List] request."""
context.set_code(grpc.StatusCode... | the_stack_v2_python_sparse | yandex/cloud/dataproc/v1/resource_preset_service_pb2_grpc.py | yandex-cloud/python-sdk | train | 63 |
870aa82868c4b5f20eac2502ebd45c5a8e53e21d | [
"logger.info('Generating Druid spec for dataset at: %s', datasetLocation)\nlogger.info('Schema for dataset: %s', datasetSchema)\nreturn json.dumps({'type': 'index', 'spec': {'dataSchema': {'dataSource': datasourceName, 'timestampSpec': {'column': DruidIngestionSpecGenerator._getTimestampColumn(datasetSchema), 'form... | <|body_start_0|>
logger.info('Generating Druid spec for dataset at: %s', datasetLocation)
logger.info('Schema for dataset: %s', datasetSchema)
return json.dumps({'type': 'index', 'spec': {'dataSchema': {'dataSource': datasourceName, 'timestampSpec': {'column': DruidIngestionSpecGenerator._getTim... | Class to handle functionality around Druid ingestion spec generation | DruidIngestionSpecGenerator | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DruidIngestionSpecGenerator:
"""Class to handle functionality around Druid ingestion spec generation"""
def getIngestionSpec(datasetLocation, datasourceName, datasetSchema):
"""Method to generate Druid ingestion spec Method doesn't support complex druid data types right now. :param d... | stack_v2_sparse_classes_10k_train_006133 | 9,076 | permissive | [
{
"docstring": "Method to generate Druid ingestion spec Method doesn't support complex druid data types right now. :param datasetLocation: S3 location of the dataset :param datasourceName Name of the dataset :param datasetSchema The schema of the dataset :returns DruidSpec",
"name": "getIngestionSpec",
... | 5 | stack_v2_sparse_classes_30k_train_000355 | Implement the Python class `DruidIngestionSpecGenerator` described below.
Class description:
Class to handle functionality around Druid ingestion spec generation
Method signatures and docstrings:
- def getIngestionSpec(datasetLocation, datasourceName, datasetSchema): Method to generate Druid ingestion spec Method doe... | Implement the Python class `DruidIngestionSpecGenerator` described below.
Class description:
Class to handle functionality around Druid ingestion spec generation
Method signatures and docstrings:
- def getIngestionSpec(datasetLocation, datasourceName, datasetSchema): Method to generate Druid ingestion spec Method doe... | cf765e822c2aaefb546ed8a9507ac4a0b0b9ce73 | <|skeleton|>
class DruidIngestionSpecGenerator:
"""Class to handle functionality around Druid ingestion spec generation"""
def getIngestionSpec(datasetLocation, datasourceName, datasetSchema):
"""Method to generate Druid ingestion spec Method doesn't support complex druid data types right now. :param d... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DruidIngestionSpecGenerator:
"""Class to handle functionality around Druid ingestion spec generation"""
def getIngestionSpec(datasetLocation, datasourceName, datasetSchema):
"""Method to generate Druid ingestion spec Method doesn't support complex druid data types right now. :param datasetLocatio... | the_stack_v2_python_sparse | api/utils/druidSpecGenerator.py | rberrelleza/cuelake | train | 0 |
4a3ab11f6ef5670d0e547aa55cc4e14253c82da7 | [
"if not intervals:\n return [newInterval]\nelif not newInterval:\n return intervals\nif newInterval[0] <= intervals[0][0]:\n intervals.insert(0, newInterval)\nelif newInterval[0] >= intervals[-1][0]:\n intervals.append(newInterval)\nans = []\nfor interval in intervals:\n if newInterval[0] < interval[... | <|body_start_0|>
if not intervals:
return [newInterval]
elif not newInterval:
return intervals
if newInterval[0] <= intervals[0][0]:
intervals.insert(0, newInterval)
elif newInterval[0] >= intervals[-1][0]:
intervals.append(newInterval)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def insert__(self, intervals, newInterval):
""":type intervals: List[List[int]] :type newInterval: List[int] :rtype: List[List[int]]"""
<|body_0|>
def insert(self, intervals, newInterval):
""":type intervals: List[List[int]] :type newInterval: List[int] :rt... | stack_v2_sparse_classes_10k_train_006134 | 2,188 | no_license | [
{
"docstring": ":type intervals: List[List[int]] :type newInterval: List[int] :rtype: List[List[int]]",
"name": "insert__",
"signature": "def insert__(self, intervals, newInterval)"
},
{
"docstring": ":type intervals: List[List[int]] :type newInterval: List[int] :rtype: List[List[int]]",
"na... | 2 | stack_v2_sparse_classes_30k_train_003034 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def insert__(self, intervals, newInterval): :type intervals: List[List[int]] :type newInterval: List[int] :rtype: List[List[int]]
- def insert(self, intervals, newInterval): :typ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def insert__(self, intervals, newInterval): :type intervals: List[List[int]] :type newInterval: List[int] :rtype: List[List[int]]
- def insert(self, intervals, newInterval): :typ... | b5c25f976866eefec33b96c638a4c5e127319e74 | <|skeleton|>
class Solution:
def insert__(self, intervals, newInterval):
""":type intervals: List[List[int]] :type newInterval: List[int] :rtype: List[List[int]]"""
<|body_0|>
def insert(self, intervals, newInterval):
""":type intervals: List[List[int]] :type newInterval: List[int] :rt... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def insert__(self, intervals, newInterval):
""":type intervals: List[List[int]] :type newInterval: List[int] :rtype: List[List[int]]"""
if not intervals:
return [newInterval]
elif not newInterval:
return intervals
if newInterval[0] <= intervals... | the_stack_v2_python_sparse | Python/057_Insert Interval.py | Eddie02582/Leetcode | train | 1 | |
d4e2aa4665885a5ebfcf6e20152a510f8f84aaa5 | [
"dp = [float('inf')] * (n + 1)\ndp[0] = 0\nfor i in range(n + 1):\n j = 1\n while j * j <= i:\n dp[i] = min(dp[i], dp[i - j * j] + 1)\n j += 1\nreturn dp[n]",
"def isPerfectSquare(x: int) -> bool:\n y = int(x ** 0.5)\n return y * y == x\n\ndef check(x: int) -> bool:\n while x % 4 == 0... | <|body_start_0|>
dp = [float('inf')] * (n + 1)
dp[0] = 0
for i in range(n + 1):
j = 1
while j * j <= i:
dp[i] = min(dp[i], dp[i - j * j] + 1)
j += 1
return dp[n]
<|end_body_0|>
<|body_start_1|>
def isPerfectSquare(x: int) -... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def numSquares_MK1(self, n: int) -> int:
"""Time complexity: O(n√n) Space complexity: O(n)"""
<|body_0|>
def numSquares_MK2(self, n: int) -> int:
"""四平方和定理 Time complexity: O(√n) Space complexity: O(1)"""
<|body_1|>
<|end_skeleton|>
<|body_start_0... | stack_v2_sparse_classes_10k_train_006135 | 1,025 | no_license | [
{
"docstring": "Time complexity: O(n√n) Space complexity: O(n)",
"name": "numSquares_MK1",
"signature": "def numSquares_MK1(self, n: int) -> int"
},
{
"docstring": "四平方和定理 Time complexity: O(√n) Space complexity: O(1)",
"name": "numSquares_MK2",
"signature": "def numSquares_MK2(self, n: ... | 2 | stack_v2_sparse_classes_30k_train_003446 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numSquares_MK1(self, n: int) -> int: Time complexity: O(n√n) Space complexity: O(n)
- def numSquares_MK2(self, n: int) -> int: 四平方和定理 Time complexity: O(√n) Space complexity:... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numSquares_MK1(self, n: int) -> int: Time complexity: O(n√n) Space complexity: O(n)
- def numSquares_MK2(self, n: int) -> int: 四平方和定理 Time complexity: O(√n) Space complexity:... | d7ba416d22becfa8f2a2ae4eee04c86617cd9332 | <|skeleton|>
class Solution:
def numSquares_MK1(self, n: int) -> int:
"""Time complexity: O(n√n) Space complexity: O(n)"""
<|body_0|>
def numSquares_MK2(self, n: int) -> int:
"""四平方和定理 Time complexity: O(√n) Space complexity: O(1)"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def numSquares_MK1(self, n: int) -> int:
"""Time complexity: O(n√n) Space complexity: O(n)"""
dp = [float('inf')] * (n + 1)
dp[0] = 0
for i in range(n + 1):
j = 1
while j * j <= i:
dp[i] = min(dp[i], dp[i - j * j] + 1)
... | the_stack_v2_python_sparse | 0279. Perfect Squares/Solution.py | faterazer/LeetCode | train | 4 | |
dcc2919a43a908b00018bfd4e7c9e0b2b75b82cc | [
"P = self.parent()\nct = P.cartan_type()\nsym = P._symmetric_form_matrix\nif ct.is_finite():\n iset = P.index_set()\nelse:\n iset = P.index_set() + ('delta',)\nreturn sum((cl * sym[iset.index(ml), iset.index(mr)] * cr for ml, cl in self for mr, cr in la))",
"L = self.parent()\nif base_ring is None:\n bas... | <|body_start_0|>
P = self.parent()
ct = P.cartan_type()
sym = P._symmetric_form_matrix
if ct.is_finite():
iset = P.index_set()
else:
iset = P.index_set() + ('delta',)
return sum((cl * sym[iset.index(ml), iset.index(mr)] * cr for ml, cl in self for ... | ElementMethods | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ElementMethods:
def symmetric_form(self, la):
"""Return the symmetric form of ``self`` with ``la``. Return the pairing `( | )` on the weight lattice. See Chapter 6 in Kac, Infinite Dimensional Lie Algebras for more details. .. WARNING:: For affine root systems, if you are not working in ... | stack_v2_sparse_classes_10k_train_006136 | 46,194 | no_license | [
{
"docstring": "Return the symmetric form of ``self`` with ``la``. Return the pairing `( | )` on the weight lattice. See Chapter 6 in Kac, Infinite Dimensional Lie Algebras for more details. .. WARNING:: For affine root systems, if you are not working in the extended weight lattice/space, this may return incorr... | 2 | null | Implement the Python class `ElementMethods` described below.
Class description:
Implement the ElementMethods class.
Method signatures and docstrings:
- def symmetric_form(self, la): Return the symmetric form of ``self`` with ``la``. Return the pairing `( | )` on the weight lattice. See Chapter 6 in Kac, Infinite Dime... | Implement the Python class `ElementMethods` described below.
Class description:
Implement the ElementMethods class.
Method signatures and docstrings:
- def symmetric_form(self, la): Return the symmetric form of ``self`` with ``la``. Return the pairing `( | )` on the weight lattice. See Chapter 6 in Kac, Infinite Dime... | 0d9eacbf74e2acffefde93e39f8bcbec745cdaba | <|skeleton|>
class ElementMethods:
def symmetric_form(self, la):
"""Return the symmetric form of ``self`` with ``la``. Return the pairing `( | )` on the weight lattice. See Chapter 6 in Kac, Infinite Dimensional Lie Algebras for more details. .. WARNING:: For affine root systems, if you are not working in ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ElementMethods:
def symmetric_form(self, la):
"""Return the symmetric form of ``self`` with ``la``. Return the pairing `( | )` on the weight lattice. See Chapter 6 in Kac, Infinite Dimensional Lie Algebras for more details. .. WARNING:: For affine root systems, if you are not working in the extended w... | the_stack_v2_python_sparse | sage/src/sage/combinat/root_system/weight_lattice_realizations.py | bopopescu/geosci | train | 0 | |
23f4c499b34d66492d508e0218d6810312aadd06 | [
"self.state = state\nself.t_score_gte = t_score_gte\nself.c_score_gte = c_score_gte\nself.fetch_size = fetch_size\nself.headers = {'Authorization': f'Token {api_token}'}\nself.base_url = vectra_url + '/api/v2.1/'\nself.verify = verify\nself.proxies = proxy\nself.first_fetch = first_fetch",
"full_url = self.base_u... | <|body_start_0|>
self.state = state
self.t_score_gte = t_score_gte
self.c_score_gte = c_score_gte
self.fetch_size = fetch_size
self.headers = {'Authorization': f'Token {api_token}'}
self.base_url = vectra_url + '/api/v2.1/'
self.verify = verify
self.proxie... | Client | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Client:
def __init__(self, vectra_url: str, api_token: str, verify: bool, proxy: dict, fetch_size: int, first_fetch: str, t_score_gte: int, c_score_gte: int, state: str):
""":param vectra_url: IP or hostname of Vectra brain (ex https://www.example.com) - required :param api_token: API to... | stack_v2_sparse_classes_10k_train_006137 | 29,008 | permissive | [
{
"docstring": ":param vectra_url: IP or hostname of Vectra brain (ex https://www.example.com) - required :param api_token: API token for authentication when using API v2* :param verify: Boolean, controls whether we verify the server's TLS certificate :param proxy: Dictionary mapping protocol to the URL of the ... | 3 | null | Implement the Python class `Client` described below.
Class description:
Implement the Client class.
Method signatures and docstrings:
- def __init__(self, vectra_url: str, api_token: str, verify: bool, proxy: dict, fetch_size: int, first_fetch: str, t_score_gte: int, c_score_gte: int, state: str): :param vectra_url: ... | Implement the Python class `Client` described below.
Class description:
Implement the Client class.
Method signatures and docstrings:
- def __init__(self, vectra_url: str, api_token: str, verify: bool, proxy: dict, fetch_size: int, first_fetch: str, t_score_gte: int, c_score_gte: int, state: str): :param vectra_url: ... | 890def5a0e0ae8d6eaa538148249ddbc851dbb6b | <|skeleton|>
class Client:
def __init__(self, vectra_url: str, api_token: str, verify: bool, proxy: dict, fetch_size: int, first_fetch: str, t_score_gte: int, c_score_gte: int, state: str):
""":param vectra_url: IP or hostname of Vectra brain (ex https://www.example.com) - required :param api_token: API to... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Client:
def __init__(self, vectra_url: str, api_token: str, verify: bool, proxy: dict, fetch_size: int, first_fetch: str, t_score_gte: int, c_score_gte: int, state: str):
""":param vectra_url: IP or hostname of Vectra brain (ex https://www.example.com) - required :param api_token: API token for authen... | the_stack_v2_python_sparse | Packs/Vectra/Integrations/Vectra_v2/Vectra_v2.py | demisto/content | train | 1,023 | |
aeb8e21c411e031d8cda978ce85e924ca1145d22 | [
"super(HypervisorsClient, self).__init__(serialize_format, deserialize_format)\nself.auth_token = auth_token\nself.default_headers['X-Auth-Token'] = auth_token\nct = ''.join(['application/', self.serialize_format])\naccept = ''.join(['application/', self.deserialize_format])\nself.default_headers['Content-Type'] = ... | <|body_start_0|>
super(HypervisorsClient, self).__init__(serialize_format, deserialize_format)
self.auth_token = auth_token
self.default_headers['X-Auth-Token'] = auth_token
ct = ''.join(['application/', self.serialize_format])
accept = ''.join(['application/', self.deserialize_f... | HypervisorsClient | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HypervisorsClient:
def __init__(self, url, auth_token, serialize_format=None, deserialize_format=None):
"""@param url: Base URL for the compute service @type url: String @param auth_token: Auth token to be used for all requests @type auth_token: String @param serialize_format: Format for... | stack_v2_sparse_classes_10k_train_006138 | 3,393 | permissive | [
{
"docstring": "@param url: Base URL for the compute service @type url: String @param auth_token: Auth token to be used for all requests @type auth_token: String @param serialize_format: Format for serializing requests @type serialize_format: String @param deserialize_format: Format for de-serializing responses... | 4 | null | Implement the Python class `HypervisorsClient` described below.
Class description:
Implement the HypervisorsClient class.
Method signatures and docstrings:
- def __init__(self, url, auth_token, serialize_format=None, deserialize_format=None): @param url: Base URL for the compute service @type url: String @param auth_... | Implement the Python class `HypervisorsClient` described below.
Class description:
Implement the HypervisorsClient class.
Method signatures and docstrings:
- def __init__(self, url, auth_token, serialize_format=None, deserialize_format=None): @param url: Base URL for the compute service @type url: String @param auth_... | 7d49cf6bfd7e1a6e5b739e7de52f2e18e5ccf924 | <|skeleton|>
class HypervisorsClient:
def __init__(self, url, auth_token, serialize_format=None, deserialize_format=None):
"""@param url: Base URL for the compute service @type url: String @param auth_token: Auth token to be used for all requests @type auth_token: String @param serialize_format: Format for... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class HypervisorsClient:
def __init__(self, url, auth_token, serialize_format=None, deserialize_format=None):
"""@param url: Base URL for the compute service @type url: String @param auth_token: Auth token to be used for all requests @type auth_token: String @param serialize_format: Format for serializing r... | the_stack_v2_python_sparse | cloudcafe/compute/hypervisors_api/client.py | kurhula/cloudcafe | train | 0 | |
9e3e9c30f9b8440388e8e6677e1d7cc7b14c7f91 | [
"e = Inventory('test product code', 'test description', 'test market price', 'test rental price')\nself.assertEqual(e.product_code, 'test product code')\nself.assertEqual(e.description, 'test description')\nself.assertEqual(e.market_price, 'test market price')\nself.assertEqual(e.rental_price, 'test rental price')"... | <|body_start_0|>
e = Inventory('test product code', 'test description', 'test market price', 'test rental price')
self.assertEqual(e.product_code, 'test product code')
self.assertEqual(e.description, 'test description')
self.assertEqual(e.market_price, 'test market price')
self.a... | InventoryTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InventoryTest:
def test_inventory_init(self):
"""Tests that Inventory can be initiated"""
<|body_0|>
def test_inventory_return(self):
"""Tests Inventory return_as_dictionary"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
e = Inventory('test product... | stack_v2_sparse_classes_10k_train_006139 | 9,076 | no_license | [
{
"docstring": "Tests that Inventory can be initiated",
"name": "test_inventory_init",
"signature": "def test_inventory_init(self)"
},
{
"docstring": "Tests Inventory return_as_dictionary",
"name": "test_inventory_return",
"signature": "def test_inventory_return(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005558 | Implement the Python class `InventoryTest` described below.
Class description:
Implement the InventoryTest class.
Method signatures and docstrings:
- def test_inventory_init(self): Tests that Inventory can be initiated
- def test_inventory_return(self): Tests Inventory return_as_dictionary | Implement the Python class `InventoryTest` described below.
Class description:
Implement the InventoryTest class.
Method signatures and docstrings:
- def test_inventory_init(self): Tests that Inventory can be initiated
- def test_inventory_return(self): Tests Inventory return_as_dictionary
<|skeleton|>
class Invento... | 5dac60f39e3909ff05b26721d602ed20f14d6be3 | <|skeleton|>
class InventoryTest:
def test_inventory_init(self):
"""Tests that Inventory can be initiated"""
<|body_0|>
def test_inventory_return(self):
"""Tests Inventory return_as_dictionary"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class InventoryTest:
def test_inventory_init(self):
"""Tests that Inventory can be initiated"""
e = Inventory('test product code', 'test description', 'test market price', 'test rental price')
self.assertEqual(e.product_code, 'test product code')
self.assertEqual(e.description, 'test... | the_stack_v2_python_sparse | students/kyle_lehning/Lesson01/test_unit.py | JavaRod/SP_Python220B_2019 | train | 1 | |
46387d7f47da692898cc02ef9a31660e46dc86dc | [
"device = get_object_or_404(Device, slug=slug)\nself.check_object_permissions(request, device)\nserializer = DeviceProfileSerializer(device, many=False)\nreturn Response(data=serializer.data, status=status.HTTP_200_OK)",
"device = get_object_or_404(Device, slug=slug)\nself.check_object_permissions(request, device... | <|body_start_0|>
device = get_object_or_404(Device, slug=slug)
self.check_object_permissions(request, device)
serializer = DeviceProfileSerializer(device, many=False)
return Response(data=serializer.data, status=status.HTTP_200_OK)
<|end_body_0|>
<|body_start_1|>
device = get_ob... | DeviceProfileAPIView | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DeviceProfileAPIView:
def get(self, request, slug=None):
"""Retrieve"""
<|body_0|>
def put(self, request, slug=None):
"""Update"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
device = get_object_or_404(Device, slug=slug)
self.check_object_p... | stack_v2_sparse_classes_10k_train_006140 | 5,225 | permissive | [
{
"docstring": "Retrieve",
"name": "get",
"signature": "def get(self, request, slug=None)"
},
{
"docstring": "Update",
"name": "put",
"signature": "def put(self, request, slug=None)"
}
] | 2 | null | Implement the Python class `DeviceProfileAPIView` described below.
Class description:
Implement the DeviceProfileAPIView class.
Method signatures and docstrings:
- def get(self, request, slug=None): Retrieve
- def put(self, request, slug=None): Update | Implement the Python class `DeviceProfileAPIView` described below.
Class description:
Implement the DeviceProfileAPIView class.
Method signatures and docstrings:
- def get(self, request, slug=None): Retrieve
- def put(self, request, slug=None): Update
<|skeleton|>
class DeviceProfileAPIView:
def get(self, reque... | 98e1ff8bab7dda3492e5ff637bf5aafd111c840c | <|skeleton|>
class DeviceProfileAPIView:
def get(self, request, slug=None):
"""Retrieve"""
<|body_0|>
def put(self, request, slug=None):
"""Update"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DeviceProfileAPIView:
def get(self, request, slug=None):
"""Retrieve"""
device = get_object_or_404(Device, slug=slug)
self.check_object_permissions(request, device)
serializer = DeviceProfileSerializer(device, many=False)
return Response(data=serializer.data, status=sta... | the_stack_v2_python_sparse | mikaponics/device/views/resources/device_crud_api_views.py | mikaponics/mikaponics-back | train | 4 | |
367db951532abf6f3aaf919b714383cb3f708cb4 | [
"profile.addListsToCraftTypeRepository('skeinforge_tools.craft_plugins.dimension.html', self)\nself.fileNameInput = settings.FileNameInput().getFromFileName(interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File for Dimension', self, '')\nself.openWikiManualHelpPage = settings.HelpPage().getOpenFromAbsolute('h... | <|body_start_0|>
profile.addListsToCraftTypeRepository('skeinforge_tools.craft_plugins.dimension.html', self)
self.fileNameInput = settings.FileNameInput().getFromFileName(interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File for Dimension', self, '')
self.openWikiManualHelpPage = settings... | A class to handle the dimension settings. | DimensionRepository | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DimensionRepository:
"""A class to handle the dimension settings."""
def __init__(self):
"""Set the default settings, execute title & settings fileName."""
<|body_0|>
def execute(self):
"""Dimension button has been clicked."""
<|body_1|>
<|end_skeleton|>... | stack_v2_sparse_classes_10k_train_006141 | 10,249 | no_license | [
{
"docstring": "Set the default settings, execute title & settings fileName.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Dimension button has been clicked.",
"name": "execute",
"signature": "def execute(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004417 | Implement the Python class `DimensionRepository` described below.
Class description:
A class to handle the dimension settings.
Method signatures and docstrings:
- def __init__(self): Set the default settings, execute title & settings fileName.
- def execute(self): Dimension button has been clicked. | Implement the Python class `DimensionRepository` described below.
Class description:
A class to handle the dimension settings.
Method signatures and docstrings:
- def __init__(self): Set the default settings, execute title & settings fileName.
- def execute(self): Dimension button has been clicked.
<|skeleton|>
clas... | fd69d8e856780c826386dc973ceabcc03623f3e8 | <|skeleton|>
class DimensionRepository:
"""A class to handle the dimension settings."""
def __init__(self):
"""Set the default settings, execute title & settings fileName."""
<|body_0|>
def execute(self):
"""Dimension button has been clicked."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DimensionRepository:
"""A class to handle the dimension settings."""
def __init__(self):
"""Set the default settings, execute title & settings fileName."""
profile.addListsToCraftTypeRepository('skeinforge_tools.craft_plugins.dimension.html', self)
self.fileNameInput = settings.Fi... | the_stack_v2_python_sparse | skeinforge_tools/craft_plugins/dimension.py | bmander/skeinforge | train | 34 |
2d2c89df27b33d9d85291737d6a232609f4cda4b | [
"if type(arg_index) is int:\n return {cls.CATEGORY: category, cls.ARG_INDEX: [arg_index]}\nif type(arg_index) is list and all((isinstance(i, int) for i in arg_index)):\n return {cls.CATEGORY: category, cls.ARG_INDEX: arg_index}\nreturn {cls.CATEGORY: category}",
"self.name = propertiesDict.pop('name', None)... | <|body_start_0|>
if type(arg_index) is int:
return {cls.CATEGORY: category, cls.ARG_INDEX: [arg_index]}
if type(arg_index) is list and all((isinstance(i, int) for i in arg_index)):
return {cls.CATEGORY: category, cls.ARG_INDEX: arg_index}
return {cls.CATEGORY: category}
<... | Base class for formatting log messages. This implementation delegates everything to logging.Formatter using the messagefmt and datefmt properties. Subclasses may be implemented to provide required customizations, and can be registered by specifying classname in the formatter node of the project configuration file. | BaseLogFormatter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseLogFormatter:
"""Base class for formatting log messages. This implementation delegates everything to logging.Formatter using the messagefmt and datefmt properties. Subclasses may be implemented to provide required customizations, and can be registered by specifying classname in the formatter ... | stack_v2_sparse_classes_10k_train_006142 | 8,804 | no_license | [
{
"docstring": "Return dictionary to tag a string to format with color encodings. @param category: The category, as defined in L{ColorLogFormatter.COLOR_CATEGORIES} @param arg_index: The index of argument in the string expansion to color. This can be either a single integer value representing the index, or a li... | 2 | stack_v2_sparse_classes_30k_train_004943 | Implement the Python class `BaseLogFormatter` described below.
Class description:
Base class for formatting log messages. This implementation delegates everything to logging.Formatter using the messagefmt and datefmt properties. Subclasses may be implemented to provide required customizations, and can be registered by... | Implement the Python class `BaseLogFormatter` described below.
Class description:
Base class for formatting log messages. This implementation delegates everything to logging.Formatter using the messagefmt and datefmt properties. Subclasses may be implemented to provide required customizations, and can be registered by... | 3f93cbedbb806b6c53de89358025f93c740ebdc3 | <|skeleton|>
class BaseLogFormatter:
"""Base class for formatting log messages. This implementation delegates everything to logging.Formatter using the messagefmt and datefmt properties. Subclasses may be implemented to provide required customizations, and can be registered by specifying classname in the formatter ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BaseLogFormatter:
"""Base class for formatting log messages. This implementation delegates everything to logging.Formatter using the messagefmt and datefmt properties. Subclasses may be implemented to provide required customizations, and can be registered by specifying classname in the formatter node of the p... | the_stack_v2_python_sparse | pysys/utils/logutils.py | moraygrieve/pysys | train | 0 |
22e8fca9eb2d879568518a29ca2d88b53e5dc782 | [
"super(ContentMetadata, self).__init__(headers=headers, auth=auth)\nself.id = testXMLValue(elem.find(nspath_eval('wfs:Name', namespaces)))\nself.title = testXMLValue(elem.find(nspath_eval('wfs:Title', namespaces)))\nself.abstract = testXMLValue(elem.find(nspath_eval('wfs:Abstract', namespaces)))\nself.keywords = [f... | <|body_start_0|>
super(ContentMetadata, self).__init__(headers=headers, auth=auth)
self.id = testXMLValue(elem.find(nspath_eval('wfs:Name', namespaces)))
self.title = testXMLValue(elem.find(nspath_eval('wfs:Title', namespaces)))
self.abstract = testXMLValue(elem.find(nspath_eval('wfs:Abs... | Abstraction for WFS metadata. Implements IMetadata. | ContentMetadata | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ContentMetadata:
"""Abstraction for WFS metadata. Implements IMetadata."""
def __init__(self, elem, parse_remote_metadata=False, timeout=30, headers=None, auth=None):
"""."""
<|body_0|>
def parse_remote_metadata(self, timeout=30):
"""Parse remote metadata for Met... | stack_v2_sparse_classes_10k_train_006143 | 16,336 | permissive | [
{
"docstring": ".",
"name": "__init__",
"signature": "def __init__(self, elem, parse_remote_metadata=False, timeout=30, headers=None, auth=None)"
},
{
"docstring": "Parse remote metadata for MetadataURL of format 'text/xml' and add it as metadataUrl['metadata']",
"name": "parse_remote_metada... | 2 | stack_v2_sparse_classes_30k_train_001067 | Implement the Python class `ContentMetadata` described below.
Class description:
Abstraction for WFS metadata. Implements IMetadata.
Method signatures and docstrings:
- def __init__(self, elem, parse_remote_metadata=False, timeout=30, headers=None, auth=None): .
- def parse_remote_metadata(self, timeout=30): Parse re... | Implement the Python class `ContentMetadata` described below.
Class description:
Abstraction for WFS metadata. Implements IMetadata.
Method signatures and docstrings:
- def __init__(self, elem, parse_remote_metadata=False, timeout=30, headers=None, auth=None): .
- def parse_remote_metadata(self, timeout=30): Parse re... | 94b68c3a497978404edf486140138e4b9e340aba | <|skeleton|>
class ContentMetadata:
"""Abstraction for WFS metadata. Implements IMetadata."""
def __init__(self, elem, parse_remote_metadata=False, timeout=30, headers=None, auth=None):
"""."""
<|body_0|>
def parse_remote_metadata(self, timeout=30):
"""Parse remote metadata for Met... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ContentMetadata:
"""Abstraction for WFS metadata. Implements IMetadata."""
def __init__(self, elem, parse_remote_metadata=False, timeout=30, headers=None, auth=None):
"""."""
super(ContentMetadata, self).__init__(headers=headers, auth=auth)
self.id = testXMLValue(elem.find(nspath_... | the_stack_v2_python_sparse | owslib/feature/wfs110.py | bird-house/OWSLib | train | 2 |
c9a743956d8b97db6bdc1d4c6605347d3a679272 | [
"feedback = {'permission': True}\ntry:\n task_id = request.GET.get('task_id', None)\n if task_id is None:\n feedback['data'] = ErrorCode.parameter_missing('task_id')\n raise natrix_exception.ParameterMissingException(parameter='task_id')\n try:\n uuid.UUID(hex=task_id)\n task = ... | <|body_start_0|>
feedback = {'permission': True}
try:
task_id = request.GET.get('task_id', None)
if task_id is None:
feedback['data'] = ErrorCode.parameter_missing('task_id')
raise natrix_exception.ParameterMissingException(parameter='task_id')
... | Instant Task Info API mehtod: - GET get instant task information - POST create instant task | InstantTask | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InstantTask:
"""Instant Task Info API mehtod: - GET get instant task information - POST create instant task"""
def get(self, request):
"""GET method Get an instant task information. :param request: :return:"""
<|body_0|>
def post(self, request, format=None):
"""C... | stack_v2_sparse_classes_10k_train_006144 | 10,343 | permissive | [
{
"docstring": "GET method Get an instant task information. :param request: :return:",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "Create an instant task :param request: :param format: :return:",
"name": "post",
"signature": "def post(self, request, format=Non... | 2 | stack_v2_sparse_classes_30k_train_006309 | Implement the Python class `InstantTask` described below.
Class description:
Instant Task Info API mehtod: - GET get instant task information - POST create instant task
Method signatures and docstrings:
- def get(self, request): GET method Get an instant task information. :param request: :return:
- def post(self, req... | Implement the Python class `InstantTask` described below.
Class description:
Instant Task Info API mehtod: - GET get instant task information - POST create instant task
Method signatures and docstrings:
- def get(self, request): GET method Get an instant task information. :param request: :return:
- def post(self, req... | 8b97efdc9287645ea6b99dcf3a99fbe3f6ba6862 | <|skeleton|>
class InstantTask:
"""Instant Task Info API mehtod: - GET get instant task information - POST create instant task"""
def get(self, request):
"""GET method Get an instant task information. :param request: :return:"""
<|body_0|>
def post(self, request, format=None):
"""C... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class InstantTask:
"""Instant Task Info API mehtod: - GET get instant task information - POST create instant task"""
def get(self, request):
"""GET method Get an instant task information. :param request: :return:"""
feedback = {'permission': True}
try:
task_id = request.GET.... | the_stack_v2_python_sparse | benchmark/views/instant_views.py | creditease-natrix/natrix | train | 4 |
fa7434d1e859e4d94c2dade90d9bf66a990629cf | [
"if not root:\n return True\nnodes = [root]\nwhile nodes:\n node = nodes.pop()\n if abs(self.maxDepth(node.left) - self.maxDepth(node.right)) > 1:\n return False\n if node.left:\n nodes.append(node.left)\n if node.right:\n nodes.append(node.right)\nreturn True",
"if not root:\n... | <|body_start_0|>
if not root:
return True
nodes = [root]
while nodes:
node = nodes.pop()
if abs(self.maxDepth(node.left) - self.maxDepth(node.right)) > 1:
return False
if node.left:
nodes.append(node.left)
... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isBalanced(self, root):
""":type root: TreeNode :rtype: bool"""
<|body_0|>
def maxDepth(self, root):
""":type root: TreeNode :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not root:
return True
nodes... | stack_v2_sparse_classes_10k_train_006145 | 2,310 | permissive | [
{
"docstring": ":type root: TreeNode :rtype: bool",
"name": "isBalanced",
"signature": "def isBalanced(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: int",
"name": "maxDepth",
"signature": "def maxDepth(self, root)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isBalanced(self, root): :type root: TreeNode :rtype: bool
- def maxDepth(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 isBalanced(self, root): :type root: TreeNode :rtype: bool
- def maxDepth(self, root): :type root: TreeNode :rtype: int
<|skeleton|>
class Solution:
def isBalanced(self,... | 57080da5fbe5d62cbc0b8a34e362a8b0978d5b59 | <|skeleton|>
class Solution:
def isBalanced(self, root):
""":type root: TreeNode :rtype: bool"""
<|body_0|>
def maxDepth(self, root):
""":type root: TreeNode :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def isBalanced(self, root):
""":type root: TreeNode :rtype: bool"""
if not root:
return True
nodes = [root]
while nodes:
node = nodes.pop()
if abs(self.maxDepth(node.left) - self.maxDepth(node.right)) > 1:
return Fal... | the_stack_v2_python_sparse | python/tree/0110_balanced_binary_tree.py | linshaoyong/leetcode | train | 6 | |
15f785e873763bd0b559e7bd0053c42524230ffe | [
"super(SetUp, self).__init__(*args, **kwargs)\nself.arguments = arguments\nself._lexicographer = None\nself._builder = None\nreturn",
"if self._lexicographer is None:\n glob = self.arguments.glob\n message = 'Building Lexicographer with glob ({0})'.format(glob)\n self.logger.debug(message)\n self._lex... | <|body_start_0|>
super(SetUp, self).__init__(*args, **kwargs)
self.arguments = arguments
self._lexicographer = None
self._builder = None
return
<|end_body_0|>
<|body_start_1|>
if self._lexicographer is None:
glob = self.arguments.glob
message = 'B... | The SetUp sets up the infrastructure | SetUp | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SetUp:
"""The SetUp sets up the infrastructure"""
def __init__(self, arguments, *args, **kwargs):
""":param: - `arguments`: An ArgumentParser Namespace"""
<|body_0|>
def lexicographer(self):
""":return: Lexicographer that maps config-files"""
<|body_1|>
... | stack_v2_sparse_classes_10k_train_006146 | 1,568 | permissive | [
{
"docstring": ":param: - `arguments`: An ArgumentParser Namespace",
"name": "__init__",
"signature": "def __init__(self, arguments, *args, **kwargs)"
},
{
"docstring": ":return: Lexicographer that maps config-files",
"name": "lexicographer",
"signature": "def lexicographer(self)"
},
... | 4 | stack_v2_sparse_classes_30k_train_000763 | Implement the Python class `SetUp` described below.
Class description:
The SetUp sets up the infrastructure
Method signatures and docstrings:
- def __init__(self, arguments, *args, **kwargs): :param: - `arguments`: An ArgumentParser Namespace
- def lexicographer(self): :return: Lexicographer that maps config-files
- ... | Implement the Python class `SetUp` described below.
Class description:
The SetUp sets up the infrastructure
Method signatures and docstrings:
- def __init__(self, arguments, *args, **kwargs): :param: - `arguments`: An ArgumentParser Namespace
- def lexicographer(self): :return: Lexicographer that maps config-files
- ... | b4d1c77e1d611fe2b30768b42bdc7493afb0ea95 | <|skeleton|>
class SetUp:
"""The SetUp sets up the infrastructure"""
def __init__(self, arguments, *args, **kwargs):
""":param: - `arguments`: An ArgumentParser Namespace"""
<|body_0|>
def lexicographer(self):
""":return: Lexicographer that maps config-files"""
<|body_1|>
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SetUp:
"""The SetUp sets up the infrastructure"""
def __init__(self, arguments, *args, **kwargs):
""":param: - `arguments`: An ArgumentParser Namespace"""
super(SetUp, self).__init__(*args, **kwargs)
self.arguments = arguments
self._lexicographer = None
self._build... | the_stack_v2_python_sparse | apetools/proletarians/setuprun.py | russell-n/oldape | train | 0 |
6504bca43fec8cddc98cc55dce3aeaddf1bdd15f | [
"def get_number(l: ListNode) -> int:\n rslt, curr = (0, l)\n while curr:\n rslt = rslt * 10 + curr.val\n curr = curr.next\n return rslt\nn = str(get_number(l1) + get_number(l2))\ndummyHead = currNode = ListNode(None)\nfor c in n:\n currNode.next = ListNode(int(c))\n currNode = currNode.... | <|body_start_0|>
def get_number(l: ListNode) -> int:
rslt, curr = (0, l)
while curr:
rslt = rslt * 10 + curr.val
curr = curr.next
return rslt
n = str(get_number(l1) + get_number(l2))
dummyHead = currNode = ListNode(None)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode:
"""Cheat answer: python does not have a limit on integer."""
<|body_0|>
def addTwoNumbers2(self, l1: ListNode, l2: ListNode) -> ListNode:
"""Regular solution using a stack."""
<|body_1... | stack_v2_sparse_classes_10k_train_006147 | 1,482 | no_license | [
{
"docstring": "Cheat answer: python does not have a limit on integer.",
"name": "addTwoNumbers",
"signature": "def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode"
},
{
"docstring": "Regular solution using a stack.",
"name": "addTwoNumbers2",
"signature": "def addTwoNumbers2... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode: Cheat answer: python does not have a limit on integer.
- def addTwoNumbers2(self, l1: ListNode, l2: ListNode) -> ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode: Cheat answer: python does not have a limit on integer.
- def addTwoNumbers2(self, l1: ListNode, l2: ListNode) -> ... | edb870f83f0c4568cce0cacec04ee70cf6b545bf | <|skeleton|>
class Solution:
def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode:
"""Cheat answer: python does not have a limit on integer."""
<|body_0|>
def addTwoNumbers2(self, l1: ListNode, l2: ListNode) -> ListNode:
"""Regular solution using a stack."""
<|body_1... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode:
"""Cheat answer: python does not have a limit on integer."""
def get_number(l: ListNode) -> int:
rslt, curr = (0, l)
while curr:
rslt = rslt * 10 + curr.val
curr =... | the_stack_v2_python_sparse | 2020/add_two_numbers_ii.py | eronekogin/leetcode | train | 0 | |
a24fd9e3332d60a70c72263725aa8fc42f9bb77c | [
"a = []\n\ndef helper(root):\n if not root:\n a.append('#')\n return\n a.append(str(root.val))\n helper(root.left)\n helper(root.right)\nhelper(root)\nreturn ' '.join(a)",
"a = data.split()\nself.i = 0\n\ndef helper():\n if a[self.i] == '#':\n self.i += 1\n return None\n... | <|body_start_0|>
a = []
def helper(root):
if not root:
a.append('#')
return
a.append(str(root.val))
helper(root.left)
helper(root.right)
helper(root)
return ' '.join(a)
<|end_body_0|>
<|body_start_1|>
... | Codec_DFS | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec_DFS:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|b... | stack_v2_sparse_classes_10k_train_006148 | 5,078 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | null | Implement the Python class `Codec_DFS` described below.
Class description:
Implement the Codec_DFS class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str... | Implement the Python class `Codec_DFS` described below.
Class description:
Implement the Codec_DFS class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str... | 635af6e22aa8eef8e7920a585d43a45a891a8157 | <|skeleton|>
class Codec_DFS:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Codec_DFS:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
a = []
def helper(root):
if not root:
a.append('#')
return
a.append(str(root.val))
helper(root.left)
... | the_stack_v2_python_sparse | code297SerializeAndDeserializeBinaryTree.py | cybelewang/leetcode-python | train | 0 | |
e2d1391eff573fe26fd5516eb0193e828ab44107 | [
"self.typology = 'Area'\nself.source_id = identifier\nself.name = name\nself.tectonic_region_type = tectonic_region\nself.aspect_ratio = aspect_ratio\nself.mfd = None\nself.msr = None\nif upper_depth < 0.0:\n raise ValueError('Upper Depth Must be Non Negative')\nself.upper_depth = upper_depth\nif lower_depth and... | <|body_start_0|>
self.typology = 'Area'
self.source_id = identifier
self.name = name
self.tectonic_region_type = tectonic_region
self.aspect_ratio = aspect_ratio
self.mfd = None
self.msr = None
if upper_depth < 0.0:
raise ValueError('Upper Dept... | New class to describe the mtkAreaSource object | mtkAreaSource | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class mtkAreaSource:
"""New class to describe the mtkAreaSource object"""
def __init__(self, identifier, name, tectonic_region, aspect_ratio, input_geometry, upper_depth=0.0, lower_depth=None):
"""Instantiate class with just the basic attributes :param identifier: Integer ID code for the s... | stack_v2_sparse_classes_10k_train_006149 | 5,217 | no_license | [
{
"docstring": "Instantiate class with just the basic attributes :param identifier: Integer ID code for the source :param name: Source Name (string) :param tectonic_region: Tectonic Region Type (String) :param aspect_ratio: Ratio of along-strike length to down-dip width (float) :param input_geometry: Input geom... | 2 | stack_v2_sparse_classes_30k_train_004353 | Implement the Python class `mtkAreaSource` described below.
Class description:
New class to describe the mtkAreaSource object
Method signatures and docstrings:
- def __init__(self, identifier, name, tectonic_region, aspect_ratio, input_geometry, upper_depth=0.0, lower_depth=None): Instantiate class with just the basi... | Implement the Python class `mtkAreaSource` described below.
Class description:
New class to describe the mtkAreaSource object
Method signatures and docstrings:
- def __init__(self, identifier, name, tectonic_region, aspect_ratio, input_geometry, upper_depth=0.0, lower_depth=None): Instantiate class with just the basi... | cb98126555d54548f8e6ff8305eef15328930310 | <|skeleton|>
class mtkAreaSource:
"""New class to describe the mtkAreaSource object"""
def __init__(self, identifier, name, tectonic_region, aspect_ratio, input_geometry, upper_depth=0.0, lower_depth=None):
"""Instantiate class with just the basic attributes :param identifier: Integer ID code for the s... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class mtkAreaSource:
"""New class to describe the mtkAreaSource object"""
def __init__(self, identifier, name, tectonic_region, aspect_ratio, input_geometry, upper_depth=0.0, lower_depth=None):
"""Instantiate class with just the basic attributes :param identifier: Integer ID code for the source :param ... | the_stack_v2_python_sparse | seismicity_modeller/mtk/sources/mtk_area.py | g-weatherill/prototype_code | train | 0 |
aa066272064ae6d8963e1367bc71819e5fbdea45 | [
"super().__init__()\nself.in_features = in_features\nself.gate = torch.nn.Sequential(torch.nn.Linear(in_features=in_features, out_features=1), torch.nn.Sigmoid())\nself.apply(initialise_layer_weights)",
"item = input[0]\nchannels = item.shape[1]\nkernel_size = item.shape[2:]\ngating_weights = self.gate(item.resha... | <|body_start_0|>
super().__init__()
self.in_features = in_features
self.gate = torch.nn.Sequential(torch.nn.Linear(in_features=in_features, out_features=1), torch.nn.Sigmoid())
self.apply(initialise_layer_weights)
<|end_body_0|>
<|body_start_1|>
item = input[0]
channels ... | Gated pooling. Flatten each volume x [1, ZYX], feed through a one layer NN yield one weight per image. This weight is used as the mixing proportion for max_pooling features and average pooling features similar to what is done in MixPooling. | Gated3dPoolingLayer | [
"MIT",
"LicenseRef-scancode-generic-cla"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Gated3dPoolingLayer:
"""Gated pooling. Flatten each volume x [1, ZYX], feed through a one layer NN yield one weight per image. This weight is used as the mixing proportion for max_pooling features and average pooling features similar to what is done in MixPooling."""
def __init__(self, in_fe... | stack_v2_sparse_classes_10k_train_006150 | 4,772 | permissive | [
{
"docstring": ":param in_features: should be the size of the flatten volume X*Y*Z",
"name": "__init__",
"signature": "def __init__(self, in_features: int) -> None"
},
{
"docstring": ":param input: batch of size [B, C, Z, X, Y",
"name": "forward",
"signature": "def forward(self, *input: ... | 2 | null | Implement the Python class `Gated3dPoolingLayer` described below.
Class description:
Gated pooling. Flatten each volume x [1, ZYX], feed through a one layer NN yield one weight per image. This weight is used as the mixing proportion for max_pooling features and average pooling features similar to what is done in MixPo... | Implement the Python class `Gated3dPoolingLayer` described below.
Class description:
Gated pooling. Flatten each volume x [1, ZYX], feed through a one layer NN yield one weight per image. This weight is used as the mixing proportion for max_pooling features and average pooling features similar to what is done in MixPo... | 2877002d50d3a34d80f647c18cb561025d9066cc | <|skeleton|>
class Gated3dPoolingLayer:
"""Gated pooling. Flatten each volume x [1, ZYX], feed through a one layer NN yield one weight per image. This weight is used as the mixing proportion for max_pooling features and average pooling features similar to what is done in MixPooling."""
def __init__(self, in_fe... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Gated3dPoolingLayer:
"""Gated pooling. Flatten each volume x [1, ZYX], feed through a one layer NN yield one weight per image. This weight is used as the mixing proportion for max_pooling features and average pooling features similar to what is done in MixPooling."""
def __init__(self, in_features: int) ... | the_stack_v2_python_sparse | InnerEye/ML/models/layers/pooling_layers.py | microsoft/InnerEye-DeepLearning | train | 511 |
1a87ae6e617cb66cb05c4f62ac70995a8b0b91eb | [
"super().__init__()\nself.input_conv = Conv1d(in_channels, hidden_channels, 1)\nself.encoder = WaveNet(in_channels=-1, out_channels=-1, kernel_size=kernel_size, layers=layers, stacks=stacks, base_dilation=base_dilation, residual_channels=hidden_channels, aux_channels=-1, gate_channels=hidden_channels * 2, skip_chan... | <|body_start_0|>
super().__init__()
self.input_conv = Conv1d(in_channels, hidden_channels, 1)
self.encoder = WaveNet(in_channels=-1, out_channels=-1, kernel_size=kernel_size, layers=layers, stacks=stacks, base_dilation=base_dilation, residual_channels=hidden_channels, aux_channels=-1, gate_chann... | Posterior encoder module in VITS. This is a module of posterior encoder described in `Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech`_. .. _`Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech`: https://arxiv.org/abs/2006.04558 | PosteriorEncoder | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PosteriorEncoder:
"""Posterior encoder module in VITS. This is a module of posterior encoder described in `Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech`_. .. _`Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speec... | stack_v2_sparse_classes_10k_train_006151 | 4,037 | permissive | [
{
"docstring": "Initilialize PosteriorEncoder module. Args: in_channels (int): Number of input channels. out_channels (int): Number of output channels. hidden_channels (int): Number of hidden channels. kernel_size (int): Kernel size in WaveNet. layers (int): Number of layers of WaveNet. stacks (int): Number of ... | 2 | null | Implement the Python class `PosteriorEncoder` described below.
Class description:
Posterior encoder module in VITS. This is a module of posterior encoder described in `Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech`_. .. _`Conditional Variational Autoencoder with Adversaria... | Implement the Python class `PosteriorEncoder` described below.
Class description:
Posterior encoder module in VITS. This is a module of posterior encoder described in `Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech`_. .. _`Conditional Variational Autoencoder with Adversaria... | bcd20948db7846ee523443ef9fd78c7a1248c95e | <|skeleton|>
class PosteriorEncoder:
"""Posterior encoder module in VITS. This is a module of posterior encoder described in `Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech`_. .. _`Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speec... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PosteriorEncoder:
"""Posterior encoder module in VITS. This is a module of posterior encoder described in `Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech`_. .. _`Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech`: https://a... | the_stack_v2_python_sparse | espnet2/gan_tts/vits/posterior_encoder.py | espnet/espnet | train | 7,242 |
11880cd44aa1d64196dce6fb7dd065e124fb4ef3 | [
"cols.add(j)\nleft_diags.add(j - i)\nright_diags.add(n - 1 - j - i)\nboard[i][j] = 'Q'",
"cols.remove(j)\nleft_diags.remove(j - i)\nright_diags.remove(n - 1 - j - i)\nboard[i][j] = '.'",
"if j not in cols and j - i not in left_diags and (n - 1 - j - i not in right_diags):\n return True\nreturn False",
"if ... | <|body_start_0|>
cols.add(j)
left_diags.add(j - i)
right_diags.add(n - 1 - j - i)
board[i][j] = 'Q'
<|end_body_0|>
<|body_start_1|>
cols.remove(j)
left_diags.remove(j - i)
right_diags.remove(n - 1 - j - i)
board[i][j] = '.'
<|end_body_1|>
<|body_start_2|... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def place_queen(self, board, n, i, j, cols, left_diags, right_diags):
"""Places queen on the board at square(i, j). Modifies board in-place."""
<|body_0|>
def remove_queen(self, board, n, i, j, cols, left_diags, right_diags):
"""Removes queen from the squar... | stack_v2_sparse_classes_10k_train_006152 | 5,871 | no_license | [
{
"docstring": "Places queen on the board at square(i, j). Modifies board in-place.",
"name": "place_queen",
"signature": "def place_queen(self, board, n, i, j, cols, left_diags, right_diags)"
},
{
"docstring": "Removes queen from the square(i, j). Modifies board in-place.",
"name": "remove_... | 5 | stack_v2_sparse_classes_30k_train_005036 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def place_queen(self, board, n, i, j, cols, left_diags, right_diags): Places queen on the board at square(i, j). Modifies board in-place.
- def remove_queen(self, board, n, i, j,... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def place_queen(self, board, n, i, j, cols, left_diags, right_diags): Places queen on the board at square(i, j). Modifies board in-place.
- def remove_queen(self, board, n, i, j,... | 71b722ddfe8da04572e527b055cf8723d5c87bbf | <|skeleton|>
class Solution:
def place_queen(self, board, n, i, j, cols, left_diags, right_diags):
"""Places queen on the board at square(i, j). Modifies board in-place."""
<|body_0|>
def remove_queen(self, board, n, i, j, cols, left_diags, right_diags):
"""Removes queen from the squar... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def place_queen(self, board, n, i, j, cols, left_diags, right_diags):
"""Places queen on the board at square(i, j). Modifies board in-place."""
cols.add(j)
left_diags.add(j - i)
right_diags.add(n - 1 - j - i)
board[i][j] = 'Q'
def remove_queen(self, board... | the_stack_v2_python_sparse | Backtracking/n_queens.py | vladn90/Algorithms | train | 0 | |
c8fd1208d7b8082d42de8cdaa90db36e81ba08f2 | [
"for i in range(2, len(cost)):\n cost[i] = min(cost[i - 2], cost[i - 1]) + cost[i]\nreturn min(cost[-2], cost[-1])",
"li = [0] * len(cost)\nli[0] = cost[0]\nli[1] = cost[1]\nfor i in range(2, len(cost)):\n li[i] = min(li[i - 2], li[i - 1]) + cost[i]\nreturn min(li[-2], li[-1])"
] | <|body_start_0|>
for i in range(2, len(cost)):
cost[i] = min(cost[i - 2], cost[i - 1]) + cost[i]
return min(cost[-2], cost[-1])
<|end_body_0|>
<|body_start_1|>
li = [0] * len(cost)
li[0] = cost[0]
li[1] = cost[1]
for i in range(2, len(cost)):
li[i... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minCostClimbingStairs(self, cost):
""":type cost: List[int] :rtype: int"""
<|body_0|>
def minCostClimbingStairs(self, cost):
""":type cost: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
for i in range(2, len(cos... | stack_v2_sparse_classes_10k_train_006153 | 671 | no_license | [
{
"docstring": ":type cost: List[int] :rtype: int",
"name": "minCostClimbingStairs",
"signature": "def minCostClimbingStairs(self, cost)"
},
{
"docstring": ":type cost: List[int] :rtype: int",
"name": "minCostClimbingStairs",
"signature": "def minCostClimbingStairs(self, cost)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minCostClimbingStairs(self, cost): :type cost: List[int] :rtype: int
- def minCostClimbingStairs(self, cost): :type cost: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minCostClimbingStairs(self, cost): :type cost: List[int] :rtype: int
- def minCostClimbingStairs(self, cost): :type cost: List[int] :rtype: int
<|skeleton|>
class Solution:
... | a509b383a42f54313970168d9faa11f088f18708 | <|skeleton|>
class Solution:
def minCostClimbingStairs(self, cost):
""":type cost: List[int] :rtype: int"""
<|body_0|>
def minCostClimbingStairs(self, cost):
""":type cost: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def minCostClimbingStairs(self, cost):
""":type cost: List[int] :rtype: int"""
for i in range(2, len(cost)):
cost[i] = min(cost[i - 2], cost[i - 1]) + cost[i]
return min(cost[-2], cost[-1])
def minCostClimbingStairs(self, cost):
""":type cost: List[in... | the_stack_v2_python_sparse | 0746_Min_Cost_Climbing_Stairs.py | bingli8802/leetcode | train | 0 | |
b992009320958ec7462195be947ec2601f53805c | [
"self.id = id\nself._object = None\nself.velocity = {}\nfor unit, straight, diagonal in db('SELECT unit, time_move_straight, time_move_diagonal FROM data.unit_velocity WHERE ground = ?', self.id):\n self.velocity[unit] = (straight, diagonal)\nself.classes = ['ground[' + str(id) + ']']\nfor name, in db('SELECT cl... | <|body_start_0|>
self.id = id
self._object = None
self.velocity = {}
for unit, straight, diagonal in db('SELECT unit, time_move_straight, time_move_diagonal FROM data.unit_velocity WHERE ground = ?', self.id):
self.velocity[unit] = (straight, diagonal)
self.classes = ... | @param id: ground id. | GroundClass | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GroundClass:
"""@param id: ground id."""
def __init__(self, db, id):
"""@param id: id in db for this specific ground class @param db: DbReader instance to get data from"""
<|body_0|>
def __new__(self, db, id):
"""@param id: ground id."""
<|body_1|>
d... | stack_v2_sparse_classes_10k_train_006154 | 4,001 | no_license | [
{
"docstring": "@param id: id in db for this specific ground class @param db: DbReader instance to get data from",
"name": "__init__",
"signature": "def __init__(self, db, id)"
},
{
"docstring": "@param id: ground id.",
"name": "__new__",
"signature": "def __new__(self, db, id)"
},
{... | 3 | stack_v2_sparse_classes_30k_train_007301 | Implement the Python class `GroundClass` described below.
Class description:
@param id: ground id.
Method signatures and docstrings:
- def __init__(self, db, id): @param id: id in db for this specific ground class @param db: DbReader instance to get data from
- def __new__(self, db, id): @param id: ground id.
- def _... | Implement the Python class `GroundClass` described below.
Class description:
@param id: ground id.
Method signatures and docstrings:
- def __init__(self, db, id): @param id: id in db for this specific ground class @param db: DbReader instance to get data from
- def __new__(self, db, id): @param id: ground id.
- def _... | 6112ee6961714f6b963652d4ec25e2823732be8d | <|skeleton|>
class GroundClass:
"""@param id: ground id."""
def __init__(self, db, id):
"""@param id: id in db for this specific ground class @param db: DbReader instance to get data from"""
<|body_0|>
def __new__(self, db, id):
"""@param id: ground id."""
<|body_1|>
d... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GroundClass:
"""@param id: ground id."""
def __init__(self, db, id):
"""@param id: id in db for this specific ground class @param db: DbReader instance to get data from"""
self.id = id
self._object = None
self.velocity = {}
for unit, straight, diagonal in db('SELEC... | the_stack_v2_python_sparse | horizons/world/ground.py | totycro/unknown-horizons-quadtree | train | 1 |
c7245f2d1887a982782877f740e12a1dfac3a3d3 | [
"user_auth = TokenAuthentication()\naccess = user_auth.get(request)\ntry:\n user_email = access['email']\nexcept KeyError:\n return Response('You are logged out.', status=200)\nuser = User.objects.get(email_address=user_email)\nuser_id = user.id\naudio_path = request.data['audio_path']\ndata = {'user_id': use... | <|body_start_0|>
user_auth = TokenAuthentication()
access = user_auth.get(request)
try:
user_email = access['email']
except KeyError:
return Response('You are logged out.', status=200)
user = User.objects.get(email_address=user_email)
user_id = use... | MakeDeletePitt | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MakeDeletePitt:
def post(cls, request) -> Response:
"""Makes a pitt :return: Response with audio's name"""
<|body_0|>
def delete(cls, request) -> Response:
"""Deletes a pitt :param request: :return: Response dict"""
<|body_1|>
<|end_skeleton|>
<|body_start_... | stack_v2_sparse_classes_10k_train_006155 | 2,078 | no_license | [
{
"docstring": "Makes a pitt :return: Response with audio's name",
"name": "post",
"signature": "def post(cls, request) -> Response"
},
{
"docstring": "Deletes a pitt :param request: :return: Response dict",
"name": "delete",
"signature": "def delete(cls, request) -> Response"
}
] | 2 | stack_v2_sparse_classes_30k_train_000788 | Implement the Python class `MakeDeletePitt` described below.
Class description:
Implement the MakeDeletePitt class.
Method signatures and docstrings:
- def post(cls, request) -> Response: Makes a pitt :return: Response with audio's name
- def delete(cls, request) -> Response: Deletes a pitt :param request: :return: R... | Implement the Python class `MakeDeletePitt` described below.
Class description:
Implement the MakeDeletePitt class.
Method signatures and docstrings:
- def post(cls, request) -> Response: Makes a pitt :return: Response with audio's name
- def delete(cls, request) -> Response: Deletes a pitt :param request: :return: R... | 4ae72142e792c3295781e5e6a95caf3854d18c6f | <|skeleton|>
class MakeDeletePitt:
def post(cls, request) -> Response:
"""Makes a pitt :return: Response with audio's name"""
<|body_0|>
def delete(cls, request) -> Response:
"""Deletes a pitt :param request: :return: Response dict"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MakeDeletePitt:
def post(cls, request) -> Response:
"""Makes a pitt :return: Response with audio's name"""
user_auth = TokenAuthentication()
access = user_auth.get(request)
try:
user_email = access['email']
except KeyError:
return Response('You a... | the_stack_v2_python_sparse | src/api_client/views/make_delete_pitt_view.py | alexfurmenkov/backend-2019-trainee-sync | train | 0 | |
badad1b19b82b55dbfe9ea54592ee9620a3259c3 | [
"stack = []\ncnt = collections.Counter(s)\nfor char in s:\n if char not in stack:\n while stack and stack[-1] > char and (cnt[stack[-1]] > 0):\n stack.pop()\n stack.append(char)\n cnt[char] -= 1\nreturn ''.join(stack)",
"stack = []\nseen = set()\nremain_counter = collections.Counter... | <|body_start_0|>
stack = []
cnt = collections.Counter(s)
for char in s:
if char not in stack:
while stack and stack[-1] > char and (cnt[stack[-1]] > 0):
stack.pop()
stack.append(char)
cnt[char] -= 1
return ''.joi... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def removeDuplicateLetters(self, s):
""":type s: str :rtype: str"""
<|body_0|>
def removeDuplicateLetters(self, s):
""":type s: str :rtype: str"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
stack = []
cnt = collections.Counter(s)... | stack_v2_sparse_classes_10k_train_006156 | 1,078 | no_license | [
{
"docstring": ":type s: str :rtype: str",
"name": "removeDuplicateLetters",
"signature": "def removeDuplicateLetters(self, s)"
},
{
"docstring": ":type s: str :rtype: str",
"name": "removeDuplicateLetters",
"signature": "def removeDuplicateLetters(self, s)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004960 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def removeDuplicateLetters(self, s): :type s: str :rtype: str
- def removeDuplicateLetters(self, s): :type s: str :rtype: str | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def removeDuplicateLetters(self, s): :type s: str :rtype: str
- def removeDuplicateLetters(self, s): :type s: str :rtype: str
<|skeleton|>
class Solution:
def removeDuplica... | a509b383a42f54313970168d9faa11f088f18708 | <|skeleton|>
class Solution:
def removeDuplicateLetters(self, s):
""":type s: str :rtype: str"""
<|body_0|>
def removeDuplicateLetters(self, s):
""":type s: str :rtype: str"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def removeDuplicateLetters(self, s):
""":type s: str :rtype: str"""
stack = []
cnt = collections.Counter(s)
for char in s:
if char not in stack:
while stack and stack[-1] > char and (cnt[stack[-1]] > 0):
stack.pop()
... | the_stack_v2_python_sparse | 0316_Remove_Duplicate_Letters.py | bingli8802/leetcode | train | 0 | |
b1599471fcba9e272717bb752982cbc30362c232 | [
"if not pre:\n return None\nroot = TreeNode(pre[0])\nif len(pre) == 1:\n return root\nif pre[1] == post[-2]:\n right_length = len(pre[1:])\n right_post = post[:right_length]\n right_pre = pre[1:]\n left_pre = None\n left_post = None\nelse:\n post_left_index = post.index(pre[1])\n length_l... | <|body_start_0|>
if not pre:
return None
root = TreeNode(pre[0])
if len(pre) == 1:
return root
if pre[1] == post[-2]:
right_length = len(pre[1:])
right_post = post[:right_length]
right_pre = pre[1:]
left_pre = None
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def constructFromPrePost(self, pre, post):
""":type pre: List[int] :type post: List[int] :rtype: TreeNode"""
<|body_0|>
def constructFromPrePost2(self, pre, post):
""":type pre: List[int] :type post: List[int] :rtype: TreeNode"""
<|body_1|>
<|end_s... | stack_v2_sparse_classes_10k_train_006157 | 1,684 | no_license | [
{
"docstring": ":type pre: List[int] :type post: List[int] :rtype: TreeNode",
"name": "constructFromPrePost",
"signature": "def constructFromPrePost(self, pre, post)"
},
{
"docstring": ":type pre: List[int] :type post: List[int] :rtype: TreeNode",
"name": "constructFromPrePost2",
"signat... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def constructFromPrePost(self, pre, post): :type pre: List[int] :type post: List[int] :rtype: TreeNode
- def constructFromPrePost2(self, pre, post): :type pre: List[int] :type po... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def constructFromPrePost(self, pre, post): :type pre: List[int] :type post: List[int] :rtype: TreeNode
- def constructFromPrePost2(self, pre, post): :type pre: List[int] :type po... | 4105e18050b15fc0409c75353ad31be17187dd34 | <|skeleton|>
class Solution:
def constructFromPrePost(self, pre, post):
""":type pre: List[int] :type post: List[int] :rtype: TreeNode"""
<|body_0|>
def constructFromPrePost2(self, pre, post):
""":type pre: List[int] :type post: List[int] :rtype: TreeNode"""
<|body_1|>
<|end_s... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def constructFromPrePost(self, pre, post):
""":type pre: List[int] :type post: List[int] :rtype: TreeNode"""
if not pre:
return None
root = TreeNode(pre[0])
if len(pre) == 1:
return root
if pre[1] == post[-2]:
right_length =... | the_stack_v2_python_sparse | constructFromPrePost.py | NeilWangziyu/Leetcode_py | train | 2 | |
47345ea6f6e3c1be7961462dbf704fcec0504e9e | [
"res = {}\nfor line in self.browse(cr, uid, ids):\n res[line.id] = line.price_unit * line.product_qty\nreturn res",
"res = {}\nif price or qty:\n res = {'value': {'price_subtotal': price * qty}}\nreturn res"
] | <|body_start_0|>
res = {}
for line in self.browse(cr, uid, ids):
res[line.id] = line.price_unit * line.product_qty
return res
<|end_body_0|>
<|body_start_1|>
res = {}
if price or qty:
res = {'value': {'price_subtotal': price * qty}}
return res
<|e... | Manage the products of purchase inintail quotaion | pq_products | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class pq_products:
"""Manage the products of purchase inintail quotaion"""
def _amount_line(self, cr, uid, ids, fields, arg, context):
"""Compute the price amount of each quotaion line. @return: dictionary of lines subtotal"""
<|body_0|>
def subtotal(self, cr, uid, ids, price,... | stack_v2_sparse_classes_10k_train_006158 | 20,327 | no_license | [
{
"docstring": "Compute the price amount of each quotaion line. @return: dictionary of lines subtotal",
"name": "_amount_line",
"signature": "def _amount_line(self, cr, uid, ids, fields, arg, context)"
},
{
"docstring": "On change function to recompute the total price after changing product qty ... | 2 | null | Implement the Python class `pq_products` described below.
Class description:
Manage the products of purchase inintail quotaion
Method signatures and docstrings:
- def _amount_line(self, cr, uid, ids, fields, arg, context): Compute the price amount of each quotaion line. @return: dictionary of lines subtotal
- def sub... | Implement the Python class `pq_products` described below.
Class description:
Manage the products of purchase inintail quotaion
Method signatures and docstrings:
- def _amount_line(self, cr, uid, ids, fields, arg, context): Compute the price amount of each quotaion line. @return: dictionary of lines subtotal
- def sub... | 0b997095c260d58b026440967fea3a202bef7efb | <|skeleton|>
class pq_products:
"""Manage the products of purchase inintail quotaion"""
def _amount_line(self, cr, uid, ids, fields, arg, context):
"""Compute the price amount of each quotaion line. @return: dictionary of lines subtotal"""
<|body_0|>
def subtotal(self, cr, uid, ids, price,... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class pq_products:
"""Manage the products of purchase inintail quotaion"""
def _amount_line(self, cr, uid, ids, fields, arg, context):
"""Compute the price amount of each quotaion line. @return: dictionary of lines subtotal"""
res = {}
for line in self.browse(cr, uid, ids):
... | the_stack_v2_python_sparse | v_7/GDS/shamil_v3/purchase_custom/quote.py | musabahmed/baba | train | 0 |
1342c87f11545bc2335cb40008d6d7d532c13698 | [
"self.flavors_client.default_headers['Accept'] = 'application/xml'\nself.flavors_client.default_headers['Content-Type'] = 'application/json'\nresponse = self.flavors_client.list_flavors()\nself.assertEqual(response.status_code, 200, 'Unexpected status code returned. Expected: {0} Received: {1}'.format(200, response... | <|body_start_0|>
self.flavors_client.default_headers['Accept'] = 'application/xml'
self.flavors_client.default_headers['Content-Type'] = 'application/json'
response = self.flavors_client.list_flavors()
self.assertEqual(response.status_code, 200, 'Unexpected status code returned. Expected... | XMLDeprecationTest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class XMLDeprecationTest:
def test_get_request_accept_xml_ignored(self):
"""A GET request passing only the accept header as xml is ignored Request a list of available flavors passing only the accept header as xml and ensure that the header is ignored returning a valid json response. The follow... | stack_v2_sparse_classes_10k_train_006159 | 7,393 | permissive | [
{
"docstring": "A GET request passing only the accept header as xml is ignored Request a list of available flavors passing only the accept header as xml and ensure that the header is ignored returning a valid json response. The following assertions occur: - The response code is 200 - The response content does n... | 6 | null | Implement the Python class `XMLDeprecationTest` described below.
Class description:
Implement the XMLDeprecationTest class.
Method signatures and docstrings:
- def test_get_request_accept_xml_ignored(self): A GET request passing only the accept header as xml is ignored Request a list of available flavors passing only... | Implement the Python class `XMLDeprecationTest` described below.
Class description:
Implement the XMLDeprecationTest class.
Method signatures and docstrings:
- def test_get_request_accept_xml_ignored(self): A GET request passing only the accept header as xml is ignored Request a list of available flavors passing only... | 30f0e64672676c3f90b4a582fe90fac6621475b3 | <|skeleton|>
class XMLDeprecationTest:
def test_get_request_accept_xml_ignored(self):
"""A GET request passing only the accept header as xml is ignored Request a list of available flavors passing only the accept header as xml and ensure that the header is ignored returning a valid json response. The follow... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class XMLDeprecationTest:
def test_get_request_accept_xml_ignored(self):
"""A GET request passing only the accept header as xml is ignored Request a list of available flavors passing only the accept header as xml and ensure that the header is ignored returning a valid json response. The following assertions... | the_stack_v2_python_sparse | cloudroast/compute/api/test_xml_deprecation.py | RULCSoft/cloudroast | train | 1 | |
0bd47f621bdac3e959c85edc89a17f5300a0ad7e | [
"assert chunk_size % _CHUNK_SIZE_MULTIPLE == 0, 'chunk_size must be a multiple of %d B' % _CHUNK_SIZE_MULTIPLE\nself.chunk_size = chunk_size\nself.logger = logger\ncredentials = service_account.Credentials.from_service_account_file(json_key_path, scopes=(_GCS_SCOPE,))\nself.client = storage.Client(project='', crede... | <|body_start_0|>
assert chunk_size % _CHUNK_SIZE_MULTIPLE == 0, 'chunk_size must be a multiple of %d B' % _CHUNK_SIZE_MULTIPLE
self.chunk_size = chunk_size
self.logger = logger
credentials = service_account.Credentials.from_service_account_file(json_key_path, scopes=(_GCS_SCOPE,))
... | Wrapper to access Google Cloud Storage. | CloudStorage | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CloudStorage:
"""Wrapper to access Google Cloud Storage."""
def __init__(self, json_key_path, logger=logging, chunk_size=_CHUNK_SIZE):
"""Authenticates the connection to Cloud Storage. Args: json_key_path: Path to the private key (in JSON format) on disk. logger: A logging.logger obj... | stack_v2_sparse_classes_10k_train_006160 | 6,756 | permissive | [
{
"docstring": "Authenticates the connection to Cloud Storage. Args: json_key_path: Path to the private key (in JSON format) on disk. logger: A logging.logger object to record messages. chunk_size: Files uploaded to GCS are sent in chunks. Must be a multiple of _CHUNK_SIZE_MULTIPLE.",
"name": "__init__",
... | 4 | stack_v2_sparse_classes_30k_train_004131 | Implement the Python class `CloudStorage` described below.
Class description:
Wrapper to access Google Cloud Storage.
Method signatures and docstrings:
- def __init__(self, json_key_path, logger=logging, chunk_size=_CHUNK_SIZE): Authenticates the connection to Cloud Storage. Args: json_key_path: Path to the private k... | Implement the Python class `CloudStorage` described below.
Class description:
Wrapper to access Google Cloud Storage.
Method signatures and docstrings:
- def __init__(self, json_key_path, logger=logging, chunk_size=_CHUNK_SIZE): Authenticates the connection to Cloud Storage. Args: json_key_path: Path to the private k... | a1b0fccd68987d8cd9c89710adc3c04b868347ec | <|skeleton|>
class CloudStorage:
"""Wrapper to access Google Cloud Storage."""
def __init__(self, json_key_path, logger=logging, chunk_size=_CHUNK_SIZE):
"""Authenticates the connection to Cloud Storage. Args: json_key_path: Path to the private key (in JSON format) on disk. logger: A logging.logger obj... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CloudStorage:
"""Wrapper to access Google Cloud Storage."""
def __init__(self, json_key_path, logger=logging, chunk_size=_CHUNK_SIZE):
"""Authenticates the connection to Cloud Storage. Args: json_key_path: Path to the private key (in JSON format) on disk. logger: A logging.logger object to record... | the_stack_v2_python_sparse | py/utils/gcs_utils.py | bridder/factory | train | 0 |
fd1d88191e7a8b559ef093b7c12a44b4bd85bf7c | [
"cmd = 'esxcfg-vmknic -l'\nheader_keys = ['Interface', 'Port Group/DVPort', 'IP Family', 'IP Address', 'Netmask', 'Broadcast', 'MAC Address', 'MTU', 'TSO MSS', 'Enabled', 'Type']\nraw_data = client_object.connection.request(cmd).response_data\nhorizontal_data = horizontal_parser.get_parsed_data(raw_data, expect_emp... | <|body_start_0|>
cmd = 'esxcfg-vmknic -l'
header_keys = ['Interface', 'Port Group/DVPort', 'IP Family', 'IP Address', 'Netmask', 'Broadcast', 'MAC Address', 'MTU', 'TSO MSS', 'Enabled', 'Type']
raw_data = client_object.connection.request(cmd).response_data
horizontal_data = horizontal_pa... | ESX55AdapterImpl | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ESX55AdapterImpl:
def get_adapter_info(cls, client_object):
"""Returns parsed data as dictionary for all vmknic that exists on the host."""
<|body_0|>
def get_vtep_detail(cls, client_object, **kwargs):
"""Returns parsed data as dictionary for all vtep(vxlan vmknic) i... | stack_v2_sparse_classes_10k_train_006161 | 3,531 | no_license | [
{
"docstring": "Returns parsed data as dictionary for all vmknic that exists on the host.",
"name": "get_adapter_info",
"signature": "def get_adapter_info(cls, client_object)"
},
{
"docstring": "Returns parsed data as dictionary for all vtep(vxlan vmknic) information that exists on the host.",
... | 2 | null | Implement the Python class `ESX55AdapterImpl` described below.
Class description:
Implement the ESX55AdapterImpl class.
Method signatures and docstrings:
- def get_adapter_info(cls, client_object): Returns parsed data as dictionary for all vmknic that exists on the host.
- def get_vtep_detail(cls, client_object, **kw... | Implement the Python class `ESX55AdapterImpl` described below.
Class description:
Implement the ESX55AdapterImpl class.
Method signatures and docstrings:
- def get_adapter_info(cls, client_object): Returns parsed data as dictionary for all vmknic that exists on the host.
- def get_vtep_detail(cls, client_object, **kw... | 5b55817c050b637e2747084290f6206d2e622938 | <|skeleton|>
class ESX55AdapterImpl:
def get_adapter_info(cls, client_object):
"""Returns parsed data as dictionary for all vmknic that exists on the host."""
<|body_0|>
def get_vtep_detail(cls, client_object, **kwargs):
"""Returns parsed data as dictionary for all vtep(vxlan vmknic) i... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ESX55AdapterImpl:
def get_adapter_info(cls, client_object):
"""Returns parsed data as dictionary for all vmknic that exists on the host."""
cmd = 'esxcfg-vmknic -l'
header_keys = ['Interface', 'Port Group/DVPort', 'IP Family', 'IP Address', 'Netmask', 'Broadcast', 'MAC Address', 'MTU',... | the_stack_v2_python_sparse | SystemTesting/pylib/vmware/vsphere/esx/cli/esx55_adapter_impl.py | Cloudxtreme/MyProject | train | 0 | |
f374f01ba497afea55575ab5c80459afe6f4f773 | [
"self.__criterionClasses = criterionClasses\nself.__logger = logging.getLogger(__name__)\nself.__logger.addHandler(consoleLogger)",
"criterions = []\nfor criterionClass in self.__criterionClasses:\n newCriterion = criterionClass()\n if rawCriterions:\n try:\n newCriterion.currentValue = ra... | <|body_start_0|>
self.__criterionClasses = criterionClasses
self.__logger = logging.getLogger(__name__)
self.__logger.addHandler(consoleLogger)
<|end_body_0|>
<|body_start_1|>
criterions = []
for criterionClass in self.__criterionClasses:
newCriterion = criterionClas... | Factory of Test Vectors Objects | TestVectorFactory | [
"BSD-3-Clause",
"BSL-1.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestVectorFactory:
"""Factory of Test Vectors Objects"""
def __init__(self, criterionClasses, consoleLogger):
"""Init function :param criterionClasses: available criterion types :type criterionClasses: list of classes :param consoleLogger: console log handler :type consoleLogger: Han... | stack_v2_sparse_classes_10k_train_006162 | 3,213 | permissive | [
{
"docstring": "Init function :param criterionClasses: available criterion types :type criterionClasses: list of classes :param consoleLogger: console log handler :type consoleLogger: Handler",
"name": "__init__",
"signature": "def __init__(self, criterionClasses, consoleLogger)"
},
{
"docstring... | 2 | null | Implement the Python class `TestVectorFactory` described below.
Class description:
Factory of Test Vectors Objects
Method signatures and docstrings:
- def __init__(self, criterionClasses, consoleLogger): Init function :param criterionClasses: available criterion types :type criterionClasses: list of classes :param co... | Implement the Python class `TestVectorFactory` described below.
Class description:
Factory of Test Vectors Objects
Method signatures and docstrings:
- def __init__(self, criterionClasses, consoleLogger): Init function :param criterionClasses: available criterion types :type criterionClasses: list of classes :param co... | e2745b756317aac3c7a27a4c10bdfe0921a82a1c | <|skeleton|>
class TestVectorFactory:
"""Factory of Test Vectors Objects"""
def __init__(self, criterionClasses, consoleLogger):
"""Init function :param criterionClasses: available criterion types :type criterionClasses: list of classes :param consoleLogger: console log handler :type consoleLogger: Han... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestVectorFactory:
"""Factory of Test Vectors Objects"""
def __init__(self, criterionClasses, consoleLogger):
"""Init function :param criterionClasses: available criterion types :type criterionClasses: list of classes :param consoleLogger: console log handler :type consoleLogger: Handler"""
... | the_stack_v2_python_sparse | app/src/main/java/com/syd/source/aosp/external/parameter-framework/upstream/tools/clientSimulator/clientsimulator/testGenerator/TestVectorFactory.py | lz-purple/Source | train | 4 |
c814413a89f1a2ba365ccf859a397170ddd11655 | [
"super(EnsembleLayer, self).__init__()\nself.type = typ\nself.input_size = input_size\nself.output_size = output_size\nself.ensemble_size = ensemble_size\nself.act_fn = fn\nif typ == 'prob':\n self.ensemble = nn.ModuleList([nn.Sequential(nn.Linear(input_size, output_size), fn) for _ in range(ensemble_size)])\nel... | <|body_start_0|>
super(EnsembleLayer, self).__init__()
self.type = typ
self.input_size = input_size
self.output_size = output_size
self.ensemble_size = ensemble_size
self.act_fn = fn
if typ == 'prob':
self.ensemble = nn.ModuleList([nn.Sequential(nn.Lin... | Following Lee at al (2015) we implement probability and score averaging model ensembles. | EnsembleLayer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EnsembleLayer:
"""Following Lee at al (2015) we implement probability and score averaging model ensembles."""
def __init__(self, typ, input_size, output_size, ensemble_size=5, fn=nn.ReLU()):
"""Args: typ {str} from {'pron', 'score'} depending on whether the ensemble includes the acti... | stack_v2_sparse_classes_10k_train_006163 | 25,239 | no_license | [
{
"docstring": "Args: typ {str} from {'pron', 'score'} depending on whether the ensemble includes the activation function ('prob'). input_size {int} amount of input neurons output_size {int} amount of output neurons (# tasks/classes) ensemble_size {int} amount of parallel ensemble learners act_fn {int} activati... | 2 | stack_v2_sparse_classes_30k_train_000135 | Implement the Python class `EnsembleLayer` described below.
Class description:
Following Lee at al (2015) we implement probability and score averaging model ensembles.
Method signatures and docstrings:
- def __init__(self, typ, input_size, output_size, ensemble_size=5, fn=nn.ReLU()): Args: typ {str} from {'pron', 'sc... | Implement the Python class `EnsembleLayer` described below.
Class description:
Following Lee at al (2015) we implement probability and score averaging model ensembles.
Method signatures and docstrings:
- def __init__(self, typ, input_size, output_size, ensemble_size=5, fn=nn.ReLU()): Args: typ {str} from {'pron', 'sc... | e88840528fa963066f85940ffeb31687773be2ba | <|skeleton|>
class EnsembleLayer:
"""Following Lee at al (2015) we implement probability and score averaging model ensembles."""
def __init__(self, typ, input_size, output_size, ensemble_size=5, fn=nn.ReLU()):
"""Args: typ {str} from {'pron', 'score'} depending on whether the ensemble includes the acti... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class EnsembleLayer:
"""Following Lee at al (2015) we implement probability and score averaging model ensembles."""
def __init__(self, typ, input_size, output_size, ensemble_size=5, fn=nn.ReLU()):
"""Args: typ {str} from {'pron', 'score'} depending on whether the ensemble includes the activation functi... | the_stack_v2_python_sparse | Utility/layers.py | kaicd/KAICD_pipeline | train | 0 |
681261529b617333acfffba92e5d9b76facb2ff6 | [
"obj_action = self.pool.get('ir.actions.act_window')\nobj_model = self.pool.get('ir.model.data')\nfor thisrule in self.browse(cr, uid, ids):\n obj = self.pool.get(thisrule.object_id.model)\n if not obj:\n raise osv.except_osv(_('WARNING: audittrail is not part of the pool'), _('Change audittrail depend... | <|body_start_0|>
obj_action = self.pool.get('ir.actions.act_window')
obj_model = self.pool.get('ir.model.data')
for thisrule in self.browse(cr, uid, ids):
obj = self.pool.get(thisrule.object_id.model)
if not obj:
raise osv.except_osv(_('WARNING: audittrail... | For Auddittrail Rule | audittrail_rule | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class audittrail_rule:
"""For Auddittrail Rule"""
def subscribe(self, cr, uid, ids, *args):
"""Subscribe Rule for auditing changes on object and apply shortcut for logs on that object. @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security chec... | stack_v2_sparse_classes_10k_train_006164 | 28,495 | no_license | [
{
"docstring": "Subscribe Rule for auditing changes on object and apply shortcut for logs on that object. @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of Auddittrail Rule’s IDs. @return: True",
"name": "subscribe",
"signatu... | 2 | stack_v2_sparse_classes_30k_train_000889 | Implement the Python class `audittrail_rule` described below.
Class description:
For Auddittrail Rule
Method signatures and docstrings:
- def subscribe(self, cr, uid, ids, *args): Subscribe Rule for auditing changes on object and apply shortcut for logs on that object. @param cr: the current row, from the database cu... | Implement the Python class `audittrail_rule` described below.
Class description:
For Auddittrail Rule
Method signatures and docstrings:
- def subscribe(self, cr, uid, ids, *args): Subscribe Rule for auditing changes on object and apply shortcut for logs on that object. @param cr: the current row, from the database cu... | 3de4017d4df223a7596532394eda25e590081e94 | <|skeleton|>
class audittrail_rule:
"""For Auddittrail Rule"""
def subscribe(self, cr, uid, ids, *args):
"""Subscribe Rule for auditing changes on object and apply shortcut for logs on that object. @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security chec... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class audittrail_rule:
"""For Auddittrail Rule"""
def subscribe(self, cr, uid, ids, *args):
"""Subscribe Rule for auditing changes on object and apply shortcut for logs on that object. @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param id... | the_stack_v2_python_sparse | audittrail/audittrail.py | iw3hxn/addons | train | 2 |
138eb3ab5e261f8bc5ec13406a1c5a1a472aa0a6 | [
"self.application_id_local = kwargs.pop('id')\nself.adult = kwargs.pop('adult')\nself._all_emails = kwargs.pop('email_list')\nsuper(OtherPeopleAdultDetailsForm, self).__init__(*args, **kwargs)\nfull_stop_stripper(self)\nif AdultInHome.objects.filter(application_id=self.application_id_local, adult=self.adult).count(... | <|body_start_0|>
self.application_id_local = kwargs.pop('id')
self.adult = kwargs.pop('adult')
self._all_emails = kwargs.pop('email_list')
super(OtherPeopleAdultDetailsForm, self).__init__(*args, **kwargs)
full_stop_stripper(self)
if AdultInHome.objects.filter(application... | GOV.UK form for the People in your home: adult details page | OtherPeopleAdultDetailsForm | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OtherPeopleAdultDetailsForm:
"""GOV.UK form for the People in your home: adult details page"""
def __init__(self, *args, **kwargs):
"""Method to configure the initialisation of the People in your home: adult details form :param args: arguments passed to the form :param kwargs: keywor... | stack_v2_sparse_classes_10k_train_006165 | 20,631 | no_license | [
{
"docstring": "Method to configure the initialisation of the People in your home: adult details form :param args: arguments passed to the form :param kwargs: keyword arguments passed to the form, e.g. application ID",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"... | 6 | stack_v2_sparse_classes_30k_val_000103 | Implement the Python class `OtherPeopleAdultDetailsForm` described below.
Class description:
GOV.UK form for the People in your home: adult details page
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Method to configure the initialisation of the People in your home: adult details form :param... | Implement the Python class `OtherPeopleAdultDetailsForm` described below.
Class description:
GOV.UK form for the People in your home: adult details page
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Method to configure the initialisation of the People in your home: adult details form :param... | fa6ca6a8164763e1dfe1581702ca5d36e44859de | <|skeleton|>
class OtherPeopleAdultDetailsForm:
"""GOV.UK form for the People in your home: adult details page"""
def __init__(self, *args, **kwargs):
"""Method to configure the initialisation of the People in your home: adult details form :param args: arguments passed to the form :param kwargs: keywor... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class OtherPeopleAdultDetailsForm:
"""GOV.UK form for the People in your home: adult details page"""
def __init__(self, *args, **kwargs):
"""Method to configure the initialisation of the People in your home: adult details form :param args: arguments passed to the form :param kwargs: keyword arguments p... | the_stack_v2_python_sparse | application/forms/other_people.py | IS-JAQU-CAZ/OFS-MORE-Childminder-Website | train | 0 |
aa3827ace2e5554bf982e5dad99076878354973c | [
"super(NonLocalBlock, self).__init__()\nself.compression_factor = 1 if args.use_precomputed_hiddens else compression_factor\nself.theta_conv = nn.Conv2d(inplanes, inplanes // 2, kernel_size=1, bias=False)\nself.phi_conv = nn.Conv2d(inplanes, inplanes // 2, kernel_size=1, bias=False)\nself.g_conv = nn.Conv2d(inplane... | <|body_start_0|>
super(NonLocalBlock, self).__init__()
self.compression_factor = 1 if args.use_precomputed_hiddens else compression_factor
self.theta_conv = nn.Conv2d(inplanes, inplanes // 2, kernel_size=1, bias=False)
self.phi_conv = nn.Conv2d(inplanes, inplanes // 2, kernel_size=1, bia... | An embedded gaussian non-local block. | NonLocalBlock | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NonLocalBlock:
"""An embedded gaussian non-local block."""
def __init__(self, args, inplanes, planes, stride=1, downsample=None, compression_factor=2):
"""Initializes the NonLocalBlock. Arguments: inplanes(int): The depth (number of channels) of the input. planes(int): The depth (num... | stack_v2_sparse_classes_10k_train_006166 | 4,206 | permissive | [
{
"docstring": "Initializes the NonLocalBlock. Arguments: inplanes(int): The depth (number of channels) of the input. planes(int): The depth (number of channels) of the output. downsample(nn.Module): When not none, used to downsample output to planes. compression_factor(int): The compression factor to use when ... | 2 | stack_v2_sparse_classes_30k_train_003157 | Implement the Python class `NonLocalBlock` described below.
Class description:
An embedded gaussian non-local block.
Method signatures and docstrings:
- def __init__(self, args, inplanes, planes, stride=1, downsample=None, compression_factor=2): Initializes the NonLocalBlock. Arguments: inplanes(int): The depth (numb... | Implement the Python class `NonLocalBlock` described below.
Class description:
An embedded gaussian non-local block.
Method signatures and docstrings:
- def __init__(self, args, inplanes, planes, stride=1, downsample=None, compression_factor=2): Initializes the NonLocalBlock. Arguments: inplanes(int): The depth (numb... | 12bace8fd6ce9c5bb129fd0d30a46a00a2f7b054 | <|skeleton|>
class NonLocalBlock:
"""An embedded gaussian non-local block."""
def __init__(self, args, inplanes, planes, stride=1, downsample=None, compression_factor=2):
"""Initializes the NonLocalBlock. Arguments: inplanes(int): The depth (number of channels) of the input. planes(int): The depth (num... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class NonLocalBlock:
"""An embedded gaussian non-local block."""
def __init__(self, args, inplanes, planes, stride=1, downsample=None, compression_factor=2):
"""Initializes the NonLocalBlock. Arguments: inplanes(int): The depth (number of channels) of the input. planes(int): The depth (number of channe... | the_stack_v2_python_sparse | onconet/models/blocks/non_local_block.py | yala/Mirai | train | 66 |
2d767cc1b07c540793974ce34d78e32a20c0ed1d | [
"c_error = 'content_image must be a numpy.ndarray with shape (h, w, 3)'\nif not isinstance(style_image, np.ndarray):\n raise TypeError('style_image must be a numpy.ndarray with shape (h, w, 3)')\nif len(style_image.shape) != 3:\n raise TypeError('style_image must be a numpy.ndarray with shape (h, w, 3)')\nif ... | <|body_start_0|>
c_error = 'content_image must be a numpy.ndarray with shape (h, w, 3)'
if not isinstance(style_image, np.ndarray):
raise TypeError('style_image must be a numpy.ndarray with shape (h, w, 3)')
if len(style_image.shape) != 3:
raise TypeError('style_image mus... | performs tasks for neural style transfer Class atributes: - Content layer where will pull our feature maps - Style layer we are interested in | NST | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NST:
"""performs tasks for neural style transfer Class atributes: - Content layer where will pull our feature maps - Style layer we are interested in"""
def __init__(self, style_image, content_image, alpha=10000.0, beta=1):
"""initializing the varibles Arg: - style_image: img used as... | stack_v2_sparse_classes_10k_train_006167 | 3,618 | no_license | [
{
"docstring": "initializing the varibles Arg: - style_image: img used as a style reference, numpy.ndarray - content_image: image used as a content reference, numpy.ndarray - alpha: the weight for content cost - beta: the weight for style cost Enviornment: Eager execution: TensorFlow’s imperative programming en... | 2 | stack_v2_sparse_classes_30k_train_003098 | Implement the Python class `NST` described below.
Class description:
performs tasks for neural style transfer Class atributes: - Content layer where will pull our feature maps - Style layer we are interested in
Method signatures and docstrings:
- def __init__(self, style_image, content_image, alpha=10000.0, beta=1): ... | Implement the Python class `NST` described below.
Class description:
performs tasks for neural style transfer Class atributes: - Content layer where will pull our feature maps - Style layer we are interested in
Method signatures and docstrings:
- def __init__(self, style_image, content_image, alpha=10000.0, beta=1): ... | 1d86c9606371697854878b833b810d73c9af7ee7 | <|skeleton|>
class NST:
"""performs tasks for neural style transfer Class atributes: - Content layer where will pull our feature maps - Style layer we are interested in"""
def __init__(self, style_image, content_image, alpha=10000.0, beta=1):
"""initializing the varibles Arg: - style_image: img used as... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class NST:
"""performs tasks for neural style transfer Class atributes: - Content layer where will pull our feature maps - Style layer we are interested in"""
def __init__(self, style_image, content_image, alpha=10000.0, beta=1):
"""initializing the varibles Arg: - style_image: img used as a style refe... | the_stack_v2_python_sparse | supervised_learning/0x0C-neural_style_transfer/0-neural_style.py | macoyulloa/holbertonschool-machine_learning | train | 0 |
88167f930bf05728aaca3011c4f09ec983957656 | [
"def arrayToBST(ls):\n l = len(ls)\n if len(ls) < 1:\n return None\n mid = (l - 1) // 2\n nd = TreeNode(ls[mid])\n nd.left = arrayToBST(ls[0:mid])\n nd.right = arrayToBST(ls[mid + 1:l])\n return nd\nls = []\nwhile head:\n ls.append(head.val)\n head = head.next\nreturn arrayToBST(ls... | <|body_start_0|>
def arrayToBST(ls):
l = len(ls)
if len(ls) < 1:
return None
mid = (l - 1) // 2
nd = TreeNode(ls[mid])
nd.left = arrayToBST(ls[0:mid])
nd.right = arrayToBST(ls[mid + 1:l])
return nd
ls = [... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def sortedListToBST1(self, head):
""":type head: ListNode :rtype: TreeNode"""
<|body_0|>
def sortedListToBST2(self, head):
""":type head: ListNode :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
def arrayToBST(ls):
... | stack_v2_sparse_classes_10k_train_006168 | 1,941 | no_license | [
{
"docstring": ":type head: ListNode :rtype: TreeNode",
"name": "sortedListToBST1",
"signature": "def sortedListToBST1(self, head)"
},
{
"docstring": ":type head: ListNode :rtype: TreeNode",
"name": "sortedListToBST2",
"signature": "def sortedListToBST2(self, head)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def sortedListToBST1(self, head): :type head: ListNode :rtype: TreeNode
- def sortedListToBST2(self, head): :type head: ListNode :rtype: TreeNode | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def sortedListToBST1(self, head): :type head: ListNode :rtype: TreeNode
- def sortedListToBST2(self, head): :type head: ListNode :rtype: TreeNode
<|skeleton|>
class Solution:
... | d3e8669f932fc2e22711e8b7590d3365d020e189 | <|skeleton|>
class Solution:
def sortedListToBST1(self, head):
""":type head: ListNode :rtype: TreeNode"""
<|body_0|>
def sortedListToBST2(self, head):
""":type head: ListNode :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def sortedListToBST1(self, head):
""":type head: ListNode :rtype: TreeNode"""
def arrayToBST(ls):
l = len(ls)
if len(ls) < 1:
return None
mid = (l - 1) // 2
nd = TreeNode(ls[mid])
nd.left = arrayToBST(ls[0:mi... | the_stack_v2_python_sparse | leetcode/109.py | liuweilin17/algorithm | train | 3 | |
d2cc412e30fb8ab6432776ebfa83e70e630a5bec | [
"super().__init__(cv)\nself.x = x\nself.pps = pps\nself.colors = colors\nself._tospawn = 0\nself._pos = pos\nself._speed = speed\nself._timer = timer\nself._time = 0\nself._done = False\nself._doneDone = False",
"super().update(dt)\nself._tospawn += self.pps * dt\ncolor = self.colors[int(self.age * 20) % len(self... | <|body_start_0|>
super().__init__(cv)
self.x = x
self.pps = pps
self.colors = colors
self._tospawn = 0
self._pos = pos
self._speed = speed
self._timer = timer
self._time = 0
self._done = False
self._doneDone = False
<|end_body_0|>
... | RocketRocket | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RocketRocket:
def __init__(self, cv, x, pps, colors, pos, speed, timer):
"""A rocketrocket shoots a rocket and explodes and then those particles are in and of themselves also rockets! Arguments: cv {idontknow} -- the canvas upon which this wonderful display is painted x {int} -- the posi... | stack_v2_sparse_classes_10k_train_006169 | 16,427 | permissive | [
{
"docstring": "A rocketrocket shoots a rocket and explodes and then those particles are in and of themselves also rockets! Arguments: cv {idontknow} -- the canvas upon which this wonderful display is painted x {int} -- the position of the rocketrocket pps {int} -- pixels per second (the speed of the particles)... | 2 | stack_v2_sparse_classes_30k_train_000563 | Implement the Python class `RocketRocket` described below.
Class description:
Implement the RocketRocket class.
Method signatures and docstrings:
- def __init__(self, cv, x, pps, colors, pos, speed, timer): A rocketrocket shoots a rocket and explodes and then those particles are in and of themselves also rockets! Arg... | Implement the Python class `RocketRocket` described below.
Class description:
Implement the RocketRocket class.
Method signatures and docstrings:
- def __init__(self, cv, x, pps, colors, pos, speed, timer): A rocketrocket shoots a rocket and explodes and then those particles are in and of themselves also rockets! Arg... | c6b6d80e9d59f5d115ca8b8fc020fcd6cb030af8 | <|skeleton|>
class RocketRocket:
def __init__(self, cv, x, pps, colors, pos, speed, timer):
"""A rocketrocket shoots a rocket and explodes and then those particles are in and of themselves also rockets! Arguments: cv {idontknow} -- the canvas upon which this wonderful display is painted x {int} -- the posi... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RocketRocket:
def __init__(self, cv, x, pps, colors, pos, speed, timer):
"""A rocketrocket shoots a rocket and explodes and then those particles are in and of themselves also rockets! Arguments: cv {idontknow} -- the canvas upon which this wonderful display is painted x {int} -- the position of the ro... | the_stack_v2_python_sparse | scripts/sheet9/9.2.py | LennartElbe/PythOnline | train | 0 | |
c90ea1164942f9c6fe7eed05b61d552493ffa0c2 | [
"self.functions = {}\nif install_defaults:\n for function in _default_functions:\n self.register_function(function)",
"if len(args) == 1:\n function = args[0]\n try:\n name = function.fact_name\n except AttributeError:\n name = function.__name__\n if name is None:\n rais... | <|body_start_0|>
self.functions = {}
if install_defaults:
for function in _default_functions:
self.register_function(function)
<|end_body_0|>
<|body_start_1|>
if len(args) == 1:
function = args[0]
try:
name = function.fact_name... | A Fact interpreter. This is the main class that you'll use to interpret and run Fact scripts. At its simplest, this class can be used thus: >>> from libfact import Interpreter, Context >>> Interpreter().parse("One plus two is {+|1|2}.").resolve(Context()) which would print "One plus two is 3.". Each individual interpre... | Interpreter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Interpreter:
"""A Fact interpreter. This is the main class that you'll use to interpret and run Fact scripts. At its simplest, this class can be used thus: >>> from libfact import Interpreter, Context >>> Interpreter().parse("One plus two is {+|1|2}.").resolve(Context()) which would print "One pl... | stack_v2_sparse_classes_10k_train_006170 | 26,635 | no_license | [
{
"docstring": "Creates a new interpreter. If install_defaults is true, all of the functions returned by make_default_functions will be automatically registered to this interpreter.",
"name": "__init__",
"signature": "def __init__(self, install_defaults=True)"
},
{
"docstring": "register_functio... | 6 | stack_v2_sparse_classes_30k_train_004838 | Implement the Python class `Interpreter` described below.
Class description:
A Fact interpreter. This is the main class that you'll use to interpret and run Fact scripts. At its simplest, this class can be used thus: >>> from libfact import Interpreter, Context >>> Interpreter().parse("One plus two is {+|1|2}.").resol... | Implement the Python class `Interpreter` described below.
Class description:
A Fact interpreter. This is the main class that you'll use to interpret and run Fact scripts. At its simplest, this class can be used thus: >>> from libfact import Interpreter, Context >>> Interpreter().parse("One plus two is {+|1|2}.").resol... | d9d95e24673794a20bb8138ce44d5bac236e07ed | <|skeleton|>
class Interpreter:
"""A Fact interpreter. This is the main class that you'll use to interpret and run Fact scripts. At its simplest, this class can be used thus: >>> from libfact import Interpreter, Context >>> Interpreter().parse("One plus two is {+|1|2}.").resolve(Context()) which would print "One pl... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Interpreter:
"""A Fact interpreter. This is the main class that you'll use to interpret and run Fact scripts. At its simplest, this class can be used thus: >>> from libfact import Interpreter, Context >>> Interpreter().parse("One plus two is {+|1|2}.").resolve(Context()) which would print "One plus two is 3."... | the_stack_v2_python_sparse | afn/python/src/libfact.py | javawizard/afn | train | 0 |
de20d56dd39418f7b07b9e7d620b134a74a26383 | [
"plan = self.raw.get('plan')\n\ndef find_tid(p):\n if 'task' in p:\n task = p.get('task')\n if task.get('name') == task_name:\n return p.get('id')\n for k, v in p.items():\n if isinstance(v, dict):\n task_id = find_tid(v)\n if task_id:\n ret... | <|body_start_0|>
plan = self.raw.get('plan')
def find_tid(p):
if 'task' in p:
task = p.get('task')
if task.get('name') == task_name:
return p.get('id')
for k, v in p.items():
if isinstance(v, dict):
... | BuildPlan | [
"BSD-3-Clause",
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BuildPlan:
def task_id(self, task_name: str):
"""determines the task-id for the given task_name If the task_name is not unique, the task-id for the first-found task with the given name is returned. If no task with the given name is found, `None` is returned."""
<|body_0|>
de... | stack_v2_sparse_classes_10k_train_006171 | 15,599 | permissive | [
{
"docstring": "determines the task-id for the given task_name If the task_name is not unique, the task-id for the first-found task with the given name is returned. If no task with the given name is found, `None` is returned.",
"name": "task_id",
"signature": "def task_id(self, task_name: str)"
},
{... | 2 | stack_v2_sparse_classes_30k_train_004886 | Implement the Python class `BuildPlan` described below.
Class description:
Implement the BuildPlan class.
Method signatures and docstrings:
- def task_id(self, task_name: str): determines the task-id for the given task_name If the task_name is not unique, the task-id for the first-found task with the given name is re... | Implement the Python class `BuildPlan` described below.
Class description:
Implement the BuildPlan class.
Method signatures and docstrings:
- def task_id(self, task_name: str): determines the task-id for the given task_name If the task_name is not unique, the task-id for the first-found task with the given name is re... | b043a1285b67c585fc357c80678765fae47ea506 | <|skeleton|>
class BuildPlan:
def task_id(self, task_name: str):
"""determines the task-id for the given task_name If the task_name is not unique, the task-id for the first-found task with the given name is returned. If no task with the given name is found, `None` is returned."""
<|body_0|>
de... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BuildPlan:
def task_id(self, task_name: str):
"""determines the task-id for the given task_name If the task_name is not unique, the task-id for the first-found task with the given name is returned. If no task with the given name is found, `None` is returned."""
plan = self.raw.get('plan')
... | the_stack_v2_python_sparse | concourse/client/model.py | gardener/cc-utils | train | 21 | |
00b0482e9a5e0c4f432ce3f4e8665411a39057cc | [
"try:\n app_id_list = get_cc_app_id_by_user()\n data_result = machine_statistics(table_set=EsNodeInfo, field='ip', app_id_list=app_id_list)\n return JsonResponse({'result': True, 'code': 0, 'data': data_result, 'message': 'query success'})\nexcept Exception as err:\n logger.error(f'es机器查询汇总失败:{err}')\n ... | <|body_start_0|>
try:
app_id_list = get_cc_app_id_by_user()
data_result = machine_statistics(table_set=EsNodeInfo, field='ip', app_id_list=app_id_list)
return JsonResponse({'result': True, 'code': 0, 'data': data_result, 'message': 'query success'})
except Exception a... | es用户信息表视图 | EsNodeViewSet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EsNodeViewSet:
"""es用户信息表视图"""
def get_machine_statistics(self, request, *args, **kwargs):
"""POST /es/nodes/get_machine_statistics 统计es投入已使用的机器数量"""
<|body_0|>
def get_machine_statistics_top_five(self, request, *args, **kwargs):
"""POST /es/nodes/get_machine_sta... | stack_v2_sparse_classes_10k_train_006172 | 10,026 | no_license | [
{
"docstring": "POST /es/nodes/get_machine_statistics 统计es投入已使用的机器数量",
"name": "get_machine_statistics",
"signature": "def get_machine_statistics(self, request, *args, **kwargs)"
},
{
"docstring": "POST /es/nodes/get_machine_statistics_top_five 根据用户已有业务权限,查询每个业务的机器投入数量,输出TOP5",
"name": "get_... | 2 | stack_v2_sparse_classes_30k_train_003714 | Implement the Python class `EsNodeViewSet` described below.
Class description:
es用户信息表视图
Method signatures and docstrings:
- def get_machine_statistics(self, request, *args, **kwargs): POST /es/nodes/get_machine_statistics 统计es投入已使用的机器数量
- def get_machine_statistics_top_five(self, request, *args, **kwargs): POST /es/... | Implement the Python class `EsNodeViewSet` described below.
Class description:
es用户信息表视图
Method signatures and docstrings:
- def get_machine_statistics(self, request, *args, **kwargs): POST /es/nodes/get_machine_statistics 统计es投入已使用的机器数量
- def get_machine_statistics_top_five(self, request, *args, **kwargs): POST /es/... | 97cfac2ba94d67980d837f0b541caae70b68a595 | <|skeleton|>
class EsNodeViewSet:
"""es用户信息表视图"""
def get_machine_statistics(self, request, *args, **kwargs):
"""POST /es/nodes/get_machine_statistics 统计es投入已使用的机器数量"""
<|body_0|>
def get_machine_statistics_top_five(self, request, *args, **kwargs):
"""POST /es/nodes/get_machine_sta... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class EsNodeViewSet:
"""es用户信息表视图"""
def get_machine_statistics(self, request, *args, **kwargs):
"""POST /es/nodes/get_machine_statistics 统计es投入已使用的机器数量"""
try:
app_id_list = get_cc_app_id_by_user()
data_result = machine_statistics(table_set=EsNodeInfo, field='ip', app_i... | the_stack_v2_python_sparse | apps/es/views.py | sdgdsffdsfff/bk-dop | train | 0 |
d6325cd677c5b59d8134c8604008ddef2de4177f | [
"try:\n subscribers = current_app.mailchimp_client.lists.members.all(list_id=list_id)\nexcept MailChimpError as api_error:\n response = {'errors': {}}\n error_details = api_error.args[0]\n response['errors']['title'] = error_details['title']\n response['errors']['detail'] = error_details['detail']\n ... | <|body_start_0|>
try:
subscribers = current_app.mailchimp_client.lists.members.all(list_id=list_id)
except MailChimpError as api_error:
response = {'errors': {}}
error_details = api_error.args[0]
response['errors']['title'] = error_details['title']
... | View to retrieve all of the subscribers in a list and add a subscriber to a list. | SubscribersAPI | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SubscribersAPI:
"""View to retrieve all of the subscribers in a list and add a subscriber to a list."""
def get(self, list_id):
"""Return all subscribers that are in the given list."""
<|body_0|>
def post(self, list_id):
"""Add a new subscriber to the given list.... | stack_v2_sparse_classes_10k_train_006173 | 3,667 | no_license | [
{
"docstring": "Return all subscribers that are in the given list.",
"name": "get",
"signature": "def get(self, list_id)"
},
{
"docstring": "Add a new subscriber to the given list.",
"name": "post",
"signature": "def post(self, list_id)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007063 | Implement the Python class `SubscribersAPI` described below.
Class description:
View to retrieve all of the subscribers in a list and add a subscriber to a list.
Method signatures and docstrings:
- def get(self, list_id): Return all subscribers that are in the given list.
- def post(self, list_id): Add a new subscrib... | Implement the Python class `SubscribersAPI` described below.
Class description:
View to retrieve all of the subscribers in a list and add a subscriber to a list.
Method signatures and docstrings:
- def get(self, list_id): Return all subscribers that are in the given list.
- def post(self, list_id): Add a new subscrib... | d5ae552d383f5f971e29a38055c518fc68172f32 | <|skeleton|>
class SubscribersAPI:
"""View to retrieve all of the subscribers in a list and add a subscriber to a list."""
def get(self, list_id):
"""Return all subscribers that are in the given list."""
<|body_0|>
def post(self, list_id):
"""Add a new subscriber to the given list.... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SubscribersAPI:
"""View to retrieve all of the subscribers in a list and add a subscriber to a list."""
def get(self, list_id):
"""Return all subscribers that are in the given list."""
try:
subscribers = current_app.mailchimp_client.lists.members.all(list_id=list_id)
e... | the_stack_v2_python_sparse | server/app/mailchimp/resources/subscribers.py | EricMontague/MailChimp-Newsletter-Project | train | 0 |
e930e6ce5281096bb5732f966375276cc81468ad | [
"result = []\nself.accumulatePathSum(root, sum, [], result)\nreturn result",
"if not root:\n return\nsum = sum - root.val\ncur_path.append(root.val)\nif sum == 0 and root.left is None and (root.right is None):\n result.append(list(cur_path))\n return\nif root.left:\n self.accumulatePathSum(root.left, ... | <|body_start_0|>
result = []
self.accumulatePathSum(root, sum, [], result)
return result
<|end_body_0|>
<|body_start_1|>
if not root:
return
sum = sum - root.val
cur_path.append(root.val)
if sum == 0 and root.left is None and (root.right is None):
... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def pathSum(self, root, sum):
""":param root: TreeNode :param sum: integer :return: a list of lists of integers"""
<|body_0|>
def accumulatePathSum(self, root, sum, cur_path, result):
"""DFS Similar to previous path sum"""
<|body_1|>
<|end_skeleton... | stack_v2_sparse_classes_10k_train_006174 | 1,497 | permissive | [
{
"docstring": ":param root: TreeNode :param sum: integer :return: a list of lists of integers",
"name": "pathSum",
"signature": "def pathSum(self, root, sum)"
},
{
"docstring": "DFS Similar to previous path sum",
"name": "accumulatePathSum",
"signature": "def accumulatePathSum(self, roo... | 2 | stack_v2_sparse_classes_30k_train_005616 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def pathSum(self, root, sum): :param root: TreeNode :param sum: integer :return: a list of lists of integers
- def accumulatePathSum(self, root, sum, cur_path, result): DFS Simil... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def pathSum(self, root, sum): :param root: TreeNode :param sum: integer :return: a list of lists of integers
- def accumulatePathSum(self, root, sum, cur_path, result): DFS Simil... | cbbd4a67ab342ada2421e13f82d660b1d47d4d20 | <|skeleton|>
class Solution:
def pathSum(self, root, sum):
""":param root: TreeNode :param sum: integer :return: a list of lists of integers"""
<|body_0|>
def accumulatePathSum(self, root, sum, cur_path, result):
"""DFS Similar to previous path sum"""
<|body_1|>
<|end_skeleton... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def pathSum(self, root, sum):
""":param root: TreeNode :param sum: integer :return: a list of lists of integers"""
result = []
self.accumulatePathSum(root, sum, [], result)
return result
def accumulatePathSum(self, root, sum, cur_path, result):
"""DFS Sim... | the_stack_v2_python_sparse | 113 Path Sum II.py | Aminaba123/LeetCode | train | 1 | |
1c2ceb54816dc8b38c3d2bf30b5f3a6eeef95a93 | [
"if len(A) <= 0:\n return 0\nans_max_L = 0\nres_L = {}\nans_max_M = 0\nfor i in range(len(A) - L + 1):\n val = sum(A[i:i + L])\n if val > ans_max_L:\n ans_max_L = val\n res_L[val] = i\nindex_L = res_L.get(ans_max_L)\nA = A[0:index_L] + A[index_L + L:]\nfor j in range(len(A) - M + 1):\n val... | <|body_start_0|>
if len(A) <= 0:
return 0
ans_max_L = 0
res_L = {}
ans_max_M = 0
for i in range(len(A) - L + 1):
val = sum(A[i:i + L])
if val > ans_max_L:
ans_max_L = val
res_L[val] = i
index_L = res_L.ge... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxSumTwoNoOverlap(self, A, L, M):
"""wrong--局部最优,要找的是两个子序列的和最优 :type A: List[int] :type L: int :type M: int :rtype: int"""
<|body_0|>
def maxSumTwoNoOverlap1(self, A, L, M):
"""use DP step1:find cursum of A step2:two case about location of maxL & maxM-... | stack_v2_sparse_classes_10k_train_006175 | 1,893 | no_license | [
{
"docstring": "wrong--局部最优,要找的是两个子序列的和最优 :type A: List[int] :type L: int :type M: int :rtype: int",
"name": "maxSumTwoNoOverlap",
"signature": "def maxSumTwoNoOverlap(self, A, L, M)"
},
{
"docstring": "use DP step1:find cursum of A step2:two case about location of maxL & maxM--- one possible ca... | 2 | stack_v2_sparse_classes_30k_train_005932 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxSumTwoNoOverlap(self, A, L, M): wrong--局部最优,要找的是两个子序列的和最优 :type A: List[int] :type L: int :type M: int :rtype: int
- def maxSumTwoNoOverlap1(self, A, L, M): use DP step1:f... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxSumTwoNoOverlap(self, A, L, M): wrong--局部最优,要找的是两个子序列的和最优 :type A: List[int] :type L: int :type M: int :rtype: int
- def maxSumTwoNoOverlap1(self, A, L, M): use DP step1:f... | 18c06a96bb14688e4a1d5fb6baf235a6b53bd3ae | <|skeleton|>
class Solution:
def maxSumTwoNoOverlap(self, A, L, M):
"""wrong--局部最优,要找的是两个子序列的和最优 :type A: List[int] :type L: int :type M: int :rtype: int"""
<|body_0|>
def maxSumTwoNoOverlap1(self, A, L, M):
"""use DP step1:find cursum of A step2:two case about location of maxL & maxM-... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def maxSumTwoNoOverlap(self, A, L, M):
"""wrong--局部最优,要找的是两个子序列的和最优 :type A: List[int] :type L: int :type M: int :rtype: int"""
if len(A) <= 0:
return 0
ans_max_L = 0
res_L = {}
ans_max_M = 0
for i in range(len(A) - L + 1):
val ... | the_stack_v2_python_sparse | medium/others/maximum-sum-of-two-non-overlapping-subarrays.py | congyingTech/Basic-Algorithm | train | 10 | |
36094d92bf3dd0f31ab2867910a86c1b19cb6207 | [
"self.arc_map = arc_map\nsorted_sats = sorted(arc_map)\nself.flat_iters = [peekable(arc_map[x].flat) for x in sorted_sats]",
"front_entries = [x.peek(None) for x in self.flat_iters]\nif all([x is None for x in front_entries]):\n raise StopIteration\nI, _ = min(filter(lambda x: x[1] is not None, enumerate(front... | <|body_start_0|>
self.arc_map = arc_map
sorted_sats = sorted(arc_map)
self.flat_iters = [peekable(arc_map[x].flat) for x in sorted_sats]
<|end_body_0|>
<|body_start_1|>
front_entries = [x.peek(None) for x in self.flat_iters]
if all([x is None for x in front_entries]):
... | ArcMapFlatIterator | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ArcMapFlatIterator:
def __init__(self, arc_map):
"""???"""
<|body_0|>
def next(self):
"""???"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.arc_map = arc_map
sorted_sats = sorted(arc_map)
self.flat_iters = [peekable(arc_map[x].... | stack_v2_sparse_classes_10k_train_006176 | 16,515 | permissive | [
{
"docstring": "???",
"name": "__init__",
"signature": "def __init__(self, arc_map)"
},
{
"docstring": "???",
"name": "next",
"signature": "def next(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001373 | Implement the Python class `ArcMapFlatIterator` described below.
Class description:
Implement the ArcMapFlatIterator class.
Method signatures and docstrings:
- def __init__(self, arc_map): ???
- def next(self): ??? | Implement the Python class `ArcMapFlatIterator` described below.
Class description:
Implement the ArcMapFlatIterator class.
Method signatures and docstrings:
- def __init__(self, arc_map): ???
- def next(self): ???
<|skeleton|>
class ArcMapFlatIterator:
def __init__(self, arc_map):
"""???"""
<|b... | e364be68cb0cadbeea10ca569963b8f99aa7b05b | <|skeleton|>
class ArcMapFlatIterator:
def __init__(self, arc_map):
"""???"""
<|body_0|>
def next(self):
"""???"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ArcMapFlatIterator:
def __init__(self, arc_map):
"""???"""
self.arc_map = arc_map
sorted_sats = sorted(arc_map)
self.flat_iters = [peekable(arc_map[x].flat) for x in sorted_sats]
def next(self):
"""???"""
front_entries = [x.peek(None) for x in self.flat_ite... | the_stack_v2_python_sparse | pyrsss/gnss/level.py | butala/pyrsss | train | 7 | |
3d635d0a2deec98a68ddd3c67100abf97fa1c742 | [
"self.k = k\nself.nums = nums\nheapq.heapify(self.nums)\nwhile len(self.nums) > k:\n heapq.heappop(self.nums)",
"if len(self.nums) < self.k:\n heapq.heappush(self.nums, val)\nelif val > self.nums[0]:\n heapq.heapreplace(self.nums, val)\nreturn self.nums[0]"
] | <|body_start_0|>
self.k = k
self.nums = nums
heapq.heapify(self.nums)
while len(self.nums) > k:
heapq.heappop(self.nums)
<|end_body_0|>
<|body_start_1|>
if len(self.nums) < self.k:
heapq.heappush(self.nums, val)
elif val > self.nums[0]:
... | KthLargest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
<|body_0|>
def add(self, val):
""":type val: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.k = k
self.nums = nums
heapq.heapify(... | stack_v2_sparse_classes_10k_train_006177 | 2,869 | no_license | [
{
"docstring": ":type k: int :type nums: List[int]",
"name": "__init__",
"signature": "def __init__(self, k, nums)"
},
{
"docstring": ":type val: int :rtype: int",
"name": "add",
"signature": "def add(self, val)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002166 | 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... | c615b40d65ada4914650e6192a1f7c1948abadce | <|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_10k | data/stack_v2_sparse_classes_30k | class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
self.k = k
self.nums = nums
heapq.heapify(self.nums)
while len(self.nums) > k:
heapq.heappop(self.nums)
def add(self, val):
""":type val: int :rtype: int"""
... | the_stack_v2_python_sparse | 703_Kth_Largest_Element_in_a_Stream.py | mxu007/leetcode | train | 0 | |
658d12d5a5b524270b729f53e8e6cf8fc4c6cdb3 | [
"connection = get_connection()\nconnection_mock.assert_called_once_with(host=EXAMS_SFTP_HOST, port=int(EXAMS_SFTP_PORT), username=EXAMS_SFTP_USERNAME, password=EXAMS_SFTP_PASSWORD, cnopts=ANY)\nassert connection == connection_mock.return_value",
"kwargs = {settings_key: None}\nwith self.settings(**kwargs):\n w... | <|body_start_0|>
connection = get_connection()
connection_mock.assert_called_once_with(host=EXAMS_SFTP_HOST, port=int(EXAMS_SFTP_PORT), username=EXAMS_SFTP_USERNAME, password=EXAMS_SFTP_PASSWORD, cnopts=ANY)
assert connection == connection_mock.return_value
<|end_body_0|>
<|body_start_1|>
... | Tests for Pearson upload_tsv | PeasonSFTPTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PeasonSFTPTest:
"""Tests for Pearson upload_tsv"""
def test_get_connection_settings(self, connection_mock):
"""Tests that get_connection calls psftp.Connection with the correct values"""
<|body_0|>
def test_get_connection_missing_settings(self, settings_key, connection_m... | stack_v2_sparse_classes_10k_train_006178 | 2,241 | no_license | [
{
"docstring": "Tests that get_connection calls psftp.Connection with the correct values",
"name": "test_get_connection_settings",
"signature": "def test_get_connection_settings(self, connection_mock)"
},
{
"docstring": "Tests that get_connection ImproperlyConfigured if settings.{0} is not set",... | 2 | stack_v2_sparse_classes_30k_train_004184 | Implement the Python class `PeasonSFTPTest` described below.
Class description:
Tests for Pearson upload_tsv
Method signatures and docstrings:
- def test_get_connection_settings(self, connection_mock): Tests that get_connection calls psftp.Connection with the correct values
- def test_get_connection_missing_settings(... | Implement the Python class `PeasonSFTPTest` described below.
Class description:
Tests for Pearson upload_tsv
Method signatures and docstrings:
- def test_get_connection_settings(self, connection_mock): Tests that get_connection calls psftp.Connection with the correct values
- def test_get_connection_missing_settings(... | 1df800eda5f827c012881e569629a29b660c7c25 | <|skeleton|>
class PeasonSFTPTest:
"""Tests for Pearson upload_tsv"""
def test_get_connection_settings(self, connection_mock):
"""Tests that get_connection calls psftp.Connection with the correct values"""
<|body_0|>
def test_get_connection_missing_settings(self, settings_key, connection_m... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PeasonSFTPTest:
"""Tests for Pearson upload_tsv"""
def test_get_connection_settings(self, connection_mock):
"""Tests that get_connection calls psftp.Connection with the correct values"""
connection = get_connection()
connection_mock.assert_called_once_with(host=EXAMS_SFTP_HOST, po... | the_stack_v2_python_sparse | exams/pearson/sftp_test.py | johnfelipe/micromasters | train | 0 |
ff62a00479ce55ad8b065a4c0d727dc50b63ba66 | [
"if len(args) == 1 and isinstance(args[0], (list, tuple)):\n return self.find(*args[0])\nelif not all((isinstance(predicate, six.string_types) for predicate in args)):\n raise TypeError('predicates must all be strings')\nnew_list = copy.deepcopy(self)\nfor predicate in args:\n try:\n key, operator, ... | <|body_start_0|>
if len(args) == 1 and isinstance(args[0], (list, tuple)):
return self.find(*args[0])
elif not all((isinstance(predicate, six.string_types) for predicate in args)):
raise TypeError('predicates must all be strings')
new_list = copy.deepcopy(self)
fo... | _LazyList | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _LazyList:
def find(self, *args):
"""Gets the results from this collection that match input predicates. A predicate is a string containing a simple boolean expression consisting of: - a dot-delimited property such as ``metrics.accuracy`` - a Python boolean operator such as ``>=`` - a lit... | stack_v2_sparse_classes_10k_train_006179 | 5,162 | permissive | [
{
"docstring": "Gets the results from this collection that match input predicates. A predicate is a string containing a simple boolean expression consisting of: - a dot-delimited property such as ``metrics.accuracy`` - a Python boolean operator such as ``>=`` - a literal value such as ``.8`` Parameters --------... | 2 | null | Implement the Python class `_LazyList` described below.
Class description:
Implement the _LazyList class.
Method signatures and docstrings:
- def find(self, *args): Gets the results from this collection that match input predicates. A predicate is a string containing a simple boolean expression consisting of: - a dot-... | Implement the Python class `_LazyList` described below.
Class description:
Implement the _LazyList class.
Method signatures and docstrings:
- def find(self, *args): Gets the results from this collection that match input predicates. A predicate is a string containing a simple boolean expression consisting of: - a dot-... | ec9ac7712500adb13fd815dfd476ce9f536c6921 | <|skeleton|>
class _LazyList:
def find(self, *args):
"""Gets the results from this collection that match input predicates. A predicate is a string containing a simple boolean expression consisting of: - a dot-delimited property such as ``metrics.accuracy`` - a Python boolean operator such as ``>=`` - a lit... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class _LazyList:
def find(self, *args):
"""Gets the results from this collection that match input predicates. A predicate is a string containing a simple boolean expression consisting of: - a dot-delimited property such as ``metrics.accuracy`` - a Python boolean operator such as ``>=`` - a literal value suc... | the_stack_v2_python_sparse | client/verta/verta/_bases/_lazy_list.py | VertaAI/modeldb | train | 844 | |
af26c8fba8e103e34cf6f7981939a7d100dc9107 | [
"pos_hash = {0: 0}\nout = None\ntemp_sum = 0\nfor i in range(len(nums)):\n temp_sum += nums[i]\n remain_sum = temp_sum - k\n if remain_sum in pos_hash:\n length = i + 1 - pos_hash[remain_sum]\n if out is None or length > out:\n out = length\n if temp_sum not in pos_hash:\n ... | <|body_start_0|>
pos_hash = {0: 0}
out = None
temp_sum = 0
for i in range(len(nums)):
temp_sum += nums[i]
remain_sum = temp_sum - k
if remain_sum in pos_hash:
length = i + 1 - pos_hash[remain_sum]
if out is None or lengt... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxSubArrayLen(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_0|>
def maxSubArrayLen2(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
pos_ha... | stack_v2_sparse_classes_10k_train_006180 | 1,838 | no_license | [
{
"docstring": ":type nums: List[int] :type k: int :rtype: int",
"name": "maxSubArrayLen",
"signature": "def maxSubArrayLen(self, nums, k)"
},
{
"docstring": ":type nums: List[int] :type k: int :rtype: int",
"name": "maxSubArrayLen2",
"signature": "def maxSubArrayLen2(self, nums, k)"
}... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxSubArrayLen(self, nums, k): :type nums: List[int] :type k: int :rtype: int
- def maxSubArrayLen2(self, nums, k): :type nums: List[int] :type k: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxSubArrayLen(self, nums, k): :type nums: List[int] :type k: int :rtype: int
- def maxSubArrayLen2(self, nums, k): :type nums: List[int] :type k: int :rtype: int
<|skeleton... | 604efd2c53c369fb262f42f7f7f31997ea4d029b | <|skeleton|>
class Solution:
def maxSubArrayLen(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_0|>
def maxSubArrayLen2(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def maxSubArrayLen(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
pos_hash = {0: 0}
out = None
temp_sum = 0
for i in range(len(nums)):
temp_sum += nums[i]
remain_sum = temp_sum - k
if remain_sum in pos_... | the_stack_v2_python_sparse | 325_Maximum_Size_Subarray_Sum_Equals_k.py | fxy1018/Leetcode | train | 1 | |
999b54a39b4e7fa0d7599d40bf997d8e59dde5ef | [
"for v in nums:\n index = abs(v) - 1\n if nums[index] > 0:\n nums[index] *= -1\n else:\n return nums[index]\nreturn None",
"tortoise = hare = nums[0]\nwhile True:\n '\\n here we are detecting cycle\\n '\n tortoise = nums[tortoise]\n hare = nums[nums[hare]]\n ... | <|body_start_0|>
for v in nums:
index = abs(v) - 1
if nums[index] > 0:
nums[index] *= -1
else:
return nums[index]
return None
<|end_body_0|>
<|body_start_1|>
tortoise = hare = nums[0]
while True:
'\n ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findDuplicate_approach1(self, nums: List[int]) -> int:
"""Cycle detection since the values of the array will essntially be within the index range (0..n) we can mark the visited element and once we visit it again we found the duplicate"""
<|body_0|>
def findDupl... | stack_v2_sparse_classes_10k_train_006181 | 2,114 | no_license | [
{
"docstring": "Cycle detection since the values of the array will essntially be within the index range (0..n) we can mark the visited element and once we visit it again we found the duplicate",
"name": "findDuplicate_approach1",
"signature": "def findDuplicate_approach1(self, nums: List[int]) -> int"
... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findDuplicate_approach1(self, nums: List[int]) -> int: Cycle detection since the values of the array will essntially be within the index range (0..n) we can mark the visited ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findDuplicate_approach1(self, nums: List[int]) -> int: Cycle detection since the values of the array will essntially be within the index range (0..n) we can mark the visited ... | 59f70dc4466e15df591ba285317e4a1fe808ed60 | <|skeleton|>
class Solution:
def findDuplicate_approach1(self, nums: List[int]) -> int:
"""Cycle detection since the values of the array will essntially be within the index range (0..n) we can mark the visited element and once we visit it again we found the duplicate"""
<|body_0|>
def findDupl... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def findDuplicate_approach1(self, nums: List[int]) -> int:
"""Cycle detection since the values of the array will essntially be within the index range (0..n) we can mark the visited element and once we visit it again we found the duplicate"""
for v in nums:
index = abs(v) ... | the_stack_v2_python_sparse | leet/facebook/strings_arrays/find_duplicate_number.py | arsamigullin/problem_solving_python | train | 0 | |
d4d6e81a1e4182c269cdaac531e29d97b4ce5c53 | [
"mask_changed = False\ninput_mask = input_mask_list[0]\nnum_out_masks = len(output_mask_list)\nfor i in range(num_out_masks):\n output_mask_list[i] = input_mask\nmask_changed = True\nreturn mask_changed",
"mask_changed = False\nsaved_input_mask = input_mask_list[0]\nnum_in_masks = len(input_mask_list)\nnum_out... | <|body_start_0|>
mask_changed = False
input_mask = input_mask_list[0]
num_out_masks = len(output_mask_list)
for i in range(num_out_masks):
output_mask_list[i] = input_mask
mask_changed = True
return mask_changed
<|end_body_0|>
<|body_start_1|>
mask_ch... | Models SPLIT internal connectivity for an Op. | SplitInternalConnectivity | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SplitInternalConnectivity:
"""Models SPLIT internal connectivity for an Op."""
def forward_propagate_the_masks(self, input_mask_list: List[List[int]], output_mask_list: List[List[int]]) -> bool:
"""Based on the internal connectivity and input mask(s), updates the output mask(s). :par... | stack_v2_sparse_classes_10k_train_006182 | 39,659 | permissive | [
{
"docstring": "Based on the internal connectivity and input mask(s), updates the output mask(s). :param input_mask_list: The input mask(s) to be propagated :param output_mask_list: The output mask(s) to be updated based on the Op's Internal Connectivity",
"name": "forward_propagate_the_masks",
"signatu... | 2 | stack_v2_sparse_classes_30k_val_000279 | Implement the Python class `SplitInternalConnectivity` described below.
Class description:
Models SPLIT internal connectivity for an Op.
Method signatures and docstrings:
- def forward_propagate_the_masks(self, input_mask_list: List[List[int]], output_mask_list: List[List[int]]) -> bool: Based on the internal connect... | Implement the Python class `SplitInternalConnectivity` described below.
Class description:
Models SPLIT internal connectivity for an Op.
Method signatures and docstrings:
- def forward_propagate_the_masks(self, input_mask_list: List[List[int]], output_mask_list: List[List[int]]) -> bool: Based on the internal connect... | 5a406e657082b6a4f6e4bf48f0e46e085cb1e351 | <|skeleton|>
class SplitInternalConnectivity:
"""Models SPLIT internal connectivity for an Op."""
def forward_propagate_the_masks(self, input_mask_list: List[List[int]], output_mask_list: List[List[int]]) -> bool:
"""Based on the internal connectivity and input mask(s), updates the output mask(s). :par... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SplitInternalConnectivity:
"""Models SPLIT internal connectivity for an Op."""
def forward_propagate_the_masks(self, input_mask_list: List[List[int]], output_mask_list: List[List[int]]) -> bool:
"""Based on the internal connectivity and input mask(s), updates the output mask(s). :param input_mask... | the_stack_v2_python_sparse | TrainingExtensions/common/src/python/aimet_common/winnow/mask.py | quic/aimet | train | 1,676 |
6529ae34c6e4f4b4a668b827257e32a3d0b0f5d9 | [
"from reduction.histCompat.Fit1DFunction import Fit1DFunction\nfit = Fit1DFunction(functor, minimizer=self.minimizer, plotter=self.plotter)\nreturn fit(histogram, boxConstraints)",
"self.minimizer = minimizer\nself.plotter = plotter\nreturn"
] | <|body_start_0|>
from reduction.histCompat.Fit1DFunction import Fit1DFunction
fit = Fit1DFunction(functor, minimizer=self.minimizer, plotter=self.plotter)
return fit(histogram, boxConstraints)
<|end_body_0|>
<|body_start_1|>
self.minimizer = minimizer
self.plotter = plotter
... | 1D function fitter use DE algorithm | DifferentialEvolution1DFunctionFitter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DifferentialEvolution1DFunctionFitter:
"""1D function fitter use DE algorithm"""
def __call__(self, histogram, functor, boxConstraints):
"""__call__( histogram, functor, boxConstraints ): fit histogram to functor histogram: y(x) data curve functor: the function to fit, for example de... | stack_v2_sparse_classes_10k_train_006183 | 1,798 | no_license | [
{
"docstring": "__call__( histogram, functor, boxConstraints ): fit histogram to functor histogram: y(x) data curve functor: the function to fit, for example def f(x, a, b, c): return a * exp( - ((x-b)/c)**2 ) boxConstraints: constraints of parameters defined as a box",
"name": "__call__",
"signature": ... | 2 | null | Implement the Python class `DifferentialEvolution1DFunctionFitter` described below.
Class description:
1D function fitter use DE algorithm
Method signatures and docstrings:
- def __call__(self, histogram, functor, boxConstraints): __call__( histogram, functor, boxConstraints ): fit histogram to functor histogram: y(x... | Implement the Python class `DifferentialEvolution1DFunctionFitter` described below.
Class description:
1D function fitter use DE algorithm
Method signatures and docstrings:
- def __call__(self, histogram, functor, boxConstraints): __call__( histogram, functor, boxConstraints ): fit histogram to functor histogram: y(x... | 7ba4ce07a5a4645942192b4b81f7afcae505db90 | <|skeleton|>
class DifferentialEvolution1DFunctionFitter:
"""1D function fitter use DE algorithm"""
def __call__(self, histogram, functor, boxConstraints):
"""__call__( histogram, functor, boxConstraints ): fit histogram to functor histogram: y(x) data curve functor: the function to fit, for example de... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DifferentialEvolution1DFunctionFitter:
"""1D function fitter use DE algorithm"""
def __call__(self, histogram, functor, boxConstraints):
"""__call__( histogram, functor, boxConstraints ): fit histogram to functor histogram: y(x) data curve functor: the function to fit, for example def f(x, a, b, ... | the_stack_v2_python_sparse | histogrammode/reduction/core/DifferentialEvolution1DFunctionFitter.py | danse-inelastic/DrChops | train | 0 |
f98e92f72564d29b42703ef3a9f6ba4e905a2962 | [
"self.sensor = Sensor('127.0.0.1', 8000)\nself.pump = Pump('127.0.0.1', 8000)\nself.pump.set_state = MagicMock(return_value=True)\nself.decider = Decider(100, 0.05)\nself.controller = Controller(self.sensor, self.pump, self.decider)\nself.outcomes_high_or_low = {(self.pump.PUMP_IN, 90): self.pump.PUMP_IN, (self.pum... | <|body_start_0|>
self.sensor = Sensor('127.0.0.1', 8000)
self.pump = Pump('127.0.0.1', 8000)
self.pump.set_state = MagicMock(return_value=True)
self.decider = Decider(100, 0.05)
self.controller = Controller(self.sensor, self.pump, self.decider)
self.outcomes_high_or_low =... | Unit tests for the Controller class | ControllerTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ControllerTests:
"""Unit tests for the Controller class"""
def setUp(self):
"""Create the sensor, pump, decider, and controller. The sensor is not really needed, and the pump isn't either except for its constants. The decider specifies the target height and the margin, while the cont... | stack_v2_sparse_classes_10k_train_006184 | 5,926 | no_license | [
{
"docstring": "Create the sensor, pump, decider, and controller. The sensor is not really needed, and the pump isn't either except for its constants. The decider specifies the target height and the margin, while the controller is mainly needed for its constants (captured in a dict) as well.",
"name": "setU... | 3 | null | Implement the Python class `ControllerTests` described below.
Class description:
Unit tests for the Controller class
Method signatures and docstrings:
- def setUp(self): Create the sensor, pump, decider, and controller. The sensor is not really needed, and the pump isn't either except for its constants. The decider s... | Implement the Python class `ControllerTests` described below.
Class description:
Unit tests for the Controller class
Method signatures and docstrings:
- def setUp(self): Create the sensor, pump, decider, and controller. The sensor is not really needed, and the pump isn't either except for its constants. The decider s... | b1fea0309b3495b3e1dc167d7029bc9e4b6f00f1 | <|skeleton|>
class ControllerTests:
"""Unit tests for the Controller class"""
def setUp(self):
"""Create the sensor, pump, decider, and controller. The sensor is not really needed, and the pump isn't either except for its constants. The decider specifies the target height and the margin, while the cont... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ControllerTests:
"""Unit tests for the Controller class"""
def setUp(self):
"""Create the sensor, pump, decider, and controller. The sensor is not really needed, and the pump isn't either except for its constants. The decider specifies the target height and the margin, while the controller is mai... | the_stack_v2_python_sparse | students/Craig_Morton/Lesson06/water-regulation/waterregulation/test.py | UWPCE-PythonCert-ClassRepos/SP_Online_Course2_2018 | train | 4 |
d863594143c6371e3826797a732c5436e2f59e76 | [
"if not nums or k <= 0:\n return\nn = len(nums)\nk = k % n\nfor i in range(n // 2):\n nums[i], nums[n - 1 - i] = (nums[n - 1 - i], nums[i])\nfor i in range(k // 2):\n nums[i], nums[k - 1 - i] = (nums[k - 1 - i], nums[i])\nfor i in range((n - k) // 2):\n nums[k + i], nums[n - 1 - i] = (nums[n - 1 - i], n... | <|body_start_0|>
if not nums or k <= 0:
return
n = len(nums)
k = k % n
for i in range(n // 2):
nums[i], nums[n - 1 - i] = (nums[n - 1 - i], nums[i])
for i in range(k // 2):
nums[i], nums[k - 1 - i] = (nums[k - 1 - i], nums[i])
for i in ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def rotate(self, nums, k):
""":type nums: List[int] :type k: int :rtype: void Do not return anything, modify nums in-place instead."""
<|body_0|>
def rotate2(self, nums, k):
""":type nums: List[int] :type k: int :rtype: void Do not return anything, modify n... | stack_v2_sparse_classes_10k_train_006185 | 3,328 | no_license | [
{
"docstring": ":type nums: List[int] :type k: int :rtype: void Do not return anything, modify nums in-place instead.",
"name": "rotate",
"signature": "def rotate(self, nums, k)"
},
{
"docstring": ":type nums: List[int] :type k: int :rtype: void Do not return anything, modify nums in-place inste... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rotate(self, nums, k): :type nums: List[int] :type k: int :rtype: void Do not return anything, modify nums in-place instead.
- def rotate2(self, nums, k): :type nums: List[in... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rotate(self, nums, k): :type nums: List[int] :type k: int :rtype: void Do not return anything, modify nums in-place instead.
- def rotate2(self, nums, k): :type nums: List[in... | 635af6e22aa8eef8e7920a585d43a45a891a8157 | <|skeleton|>
class Solution:
def rotate(self, nums, k):
""":type nums: List[int] :type k: int :rtype: void Do not return anything, modify nums in-place instead."""
<|body_0|>
def rotate2(self, nums, k):
""":type nums: List[int] :type k: int :rtype: void Do not return anything, modify n... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def rotate(self, nums, k):
""":type nums: List[int] :type k: int :rtype: void Do not return anything, modify nums in-place instead."""
if not nums or k <= 0:
return
n = len(nums)
k = k % n
for i in range(n // 2):
nums[i], nums[n - 1 - i... | the_stack_v2_python_sparse | code189RotateArray.py | cybelewang/leetcode-python | train | 0 | |
95ee4f8c418afae3c225433775fb7cea7733698c | [
"self._fcn = fcn\nself._fixed_state = fixed_state\nself._idcs = idcs",
"state = self._fixed_state.clone()\nstate = state.repeat(varying.shape[0], varying.shape[1], 1)\nstate[:, :, self._idcs] = varying\nreturn self._fcn(state)"
] | <|body_start_0|>
self._fcn = fcn
self._fixed_state = fixed_state
self._idcs = idcs
<|end_body_0|>
<|body_start_1|>
state = self._fixed_state.clone()
state = state.repeat(varying.shape[0], varying.shape[1], 1)
state[:, :, self._idcs] = varying
return self._fcn(sta... | Wrap the values function to be able to only pass a subset of the state. | wrap_vfcn | [
"BSD-2-Clause",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class wrap_vfcn:
"""Wrap the values function to be able to only pass a subset of the state."""
def __init__(self, fcn: nn.Module, fixed_state: to.Tensor, idcs: list):
"""Constructor :param fcn: function to wrap with an input dimension >= `len(args.idcs)` :param fixed_state: state values he... | stack_v2_sparse_classes_10k_train_006186 | 5,789 | permissive | [
{
"docstring": "Constructor :param fcn: function to wrap with an input dimension >= `len(args.idcs)` :param fixed_state: state values held constant for the evaluation, dimension matches the Module's input layer :param idcs: indices of the state dimensions where the `fixed_state` is replaced which values from ou... | 2 | null | Implement the Python class `wrap_vfcn` described below.
Class description:
Wrap the values function to be able to only pass a subset of the state.
Method signatures and docstrings:
- def __init__(self, fcn: nn.Module, fixed_state: to.Tensor, idcs: list): Constructor :param fcn: function to wrap with an input dimensio... | Implement the Python class `wrap_vfcn` described below.
Class description:
Wrap the values function to be able to only pass a subset of the state.
Method signatures and docstrings:
- def __init__(self, fcn: nn.Module, fixed_state: to.Tensor, idcs: list): Constructor :param fcn: function to wrap with an input dimensio... | d7e9cd191ccb318d5f1e580babc2fc38b5b3675a | <|skeleton|>
class wrap_vfcn:
"""Wrap the values function to be able to only pass a subset of the state."""
def __init__(self, fcn: nn.Module, fixed_state: to.Tensor, idcs: list):
"""Constructor :param fcn: function to wrap with an input dimension >= `len(args.idcs)` :param fixed_state: state values he... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class wrap_vfcn:
"""Wrap the values function to be able to only pass a subset of the state."""
def __init__(self, fcn: nn.Module, fixed_state: to.Tensor, idcs: list):
"""Constructor :param fcn: function to wrap with an input dimension >= `len(args.idcs)` :param fixed_state: state values held constant f... | the_stack_v2_python_sparse | Pyrado/scripts/plotting/plot_value_fcn.py | 1abner1/SimuRLacra | train | 0 |
95b8145b69bb78f1bdb97ab2afbddb341dde14d1 | [
"cls = kwargs.pop('cls', None)\nerror_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError}\nerror_map.update(kwargs.pop('error_map', {}))\napi_version = kwargs.pop('api_version', '2021-05-01-preview')\nrequest = build_get_sip_configuration_request(api_version=api_version, tem... | <|body_start_0|>
cls = kwargs.pop('cls', None)
error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError}
error_map.update(kwargs.pop('error_map', {}))
api_version = kwargs.pop('api_version', '2021-05-01-preview')
request = build_get_sip_co... | SIPRoutingServiceOperationsMixin | [
"LicenseRef-scancode-generic-cla",
"MIT",
"LGPL-2.1-or-later"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SIPRoutingServiceOperationsMixin:
def get_sip_configuration(self, **kwargs):
"""Gets SIP configuration for resource. Gets SIP configuration for resource. :keyword callable cls: A custom type or function that will be passed the direct response :return: SipConfiguration, or the result of c... | stack_v2_sparse_classes_10k_train_006187 | 8,134 | permissive | [
{
"docstring": "Gets SIP configuration for resource. Gets SIP configuration for resource. :keyword callable cls: A custom type or function that will be passed the direct response :return: SipConfiguration, or the result of cls(response) :rtype: ~azure.communication.phonenumbers.siprouting.models.SipConfiguratio... | 2 | stack_v2_sparse_classes_30k_train_001397 | Implement the Python class `SIPRoutingServiceOperationsMixin` described below.
Class description:
Implement the SIPRoutingServiceOperationsMixin class.
Method signatures and docstrings:
- def get_sip_configuration(self, **kwargs): Gets SIP configuration for resource. Gets SIP configuration for resource. :keyword call... | Implement the Python class `SIPRoutingServiceOperationsMixin` described below.
Class description:
Implement the SIPRoutingServiceOperationsMixin class.
Method signatures and docstrings:
- def get_sip_configuration(self, **kwargs): Gets SIP configuration for resource. Gets SIP configuration for resource. :keyword call... | b23e71b289c71f179b9cf9b8c75b1922833a542a | <|skeleton|>
class SIPRoutingServiceOperationsMixin:
def get_sip_configuration(self, **kwargs):
"""Gets SIP configuration for resource. Gets SIP configuration for resource. :keyword callable cls: A custom type or function that will be passed the direct response :return: SipConfiguration, or the result of c... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SIPRoutingServiceOperationsMixin:
def get_sip_configuration(self, **kwargs):
"""Gets SIP configuration for resource. Gets SIP configuration for resource. :keyword callable cls: A custom type or function that will be passed the direct response :return: SipConfiguration, or the result of cls(response) :... | the_stack_v2_python_sparse | sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/operations/_sip_routing_service_operations.py | kurtzeborn/azure-sdk-for-python | train | 0 | |
53350caf95a171426d7a7f097d25bab754840907 | [
"for i in range(k):\n min_j = 0\n min_v = nums[0]\n for j in range(1, len(nums)):\n if nums[j] < min_v:\n min_v = nums[j]\n min_j = j\n nums[min_j] = -nums[min_j]\nreturn sum(nums)",
"nums = sorted(nums, key=abs, reverse=True)\nfor i in range(len(nums)):\n if nums[i] < ... | <|body_start_0|>
for i in range(k):
min_j = 0
min_v = nums[0]
for j in range(1, len(nums)):
if nums[j] < min_v:
min_v = nums[j]
min_j = j
nums[min_j] = -nums[min_j]
return sum(nums)
<|end_body_0|>
<|... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def largestSumAfterKNegations0(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_0|>
def largestSumAfterKNegations(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_st... | stack_v2_sparse_classes_10k_train_006188 | 991 | no_license | [
{
"docstring": ":type nums: List[int] :type k: int :rtype: int",
"name": "largestSumAfterKNegations0",
"signature": "def largestSumAfterKNegations0(self, nums, k)"
},
{
"docstring": ":type nums: List[int] :type k: int :rtype: int",
"name": "largestSumAfterKNegations",
"signature": "def l... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def largestSumAfterKNegations0(self, nums, k): :type nums: List[int] :type k: int :rtype: int
- def largestSumAfterKNegations(self, nums, k): :type nums: List[int] :type k: int :... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def largestSumAfterKNegations0(self, nums, k): :type nums: List[int] :type k: int :rtype: int
- def largestSumAfterKNegations(self, nums, k): :type nums: List[int] :type k: int :... | 6e18c5d257840489cc3fb1079ae3804c743982a4 | <|skeleton|>
class Solution:
def largestSumAfterKNegations0(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_0|>
def largestSumAfterKNegations(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def largestSumAfterKNegations0(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
for i in range(k):
min_j = 0
min_v = nums[0]
for j in range(1, len(nums)):
if nums[j] < min_v:
min_v = nums[j]
... | the_stack_v2_python_sparse | 1005.k-次取反后最大化的数组和.py | yangyuxiang1996/leetcode | train | 0 | |
437cd39a827415958dabd76a66bca2b5c198a697 | [
"super(Cell, self).__init__()\nself.reduction = reduction\nself.reduction_prev = reduction_prev\nif reduction_prev:\n self.preprocess0 = FactorizedReduce(cpp, c, affine=False)\nelse:\n self.preprocess0 = ConvBlock(cpp, c, 1, 1, 0, affine=False)\nself.preprocess1 = ConvBlock(cp, c, 1, 1, 0, affine=False)\nself... | <|body_start_0|>
super(Cell, self).__init__()
self.reduction = reduction
self.reduction_prev = reduction_prev
if reduction_prev:
self.preprocess0 = FactorizedReduce(cpp, c, affine=False)
else:
self.preprocess0 = ConvBlock(cpp, c, 1, 1, 0, affine=False)
... | Cell | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Cell:
def __init__(self, num_nodes, multiplier, cpp, cp, c, reduction, reduction_prev):
""":param steps: 4, number of layers inside a cell :param multiplier: 4 :param cpp: 48 :param cp: 48 :param c: 16 :param reduction: indicates whether to reduce the output maps width :param reduction_p... | stack_v2_sparse_classes_10k_train_006189 | 3,080 | permissive | [
{
"docstring": ":param steps: 4, number of layers inside a cell :param multiplier: 4 :param cpp: 48 :param cp: 48 :param c: 16 :param reduction: indicates whether to reduce the output maps width :param reduction_prev: when previous cell reduced width, s1_d = s0_d//2 in order to keep same shape between s1 and s0... | 2 | stack_v2_sparse_classes_30k_train_003861 | Implement the Python class `Cell` described below.
Class description:
Implement the Cell class.
Method signatures and docstrings:
- def __init__(self, num_nodes, multiplier, cpp, cp, c, reduction, reduction_prev): :param steps: 4, number of layers inside a cell :param multiplier: 4 :param cpp: 48 :param cp: 48 :param... | Implement the Python class `Cell` described below.
Class description:
Implement the Cell class.
Method signatures and docstrings:
- def __init__(self, num_nodes, multiplier, cpp, cp, c, reduction, reduction_prev): :param steps: 4, number of layers inside a cell :param multiplier: 4 :param cpp: 48 :param cp: 48 :param... | f6a3da8818308c9edcd9fedbcf831dd5968efcdd | <|skeleton|>
class Cell:
def __init__(self, num_nodes, multiplier, cpp, cp, c, reduction, reduction_prev):
""":param steps: 4, number of layers inside a cell :param multiplier: 4 :param cpp: 48 :param cp: 48 :param c: 16 :param reduction: indicates whether to reduce the output maps width :param reduction_p... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Cell:
def __init__(self, num_nodes, multiplier, cpp, cp, c, reduction, reduction_prev):
""":param steps: 4, number of layers inside a cell :param multiplier: 4 :param cpp: 48 :param cp: 48 :param c: 16 :param reduction: indicates whether to reduce the output maps width :param reduction_prev: when prev... | the_stack_v2_python_sparse | common/darts/modules/conv/cell.py | ECP-CANDLE/Benchmarks | train | 65 | |
28021ac69c06105417413a442f0e3985354d5fee | [
"parent = self.ancestor.ancestor.ancestor\nif self.relation == self.absolute:\n pqu = PQUModule.PQU(self.value, parent.unit)\n if unit is not None:\n pqu.convertToUnit(unit)\nelse:\n pqu = self.value * parent.pqu(unit)\n if self.relation == self.percent:\n pqu /= 100\nreturn pqu",
"if no... | <|body_start_0|>
parent = self.ancestor.ancestor.ancestor
if self.relation == self.absolute:
pqu = PQUModule.PQU(self.value, parent.unit)
if unit is not None:
pqu.convertToUnit(unit)
else:
pqu = self.value * parent.pqu(unit)
if self... | This is an abstract base class for number quantities. This class adds the pqu and float methods. | Number | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Number:
"""This is an abstract base class for number quantities. This class adds the pqu and float methods."""
def pqu(self, unit=None):
"""Returns a PQU instance of self's value in units of unit. If unit is None, self's unit is used."""
<|body_0|>
def float(self, unit):... | stack_v2_sparse_classes_10k_train_006190 | 5,573 | permissive | [
{
"docstring": "Returns a PQU instance of self's value in units of unit. If unit is None, self's unit is used.",
"name": "pqu",
"signature": "def pqu(self, unit=None)"
},
{
"docstring": "Returns a float instance of self's value in units of unit.",
"name": "float",
"signature": "def float... | 2 | null | Implement the Python class `Number` described below.
Class description:
This is an abstract base class for number quantities. This class adds the pqu and float methods.
Method signatures and docstrings:
- def pqu(self, unit=None): Returns a PQU instance of self's value in units of unit. If unit is None, self's unit i... | Implement the Python class `Number` described below.
Class description:
This is an abstract base class for number quantities. This class adds the pqu and float methods.
Method signatures and docstrings:
- def pqu(self, unit=None): Returns a PQU instance of self's value in units of unit. If unit is None, self's unit i... | 6ba80855ae47cb32c37f635d065b228fadb03412 | <|skeleton|>
class Number:
"""This is an abstract base class for number quantities. This class adds the pqu and float methods."""
def pqu(self, unit=None):
"""Returns a PQU instance of self's value in units of unit. If unit is None, self's unit is used."""
<|body_0|>
def float(self, unit):... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Number:
"""This is an abstract base class for number quantities. This class adds the pqu and float methods."""
def pqu(self, unit=None):
"""Returns a PQU instance of self's value in units of unit. If unit is None, self's unit is used."""
parent = self.ancestor.ancestor.ancestor
if... | the_stack_v2_python_sparse | xData/uncertainty/physicalQuantity/uncertainty.py | LLNL/fudge | train | 21 |
1873e840c22c5678876bad7ad8f4cce71d8de4fd | [
"try:\n result = service.JobStateLoader().set_request_time(nnid, json.loads(request.body))\n return_data = {'status': '200', 'result': str(result)}\n return Response(json.dumps(return_data))\nexcept Exception as e:\n return_data = {'status': '400', 'result': str(e)}\n return Response(json.dumps(retur... | <|body_start_0|>
try:
result = service.JobStateLoader().set_request_time(nnid, json.loads(request.body))
return_data = {'status': '200', 'result': str(result)}
return Response(json.dumps(return_data))
except Exception as e:
return_data = {'status': '400', ... | 1. POST : 2. GET : 3. PUT : 4. DELETE : | CommonJobInfo | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CommonJobInfo:
"""1. POST : 2. GET : 3. PUT : 4. DELETE :"""
def post(self, request, nnid):
"""set the time on the job :param request: :return:"""
<|body_0|>
def get(self, request):
"""get all job list :param request: :return:"""
<|body_1|>
def put(s... | stack_v2_sparse_classes_10k_train_006191 | 2,335 | no_license | [
{
"docstring": "set the time on the job :param request: :return:",
"name": "post",
"signature": "def post(self, request, nnid)"
},
{
"docstring": "get all job list :param request: :return:",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "set the time on t... | 4 | stack_v2_sparse_classes_30k_train_003679 | Implement the Python class `CommonJobInfo` described below.
Class description:
1. POST : 2. GET : 3. PUT : 4. DELETE :
Method signatures and docstrings:
- def post(self, request, nnid): set the time on the job :param request: :return:
- def get(self, request): get all job list :param request: :return:
- def put(self,... | Implement the Python class `CommonJobInfo` described below.
Class description:
1. POST : 2. GET : 3. PUT : 4. DELETE :
Method signatures and docstrings:
- def post(self, request, nnid): set the time on the job :param request: :return:
- def get(self, request): get all job list :param request: :return:
- def put(self,... | 17216fd58619b56b6a397178d327687c274c238c | <|skeleton|>
class CommonJobInfo:
"""1. POST : 2. GET : 3. PUT : 4. DELETE :"""
def post(self, request, nnid):
"""set the time on the job :param request: :return:"""
<|body_0|>
def get(self, request):
"""get all job list :param request: :return:"""
<|body_1|>
def put(s... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CommonJobInfo:
"""1. POST : 2. GET : 3. PUT : 4. DELETE :"""
def post(self, request, nnid):
"""set the time on the job :param request: :return:"""
try:
result = service.JobStateLoader().set_request_time(nnid, json.loads(request.body))
return_data = {'status': '200'... | the_stack_v2_python_sparse | tfmsarest/views/common_job.py | TensorMSA/tensormsa_server_old | train | 0 |
f592050eb75fa027c271798a4074784b43ea122c | [
"cluster = self.cluster\ncluster.populate([3]).start()\nnode = cluster.nodelist()[0]\nnode.drain(block_on_log=True)\ntry:\n node.decommission()\n self.assertFalse('Expected nodetool error')\nexcept ToolError as e:\n self.assertEqual('', e.stderr)\n self.assertTrue('Unsupported operation' in e.stdout)",
... | <|body_start_0|>
cluster = self.cluster
cluster.populate([3]).start()
node = cluster.nodelist()[0]
node.drain(block_on_log=True)
try:
node.decommission()
self.assertFalse('Expected nodetool error')
except ToolError as e:
self.assertEqua... | TestNodetool | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestNodetool:
def test_decommission_after_drain_is_invalid(self):
"""@jira_ticket CASSANDRA-8741 Running a decommission after a drain should generate an unsupported operation message and exit with an error code (which we receive as a ToolError exception)."""
<|body_0|>
def t... | stack_v2_sparse_classes_10k_train_006192 | 5,539 | permissive | [
{
"docstring": "@jira_ticket CASSANDRA-8741 Running a decommission after a drain should generate an unsupported operation message and exit with an error code (which we receive as a ToolError exception).",
"name": "test_decommission_after_drain_is_invalid",
"signature": "def test_decommission_after_drain... | 4 | stack_v2_sparse_classes_30k_train_001774 | Implement the Python class `TestNodetool` described below.
Class description:
Implement the TestNodetool class.
Method signatures and docstrings:
- def test_decommission_after_drain_is_invalid(self): @jira_ticket CASSANDRA-8741 Running a decommission after a drain should generate an unsupported operation message and ... | Implement the Python class `TestNodetool` described below.
Class description:
Implement the TestNodetool class.
Method signatures and docstrings:
- def test_decommission_after_drain_is_invalid(self): @jira_ticket CASSANDRA-8741 Running a decommission after a drain should generate an unsupported operation message and ... | 9ab09570b4750d9b801e2246d0fbd6016ee0a8ca | <|skeleton|>
class TestNodetool:
def test_decommission_after_drain_is_invalid(self):
"""@jira_ticket CASSANDRA-8741 Running a decommission after a drain should generate an unsupported operation message and exit with an error code (which we receive as a ToolError exception)."""
<|body_0|>
def t... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestNodetool:
def test_decommission_after_drain_is_invalid(self):
"""@jira_ticket CASSANDRA-8741 Running a decommission after a drain should generate an unsupported operation message and exit with an error code (which we receive as a ToolError exception)."""
cluster = self.cluster
clus... | the_stack_v2_python_sparse | nodetool_test.py | DikangGu/cassandra-dtest | train | 1 | |
9068143ea16fbe4a7ace7f46d559e1d650ff4774 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn KubernetesServiceEvidence()",
"from .alert_evidence import AlertEvidence\nfrom .dictionary import Dictionary\nfrom .ip_evidence import IpEvidence\nfrom .kubernetes_namespace_evidence import KubernetesNamespaceEvidence\nfrom .kubernetes... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return KubernetesServiceEvidence()
<|end_body_0|>
<|body_start_1|>
from .alert_evidence import AlertEvidence
from .dictionary import Dictionary
from .ip_evidence import IpEvidence
... | KubernetesServiceEvidence | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KubernetesServiceEvidence:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> KubernetesServiceEvidence:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and c... | stack_v2_sparse_classes_10k_train_006193 | 4,761 | permissive | [
{
"docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: KubernetesServiceEvidence",
"name": "create_from_discriminator_value",
"signature": "def create_from_discrim... | 3 | stack_v2_sparse_classes_30k_val_000373 | Implement the Python class `KubernetesServiceEvidence` described below.
Class description:
Implement the KubernetesServiceEvidence class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> KubernetesServiceEvidence: Creates a new instance of the appropriat... | Implement the Python class `KubernetesServiceEvidence` described below.
Class description:
Implement the KubernetesServiceEvidence class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> KubernetesServiceEvidence: Creates a new instance of the appropriat... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class KubernetesServiceEvidence:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> KubernetesServiceEvidence:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and c... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class KubernetesServiceEvidence:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> KubernetesServiceEvidence:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the obje... | the_stack_v2_python_sparse | msgraph/generated/models/security/kubernetes_service_evidence.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
da05afb86cc0bfbb42716aadfce37f6dd4fec943 | [
"self.harris_save_file_last_letter = ord('b')\nself.matching_save_file_last_letter = ord('b')\nself.RANSAC_matching_save_file_last_letter = ord('b')\nself.image_stitch_save_file_last_letter = ord('b')",
"harris_save_file_name_1 = '1' + chr(self.harris_save_file_last_letter) + '.png'\nself.harris_save_file_last_le... | <|body_start_0|>
self.harris_save_file_last_letter = ord('b')
self.matching_save_file_last_letter = ord('b')
self.RANSAC_matching_save_file_last_letter = ord('b')
self.image_stitch_save_file_last_letter = ord('b')
<|end_body_0|>
<|body_start_1|>
harris_save_file_name_1 = '1' + c... | this class manages the file names for all saving files | fname_manager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class fname_manager:
"""this class manages the file names for all saving files"""
def __init__(self):
"""constructor"""
<|body_0|>
def get_2_harris_output_filenames(self):
""":return: return 2 file names for harris corner output"""
<|body_1|>
def get_match... | stack_v2_sparse_classes_10k_train_006194 | 1,961 | no_license | [
{
"docstring": "constructor",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": ":return: return 2 file names for harris corner output",
"name": "get_2_harris_output_filenames",
"signature": "def get_2_harris_output_filenames(self)"
},
{
"docstring": ":retur... | 5 | stack_v2_sparse_classes_30k_train_002322 | Implement the Python class `fname_manager` described below.
Class description:
this class manages the file names for all saving files
Method signatures and docstrings:
- def __init__(self): constructor
- def get_2_harris_output_filenames(self): :return: return 2 file names for harris corner output
- def get_matching_... | Implement the Python class `fname_manager` described below.
Class description:
this class manages the file names for all saving files
Method signatures and docstrings:
- def __init__(self): constructor
- def get_2_harris_output_filenames(self): :return: return 2 file names for harris corner output
- def get_matching_... | a0b687e4c3b793edd48f22102a5a4affa32c5193 | <|skeleton|>
class fname_manager:
"""this class manages the file names for all saving files"""
def __init__(self):
"""constructor"""
<|body_0|>
def get_2_harris_output_filenames(self):
""":return: return 2 file names for harris corner output"""
<|body_1|>
def get_match... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class fname_manager:
"""this class manages the file names for all saving files"""
def __init__(self):
"""constructor"""
self.harris_save_file_last_letter = ord('b')
self.matching_save_file_last_letter = ord('b')
self.RANSAC_matching_save_file_last_letter = ord('b')
self.... | the_stack_v2_python_sparse | project/src/filename_manager.py | Yixuan-Lee/COMP6341-winter-2020 | train | 1 |
be145d69da147d8c0a117bd4ee974866ea1e8ea3 | [
"N = len(nums)\nW = (sum(nums) + S) // 2\nif (sum(nums) + S) % 2 == 1:\n return 0\nif sum(nums) < S or sum(nums) < -S:\n return 0\ndp = [0] * (W + 1)\ndp[0] = 1\nfor i in range(1, N + 1):\n for j in range(W, nums[i - 1] - 1, -1):\n dp[j] = dp[j] + dp[j - nums[i - 1]]\nprint(dp)\nreturn dp[W]",
"de... | <|body_start_0|>
N = len(nums)
W = (sum(nums) + S) // 2
if (sum(nums) + S) % 2 == 1:
return 0
if sum(nums) < S or sum(nums) < -S:
return 0
dp = [0] * (W + 1)
dp[0] = 1
for i in range(1, N + 1):
for j in range(W, nums[i - 1] - 1,... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findTargetSumWays(self, nums: List[int], S: int) -> int:
"""状态转移方程:0-1背包 假设所有元素和为sum,所有添加正号的元素的和为A,所有添加负号的元素和为B, 则有sum = A + B 且 S = A - B,解方程得A = (sum + S)/2。 即题目转换成:从数组中选取一些元素使和恰好为(sum + S) / 2"""
<|body_0|>
def findTargetSumWays1(self, nums: List[int], S: in... | stack_v2_sparse_classes_10k_train_006195 | 3,913 | permissive | [
{
"docstring": "状态转移方程:0-1背包 假设所有元素和为sum,所有添加正号的元素的和为A,所有添加负号的元素和为B, 则有sum = A + B 且 S = A - B,解方程得A = (sum + S)/2。 即题目转换成:从数组中选取一些元素使和恰好为(sum + S) / 2",
"name": "findTargetSumWays",
"signature": "def findTargetSumWays(self, nums: List[int], S: int) -> int"
},
{
"docstring": "回溯算法:二进制递归枚举",
... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findTargetSumWays(self, nums: List[int], S: int) -> int: 状态转移方程:0-1背包 假设所有元素和为sum,所有添加正号的元素的和为A,所有添加负号的元素和为B, 则有sum = A + B 且 S = A - B,解方程得A = (sum + S)/2。 即题目转换成:从数组中选取一些元素... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findTargetSumWays(self, nums: List[int], S: int) -> int: 状态转移方程:0-1背包 假设所有元素和为sum,所有添加正号的元素的和为A,所有添加负号的元素和为B, 则有sum = A + B 且 S = A - B,解方程得A = (sum + S)/2。 即题目转换成:从数组中选取一些元素... | e8a1c6cae6547cbcb6e8494be6df685f3e7c837c | <|skeleton|>
class Solution:
def findTargetSumWays(self, nums: List[int], S: int) -> int:
"""状态转移方程:0-1背包 假设所有元素和为sum,所有添加正号的元素的和为A,所有添加负号的元素和为B, 则有sum = A + B 且 S = A - B,解方程得A = (sum + S)/2。 即题目转换成:从数组中选取一些元素使和恰好为(sum + S) / 2"""
<|body_0|>
def findTargetSumWays1(self, nums: List[int], S: in... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def findTargetSumWays(self, nums: List[int], S: int) -> int:
"""状态转移方程:0-1背包 假设所有元素和为sum,所有添加正号的元素的和为A,所有添加负号的元素和为B, 则有sum = A + B 且 S = A - B,解方程得A = (sum + S)/2。 即题目转换成:从数组中选取一些元素使和恰好为(sum + S) / 2"""
N = len(nums)
W = (sum(nums) + S) // 2
if (sum(nums) + S) % 2 == ... | the_stack_v2_python_sparse | 494-target-sum.py | yuenliou/leetcode | train | 0 | |
215b74cafe6e62706a6365c119a6769207ae42ce | [
"super(JointHead, self).__init__(name=name)\nassert all([vid_to_aud_txt_kwargs['d_model'] == aud_to_vid_txt_kwargs['d_model'], vid_to_aud_txt_kwargs['d_model'] == txt_to_vid_aud_kwargs['d_model']]), 'The joint space projection should be the same for all projections'\nd_joint = vid_to_aud_txt_kwargs['d_model']\nself... | <|body_start_0|>
super(JointHead, self).__init__(name=name)
assert all([vid_to_aud_txt_kwargs['d_model'] == aud_to_vid_txt_kwargs['d_model'], vid_to_aud_txt_kwargs['d_model'] == txt_to_vid_aud_kwargs['d_model']]), 'The joint space projection should be the same for all projections'
d_joint = vid_... | MLP-based Head to bridge audio, text and video with a Joint style. | JointHead | [
"Apache-2.0",
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JointHead:
"""MLP-based Head to bridge audio, text and video with a Joint style."""
def __init__(self, bn_config, use_xreplica_bn, vid_to_aud_txt_kwargs, aud_to_vid_txt_kwargs, txt_to_vid_aud_kwargs, name='mlp_fac_head', **kwargs):
"""Initialize the Fine-to-Coarse head class. Args: b... | stack_v2_sparse_classes_10k_train_006196 | 6,829 | permissive | [
{
"docstring": "Initialize the Fine-to-Coarse head class. Args: bn_config: batchnorm configuration args use_xreplica_bn: whether to use cross-replica bn stats or not vid_to_aud_txt_kwargs: vid2rest MLP args aud_to_vid_txt_kwargs: aud2rest MLP args txt_to_vid_aud_kwargs: txt2rest MLP args name: graph name. **kwa... | 2 | null | Implement the Python class `JointHead` described below.
Class description:
MLP-based Head to bridge audio, text and video with a Joint style.
Method signatures and docstrings:
- def __init__(self, bn_config, use_xreplica_bn, vid_to_aud_txt_kwargs, aud_to_vid_txt_kwargs, txt_to_vid_aud_kwargs, name='mlp_fac_head', **k... | Implement the Python class `JointHead` described below.
Class description:
MLP-based Head to bridge audio, text and video with a Joint style.
Method signatures and docstrings:
- def __init__(self, bn_config, use_xreplica_bn, vid_to_aud_txt_kwargs, aud_to_vid_txt_kwargs, txt_to_vid_aud_kwargs, name='mlp_fac_head', **k... | 5573d9c5822f4e866b6692769963ae819cb3f10d | <|skeleton|>
class JointHead:
"""MLP-based Head to bridge audio, text and video with a Joint style."""
def __init__(self, bn_config, use_xreplica_bn, vid_to_aud_txt_kwargs, aud_to_vid_txt_kwargs, txt_to_vid_aud_kwargs, name='mlp_fac_head', **kwargs):
"""Initialize the Fine-to-Coarse head class. Args: b... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class JointHead:
"""MLP-based Head to bridge audio, text and video with a Joint style."""
def __init__(self, bn_config, use_xreplica_bn, vid_to_aud_txt_kwargs, aud_to_vid_txt_kwargs, txt_to_vid_aud_kwargs, name='mlp_fac_head', **kwargs):
"""Initialize the Fine-to-Coarse head class. Args: bn_config: bat... | the_stack_v2_python_sparse | vatt/modeling/heads/bridge.py | Jimmy-INL/google-research | train | 1 |
bb91cbc762751f307b2ddc76f1a358afd5daa74d | [
"parameters = {'image': image, 'flavor': flavor, 'number_machines': number_machines, 'availability_zone': availability_zone, 'key_name': key_name, 'security_groups': security_groups, 'private_network': private_network, 'public_network': public_network, 'userdata': userdata, 'swap': swap, 'block_device': None, 'sche... | <|body_start_0|>
parameters = {'image': image, 'flavor': flavor, 'number_machines': number_machines, 'availability_zone': availability_zone, 'key_name': key_name, 'security_groups': security_groups, 'private_network': private_network, 'public_network': public_network, 'userdata': userdata, 'swap': swap, 'block_... | Create a virtual machine instance: mysqlfabric machine create provider --image name=image-mysql --flavor name=vm-template --meta db=mysql --meta version=5.6 mysqlfabric machine create provider --image name=image-mysql --flavor name=vm-template --security_groups grp_fabric, grp_ham Options that accept a list are defined... | CreateMachine | [
"Apache-2.0",
"LicenseRef-scancode-python-cwi",
"LGPL-2.0-or-later",
"BSD-3-Clause",
"bzip2-1.0.6",
"LicenseRef-scancode-free-unknown",
"GPL-2.0-only",
"LicenseRef-scancode-other-copyleft",
"Sleepycat",
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-unknown-license-reference",
... | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CreateMachine:
"""Create a virtual machine instance: mysqlfabric machine create provider --image name=image-mysql --flavor name=vm-template --meta db=mysql --meta version=5.6 mysqlfabric machine create provider --image name=image-mysql --flavor name=vm-template --security_groups grp_fabric, grp_h... | stack_v2_sparse_classes_10k_train_006197 | 19,734 | permissive | [
{
"docstring": "Create a machine. :param provider_id: Provider's Id. :param image: Image's properties (e.g. name=image-mysql). :rtype image: list of key/value pairs :param flavor: Flavor's properties (e.g. name=vm-template). :rtype flavor: list of key/value pairs :param number_machines: Number of machines to be... | 2 | stack_v2_sparse_classes_30k_train_005894 | Implement the Python class `CreateMachine` described below.
Class description:
Create a virtual machine instance: mysqlfabric machine create provider --image name=image-mysql --flavor name=vm-template --meta db=mysql --meta version=5.6 mysqlfabric machine create provider --image name=image-mysql --flavor name=vm-templ... | Implement the Python class `CreateMachine` described below.
Class description:
Create a virtual machine instance: mysqlfabric machine create provider --image name=image-mysql --flavor name=vm-template --meta db=mysql --meta version=5.6 mysqlfabric machine create provider --image name=image-mysql --flavor name=vm-templ... | 1e912fd87282be3b3bed48487e6beb0ecb1de339 | <|skeleton|>
class CreateMachine:
"""Create a virtual machine instance: mysqlfabric machine create provider --image name=image-mysql --flavor name=vm-template --meta db=mysql --meta version=5.6 mysqlfabric machine create provider --image name=image-mysql --flavor name=vm-template --security_groups grp_fabric, grp_h... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CreateMachine:
"""Create a virtual machine instance: mysqlfabric machine create provider --image name=image-mysql --flavor name=vm-template --meta db=mysql --meta version=5.6 mysqlfabric machine create provider --image name=image-mysql --flavor name=vm-template --security_groups grp_fabric, grp_ham Options th... | the_stack_v2_python_sparse | mysql-utilities-1.6.0/mysql/fabric/services/machine.py | scavarda/mysql-dbcompare | train | 2 |
91915b97c2c3d6a98b13db24c5df3f19444df24b | [
"for event in response.css('div.event-list-item'):\n date = event.css('h6.event-date::text').get()\n date = datetime.strptime(date.replace(' ', ''), '%a,%b%d,%Y')\n event_id = event.css('h3.el-header a').attrib['href'].split('/')[2]\n yield Request(response.url + '/' + event_id, callback=self.parse_even... | <|body_start_0|>
for event in response.css('div.event-list-item'):
date = event.css('h6.event-date::text').get()
date = datetime.strptime(date.replace(' ', ''), '%a,%b%d,%Y')
event_id = event.css('h3.el-header a').attrib['href'].split('/')[2]
yield Request(respons... | Spider to crawl Chris' Jazz Cafe for performances. | ChrisJazzCafeSpider | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChrisJazzCafeSpider:
"""Spider to crawl Chris' Jazz Cafe for performances."""
def parse(self, response):
"""Parse the html for performance information and yield PerformanceItem instances."""
<|body_0|>
def parse_event(self, response, date):
"""Parse the individua... | stack_v2_sparse_classes_10k_train_006198 | 3,681 | no_license | [
{
"docstring": "Parse the html for performance information and yield PerformanceItem instances.",
"name": "parse",
"signature": "def parse(self, response)"
},
{
"docstring": "Parse the individual event's page for information and yield that performance item.",
"name": "parse_event",
"sign... | 3 | stack_v2_sparse_classes_30k_train_006356 | Implement the Python class `ChrisJazzCafeSpider` described below.
Class description:
Spider to crawl Chris' Jazz Cafe for performances.
Method signatures and docstrings:
- def parse(self, response): Parse the html for performance information and yield PerformanceItem instances.
- def parse_event(self, response, date)... | Implement the Python class `ChrisJazzCafeSpider` described below.
Class description:
Spider to crawl Chris' Jazz Cafe for performances.
Method signatures and docstrings:
- def parse(self, response): Parse the html for performance information and yield PerformanceItem instances.
- def parse_event(self, response, date)... | d5ae552d383f5f971e29a38055c518fc68172f32 | <|skeleton|>
class ChrisJazzCafeSpider:
"""Spider to crawl Chris' Jazz Cafe for performances."""
def parse(self, response):
"""Parse the html for performance information and yield PerformanceItem instances."""
<|body_0|>
def parse_event(self, response, date):
"""Parse the individua... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ChrisJazzCafeSpider:
"""Spider to crawl Chris' Jazz Cafe for performances."""
def parse(self, response):
"""Parse the html for performance information and yield PerformanceItem instances."""
for event in response.css('div.event-list-item'):
date = event.css('h6.event-date::tex... | the_stack_v2_python_sparse | server/app/performance_scraper/performance_scraper/spiders/chris_jazz_cafe_spider.py | EricMontague/MailChimp-Newsletter-Project | train | 0 |
f4338a955716d3a72a9fd7f3b4ca11cfdc04fe17 | [
"user = get_current_user()\nuser_info = UserInfo.query.filter_by(user_id=user.id).first()\nuser_info_schema = UserInfoSchema()\nuser_schema = UserSchema()\nresponse_data = user_info_schema.dump(user_info).data\nresponse_data.update(user_schema.dump(user).data)\nreturn json_response(response_data, message='ok')",
... | <|body_start_0|>
user = get_current_user()
user_info = UserInfo.query.filter_by(user_id=user.id).first()
user_info_schema = UserInfoSchema()
user_schema = UserSchema()
response_data = user_info_schema.dump(user_info).data
response_data.update(user_schema.dump(user).data)
... | UserInfoResource | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserInfoResource:
def get(self):
"""获取用户基本信息 --- tags: - 用户 responses: 200: description: A list of colors (may be filtered by palette) examples: response: {"data": {"name": "", "signature": "", "email": ""}, "message": "ok"}"""
<|body_0|>
def put(self, **kwargs):
"""... | stack_v2_sparse_classes_10k_train_006199 | 10,463 | permissive | [
{
"docstring": "获取用户基本信息 --- tags: - 用户 responses: 200: description: A list of colors (may be filtered by palette) examples: response: {\"data\": {\"name\": \"\", \"signature\": \"\", \"email\": \"\"}, \"message\": \"ok\"}",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "修改用户信息 -... | 2 | stack_v2_sparse_classes_30k_train_005223 | Implement the Python class `UserInfoResource` described below.
Class description:
Implement the UserInfoResource class.
Method signatures and docstrings:
- def get(self): 获取用户基本信息 --- tags: - 用户 responses: 200: description: A list of colors (may be filtered by palette) examples: response: {"data": {"name": "", "signa... | Implement the Python class `UserInfoResource` described below.
Class description:
Implement the UserInfoResource class.
Method signatures and docstrings:
- def get(self): 获取用户基本信息 --- tags: - 用户 responses: 200: description: A list of colors (may be filtered by palette) examples: response: {"data": {"name": "", "signa... | de894e8f8c163cb5aafe360dc146d1a4ded20ddb | <|skeleton|>
class UserInfoResource:
def get(self):
"""获取用户基本信息 --- tags: - 用户 responses: 200: description: A list of colors (may be filtered by palette) examples: response: {"data": {"name": "", "signature": "", "email": ""}, "message": "ok"}"""
<|body_0|>
def put(self, **kwargs):
"""... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class UserInfoResource:
def get(self):
"""获取用户基本信息 --- tags: - 用户 responses: 200: description: A list of colors (may be filtered by palette) examples: response: {"data": {"name": "", "signature": "", "email": ""}, "message": "ok"}"""
user = get_current_user()
user_info = UserInfo.query.filte... | the_stack_v2_python_sparse | arrplat/resources/user/views.py | zhengdeding/tefact-engine | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.