blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 6.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 438 7.52k | id stringlengths 40 40 | length_bytes int64 506 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.25k | prompted_full_text stringlengths 645 10.7k | revision_id stringlengths 40 40 | skeleton stringlengths 162 4.34k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | solution stringlengths 302 7.33k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1406378e1a5b8e9f9a9cd090cb6ae37d626426a5 | [
"self.display_name = display_name\nself.label_width = label_width\nself.col_config = col_config\nself.value_ids = None\nself.prompt_text = PROMPT\nself.show_required_fields = show_required_fields\nif col_config['type'] == 'float':\n self.value_widget = CustomTextArea(PROMPT, multiline=False, validator=float_vali... | <|body_start_0|>
self.display_name = display_name
self.label_width = label_width
self.col_config = col_config
self.value_ids = None
self.prompt_text = PROMPT
self.show_required_fields = show_required_fields
if col_config['type'] == 'float':
self.value_... | EntryEditWidgetRow | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EntryEditWidgetRow:
def __init__(self, display_name, col_config, label_width, edit_width, show_required_fields=False):
"""Representation of a row in the EntryEditWidget. Each of these rows is for editing a single column. :param display_name: Display name for the row (used in the label) :... | stack_v2_sparse_classes_36k_train_000200 | 6,882 | permissive | [
{
"docstring": "Representation of a row in the EntryEditWidget. Each of these rows is for editing a single column. :param display_name: Display name for the row (used in the label) :type display_name: str :param col_config: Column configuration dictionary - this is a single entry from the edit_data dictionary :... | 3 | null | Implement the Python class `EntryEditWidgetRow` described below.
Class description:
Implement the EntryEditWidgetRow class.
Method signatures and docstrings:
- def __init__(self, display_name, col_config, label_width, edit_width, show_required_fields=False): Representation of a row in the EntryEditWidget. Each of the... | Implement the Python class `EntryEditWidgetRow` described below.
Class description:
Implement the EntryEditWidgetRow class.
Method signatures and docstrings:
- def __init__(self, display_name, col_config, label_width, edit_width, show_required_fields=False): Representation of a row in the EntryEditWidget. Each of the... | da8d0baea0cc03a9c0316d686406fce917157d78 | <|skeleton|>
class EntryEditWidgetRow:
def __init__(self, display_name, col_config, label_width, edit_width, show_required_fields=False):
"""Representation of a row in the EntryEditWidget. Each of these rows is for editing a single column. :param display_name: Display name for the row (used in the label) :... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EntryEditWidgetRow:
def __init__(self, display_name, col_config, label_width, edit_width, show_required_fields=False):
"""Representation of a row in the EntryEditWidget. Each of these rows is for editing a single column. :param display_name: Display name for the row (used in the label) :type display_n... | the_stack_v2_python_sparse | pepys_admin/maintenance/widgets/entry_edit_widget.py | debrief/pepys-import | train | 4 | |
6b5f82cff9f54f7fd46f16b41a3c8b4ebcb667b5 | [
"self.resume_command = a.get_command_message(resume_args)\nself.command = get_log_reversed(command_log, stack_level)\nself.output_dir = get_log_reversed(dirs_log, stack_level)\nself.defaults_file = os.path.join(self.output_dir, DEFAULTS_FILE)\nself.args = [arg.decode(u.SYSTEM_ENCODING) for arg in shlex.split(self.c... | <|body_start_0|>
self.resume_command = a.get_command_message(resume_args)
self.command = get_log_reversed(command_log, stack_level)
self.output_dir = get_log_reversed(dirs_log, stack_level)
self.defaults_file = os.path.join(self.output_dir, DEFAULTS_FILE)
self.args = [arg.decode(... | Objects derived from a stored bigmler command | StoredCommand | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StoredCommand:
"""Objects derived from a stored bigmler command"""
def __init__(self, resume_args, command_log, dirs_log, stack_level=0):
"""Constructor that extracts the command from the file ``command_log``: file for stored commands ``dirs_log``: file for associated work directorie... | stack_v2_sparse_classes_36k_train_000201 | 5,186 | permissive | [
{
"docstring": "Constructor that extracts the command from the file ``command_log``: file for stored commands ``dirs_log``: file for associated work directories ``stack_level``: index in the stack for the command to be retrieved",
"name": "__init__",
"signature": "def __init__(self, resume_args, command... | 2 | stack_v2_sparse_classes_30k_val_000894 | Implement the Python class `StoredCommand` described below.
Class description:
Objects derived from a stored bigmler command
Method signatures and docstrings:
- def __init__(self, resume_args, command_log, dirs_log, stack_level=0): Constructor that extracts the command from the file ``command_log``: file for stored c... | Implement the Python class `StoredCommand` described below.
Class description:
Objects derived from a stored bigmler command
Method signatures and docstrings:
- def __init__(self, resume_args, command_log, dirs_log, stack_level=0): Constructor that extracts the command from the file ``command_log``: file for stored c... | cda58f6149e211897c931300083c6b1b3686ff11 | <|skeleton|>
class StoredCommand:
"""Objects derived from a stored bigmler command"""
def __init__(self, resume_args, command_log, dirs_log, stack_level=0):
"""Constructor that extracts the command from the file ``command_log``: file for stored commands ``dirs_log``: file for associated work directorie... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StoredCommand:
"""Objects derived from a stored bigmler command"""
def __init__(self, resume_args, command_log, dirs_log, stack_level=0):
"""Constructor that extracts the command from the file ``command_log``: file for stored commands ``dirs_log``: file for associated work directories ``stack_lev... | the_stack_v2_python_sparse | bigmler/command.py | cheesinglee/bigmler | train | 1 |
06a4aad534db145ee931e8572ec3a9fc6f2bfcb3 | [
"with open(os.path.join(TESTDATA_DIR, 'get_guild.json')) as f:\n cls.GET_GUILD_DATA = json.load(f)\nwith open(os.path.join(TESTDATA_DIR, 'get_guild_crest_emblem_media.json')) as f:\n cls.GET_GUILD_CREST_EMBLEM_MEDIA = json.load(f)",
"guild = Guild('123456789')\nguild.discord_name = 'test me'\nself.db.sessio... | <|body_start_0|>
with open(os.path.join(TESTDATA_DIR, 'get_guild.json')) as f:
cls.GET_GUILD_DATA = json.load(f)
with open(os.path.join(TESTDATA_DIR, 'get_guild_crest_emblem_media.json')) as f:
cls.GET_GUILD_CREST_EMBLEM_MEDIA = json.load(f)
<|end_body_0|>
<|body_start_1|>
... | Ensure consistency of the model. | TestGuildModel | [
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestGuildModel:
"""Ensure consistency of the model."""
def setUpClass(cls):
"""Load test data."""
<|body_0|>
def test_create_guild(self):
"""Creates and registers a guild in a database."""
<|body_1|>
def test_guild_synchronization_from_discord(self):... | stack_v2_sparse_classes_36k_train_000202 | 5,093 | permissive | [
{
"docstring": "Load test data.",
"name": "setUpClass",
"signature": "def setUpClass(cls)"
},
{
"docstring": "Creates and registers a guild in a database.",
"name": "test_create_guild",
"signature": "def test_create_guild(self)"
},
{
"docstring": "Creates a guild and synchronize ... | 6 | stack_v2_sparse_classes_30k_test_000141 | Implement the Python class `TestGuildModel` described below.
Class description:
Ensure consistency of the model.
Method signatures and docstrings:
- def setUpClass(cls): Load test data.
- def test_create_guild(self): Creates and registers a guild in a database.
- def test_guild_synchronization_from_discord(self): Cre... | Implement the Python class `TestGuildModel` described below.
Class description:
Ensure consistency of the model.
Method signatures and docstrings:
- def setUpClass(cls): Load test data.
- def test_create_guild(self): Creates and registers a guild in a database.
- def test_guild_synchronization_from_discord(self): Cre... | 709dd307b046158ddf9e49a559852d486168a94f | <|skeleton|>
class TestGuildModel:
"""Ensure consistency of the model."""
def setUpClass(cls):
"""Load test data."""
<|body_0|>
def test_create_guild(self):
"""Creates and registers a guild in a database."""
<|body_1|>
def test_guild_synchronization_from_discord(self):... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestGuildModel:
"""Ensure consistency of the model."""
def setUpClass(cls):
"""Load test data."""
with open(os.path.join(TESTDATA_DIR, 'get_guild.json')) as f:
cls.GET_GUILD_DATA = json.load(f)
with open(os.path.join(TESTDATA_DIR, 'get_guild_crest_emblem_media.json')) ... | the_stack_v2_python_sparse | api/mod_guild/guild_test.py | FunkySayu/discord-event-manager | train | 6 |
6bf00dcef6bb9cca25219a2bcd0ccad0008d24f1 | [
"super().__init__(model_config)\nself.pipelines = pipelines\nself.aggregation_type = ensemble_aggregation_type",
"inference_pipelines = []\nfor pipeline_id, path in enumerate(paths_to_checkpoint):\n pipeline = ScalarInferencePipeline.create_from_checkpoint(path, config, pipeline_id)\n if pipeline:\n ... | <|body_start_0|>
super().__init__(model_config)
self.pipelines = pipelines
self.aggregation_type = ensemble_aggregation_type
<|end_body_0|>
<|body_start_1|>
inference_pipelines = []
for pipeline_id, path in enumerate(paths_to_checkpoint):
pipeline = ScalarInferencePi... | Pipeline for inference from an ensemble model on classification tasks. This pipeline creates models from multiple checkpoints and aggregates the predictions across models. | ScalarEnsemblePipeline | [
"MIT",
"LicenseRef-scancode-generic-cla"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ScalarEnsemblePipeline:
"""Pipeline for inference from an ensemble model on classification tasks. This pipeline creates models from multiple checkpoints and aggregates the predictions across models."""
def __init__(self, pipelines: List[ScalarInferencePipeline], model_config: ScalarModelBase... | stack_v2_sparse_classes_36k_train_000203 | 10,504 | permissive | [
{
"docstring": ":param pipelines: A set of inference pipelines, one for each recovered checkpoint. :param model_config: Model configuration information. :param ensemble_aggregation_type: Type of aggregation to perform on the model outputs. :return:",
"name": "__init__",
"signature": "def __init__(self, ... | 4 | stack_v2_sparse_classes_30k_train_010069 | Implement the Python class `ScalarEnsemblePipeline` described below.
Class description:
Pipeline for inference from an ensemble model on classification tasks. This pipeline creates models from multiple checkpoints and aggregates the predictions across models.
Method signatures and docstrings:
- def __init__(self, pip... | Implement the Python class `ScalarEnsemblePipeline` described below.
Class description:
Pipeline for inference from an ensemble model on classification tasks. This pipeline creates models from multiple checkpoints and aggregates the predictions across models.
Method signatures and docstrings:
- def __init__(self, pip... | 12b496093097ef48d5ac8880985c04918d7f76fe | <|skeleton|>
class ScalarEnsemblePipeline:
"""Pipeline for inference from an ensemble model on classification tasks. This pipeline creates models from multiple checkpoints and aggregates the predictions across models."""
def __init__(self, pipelines: List[ScalarInferencePipeline], model_config: ScalarModelBase... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ScalarEnsemblePipeline:
"""Pipeline for inference from an ensemble model on classification tasks. This pipeline creates models from multiple checkpoints and aggregates the predictions across models."""
def __init__(self, pipelines: List[ScalarInferencePipeline], model_config: ScalarModelBase, ensemble_ag... | the_stack_v2_python_sparse | InnerEye/ML/pipelines/scalar_inference.py | MaxCodeXTC/InnerEye-DeepLearning | train | 1 |
eb6f8d841c15c7f75652dd5b91f966cc1fac7392 | [
"if not sourceCode:\n raise SphereEngineException('empty source code', 400)\ntry:\n _cId = int(compilerId)\nexcept:\n raise SphereEngineException('compilerId should be integer', 400)\nresource_path = '/submissions'\nmethod = 'POST'\npost_params = {'sourceCode': sourceCode, 'compilerId': compilerId, 'input'... | <|body_start_0|>
if not sourceCode:
raise SphereEngineException('empty source code', 400)
try:
_cId = int(compilerId)
except:
raise SphereEngineException('compilerId should be integer', 400)
resource_path = '/submissions'
method = 'POST'
... | CompilersApiSubmissions | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CompilersApiSubmissions:
def create(self, sourceCode, compilerId=1, _input='', priority=None):
"""Create submission :param sourceCode: source code :type : string :param compilerId: id of the compiler (default 1, i.e. C++) :type : integer :param _input: input for the program (default '') ... | stack_v2_sparse_classes_36k_train_000204 | 7,152 | no_license | [
{
"docstring": "Create submission :param sourceCode: source code :type : string :param compilerId: id of the compiler (default 1, i.e. C++) :type : integer :param _input: input for the program (default '') :type : string :param priority: priority of the submission (default normal priority, eg. 5 for range 1-9) ... | 4 | stack_v2_sparse_classes_30k_train_018392 | Implement the Python class `CompilersApiSubmissions` described below.
Class description:
Implement the CompilersApiSubmissions class.
Method signatures and docstrings:
- def create(self, sourceCode, compilerId=1, _input='', priority=None): Create submission :param sourceCode: source code :type : string :param compile... | Implement the Python class `CompilersApiSubmissions` described below.
Class description:
Implement the CompilersApiSubmissions class.
Method signatures and docstrings:
- def create(self, sourceCode, compilerId=1, _input='', priority=None): Create submission :param sourceCode: source code :type : string :param compile... | 2b9ddbea0f9173754dfeb4f4e651a7c5a275bf52 | <|skeleton|>
class CompilersApiSubmissions:
def create(self, sourceCode, compilerId=1, _input='', priority=None):
"""Create submission :param sourceCode: source code :type : string :param compilerId: id of the compiler (default 1, i.e. C++) :type : integer :param _input: input for the program (default '') ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CompilersApiSubmissions:
def create(self, sourceCode, compilerId=1, _input='', priority=None):
"""Create submission :param sourceCode: source code :type : string :param compilerId: id of the compiler (default 1, i.e. C++) :type : integer :param _input: input for the program (default '') :type : string... | the_stack_v2_python_sparse | build/lib/sphere_engine/apis/compilers.py | rucamedia/python-client | train | 1 | |
7604342b678825c5d9abd8bb90c988a912beb159 | [
"form = UserSignUpForm({'username': 'test', 'password1': 'tH1$isA7357', 'password2': 'tH1$isA7357'})\nself.assertFalse(form.is_valid())\nform = UserSignUpForm({'username': 'test', 'email': 'test@test.com', 'password1': 'tH1$isA7357', 'password2': 'tH1$isA7357'})\nself.assertTrue(form.is_valid())",
"test_user = Us... | <|body_start_0|>
form = UserSignUpForm({'username': 'test', 'password1': 'tH1$isA7357', 'password2': 'tH1$isA7357'})
self.assertFalse(form.is_valid())
form = UserSignUpForm({'username': 'test', 'email': 'test@test.com', 'password1': 'tH1$isA7357', 'password2': 'tH1$isA7357'})
self.assert... | Class to test user sign up form. | UserSignUpFormTestCase | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserSignUpFormTestCase:
"""Class to test user sign up form."""
def test_requires_email(self):
"""The email field is required, and submitted forms should only be valid if it is completed"""
<|body_0|>
def test_email_must_be_unique(self):
"""The email cannot alread... | stack_v2_sparse_classes_36k_train_000205 | 1,282 | no_license | [
{
"docstring": "The email field is required, and submitted forms should only be valid if it is completed",
"name": "test_requires_email",
"signature": "def test_requires_email(self)"
},
{
"docstring": "The email cannot already have a user assoctaed with it.",
"name": "test_email_must_be_uniq... | 2 | stack_v2_sparse_classes_30k_train_014003 | Implement the Python class `UserSignUpFormTestCase` described below.
Class description:
Class to test user sign up form.
Method signatures and docstrings:
- def test_requires_email(self): The email field is required, and submitted forms should only be valid if it is completed
- def test_email_must_be_unique(self): Th... | Implement the Python class `UserSignUpFormTestCase` described below.
Class description:
Class to test user sign up form.
Method signatures and docstrings:
- def test_requires_email(self): The email field is required, and submitted forms should only be valid if it is completed
- def test_email_must_be_unique(self): Th... | 089126403f135631b72f5a66adb1a219ff7a9fc7 | <|skeleton|>
class UserSignUpFormTestCase:
"""Class to test user sign up form."""
def test_requires_email(self):
"""The email field is required, and submitted forms should only be valid if it is completed"""
<|body_0|>
def test_email_must_be_unique(self):
"""The email cannot alread... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserSignUpFormTestCase:
"""Class to test user sign up form."""
def test_requires_email(self):
"""The email field is required, and submitted forms should only be valid if it is completed"""
form = UserSignUpForm({'username': 'test', 'password1': 'tH1$isA7357', 'password2': 'tH1$isA7357'})
... | the_stack_v2_python_sparse | account/test_forms.py | ASquirrelsTail/issue-tracker | train | 0 |
a6d68402552c6ddd6b515754cc9c29aa1bbcb9a4 | [
"self.numsDict = {num: [] for num in nums}\nfor index, num in enumerate(nums):\n self.numsDict[num].append(index)",
"result = None\nfor curRandomNumber in range(len(self.numsDict[target])):\n if random.randint(0, curRandomNumber) == 0:\n result = self.numsDict[target][curRandomNumber]\nreturn result"... | <|body_start_0|>
self.numsDict = {num: [] for num in nums}
for index, num in enumerate(nums):
self.numsDict[num].append(index)
<|end_body_0|>
<|body_start_1|>
result = None
for curRandomNumber in range(len(self.numsDict[target])):
if random.randint(0, curRandomNu... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def __init__(self, nums):
""":type nums: List[int] :type numsSize: int"""
<|body_0|>
def pick(self, target):
""":type target: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.numsDict = {num: [] for num in nums}
... | stack_v2_sparse_classes_36k_train_000206 | 753 | no_license | [
{
"docstring": ":type nums: List[int] :type numsSize: int",
"name": "__init__",
"signature": "def __init__(self, nums)"
},
{
"docstring": ":type target: int :rtype: int",
"name": "pick",
"signature": "def pick(self, target)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, nums): :type nums: List[int] :type numsSize: int
- def pick(self, target): :type target: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, nums): :type nums: List[int] :type numsSize: int
- def pick(self, target): :type target: int :rtype: int
<|skeleton|>
class Solution:
def __init__(self, ... | e05f29071d0badd081535e773f43ebc303aa12c4 | <|skeleton|>
class Solution:
def __init__(self, nums):
""":type nums: List[int] :type numsSize: int"""
<|body_0|>
def pick(self, target):
""":type target: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def __init__(self, nums):
""":type nums: List[int] :type numsSize: int"""
self.numsDict = {num: [] for num in nums}
for index, num in enumerate(nums):
self.numsDict[num].append(index)
def pick(self, target):
""":type target: int :rtype: int"""
... | the_stack_v2_python_sparse | LeetCode/Reservoir Sampling/398_RandomPickIndex.py | HzCeee/Algorithms | train | 0 | |
3bc305d0f3c13f33d5c5ff5b916bdbed0cbdc996 | [
"self.auth_service = AuthService\nself.logout(app, req)\nself.login(app, req)",
"auth_service = self.auth_service\n\n@app.route('{}'.format(ROUTER_CONFIG['api']['v1']['auth']['path_login']), methods=['POST'])\ndef login():\n \"\"\"\n login\n \"\"\"\n return auth_service.login_user(req)... | <|body_start_0|>
self.auth_service = AuthService
self.logout(app, req)
self.login(app, req)
<|end_body_0|>
<|body_start_1|>
auth_service = self.auth_service
@app.route('{}'.format(ROUTER_CONFIG['api']['v1']['auth']['path_login']), methods=['POST'])
def login():
... | Account Controller | AuthController | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AuthController:
"""Account Controller"""
def __init__(self, app, req):
"""init :param app: object Flask :return:"""
<|body_0|>
def login(self, app, req):
"""add account of facebook :param app: object :param req: object :return:"""
<|body_1|>
def logo... | stack_v2_sparse_classes_36k_train_000207 | 1,284 | no_license | [
{
"docstring": "init :param app: object Flask :return:",
"name": "__init__",
"signature": "def __init__(self, app, req)"
},
{
"docstring": "add account of facebook :param app: object :param req: object :return:",
"name": "login",
"signature": "def login(self, app, req)"
},
{
"doc... | 3 | stack_v2_sparse_classes_30k_val_000893 | Implement the Python class `AuthController` described below.
Class description:
Account Controller
Method signatures and docstrings:
- def __init__(self, app, req): init :param app: object Flask :return:
- def login(self, app, req): add account of facebook :param app: object :param req: object :return:
- def logout(s... | Implement the Python class `AuthController` described below.
Class description:
Account Controller
Method signatures and docstrings:
- def __init__(self, app, req): init :param app: object Flask :return:
- def login(self, app, req): add account of facebook :param app: object :param req: object :return:
- def logout(s... | aad508ff252b30009986f66cdc02bd687ca6f59c | <|skeleton|>
class AuthController:
"""Account Controller"""
def __init__(self, app, req):
"""init :param app: object Flask :return:"""
<|body_0|>
def login(self, app, req):
"""add account of facebook :param app: object :param req: object :return:"""
<|body_1|>
def logo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AuthController:
"""Account Controller"""
def __init__(self, app, req):
"""init :param app: object Flask :return:"""
self.auth_service = AuthService
self.logout(app, req)
self.login(app, req)
def login(self, app, req):
"""add account of facebook :param app: obj... | the_stack_v2_python_sparse | src/controller/auth_controller.py | hoanghuyen98/Cashier | train | 0 |
00a730c8161a5c52858a1a7aef69eca8f2eabd55 | [
"from sktime.distances._distance_alignment_paths import compute_min_return_path\nfrom sktime.distances._numba_utils import is_no_python_compiled_callable\nfrom sktime.distances._wdtw_numba import _weighted_cost_matrix\nfrom sktime.distances.lower_bounding import resolve_bounding_matrix\nfrom sktime.utils.numba.njit... | <|body_start_0|>
from sktime.distances._distance_alignment_paths import compute_min_return_path
from sktime.distances._numba_utils import is_no_python_compiled_callable
from sktime.distances._wdtw_numba import _weighted_cost_matrix
from sktime.distances.lower_bounding import resolve_boun... | Weighted derivative dynamic time warping (wddtw) distance between two series. Takes the first order derivative, then applies _weighted_cost_matrix to find WDTW distance. | _WddtwDistance | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _WddtwDistance:
"""Weighted derivative dynamic time warping (wddtw) distance between two series. Takes the first order derivative, then applies _weighted_cost_matrix to find WDTW distance."""
def _distance_alignment_path_factory(self, x: np.ndarray, y: np.ndarray, return_cost_matrix: bool=Fa... | stack_v2_sparse_classes_36k_train_000208 | 9,294 | permissive | [
{
"docstring": "Create a no_python compiled wddtw distance alignment path callable. Series should be shape (d, m), where d is the number of dimensions, m the series length. Series can be different lengths. Parameters ---------- x: np.ndarray (2d array of shape (d,m1)). First time series. y: np.ndarray (2d array... | 2 | null | Implement the Python class `_WddtwDistance` described below.
Class description:
Weighted derivative dynamic time warping (wddtw) distance between two series. Takes the first order derivative, then applies _weighted_cost_matrix to find WDTW distance.
Method signatures and docstrings:
- def _distance_alignment_path_fac... | Implement the Python class `_WddtwDistance` described below.
Class description:
Weighted derivative dynamic time warping (wddtw) distance between two series. Takes the first order derivative, then applies _weighted_cost_matrix to find WDTW distance.
Method signatures and docstrings:
- def _distance_alignment_path_fac... | 70b2bfaaa597eb31bc3a1032366dcc0e1f4c8a9f | <|skeleton|>
class _WddtwDistance:
"""Weighted derivative dynamic time warping (wddtw) distance between two series. Takes the first order derivative, then applies _weighted_cost_matrix to find WDTW distance."""
def _distance_alignment_path_factory(self, x: np.ndarray, y: np.ndarray, return_cost_matrix: bool=Fa... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _WddtwDistance:
"""Weighted derivative dynamic time warping (wddtw) distance between two series. Takes the first order derivative, then applies _weighted_cost_matrix to find WDTW distance."""
def _distance_alignment_path_factory(self, x: np.ndarray, y: np.ndarray, return_cost_matrix: bool=False, window: ... | the_stack_v2_python_sparse | sktime/distances/_wddtw.py | sktime/sktime | train | 1,117 |
6d954afa2741cbd0e4a050fc9ad2a58728bc31b2 | [
"self._capacity = capacity\nself.main = {}\nself.lru = LRU()",
"if key in self.main:\n self.lru.accessed(key)\n return self.main[key]\nelse:\n return -1",
"if key in self.main:\n self.main[key] = value\nelif len(self.main) < self._capacity:\n self.main[key] = value\nelse:\n poppedKey = self.lr... | <|body_start_0|>
self._capacity = capacity
self.main = {}
self.lru = LRU()
<|end_body_0|>
<|body_start_1|>
if key in self.main:
self.lru.accessed(key)
return self.main[key]
else:
return -1
<|end_body_1|>
<|body_start_2|>
if key in sel... | LRUCache | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":type key: int :rtype: int"""
<|body_1|>
def put(self, key, value):
""":type key: int :type value: int :rtype: void"""
<|body_2|>
<|end_s... | stack_v2_sparse_classes_36k_train_000209 | 3,878 | no_license | [
{
"docstring": ":type capacity: int",
"name": "__init__",
"signature": "def __init__(self, capacity)"
},
{
"docstring": ":type key: int :rtype: int",
"name": "get",
"signature": "def get(self, key)"
},
{
"docstring": ":type key: int :type value: int :rtype: void",
"name": "pu... | 3 | null | Implement the Python class `LRUCache` described below.
Class description:
Implement the LRUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :type key: int :rtype: int
- def put(self, key, value): :type key: int :type value: int :rtype: void | Implement the Python class `LRUCache` described below.
Class description:
Implement the LRUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :type key: int :rtype: int
- def put(self, key, value): :type key: int :type value: int :rtype: void
<|sk... | 4ed2d3d7a05890e1d39621465e57bc429ccde19b | <|skeleton|>
class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":type key: int :rtype: int"""
<|body_1|>
def put(self, key, value):
""":type key: int :type value: int :rtype: void"""
<|body_2|>
<|end_s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
self._capacity = capacity
self.main = {}
self.lru = LRU()
def get(self, key):
""":type key: int :rtype: int"""
if key in self.main:
self.lru.accessed(key)
return self.... | the_stack_v2_python_sparse | python/leetcode/py146.py | aloklal99/naukari | train | 0 | |
a57a3099912097316d97dec7cddec3b706b13c2c | [
"res = []\n\ndef dfs(ss, cur):\n if ss == ss[::-1]:\n res.append(cur + [ss])\n for i in range(1, len(ss)):\n if ss[:i] == ss[:i][::-1]:\n dfs(ss[i:], cur + [ss[:i]])\ndfs(s, [])\nreturn res",
"dp = [[True] * len(s) for _ in range(len(s))]\nfor i in range(len(s) - 2, -1, -1):\n fo... | <|body_start_0|>
res = []
def dfs(ss, cur):
if ss == ss[::-1]:
res.append(cur + [ss])
for i in range(1, len(ss)):
if ss[:i] == ss[:i][::-1]:
dfs(ss[i:], cur + [ss[:i]])
dfs(s, [])
return res
<|end_body_0|>
<|bo... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def partition(self, s):
""":type s: str :rtype: List[List[str]]"""
<|body_0|>
def test(self, s):
"""动态规划加回溯"""
<|body_1|>
def test2(self, s):
"""动态规划加回溯的优化,记忆化搜索"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
res = []... | stack_v2_sparse_classes_36k_train_000210 | 1,802 | no_license | [
{
"docstring": ":type s: str :rtype: List[List[str]]",
"name": "partition",
"signature": "def partition(self, s)"
},
{
"docstring": "动态规划加回溯",
"name": "test",
"signature": "def test(self, s)"
},
{
"docstring": "动态规划加回溯的优化,记忆化搜索",
"name": "test2",
"signature": "def test2(s... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def partition(self, s): :type s: str :rtype: List[List[str]]
- def test(self, s): 动态规划加回溯
- def test2(self, s): 动态规划加回溯的优化,记忆化搜索 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def partition(self, s): :type s: str :rtype: List[List[str]]
- def test(self, s): 动态规划加回溯
- def test2(self, s): 动态规划加回溯的优化,记忆化搜索
<|skeleton|>
class Solution:
def partition(... | 4599634f31d78a0372cf0ff6fb7935d054d5ecb5 | <|skeleton|>
class Solution:
def partition(self, s):
""":type s: str :rtype: List[List[str]]"""
<|body_0|>
def test(self, s):
"""动态规划加回溯"""
<|body_1|>
def test2(self, s):
"""动态规划加回溯的优化,记忆化搜索"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def partition(self, s):
""":type s: str :rtype: List[List[str]]"""
res = []
def dfs(ss, cur):
if ss == ss[::-1]:
res.append(cur + [ss])
for i in range(1, len(ss)):
if ss[:i] == ss[:i][::-1]:
dfs(ss[i... | the_stack_v2_python_sparse | leetcode_python/101-200/131.py | jhgdike/leetCode | train | 3 | |
25fde73b55ae5d8b870bc3212ad0613fe0f99a8f | [
"import collections\nm = collections.defaultdict(int)\nfor num in nums:\n m[num] += 1\n if m[num] > 1:\n return num\nreturn -1",
"i = 0\nwhile i < len(nums):\n if nums[i] == i:\n i += 1\n continue\n if nums[nums[i]] == nums[i]:\n return nums[i]\n nums[nums[i]], nums[i] =... | <|body_start_0|>
import collections
m = collections.defaultdict(int)
for num in nums:
m[num] += 1
if m[num] > 1:
return num
return -1
<|end_body_0|>
<|body_start_1|>
i = 0
while i < len(nums):
if nums[i] == i:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findRepeatNumber(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def findRepeatNumber(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
import collections
m = coll... | stack_v2_sparse_classes_36k_train_000211 | 964 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "findRepeatNumber",
"signature": "def findRepeatNumber(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "findRepeatNumber",
"signature": "def findRepeatNumber(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_train_008525 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findRepeatNumber(self, nums): :type nums: List[int] :rtype: int
- def findRepeatNumber(self, nums): :type nums: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findRepeatNumber(self, nums): :type nums: List[int] :rtype: int
- def findRepeatNumber(self, nums): :type nums: List[int] :rtype: int
<|skeleton|>
class Solution:
def f... | 6e18c5d257840489cc3fb1079ae3804c743982a4 | <|skeleton|>
class Solution:
def findRepeatNumber(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def findRepeatNumber(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findRepeatNumber(self, nums):
""":type nums: List[int] :rtype: int"""
import collections
m = collections.defaultdict(int)
for num in nums:
m[num] += 1
if m[num] > 1:
return num
return -1
def findRepeatNumber(sel... | the_stack_v2_python_sparse | 剑指 Offer 03. 数组中重复的数字.py | yangyuxiang1996/leetcode | train | 0 | |
9f54d3e9c7764a4f6b3ebc3a4c56ea36ec745b5f | [
"self.lowHeap = []\nself.highHeap = []\nself.median = None",
"if self.median == None:\n heappush(self.lowHeap, -num)\n self.median = num\nelse:\n if num <= self.median:\n if len(self.lowHeap) <= len(self.highHeap):\n heappush(self.lowHeap, -num)\n else:\n shift = heapp... | <|body_start_0|>
self.lowHeap = []
self.highHeap = []
self.median = None
<|end_body_0|>
<|body_start_1|>
if self.median == None:
heappush(self.lowHeap, -num)
self.median = num
else:
if num <= self.median:
if len(self.lowHeap) <... | MedianFinder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MedianFinder:
def __init__(self):
"""initialize your data structure here."""
<|body_0|>
def addNum(self, num):
""":type num: int :rtype: void"""
<|body_1|>
def findMedian(self):
""":rtype: float"""
<|body_2|>
<|end_skeleton|>
<|body_sta... | stack_v2_sparse_classes_36k_train_000212 | 1,804 | no_license | [
{
"docstring": "initialize your data structure here.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": ":type num: int :rtype: void",
"name": "addNum",
"signature": "def addNum(self, num)"
},
{
"docstring": ":rtype: float",
"name": "findMedian",
"s... | 3 | null | Implement the Python class `MedianFinder` described below.
Class description:
Implement the MedianFinder class.
Method signatures and docstrings:
- def __init__(self): initialize your data structure here.
- def addNum(self, num): :type num: int :rtype: void
- def findMedian(self): :rtype: float | Implement the Python class `MedianFinder` described below.
Class description:
Implement the MedianFinder class.
Method signatures and docstrings:
- def __init__(self): initialize your data structure here.
- def addNum(self, num): :type num: int :rtype: void
- def findMedian(self): :rtype: float
<|skeleton|>
class Me... | a6d0e392134afe19d1aed2dfe7914b674e05ecc6 | <|skeleton|>
class MedianFinder:
def __init__(self):
"""initialize your data structure here."""
<|body_0|>
def addNum(self, num):
""":type num: int :rtype: void"""
<|body_1|>
def findMedian(self):
""":rtype: float"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MedianFinder:
def __init__(self):
"""initialize your data structure here."""
self.lowHeap = []
self.highHeap = []
self.median = None
def addNum(self, num):
""":type num: int :rtype: void"""
if self.median == None:
heappush(self.lowHeap, -num)
... | the_stack_v2_python_sparse | 295Median.py | Ting007/leetcodePractice | train | 0 | |
3f590307c4e50d1541efba93db3325a8e347bd33 | [
"self.instance_keypair = self.os_conn.create_key(key_name='instancekey')\nzone = self.os_conn.nova.availability_zones.find(zoneName='nova')\nhost = zone.hosts.keys()[0]\nself.setup_rules_for_default_sec_group()\nnet, subnet = self.create_internal_network_with_subnet(suffix=1)\nself.os_conn.create_server(name='serve... | <|body_start_0|>
self.instance_keypair = self.os_conn.create_key(key_name='instancekey')
zone = self.os_conn.nova.availability_zones.find(zoneName='nova')
host = zone.hosts.keys()[0]
self.setup_rules_for_default_sec_group()
net, subnet = self.create_internal_network_with_subnet(s... | Check that new flows are added after restarts of openvswitch-agents. | TestOVSRestartAddFlows | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestOVSRestartAddFlows:
"""Check that new flows are added after restarts of openvswitch-agents."""
def _prepare_openstack(self):
"""Prepare OpenStack for scenarios run Steps: 1. Update default security group 2. Create create network net01: net01__subnet, 192.168.1.0/24. 3. Launch vm1... | stack_v2_sparse_classes_36k_train_000213 | 41,546 | no_license | [
{
"docstring": "Prepare OpenStack for scenarios run Steps: 1. Update default security group 2. Create create network net01: net01__subnet, 192.168.1.0/24. 3. Launch vm1 in net01 network 4. Get list of openvswitch-agents",
"name": "_prepare_openstack",
"signature": "def _prepare_openstack(self)"
},
{... | 2 | stack_v2_sparse_classes_30k_train_016566 | Implement the Python class `TestOVSRestartAddFlows` described below.
Class description:
Check that new flows are added after restarts of openvswitch-agents.
Method signatures and docstrings:
- def _prepare_openstack(self): Prepare OpenStack for scenarios run Steps: 1. Update default security group 2. Create create ne... | Implement the Python class `TestOVSRestartAddFlows` described below.
Class description:
Check that new flows are added after restarts of openvswitch-agents.
Method signatures and docstrings:
- def _prepare_openstack(self): Prepare OpenStack for scenarios run Steps: 1. Update default security group 2. Create create ne... | 8aced2855b78b5f123195d188c80e27b43888a2e | <|skeleton|>
class TestOVSRestartAddFlows:
"""Check that new flows are added after restarts of openvswitch-agents."""
def _prepare_openstack(self):
"""Prepare OpenStack for scenarios run Steps: 1. Update default security group 2. Create create network net01: net01__subnet, 192.168.1.0/24. 3. Launch vm1... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestOVSRestartAddFlows:
"""Check that new flows are added after restarts of openvswitch-agents."""
def _prepare_openstack(self):
"""Prepare OpenStack for scenarios run Steps: 1. Update default security group 2. Create create network net01: net01__subnet, 192.168.1.0/24. 3. Launch vm1 in net01 net... | the_stack_v2_python_sparse | mos_tests/neutron/python_tests/test_ovs_restart.py | Mirantis/mos-integration-tests | train | 16 |
ca5b86fc5ad32d750086aaac8187f3b9f12bc8a3 | [
"if len(args) >= 2 and isinstance(args[0], str):\n value = args[1]\n for key in reversed(args[0].split('.')):\n value = {key: value}\n self.data = value\nelse:\n super().__init__(*args, **kwargs)",
"for k, v in other.items():\n if isinstance(v, collections.abc.Mapping):\n self[k] = WD... | <|body_start_0|>
if len(args) >= 2 and isinstance(args[0], str):
value = args[1]
for key in reversed(args[0].split('.')):
value = {key: value}
self.data = value
else:
super().__init__(*args, **kwargs)
<|end_body_0|>
<|body_start_1|>
... | WDict | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WDict:
def __init__(self, *args, **kwargs):
"""permet d'initialiser un dict sous forme nested WDict("aaa.bbb.ccc", 2) => {"aaa":{"bbb":{"ccc":2}}}"""
<|body_0|>
def update(self, other):
"""Recursively update nested dict :param other: some Mapping :return: self, updat... | stack_v2_sparse_classes_36k_train_000214 | 6,173 | no_license | [
{
"docstring": "permet d'initialiser un dict sous forme nested WDict(\"aaa.bbb.ccc\", 2) => {\"aaa\":{\"bbb\":{\"ccc\":2}}}",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docstring": "Recursively update nested dict :param other: some Mapping :return: self, updated... | 2 | stack_v2_sparse_classes_30k_train_011010 | Implement the Python class `WDict` described below.
Class description:
Implement the WDict class.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): permet d'initialiser un dict sous forme nested WDict("aaa.bbb.ccc", 2) => {"aaa":{"bbb":{"ccc":2}}}
- def update(self, other): Recursively update n... | Implement the Python class `WDict` described below.
Class description:
Implement the WDict class.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): permet d'initialiser un dict sous forme nested WDict("aaa.bbb.ccc", 2) => {"aaa":{"bbb":{"ccc":2}}}
- def update(self, other): Recursively update n... | 8bd37e89cff02cf0366ef66d30d7ebab38205759 | <|skeleton|>
class WDict:
def __init__(self, *args, **kwargs):
"""permet d'initialiser un dict sous forme nested WDict("aaa.bbb.ccc", 2) => {"aaa":{"bbb":{"ccc":2}}}"""
<|body_0|>
def update(self, other):
"""Recursively update nested dict :param other: some Mapping :return: self, updat... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WDict:
def __init__(self, *args, **kwargs):
"""permet d'initialiser un dict sous forme nested WDict("aaa.bbb.ccc", 2) => {"aaa":{"bbb":{"ccc":2}}}"""
if len(args) >= 2 and isinstance(args[0], str):
value = args[1]
for key in reversed(args[0].split('.')):
... | the_stack_v2_python_sparse | src/mycartable/utils.py | jgirardet/MyCartable | train | 3 | |
f9afb11fbf9d6e40bc440919c405d93abd8ef0fa | [
"fast = slow = head\nwhile fast and fast.next:\n fast = fast.next.next\n slow = slow.next\n if fast == slow:\n return True\nreturn False",
"if not head:\n return False\nif not head.next:\n return False\nnode_set = set()\ncurrent = head\nwhile current:\n if current not in node_set:\n ... | <|body_start_0|>
fast = slow = head
while fast and fast.next:
fast = fast.next.next
slow = slow.next
if fast == slow:
return True
return False
<|end_body_0|>
<|body_start_1|>
if not head:
return False
if not head.ne... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def hasCycle(self, head):
""":type head: ListNode :rtype: bool https://leetcode.com/problems/linked-list-cycle/solution/ 提供了两种解决方法,hash 和两个快慢指针"""
<|body_0|>
def hasCycle1(self, head):
""":type head: ListNode :rtype: bool"""
<|body_1|>
def dete... | stack_v2_sparse_classes_36k_train_000215 | 2,526 | no_license | [
{
"docstring": ":type head: ListNode :rtype: bool https://leetcode.com/problems/linked-list-cycle/solution/ 提供了两种解决方法,hash 和两个快慢指针",
"name": "hasCycle",
"signature": "def hasCycle(self, head)"
},
{
"docstring": ":type head: ListNode :rtype: bool",
"name": "hasCycle1",
"signature": "def h... | 5 | stack_v2_sparse_classes_30k_train_017434 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hasCycle(self, head): :type head: ListNode :rtype: bool https://leetcode.com/problems/linked-list-cycle/solution/ 提供了两种解决方法,hash 和两个快慢指针
- def hasCycle1(self, head): :type he... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hasCycle(self, head): :type head: ListNode :rtype: bool https://leetcode.com/problems/linked-list-cycle/solution/ 提供了两种解决方法,hash 和两个快慢指针
- def hasCycle1(self, head): :type he... | 11ad9d3841de09c0b4dc3a667e7e63c3558656a5 | <|skeleton|>
class Solution:
def hasCycle(self, head):
""":type head: ListNode :rtype: bool https://leetcode.com/problems/linked-list-cycle/solution/ 提供了两种解决方法,hash 和两个快慢指针"""
<|body_0|>
def hasCycle1(self, head):
""":type head: ListNode :rtype: bool"""
<|body_1|>
def dete... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def hasCycle(self, head):
""":type head: ListNode :rtype: bool https://leetcode.com/problems/linked-list-cycle/solution/ 提供了两种解决方法,hash 和两个快慢指针"""
fast = slow = head
while fast and fast.next:
fast = fast.next.next
slow = slow.next
if fast =... | the_stack_v2_python_sparse | link_list_cycle.py | ganlanshu/leetcode | train | 0 | |
2b94cbf99366f4b45eb4aafad676506442ab8e06 | [
"threading.Thread.__init__(self)\nself.daemon = True\nself.parent = parent\nself.cleaner = TextsCleaner(True)",
"while not self.parent.queueLinks.empty():\n link = self.parent.queueLinks.get()\n text = self.Process(link)\n text = self.cleaner.Process(text)\n self.parent.queueTexts.put(text)\n self.... | <|body_start_0|>
threading.Thread.__init__(self)
self.daemon = True
self.parent = parent
self.cleaner = TextsCleaner(True)
<|end_body_0|>
<|body_start_1|>
while not self.parent.queueLinks.empty():
link = self.parent.queueLinks.get()
text = self.Process(li... | Поток скачивания текста | TextsDownloaderThreaded | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TextsDownloaderThreaded:
"""Поток скачивания текста"""
def __init__(self, parent):
"""Инициализация"""
<|body_0|>
def run(self):
"""Обработка очередей"""
<|body_1|>
def Process(self, link):
"""Непосредственно скачивание"""
<|body_2|>
... | stack_v2_sparse_classes_36k_train_000216 | 14,806 | no_license | [
{
"docstring": "Инициализация",
"name": "__init__",
"signature": "def __init__(self, parent)"
},
{
"docstring": "Обработка очередей",
"name": "run",
"signature": "def run(self)"
},
{
"docstring": "Непосредственно скачивание",
"name": "Process",
"signature": "def Process(s... | 3 | stack_v2_sparse_classes_30k_train_000498 | Implement the Python class `TextsDownloaderThreaded` described below.
Class description:
Поток скачивания текста
Method signatures and docstrings:
- def __init__(self, parent): Инициализация
- def run(self): Обработка очередей
- def Process(self, link): Непосредственно скачивание | Implement the Python class `TextsDownloaderThreaded` described below.
Class description:
Поток скачивания текста
Method signatures and docstrings:
- def __init__(self, parent): Инициализация
- def run(self): Обработка очередей
- def Process(self, link): Непосредственно скачивание
<|skeleton|>
class TextsDownloaderTh... | d2771bf04aa187dda6d468883a5a167237589369 | <|skeleton|>
class TextsDownloaderThreaded:
"""Поток скачивания текста"""
def __init__(self, parent):
"""Инициализация"""
<|body_0|>
def run(self):
"""Обработка очередей"""
<|body_1|>
def Process(self, link):
"""Непосредственно скачивание"""
<|body_2|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TextsDownloaderThreaded:
"""Поток скачивания текста"""
def __init__(self, parent):
"""Инициализация"""
threading.Thread.__init__(self)
self.daemon = True
self.parent = parent
self.cleaner = TextsCleaner(True)
def run(self):
"""Обработка очередей"""
... | the_stack_v2_python_sparse | tools/textparser.py | cash2one/doorscenter | train | 0 |
6c51a1a6dec8f70409203c9dfaffc96d4ebb444d | [
"if not says_the_other or says_the_other.isspace():\n return 'Fine. Be that way!'\nelif self.is_yelling(says_the_other):\n return 'Woah, chill out!'\nelif says_the_other[-1] == '?':\n return 'Sure.'\nreturn 'Whatever.'",
"letters = ''.join([c for c in text if c.isalpha()])\nif letters and letters.isupper... | <|body_start_0|>
if not says_the_other or says_the_other.isspace():
return 'Fine. Be that way!'
elif self.is_yelling(says_the_other):
return 'Woah, chill out!'
elif says_the_other[-1] == '?':
return 'Sure.'
return 'Whatever.'
<|end_body_0|>
<|body_sta... | A lackadaisical teenager | Bob | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Bob:
"""A lackadaisical teenager"""
def hey(self, says_the_other):
"""Bob's response to anything"""
<|body_0|>
def is_yelling(text):
"""Determines whether text contains yelling or not"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not says_t... | stack_v2_sparse_classes_36k_train_000217 | 948 | no_license | [
{
"docstring": "Bob's response to anything",
"name": "hey",
"signature": "def hey(self, says_the_other)"
},
{
"docstring": "Determines whether text contains yelling or not",
"name": "is_yelling",
"signature": "def is_yelling(text)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007383 | Implement the Python class `Bob` described below.
Class description:
A lackadaisical teenager
Method signatures and docstrings:
- def hey(self, says_the_other): Bob's response to anything
- def is_yelling(text): Determines whether text contains yelling or not | Implement the Python class `Bob` described below.
Class description:
A lackadaisical teenager
Method signatures and docstrings:
- def hey(self, says_the_other): Bob's response to anything
- def is_yelling(text): Determines whether text contains yelling or not
<|skeleton|>
class Bob:
"""A lackadaisical teenager""... | be0e2f635a7558f56c61bc0b36c6146b01d1e6e6 | <|skeleton|>
class Bob:
"""A lackadaisical teenager"""
def hey(self, says_the_other):
"""Bob's response to anything"""
<|body_0|>
def is_yelling(text):
"""Determines whether text contains yelling or not"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Bob:
"""A lackadaisical teenager"""
def hey(self, says_the_other):
"""Bob's response to anything"""
if not says_the_other or says_the_other.isspace():
return 'Fine. Be that way!'
elif self.is_yelling(says_the_other):
return 'Woah, chill out!'
elif s... | the_stack_v2_python_sparse | all_data/exercism_data/python/bob/1ec7c55444a7459baab0444d070b314d.py | itsolutionscorp/AutoStyle-Clustering | train | 4 |
b8af26faeb4444367f05b43d3ffe9fba193942e1 | [
"obj = context.object\nif obj is None:\n return False\nreturn all([bool(obj), obj.type == 'MESH'])",
"scene = context.scene\npg = scene.pdt_pg\nobj = bpy.context.view_layer.objects.active\nif obj is None:\n self.report({'ERROR'}, PDT_ERR_NO_ACT_OBJ)\n return {'FINISHED'}\nold_cursor_loc = scene.cursor.lo... | <|body_start_0|>
obj = context.object
if obj is None:
return False
return all([bool(obj), obj.type == 'MESH'])
<|end_body_0|>
<|body_start_1|>
scene = context.scene
pg = scene.pdt_pg
obj = bpy.context.view_layer.objects.active
if obj is None:
... | Set Pivot Point at Object Origin | PDT_OT_PivotOrigin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PDT_OT_PivotOrigin:
"""Set Pivot Point at Object Origin"""
def poll(cls, context):
"""Check Object Status. Args: context: Blender bpy.context instance. Returns: Nothing."""
<|body_0|>
def execute(self, context):
"""Moves Pivot Point to Object Origin. Note: Moves ... | stack_v2_sparse_classes_36k_train_000218 | 13,734 | permissive | [
{
"docstring": "Check Object Status. Args: context: Blender bpy.context instance. Returns: Nothing.",
"name": "poll",
"signature": "def poll(cls, context)"
},
{
"docstring": "Moves Pivot Point to Object Origin. Note: Moves Pivot Point to Object Origin in active scene Args: context: Blender bpy.c... | 2 | stack_v2_sparse_classes_30k_train_005281 | Implement the Python class `PDT_OT_PivotOrigin` described below.
Class description:
Set Pivot Point at Object Origin
Method signatures and docstrings:
- def poll(cls, context): Check Object Status. Args: context: Blender bpy.context instance. Returns: Nothing.
- def execute(self, context): Moves Pivot Point to Object... | Implement the Python class `PDT_OT_PivotOrigin` described below.
Class description:
Set Pivot Point at Object Origin
Method signatures and docstrings:
- def poll(cls, context): Check Object Status. Args: context: Blender bpy.context instance. Returns: Nothing.
- def execute(self, context): Moves Pivot Point to Object... | 4d5c304878c1e0018d97c1b07bcaa3981632265a | <|skeleton|>
class PDT_OT_PivotOrigin:
"""Set Pivot Point at Object Origin"""
def poll(cls, context):
"""Check Object Status. Args: context: Blender bpy.context instance. Returns: Nothing."""
<|body_0|>
def execute(self, context):
"""Moves Pivot Point to Object Origin. Note: Moves ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PDT_OT_PivotOrigin:
"""Set Pivot Point at Object Origin"""
def poll(cls, context):
"""Check Object Status. Args: context: Blender bpy.context instance. Returns: Nothing."""
obj = context.object
if obj is None:
return False
return all([bool(obj), obj.type == 'ME... | the_stack_v2_python_sparse | src/bpy/3.6/scripts/addons/precision_drawing_tools/pdt_pivot_point.py | RnoB/3DVisualSwarm | train | 0 |
67c3136048229d5169497fbaefa6e09455fa5af5 | [
"goalking_list = list(GoalKing.objects.accidental_tourist(season))\nif len(goalking_list) > 0:\n m_list = [x for x in goalking_list if x.member.gender == Member.GENDER.Male]\n l_list = [x for x in goalking_list if x.member.gender == Member.GENDER.Female]\n self.apply_ranking(m_list)\n self.apply_ranking... | <|body_start_0|>
goalking_list = list(GoalKing.objects.accidental_tourist(season))
if len(goalking_list) > 0:
m_list = [x for x in goalking_list if x.member.gender == Member.GENDER.Male]
l_list = [x for x in goalking_list if x.member.gender == Member.GENDER.Female]
se... | Provides useful methods for AccidentalTourist related views. | AccidentalTouristMixin | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AccidentalTouristMixin:
"""Provides useful methods for AccidentalTourist related views."""
def get_goalking_list(self, season):
"""Returns a list of GoalKing items for the specified season."""
<|body_0|>
def apply_ranking(self, goalking_list):
"""Adds a rank attr... | stack_v2_sparse_classes_36k_train_000219 | 21,351 | no_license | [
{
"docstring": "Returns a list of GoalKing items for the specified season.",
"name": "get_goalking_list",
"signature": "def get_goalking_list(self, season)"
},
{
"docstring": "Adds a rank attribute to each GoalKing instance in the given list. based on the total number of miles travelled by that ... | 2 | stack_v2_sparse_classes_30k_train_021293 | Implement the Python class `AccidentalTouristMixin` described below.
Class description:
Provides useful methods for AccidentalTourist related views.
Method signatures and docstrings:
- def get_goalking_list(self, season): Returns a list of GoalKing items for the specified season.
- def apply_ranking(self, goalking_li... | Implement the Python class `AccidentalTouristMixin` described below.
Class description:
Provides useful methods for AccidentalTourist related views.
Method signatures and docstrings:
- def get_goalking_list(self, season): Returns a list of GoalKing items for the specified season.
- def apply_ranking(self, goalking_li... | f38e1984064bdf81f05b86f4650824dd28946c19 | <|skeleton|>
class AccidentalTouristMixin:
"""Provides useful methods for AccidentalTourist related views."""
def get_goalking_list(self, season):
"""Returns a list of GoalKing items for the specified season."""
<|body_0|>
def apply_ranking(self, goalking_list):
"""Adds a rank attr... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AccidentalTouristMixin:
"""Provides useful methods for AccidentalTourist related views."""
def get_goalking_list(self, season):
"""Returns a list of GoalKing items for the specified season."""
goalking_list = list(GoalKing.objects.accidental_tourist(season))
if len(goalking_list) ... | the_stack_v2_python_sparse | cshcsite/matches/views.py | cshc/cshc_website | train | 2 |
b404f5abd388426efb9e5da8b7739170ce603280 | [
"if len(nums) < 3:\n return False\nmin_from_left = [nums[0]]\nfor i in range(1, len(nums)):\n min_from_left.append(min(min_from_left[-1], nums[i]))\nstack = [nums[-1]]\nfor i in range(len(nums) - 2, 0, -1):\n if stack and nums[i] > stack[-1]:\n while stack:\n n = stack.pop()\n ... | <|body_start_0|>
if len(nums) < 3:
return False
min_from_left = [nums[0]]
for i in range(1, len(nums)):
min_from_left.append(min(min_from_left[-1], nums[i]))
stack = [nums[-1]]
for i in range(len(nums) - 2, 0, -1):
if stack and nums[i] > stack[... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def find132pattern(self, nums: List[int]) -> bool:
"""05/03/2020 23:23"""
<|body_0|>
def find132pattern(self, nums: List[int]) -> bool:
"""05/20/2022 12:10 The first number needs to be smaller than the third number. Thus, the thrid number is larger the easi... | stack_v2_sparse_classes_36k_train_000220 | 29,803 | no_license | [
{
"docstring": "05/03/2020 23:23",
"name": "find132pattern",
"signature": "def find132pattern(self, nums: List[int]) -> bool"
},
{
"docstring": "05/20/2022 12:10 The first number needs to be smaller than the third number. Thus, the thrid number is larger the easier to find such the first number.... | 2 | stack_v2_sparse_classes_30k_train_003250 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def find132pattern(self, nums: List[int]) -> bool: 05/03/2020 23:23
- def find132pattern(self, nums: List[int]) -> bool: 05/20/2022 12:10 The first number needs to be smaller tha... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def find132pattern(self, nums: List[int]) -> bool: 05/03/2020 23:23
- def find132pattern(self, nums: List[int]) -> bool: 05/20/2022 12:10 The first number needs to be smaller tha... | 1389a009a02e90e8700a7a00e0b7f797c129cdf4 | <|skeleton|>
class Solution:
def find132pattern(self, nums: List[int]) -> bool:
"""05/03/2020 23:23"""
<|body_0|>
def find132pattern(self, nums: List[int]) -> bool:
"""05/20/2022 12:10 The first number needs to be smaller than the third number. Thus, the thrid number is larger the easi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def find132pattern(self, nums: List[int]) -> bool:
"""05/03/2020 23:23"""
if len(nums) < 3:
return False
min_from_left = [nums[0]]
for i in range(1, len(nums)):
min_from_left.append(min(min_from_left[-1], nums[i]))
stack = [nums[-1]]
... | the_stack_v2_python_sparse | leetcode/solved/456_132_Pattern/solution.py | sungminoh/algorithms | train | 0 | |
ce8d377e7063adb8d27b9ce01ed53af503428bf3 | [
"self.im_axis = im_axis\nself.re_axis = re_axis\nself.im_data = im_data\nself.a = pade.compute_coefficients(1j * self.im_axis, self.im_data)",
"if im_axis_fine is None:\n self.ivcheck = np.linspace(0, 2 * np.max(self.im_axis), num=500)\nelse:\n self.ivcheck = im_axis_fine\ncheck = pade.C(self.ivcheck * 1j, ... | <|body_start_0|>
self.im_axis = im_axis
self.re_axis = re_axis
self.im_data = im_data
self.a = pade.compute_coefficients(1j * self.im_axis, self.im_data)
<|end_body_0|>
<|body_start_1|>
if im_axis_fine is None:
self.ivcheck = np.linspace(0, 2 * np.max(self.im_axis), ... | Pade solver | PadeSolver | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PadeSolver:
"""Pade solver"""
def __init__(self, im_axis, re_axis, im_data):
"""Parameters ---------- im_axis : numpy.ndarray Matsubara frequencies which are used for the continuation re_axis : numpy.ndarray Real-frequency points at which the Pade interpolant is evaluated im_data : G... | stack_v2_sparse_classes_36k_train_000221 | 47,924 | permissive | [
{
"docstring": "Parameters ---------- im_axis : numpy.ndarray Matsubara frequencies which are used for the continuation re_axis : numpy.ndarray Real-frequency points at which the Pade interpolant is evaluated im_data : Green's function values at the given points `im_axis`",
"name": "__init__",
"signatur... | 3 | stack_v2_sparse_classes_30k_train_012515 | Implement the Python class `PadeSolver` described below.
Class description:
Pade solver
Method signatures and docstrings:
- def __init__(self, im_axis, re_axis, im_data): Parameters ---------- im_axis : numpy.ndarray Matsubara frequencies which are used for the continuation re_axis : numpy.ndarray Real-frequency poin... | Implement the Python class `PadeSolver` described below.
Class description:
Pade solver
Method signatures and docstrings:
- def __init__(self, im_axis, re_axis, im_data): Parameters ---------- im_axis : numpy.ndarray Matsubara frequencies which are used for the continuation re_axis : numpy.ndarray Real-frequency poin... | 84d864b75b90805b5b1688dfbf4a2387dfa20e3d | <|skeleton|>
class PadeSolver:
"""Pade solver"""
def __init__(self, im_axis, re_axis, im_data):
"""Parameters ---------- im_axis : numpy.ndarray Matsubara frequencies which are used for the continuation re_axis : numpy.ndarray Real-frequency points at which the Pade interpolant is evaluated im_data : G... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PadeSolver:
"""Pade solver"""
def __init__(self, im_axis, re_axis, im_data):
"""Parameters ---------- im_axis : numpy.ndarray Matsubara frequencies which are used for the continuation re_axis : numpy.ndarray Real-frequency points at which the Pade interpolant is evaluated im_data : Green's functi... | the_stack_v2_python_sparse | ana_cont/solvers.py | josefkaufmann/ana_cont | train | 39 |
1e864e9549076b89c7b8a3e509d888cb06ba860a | [
"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... | Proto file describing the AccountBudgetProposal service. A service for managing account-level budgets via proposals. A proposal is a request to create a new budget or make changes to an existing one. Reads for account-level budgets managed by these proposals will be supported in a future version. Until then, please use... | AccountBudgetProposalServiceServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AccountBudgetProposalServiceServicer:
"""Proto file describing the AccountBudgetProposal service. A service for managing account-level budgets via proposals. A proposal is a request to create a new budget or make changes to an existing one. Reads for account-level budgets managed by these proposa... | stack_v2_sparse_classes_36k_train_000222 | 7,671 | permissive | [
{
"docstring": "Returns an account-level budget proposal in full detail.",
"name": "GetAccountBudgetProposal",
"signature": "def GetAccountBudgetProposal(self, request, context)"
},
{
"docstring": "Creates, updates, or removes account budget proposals. Operation statuses are returned.",
"nam... | 2 | null | Implement the Python class `AccountBudgetProposalServiceServicer` described below.
Class description:
Proto file describing the AccountBudgetProposal service. A service for managing account-level budgets via proposals. A proposal is a request to create a new budget or make changes to an existing one. Reads for account... | Implement the Python class `AccountBudgetProposalServiceServicer` described below.
Class description:
Proto file describing the AccountBudgetProposal service. A service for managing account-level budgets via proposals. A proposal is a request to create a new budget or make changes to an existing one. Reads for account... | 969eff5b6c3cec59d21191fa178cffb6270074c3 | <|skeleton|>
class AccountBudgetProposalServiceServicer:
"""Proto file describing the AccountBudgetProposal service. A service for managing account-level budgets via proposals. A proposal is a request to create a new budget or make changes to an existing one. Reads for account-level budgets managed by these proposa... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AccountBudgetProposalServiceServicer:
"""Proto file describing the AccountBudgetProposal service. A service for managing account-level budgets via proposals. A proposal is a request to create a new budget or make changes to an existing one. Reads for account-level budgets managed by these proposals will be su... | the_stack_v2_python_sparse | google/ads/google_ads/v6/proto/services/account_budget_proposal_service_pb2_grpc.py | VincentFritzsche/google-ads-python | train | 0 |
89598ca59ead92a985ea2b1d0971ed965d3cc341 | [
"super().__init__(parent=parent)\nself._analysis_type = AnalysisType.UNDEFINED\nx_label, y_label = plot_labels[self._analysis_type]\nself.setTitle('VFOM')\nself.setLabel('bottom', x_label)\nself.setLabel('left', y_label)\nself.addLegend(offset=(-40, 20))\nself._is_diff = diff\nif diff:\n self._on_off_pulse = sel... | <|body_start_0|>
super().__init__(parent=parent)
self._analysis_type = AnalysisType.UNDEFINED
x_label, y_label = plot_labels[self._analysis_type]
self.setTitle('VFOM')
self.setLabel('bottom', x_label)
self.setLabel('left', y_label)
self.addLegend(offset=(-40, 20))... | PumpProbeVFomPlot class. Widget for displaying the pump and probe signal or their difference. | PumpProbeVFomPlot | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PumpProbeVFomPlot:
"""PumpProbeVFomPlot class. Widget for displaying the pump and probe signal or their difference."""
def __init__(self, diff=False, *, parent=None):
"""Initialization. :param bool diff: True for displaying on-off while False for displaying on and off"""
<|bo... | stack_v2_sparse_classes_36k_train_000223 | 4,377 | permissive | [
{
"docstring": "Initialization. :param bool diff: True for displaying on-off while False for displaying on and off",
"name": "__init__",
"signature": "def __init__(self, diff=False, *, parent=None)"
},
{
"docstring": "Override.",
"name": "updateF",
"signature": "def updateF(self, data)"
... | 2 | stack_v2_sparse_classes_30k_train_002766 | Implement the Python class `PumpProbeVFomPlot` described below.
Class description:
PumpProbeVFomPlot class. Widget for displaying the pump and probe signal or their difference.
Method signatures and docstrings:
- def __init__(self, diff=False, *, parent=None): Initialization. :param bool diff: True for displaying on-... | Implement the Python class `PumpProbeVFomPlot` described below.
Class description:
PumpProbeVFomPlot class. Widget for displaying the pump and probe signal or their difference.
Method signatures and docstrings:
- def __init__(self, diff=False, *, parent=None): Initialization. :param bool diff: True for displaying on-... | a6ee28040b15ae8d110570bd9f3c37e5a3e70fc0 | <|skeleton|>
class PumpProbeVFomPlot:
"""PumpProbeVFomPlot class. Widget for displaying the pump and probe signal or their difference."""
def __init__(self, diff=False, *, parent=None):
"""Initialization. :param bool diff: True for displaying on-off while False for displaying on and off"""
<|bo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PumpProbeVFomPlot:
"""PumpProbeVFomPlot class. Widget for displaying the pump and probe signal or their difference."""
def __init__(self, diff=False, *, parent=None):
"""Initialization. :param bool diff: True for displaying on-off while False for displaying on and off"""
super().__init__(... | the_stack_v2_python_sparse | extra_foam/gui/windows/pump_probe_w.py | European-XFEL/EXtra-foam | train | 8 |
7e9396f0787738f59018f393cef2c272565d1aac | [
"if name not in np.array(combined_df['name']):\n raise InvalidBusinessName\nreturn name",
"df['cumulative_sum'] = df[df_column].cumsum()\ndf['moving_average'] = df['cumulative_sum'] / (df.index + 1)\nreturn df",
"plt.subplot(2, 1, 1)\nplt.plot(dates, moving_average, label=name)\nplt.xlabel('Date')\nplt.ylabe... | <|body_start_0|>
if name not in np.array(combined_df['name']):
raise InvalidBusinessName
return name
<|end_body_0|>
<|body_start_1|>
df['cumulative_sum'] = df[df_column].cumsum()
df['moving_average'] = df['cumulative_sum'] / (df.index + 1)
return df
<|end_body_1|>
<... | CompanyRatings | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CompanyRatings:
def check_valid_business(name, combined_df):
""":param name: business/franchise name :param combined_df: dataframe containing the names of business/franchises. :return: the name if it is valid."""
<|body_0|>
def calculate_moving_average(df, df_column):
... | stack_v2_sparse_classes_36k_train_000224 | 3,570 | permissive | [
{
"docstring": ":param name: business/franchise name :param combined_df: dataframe containing the names of business/franchises. :return: the name if it is valid.",
"name": "check_valid_business",
"signature": "def check_valid_business(name, combined_df)"
},
{
"docstring": ":param df: dataframe :... | 4 | null | Implement the Python class `CompanyRatings` described below.
Class description:
Implement the CompanyRatings class.
Method signatures and docstrings:
- def check_valid_business(name, combined_df): :param name: business/franchise name :param combined_df: dataframe containing the names of business/franchises. :return: ... | Implement the Python class `CompanyRatings` described below.
Class description:
Implement the CompanyRatings class.
Method signatures and docstrings:
- def check_valid_business(name, combined_df): :param name: business/franchise name :param combined_df: dataframe containing the names of business/franchises. :return: ... | dc9185cbc5e65650d985ebecf877a157c8c19a13 | <|skeleton|>
class CompanyRatings:
def check_valid_business(name, combined_df):
""":param name: business/franchise name :param combined_df: dataframe containing the names of business/franchises. :return: the name if it is valid."""
<|body_0|>
def calculate_moving_average(df, df_column):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CompanyRatings:
def check_valid_business(name, combined_df):
""":param name: business/franchise name :param combined_df: dataframe containing the names of business/franchises. :return: the name if it is valid."""
if name not in np.array(combined_df['name']):
raise InvalidBusinessNa... | the_stack_v2_python_sparse | ak6179/src/company_ratings/company_ratings.py | ds-ga-1007/final_project | train | 0 | |
ce4be85b08b32afa14986cafc899e67f3b61de99 | [
"def __doh1test(self, h1):\n self.assertEqual(h1.__class__, TH1F)\n self.assertEqual(h1.GetName(), h1name)\n self.assertEqual(h1.GetTitle(), h1title)\n self.assertEqual(h1.GetNbinsX(), h1nbins)\nh1 = pickle.load(self.in1)\n__doh1test(self, h1)\nh1 = cPickle.load(self.in2)\n__doh1test(self, h1)",
"def ... | <|body_start_0|>
def __doh1test(self, h1):
self.assertEqual(h1.__class__, TH1F)
self.assertEqual(h1.GetName(), h1name)
self.assertEqual(h1.GetTitle(), h1title)
self.assertEqual(h1.GetNbinsX(), h1nbins)
h1 = pickle.load(self.in1)
__doh1test(self, h1... | PickleReadingSimpleObjectsTestCase | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PickleReadingSimpleObjectsTestCase:
def test1ReadTObjectDerived(self):
"""Test reading of a histogram from a pickle file"""
<|body_0|>
def test2ReadNonTObjectDerived(self):
"""Test reading of an std::vector<double> from a pickle file"""
<|body_1|>
def te... | stack_v2_sparse_classes_36k_train_000225 | 6,654 | no_license | [
{
"docstring": "Test reading of a histogram from a pickle file",
"name": "test1ReadTObjectDerived",
"signature": "def test1ReadTObjectDerived(self)"
},
{
"docstring": "Test reading of an std::vector<double> from a pickle file",
"name": "test2ReadNonTObjectDerived",
"signature": "def test... | 6 | null | Implement the Python class `PickleReadingSimpleObjectsTestCase` described below.
Class description:
Implement the PickleReadingSimpleObjectsTestCase class.
Method signatures and docstrings:
- def test1ReadTObjectDerived(self): Test reading of a histogram from a pickle file
- def test2ReadNonTObjectDerived(self): Test... | Implement the Python class `PickleReadingSimpleObjectsTestCase` described below.
Class description:
Implement the PickleReadingSimpleObjectsTestCase class.
Method signatures and docstrings:
- def test1ReadTObjectDerived(self): Test reading of a histogram from a pickle file
- def test2ReadNonTObjectDerived(self): Test... | 134508460915282a5d82d6cbbb6e6afa14653413 | <|skeleton|>
class PickleReadingSimpleObjectsTestCase:
def test1ReadTObjectDerived(self):
"""Test reading of a histogram from a pickle file"""
<|body_0|>
def test2ReadNonTObjectDerived(self):
"""Test reading of an std::vector<double> from a pickle file"""
<|body_1|>
def te... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PickleReadingSimpleObjectsTestCase:
def test1ReadTObjectDerived(self):
"""Test reading of a histogram from a pickle file"""
def __doh1test(self, h1):
self.assertEqual(h1.__class__, TH1F)
self.assertEqual(h1.GetName(), h1name)
self.assertEqual(h1.GetTitle(), ... | the_stack_v2_python_sparse | python/pickle/PyROOT_readtests.py | root-project/roottest | train | 41 | |
4f91bfd2089fdb28fe03e287621db3f9eedebdb9 | [
"from bars_items.models.sellitem import SellItem\nfrom bars_stats.utils import compute_ranking\nf = {'stockitems__itemoperation__transaction__bar': pk, 'stockitems__itemoperation__transaction__type__in': ('buy', 'meal'), 'stockitems__deleted': False}\nann = Count('stockitems__itemoperation__transaction') / Count('s... | <|body_start_0|>
from bars_items.models.sellitem import SellItem
from bars_stats.utils import compute_ranking
f = {'stockitems__itemoperation__transaction__bar': pk, 'stockitems__itemoperation__transaction__type__in': ('buy', 'meal'), 'stockitems__deleted': False}
ann = Count('stockitems... | BarViewSet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BarViewSet:
def sellitem_ranking(self, request, pk):
"""Return a ranking of the most consumed SellItems in the bar. Response format: `[{sellitem: id, total: (float)total}, ...]` --- omit_serializer: true parameters: - name: date_start required: false type: datetime paramType: query - nam... | stack_v2_sparse_classes_36k_train_000226 | 7,957 | no_license | [
{
"docstring": "Return a ranking of the most consumed SellItems in the bar. Response format: `[{sellitem: id, total: (float)total}, ...]` --- omit_serializer: true parameters: - name: date_start required: false type: datetime paramType: query - name: date_end required: false type: datetime paramType: query",
... | 3 | stack_v2_sparse_classes_30k_train_005275 | Implement the Python class `BarViewSet` described below.
Class description:
Implement the BarViewSet class.
Method signatures and docstrings:
- def sellitem_ranking(self, request, pk): Return a ranking of the most consumed SellItems in the bar. Response format: `[{sellitem: id, total: (float)total}, ...]` --- omit_se... | Implement the Python class `BarViewSet` described below.
Class description:
Implement the BarViewSet class.
Method signatures and docstrings:
- def sellitem_ranking(self, request, pk): Return a ranking of the most consumed SellItems in the bar. Response format: `[{sellitem: id, total: (float)total}, ...]` --- omit_se... | 7e464d4398e14b94d5b802bbd73c563639b5f125 | <|skeleton|>
class BarViewSet:
def sellitem_ranking(self, request, pk):
"""Return a ranking of the most consumed SellItems in the bar. Response format: `[{sellitem: id, total: (float)total}, ...]` --- omit_serializer: true parameters: - name: date_start required: false type: datetime paramType: query - nam... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BarViewSet:
def sellitem_ranking(self, request, pk):
"""Return a ranking of the most consumed SellItems in the bar. Response format: `[{sellitem: id, total: (float)total}, ...]` --- omit_serializer: true parameters: - name: date_start required: false type: datetime paramType: query - name: date_end re... | the_stack_v2_python_sparse | bars_core/models/bar.py | BinetReseau/chocapix-server | train | 2 | |
ceac4fbeb7f222f38b417db5ad228228169e6991 | [
"M, INT_MAX, d = (len(dungeon), 2 ** 31 - 1, dungeon)\nif M < 1:\n return 1\nN = len(d[0])\nd[M - 1][N - 1] = 1 if d[M - 1][N - 1] >= 0 else 1 - d[M - 1][N - 1]\nfor i in range(M - 1, -1, -1):\n for j in range(N - 1, -1, -1):\n if i == M - 1 and j == N - 1:\n continue\n right = max(1,... | <|body_start_0|>
M, INT_MAX, d = (len(dungeon), 2 ** 31 - 1, dungeon)
if M < 1:
return 1
N = len(d[0])
d[M - 1][N - 1] = 1 if d[M - 1][N - 1] >= 0 else 1 - d[M - 1][N - 1]
for i in range(M - 1, -1, -1):
for j in range(N - 1, -1, -1):
if i =... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def calculateMinimumHP(self, dungeon):
""":type dungeon: List[List[int]] :rtype: int"""
<|body_0|>
def calculateMinimumHP2(self, dungeon):
""":type dungeon: List[List[int]] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
M, INT... | stack_v2_sparse_classes_36k_train_000227 | 3,940 | no_license | [
{
"docstring": ":type dungeon: List[List[int]] :rtype: int",
"name": "calculateMinimumHP",
"signature": "def calculateMinimumHP(self, dungeon)"
},
{
"docstring": ":type dungeon: List[List[int]] :rtype: int",
"name": "calculateMinimumHP2",
"signature": "def calculateMinimumHP2(self, dunge... | 2 | stack_v2_sparse_classes_30k_train_007467 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def calculateMinimumHP(self, dungeon): :type dungeon: List[List[int]] :rtype: int
- def calculateMinimumHP2(self, dungeon): :type dungeon: List[List[int]] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def calculateMinimumHP(self, dungeon): :type dungeon: List[List[int]] :rtype: int
- def calculateMinimumHP2(self, dungeon): :type dungeon: List[List[int]] :rtype: int
<|skeleton... | 635af6e22aa8eef8e7920a585d43a45a891a8157 | <|skeleton|>
class Solution:
def calculateMinimumHP(self, dungeon):
""":type dungeon: List[List[int]] :rtype: int"""
<|body_0|>
def calculateMinimumHP2(self, dungeon):
""":type dungeon: List[List[int]] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def calculateMinimumHP(self, dungeon):
""":type dungeon: List[List[int]] :rtype: int"""
M, INT_MAX, d = (len(dungeon), 2 ** 31 - 1, dungeon)
if M < 1:
return 1
N = len(d[0])
d[M - 1][N - 1] = 1 if d[M - 1][N - 1] >= 0 else 1 - d[M - 1][N - 1]
... | the_stack_v2_python_sparse | code174DungeonGame.py | cybelewang/leetcode-python | train | 0 | |
43694e2cc9f7f4771e6c4ff2727ed3c27e50b24f | [
"DataSource.__init__(self, name)\nif dir_path is None:\n raise ValueError('File path cannot be None')\nself.dir_path = dir_path\nself.file_naming_conventions = file_naming_conventions\nself.turn_off_null_and_nan_check = turn_off_null_and_nan_check\nself.kwargs = kwargs\nlogger.debug('Using SuperGopher data sourc... | <|body_start_0|>
DataSource.__init__(self, name)
if dir_path is None:
raise ValueError('File path cannot be None')
self.dir_path = dir_path
self.file_naming_conventions = file_naming_conventions
self.turn_off_null_and_nan_check = turn_off_null_and_nan_check
se... | Delegate the finding and reading of the file to SuperGopher. | SuperGopherDataSource | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SuperGopherDataSource:
"""Delegate the finding and reading of the file to SuperGopher."""
def __init__(self, name, file_naming_conventions, dir_path, turn_off_null_and_nan_check, **kwargs):
"""Delegate the finding and reading of the file to SuperGopher. Resample to n_draws. Args: nam... | stack_v2_sparse_classes_36k_train_000228 | 10,173 | no_license | [
{
"docstring": "Delegate the finding and reading of the file to SuperGopher. Resample to n_draws. Args: name(str): name for logger file_naming_conventions(Dict[str, str]): Dictionary containing at least 'file_pattern' key and possibly 'h5_tablename' key. dir_path(str): path to directory containing files to sear... | 2 | null | Implement the Python class `SuperGopherDataSource` described below.
Class description:
Delegate the finding and reading of the file to SuperGopher.
Method signatures and docstrings:
- def __init__(self, name, file_naming_conventions, dir_path, turn_off_null_and_nan_check, **kwargs): Delegate the finding and reading o... | Implement the Python class `SuperGopherDataSource` described below.
Class description:
Delegate the finding and reading of the file to SuperGopher.
Method signatures and docstrings:
- def __init__(self, name, file_naming_conventions, dir_path, turn_off_null_and_nan_check, **kwargs): Delegate the finding and reading o... | 746ea5fb76a9c049c37a8c15aa089c041a90a6d5 | <|skeleton|>
class SuperGopherDataSource:
"""Delegate the finding and reading of the file to SuperGopher."""
def __init__(self, name, file_naming_conventions, dir_path, turn_off_null_and_nan_check, **kwargs):
"""Delegate the finding and reading of the file to SuperGopher. Resample to n_draws. Args: nam... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SuperGopherDataSource:
"""Delegate the finding and reading of the file to SuperGopher."""
def __init__(self, name, file_naming_conventions, dir_path, turn_off_null_and_nan_check, **kwargs):
"""Delegate the finding and reading of the file to SuperGopher. Resample to n_draws. Args: name(str): name ... | the_stack_v2_python_sparse | shared_code/central_comp/risk/burdenator/data_source.py | Nermin-Ghith/ihme-modeling | train | 0 |
4f7bb03dd25f816e527ca353162dd7112d0bfebf | [
"self.request = request\nself.action = action\ntemplates = dict(self.DEFAULT_TEMPLATES, **current_app.config['ILS_NOTIFICATIONS_TEMPLATES_DOCUMENT_REQUEST'])\nif not action:\n raise NotImplementedError\nif action == 'request_declined':\n decline_reason = request.get('decline_reason', '')\n action = '{}_{}'... | <|body_start_0|>
self.request = request
self.action = action
templates = dict(self.DEFAULT_TEMPLATES, **current_app.config['ILS_NOTIFICATIONS_TEMPLATES_DOCUMENT_REQUEST'])
if not action:
raise NotImplementedError
if action == 'request_declined':
decline_re... | Document request message class to generate the msg content. | NotificationDocumentRequestMsg | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NotificationDocumentRequestMsg:
"""Document request message class to generate the msg content."""
def __init__(self, request, action, msg_ctx, **kwargs):
"""Create message based on the record action."""
<|body_0|>
def to_dict(self):
"""Dump obj."""
<|body... | stack_v2_sparse_classes_36k_train_000229 | 2,574 | permissive | [
{
"docstring": "Create message based on the record action.",
"name": "__init__",
"signature": "def __init__(self, request, action, msg_ctx, **kwargs)"
},
{
"docstring": "Dump obj.",
"name": "to_dict",
"signature": "def to_dict(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_020060 | Implement the Python class `NotificationDocumentRequestMsg` described below.
Class description:
Document request message class to generate the msg content.
Method signatures and docstrings:
- def __init__(self, request, action, msg_ctx, **kwargs): Create message based on the record action.
- def to_dict(self): Dump o... | Implement the Python class `NotificationDocumentRequestMsg` described below.
Class description:
Document request message class to generate the msg content.
Method signatures and docstrings:
- def __init__(self, request, action, msg_ctx, **kwargs): Create message based on the record action.
- def to_dict(self): Dump o... | 1c36526e85510100c5f64059518d1b716d87ac10 | <|skeleton|>
class NotificationDocumentRequestMsg:
"""Document request message class to generate the msg content."""
def __init__(self, request, action, msg_ctx, **kwargs):
"""Create message based on the record action."""
<|body_0|>
def to_dict(self):
"""Dump obj."""
<|body... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NotificationDocumentRequestMsg:
"""Document request message class to generate the msg content."""
def __init__(self, request, action, msg_ctx, **kwargs):
"""Create message based on the record action."""
self.request = request
self.action = action
templates = dict(self.DEFA... | the_stack_v2_python_sparse | invenio_app_ils/document_requests/notifications/messages.py | inveniosoftware/invenio-app-ils | train | 64 |
1ad5cab4c64102cf28e0e40f57260c4106373d4c | [
"try:\n return User.objects.get(email=user_email)\nexcept User.DoesNotExist:\n raise Http404",
"response = self.serializer(data=request.data)\nif response.is_valid():\n self.get_object(response.validated_data['email'])\n return Response(status=status.HTTP_200_OK)\nreturn Response(status=status.HTTP_40... | <|body_start_0|>
try:
return User.objects.get(email=user_email)
except User.DoesNotExist:
raise Http404
<|end_body_0|>
<|body_start_1|>
response = self.serializer(data=request.data)
if response.is_valid():
self.get_object(response.validated_data['emai... | ... | VEmail | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VEmail:
"""..."""
def get_object(self, user_email: str):
"""..."""
<|body_0|>
def post(self, request, format=None):
"""..."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
try:
return User.objects.get(email=user_email)
except ... | stack_v2_sparse_classes_36k_train_000230 | 2,434 | permissive | [
{
"docstring": "...",
"name": "get_object",
"signature": "def get_object(self, user_email: str)"
},
{
"docstring": "...",
"name": "post",
"signature": "def post(self, request, format=None)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005754 | Implement the Python class `VEmail` described below.
Class description:
...
Method signatures and docstrings:
- def get_object(self, user_email: str): ...
- def post(self, request, format=None): ... | Implement the Python class `VEmail` described below.
Class description:
...
Method signatures and docstrings:
- def get_object(self, user_email: str): ...
- def post(self, request, format=None): ...
<|skeleton|>
class VEmail:
"""..."""
def get_object(self, user_email: str):
"""..."""
<|body_... | 660664ba2321499e92c3c5c23719756db2569e90 | <|skeleton|>
class VEmail:
"""..."""
def get_object(self, user_email: str):
"""..."""
<|body_0|>
def post(self, request, format=None):
"""..."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VEmail:
"""..."""
def get_object(self, user_email: str):
"""..."""
try:
return User.objects.get(email=user_email)
except User.DoesNotExist:
raise Http404
def post(self, request, format=None):
"""..."""
response = self.serializer(data=re... | the_stack_v2_python_sparse | apps/user/views/vauth.py | magocod/djrepo | train | 1 |
3b015eb59532f512ab2aab084c2d59d635c5a009 | [
"if k > len(nums):\n return ()\npreSum = 0\nmaxSum = -float('Inf')\nfor i in range(0, len(nums) - k + 1):\n preSum = sum(nums[i:i + k])\n maxSum = max(maxSum, preSum)\nreturn maxSum / k",
"if k > len(nums):\n return ()\npreSum = sum(nums[0:k])\nmaxSum = preSum\nfor i in range(k, len(nums)):\n preSu... | <|body_start_0|>
if k > len(nums):
return ()
preSum = 0
maxSum = -float('Inf')
for i in range(0, len(nums) - k + 1):
preSum = sum(nums[i:i + k])
maxSum = max(maxSum, preSum)
return maxSum / k
<|end_body_0|>
<|body_start_1|>
if k > len(... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findMaxAverage(self, nums, k):
""":type nums: List[int] :type k: int :rtype: float"""
<|body_0|>
def findMaxAverage2(self, nums, k):
""":type nums: List[int] :type k: int :rtype: float"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if... | stack_v2_sparse_classes_36k_train_000231 | 1,288 | no_license | [
{
"docstring": ":type nums: List[int] :type k: int :rtype: float",
"name": "findMaxAverage",
"signature": "def findMaxAverage(self, nums, k)"
},
{
"docstring": ":type nums: List[int] :type k: int :rtype: float",
"name": "findMaxAverage2",
"signature": "def findMaxAverage2(self, nums, k)"... | 2 | stack_v2_sparse_classes_30k_train_002878 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findMaxAverage(self, nums, k): :type nums: List[int] :type k: int :rtype: float
- def findMaxAverage2(self, nums, k): :type nums: List[int] :type k: int :rtype: float | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findMaxAverage(self, nums, k): :type nums: List[int] :type k: int :rtype: float
- def findMaxAverage2(self, nums, k): :type nums: List[int] :type k: int :rtype: float
<|skel... | 604efd2c53c369fb262f42f7f7f31997ea4d029b | <|skeleton|>
class Solution:
def findMaxAverage(self, nums, k):
""":type nums: List[int] :type k: int :rtype: float"""
<|body_0|>
def findMaxAverage2(self, nums, k):
""":type nums: List[int] :type k: int :rtype: float"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findMaxAverage(self, nums, k):
""":type nums: List[int] :type k: int :rtype: float"""
if k > len(nums):
return ()
preSum = 0
maxSum = -float('Inf')
for i in range(0, len(nums) - k + 1):
preSum = sum(nums[i:i + k])
maxSum... | the_stack_v2_python_sparse | 643_MaximumAverageSubarrayI.py | fxy1018/Leetcode | train | 1 | |
339115dc576a41922ed9550d1016fcaa67912794 | [
"parselet = self._parselet(parser, token)\npower = parselet.power\nreturn power",
"parselet = self._parselet(parser, token)\nresult = parselet.led(parser, token, left)\nreturn result",
"try:\n parselet = super()._get_parselet(token)\nexcept ParseletNotRegistered:\n ctx = parser.context()\n raise LedDen... | <|body_start_0|>
parselet = self._parselet(parser, token)
power = parselet.power
return power
<|end_body_0|>
<|body_start_1|>
parselet = self._parselet(parser, token)
result = parselet.led(parser, token, left)
return result
<|end_body_1|>
<|body_start_2|>
try:
... | Left-Denotation. The specification of how an operator consumes to the right with a left-context. | Led | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Led:
"""Left-Denotation. The specification of how an operator consumes to the right with a left-context."""
def power(self, parser, token):
"""Return power for a given token."""
<|body_0|>
def eval(self, parser, token, left):
"""Receive from left, evaluate and re... | stack_v2_sparse_classes_36k_train_000232 | 1,009 | no_license | [
{
"docstring": "Return power for a given token.",
"name": "power",
"signature": "def power(self, parser, token)"
},
{
"docstring": "Receive from left, evaluate and return result.",
"name": "eval",
"signature": "def eval(self, parser, token, left)"
},
{
"docstring": "Find and retu... | 3 | stack_v2_sparse_classes_30k_train_016739 | Implement the Python class `Led` described below.
Class description:
Left-Denotation. The specification of how an operator consumes to the right with a left-context.
Method signatures and docstrings:
- def power(self, parser, token): Return power for a given token.
- def eval(self, parser, token, left): Receive from ... | Implement the Python class `Led` described below.
Class description:
Left-Denotation. The specification of how an operator consumes to the right with a left-context.
Method signatures and docstrings:
- def power(self, parser, token): Return power for a given token.
- def eval(self, parser, token, left): Receive from ... | 43f8e3b6ab4c6b85f44e5331d16f36ac88518c42 | <|skeleton|>
class Led:
"""Left-Denotation. The specification of how an operator consumes to the right with a left-context."""
def power(self, parser, token):
"""Return power for a given token."""
<|body_0|>
def eval(self, parser, token, left):
"""Receive from left, evaluate and re... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Led:
"""Left-Denotation. The specification of how an operator consumes to the right with a left-context."""
def power(self, parser, token):
"""Return power for a given token."""
parselet = self._parselet(parser, token)
power = parselet.power
return power
def eval(self... | the_stack_v2_python_sparse | final_task/pycalc/specification/led.py | siarhiejkresik/Epam-2019-Python-Homework | train | 1 |
a59377b8da63eacdcb45b6f611b646f9d1a65e57 | [
"if ax is None:\n ax = plt.gca()\ntplot = np.arange(self.T)\nif maskNaNs:\n tplot = tplot[~np.any(np.isnan(self.data), axis=(0, 2))]\nreturn ax.plot(tplot, self[tplot], **kwargs)",
"if max(dims) >= self.d:\n raise ValueError('Invalid plotting dimensions')\nif 'linestyle' in kwargs.keys():\n if isinsta... | <|body_start_0|>
if ax is None:
ax = plt.gca()
tplot = np.arange(self.T)
if maskNaNs:
tplot = tplot[~np.any(np.isnan(self.data), axis=(0, 2))]
return ax.plot(tplot, self[tplot], **kwargs)
<|end_body_0|>
<|body_start_1|>
if max(dims) >= self.d:
... | Single-locus trajectory | Trajectory_1N | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Trajectory_1N:
"""Single-locus trajectory"""
def plot_vstime(self, ax=None, maskNaNs=True, **kwargs):
"""Plot spatial components vs. time"""
<|body_0|>
def _raw_plot_spatial(self, ax, dims, **kwargs):
"""internal method for spatial plotting"""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_000233 | 18,150 | permissive | [
{
"docstring": "Plot spatial components vs. time",
"name": "plot_vstime",
"signature": "def plot_vstime(self, ax=None, maskNaNs=True, **kwargs)"
},
{
"docstring": "internal method for spatial plotting",
"name": "_raw_plot_spatial",
"signature": "def _raw_plot_spatial(self, ax, dims, **kw... | 2 | stack_v2_sparse_classes_30k_train_002984 | Implement the Python class `Trajectory_1N` described below.
Class description:
Single-locus trajectory
Method signatures and docstrings:
- def plot_vstime(self, ax=None, maskNaNs=True, **kwargs): Plot spatial components vs. time
- def _raw_plot_spatial(self, ax, dims, **kwargs): internal method for spatial plotting | Implement the Python class `Trajectory_1N` described below.
Class description:
Single-locus trajectory
Method signatures and docstrings:
- def plot_vstime(self, ax=None, maskNaNs=True, **kwargs): Plot spatial components vs. time
- def _raw_plot_spatial(self, ax, dims, **kwargs): internal method for spatial plotting
... | 01365b272883b6dbef82d7d72bff092756092938 | <|skeleton|>
class Trajectory_1N:
"""Single-locus trajectory"""
def plot_vstime(self, ax=None, maskNaNs=True, **kwargs):
"""Plot spatial components vs. time"""
<|body_0|>
def _raw_plot_spatial(self, ax, dims, **kwargs):
"""internal method for spatial plotting"""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Trajectory_1N:
"""Single-locus trajectory"""
def plot_vstime(self, ax=None, maskNaNs=True, **kwargs):
"""Plot spatial components vs. time"""
if ax is None:
ax = plt.gca()
tplot = np.arange(self.T)
if maskNaNs:
tplot = tplot[~np.any(np.isnan(self.dat... | the_stack_v2_python_sparse | tracklib/traj_old.py | SGrosse-Holz/tracklib | train | 3 |
46cf3286b9b2c65c1cb301a0f2abdc6bb683ae6c | [
"assert batch_size is not None and max_len is not None\nself.src_dataset = src_dataset\nself.src_vocab = src_vocab\nself.tgt_dataset = tgt_dataset\nself.tgt_vocab = tgt_vocab\nself.batch_size = batch_size\nself.max_len = max_len",
"src_tgt_dataset = tf.data.Dataset.zip((self.src_dataset, self.tgt_dataset))\nif sh... | <|body_start_0|>
assert batch_size is not None and max_len is not None
self.src_dataset = src_dataset
self.src_vocab = src_vocab
self.tgt_dataset = tgt_dataset
self.tgt_vocab = tgt_vocab
self.batch_size = batch_size
self.max_len = max_len
<|end_body_0|>
<|body_st... | Iterator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Iterator:
def __init__(self, src_dataset, src_vocab, tgt_dataset=None, tgt_vocab=None, batch_size=None, max_len=None):
"""Constructs and Iterator for the given Model Note: batch size and datasets can be placeholders"""
<|body_0|>
def create_iterator(self, shuffle=True, reshu... | stack_v2_sparse_classes_36k_train_000234 | 6,517 | no_license | [
{
"docstring": "Constructs and Iterator for the given Model Note: batch size and datasets can be placeholders",
"name": "__init__",
"signature": "def __init__(self, src_dataset, src_vocab, tgt_dataset=None, tgt_vocab=None, batch_size=None, max_len=None)"
},
{
"docstring": "Constructs the Trainin... | 3 | stack_v2_sparse_classes_30k_train_008954 | Implement the Python class `Iterator` described below.
Class description:
Implement the Iterator class.
Method signatures and docstrings:
- def __init__(self, src_dataset, src_vocab, tgt_dataset=None, tgt_vocab=None, batch_size=None, max_len=None): Constructs and Iterator for the given Model Note: batch size and data... | Implement the Python class `Iterator` described below.
Class description:
Implement the Iterator class.
Method signatures and docstrings:
- def __init__(self, src_dataset, src_vocab, tgt_dataset=None, tgt_vocab=None, batch_size=None, max_len=None): Constructs and Iterator for the given Model Note: batch size and data... | 271955ab3a5543bdc38c57291d28f4736a5d067a | <|skeleton|>
class Iterator:
def __init__(self, src_dataset, src_vocab, tgt_dataset=None, tgt_vocab=None, batch_size=None, max_len=None):
"""Constructs and Iterator for the given Model Note: batch size and datasets can be placeholders"""
<|body_0|>
def create_iterator(self, shuffle=True, reshu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Iterator:
def __init__(self, src_dataset, src_vocab, tgt_dataset=None, tgt_vocab=None, batch_size=None, max_len=None):
"""Constructs and Iterator for the given Model Note: batch size and datasets can be placeholders"""
assert batch_size is not None and max_len is not None
self.src_data... | the_stack_v2_python_sparse | tf/nmt/utils/iterator_utils.py | oneTimePad/neural_networks | train | 1 | |
b2ba05889ae070bc25577932648e9574fff71487 | [
"if len(remote_addr) > 0:\n if memcache.get('/ratelimit/' + remote_addr + '/' + action):\n return False\n else:\n memcache.set('/ratelimit/' + remote_addr + '/' + action, True, ttl)\n return True\n status = memcache.get('/blocked/' + remote_addr)\n if status is not None:\n re... | <|body_start_0|>
if len(remote_addr) > 0:
if memcache.get('/ratelimit/' + remote_addr + '/' + action):
return False
else:
memcache.set('/ratelimit/' + remote_addr + '/' + action, True, ttl)
return True
status = memcache.get('/bl... | This library defines a data store that tracks blocked and trusted IP addresses, and provides a simple call to check to see if an IP address is either blocked or rate limited. This allows web service request handlers to block or throttle requests that are too frequent. For example, WWL does not rate limit reads from the... | ip | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ip:
"""This library defines a data store that tracks blocked and trusted IP addresses, and provides a simple call to check to see if an IP address is either blocked or rate limited. This allows web service request handlers to block or throttle requests that are too frequent. For example, WWL does... | stack_v2_sparse_classes_36k_train_000235 | 5,951 | no_license | [
{
"docstring": "Checks to see if a request from an IP address should be allowed or not. Expects remote_addr, and two optional parameters: action = label for the action or web service (e.g. submit_translation) ttl = time to live for rate limit (default = 1 second) Returns True (allow) or False (deny)",
"name... | 2 | stack_v2_sparse_classes_30k_train_016434 | Implement the Python class `ip` described below.
Class description:
This library defines a data store that tracks blocked and trusted IP addresses, and provides a simple call to check to see if an IP address is either blocked or rate limited. This allows web service request handlers to block or throttle requests that ... | Implement the Python class `ip` described below.
Class description:
This library defines a data store that tracks blocked and trusted IP addresses, and provides a simple call to check to see if an IP address is either blocked or rate limited. This allows web service request handlers to block or throttle requests that ... | 06f65ff465c4dc742e71c9d17ec04268762bc9f3 | <|skeleton|>
class ip:
"""This library defines a data store that tracks blocked and trusted IP addresses, and provides a simple call to check to see if an IP address is either blocked or rate limited. This allows web service request handlers to block or throttle requests that are too frequent. For example, WWL does... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ip:
"""This library defines a data store that tracks blocked and trusted IP addresses, and provides a simple call to check to see if an IP address is either blocked or rate limited. This allows web service request handlers to block or throttle requests that are too frequent. For example, WWL does not rate lim... | the_stack_v2_python_sparse | worldwidelexicon/widgets/wwlserver/ip.py | thiur/worldwidelexicon | train | 0 |
9361a03824c0138cb41ec7f82cabc2fc4137cdd2 | [
"if len(list) == 0:\n return None\nroot = TreeNode(list.pop(0))\nq = deque([root])\nwhile len(list) > 0:\n current_node = q.popleft()\n i = list.pop(0)\n if i:\n n = TreeNode(i)\n current_node.left = n\n q.append(n)\n if len(list) > 0:\n i = list.pop(0)\n if i:\n ... | <|body_start_0|>
if len(list) == 0:
return None
root = TreeNode(list.pop(0))
q = deque([root])
while len(list) > 0:
current_node = q.popleft()
i = list.pop(0)
if i:
n = TreeNode(i)
current_node.left = n
... | BSTHelper | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BSTHelper:
def listToBST(self, list):
""":type list: List[int] :rtype: TreeNode"""
<|body_0|>
def BSTtoList(self, root):
""":type root: TreeNode :rtype: List"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if len(list) == 0:
return None
... | stack_v2_sparse_classes_36k_train_000236 | 3,744 | no_license | [
{
"docstring": ":type list: List[int] :rtype: TreeNode",
"name": "listToBST",
"signature": "def listToBST(self, list)"
},
{
"docstring": ":type root: TreeNode :rtype: List",
"name": "BSTtoList",
"signature": "def BSTtoList(self, root)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001632 | Implement the Python class `BSTHelper` described below.
Class description:
Implement the BSTHelper class.
Method signatures and docstrings:
- def listToBST(self, list): :type list: List[int] :rtype: TreeNode
- def BSTtoList(self, root): :type root: TreeNode :rtype: List | Implement the Python class `BSTHelper` described below.
Class description:
Implement the BSTHelper class.
Method signatures and docstrings:
- def listToBST(self, list): :type list: List[int] :rtype: TreeNode
- def BSTtoList(self, root): :type root: TreeNode :rtype: List
<|skeleton|>
class BSTHelper:
def listToB... | a57282895fb213b68e5d81db301903721a92d80f | <|skeleton|>
class BSTHelper:
def listToBST(self, list):
""":type list: List[int] :rtype: TreeNode"""
<|body_0|>
def BSTtoList(self, root):
""":type root: TreeNode :rtype: List"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BSTHelper:
def listToBST(self, list):
""":type list: List[int] :rtype: TreeNode"""
if len(list) == 0:
return None
root = TreeNode(list.pop(0))
q = deque([root])
while len(list) > 0:
current_node = q.popleft()
i = list.pop(0)
... | the_stack_v2_python_sparse | Python/helper.py | antonylu/leetcode2 | train | 0 | |
571307be1e1d20222afe3cbe4527af5fcb38f445 | [
"try:\n return Member.objects.get(pk=pk)\nexcept Member.DoesNotExist:\n raise Http404",
"if pk is not None:\n member = self.get_member(int(pk))\nelse:\n member = None\nself.check_object_permissions(request, member)\nsecurity = SecurityArticle.get_members_securities(member=member)\nserializer = Securit... | <|body_start_0|>
try:
return Member.objects.get(pk=pk)
except Member.DoesNotExist:
raise Http404
<|end_body_0|>
<|body_start_1|>
if pk is not None:
member = self.get_member(int(pk))
else:
member = None
self.check_object_permissions... | LoanSecurityArticlesView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoanSecurityArticlesView:
def get_member(self, pk):
"""Get a member."""
<|body_0|>
def get(self, request, pk, format=None):
"""List Securities which are physical items --- serializer: loans.serializers.SecurityArticleSerializer"""
<|body_1|>
def post(sel... | stack_v2_sparse_classes_36k_train_000237 | 13,511 | no_license | [
{
"docstring": "Get a member.",
"name": "get_member",
"signature": "def get_member(self, pk)"
},
{
"docstring": "List Securities which are physical items --- serializer: loans.serializers.SecurityArticleSerializer",
"name": "get",
"signature": "def get(self, request, pk, format=None)"
... | 3 | stack_v2_sparse_classes_30k_train_011496 | Implement the Python class `LoanSecurityArticlesView` described below.
Class description:
Implement the LoanSecurityArticlesView class.
Method signatures and docstrings:
- def get_member(self, pk): Get a member.
- def get(self, request, pk, format=None): List Securities which are physical items --- serializer: loans.... | Implement the Python class `LoanSecurityArticlesView` described below.
Class description:
Implement the LoanSecurityArticlesView class.
Method signatures and docstrings:
- def get_member(self, pk): Get a member.
- def get(self, request, pk, format=None): List Securities which are physical items --- serializer: loans.... | c5ac11e40a628c93c3865363e97b4f255a104ca8 | <|skeleton|>
class LoanSecurityArticlesView:
def get_member(self, pk):
"""Get a member."""
<|body_0|>
def get(self, request, pk, format=None):
"""List Securities which are physical items --- serializer: loans.serializers.SecurityArticleSerializer"""
<|body_1|>
def post(sel... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LoanSecurityArticlesView:
def get_member(self, pk):
"""Get a member."""
try:
return Member.objects.get(pk=pk)
except Member.DoesNotExist:
raise Http404
def get(self, request, pk, format=None):
"""List Securities which are physical items --- serializ... | the_stack_v2_python_sparse | loans/views.py | lubegamark/gosacco | train | 2 | |
ba3fe3891cfaab36da0bf47caaf39ff4a5bf5e1f | [
"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. | ConnectionHandlerServicer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConnectionHandlerServicer:
"""Missing associated documentation comment in .proto file."""
def info(self, request, context):
"""Listens to incoming requests for expert computation"""
<|body_0|>
def forward(self, request, context):
"""Missing associated documentati... | stack_v2_sparse_classes_36k_train_000238 | 24,581 | no_license | [
{
"docstring": "Listens to incoming requests for expert computation",
"name": "info",
"signature": "def info(self, request, context)"
},
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "forward",
"signature": "def forward(self, request, context)"
},
... | 3 | stack_v2_sparse_classes_30k_train_009087 | Implement the Python class `ConnectionHandlerServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def info(self, request, context): Listens to incoming requests for expert computation
- def forward(self, request, context): Missing a... | Implement the Python class `ConnectionHandlerServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def info(self, request, context): Listens to incoming requests for expert computation
- def forward(self, request, context): Missing a... | 345bf7df822c4ae5cd9988ffdedae2fa5c1ffd99 | <|skeleton|>
class ConnectionHandlerServicer:
"""Missing associated documentation comment in .proto file."""
def info(self, request, context):
"""Listens to incoming requests for expert computation"""
<|body_0|>
def forward(self, request, context):
"""Missing associated documentati... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ConnectionHandlerServicer:
"""Missing associated documentation comment in .proto file."""
def info(self, request, context):
"""Listens to incoming requests for expert computation"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
... | the_stack_v2_python_sparse | grpc_pb2_grpc.py | isSPDL/SPDL | train | 3 |
3e87e2d274064f2e2dfc735ef04b0a3810c7106e | [
"res = self.r.set('user2', 'Amy')\nprint(res)\nreturn res",
"res = self.r.get('user2')\nprint(res)\nreturn res",
"d = {'user3': 'Tony', 'user4': 'Tom'}\nres = self.r.mset(d)\nprint(res)\nreturn res",
"l = ['user3', 'user4']\nres = self.r.mget(l)\nprint(res)\nreturn res",
"res = self.r.delete('user3')\nprint... | <|body_start_0|>
res = self.r.set('user2', 'Amy')
print(res)
return res
<|end_body_0|>
<|body_start_1|>
res = self.r.get('user2')
print(res)
return res
<|end_body_1|>
<|body_start_2|>
d = {'user3': 'Tony', 'user4': 'Tom'}
res = self.r.mset(d)
pri... | TestString | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestString:
def test_set(self):
"""set -- 设置值"""
<|body_0|>
def test_get(self):
"""get -- 设置值"""
<|body_1|>
def test_mset(self):
"""mset -- 多个键值对"""
<|body_2|>
def test_mget(self):
"""mget -- 多个键值对"""
<|body_3|>
... | stack_v2_sparse_classes_36k_train_000239 | 3,577 | no_license | [
{
"docstring": "set -- 设置值",
"name": "test_set",
"signature": "def test_set(self)"
},
{
"docstring": "get -- 设置值",
"name": "test_get",
"signature": "def test_get(self)"
},
{
"docstring": "mset -- 多个键值对",
"name": "test_mset",
"signature": "def test_mset(self)"
},
{
... | 5 | stack_v2_sparse_classes_30k_train_007665 | Implement the Python class `TestString` described below.
Class description:
Implement the TestString class.
Method signatures and docstrings:
- def test_set(self): set -- 设置值
- def test_get(self): get -- 设置值
- def test_mset(self): mset -- 多个键值对
- def test_mget(self): mget -- 多个键值对
- def test_del(self): del -- 删除 | Implement the Python class `TestString` described below.
Class description:
Implement the TestString class.
Method signatures and docstrings:
- def test_set(self): set -- 设置值
- def test_get(self): get -- 设置值
- def test_mset(self): mset -- 多个键值对
- def test_mget(self): mget -- 多个键值对
- def test_del(self): del -- 删除
<|s... | 9434557f8e6b85ff7fc8f4699b253b054910d869 | <|skeleton|>
class TestString:
def test_set(self):
"""set -- 设置值"""
<|body_0|>
def test_get(self):
"""get -- 设置值"""
<|body_1|>
def test_mset(self):
"""mset -- 多个键值对"""
<|body_2|>
def test_mget(self):
"""mget -- 多个键值对"""
<|body_3|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestString:
def test_set(self):
"""set -- 设置值"""
res = self.r.set('user2', 'Amy')
print(res)
return res
def test_get(self):
"""get -- 设置值"""
res = self.r.get('user2')
print(res)
return res
def test_mset(self):
"""mset -- 多个键值对""... | the_stack_v2_python_sparse | SQL/test_redis.py | 0Monster0/Python | train | 1 | |
ca0b3e85fbcdf38c17cf9450ed4ba8159bddd551 | [
"if instance is None:\n return self\nvalue = instance._new_values.get(self.field.attname, instance._values.get(self.field.attname))\nreturn value",
"if instance is None:\n raise Exception()\nif value is not None:\n instance._new_values[self.field.attname] = value"
] | <|body_start_0|>
if instance is None:
return self
value = instance._new_values.get(self.field.attname, instance._values.get(self.field.attname))
return value
<|end_body_0|>
<|body_start_1|>
if instance is None:
raise Exception()
if value is not None:
... | docstring for StringObject | StringObject | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StringObject:
"""docstring for StringObject"""
def __get__(self, instance, instance_type=None):
"""docstring for __get__"""
<|body_0|>
def __set__(self, instance, value):
"""docstring for __set__"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
i... | stack_v2_sparse_classes_36k_train_000240 | 907 | no_license | [
{
"docstring": "docstring for __get__",
"name": "__get__",
"signature": "def __get__(self, instance, instance_type=None)"
},
{
"docstring": "docstring for __set__",
"name": "__set__",
"signature": "def __set__(self, instance, value)"
}
] | 2 | stack_v2_sparse_classes_30k_train_019787 | Implement the Python class `StringObject` described below.
Class description:
docstring for StringObject
Method signatures and docstrings:
- def __get__(self, instance, instance_type=None): docstring for __get__
- def __set__(self, instance, value): docstring for __set__ | Implement the Python class `StringObject` described below.
Class description:
docstring for StringObject
Method signatures and docstrings:
- def __get__(self, instance, instance_type=None): docstring for __get__
- def __set__(self, instance, value): docstring for __set__
<|skeleton|>
class StringObject:
"""docst... | bdcc87a177f0ce5c292e1624e82fd61a71b1891f | <|skeleton|>
class StringObject:
"""docstring for StringObject"""
def __get__(self, instance, instance_type=None):
"""docstring for __get__"""
<|body_0|>
def __set__(self, instance, value):
"""docstring for __set__"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StringObject:
"""docstring for StringObject"""
def __get__(self, instance, instance_type=None):
"""docstring for __get__"""
if instance is None:
return self
value = instance._new_values.get(self.field.attname, instance._values.get(self.field.attname))
return va... | the_stack_v2_python_sparse | tornado_reloaded/db/orm/documents/fields/virtual.py | ohardy/tornado-reloaded | train | 0 |
a9975d8ed945689279b8df26cab2d165bfe7225b | [
"some_list_of_objects = copy.copy(self.some_list_of_objects)\nsome_circular_ref = copy.copy(self.some_circular_ref)\nnew = self.__class__(self.some_int, some_list_of_objects, some_circular_ref)\nnew.__dict__.update(self.__dict__)\nreturn new",
"some_list_of_objects = copy.deepcopy(self.some_list_of_objects, memo)... | <|body_start_0|>
some_list_of_objects = copy.copy(self.some_list_of_objects)
some_circular_ref = copy.copy(self.some_circular_ref)
new = self.__class__(self.some_int, some_list_of_objects, some_circular_ref)
new.__dict__.update(self.__dict__)
return new
<|end_body_0|>
<|body_sta... | Python provides its own interface of Prototype via `copy.copy` and `copy.deepcopy` functions. And any class that wants to implement custom implementations have to override `__copy__` and `__deepcopy__` member functions. | SomeComponent | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SomeComponent:
"""Python provides its own interface of Prototype via `copy.copy` and `copy.deepcopy` functions. And any class that wants to implement custom implementations have to override `__copy__` and `__deepcopy__` member functions."""
def __copy__(self) -> SomeComponent:
"""Cre... | stack_v2_sparse_classes_36k_train_000241 | 2,393 | no_license | [
{
"docstring": "Create a shallow copy. This method will be called whenever someone calls `copy.copy` with this object and the returned value is returned as the new shallow copy.",
"name": "__copy__",
"signature": "def __copy__(self) -> SomeComponent"
},
{
"docstring": "Create a deep copy. This m... | 2 | stack_v2_sparse_classes_30k_train_018927 | Implement the Python class `SomeComponent` described below.
Class description:
Python provides its own interface of Prototype via `copy.copy` and `copy.deepcopy` functions. And any class that wants to implement custom implementations have to override `__copy__` and `__deepcopy__` member functions.
Method signatures a... | Implement the Python class `SomeComponent` described below.
Class description:
Python provides its own interface of Prototype via `copy.copy` and `copy.deepcopy` functions. And any class that wants to implement custom implementations have to override `__copy__` and `__deepcopy__` member functions.
Method signatures a... | 04165c775796f7c5beab8eee8b867386685f4d89 | <|skeleton|>
class SomeComponent:
"""Python provides its own interface of Prototype via `copy.copy` and `copy.deepcopy` functions. And any class that wants to implement custom implementations have to override `__copy__` and `__deepcopy__` member functions."""
def __copy__(self) -> SomeComponent:
"""Cre... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SomeComponent:
"""Python provides its own interface of Prototype via `copy.copy` and `copy.deepcopy` functions. And any class that wants to implement custom implementations have to override `__copy__` and `__deepcopy__` member functions."""
def __copy__(self) -> SomeComponent:
"""Create a shallow... | the_stack_v2_python_sparse | creational/prototype/components.py | rjNemo/design-patterns | train | 1 |
8eac60ad69e7215271e1d35ee0d5a51f4a7283f9 | [
"stack, ret = ([], 0)\nfor p in prices:\n while stack and stack[-1] > p:\n stack.pop()\n if stack == []:\n stack.append(p)\n else:\n ret = max(ret, p - stack[-1])\nreturn ret",
"minPrice, maxProfit = (float('inf'), 0)\nfor i in xrange(len(prices)):\n minPrice = min(minPrice, price... | <|body_start_0|>
stack, ret = ([], 0)
for p in prices:
while stack and stack[-1] > p:
stack.pop()
if stack == []:
stack.append(p)
else:
ret = max(ret, p - stack[-1])
return ret
<|end_body_0|>
<|body_start_1|>
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxProfit(self, prices):
""":type prices: List[int] :rtype: int"""
<|body_0|>
def maxProfit(self, prices):
""":type prices: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
stack, ret = ([], 0)
for p in pri... | stack_v2_sparse_classes_36k_train_000242 | 892 | no_license | [
{
"docstring": ":type prices: List[int] :rtype: int",
"name": "maxProfit",
"signature": "def maxProfit(self, prices)"
},
{
"docstring": ":type prices: List[int] :rtype: int",
"name": "maxProfit",
"signature": "def maxProfit(self, prices)"
}
] | 2 | stack_v2_sparse_classes_30k_train_016558 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit(self, prices): :type prices: List[int] :rtype: int
- def maxProfit(self, prices): :type prices: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit(self, prices): :type prices: List[int] :rtype: int
- def maxProfit(self, prices): :type prices: List[int] :rtype: int
<|skeleton|>
class Solution:
def maxProf... | 1a0dbcabb0f454a4fdcc31af9b919f5d30664335 | <|skeleton|>
class Solution:
def maxProfit(self, prices):
""":type prices: List[int] :rtype: int"""
<|body_0|>
def maxProfit(self, prices):
""":type prices: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxProfit(self, prices):
""":type prices: List[int] :rtype: int"""
stack, ret = ([], 0)
for p in prices:
while stack and stack[-1] > p:
stack.pop()
if stack == []:
stack.append(p)
else:
re... | the_stack_v2_python_sparse | 121. Best Time to Buy and Sell Stock.py | haomingchan0811/Leetcode | train | 0 | |
f6cbc7185dc312d0d0442b61a7bb350016d42f82 | [
"canonicalTags = ORM().selectAll(self.tables['canonicalMetaTag'])\nres = []\nfor c in canonicalTags:\n trimname = removeCanon(c.name)\n res.append(trimname)\nreturn res",
"canonicalTags = ORM().selectAll(self.tables['canonicalMetaTag'])\nres = {}\nfor c in canonicalTags:\n trimname = removeCanon(c.name)\... | <|body_start_0|>
canonicalTags = ORM().selectAll(self.tables['canonicalMetaTag'])
res = []
for c in canonicalTags:
trimname = removeCanon(c.name)
res.append(trimname)
return res
<|end_body_0|>
<|body_start_1|>
canonicalTags = ORM().selectAll(self.tables['... | Topics | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Topics:
def getCanonicalTagsList(self) -> json:
"""Get all the canonical tags from DB and Returns a json obj. Returns ------- JSON { ..., tagName:Default value, ... }"""
<|body_0|>
def getCanonicalTagsJSON(self) -> json:
"""Get all the canonical tags from DB and Retu... | stack_v2_sparse_classes_36k_train_000243 | 1,620 | no_license | [
{
"docstring": "Get all the canonical tags from DB and Returns a json obj. Returns ------- JSON { ..., tagName:Default value, ... }",
"name": "getCanonicalTagsList",
"signature": "def getCanonicalTagsList(self) -> json"
},
{
"docstring": "Get all the canonical tags from DB and Returns a json obj... | 2 | null | Implement the Python class `Topics` described below.
Class description:
Implement the Topics class.
Method signatures and docstrings:
- def getCanonicalTagsList(self) -> json: Get all the canonical tags from DB and Returns a json obj. Returns ------- JSON { ..., tagName:Default value, ... }
- def getCanonicalTagsJSON... | Implement the Python class `Topics` described below.
Class description:
Implement the Topics class.
Method signatures and docstrings:
- def getCanonicalTagsList(self) -> json: Get all the canonical tags from DB and Returns a json obj. Returns ------- JSON { ..., tagName:Default value, ... }
- def getCanonicalTagsJSON... | 2dfc387e86928816fb2fdc5e300991cb9c1a3a36 | <|skeleton|>
class Topics:
def getCanonicalTagsList(self) -> json:
"""Get all the canonical tags from DB and Returns a json obj. Returns ------- JSON { ..., tagName:Default value, ... }"""
<|body_0|>
def getCanonicalTagsJSON(self) -> json:
"""Get all the canonical tags from DB and Retu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Topics:
def getCanonicalTagsList(self) -> json:
"""Get all the canonical tags from DB and Returns a json obj. Returns ------- JSON { ..., tagName:Default value, ... }"""
canonicalTags = ORM().selectAll(self.tables['canonicalMetaTag'])
res = []
for c in canonicalTags:
... | the_stack_v2_python_sparse | backend/ORM/Topics.py | MEC402/openpipe | train | 5 | |
83d9ef59e70f14a7f6f1ed9fbf3a6412f8ad5ec2 | [
"H = len(wall)\nWall = [[] for _ in range(H)]\nfor i, onelayer in enumerate(wall):\n k = 1\n for w in onelayer:\n while w:\n Wall[i].append(k)\n w -= 1\n k += 1\nif len(Wall[0]) == 1:\n return H\nCrossNums = [0 for _ in range(len(Wall[0]) - 1)]\nfor i in range(H):\n f... | <|body_start_0|>
H = len(wall)
Wall = [[] for _ in range(H)]
for i, onelayer in enumerate(wall):
k = 1
for w in onelayer:
while w:
Wall[i].append(k)
w -= 1
k += 1
if len(Wall[0]) == 1:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def leastBricks(self, wall) -> int:
"""差分,超时了 :param list[list[int]] wall: :return:"""
<|body_0|>
def leastBricks2(self, wall) -> int:
"""哈希表 :param wall: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
H = len(wall)
Wall ... | stack_v2_sparse_classes_36k_train_000244 | 2,218 | no_license | [
{
"docstring": "差分,超时了 :param list[list[int]] wall: :return:",
"name": "leastBricks",
"signature": "def leastBricks(self, wall) -> int"
},
{
"docstring": "哈希表 :param wall: :return:",
"name": "leastBricks2",
"signature": "def leastBricks2(self, wall) -> int"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def leastBricks(self, wall) -> int: 差分,超时了 :param list[list[int]] wall: :return:
- def leastBricks2(self, wall) -> int: 哈希表 :param wall: :return: | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def leastBricks(self, wall) -> int: 差分,超时了 :param list[list[int]] wall: :return:
- def leastBricks2(self, wall) -> int: 哈希表 :param wall: :return:
<|skeleton|>
class Solution:
... | 837957ea22aa07ce28a6c23ea0419bd2011e1f88 | <|skeleton|>
class Solution:
def leastBricks(self, wall) -> int:
"""差分,超时了 :param list[list[int]] wall: :return:"""
<|body_0|>
def leastBricks2(self, wall) -> int:
"""哈希表 :param wall: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def leastBricks(self, wall) -> int:
"""差分,超时了 :param list[list[int]] wall: :return:"""
H = len(wall)
Wall = [[] for _ in range(H)]
for i, onelayer in enumerate(wall):
k = 1
for w in onelayer:
while w:
Wall[i]... | the_stack_v2_python_sparse | 华为题库/砖墙.py | 2226171237/Algorithmpractice | train | 0 | |
4575da7efbafcaf7a2cac92eb2e5bb6fe03c0466 | [
"super(Physics2d, self).__init__()\nself.velocity = geometry.Point2d(0, 0)\nself.acceleration = geometry.Point2d(0, 0)\nself.friction = max(min(100, friction), 1)\nself._terminal_velocity = geometry.Point2d(*terminal_velocity)\nself._gravity = geometry.Point2d(*gravity)\nself.mass = mass\nself._velocity_1000 = self... | <|body_start_0|>
super(Physics2d, self).__init__()
self.velocity = geometry.Point2d(0, 0)
self.acceleration = geometry.Point2d(0, 0)
self.friction = max(min(100, friction), 1)
self._terminal_velocity = geometry.Point2d(*terminal_velocity)
self._gravity = geometry.Point2d(... | Simple two dimensional physics simulation. Attributes: mass (int): Mass of the object in arbitrary units. velocity (:obj:`engine.geometry.Point2d`): Velocity along the x and y axes in units per second. acceleration (:obj:`engine.geometry.Point2d`): Acceleration along the x and y axes in units per second. friction (int)... | Physics2d | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Physics2d:
"""Simple two dimensional physics simulation. Attributes: mass (int): Mass of the object in arbitrary units. velocity (:obj:`engine.geometry.Point2d`): Velocity along the x and y axes in units per second. acceleration (:obj:`engine.geometry.Point2d`): Acceleration along the x and y axe... | stack_v2_sparse_classes_36k_train_000245 | 4,374 | permissive | [
{
"docstring": "Creates a new two dimensional physics simulation. Args: mass (int, optional): Mass of the object in units. Defaults to 100. friction (int): Coefficient of friction between 1 and 100 when no acceleration is applied, to slow it to rest. Defaults to 100. gravity (tuple of int, optional): Gravitatio... | 4 | stack_v2_sparse_classes_30k_test_000624 | Implement the Python class `Physics2d` described below.
Class description:
Simple two dimensional physics simulation. Attributes: mass (int): Mass of the object in arbitrary units. velocity (:obj:`engine.geometry.Point2d`): Velocity along the x and y axes in units per second. acceleration (:obj:`engine.geometry.Point2... | Implement the Python class `Physics2d` described below.
Class description:
Simple two dimensional physics simulation. Attributes: mass (int): Mass of the object in arbitrary units. velocity (:obj:`engine.geometry.Point2d`): Velocity along the x and y axes in units per second. acceleration (:obj:`engine.geometry.Point2... | 7c19b8f09d298a55e4276bb959f0ac9bc8ea534a | <|skeleton|>
class Physics2d:
"""Simple two dimensional physics simulation. Attributes: mass (int): Mass of the object in arbitrary units. velocity (:obj:`engine.geometry.Point2d`): Velocity along the x and y axes in units per second. acceleration (:obj:`engine.geometry.Point2d`): Acceleration along the x and y axe... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Physics2d:
"""Simple two dimensional physics simulation. Attributes: mass (int): Mass of the object in arbitrary units. velocity (:obj:`engine.geometry.Point2d`): Velocity along the x and y axes in units per second. acceleration (:obj:`engine.geometry.Point2d`): Acceleration along the x and y axes in units pe... | the_stack_v2_python_sparse | engine/physics/physics_2d.py | codehearts/pickles-fetch-quest | train | 3 |
f27858792b6e6cf68845c93832c95f0d113f7ff5 | [
"self.idAtributo = idAtributo\nself.nombreAtributo = nombreAtributo\nself.tipoPrimarioId = tipoPrimarioId\nself.longitudCadena = longitudCadena",
"self.idAtributo = idAtributo\nself.nombreAtributo = nombreAtributo\nself.tipoPrimarioId = tipoPrimarioId\nself.longitudCadena = longitudCadena"
] | <|body_start_0|>
self.idAtributo = idAtributo
self.nombreAtributo = nombreAtributo
self.tipoPrimarioId = tipoPrimarioId
self.longitudCadena = longitudCadena
<|end_body_0|>
<|body_start_1|>
self.idAtributo = idAtributo
self.nombreAtributo = nombreAtributo
self.tip... | Esta clase se utiliza para mapear a sus instancias con la tabla de ATRIBUTOS Hereda de la clase Base. La clase Base debe ser heredada por todas las clases que mapearan a una tabla. | Atributos | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Atributos:
"""Esta clase se utiliza para mapear a sus instancias con la tabla de ATRIBUTOS Hereda de la clase Base. La clase Base debe ser heredada por todas las clases que mapearan a una tabla."""
def setValues(self, idAtributo, nombreAtributo, tipoPrimarioId, longitudCadena):
"""Me... | stack_v2_sparse_classes_36k_train_000246 | 2,935 | no_license | [
{
"docstring": "Metodo para establecer valores de atributos de la clase. @type idAtributo : number @param idAtributo : id del atributo @type nombreAtributo : string @param nombreAtributo : nombre del atributo @type tipoPrimarioId : number @param tipoPrimarioId : id del tipo primario del cual hereda el atributo ... | 2 | null | Implement the Python class `Atributos` described below.
Class description:
Esta clase se utiliza para mapear a sus instancias con la tabla de ATRIBUTOS Hereda de la clase Base. La clase Base debe ser heredada por todas las clases que mapearan a una tabla.
Method signatures and docstrings:
- def setValues(self, idAtri... | Implement the Python class `Atributos` described below.
Class description:
Esta clase se utiliza para mapear a sus instancias con la tabla de ATRIBUTOS Hereda de la clase Base. La clase Base debe ser heredada por todas las clases que mapearan a una tabla.
Method signatures and docstrings:
- def setValues(self, idAtri... | 9262320d4ff52bd3592365cd232f8dedff4f64da | <|skeleton|>
class Atributos:
"""Esta clase se utiliza para mapear a sus instancias con la tabla de ATRIBUTOS Hereda de la clase Base. La clase Base debe ser heredada por todas las clases que mapearan a una tabla."""
def setValues(self, idAtributo, nombreAtributo, tipoPrimarioId, longitudCadena):
"""Me... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Atributos:
"""Esta clase se utiliza para mapear a sus instancias con la tabla de ATRIBUTOS Hereda de la clase Base. La clase Base debe ser heredada por todas las clases que mapearan a una tabla."""
def setValues(self, idAtributo, nombreAtributo, tipoPrimarioId, longitudCadena):
"""Metodo para est... | the_stack_v2_python_sparse | models/atributosModelo.py | jemaromaster/WAPM | train | 0 |
895befa066f816fa655d81edc6cdbd31d105eda6 | [
"from nltk.corpus import stopwords\nself.nlp = spacy.load('en_core_web_lg')\nself.class_names = class_names\nself.use_unk_distribution = True\nself.tg = None\nself.mask_string = mask_string\nself.stopwords = stopwords.words('english') + list(string.punctuation)",
"true_label = classifier_fn([text])[0]\nprocessed ... | <|body_start_0|>
from nltk.corpus import stopwords
self.nlp = spacy.load('en_core_web_lg')
self.class_names = class_names
self.use_unk_distribution = True
self.tg = None
self.mask_string = mask_string
self.stopwords = stopwords.words('english') + list(string.punct... | AnchorText | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AnchorText:
def __init__(self, class_names=('Negative', 'Positive'), mask_string='UNK'):
"""AnchorText instance to find a string's anchor for a given model prediction function. Args: class_names (tuple or list): list of strings mask_string (string): String used to mask tokens if use_unk_... | stack_v2_sparse_classes_36k_train_000247 | 11,311 | permissive | [
{
"docstring": "AnchorText instance to find a string's anchor for a given model prediction function. Args: class_names (tuple or list): list of strings mask_string (string): String used to mask tokens if use_unk_distribution is True.",
"name": "__init__",
"signature": "def __init__(self, class_names=('N... | 3 | stack_v2_sparse_classes_30k_train_015255 | Implement the Python class `AnchorText` described below.
Class description:
Implement the AnchorText class.
Method signatures and docstrings:
- def __init__(self, class_names=('Negative', 'Positive'), mask_string='UNK'): AnchorText instance to find a string's anchor for a given model prediction function. Args: class_... | Implement the Python class `AnchorText` described below.
Class description:
Implement the AnchorText class.
Method signatures and docstrings:
- def __init__(self, class_names=('Negative', 'Positive'), mask_string='UNK'): AnchorText instance to find a string's anchor for a given model prediction function. Args: class_... | 1e44de66901e316a9b953a6f8ef05c49f963ab63 | <|skeleton|>
class AnchorText:
def __init__(self, class_names=('Negative', 'Positive'), mask_string='UNK'):
"""AnchorText instance to find a string's anchor for a given model prediction function. Args: class_names (tuple or list): list of strings mask_string (string): String used to mask tokens if use_unk_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AnchorText:
def __init__(self, class_names=('Negative', 'Positive'), mask_string='UNK'):
"""AnchorText instance to find a string's anchor for a given model prediction function. Args: class_names (tuple or list): list of strings mask_string (string): String used to mask tokens if use_unk_distribution i... | the_stack_v2_python_sparse | anchor/anchor_text.py | kartikparnami/explainable_ai | train | 2 | |
0c4c0da9c7bd22492357149030214fce661c7e25 | [
"listr = Category.objects.all().order_by('id')\nresults = self.paginate_queryset(listr, request)\nserializer = self.serializer(results, many=True)\nreturn self.get_paginated_response(serializer.data)",
"response = self.serializer(data=request.data)\nif response.is_valid():\n response.save()\n return Respons... | <|body_start_0|>
listr = Category.objects.all().order_by('id')
results = self.paginate_queryset(listr, request)
serializer = self.serializer(results, many=True)
return self.get_paginated_response(serializer.data)
<|end_body_0|>
<|body_start_1|>
response = self.serializer(data=re... | ... | VCategoryList | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VCategoryList:
"""..."""
def get(self, request, format=None):
"""..."""
<|body_0|>
def post(self, request, format=None):
"""..."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
listr = Category.objects.all().order_by('id')
results = self.... | stack_v2_sparse_classes_36k_train_000248 | 2,534 | permissive | [
{
"docstring": "...",
"name": "get",
"signature": "def get(self, request, format=None)"
},
{
"docstring": "...",
"name": "post",
"signature": "def post(self, request, format=None)"
}
] | 2 | stack_v2_sparse_classes_30k_train_009285 | Implement the Python class `VCategoryList` described below.
Class description:
...
Method signatures and docstrings:
- def get(self, request, format=None): ...
- def post(self, request, format=None): ... | Implement the Python class `VCategoryList` described below.
Class description:
...
Method signatures and docstrings:
- def get(self, request, format=None): ...
- def post(self, request, format=None): ...
<|skeleton|>
class VCategoryList:
"""..."""
def get(self, request, format=None):
"""..."""
... | 660664ba2321499e92c3c5c23719756db2569e90 | <|skeleton|>
class VCategoryList:
"""..."""
def get(self, request, format=None):
"""..."""
<|body_0|>
def post(self, request, format=None):
"""..."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VCategoryList:
"""..."""
def get(self, request, format=None):
"""..."""
listr = Category.objects.all().order_by('id')
results = self.paginate_queryset(listr, request)
serializer = self.serializer(results, many=True)
return self.get_paginated_response(serializer.dat... | the_stack_v2_python_sparse | apps/category/views/vcategory.py | magocod/djrepo | train | 1 |
75dfe9dce4b26a525c35a88293e6bccd2fef27e4 | [
"for i in range(len(alist) - 1, 0, -1):\n for j in range(i):\n if alist[j] > alist[j + 1]:\n alist[j], alist[j + 1] = (alist[j + 1], alist[j])",
"for i in range(1, len(alist)):\n for j in range(i, 0, -1):\n if alist[j] < alist[j - 1]:\n alist[j], alist[j - 1] = (alist[j -... | <|body_start_0|>
for i in range(len(alist) - 1, 0, -1):
for j in range(i):
if alist[j] > alist[j + 1]:
alist[j], alist[j + 1] = (alist[j + 1], alist[j])
<|end_body_0|>
<|body_start_1|>
for i in range(1, len(alist)):
for j in range(i, 0, -1):
... | Sorts | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Sorts:
def bubble_sort(self, alist):
"""冒泡排序"""
<|body_0|>
def insert_sort(self, alist):
"""插入排序"""
<|body_1|>
def select_sort(self, alist):
"""选择排序"""
<|body_2|>
def shell_sort(self, alist):
"""希尔排序,一种特殊的插入排序"""
<|bo... | stack_v2_sparse_classes_36k_train_000249 | 2,487 | no_license | [
{
"docstring": "冒泡排序",
"name": "bubble_sort",
"signature": "def bubble_sort(self, alist)"
},
{
"docstring": "插入排序",
"name": "insert_sort",
"signature": "def insert_sort(self, alist)"
},
{
"docstring": "选择排序",
"name": "select_sort",
"signature": "def select_sort(self, alis... | 6 | null | Implement the Python class `Sorts` described below.
Class description:
Implement the Sorts class.
Method signatures and docstrings:
- def bubble_sort(self, alist): 冒泡排序
- def insert_sort(self, alist): 插入排序
- def select_sort(self, alist): 选择排序
- def shell_sort(self, alist): 希尔排序,一种特殊的插入排序
- def merge_sort(self, alist)... | Implement the Python class `Sorts` described below.
Class description:
Implement the Sorts class.
Method signatures and docstrings:
- def bubble_sort(self, alist): 冒泡排序
- def insert_sort(self, alist): 插入排序
- def select_sort(self, alist): 选择排序
- def shell_sort(self, alist): 希尔排序,一种特殊的插入排序
- def merge_sort(self, alist)... | 7e82422c84ad699805cc12568b8d3d969f66a419 | <|skeleton|>
class Sorts:
def bubble_sort(self, alist):
"""冒泡排序"""
<|body_0|>
def insert_sort(self, alist):
"""插入排序"""
<|body_1|>
def select_sort(self, alist):
"""选择排序"""
<|body_2|>
def shell_sort(self, alist):
"""希尔排序,一种特殊的插入排序"""
<|bo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Sorts:
def bubble_sort(self, alist):
"""冒泡排序"""
for i in range(len(alist) - 1, 0, -1):
for j in range(i):
if alist[j] > alist[j + 1]:
alist[j], alist[j + 1] = (alist[j + 1], alist[j])
def insert_sort(self, alist):
"""插入排序"""
... | the_stack_v2_python_sparse | Algorithms/Python/sorts.py | mrmenand/Py_transaction | train | 1 | |
2f15e4c6afca9831d2924e39c0da2a635636e2bf | [
"l_id = 0\nproduction_obj = self.env['stock.production.lot']\nfor line in self:\n if line.production_lot_id:\n continue\n l_id += 1\n name = line.order_id and str(line.order_id.name) + '/%02d' % (l_id,) or False\n product_id = line.product_id and line.product_id.id or False\n production_lot_di... | <|body_start_0|>
l_id = 0
production_obj = self.env['stock.production.lot']
for line in self:
if line.production_lot_id:
continue
l_id += 1
name = line.order_id and str(line.order_id.name) + '/%02d' % (l_id,) or False
product_id = l... | SaleOrderLine | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SaleOrderLine:
def button_confirm(self):
"""This method confirm order. @param self : Object Pointer @param cr : Database Cursor @param uid : Current Logged in User @param ids : Current Records @param context : standard Dictionary @return : True"""
<|body_0|>
def copy(self, d... | stack_v2_sparse_classes_36k_train_000250 | 8,401 | no_license | [
{
"docstring": "This method confirm order. @param self : Object Pointer @param cr : Database Cursor @param uid : Current Logged in User @param ids : Current Records @param context : standard Dictionary @return : True",
"name": "button_confirm",
"signature": "def button_confirm(self)"
},
{
"docst... | 2 | stack_v2_sparse_classes_30k_train_017528 | Implement the Python class `SaleOrderLine` described below.
Class description:
Implement the SaleOrderLine class.
Method signatures and docstrings:
- def button_confirm(self): This method confirm order. @param self : Object Pointer @param cr : Database Cursor @param uid : Current Logged in User @param ids : Current R... | Implement the Python class `SaleOrderLine` described below.
Class description:
Implement the SaleOrderLine class.
Method signatures and docstrings:
- def button_confirm(self): This method confirm order. @param self : Object Pointer @param cr : Database Cursor @param uid : Current Logged in User @param ids : Current R... | f6f6cd847072b5b6b5cc4f729e019a83db8e01b6 | <|skeleton|>
class SaleOrderLine:
def button_confirm(self):
"""This method confirm order. @param self : Object Pointer @param cr : Database Cursor @param uid : Current Logged in User @param ids : Current Records @param context : standard Dictionary @return : True"""
<|body_0|>
def copy(self, d... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SaleOrderLine:
def button_confirm(self):
"""This method confirm order. @param self : Object Pointer @param cr : Database Cursor @param uid : Current Logged in User @param ids : Current Records @param context : standard Dictionary @return : True"""
l_id = 0
production_obj = self.env['st... | the_stack_v2_python_sparse | library/models/sale.py | chaudharitejaskumar/OdooEduERP | train | 0 | |
d9b0933561881e6b13c2e17cd335a6cd4338af21 | [
"super(ContentMetadata, self).__init__(auth)\nself.id = testXMLValue(elem.find(nspath('Name')))\nself.title = testXMLValue(elem.find(nspath('Title')))\nself.abstract = testXMLValue(elem.find(nspath('Abstract')))\nself.keywords = [f.text for f in elem.findall(nspath('Keywords'))]\nself.boundingBox = None\nb = elem.f... | <|body_start_0|>
super(ContentMetadata, self).__init__(auth)
self.id = testXMLValue(elem.find(nspath('Name')))
self.title = testXMLValue(elem.find(nspath('Title')))
self.abstract = testXMLValue(elem.find(nspath('Abstract')))
self.keywords = [f.text for f in elem.findall(nspath('K... | 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, parent, parse_remote_metadata=False, timeout=30, auth=None):
"""."""
<|body_0|>
def parse_remote_metadata(self, timeout=30):
"""Parse remote metadata for MetadataU... | stack_v2_sparse_classes_36k_train_000251 | 16,493 | permissive | [
{
"docstring": ".",
"name": "__init__",
"signature": "def __init__(self, elem, parent, parse_remote_metadata=False, timeout=30, auth=None)"
},
{
"docstring": "Parse remote metadata for MetadataURL of format 'XML' and add it as metadataUrl['metadata']",
"name": "parse_remote_metadata",
"s... | 2 | stack_v2_sparse_classes_30k_train_011492 | Implement the Python class `ContentMetadata` described below.
Class description:
Abstraction for WFS metadata. Implements IMetadata.
Method signatures and docstrings:
- def __init__(self, elem, parent, parse_remote_metadata=False, timeout=30, auth=None): .
- def parse_remote_metadata(self, timeout=30): Parse remote m... | Implement the Python class `ContentMetadata` described below.
Class description:
Abstraction for WFS metadata. Implements IMetadata.
Method signatures and docstrings:
- def __init__(self, elem, parent, parse_remote_metadata=False, timeout=30, auth=None): .
- def parse_remote_metadata(self, timeout=30): Parse remote m... | 94b68c3a497978404edf486140138e4b9e340aba | <|skeleton|>
class ContentMetadata:
"""Abstraction for WFS metadata. Implements IMetadata."""
def __init__(self, elem, parent, parse_remote_metadata=False, timeout=30, auth=None):
"""."""
<|body_0|>
def parse_remote_metadata(self, timeout=30):
"""Parse remote metadata for MetadataU... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ContentMetadata:
"""Abstraction for WFS metadata. Implements IMetadata."""
def __init__(self, elem, parent, parse_remote_metadata=False, timeout=30, auth=None):
"""."""
super(ContentMetadata, self).__init__(auth)
self.id = testXMLValue(elem.find(nspath('Name')))
self.title... | the_stack_v2_python_sparse | owslib/feature/wfs100.py | bird-house/OWSLib | train | 2 |
2a95dfd07ea120f40abcd5e593fbefcac7a611e7 | [
"if pRoot1 == None or pRoot2 == None:\n return False\nres = self.SubTree(pRoot1, pRoot2) or self.HasSubtree(pRoot1.left, pRoot2) or self.HasSubtree(pRoot1.right, pRoot2)\nreturn res",
"if pRoot2 == None:\n return True\nif pRoot1 == None:\n return False\nif pRoot1.val != pRoot2.val:\n return False\nret... | <|body_start_0|>
if pRoot1 == None or pRoot2 == None:
return False
res = self.SubTree(pRoot1, pRoot2) or self.HasSubtree(pRoot1.left, pRoot2) or self.HasSubtree(pRoot1.right, pRoot2)
return res
<|end_body_0|>
<|body_start_1|>
if pRoot2 == None:
return True
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def HasSubtree(self, pRoot1, pRoot2):
"""判断pRoot2是否是pRoot1的子结构"""
<|body_0|>
def SubTree(self, pRoot1, pRoot2):
"""查找B树根节点在A树中的位置,并返回"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if pRoot1 == None or pRoot2 == None:
return F... | stack_v2_sparse_classes_36k_train_000252 | 1,539 | no_license | [
{
"docstring": "判断pRoot2是否是pRoot1的子结构",
"name": "HasSubtree",
"signature": "def HasSubtree(self, pRoot1, pRoot2)"
},
{
"docstring": "查找B树根节点在A树中的位置,并返回",
"name": "SubTree",
"signature": "def SubTree(self, pRoot1, pRoot2)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def HasSubtree(self, pRoot1, pRoot2): 判断pRoot2是否是pRoot1的子结构
- def SubTree(self, pRoot1, pRoot2): 查找B树根节点在A树中的位置,并返回 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def HasSubtree(self, pRoot1, pRoot2): 判断pRoot2是否是pRoot1的子结构
- def SubTree(self, pRoot1, pRoot2): 查找B树根节点在A树中的位置,并返回
<|skeleton|>
class Solution:
def HasSubtree(self, pRoot1... | 154f53d0eeeceb2f07f330ae407d4590840fe5ca | <|skeleton|>
class Solution:
def HasSubtree(self, pRoot1, pRoot2):
"""判断pRoot2是否是pRoot1的子结构"""
<|body_0|>
def SubTree(self, pRoot1, pRoot2):
"""查找B树根节点在A树中的位置,并返回"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def HasSubtree(self, pRoot1, pRoot2):
"""判断pRoot2是否是pRoot1的子结构"""
if pRoot1 == None or pRoot2 == None:
return False
res = self.SubTree(pRoot1, pRoot2) or self.HasSubtree(pRoot1.left, pRoot2) or self.HasSubtree(pRoot1.right, pRoot2)
return res
def SubT... | the_stack_v2_python_sparse | 剑指offer/HasSubtree.py | EchoLLLiu/OtherCodes | train | 0 | |
27671b9a09b3a6a82187012ba38f8193b9fbcb0c | [
"super().__init__(coordinator, entry, type_id)\nif description.name == UNDEFINED:\n self._attr_has_entity_name = True\nelse:\n self._attr_name = f'{self.product} {description.name}'\nself._attr_unique_id = f'{entry.unique_id}_{description.key}{description.sep_key}{description.subkey}'\nself.entity_description... | <|body_start_0|>
super().__init__(coordinator, entry, type_id)
if description.name == UNDEFINED:
self._attr_has_entity_name = True
else:
self._attr_name = f'{self.product} {description.name}'
self._attr_unique_id = f'{entry.unique_id}_{description.key}{description... | Define a QNAP QSW sensor. | QswSensor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QswSensor:
"""Define a QNAP QSW sensor."""
def __init__(self, coordinator: QswDataCoordinator, description: QswSensorEntityDescription, entry: ConfigEntry, type_id: int | None=None) -> None:
"""Initialize."""
<|body_0|>
def _async_update_attrs(self) -> None:
"""U... | stack_v2_sparse_classes_36k_train_000253 | 12,861 | permissive | [
{
"docstring": "Initialize.",
"name": "__init__",
"signature": "def __init__(self, coordinator: QswDataCoordinator, description: QswSensorEntityDescription, entry: ConfigEntry, type_id: int | None=None) -> None"
},
{
"docstring": "Update sensor attributes.",
"name": "_async_update_attrs",
... | 2 | null | Implement the Python class `QswSensor` described below.
Class description:
Define a QNAP QSW sensor.
Method signatures and docstrings:
- def __init__(self, coordinator: QswDataCoordinator, description: QswSensorEntityDescription, entry: ConfigEntry, type_id: int | None=None) -> None: Initialize.
- def _async_update_a... | Implement the Python class `QswSensor` described below.
Class description:
Define a QNAP QSW sensor.
Method signatures and docstrings:
- def __init__(self, coordinator: QswDataCoordinator, description: QswSensorEntityDescription, entry: ConfigEntry, type_id: int | None=None) -> None: Initialize.
- def _async_update_a... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class QswSensor:
"""Define a QNAP QSW sensor."""
def __init__(self, coordinator: QswDataCoordinator, description: QswSensorEntityDescription, entry: ConfigEntry, type_id: int | None=None) -> None:
"""Initialize."""
<|body_0|>
def _async_update_attrs(self) -> None:
"""U... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class QswSensor:
"""Define a QNAP QSW sensor."""
def __init__(self, coordinator: QswDataCoordinator, description: QswSensorEntityDescription, entry: ConfigEntry, type_id: int | None=None) -> None:
"""Initialize."""
super().__init__(coordinator, entry, type_id)
if description.name == UND... | the_stack_v2_python_sparse | homeassistant/components/qnap_qsw/sensor.py | home-assistant/core | train | 35,501 |
83224375e428d9e79a21169de8e6b20beb15a880 | [
"with open('data_layer/data_files/profits.csv', 'a+', encoding='utf-8', newline='') as file_stream:\n csv_writer = csv.writer(file_stream)\n csv_writer.writerow(a_list)",
"ret_list = []\nwith open('data_layer/data_files/profits.csv', 'r', encoding='utf-8') as file_stream:\n csv_reader = csv.DictReader(fi... | <|body_start_0|>
with open('data_layer/data_files/profits.csv', 'a+', encoding='utf-8', newline='') as file_stream:
csv_writer = csv.writer(file_stream)
csv_writer.writerow(a_list)
<|end_body_0|>
<|body_start_1|>
ret_list = []
with open('data_layer/data_files/profits.csv... | ProfitsData | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProfitsData:
def add_profits(self, a_list):
"""Writes profit logs in DB"""
<|body_0|>
def get_profits(self):
"""Returns Profits intstances to logic"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
with open('data_layer/data_files/profits.csv', 'a+', ... | stack_v2_sparse_classes_36k_train_000254 | 853 | no_license | [
{
"docstring": "Writes profit logs in DB",
"name": "add_profits",
"signature": "def add_profits(self, a_list)"
},
{
"docstring": "Returns Profits intstances to logic",
"name": "get_profits",
"signature": "def get_profits(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_013785 | Implement the Python class `ProfitsData` described below.
Class description:
Implement the ProfitsData class.
Method signatures and docstrings:
- def add_profits(self, a_list): Writes profit logs in DB
- def get_profits(self): Returns Profits intstances to logic | Implement the Python class `ProfitsData` described below.
Class description:
Implement the ProfitsData class.
Method signatures and docstrings:
- def add_profits(self, a_list): Writes profit logs in DB
- def get_profits(self): Returns Profits intstances to logic
<|skeleton|>
class ProfitsData:
def add_profits(s... | 917c6c6c29ac998e58a4f9807f63e660a1b2bf54 | <|skeleton|>
class ProfitsData:
def add_profits(self, a_list):
"""Writes profit logs in DB"""
<|body_0|>
def get_profits(self):
"""Returns Profits intstances to logic"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProfitsData:
def add_profits(self, a_list):
"""Writes profit logs in DB"""
with open('data_layer/data_files/profits.csv', 'a+', encoding='utf-8', newline='') as file_stream:
csv_writer = csv.writer(file_stream)
csv_writer.writerow(a_list)
def get_profits(self):
... | the_stack_v2_python_sparse | src/data_layer/profits_data.py | ThorRafnar/NaNAirCarRental | train | 0 | |
0fba9f65f0fb643150b9c1f3b1dd0c914f0dac1a | [
"super().__init__()\nself.fm = FMLayer(fm_dropout_p)\ncat_size = num_fields + embed_size\nself.deep = DNNLayer(inputs_size=cat_size, output_size=deep_output_size, layer_sizes=deep_layer_sizes, dropout_p=deep_dropout_p, activation=deep_activation)",
"feat_inputs.names = ('B', 'N', 'E')\nif feat_inputs.dim() == 2:\... | <|body_start_0|>
super().__init__()
self.fm = FMLayer(fm_dropout_p)
cat_size = num_fields + embed_size
self.deep = DNNLayer(inputs_size=cat_size, output_size=deep_output_size, layer_sizes=deep_layer_sizes, dropout_p=deep_dropout_p, activation=deep_activation)
<|end_body_0|>
<|body_start... | Model class of Factorization Machine supported Neural Network (FMNN). Factorization Machine supported Neural Network is a stack of Factorization Machine and Dense Network, with the following calculation: #. Calculate features interactions by factorization machine: :math:`y_{FM} = \\text{Sigmoid} ( w_{0} + \\sum_{i=1}^{... | FactorizationMachineSupportedNeuralNetworkModel | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FactorizationMachineSupportedNeuralNetworkModel:
"""Model class of Factorization Machine supported Neural Network (FMNN). Factorization Machine supported Neural Network is a stack of Factorization Machine and Dense Network, with the following calculation: #. Calculate features interactions by fac... | stack_v2_sparse_classes_36k_train_000255 | 4,034 | permissive | [
{
"docstring": "Initialize FactorizationMachineSupportedNeuralNetworkModel Args: embed_size (int): size of embedding tensor num_fields (int): number of inputs' fields deep_output_size (int): output size of dense network deep_layer_sizes (List[int]): layer sizes of dense network fm_dropout_p (float, optional): p... | 2 | stack_v2_sparse_classes_30k_train_019711 | Implement the Python class `FactorizationMachineSupportedNeuralNetworkModel` described below.
Class description:
Model class of Factorization Machine supported Neural Network (FMNN). Factorization Machine supported Neural Network is a stack of Factorization Machine and Dense Network, with the following calculation: #.... | Implement the Python class `FactorizationMachineSupportedNeuralNetworkModel` described below.
Class description:
Model class of Factorization Machine supported Neural Network (FMNN). Factorization Machine supported Neural Network is a stack of Factorization Machine and Dense Network, with the following calculation: #.... | 751a43b9cd35e951d81c0d9cf46507b1777bb7ff | <|skeleton|>
class FactorizationMachineSupportedNeuralNetworkModel:
"""Model class of Factorization Machine supported Neural Network (FMNN). Factorization Machine supported Neural Network is a stack of Factorization Machine and Dense Network, with the following calculation: #. Calculate features interactions by fac... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FactorizationMachineSupportedNeuralNetworkModel:
"""Model class of Factorization Machine supported Neural Network (FMNN). Factorization Machine supported Neural Network is a stack of Factorization Machine and Dense Network, with the following calculation: #. Calculate features interactions by factorization ma... | the_stack_v2_python_sparse | torecsys/models/ctr/factorization_machine_supported_neural_network.py | p768lwy3/torecsys | train | 98 |
5e8b9932734bec2eac26839189e7c997956ec95b | [
"if request.version == 'v6':\n return self.retrieve_impl(request, file_id)\nelif request.version == 'v7':\n return self.retrieve_impl(request, file_id)\nraise Http404()",
"try:\n scale_file = ScaleFile.objects.get_details(file_id)\nexcept ScaleFile.DoesNotExist:\n raise Http404\nserializer = self.get_... | <|body_start_0|>
if request.version == 'v6':
return self.retrieve_impl(request, file_id)
elif request.version == 'v7':
return self.retrieve_impl(request, file_id)
raise Http404()
<|end_body_0|>
<|body_start_1|>
try:
scale_file = ScaleFile.objects.get_... | This view is the endpoint for retrieving details of a scale file. | FileDetailsView | [
"LicenseRef-scancode-free-unknown",
"Apache-2.0",
"LicenseRef-scancode-public-domain"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FileDetailsView:
"""This view is the endpoint for retrieving details of a scale file."""
def retrieve(self, request, file_id):
"""Determine api version and call specific method :param request: the HTTP POST request :type request: :class:`rest_framework.request.Request` :param file_id... | stack_v2_sparse_classes_36k_train_000256 | 19,677 | permissive | [
{
"docstring": "Determine api version and call specific method :param request: the HTTP POST request :type request: :class:`rest_framework.request.Request` :param file_id: The id of the file :type file_id: int encoded as a string :rtype: :class:`rest_framework.response.Response` :returns: the HTTP response to s... | 2 | stack_v2_sparse_classes_30k_train_017883 | Implement the Python class `FileDetailsView` described below.
Class description:
This view is the endpoint for retrieving details of a scale file.
Method signatures and docstrings:
- def retrieve(self, request, file_id): Determine api version and call specific method :param request: the HTTP POST request :type reques... | Implement the Python class `FileDetailsView` described below.
Class description:
This view is the endpoint for retrieving details of a scale file.
Method signatures and docstrings:
- def retrieve(self, request, file_id): Determine api version and call specific method :param request: the HTTP POST request :type reques... | 28618aee07ceed9e4a6eb7b8d0e6f05b31d8fd6b | <|skeleton|>
class FileDetailsView:
"""This view is the endpoint for retrieving details of a scale file."""
def retrieve(self, request, file_id):
"""Determine api version and call specific method :param request: the HTTP POST request :type request: :class:`rest_framework.request.Request` :param file_id... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FileDetailsView:
"""This view is the endpoint for retrieving details of a scale file."""
def retrieve(self, request, file_id):
"""Determine api version and call specific method :param request: the HTTP POST request :type request: :class:`rest_framework.request.Request` :param file_id: The id of t... | the_stack_v2_python_sparse | scale/storage/views.py | kfconsultant/scale | train | 0 |
812086507e7293963b8fc0c0ba4e50a9206bba7b | [
"degree = {}\nfor G in stream:\n G_degrees = nx.degree(G)\n for node, value in G_degrees:\n if node not in degree:\n degree[node] = {value: 1}\n else:\n degree[node][value] = degree[node].get(value, 0) + 1\nreturn degree",
"degrees = self.get_degree_profile(stream)\nresul... | <|body_start_0|>
degree = {}
for G in stream:
G_degrees = nx.degree(G)
for node, value in G_degrees:
if node not in degree:
degree[node] = {value: 1}
else:
degree[node][value] = degree[node].get(value, 0) + 1... | Naive algorithm for node importance calculation. | NaiveImportance | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NaiveImportance:
"""Naive algorithm for node importance calculation."""
def get_degree_profile(self, stream):
"""Construct node profiles. Params ------ stream : TrajectoryStream The input data stream of ParticleStream objects"""
<|body_0|>
def get_importance(self, stream... | stack_v2_sparse_classes_36k_train_000257 | 1,538 | no_license | [
{
"docstring": "Construct node profiles. Params ------ stream : TrajectoryStream The input data stream of ParticleStream objects",
"name": "get_degree_profile",
"signature": "def get_degree_profile(self, stream)"
},
{
"docstring": "Calculate node importance metrics for input data. Params ------ ... | 2 | stack_v2_sparse_classes_30k_train_010975 | Implement the Python class `NaiveImportance` described below.
Class description:
Naive algorithm for node importance calculation.
Method signatures and docstrings:
- def get_degree_profile(self, stream): Construct node profiles. Params ------ stream : TrajectoryStream The input data stream of ParticleStream objects
-... | Implement the Python class `NaiveImportance` described below.
Class description:
Naive algorithm for node importance calculation.
Method signatures and docstrings:
- def get_degree_profile(self, stream): Construct node profiles. Params ------ stream : TrajectoryStream The input data stream of ParticleStream objects
-... | 0394980efc628bfedd4fd504079a534418cbb89a | <|skeleton|>
class NaiveImportance:
"""Naive algorithm for node importance calculation."""
def get_degree_profile(self, stream):
"""Construct node profiles. Params ------ stream : TrajectoryStream The input data stream of ParticleStream objects"""
<|body_0|>
def get_importance(self, stream... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NaiveImportance:
"""Naive algorithm for node importance calculation."""
def get_degree_profile(self, stream):
"""Construct node profiles. Params ------ stream : TrajectoryStream The input data stream of ParticleStream objects"""
degree = {}
for G in stream:
G_degrees =... | the_stack_v2_python_sparse | algorithms/naive_importance.py | tipech/spatialnet | train | 1 |
8b8c0b177bd98e85ea03b8f3e5dc7d4fc95333bf | [
"self.projDir = projDir_\nself.caseName = caseName_\nself.nTurbine = nTurbine_\nself.P = 0\nself.T = 0",
"turbines = list(range(0, self.nTurbine))\nfile_powerRotor = open(self.projDir + self.caseName + '/turbineOutputofWindFarm/' + str(startTime) + '/powerRotor', 'r')\ndata_powerRotor = csv.reader(file_powerRotor... | <|body_start_0|>
self.projDir = projDir_
self.caseName = caseName_
self.nTurbine = nTurbine_
self.P = 0
self.T = 0
<|end_body_0|>
<|body_start_1|>
turbines = list(range(0, self.nTurbine))
file_powerRotor = open(self.projDir + self.caseName + '/turbineOutputofWind... | Output | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Output:
def __init__(self, projDir_, caseName_, nTurbine_):
"""constructor"""
<|body_0|>
def powerRotor(self, startTime):
"""read powerRotor and return a dict"""
<|body_1|>
def thrust(self, startTime):
"""read thrust and return a dict"""
... | stack_v2_sparse_classes_36k_train_000258 | 1,998 | no_license | [
{
"docstring": "constructor",
"name": "__init__",
"signature": "def __init__(self, projDir_, caseName_, nTurbine_)"
},
{
"docstring": "read powerRotor and return a dict",
"name": "powerRotor",
"signature": "def powerRotor(self, startTime)"
},
{
"docstring": "read thrust and retur... | 3 | stack_v2_sparse_classes_30k_train_018441 | Implement the Python class `Output` described below.
Class description:
Implement the Output class.
Method signatures and docstrings:
- def __init__(self, projDir_, caseName_, nTurbine_): constructor
- def powerRotor(self, startTime): read powerRotor and return a dict
- def thrust(self, startTime): read thrust and re... | Implement the Python class `Output` described below.
Class description:
Implement the Output class.
Method signatures and docstrings:
- def __init__(self, projDir_, caseName_, nTurbine_): constructor
- def powerRotor(self, startTime): read powerRotor and return a dict
- def thrust(self, startTime): read thrust and re... | 19a1da06b0c5fdacf89db57ebaac371b063e44a3 | <|skeleton|>
class Output:
def __init__(self, projDir_, caseName_, nTurbine_):
"""constructor"""
<|body_0|>
def powerRotor(self, startTime):
"""read powerRotor and return a dict"""
<|body_1|>
def thrust(self, startTime):
"""read thrust and return a dict"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Output:
def __init__(self, projDir_, caseName_, nTurbine_):
"""constructor"""
self.projDir = projDir_
self.caseName = caseName_
self.nTurbine = nTurbine_
self.P = 0
self.T = 0
def powerRotor(self, startTime):
"""read powerRotor and return a dict"""
... | the_stack_v2_python_sparse | code.org/outputReadClass.py | HansInM36/Postprocessing_OpenFOAM | train | 1 | |
ce8a3413192894ef9c734a8954a999095d8d9acb | [
"super(FileMenu, self).__init__()\nself.xInitGui()\nmenubar.parent.Bind(wx.EVT_MENU, menubar.Handler, self.itemOpen)\nmenubar.parent.Bind(wx.EVT_MENU, menubar.Handler, self.itemSave)\nmenubar.parent.Bind(wx.EVT_MENU, menubar.Handler, self.itemSaveAs)\nmenubar.parent.Bind(wx.EVT_MENU, menubar.Handler, self.itemExit)... | <|body_start_0|>
super(FileMenu, self).__init__()
self.xInitGui()
menubar.parent.Bind(wx.EVT_MENU, menubar.Handler, self.itemOpen)
menubar.parent.Bind(wx.EVT_MENU, menubar.Handler, self.itemSave)
menubar.parent.Bind(wx.EVT_MENU, menubar.Handler, self.itemSaveAs)
menubar.p... | The application's File menu. It binds to the containing menu bar's "handler" member as its menu handler. | FileMenu | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FileMenu:
"""The application's File menu. It binds to the containing menu bar's "handler" member as its menu handler."""
def __init__(self, menubar):
"""Initializes the underlying wx.Menu item and triggers creation of the menu items."""
<|body_0|>
def xInitGui(self):
... | stack_v2_sparse_classes_36k_train_000259 | 6,684 | no_license | [
{
"docstring": "Initializes the underlying wx.Menu item and triggers creation of the menu items.",
"name": "__init__",
"signature": "def __init__(self, menubar)"
},
{
"docstring": "Adds the actual menu items.",
"name": "xInitGui",
"signature": "def xInitGui(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_020109 | Implement the Python class `FileMenu` described below.
Class description:
The application's File menu. It binds to the containing menu bar's "handler" member as its menu handler.
Method signatures and docstrings:
- def __init__(self, menubar): Initializes the underlying wx.Menu item and triggers creation of the menu ... | Implement the Python class `FileMenu` described below.
Class description:
The application's File menu. It binds to the containing menu bar's "handler" member as its menu handler.
Method signatures and docstrings:
- def __init__(self, menubar): Initializes the underlying wx.Menu item and triggers creation of the menu ... | 629e48ab3bf9d9c52ac9863a03196573bbf526e1 | <|skeleton|>
class FileMenu:
"""The application's File menu. It binds to the containing menu bar's "handler" member as its menu handler."""
def __init__(self, menubar):
"""Initializes the underlying wx.Menu item and triggers creation of the menu items."""
<|body_0|>
def xInitGui(self):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FileMenu:
"""The application's File menu. It binds to the containing menu bar's "handler" member as its menu handler."""
def __init__(self, menubar):
"""Initializes the underlying wx.Menu item and triggers creation of the menu items."""
super(FileMenu, self).__init__()
self.xInitG... | the_stack_v2_python_sparse | python/app/asig/MenuBar.py | ludwigf/radio | train | 0 |
789b9818cc7b2a3ee32978d2e0c8fbe0734580a9 | [
"actual = a1.num_buses(0)\nexpected = 0\nself.assertEqual(actual, expected)",
"actual = a1.num_buses(49)\nexpected = 1\nself.assertEqual(actual, expected)",
"actual = a1.num_buses(50)\nexpected = 1\nself.assertEqual(actual, expected)",
"actual = a1.num_buses(51)\nexpected = 2\nself.assertEqual(actual, expecte... | <|body_start_0|>
actual = a1.num_buses(0)
expected = 0
self.assertEqual(actual, expected)
<|end_body_0|>
<|body_start_1|>
actual = a1.num_buses(49)
expected = 1
self.assertEqual(actual, expected)
<|end_body_1|>
<|body_start_2|>
actual = a1.num_buses(50)
... | Test class for function a1.num_buses. | TestNumBuses | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestNumBuses:
"""Test class for function a1.num_buses."""
def test_numBuses_t1(self):
"""Test num_buses with 0"""
<|body_0|>
def test_numBuses_t2(self):
"""Test num_buses with 49"""
<|body_1|>
def test_numBuses_t3(self):
"""Test num_buses wit... | stack_v2_sparse_classes_36k_train_000260 | 1,380 | no_license | [
{
"docstring": "Test num_buses with 0",
"name": "test_numBuses_t1",
"signature": "def test_numBuses_t1(self)"
},
{
"docstring": "Test num_buses with 49",
"name": "test_numBuses_t2",
"signature": "def test_numBuses_t2(self)"
},
{
"docstring": "Test num_buses with 50",
"name": ... | 6 | null | Implement the Python class `TestNumBuses` described below.
Class description:
Test class for function a1.num_buses.
Method signatures and docstrings:
- def test_numBuses_t1(self): Test num_buses with 0
- def test_numBuses_t2(self): Test num_buses with 49
- def test_numBuses_t3(self): Test num_buses with 50
- def test... | Implement the Python class `TestNumBuses` described below.
Class description:
Test class for function a1.num_buses.
Method signatures and docstrings:
- def test_numBuses_t1(self): Test num_buses with 0
- def test_numBuses_t2(self): Test num_buses with 49
- def test_numBuses_t3(self): Test num_buses with 50
- def test... | 9dd2f37bcdce25a5cc0146adb4513ed2e539b650 | <|skeleton|>
class TestNumBuses:
"""Test class for function a1.num_buses."""
def test_numBuses_t1(self):
"""Test num_buses with 0"""
<|body_0|>
def test_numBuses_t2(self):
"""Test num_buses with 49"""
<|body_1|>
def test_numBuses_t3(self):
"""Test num_buses wit... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestNumBuses:
"""Test class for function a1.num_buses."""
def test_numBuses_t1(self):
"""Test num_buses with 0"""
actual = a1.num_buses(0)
expected = 0
self.assertEqual(actual, expected)
def test_numBuses_t2(self):
"""Test num_buses with 49"""
actual =... | the_stack_v2_python_sparse | 3_Coursera_Learn to Program Crafting Quality Code (LPT2)/Assignment 1/test_num_buses.py | DmitryVakhrushev/Python | train | 0 |
78ddd5e99e1d6c3c4b054d592b0e5158e3d55a78 | [
"Talker.__init__(self, **kwargs)\nself.obs = obs\nself.filename = os.path.join(self.obs.directory, 'headers.txt')",
"self.speak('loading cube of image headers.')\ntry:\n self.headers\n assert remake == False\n self.speak('header cube was already loaded')\nexcept (AssertionError, AttributeError):\n sel... | <|body_start_0|>
Talker.__init__(self, **kwargs)
self.obs = obs
self.filename = os.path.join(self.obs.directory, 'headers.txt')
<|end_body_0|>
<|body_start_1|>
self.speak('loading cube of image headers.')
try:
self.headers
assert remake == False
... | An object to store the timeseries of image headers for this project -- good for keeping track of various external variables. | Headers | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Headers:
"""An object to store the timeseries of image headers for this project -- good for keeping track of various external variables."""
def __init__(self, obs, **kwargs):
"""Initialize a Headers object."""
<|body_0|>
def load(self, remake=True):
"""Make sure ... | stack_v2_sparse_classes_36k_train_000261 | 5,024 | permissive | [
{
"docstring": "Initialize a Headers object.",
"name": "__init__",
"signature": "def __init__(self, obs, **kwargs)"
},
{
"docstring": "Make sure the header table is loaded.",
"name": "load",
"signature": "def load(self, remake=True)"
},
{
"docstring": "Load a table of header info... | 5 | null | Implement the Python class `Headers` described below.
Class description:
An object to store the timeseries of image headers for this project -- good for keeping track of various external variables.
Method signatures and docstrings:
- def __init__(self, obs, **kwargs): Initialize a Headers object.
- def load(self, rem... | Implement the Python class `Headers` described below.
Class description:
An object to store the timeseries of image headers for this project -- good for keeping track of various external variables.
Method signatures and docstrings:
- def __init__(self, obs, **kwargs): Initialize a Headers object.
- def load(self, rem... | 09f24956d080044b996ca1e646525acd8b0ccbe0 | <|skeleton|>
class Headers:
"""An object to store the timeseries of image headers for this project -- good for keeping track of various external variables."""
def __init__(self, obs, **kwargs):
"""Initialize a Headers object."""
<|body_0|>
def load(self, remake=True):
"""Make sure ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Headers:
"""An object to store the timeseries of image headers for this project -- good for keeping track of various external variables."""
def __init__(self, obs, **kwargs):
"""Initialize a Headers object."""
Talker.__init__(self, **kwargs)
self.obs = obs
self.filename = ... | the_stack_v2_python_sparse | mosasaurus/Headers.py | zkbt/mosasaurus | train | 3 |
83c85e9ffe659cbffef0e0162caa7cd8642ccc26 | [
"if not pRoot:\n return True\nnleft = self.treeDepth(pRoot.left)\nnright = self.treeDepth(pRoot.right)\nif abs(nleft - nright) > 1:\n return False\nelse:\n return self.IsBalanced_Solution(pRoot.left) and self.IsBalanced_Solution(pRoot.right)",
"if not pRoot:\n return 0\nnleft = self.treeDepth(pRoot.le... | <|body_start_0|>
if not pRoot:
return True
nleft = self.treeDepth(pRoot.left)
nright = self.treeDepth(pRoot.right)
if abs(nleft - nright) > 1:
return False
else:
return self.IsBalanced_Solution(pRoot.left) and self.IsBalanced_Solution(pRoot.rig... | 从上往下遍历时,由于每次计算结点深度时,其下面的结点都会被遍历到,导致多次访问,影响性能 | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""从上往下遍历时,由于每次计算结点深度时,其下面的结点都会被遍历到,导致多次访问,影响性能"""
def IsBalanced_Solution(self, pRoot):
"""判断是否为平衡树"""
<|body_0|>
def treeDepth(self, pRoot):
"""计算二叉树的深度"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not pRoot:
return... | stack_v2_sparse_classes_36k_train_000262 | 4,838 | no_license | [
{
"docstring": "判断是否为平衡树",
"name": "IsBalanced_Solution",
"signature": "def IsBalanced_Solution(self, pRoot)"
},
{
"docstring": "计算二叉树的深度",
"name": "treeDepth",
"signature": "def treeDepth(self, pRoot)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
从上往下遍历时,由于每次计算结点深度时,其下面的结点都会被遍历到,导致多次访问,影响性能
Method signatures and docstrings:
- def IsBalanced_Solution(self, pRoot): 判断是否为平衡树
- def treeDepth(self, pRoot): 计算二叉树的深度 | Implement the Python class `Solution` described below.
Class description:
从上往下遍历时,由于每次计算结点深度时,其下面的结点都会被遍历到,导致多次访问,影响性能
Method signatures and docstrings:
- def IsBalanced_Solution(self, pRoot): 判断是否为平衡树
- def treeDepth(self, pRoot): 计算二叉树的深度
<|skeleton|>
class Solution:
"""从上往下遍历时,由于每次计算结点深度时,其下面的结点都会被遍历到,导致多次访问,... | 4e4f739402b95691f6c91411da26d7d3bfe042b6 | <|skeleton|>
class Solution:
"""从上往下遍历时,由于每次计算结点深度时,其下面的结点都会被遍历到,导致多次访问,影响性能"""
def IsBalanced_Solution(self, pRoot):
"""判断是否为平衡树"""
<|body_0|>
def treeDepth(self, pRoot):
"""计算二叉树的深度"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
"""从上往下遍历时,由于每次计算结点深度时,其下面的结点都会被遍历到,导致多次访问,影响性能"""
def IsBalanced_Solution(self, pRoot):
"""判断是否为平衡树"""
if not pRoot:
return True
nleft = self.treeDepth(pRoot.left)
nright = self.treeDepth(pRoot.right)
if abs(nleft - nright) > 1:
r... | the_stack_v2_python_sparse | 剑指offer/39.平衡二叉树.py | hugechuanqi/Algorithms-and-Data-Structures | train | 3 |
5f45935372d3cb33d0e21d88a390bcc90e986189 | [
"super(Yolo_net, self).__init__()\nself.in_ch = in_ch\nself.anchors = anchors\nself.num_anchors = len(anchors)\nself.num_classes = num_classes\nself.img_dim = img_dim\nself.batch_norm = batch_norm\nself.darknet = Darknet(in_ch)\nindex = self.darknet.first_index + 1\nself.out_net1 = DarknetConvBlock(512, self.num_an... | <|body_start_0|>
super(Yolo_net, self).__init__()
self.in_ch = in_ch
self.anchors = anchors
self.num_anchors = len(anchors)
self.num_classes = num_classes
self.img_dim = img_dim
self.batch_norm = batch_norm
self.darknet = Darknet(in_ch)
index = sel... | Yolo network | Yolo_net | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Yolo_net:
"""Yolo network"""
def __init__(self, in_ch, num_classes=2, anchors=[(116, 90), (156, 198), (737, 326)], img_dim=512, batch_norm=True):
"""Constructor"""
<|body_0|>
def forward(self, x, targets=None):
"""Foward method"""
<|body_1|>
<|end_skelet... | stack_v2_sparse_classes_36k_train_000263 | 28,014 | no_license | [
{
"docstring": "Constructor",
"name": "__init__",
"signature": "def __init__(self, in_ch, num_classes=2, anchors=[(116, 90), (156, 198), (737, 326)], img_dim=512, batch_norm=True)"
},
{
"docstring": "Foward method",
"name": "forward",
"signature": "def forward(self, x, targets=None)"
}... | 2 | stack_v2_sparse_classes_30k_train_001181 | Implement the Python class `Yolo_net` described below.
Class description:
Yolo network
Method signatures and docstrings:
- def __init__(self, in_ch, num_classes=2, anchors=[(116, 90), (156, 198), (737, 326)], img_dim=512, batch_norm=True): Constructor
- def forward(self, x, targets=None): Foward method | Implement the Python class `Yolo_net` described below.
Class description:
Yolo network
Method signatures and docstrings:
- def __init__(self, in_ch, num_classes=2, anchors=[(116, 90), (156, 198), (737, 326)], img_dim=512, batch_norm=True): Constructor
- def forward(self, x, targets=None): Foward method
<|skeleton|>
... | 69edb5ecd569395086cf610df9c8aa345284259a | <|skeleton|>
class Yolo_net:
"""Yolo network"""
def __init__(self, in_ch, num_classes=2, anchors=[(116, 90), (156, 198), (737, 326)], img_dim=512, batch_norm=True):
"""Constructor"""
<|body_0|>
def forward(self, x, targets=None):
"""Foward method"""
<|body_1|>
<|end_skelet... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Yolo_net:
"""Yolo network"""
def __init__(self, in_ch, num_classes=2, anchors=[(116, 90), (156, 198), (737, 326)], img_dim=512, batch_norm=True):
"""Constructor"""
super(Yolo_net, self).__init__()
self.in_ch = in_ch
self.anchors = anchors
self.num_anchors = len(anc... | the_stack_v2_python_sparse | python/models/modules.py | dswanderley/detntorch | train | 2 |
8fec4c9193b5ae8636ce2e79b962fb6be2cf4ca5 | [
"self.active = active\nself.order_size_limit = int(order_size_limit)\nself.order_price_upper_limit = float(order_price_upper_limit)\nself.balance_use_limit = float(balance_use_limit)\nself.trade_count = trade_count\nself.trade_limit = int(trade_limit)",
"msg = ''\nif not self.active:\n msg = u'风控: 风控引擎未开启'\n ... | <|body_start_0|>
self.active = active
self.order_size_limit = int(order_size_limit)
self.order_price_upper_limit = float(order_price_upper_limit)
self.balance_use_limit = float(balance_use_limit)
self.trade_count = trade_count
self.trade_limit = int(trade_limit)
<|end_bod... | 风控引擎 | RiskManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RiskManager:
"""风控引擎"""
def __init__(self, active, order_size_limit, order_price_upper_limit, balance_use_limit, trade_limit, trade_count):
"""Constructor"""
<|body_0|>
def checkRisk(self, orderReq, tick, account):
"""检查风险"""
<|body_1|>
<|end_skeleton|>
... | stack_v2_sparse_classes_36k_train_000264 | 3,904 | no_license | [
{
"docstring": "Constructor",
"name": "__init__",
"signature": "def __init__(self, active, order_size_limit, order_price_upper_limit, balance_use_limit, trade_limit, trade_count)"
},
{
"docstring": "检查风险",
"name": "checkRisk",
"signature": "def checkRisk(self, orderReq, tick, account)"
... | 2 | stack_v2_sparse_classes_30k_train_016504 | Implement the Python class `RiskManager` described below.
Class description:
风控引擎
Method signatures and docstrings:
- def __init__(self, active, order_size_limit, order_price_upper_limit, balance_use_limit, trade_limit, trade_count): Constructor
- def checkRisk(self, orderReq, tick, account): 检查风险 | Implement the Python class `RiskManager` described below.
Class description:
风控引擎
Method signatures and docstrings:
- def __init__(self, active, order_size_limit, order_price_upper_limit, balance_use_limit, trade_limit, trade_count): Constructor
- def checkRisk(self, orderReq, tick, account): 检查风险
<|skeleton|>
class... | 1390db7bba9c2a3408b09a863b03f7802cbe2fff | <|skeleton|>
class RiskManager:
"""风控引擎"""
def __init__(self, active, order_size_limit, order_price_upper_limit, balance_use_limit, trade_limit, trade_count):
"""Constructor"""
<|body_0|>
def checkRisk(self, orderReq, tick, account):
"""检查风险"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RiskManager:
"""风控引擎"""
def __init__(self, active, order_size_limit, order_price_upper_limit, balance_use_limit, trade_limit, trade_count):
"""Constructor"""
self.active = active
self.order_size_limit = int(order_size_limit)
self.order_price_upper_limit = float(order_price... | the_stack_v2_python_sparse | 基线库/源码/SQuant/trader/trade/riskManager.py | SQuantTeam/SQuant | train | 4 |
72350d20c0ce00695951c92a797ecb4c709a6467 | [
"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... | Service for ingesting and querying logs. | LoggingServiceV2Servicer | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoggingServiceV2Servicer:
"""Service for ingesting and querying logs."""
def DeleteLog(self, request, context):
"""Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted. Entries... | stack_v2_sparse_classes_36k_train_000265 | 8,741 | permissive | [
{
"docstring": "Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted. Entries received after the delete operation with a timestamp before the operation will be deleted.",
"name": "DeleteLog",
"sig... | 6 | null | Implement the Python class `LoggingServiceV2Servicer` described below.
Class description:
Service for ingesting and querying logs.
Method signatures and docstrings:
- def DeleteLog(self, request, context): Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries written shortly ... | Implement the Python class `LoggingServiceV2Servicer` described below.
Class description:
Service for ingesting and querying logs.
Method signatures and docstrings:
- def DeleteLog(self, request, context): Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries written shortly ... | 1f9b424c40a87b46656fc9f5e2e9c81895c7e614 | <|skeleton|>
class LoggingServiceV2Servicer:
"""Service for ingesting and querying logs."""
def DeleteLog(self, request, context):
"""Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted. Entries... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LoggingServiceV2Servicer:
"""Service for ingesting and querying logs."""
def DeleteLog(self, request, context):
"""Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted. Entries received aft... | the_stack_v2_python_sparse | google-cloud-sdk/lib/googlecloudsdk/third_party/logging_v2/proto/logging_pb2_grpc.py | twistedpair/google-cloud-sdk | train | 58 |
7ec2ca798e48eb8ebe95d67f18f5255830260600 | [
"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... | MpfHardwareService | [
"MIT",
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MpfHardwareService:
def Start(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def SendSwitchChanges(self, request_iterator, context):
"""Missing associated documentation comment in .proto file."""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_000266 | 2,126 | permissive | [
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "Start",
"signature": "def Start(self, request, context)"
},
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "SendSwitchChanges",
"signature": "def SendSwitchChanges(self... | 3 | null | Implement the Python class `MpfHardwareService` described below.
Class description:
Implement the MpfHardwareService class.
Method signatures and docstrings:
- def Start(self, request, context): Missing associated documentation comment in .proto file.
- def SendSwitchChanges(self, request_iterator, context): Missing ... | Implement the Python class `MpfHardwareService` described below.
Class description:
Implement the MpfHardwareService class.
Method signatures and docstrings:
- def Start(self, request, context): Missing associated documentation comment in .proto file.
- def SendSwitchChanges(self, request_iterator, context): Missing ... | 9f90c8b1586363b65340017bfa3af5d56d32c6d9 | <|skeleton|>
class MpfHardwareService:
def Start(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def SendSwitchChanges(self, request_iterator, context):
"""Missing associated documentation comment in .proto file."""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MpfHardwareService:
def Start(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def Sen... | the_stack_v2_python_sparse | mpf/platforms/visual_pinball_engine/test_client.py | missionpinball/mpf | train | 191 | |
36e4f90751adfb56b352f93084cf823b4e47ae26 | [
"if not root:\n return sys.maxint\nchild = root.left if root.val > target else root.right\nclosest = self.closestValue(child, target)\nreturn closest if abs(closest - target) < abs(root.val - target) else root.val",
"child = root.left if root.val > target else root.right\nif child:\n closest = self.closestV... | <|body_start_0|>
if not root:
return sys.maxint
child = root.left if root.val > target else root.right
closest = self.closestValue(child, target)
return closest if abs(closest - target) < abs(root.val - target) else root.val
<|end_body_0|>
<|body_start_1|>
child = ro... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def closestValue(self, root, target):
""":type root: TreeNode :type target: float :rtype: int"""
<|body_0|>
def closestValue(self, root, target):
""":type root: TreeNode :type target: float :rtype: int"""
<|body_1|>
def closestValue(self, root,... | stack_v2_sparse_classes_36k_train_000267 | 1,474 | no_license | [
{
"docstring": ":type root: TreeNode :type target: float :rtype: int",
"name": "closestValue",
"signature": "def closestValue(self, root, target)"
},
{
"docstring": ":type root: TreeNode :type target: float :rtype: int",
"name": "closestValue",
"signature": "def closestValue(self, root, ... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def closestValue(self, root, target): :type root: TreeNode :type target: float :rtype: int
- def closestValue(self, root, target): :type root: TreeNode :type target: float :rtype... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def closestValue(self, root, target): :type root: TreeNode :type target: float :rtype: int
- def closestValue(self, root, target): :type root: TreeNode :type target: float :rtype... | d953abe2c9680f636563e76287d2f907e90ced63 | <|skeleton|>
class Solution:
def closestValue(self, root, target):
""":type root: TreeNode :type target: float :rtype: int"""
<|body_0|>
def closestValue(self, root, target):
""":type root: TreeNode :type target: float :rtype: int"""
<|body_1|>
def closestValue(self, root,... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def closestValue(self, root, target):
""":type root: TreeNode :type target: float :rtype: int"""
if not root:
return sys.maxint
child = root.left if root.val > target else root.right
closest = self.closestValue(child, target)
return closest if abs(... | the_stack_v2_python_sparse | Python_leetcode/270_closest_bst_value.py | xiangcao/Leetcode | train | 0 | |
9394d67a29d433dff78521d16930b7fd2f035c38 | [
"super(UserRegisterForm, self).clean()\npassword1 = self.cleaned_data.get('password1')\npassword2 = self.cleaned_data.get('password2')\nif password1 != password2:\n raise forms.ValidationError('You must enter matching passwords.')\ntry:\n password_validation.validate_password(password=password1, user=get_user... | <|body_start_0|>
super(UserRegisterForm, self).clean()
password1 = self.cleaned_data.get('password1')
password2 = self.cleaned_data.get('password2')
if password1 != password2:
raise forms.ValidationError('You must enter matching passwords.')
try:
password_... | UserRegisterForm | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserRegisterForm:
def clean(self):
"""Validate attributes, including password constraints, before persisting the user to the database."""
<|body_0|>
def save(self, commit=True):
"""Save the provided password in hashed format. :param commit: If True, changes to the in... | stack_v2_sparse_classes_36k_train_000268 | 1,743 | permissive | [
{
"docstring": "Validate attributes, including password constraints, before persisting the user to the database.",
"name": "clean",
"signature": "def clean(self)"
},
{
"docstring": "Save the provided password in hashed format. :param commit: If True, changes to the instance will be saved to the ... | 2 | stack_v2_sparse_classes_30k_val_000005 | Implement the Python class `UserRegisterForm` described below.
Class description:
Implement the UserRegisterForm class.
Method signatures and docstrings:
- def clean(self): Validate attributes, including password constraints, before persisting the user to the database.
- def save(self, commit=True): Save the provided... | Implement the Python class `UserRegisterForm` described below.
Class description:
Implement the UserRegisterForm class.
Method signatures and docstrings:
- def clean(self): Validate attributes, including password constraints, before persisting the user to the database.
- def save(self, commit=True): Save the provided... | d03b56f5b1878dc981d866e108dbb05deb120266 | <|skeleton|>
class UserRegisterForm:
def clean(self):
"""Validate attributes, including password constraints, before persisting the user to the database."""
<|body_0|>
def save(self, commit=True):
"""Save the provided password in hashed format. :param commit: If True, changes to the in... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserRegisterForm:
def clean(self):
"""Validate attributes, including password constraints, before persisting the user to the database."""
super(UserRegisterForm, self).clean()
password1 = self.cleaned_data.get('password1')
password2 = self.cleaned_data.get('password2')
... | the_stack_v2_python_sparse | myproject/auth/forms/userregistrationform.py | alexdlaird/django-bootstrap-authentication-template-project | train | 3 | |
a9618f24dc8e4bad15ec2241f7e4912d5d4091fa | [
"logger.debug('Initializing websocket state manager')\nself._websocket = websocket\nself.state = State()\nself.state.enqueue_message(AuthenticationRequiredMessage())\nself.state.start_authentication_timeout()",
"logger.debug('Starting websocket consumer')\nwhile not self.state.exit:\n msg = await self._websock... | <|body_start_0|>
logger.debug('Initializing websocket state manager')
self._websocket = websocket
self.state = State()
self.state.enqueue_message(AuthenticationRequiredMessage())
self.state.start_authentication_timeout()
<|end_body_0|>
<|body_start_1|>
logger.debug('Star... | A class for managing the inbound/outbound messages and state of a websocket session. | StateManager | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StateManager:
"""A class for managing the inbound/outbound messages and state of a websocket session."""
def __init__(self, websocket: websockets.WebSocketServerProtocol):
"""Initializer."""
<|body_0|>
async def consumer_handler(self):
"""This is the primary asyn... | stack_v2_sparse_classes_36k_train_000269 | 6,011 | permissive | [
{
"docstring": "Initializer.",
"name": "__init__",
"signature": "def __init__(self, websocket: websockets.WebSocketServerProtocol)"
},
{
"docstring": "This is the primary asynchronous method that is used for handling inbound websocket massages.",
"name": "consumer_handler",
"signature": ... | 5 | null | Implement the Python class `StateManager` described below.
Class description:
A class for managing the inbound/outbound messages and state of a websocket session.
Method signatures and docstrings:
- def __init__(self, websocket: websockets.WebSocketServerProtocol): Initializer.
- async def consumer_handler(self): Thi... | Implement the Python class `StateManager` described below.
Class description:
A class for managing the inbound/outbound messages and state of a websocket session.
Method signatures and docstrings:
- def __init__(self, websocket: websockets.WebSocketServerProtocol): Initializer.
- async def consumer_handler(self): Thi... | 56d808d7836cd15d6c6748cbf704cdea4407fef6 | <|skeleton|>
class StateManager:
"""A class for managing the inbound/outbound messages and state of a websocket session."""
def __init__(self, websocket: websockets.WebSocketServerProtocol):
"""Initializer."""
<|body_0|>
async def consumer_handler(self):
"""This is the primary asyn... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StateManager:
"""A class for managing the inbound/outbound messages and state of a websocket session."""
def __init__(self, websocket: websockets.WebSocketServerProtocol):
"""Initializer."""
logger.debug('Initializing websocket state manager')
self._websocket = websocket
s... | the_stack_v2_python_sparse | src/installer/src/tortuga/web_service/websocket/state_manager.py | UnivaCorporation/tortuga | train | 33 |
f333e63d51a0ea0f2b2fcdddd5d1872e949099b1 | [
"Thread.__init__(self)\nself.daemon = True\nself.queue = Queue()\nself.running = False\nself.commands = {'blastp': '', 'blastn': ''}\nself.temp_dir = ''\nif app is not None:\n self.init_app(app)",
"app.extensions = getattr(app, 'extensions', {})\napp.extensions['flask-blast'] = self\nif not self.running and (o... | <|body_start_0|>
Thread.__init__(self)
self.daemon = True
self.queue = Queue()
self.running = False
self.commands = {'blastp': '', 'blastn': ''}
self.temp_dir = ''
if app is not None:
self.init_app(app)
<|end_body_0|>
<|body_start_1|>
app.exte... | BlastThread | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BlastThread:
def __init__(self, app=None):
"""Sets up thread, empty queue and register with app :param app: flask-app to register with"""
<|body_0|>
def init_app(self, app):
"""Register blast thread with app :param app: Flask application :type app: Flask"""
<... | stack_v2_sparse_classes_36k_train_000270 | 3,368 | permissive | [
{
"docstring": "Sets up thread, empty queue and register with app :param app: flask-app to register with",
"name": "__init__",
"signature": "def __init__(self, app=None)"
},
{
"docstring": "Register blast thread with app :param app: Flask application :type app: Flask",
"name": "init_app",
... | 5 | null | Implement the Python class `BlastThread` described below.
Class description:
Implement the BlastThread class.
Method signatures and docstrings:
- def __init__(self, app=None): Sets up thread, empty queue and register with app :param app: flask-app to register with
- def init_app(self, app): Register blast thread with... | Implement the Python class `BlastThread` described below.
Class description:
Implement the BlastThread class.
Method signatures and docstrings:
- def __init__(self, app=None): Sets up thread, empty queue and register with app :param app: flask-app to register with
- def init_app(self, app): Register blast thread with... | 25d0187030bcb85bb99125af4fd0c0c11aa012cb | <|skeleton|>
class BlastThread:
def __init__(self, app=None):
"""Sets up thread, empty queue and register with app :param app: flask-app to register with"""
<|body_0|>
def init_app(self, app):
"""Register blast thread with app :param app: Flask application :type app: Flask"""
<... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BlastThread:
def __init__(self, app=None):
"""Sets up thread, empty queue and register with app :param app: flask-app to register with"""
Thread.__init__(self)
self.daemon = True
self.queue = Queue()
self.running = False
self.commands = {'blastp': '', 'blastn': ... | the_stack_v2_python_sparse | conekt/flask_blast/blast.py | sepro/CoNekT | train | 23 | |
9bbb7cc4afaaaa8083c301b555b6cba674062f4a | [
"self.gui = gui.app\nself.gui.startSubWindow('Retransmision')\nself.gui.setGeometry(800, 520)\nmsg = 'Redes2 - P2P - ' + discover_server.user_read_file()['nick']\nself.gui.addLabel('subtitle', msg)\nself.gui.addImage('imagen_stream', 'imgs/webcam.gif')\nself.frame = cv2.VideoCapture(0)\nself.gui.setPollTime(20)\nse... | <|body_start_0|>
self.gui = gui.app
self.gui.startSubWindow('Retransmision')
self.gui.setGeometry(800, 520)
msg = 'Redes2 - P2P - ' + discover_server.user_read_file()['nick']
self.gui.addLabel('subtitle', msg)
self.gui.addImage('imagen_stream', 'imgs/webcam.gif')
... | Clase que contiene toda la funcionalidad del Streaming | Video_UDP | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Video_UDP:
"""Clase que contiene toda la funcionalidad del Streaming"""
def __init__(self, gui):
"""Funcion de inicializacion del objeto Video_UDP. :param gui: gui: objeto de la interfaz videoClient, necesario para completar su funcionalidad."""
<|body_0|>
def start(self... | stack_v2_sparse_classes_36k_train_000271 | 6,381 | no_license | [
{
"docstring": "Funcion de inicializacion del objeto Video_UDP. :param gui: gui: objeto de la interfaz videoClient, necesario para completar su funcionalidad.",
"name": "__init__",
"signature": "def __init__(self, gui)"
},
{
"docstring": "Inicializa la clase Video_UDP. Lanza los hilos de mandar ... | 5 | stack_v2_sparse_classes_30k_train_016667 | Implement the Python class `Video_UDP` described below.
Class description:
Clase que contiene toda la funcionalidad del Streaming
Method signatures and docstrings:
- def __init__(self, gui): Funcion de inicializacion del objeto Video_UDP. :param gui: gui: objeto de la interfaz videoClient, necesario para completar su... | Implement the Python class `Video_UDP` described below.
Class description:
Clase que contiene toda la funcionalidad del Streaming
Method signatures and docstrings:
- def __init__(self, gui): Funcion de inicializacion del objeto Video_UDP. :param gui: gui: objeto de la interfaz videoClient, necesario para completar su... | d978f1d8081a9b688c973e8955a4d60e8cabec3e | <|skeleton|>
class Video_UDP:
"""Clase que contiene toda la funcionalidad del Streaming"""
def __init__(self, gui):
"""Funcion de inicializacion del objeto Video_UDP. :param gui: gui: objeto de la interfaz videoClient, necesario para completar su funcionalidad."""
<|body_0|>
def start(self... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Video_UDP:
"""Clase que contiene toda la funcionalidad del Streaming"""
def __init__(self, gui):
"""Funcion de inicializacion del objeto Video_UDP. :param gui: gui: objeto de la interfaz videoClient, necesario para completar su funcionalidad."""
self.gui = gui.app
self.gui.startSu... | the_stack_v2_python_sparse | P3/video_UDP.py | artiimor/REDES2 | train | 0 |
069654895726f941a3a71f641395e0eaf9adc9aa | [
"data = request.get_json()\ncase_id = data.get('case_id')\ndata_id = data.get('data_id')\nquery_case = TestCase.query.get(case_id)\nquery_case_data = TestCaseData.query.get(data_id)\nif not query_case:\n return api_result(code=400, message='用例id不存在:{}'.format(case_id))\nif not query_case_data:\n return api_re... | <|body_start_0|>
data = request.get_json()
case_id = data.get('case_id')
data_id = data.get('data_id')
query_case = TestCase.query.get(case_id)
query_case_data = TestCaseData.query.get(data_id)
if not query_case:
return api_result(code=400, message='用例id不存在:{}... | 用例配置数据Api | CaseBindDataApi | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CaseBindDataApi:
"""用例配置数据Api"""
def post(self):
"""用例绑定数据"""
<|body_0|>
def put(self):
"""用例数据解绑"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
data = request.get_json()
case_id = data.get('case_id')
data_id = data.get('data_id... | stack_v2_sparse_classes_36k_train_000272 | 4,328 | no_license | [
{
"docstring": "用例绑定数据",
"name": "post",
"signature": "def post(self)"
},
{
"docstring": "用例数据解绑",
"name": "put",
"signature": "def put(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_008545 | Implement the Python class `CaseBindDataApi` described below.
Class description:
用例配置数据Api
Method signatures and docstrings:
- def post(self): 用例绑定数据
- def put(self): 用例数据解绑 | Implement the Python class `CaseBindDataApi` described below.
Class description:
用例配置数据Api
Method signatures and docstrings:
- def post(self): 用例绑定数据
- def put(self): 用例数据解绑
<|skeleton|>
class CaseBindDataApi:
"""用例配置数据Api"""
def post(self):
"""用例绑定数据"""
<|body_0|>
def put(self):
... | df76812885d7d7f3a5269e3f7c652db6a9f3c3ad | <|skeleton|>
class CaseBindDataApi:
"""用例配置数据Api"""
def post(self):
"""用例绑定数据"""
<|body_0|>
def put(self):
"""用例数据解绑"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CaseBindDataApi:
"""用例配置数据Api"""
def post(self):
"""用例绑定数据"""
data = request.get_json()
case_id = data.get('case_id')
data_id = data.get('data_id')
query_case = TestCase.query.get(case_id)
query_case_data = TestCaseData.query.get(data_id)
if not que... | the_stack_v2_python_sparse | app/api/case_bind_api/case_bind_api.py | chengzizhen/ExileTestPlatformServer | train | 0 |
30d475d8f5349862f96650dfd5aaac7273ef9a97 | [
"if not all((isinstance(kernel, Metropolis) for kernel in mckernels)):\n raise ValueError('All kernels must be of type Metropolis')\nsuper().__init__(temperature, mckernels, kernel_probabilities=kernel_probabilities, kernel_hop_periods=kernel_hop_periods, kernel_hop_probabilities=kernel_hop_probabilities, seed=s... | <|body_start_0|>
if not all((isinstance(kernel, Metropolis) for kernel in mckernels)):
raise ValueError('All kernels must be of type Metropolis')
super().__init__(temperature, mckernels, kernel_probabilities=kernel_probabilities, kernel_hop_periods=kernel_hop_periods, kernel_hop_probabilitie... | A Multicell Metropolis Hastings kernel. This is useful for example when one wants to sample over different supercell shapes, i.e. for generating special quasi-random structures. The ensembles in all kernels must have supercells of the same size, only the shape can change. All ensembles must be created from the same Ham... | MulticellMetropolis | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MulticellMetropolis:
"""A Multicell Metropolis Hastings kernel. This is useful for example when one wants to sample over different supercell shapes, i.e. for generating special quasi-random structures. The ensembles in all kernels must have supercells of the same size, only the shape can change. ... | stack_v2_sparse_classes_36k_train_000273 | 5,611 | permissive | [
{
"docstring": "Initialize MCKernel. Args: mckernels (list of MCKernels): a list of MCKernels instances to obtain the features and parameters used in computing log probabilities. temperature (float): Temperature that kernel hops are attempted at. seed (int): optional non-negative integer to seed the PRNG kernel... | 2 | stack_v2_sparse_classes_30k_train_011041 | Implement the Python class `MulticellMetropolis` described below.
Class description:
A Multicell Metropolis Hastings kernel. This is useful for example when one wants to sample over different supercell shapes, i.e. for generating special quasi-random structures. The ensembles in all kernels must have supercells of the... | Implement the Python class `MulticellMetropolis` described below.
Class description:
A Multicell Metropolis Hastings kernel. This is useful for example when one wants to sample over different supercell shapes, i.e. for generating special quasi-random structures. The ensembles in all kernels must have supercells of the... | 457518b9a27729fd4d5c1c23231bd37f8fee364b | <|skeleton|>
class MulticellMetropolis:
"""A Multicell Metropolis Hastings kernel. This is useful for example when one wants to sample over different supercell shapes, i.e. for generating special quasi-random structures. The ensembles in all kernels must have supercells of the same size, only the shape can change. ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MulticellMetropolis:
"""A Multicell Metropolis Hastings kernel. This is useful for example when one wants to sample over different supercell shapes, i.e. for generating special quasi-random structures. The ensembles in all kernels must have supercells of the same size, only the shape can change. All ensembles... | the_stack_v2_python_sparse | smol/moca/kernel/metropolis.py | CederGroupHub/smol | train | 40 |
aed4149070cdcd52ca76cd0aaa0990c1ec6507a1 | [
"if kwargs and object_id:\n raise Exception('Specify an object id or keyword arguments, but not both')\nif kwargs:\n object_id = self._get_object(**kwargs)['Id']\nurl_template = '{root}/lightning/r/{object_name}/{object_id}/view'\nurl = url_template.format(root=self.cumulusci.org.lightning_base_url, object_na... | <|body_start_0|>
if kwargs and object_id:
raise Exception('Specify an object id or keyword arguments, but not both')
if kwargs:
object_id = self._get_object(**kwargs)['Id']
url_template = '{root}/lightning/r/{object_name}/{object_id}/view'
url = url_template.forma... | A page object representing the standard Detail page. When going to this page via the standard `Go to page` keyword, you can specify either an object id, or a set of keyword arguments which will be used to look up the object id. When using keyword arguments, they need to represent a unique user. Example | ${contact_id} ... | DetailPage | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DetailPage:
"""A page object representing the standard Detail page. When going to this page via the standard `Go to page` keyword, you can specify either an object id, or a set of keyword arguments which will be used to look up the object id. When using keyword arguments, they need to represent a... | stack_v2_sparse_classes_36k_train_000274 | 9,938 | permissive | [
{
"docstring": "Go to the detail page for the given record. You may pass in an object id, or you may pass in keyword arguments which can be used to look up the object. Example | Go to page Detail Contact firstName=John lastName=Smith",
"name": "_go_to_page",
"signature": "def _go_to_page(self, object_id... | 2 | stack_v2_sparse_classes_30k_train_016729 | Implement the Python class `DetailPage` described below.
Class description:
A page object representing the standard Detail page. When going to this page via the standard `Go to page` keyword, you can specify either an object id, or a set of keyword arguments which will be used to look up the object id. When using keyw... | Implement the Python class `DetailPage` described below.
Class description:
A page object representing the standard Detail page. When going to this page via the standard `Go to page` keyword, you can specify either an object id, or a set of keyword arguments which will be used to look up the object id. When using keyw... | ea01e5d3523cc174d4a60af93584df7f4486c9f3 | <|skeleton|>
class DetailPage:
"""A page object representing the standard Detail page. When going to this page via the standard `Go to page` keyword, you can specify either an object id, or a set of keyword arguments which will be used to look up the object id. When using keyword arguments, they need to represent a... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DetailPage:
"""A page object representing the standard Detail page. When going to this page via the standard `Go to page` keyword, you can specify either an object id, or a set of keyword arguments which will be used to look up the object id. When using keyword arguments, they need to represent a unique user.... | the_stack_v2_python_sparse | cumulusci/robotframework/pageobjects/BasePageObjects.py | Julian88Tex/CumulusCI | train | 1 |
204ede592b9b9d0f687fdafd13ac1f37076861dc | [
"len1, len2, len3 = (len(str1), len(str2), len(str3))\nif len1 + len2 == len3:\n return False\ndp = [True] * (len2 + 1)\nfor j in range(1, len2 + 1):\n dp[j] = dp[j - 1] and str2[j - 1] == str3[j - 1]\nfor i in range(1, len1 + 1):\n dp[0] = dp[0] and str1[i - 1] == str3[i - 1]\n for j in range(1, len2 +... | <|body_start_0|>
len1, len2, len3 = (len(str1), len(str2), len(str3))
if len1 + len2 == len3:
return False
dp = [True] * (len2 + 1)
for j in range(1, len2 + 1):
dp[j] = dp[j - 1] and str2[j - 1] == str3[j - 1]
for i in range(1, len1 + 1):
dp[0]... | InterLeaving | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InterLeaving:
def is_inter_leaving_string(self, str1: str, str2: str, str3: str) -> bool:
"""Approach: DP 1D Array Time Complexity: O(MN) Space Complexity: O(N) :param str1: :param str2: :param str3: :return:"""
<|body_0|>
def is_inter_leaving_string_(self, str1: str, str2: ... | stack_v2_sparse_classes_36k_train_000275 | 2,023 | no_license | [
{
"docstring": "Approach: DP 1D Array Time Complexity: O(MN) Space Complexity: O(N) :param str1: :param str2: :param str3: :return:",
"name": "is_inter_leaving_string",
"signature": "def is_inter_leaving_string(self, str1: str, str2: str, str3: str) -> bool"
},
{
"docstring": "Approach: DP 2D Ar... | 2 | null | Implement the Python class `InterLeaving` described below.
Class description:
Implement the InterLeaving class.
Method signatures and docstrings:
- def is_inter_leaving_string(self, str1: str, str2: str, str3: str) -> bool: Approach: DP 1D Array Time Complexity: O(MN) Space Complexity: O(N) :param str1: :param str2: ... | Implement the Python class `InterLeaving` described below.
Class description:
Implement the InterLeaving class.
Method signatures and docstrings:
- def is_inter_leaving_string(self, str1: str, str2: str, str3: str) -> bool: Approach: DP 1D Array Time Complexity: O(MN) Space Complexity: O(N) :param str1: :param str2: ... | 65cc78b5afa0db064f9fe8f06597e3e120f7363d | <|skeleton|>
class InterLeaving:
def is_inter_leaving_string(self, str1: str, str2: str, str3: str) -> bool:
"""Approach: DP 1D Array Time Complexity: O(MN) Space Complexity: O(N) :param str1: :param str2: :param str3: :return:"""
<|body_0|>
def is_inter_leaving_string_(self, str1: str, str2: ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InterLeaving:
def is_inter_leaving_string(self, str1: str, str2: str, str3: str) -> bool:
"""Approach: DP 1D Array Time Complexity: O(MN) Space Complexity: O(N) :param str1: :param str2: :param str3: :return:"""
len1, len2, len3 = (len(str1), len(str2), len(str3))
if len1 + len2 == len... | the_stack_v2_python_sparse | data_structures/recurrsion_dp/inter_leaving.py | Shiv2157k/leet_code | train | 1 | |
a86b02581f06d22d5907fefdb2ff7bb64f911b59 | [
"pol, cov = (np.array(pol), np.array(cov))\nif cov.shape != (pol.size, pol.size):\n raise ValueError\nself.pol = pol\nself.deg = len(self.pol) - 1\nself.cov = cov\nself.covpol = np.zeros((2 * self.deg + 1,))\nfor i in range(self.deg + 1):\n for j in range(self.deg + 1):\n self.covpol[i + j] += self.cov... | <|body_start_0|>
pol, cov = (np.array(pol), np.array(cov))
if cov.shape != (pol.size, pol.size):
raise ValueError
self.pol = pol
self.deg = len(self.pol) - 1
self.cov = cov
self.covpol = np.zeros((2 * self.deg + 1,))
for i in range(self.deg + 1):
... | Store and evaluate polynomials with covariance matrix on their coefficients. | Polynomial | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Polynomial:
"""Store and evaluate polynomials with covariance matrix on their coefficients."""
def __init__(self, pol, cov):
"""Compute standard devation polynomial. Considering we have polynomial P(x) = \\sum_i a_i x^i, and \\sigma_ij the covariance of the i-th and j-th coefficients... | stack_v2_sparse_classes_36k_train_000276 | 35,535 | permissive | [
{
"docstring": "Compute standard devation polynomial. Considering we have polynomial P(x) = \\\\sum_i a_i x^i, and \\\\sigma_ij the covariance of the i-th and j-th coefficients, a_i and a_j, we compute \\\\sigma_f(x) = \\\\sqrt(\\\\sum_ij \\\\sigma_ij x^{i+j}) as the variance of the polynomial f evaluated at x.... | 2 | stack_v2_sparse_classes_30k_train_002721 | Implement the Python class `Polynomial` described below.
Class description:
Store and evaluate polynomials with covariance matrix on their coefficients.
Method signatures and docstrings:
- def __init__(self, pol, cov): Compute standard devation polynomial. Considering we have polynomial P(x) = \\sum_i a_i x^i, and \\... | Implement the Python class `Polynomial` described below.
Class description:
Store and evaluate polynomials with covariance matrix on their coefficients.
Method signatures and docstrings:
- def __init__(self, pol, cov): Compute standard devation polynomial. Considering we have polynomial P(x) = \\sum_i a_i x^i, and \\... | 99107a0d4935296b673f67469c1e2bd258954b9b | <|skeleton|>
class Polynomial:
"""Store and evaluate polynomials with covariance matrix on their coefficients."""
def __init__(self, pol, cov):
"""Compute standard devation polynomial. Considering we have polynomial P(x) = \\sum_i a_i x^i, and \\sigma_ij the covariance of the i-th and j-th coefficients... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Polynomial:
"""Store and evaluate polynomials with covariance matrix on their coefficients."""
def __init__(self, pol, cov):
"""Compute standard devation polynomial. Considering we have polynomial P(x) = \\sum_i a_i x^i, and \\sigma_ij the covariance of the i-th and j-th coefficients, a_i and a_j... | the_stack_v2_python_sparse | maths.py | yketa/active_work | train | 1 |
675732ae168ccb0e8c271c6a81fc8c6c36c9b43d | [
"params = {'method': 'brooklyn.integers.create'}\ndata = urlencode(params)\nrequest = urllib2.Request(BROOKLYNT_URL, data, HEADERS)\nresponse = simplejson.load(urllib2.urlopen(request))\nif option == 'raw':\n result = response['integer']\nelse:\n result = 'Your hand-crafted integer is %s - %s ' % (response['i... | <|body_start_0|>
params = {'method': 'brooklyn.integers.create'}
data = urlencode(params)
request = urllib2.Request(BROOKLYNT_URL, data, HEADERS)
response = simplejson.load(urllib2.urlopen(request))
if option == 'raw':
result = response['integer']
else:
... | ArtisanalIntegers | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ArtisanalIntegers:
def brooklynt(self, irc, msg, args, option):
"""(brooklynt [raw]): Request a new hand-crafted artisanal integer from http://brooklynintegers.com"""
<|body_0|>
def missionint(self, irc, msg, args, option):
"""(missionint [raw]): Request a new hella ... | stack_v2_sparse_classes_36k_train_000277 | 3,585 | no_license | [
{
"docstring": "(brooklynt [raw]): Request a new hand-crafted artisanal integer from http://brooklynintegers.com",
"name": "brooklynt",
"signature": "def brooklynt(self, irc, msg, args, option)"
},
{
"docstring": "(missionint [raw]): Request a new hella artisanal integer from http://missioninteg... | 2 | stack_v2_sparse_classes_30k_train_019189 | Implement the Python class `ArtisanalIntegers` described below.
Class description:
Implement the ArtisanalIntegers class.
Method signatures and docstrings:
- def brooklynt(self, irc, msg, args, option): (brooklynt [raw]): Request a new hand-crafted artisanal integer from http://brooklynintegers.com
- def missionint(s... | Implement the Python class `ArtisanalIntegers` described below.
Class description:
Implement the ArtisanalIntegers class.
Method signatures and docstrings:
- def brooklynt(self, irc, msg, args, option): (brooklynt [raw]): Request a new hand-crafted artisanal integer from http://brooklynintegers.com
- def missionint(s... | 8c7f16c0584bdf393a56dccff6b35a83142e5ece | <|skeleton|>
class ArtisanalIntegers:
def brooklynt(self, irc, msg, args, option):
"""(brooklynt [raw]): Request a new hand-crafted artisanal integer from http://brooklynintegers.com"""
<|body_0|>
def missionint(self, irc, msg, args, option):
"""(missionint [raw]): Request a new hella ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ArtisanalIntegers:
def brooklynt(self, irc, msg, args, option):
"""(brooklynt [raw]): Request a new hand-crafted artisanal integer from http://brooklynintegers.com"""
params = {'method': 'brooklyn.integers.create'}
data = urlencode(params)
request = urllib2.Request(BROOKLYNT_UR... | the_stack_v2_python_sparse | plugins/ArtisanalIntegers/plugin.py | frumiousbandersnatch/supybot-plugins | train | 0 | |
c55358a55a80c02947fe6ece890005b7a1b1008d | [
"self.spooler = spool\nself.scope = scope\nself.hdf5File = hdf5File\nself.evts = self.hdf5File.createTable(hdf5File.root, 'Events', SpoolEvent)",
"if eventName == 'StartAq':\n eventDescr = '%d' % self.spooler.imNum\nev = self.evts.row\nev['EventName'] = eventName\nev['EventDescr'] = eventDescr\nev['Time'] = sp... | <|body_start_0|>
self.spooler = spool
self.scope = scope
self.hdf5File = hdf5File
self.evts = self.hdf5File.createTable(hdf5File.root, 'Events', SpoolEvent)
<|end_body_0|>
<|body_start_1|>
if eventName == 'StartAq':
eventDescr = '%d' % self.spooler.imNum
ev =... | Event logging backend for hdf/pytables data storage Parameters ---------- spool : instance of HDFSpooler.Spooler The spooler to ascociate this logger with scope : PYME.Acquire.microscope.microscope instance The current microscope object hdf5File : pytables hdf file The open HDF5 file to write to | EventLogger | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EventLogger:
"""Event logging backend for hdf/pytables data storage Parameters ---------- spool : instance of HDFSpooler.Spooler The spooler to ascociate this logger with scope : PYME.Acquire.microscope.microscope instance The current microscope object hdf5File : pytables hdf file The open HDF5 f... | stack_v2_sparse_classes_36k_train_000278 | 4,294 | no_license | [
{
"docstring": "Create a new Events table.",
"name": "__init__",
"signature": "def __init__(self, spool, scope, hdf5File)"
},
{
"docstring": "Log an event. Parameters ---------- eventName : string short event name - < 32 chars and should be shared by events of the same type. eventDescr : string ... | 2 | null | Implement the Python class `EventLogger` described below.
Class description:
Event logging backend for hdf/pytables data storage Parameters ---------- spool : instance of HDFSpooler.Spooler The spooler to ascociate this logger with scope : PYME.Acquire.microscope.microscope instance The current microscope object hdf5F... | Implement the Python class `EventLogger` described below.
Class description:
Event logging backend for hdf/pytables data storage Parameters ---------- spool : instance of HDFSpooler.Spooler The spooler to ascociate this logger with scope : PYME.Acquire.microscope.microscope instance The current microscope object hdf5F... | 6596167034c727ad7dad0a741dd59e0e48f6852a | <|skeleton|>
class EventLogger:
"""Event logging backend for hdf/pytables data storage Parameters ---------- spool : instance of HDFSpooler.Spooler The spooler to ascociate this logger with scope : PYME.Acquire.microscope.microscope instance The current microscope object hdf5File : pytables hdf file The open HDF5 f... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EventLogger:
"""Event logging backend for hdf/pytables data storage Parameters ---------- spool : instance of HDFSpooler.Spooler The spooler to ascociate this logger with scope : PYME.Acquire.microscope.microscope instance The current microscope object hdf5File : pytables hdf file The open HDF5 file to write ... | the_stack_v2_python_sparse | PYME/Acquire/HDFSpooler.py | WilliamRo/CLipPYME | train | 3 |
95ccbca9ab4511ef0d7eb02966dfdef1d11030fb | [
"res = []\nif not root:\n return []\nqueue = [root]\nwhile queue:\n n = len(queue)\n i = 0\n while i < n:\n node = queue.pop(0)\n if node:\n node_val = node.val\n res.append(str(node_val))\n queue.append(node.left)\n queue.append(node.right)\n ... | <|body_start_0|>
res = []
if not root:
return []
queue = [root]
while queue:
n = len(queue)
i = 0
while i < n:
node = queue.pop(0)
if node:
node_val = node.val
res.appe... | My own bfs solution; not efficient | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
"""My own bfs solution; not efficient"""
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"""
... | stack_v2_sparse_classes_36k_train_000279 | 7,655 | 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` described below.
Class description:
My own bfs solution; not efficient
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` described below.
Class description:
My own bfs solution; not efficient
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... | 3ea03cd8b1fa507553ebee4fd765c4cc4b5814b6 | <|skeleton|>
class Codec:
"""My own bfs solution; not efficient"""
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"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
"""My own bfs solution; not efficient"""
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
res = []
if not root:
return []
queue = [root]
while queue:
n = len(queue)
i = 0... | the_stack_v2_python_sparse | Serialize_and_Deserialize_Binary_Tree_297.py | jay6413682/Leetcode | train | 0 |
25744b01fc219392b0f4b983a9f0f66d14e70682 | [
"self.verbose = None\nsdist_.__init__(self, distribution)\nself.__buildConfiguration = BuildConfiguration()\nself.dist_dir = self.__buildConfiguration.distDirectory",
"self._prepare()\nfor commandName in self.get_sub_commands():\n self.run_command(commandName)\nself.distribution.packages = self.__buildConfigur... | <|body_start_0|>
self.verbose = None
sdist_.__init__(self, distribution)
self.__buildConfiguration = BuildConfiguration()
self.dist_dir = self.__buildConfiguration.distDirectory
<|end_body_0|>
<|body_start_1|>
self._prepare()
for commandName in self.get_sub_commands():
... | Adapted sdist target. | sdist | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class sdist:
"""Adapted sdist target."""
def __init__(self, distribution):
"""Constructor."""
<|body_0|>
def run(self):
"""Sets some new configuration values and runs the default run method of the sdist target."""
<|body_1|>
def _prepare(self):
"""... | stack_v2_sparse_classes_36k_train_000280 | 7,376 | no_license | [
{
"docstring": "Constructor.",
"name": "__init__",
"signature": "def __init__(self, distribution)"
},
{
"docstring": "Sets some new configuration values and runs the default run method of the sdist target.",
"name": "run",
"signature": "def run(self)"
},
{
"docstring": "Prepares ... | 6 | stack_v2_sparse_classes_30k_train_012394 | Implement the Python class `sdist` described below.
Class description:
Adapted sdist target.
Method signatures and docstrings:
- def __init__(self, distribution): Constructor.
- def run(self): Sets some new configuration values and runs the default run method of the sdist target.
- def _prepare(self): Prepares the so... | Implement the Python class `sdist` described below.
Class description:
Adapted sdist target.
Method signatures and docstrings:
- def __init__(self, distribution): Constructor.
- def run(self): Sets some new configuration values and runs the default run method of the sdist target.
- def _prepare(self): Prepares the so... | 958fda4f3064f9f6b2034da396a20ac9d9abd52f | <|skeleton|>
class sdist:
"""Adapted sdist target."""
def __init__(self, distribution):
"""Constructor."""
<|body_0|>
def run(self):
"""Sets some new configuration values and runs the default run method of the sdist target."""
<|body_1|>
def _prepare(self):
"""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class sdist:
"""Adapted sdist target."""
def __init__(self, distribution):
"""Constructor."""
self.verbose = None
sdist_.__init__(self, distribution)
self.__buildConfiguration = BuildConfiguration()
self.dist_dir = self.__buildConfiguration.distDirectory
def run(sel... | the_stack_v2_python_sparse | build_scripts/distutils/src/datafinder_distutils/targets/sdist.py | DLR-SC/DataFinder | train | 9 |
05222fa55e400b7181c837f70ebbddba316b214f | [
"try:\n X = np.array(sample_batch).reshape(1, -1)\n kde = KernelDensity()\n kde.fit(X)\n est = kde.sample().item(0)\nexcept:\n return random.choice(sample_batch)\nreturn abs(est) if 'float' in str(dtype) else abs(int(est))",
"if dtype is str:\n if 'sample_batch' in params:\n values = para... | <|body_start_0|>
try:
X = np.array(sample_batch).reshape(1, -1)
kde = KernelDensity()
kde.fit(X)
est = kde.sample().item(0)
except:
return random.choice(sample_batch)
return abs(est) if 'float' in str(dtype) else abs(int(est))
<|end_bod... | Utility class for generating distributions and fitting data to a distribution for further analysis | DistributionUtils | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DistributionUtils:
"""Utility class for generating distributions and fitting data to a distribution for further analysis"""
def get_estimated_rand(dtype, sample_batch):
"""Generate random value based on empirical distribution of given sequence of values Distribution is estimated usin... | stack_v2_sparse_classes_36k_train_000281 | 2,307 | no_license | [
{
"docstring": "Generate random value based on empirical distribution of given sequence of values Distribution is estimated using a kernel distribution estimator (KDE) :param dtype: Type of variables in the sample batch used for fitting estimation (e.g., int, float) :param sample_batch: Sequence of value for fi... | 2 | null | Implement the Python class `DistributionUtils` described below.
Class description:
Utility class for generating distributions and fitting data to a distribution for further analysis
Method signatures and docstrings:
- def get_estimated_rand(dtype, sample_batch): Generate random value based on empirical distribution o... | Implement the Python class `DistributionUtils` described below.
Class description:
Utility class for generating distributions and fitting data to a distribution for further analysis
Method signatures and docstrings:
- def get_estimated_rand(dtype, sample_batch): Generate random value based on empirical distribution o... | b66862bd469bf078ca12bdb692e39675d40c96b8 | <|skeleton|>
class DistributionUtils:
"""Utility class for generating distributions and fitting data to a distribution for further analysis"""
def get_estimated_rand(dtype, sample_batch):
"""Generate random value based on empirical distribution of given sequence of values Distribution is estimated usin... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DistributionUtils:
"""Utility class for generating distributions and fitting data to a distribution for further analysis"""
def get_estimated_rand(dtype, sample_batch):
"""Generate random value based on empirical distribution of given sequence of values Distribution is estimated using a kernel di... | the_stack_v2_python_sparse | Utils/DistributionUtils.py | Navypowder/MiDiPSA-for-non-stationary-streams | train | 0 |
395894b682ece2b60e052c6f592624dfa651517f | [
"super().__init__(min_neg=min_neg, batch_size_per_image=batch_size_per_image, positive_fraction=positive_fraction, pool_size=pool_size)\nself._batch_size_per_image = batch_size_per_image\nlogger.info('Sampling hard negatives on a per batch basis')",
"batch_size = len(target_labels)\nself.batch_size_per_image = se... | <|body_start_0|>
super().__init__(min_neg=min_neg, batch_size_per_image=batch_size_per_image, positive_fraction=positive_fraction, pool_size=pool_size)
self._batch_size_per_image = batch_size_per_image
logger.info('Sampling hard negatives on a per batch basis')
<|end_body_0|>
<|body_start_1|>
... | Samples negatives and positives on a per batch basis (default sampler only does this on a per image basis) Note: :attr:`batch_size_per_image` is manipulated to sample the correct number of samples per batch, use :attr:`_batch_size_per_image` to get the number of anchors per image | HardNegativeSamplerBatched | [
"BSD-3-Clause",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HardNegativeSamplerBatched:
"""Samples negatives and positives on a per batch basis (default sampler only does this on a per image basis) Note: :attr:`batch_size_per_image` is manipulated to sample the correct number of samples per batch, use :attr:`_batch_size_per_image` to get the number of anc... | stack_v2_sparse_classes_36k_train_000282 | 13,985 | permissive | [
{
"docstring": "Args: batch_size_per_image (int): number of elements to be selected per image positive_fraction (float): percentage of positive elements per batch pool_size (float): hard negatives are sampled from a pool of size: batch_size_per_image * (1 - positive_fraction) * pool_size",
"name": "__init__... | 2 | stack_v2_sparse_classes_30k_train_011530 | Implement the Python class `HardNegativeSamplerBatched` described below.
Class description:
Samples negatives and positives on a per batch basis (default sampler only does this on a per image basis) Note: :attr:`batch_size_per_image` is manipulated to sample the correct number of samples per batch, use :attr:`_batch_s... | Implement the Python class `HardNegativeSamplerBatched` described below.
Class description:
Samples negatives and positives on a per batch basis (default sampler only does this on a per image basis) Note: :attr:`batch_size_per_image` is manipulated to sample the correct number of samples per batch, use :attr:`_batch_s... | 4f41faa7536dcef8fca7b647dcdca25360e5b58a | <|skeleton|>
class HardNegativeSamplerBatched:
"""Samples negatives and positives on a per batch basis (default sampler only does this on a per image basis) Note: :attr:`batch_size_per_image` is manipulated to sample the correct number of samples per batch, use :attr:`_batch_size_per_image` to get the number of anc... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HardNegativeSamplerBatched:
"""Samples negatives and positives on a per batch basis (default sampler only does this on a per image basis) Note: :attr:`batch_size_per_image` is manipulated to sample the correct number of samples per batch, use :attr:`_batch_size_per_image` to get the number of anchors per imag... | the_stack_v2_python_sparse | nndet/core/boxes/sampler.py | dboun/nnDetection | train | 1 |
5c523790f72394199efd1410913149de42d7fc2b | [
"if 'user' not in kwargs:\n raise AssertionError('<user> is not defined')\nobj = super(StreamManager, self).create(**kwargs)\nreturn obj",
"if 'user' not in kwargs:\n raise AssertionError('<user> is not defined')\nreturn self.create(name='main', **kwargs)"
] | <|body_start_0|>
if 'user' not in kwargs:
raise AssertionError('<user> is not defined')
obj = super(StreamManager, self).create(**kwargs)
return obj
<|end_body_0|>
<|body_start_1|>
if 'user' not in kwargs:
raise AssertionError('<user> is not defined')
ret... | StreamManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StreamManager:
def create(self, **kwargs):
"""Create new UserFeed / UserFeedVector"""
<|body_0|>
def create_main(self, **kwargs):
"""Create a new default UserFeed / UserFeedVector, named 'main'"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if 'use... | stack_v2_sparse_classes_36k_train_000283 | 6,832 | no_license | [
{
"docstring": "Create new UserFeed / UserFeedVector",
"name": "create",
"signature": "def create(self, **kwargs)"
},
{
"docstring": "Create a new default UserFeed / UserFeedVector, named 'main'",
"name": "create_main",
"signature": "def create_main(self, **kwargs)"
}
] | 2 | null | Implement the Python class `StreamManager` described below.
Class description:
Implement the StreamManager class.
Method signatures and docstrings:
- def create(self, **kwargs): Create new UserFeed / UserFeedVector
- def create_main(self, **kwargs): Create a new default UserFeed / UserFeedVector, named 'main' | Implement the Python class `StreamManager` described below.
Class description:
Implement the StreamManager class.
Method signatures and docstrings:
- def create(self, **kwargs): Create new UserFeed / UserFeedVector
- def create_main(self, **kwargs): Create a new default UserFeed / UserFeedVector, named 'main'
<|skel... | 260ce54d2da53c943d8b82fa9d40bb0c0df918a6 | <|skeleton|>
class StreamManager:
def create(self, **kwargs):
"""Create new UserFeed / UserFeedVector"""
<|body_0|>
def create_main(self, **kwargs):
"""Create a new default UserFeed / UserFeedVector, named 'main'"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StreamManager:
def create(self, **kwargs):
"""Create new UserFeed / UserFeedVector"""
if 'user' not in kwargs:
raise AssertionError('<user> is not defined')
obj = super(StreamManager, self).create(**kwargs)
return obj
def create_main(self, **kwargs):
""... | the_stack_v2_python_sparse | etalia/feeds/models.py | GemmaAA1/etalia-open | train | 0 | |
c120acd5af964ec3df331bad4fdbd6ba6a8889a2 | [
"super(RobertaEmbeddings, self).__init__()\nself.padding_idx = 1\nself.word_embeddings = nn.Embedding(config.vocab_size, config.hidden_size, padding_idx=self.padding_idx)\nself.position_embeddings = nn.Embedding(config.max_position_embeddings, config.hidden_size)\nself.token_type_embeddings = nn.Embedding(config.ty... | <|body_start_0|>
super(RobertaEmbeddings, self).__init__()
self.padding_idx = 1
self.word_embeddings = nn.Embedding(config.vocab_size, config.hidden_size, padding_idx=self.padding_idx)
self.position_embeddings = nn.Embedding(config.max_position_embeddings, config.hidden_size)
sel... | Construct the embeddings from word, position and token_type embeddings. | RobertaEmbeddings | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RobertaEmbeddings:
"""Construct the embeddings from word, position and token_type embeddings."""
def __init__(self, config):
"""init fun"""
<|body_0|>
def construct(self, input_ids, token_type_ids):
"""construct fun"""
<|body_1|>
<|end_skeleton|>
<|body... | stack_v2_sparse_classes_36k_train_000284 | 16,172 | permissive | [
{
"docstring": "init fun",
"name": "__init__",
"signature": "def __init__(self, config)"
},
{
"docstring": "construct fun",
"name": "construct",
"signature": "def construct(self, input_ids, token_type_ids)"
}
] | 2 | null | Implement the Python class `RobertaEmbeddings` described below.
Class description:
Construct the embeddings from word, position and token_type embeddings.
Method signatures and docstrings:
- def __init__(self, config): init fun
- def construct(self, input_ids, token_type_ids): construct fun | Implement the Python class `RobertaEmbeddings` described below.
Class description:
Construct the embeddings from word, position and token_type embeddings.
Method signatures and docstrings:
- def __init__(self, config): init fun
- def construct(self, input_ids, token_type_ids): construct fun
<|skeleton|>
class Robert... | eab643f51336dbf7d711f02d27e6516e5affee59 | <|skeleton|>
class RobertaEmbeddings:
"""Construct the embeddings from word, position and token_type embeddings."""
def __init__(self, config):
"""init fun"""
<|body_0|>
def construct(self, input_ids, token_type_ids):
"""construct fun"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RobertaEmbeddings:
"""Construct the embeddings from word, position and token_type embeddings."""
def __init__(self, config):
"""init fun"""
super(RobertaEmbeddings, self).__init__()
self.padding_idx = 1
self.word_embeddings = nn.Embedding(config.vocab_size, config.hidden_s... | the_stack_v2_python_sparse | research/nlp/luke/src/luke/robert.py | mindspore-ai/models | train | 301 |
ad228c5f54f756b71bba6135f76eae3ed7c8898f | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn UserActivity()",
"from .activity_history_item import ActivityHistoryItem\nfrom .entity import Entity\nfrom .json import Json\nfrom .status import Status\nfrom .visual_info import VisualInfo\nfrom .activity_history_item import ActivityH... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return UserActivity()
<|end_body_0|>
<|body_start_1|>
from .activity_history_item import ActivityHistoryItem
from .entity import Entity
from .json import Json
from .status impor... | UserActivity | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserActivity:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserActivity:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: ... | stack_v2_sparse_classes_36k_train_000285 | 7,426 | 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: UserActivity",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_value(... | 3 | null | Implement the Python class `UserActivity` described below.
Class description:
Implement the UserActivity class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserActivity: Creates a new instance of the appropriate class based on discriminator value Ar... | Implement the Python class `UserActivity` described below.
Class description:
Implement the UserActivity class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserActivity: Creates a new instance of the appropriate class based on discriminator value Ar... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class UserActivity:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserActivity:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserActivity:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserActivity:
"""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: UserActivity""... | the_stack_v2_python_sparse | msgraph/generated/models/user_activity.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
58d8c2271fb423f8309143ccf3d44b10f145e02b | [
"ride = self.context['view'].get_object()\nuser = data['passanger']\nif not ride.passangers.filter(pk=user.pk).exists():\n raise serializers.ValidationError('El pasajero no esta en este ride')\nif Raitings.objects.filter(ride=ride, passanger=user).exists():\n raise serializers.ValidationError('El pasajero ya ... | <|body_start_0|>
ride = self.context['view'].get_object()
user = data['passanger']
if not ride.passangers.filter(pk=user.pk).exists():
raise serializers.ValidationError('El pasajero no esta en este ride')
if Raitings.objects.filter(ride=ride, passanger=user).exists():
... | Score Ride serializer | SocoreRideSerializer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SocoreRideSerializer:
"""Score Ride serializer"""
def validate(self, data):
"""Verify qeu el usuario pertenece al ride y el ride esta finalizado"""
<|body_0|>
def create(self, data):
"""Create new circle member"""
<|body_1|>
<|end_skeleton|>
<|body_star... | stack_v2_sparse_classes_36k_train_000286 | 7,953 | no_license | [
{
"docstring": "Verify qeu el usuario pertenece al ride y el ride esta finalizado",
"name": "validate",
"signature": "def validate(self, data)"
},
{
"docstring": "Create new circle member",
"name": "create",
"signature": "def create(self, data)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007203 | Implement the Python class `SocoreRideSerializer` described below.
Class description:
Score Ride serializer
Method signatures and docstrings:
- def validate(self, data): Verify qeu el usuario pertenece al ride y el ride esta finalizado
- def create(self, data): Create new circle member | Implement the Python class `SocoreRideSerializer` described below.
Class description:
Score Ride serializer
Method signatures and docstrings:
- def validate(self, data): Verify qeu el usuario pertenece al ride y el ride esta finalizado
- def create(self, data): Create new circle member
<|skeleton|>
class SocoreRideS... | 0cede53169041667bd40bbce3c4774af84ffc2fa | <|skeleton|>
class SocoreRideSerializer:
"""Score Ride serializer"""
def validate(self, data):
"""Verify qeu el usuario pertenece al ride y el ride esta finalizado"""
<|body_0|>
def create(self, data):
"""Create new circle member"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SocoreRideSerializer:
"""Score Ride serializer"""
def validate(self, data):
"""Verify qeu el usuario pertenece al ride y el ride esta finalizado"""
ride = self.context['view'].get_object()
user = data['passanger']
if not ride.passangers.filter(pk=user.pk).exists():
... | the_stack_v2_python_sparse | rides/serializers/rides.py | KrystellCR/DjangoRF | train | 0 |
36609279cce4904b105e5587adb4f7422cadeaf8 | [
"super().__init__()\nself.hidden_layers = nn.ModuleList([nn.Linear(input_size, hidden_layers[0])])\nlayer_sizes = zip(hidden_layers[:-1], hidden_layers[1:])\nself.hidden_layers.extend([nn.Linear(h1, h2) for h1, h2 in layer_sizes])\nself.output = nn.Linear(hidden_layers[-1], output_size)\nself.dropout = nn.Dropout(p... | <|body_start_0|>
super().__init__()
self.hidden_layers = nn.ModuleList([nn.Linear(input_size, hidden_layers[0])])
layer_sizes = zip(hidden_layers[:-1], hidden_layers[1:])
self.hidden_layers.extend([nn.Linear(h1, h2) for h1, h2 in layer_sizes])
self.output = nn.Linear(hidden_layer... | Network | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Network:
def __init__(self, input_size, output_size, hidden_layers, drop_p=0.5):
"""Builds a feedforward network with arbitrary hidden layers. Arguments --------- input_size: integer, size of the input layer output_size: integer, size of the output layer hidden_layers: list of integers, ... | stack_v2_sparse_classes_36k_train_000287 | 5,507 | no_license | [
{
"docstring": "Builds a feedforward network with arbitrary hidden layers. Arguments --------- input_size: integer, size of the input layer output_size: integer, size of the output layer hidden_layers: list of integers, the sizes of the hidden layers",
"name": "__init__",
"signature": "def __init__(self... | 2 | stack_v2_sparse_classes_30k_train_017257 | Implement the Python class `Network` described below.
Class description:
Implement the Network class.
Method signatures and docstrings:
- def __init__(self, input_size, output_size, hidden_layers, drop_p=0.5): Builds a feedforward network with arbitrary hidden layers. Arguments --------- input_size: integer, size of ... | Implement the Python class `Network` described below.
Class description:
Implement the Network class.
Method signatures and docstrings:
- def __init__(self, input_size, output_size, hidden_layers, drop_p=0.5): Builds a feedforward network with arbitrary hidden layers. Arguments --------- input_size: integer, size of ... | 3e7e33b94e5eb3e4a8fba866132bcce9635b44f0 | <|skeleton|>
class Network:
def __init__(self, input_size, output_size, hidden_layers, drop_p=0.5):
"""Builds a feedforward network with arbitrary hidden layers. Arguments --------- input_size: integer, size of the input layer output_size: integer, size of the output layer hidden_layers: list of integers, ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Network:
def __init__(self, input_size, output_size, hidden_layers, drop_p=0.5):
"""Builds a feedforward network with arbitrary hidden layers. Arguments --------- input_size: integer, size of the input layer output_size: integer, size of the output layer hidden_layers: list of integers, the sizes of t... | the_stack_v2_python_sparse | Intro_Pytorch_Lecture/codes/18_load_cat_dog_data.py | pelinbalci/Intro_Deep_Learning | train | 1 | |
40d4c959dfab70ff3362e055e620a0eaa5c21411 | [
"if do_generate:\n self.game_map = self.generate(size)\nelse:\n self.game_map = []",
"trap_count = int(size ** 2 / RATIO_TRAPS)\ntreasure_count = int(size ** 2 / RATIO_TREASURE)\nif trap_count <= 0:\n raise MapInitError('Error initializing trap count. Try larger map size.')\nif treasure_count < config.PL... | <|body_start_0|>
if do_generate:
self.game_map = self.generate(size)
else:
self.game_map = []
<|end_body_0|>
<|body_start_1|>
trap_count = int(size ** 2 / RATIO_TRAPS)
treasure_count = int(size ** 2 / RATIO_TREASURE)
if trap_count <= 0:
raise ... | DungeonMap | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DungeonMap:
def __init__(self, size, do_generate=True):
"""Class constructor :param size: Generated map size :param do_generate: Whether to initiate map generation"""
<|body_0|>
def generate(self, size):
"""Generates map for Dungeon Game :param size: Map square size ... | stack_v2_sparse_classes_36k_train_000288 | 5,735 | permissive | [
{
"docstring": "Class constructor :param size: Generated map size :param do_generate: Whether to initiate map generation",
"name": "__init__",
"signature": "def __init__(self, size, do_generate=True)"
},
{
"docstring": "Generates map for Dungeon Game :param size: Map square size :return: None",
... | 6 | stack_v2_sparse_classes_30k_val_000928 | Implement the Python class `DungeonMap` described below.
Class description:
Implement the DungeonMap class.
Method signatures and docstrings:
- def __init__(self, size, do_generate=True): Class constructor :param size: Generated map size :param do_generate: Whether to initiate map generation
- def generate(self, size... | Implement the Python class `DungeonMap` described below.
Class description:
Implement the DungeonMap class.
Method signatures and docstrings:
- def __init__(self, size, do_generate=True): Class constructor :param size: Generated map size :param do_generate: Whether to initiate map generation
- def generate(self, size... | 291592e97b6d8fe9f9e6627dc0023875918d3463 | <|skeleton|>
class DungeonMap:
def __init__(self, size, do_generate=True):
"""Class constructor :param size: Generated map size :param do_generate: Whether to initiate map generation"""
<|body_0|>
def generate(self, size):
"""Generates map for Dungeon Game :param size: Map square size ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DungeonMap:
def __init__(self, size, do_generate=True):
"""Class constructor :param size: Generated map size :param do_generate: Whether to initiate map generation"""
if do_generate:
self.game_map = self.generate(size)
else:
self.game_map = []
def generate(... | the_stack_v2_python_sparse | Kyrylo_Yeremenko/10/dungeon_game/dungeon_map.py | SmischenkoB/campus_2018_python | train | 0 | |
0635396e064a0e8119c4290bc7b88275d1198949 | [
"attachment = Attachment.query.get(attachment_id)\nif attachment is None:\n return abort(HTTPStatus.NOT_FOUND, message='Attachment is not found')\nreturn attachment",
"attachment = Attachment.query.get(attachment_id)\nif attachment is None:\n return abort(HTTPStatus.NOT_FOUND, message='Attachment is not fou... | <|body_start_0|>
attachment = Attachment.query.get(attachment_id)
if attachment is None:
return abort(HTTPStatus.NOT_FOUND, message='Attachment is not found')
return attachment
<|end_body_0|>
<|body_start_1|>
attachment = Attachment.query.get(attachment_id)
if attach... | AttachmentItem | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AttachmentItem:
def get(self, attachment_id):
"""Get attachment info"""
<|body_0|>
def delete(self, attachment_id):
"""Delete attachment * User can delete **their attachment** if discussion is not frozen * User with permission to **"edit theses"** can delete the atta... | stack_v2_sparse_classes_36k_train_000289 | 1,907 | permissive | [
{
"docstring": "Get attachment info",
"name": "get",
"signature": "def get(self, attachment_id)"
},
{
"docstring": "Delete attachment * User can delete **their attachment** if discussion is not frozen * User with permission to **\"edit theses\"** can delete the attachment",
"name": "delete",... | 2 | stack_v2_sparse_classes_30k_train_004341 | Implement the Python class `AttachmentItem` described below.
Class description:
Implement the AttachmentItem class.
Method signatures and docstrings:
- def get(self, attachment_id): Get attachment info
- def delete(self, attachment_id): Delete attachment * User can delete **their attachment** if discussion is not fro... | Implement the Python class `AttachmentItem` described below.
Class description:
Implement the AttachmentItem class.
Method signatures and docstrings:
- def get(self, attachment_id): Get attachment info
- def delete(self, attachment_id): Delete attachment * User can delete **their attachment** if discussion is not fro... | dce87ffe395ae4bd08b47f28e07594e1889da819 | <|skeleton|>
class AttachmentItem:
def get(self, attachment_id):
"""Get attachment info"""
<|body_0|>
def delete(self, attachment_id):
"""Delete attachment * User can delete **their attachment** if discussion is not frozen * User with permission to **"edit theses"** can delete the atta... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AttachmentItem:
def get(self, attachment_id):
"""Get attachment info"""
attachment = Attachment.query.get(attachment_id)
if attachment is None:
return abort(HTTPStatus.NOT_FOUND, message='Attachment is not found')
return attachment
def delete(self, attachment_i... | the_stack_v2_python_sparse | src/backend/app/api/public/attachments/attachment/attachment.py | aimanow/sft | train | 0 | |
65e9a97fbd8980ae9d511c6a3121367ceb273540 | [
"res = []\nnums_count = Counter(nums)\nfor num, count in nums_count.items():\n if count > len(nums) / 3:\n res.append(num)\nreturn res",
"if not nums:\n return []\ncount1, count2, candidate1, candidate2 = (0, 0, 0, 1)\nfor n in nums:\n if n == candidate1:\n count1 += 1\n elif n == candid... | <|body_start_0|>
res = []
nums_count = Counter(nums)
for num, count in nums_count.items():
if count > len(nums) / 3:
res.append(num)
return res
<|end_body_0|>
<|body_start_1|>
if not nums:
return []
count1, count2, candidate1, cand... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def majorityElement(self, nums):
"""Time: N Space: N :type nums: List[int] :rtype: List[int]"""
<|body_0|>
def majorityElement2(self, nums):
"""Time: N Space: 1 :type nums: List[int] :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|... | stack_v2_sparse_classes_36k_train_000290 | 1,264 | permissive | [
{
"docstring": "Time: N Space: N :type nums: List[int] :rtype: List[int]",
"name": "majorityElement",
"signature": "def majorityElement(self, nums)"
},
{
"docstring": "Time: N Space: 1 :type nums: List[int] :rtype: List[int]",
"name": "majorityElement2",
"signature": "def majorityElement... | 2 | stack_v2_sparse_classes_30k_train_002997 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def majorityElement(self, nums): Time: N Space: N :type nums: List[int] :rtype: List[int]
- def majorityElement2(self, nums): Time: N Space: 1 :type nums: List[int] :rtype: List[... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def majorityElement(self, nums): Time: N Space: N :type nums: List[int] :rtype: List[int]
- def majorityElement2(self, nums): Time: N Space: 1 :type nums: List[int] :rtype: List[... | d2ffcccede5d1543aea48f18a39cdbd3d83e3ed8 | <|skeleton|>
class Solution:
def majorityElement(self, nums):
"""Time: N Space: N :type nums: List[int] :rtype: List[int]"""
<|body_0|>
def majorityElement2(self, nums):
"""Time: N Space: 1 :type nums: List[int] :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def majorityElement(self, nums):
"""Time: N Space: N :type nums: List[int] :rtype: List[int]"""
res = []
nums_count = Counter(nums)
for num, count in nums_count.items():
if count > len(nums) / 3:
res.append(num)
return res
def ... | the_stack_v2_python_sparse | arrays/majority_element.py | kandarpck/leetcode | train | 0 | |
42c785c4a9aec3d489f419a51908a0d75ad5f644 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn HostReputation()",
"from ..entity import Entity\nfrom .host_reputation_classification import HostReputationClassification\nfrom .host_reputation_rule import HostReputationRule\nfrom ..entity import Entity\nfrom .host_reputation_classif... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return HostReputation()
<|end_body_0|>
<|body_start_1|>
from ..entity import Entity
from .host_reputation_classification import HostReputationClassification
from .host_reputation_rule i... | HostReputation | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HostReputation:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> HostReputation:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Retur... | stack_v2_sparse_classes_36k_train_000291 | 3,084 | 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: HostReputation",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_valu... | 3 | stack_v2_sparse_classes_30k_train_016700 | Implement the Python class `HostReputation` described below.
Class description:
Implement the HostReputation class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> HostReputation: Creates a new instance of the appropriate class based on discriminator va... | Implement the Python class `HostReputation` described below.
Class description:
Implement the HostReputation class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> HostReputation: Creates a new instance of the appropriate class based on discriminator va... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class HostReputation:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> HostReputation:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Retur... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HostReputation:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> HostReputation:
"""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: HostReputa... | the_stack_v2_python_sparse | msgraph/generated/models/security/host_reputation.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
e61062e71a5eb6cd3a361ec2ce06838a9594b732 | [
"if not repodirs:\n repodirs = self.registryValue('repos')\nif not repodirs:\n irc.error('No repositories given.', Raise=True)\nfor repodir in repodirs:\n inst = popen2.Popen4(darcsCommandLine % {'REPODIR': repodir})\n lines = [line.rstrip() for line in inst.fromchild]\n irc.replies(lines, prefixer='... | <|body_start_0|>
if not repodirs:
repodirs = self.registryValue('repos')
if not repodirs:
irc.error('No repositories given.', Raise=True)
for repodir in repodirs:
inst = popen2.Popen4(darcsCommandLine % {'REPODIR': repodir})
lines = [line.rstrip() ... | Darcs | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Darcs:
def pull(self, irc, msg, args, repodirs):
"""[<repodir> [<repodir> [...]]] Does a darcs pull on <repodir>. If <repodir> is not given, uses the default configured repodirs."""
<|body_0|>
def install(self, irc, msg, args):
"""takes no arguments Does an install, ... | stack_v2_sparse_classes_36k_train_000292 | 3,351 | no_license | [
{
"docstring": "[<repodir> [<repodir> [...]]] Does a darcs pull on <repodir>. If <repodir> is not given, uses the default configured repodirs.",
"name": "pull",
"signature": "def pull(self, irc, msg, args, repodirs)"
},
{
"docstring": "takes no arguments Does an install, executing the string sup... | 2 | null | Implement the Python class `Darcs` described below.
Class description:
Implement the Darcs class.
Method signatures and docstrings:
- def pull(self, irc, msg, args, repodirs): [<repodir> [<repodir> [...]]] Does a darcs pull on <repodir>. If <repodir> is not given, uses the default configured repodirs.
- def install(s... | Implement the Python class `Darcs` described below.
Class description:
Implement the Darcs class.
Method signatures and docstrings:
- def pull(self, irc, msg, args, repodirs): [<repodir> [<repodir> [...]]] Does a darcs pull on <repodir>. If <repodir> is not given, uses the default configured repodirs.
- def install(s... | 6838f7ae22ad1905272cf7e003fb803e637c87d8 | <|skeleton|>
class Darcs:
def pull(self, irc, msg, args, repodirs):
"""[<repodir> [<repodir> [...]]] Does a darcs pull on <repodir>. If <repodir> is not given, uses the default configured repodirs."""
<|body_0|>
def install(self, irc, msg, args):
"""takes no arguments Does an install, ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Darcs:
def pull(self, irc, msg, args, repodirs):
"""[<repodir> [<repodir> [...]]] Does a darcs pull on <repodir>. If <repodir> is not given, uses the default configured repodirs."""
if not repodirs:
repodirs = self.registryValue('repos')
if not repodirs:
irc.err... | the_stack_v2_python_sparse | Darcs/plugin.py | stepnem/supybot-plugins | train | 8 | |
7cd6900e93bd8bd4d4932c136f0ca36f066318b3 | [
"self.name = name\nself.pattern = pattern\nself.regex = re.compile(pattern)\nself.f_getval = f_getval\nself.f_format = f_format\nself.value = value",
"match = self.regex.match(input)\nif match:\n self.value = self.f_getval(match)\n mi_logger.debug('Updated parameter %s=%s', self.name, str(self.value))\n ... | <|body_start_0|>
self.name = name
self.pattern = pattern
self.regex = re.compile(pattern)
self.f_getval = f_getval
self.f_format = f_format
self.value = value
<|end_body_0|>
<|body_start_1|>
match = self.regex.match(input)
if match:
self.value... | A parameter dictionary value. | ParameterDictVal | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ParameterDictVal:
"""A parameter dictionary value."""
def __init__(self, name, pattern, f_getval, f_format, value=None):
"""Parameter value constructor. @param name The parameter name. @param pattern The regex that matches the parameter in line output. @param f_getval The fuction tha... | stack_v2_sparse_classes_36k_train_000293 | 4,493 | no_license | [
{
"docstring": "Parameter value constructor. @param name The parameter name. @param pattern The regex that matches the parameter in line output. @param f_getval The fuction that extracts the value from a regex match. @param f_format The function that formats the parameter value for a set command. @param value T... | 2 | stack_v2_sparse_classes_30k_train_010233 | Implement the Python class `ParameterDictVal` described below.
Class description:
A parameter dictionary value.
Method signatures and docstrings:
- def __init__(self, name, pattern, f_getval, f_format, value=None): Parameter value constructor. @param name The parameter name. @param pattern The regex that matches the ... | Implement the Python class `ParameterDictVal` described below.
Class description:
A parameter dictionary value.
Method signatures and docstrings:
- def __init__(self, name, pattern, f_getval, f_format, value=None): Parameter value constructor. @param name The parameter name. @param pattern The regex that matches the ... | 1d5dbd711b9e5e26837aa1e737124605bdd606e4 | <|skeleton|>
class ParameterDictVal:
"""A parameter dictionary value."""
def __init__(self, name, pattern, f_getval, f_format, value=None):
"""Parameter value constructor. @param name The parameter name. @param pattern The regex that matches the parameter in line output. @param f_getval The fuction tha... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ParameterDictVal:
"""A parameter dictionary value."""
def __init__(self, name, pattern, f_getval, f_format, value=None):
"""Parameter value constructor. @param name The parameter name. @param pattern The regex that matches the parameter in line output. @param f_getval The fuction that extracts th... | the_stack_v2_python_sparse | ion/agents/instrument/protocol_param_dict.py | ooici-dm/coi-services | train | 4 |
22903972f9180b9d44b0f2736cb8049ba3c18095 | [
"self.model = model\nself.n_features = x.shape[1]\nself.cv_split = cv_split\nself.x = x\nself.y = y\nself.random_state = random_state\nself.n_pop = n_pop\nself.n_gen = n_gen\nprint('The number of Features received by the system is : {}'.format(self.n_features))\nprint('The Shape of Training Data is : {} and Target ... | <|body_start_0|>
self.model = model
self.n_features = x.shape[1]
self.cv_split = cv_split
self.x = x
self.y = y
self.random_state = random_state
self.n_pop = n_pop
self.n_gen = n_gen
print('The number of Features received by the system is : {}'.for... | FeatureSelectionGA This Class uses Genetic Algorithm to find out the best features for the input model using Distributed Evolutionary Algorithms in Python(DEAP) package. | FeatureSelectionGA | [
"BSD-3-Clause",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FeatureSelectionGA:
"""FeatureSelectionGA This Class uses Genetic Algorithm to find out the best features for the input model using Distributed Evolutionary Algorithms in Python(DEAP) package."""
def __init__(self, model, x, y, cv_split=5, random_state=9, n_pop=10, n_gen=10):
"""Para... | stack_v2_sparse_classes_36k_train_000294 | 4,946 | permissive | [
{
"docstring": "Parameters ----------- model : scikit-learn supported model, x : {array-like}, shape = [n_samples, n_features] Training vectors, where n_samples is the number of samples and n_features is the number of features. y : {array-like}, shape = [n_samples] Target Values cv_split: int Number of splits f... | 4 | null | Implement the Python class `FeatureSelectionGA` described below.
Class description:
FeatureSelectionGA This Class uses Genetic Algorithm to find out the best features for the input model using Distributed Evolutionary Algorithms in Python(DEAP) package.
Method signatures and docstrings:
- def __init__(self, model, x,... | Implement the Python class `FeatureSelectionGA` described below.
Class description:
FeatureSelectionGA This Class uses Genetic Algorithm to find out the best features for the input model using Distributed Evolutionary Algorithms in Python(DEAP) package.
Method signatures and docstrings:
- def __init__(self, model, x,... | 20d8df6172906337f81583dabb841d66b8f31857 | <|skeleton|>
class FeatureSelectionGA:
"""FeatureSelectionGA This Class uses Genetic Algorithm to find out the best features for the input model using Distributed Evolutionary Algorithms in Python(DEAP) package."""
def __init__(self, model, x, y, cv_split=5, random_state=9, n_pop=10, n_gen=10):
"""Para... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FeatureSelectionGA:
"""FeatureSelectionGA This Class uses Genetic Algorithm to find out the best features for the input model using Distributed Evolutionary Algorithms in Python(DEAP) package."""
def __init__(self, model, x, y, cv_split=5, random_state=9, n_pop=10, n_gen=10):
"""Parameters ------... | the_stack_v2_python_sparse | new_algs/Sequence+algorithms/Selection+algorithm/FeatureGA.py | coolsnake/JupyterNotebook | train | 0 |
f165afefdae14002164488adf9913d0e0f2d9a27 | [
"def pre_order_serialize(node):\n if node is None:\n return '#!'\n string = str(node.val) + '!'\n string += pre_order_serialize(node.left)\n string += pre_order_serialize(node.right)\n return string\nreturn pre_order_serialize(root)",
"def pre_order_deserialize(que):\n if que:\n va... | <|body_start_0|>
def pre_order_serialize(node):
if node is None:
return '#!'
string = str(node.val) + '!'
string += pre_order_serialize(node.left)
string += pre_order_serialize(node.right)
return string
return pre_order_serializ... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_36k_train_000295 | 1,518 | 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` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | 2828811ae2f905865b4f391672693375c124c185 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
def pre_order_serialize(node):
if node is None:
return '#!'
string = str(node.val) + '!'
string += pre_order_serialize(node.left)
... | the_stack_v2_python_sparse | LeetCode/剑指 Offer/37. 序列化二叉树/solve.py | koking0/Algorithm | train | 35 | |
e59a8db10ff05797345353182cb7d141482091ec | [
"self.model = model\nself.feature_names = feature_names\nself.feature_types = feature_types",
"if name is None:\n name = gen_name_from_class(self)\ny = clean_dimensions(y, 'y')\nif y.ndim != 1:\n raise ValueError('y must be 1 dimensional')\nX, n_samples = preclean_X(X, self.feature_names, self.feature_types... | <|body_start_0|>
self.model = model
self.feature_names = feature_names
self.feature_types = feature_types
<|end_body_0|>
<|body_start_1|>
if name is None:
name = gen_name_from_class(self)
y = clean_dimensions(y, 'y')
if y.ndim != 1:
raise ValueErr... | Produces precision-recall curves. | PR | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PR:
"""Produces precision-recall curves."""
def __init__(self, model, feature_names=None, feature_types=None):
"""Initializes class. Args: model: model or prediction function of model (predict_proba for classification or predict for regression) feature_names: List of feature names. f... | stack_v2_sparse_classes_36k_train_000296 | 10,362 | permissive | [
{
"docstring": "Initializes class. Args: model: model or prediction function of model (predict_proba for classification or predict for regression) feature_names: List of feature names. feature_types: List of feature types.",
"name": "__init__",
"signature": "def __init__(self, model, feature_names=None,... | 2 | stack_v2_sparse_classes_30k_train_005059 | Implement the Python class `PR` described below.
Class description:
Produces precision-recall curves.
Method signatures and docstrings:
- def __init__(self, model, feature_names=None, feature_types=None): Initializes class. Args: model: model or prediction function of model (predict_proba for classification or predic... | Implement the Python class `PR` described below.
Class description:
Produces precision-recall curves.
Method signatures and docstrings:
- def __init__(self, model, feature_names=None, feature_types=None): Initializes class. Args: model: model or prediction function of model (predict_proba for classification or predic... | e6f38ea195aecbbd9d28c7183a83c65ada16e1ae | <|skeleton|>
class PR:
"""Produces precision-recall curves."""
def __init__(self, model, feature_names=None, feature_types=None):
"""Initializes class. Args: model: model or prediction function of model (predict_proba for classification or predict for regression) feature_names: List of feature names. f... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PR:
"""Produces precision-recall curves."""
def __init__(self, model, feature_names=None, feature_types=None):
"""Initializes class. Args: model: model or prediction function of model (predict_proba for classification or predict for regression) feature_names: List of feature names. feature_types:... | the_stack_v2_python_sparse | python/interpret-core/interpret/perf/_curve.py | interpretml/interpret | train | 3,731 |
476e0b1ef27e6b80de24331d1d3488a83f7815e5 | [
"try:\n signature = document.pop('signature')\n options = {'@context': 'https://w3id.org/identity/v1', 'creator': signature['creator'], 'created': signature['created']}\nexcept KeyError:\n raise VerificationFormatError('Invalid signature section')\nif signature['type'].lower() != 'rsasignature2017':\n r... | <|body_start_0|>
try:
signature = document.pop('signature')
options = {'@context': 'https://w3id.org/identity/v1', 'creator': signature['creator'], 'created': signature['created']}
except KeyError:
raise VerificationFormatError('Invalid signature section')
if ... | Creates and verifies signatures of JSON-LD documents | LDSignature | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LDSignature:
"""Creates and verifies signatures of JSON-LD documents"""
def verify_signature(cls, document: dict, public_key: str) -> None:
"""Verifies a document"""
<|body_0|>
def create_signature(cls, document: dict, private_key: str, key_id: str) -> dict[str, str]:
... | stack_v2_sparse_classes_36k_train_000297 | 12,105 | permissive | [
{
"docstring": "Verifies a document",
"name": "verify_signature",
"signature": "def verify_signature(cls, document: dict, public_key: str) -> None"
},
{
"docstring": "Creates the signature for a document",
"name": "create_signature",
"signature": "def create_signature(cls, document: dict... | 3 | stack_v2_sparse_classes_30k_train_019075 | Implement the Python class `LDSignature` described below.
Class description:
Creates and verifies signatures of JSON-LD documents
Method signatures and docstrings:
- def verify_signature(cls, document: dict, public_key: str) -> None: Verifies a document
- def create_signature(cls, document: dict, private_key: str, ke... | Implement the Python class `LDSignature` described below.
Class description:
Creates and verifies signatures of JSON-LD documents
Method signatures and docstrings:
- def verify_signature(cls, document: dict, public_key: str) -> None: Verifies a document
- def create_signature(cls, document: dict, private_key: str, ke... | eede9682b21a7b9c069d7c2fdc7da6d7267db155 | <|skeleton|>
class LDSignature:
"""Creates and verifies signatures of JSON-LD documents"""
def verify_signature(cls, document: dict, public_key: str) -> None:
"""Verifies a document"""
<|body_0|>
def create_signature(cls, document: dict, private_key: str, key_id: str) -> dict[str, str]:
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LDSignature:
"""Creates and verifies signatures of JSON-LD documents"""
def verify_signature(cls, document: dict, public_key: str) -> None:
"""Verifies a document"""
try:
signature = document.pop('signature')
options = {'@context': 'https://w3id.org/identity/v1', '... | the_stack_v2_python_sparse | core/signatures.py | pombredanne/takahe | train | 0 |
97c2671e3516a8d0ab6b381d4ed93cd50ce64e97 | [
"if isinstance(key, int):\n return Packet(key)\nif key not in Packet._member_map_:\n return extend_enum(Packet, key, default)\nreturn Packet[key]",
"if not (isinstance(value, int) and 0 <= value <= 127):\n raise ValueError('%r is not a valid %s' % (value, cls.__name__))\nif 5 <= value <= 15:\n return ... | <|body_start_0|>
if isinstance(key, int):
return Packet(key)
if key not in Packet._member_map_:
return extend_enum(Packet, key, default)
return Packet[key]
<|end_body_0|>
<|body_start_1|>
if not (isinstance(value, int) and 0 <= value <= 127):
raise Va... | [Packet] HIP Packet Types | Packet | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Packet:
"""[Packet] HIP Packet Types"""
def get(key: 'int | str', default: 'int'=-1) -> 'Packet':
"""Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:"""
<|body_0|>
def _missing_(cls, value: 'int') -... | stack_v2_sparse_classes_36k_train_000298 | 2,440 | permissive | [
{
"docstring": "Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:",
"name": "get",
"signature": "def get(key: 'int | str', default: 'int'=-1) -> 'Packet'"
},
{
"docstring": "Lookup function used when value is not found. Args... | 2 | stack_v2_sparse_classes_30k_val_000414 | Implement the Python class `Packet` described below.
Class description:
[Packet] HIP Packet Types
Method signatures and docstrings:
- def get(key: 'int | str', default: 'int'=-1) -> 'Packet': Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:
- de... | Implement the Python class `Packet` described below.
Class description:
[Packet] HIP Packet Types
Method signatures and docstrings:
- def get(key: 'int | str', default: 'int'=-1) -> 'Packet': Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:
- de... | a6fe49ec58f09e105bec5a00fb66d9b3f22730d9 | <|skeleton|>
class Packet:
"""[Packet] HIP Packet Types"""
def get(key: 'int | str', default: 'int'=-1) -> 'Packet':
"""Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:"""
<|body_0|>
def _missing_(cls, value: 'int') -... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Packet:
"""[Packet] HIP Packet Types"""
def get(key: 'int | str', default: 'int'=-1) -> 'Packet':
"""Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:"""
if isinstance(key, int):
return Packet(key)
... | the_stack_v2_python_sparse | pcapkit/const/hip/packet.py | JarryShaw/PyPCAPKit | train | 204 |
592a65d6e96d8480efcd3f112dbb47bc1b0dd152 | [
"all_dep_paths = rule_details[su.ALL_DEP_PATHS_KEY][:]\nfor rule_symbol in rule_details[su.PACKAGE_MODULES_KEY]:\n all_dep_paths.append(_check_and_get_outfile(details_map[rule_symbol]))\nrule_details[su.ALL_DEP_PATHS_KEY] = sorted(list(set(all_dep_paths)))",
"test_commands = []\nfor rule_symbol in rule_details... | <|body_start_0|>
all_dep_paths = rule_details[su.ALL_DEP_PATHS_KEY][:]
for rule_symbol in rule_details[su.PACKAGE_MODULES_KEY]:
all_dep_paths.append(_check_and_get_outfile(details_map[rule_symbol]))
rule_details[su.ALL_DEP_PATHS_KEY] = sorted(list(set(all_dep_paths)))
<|end_body_0|>
... | Pre-release test and packaging module. | ReleasePackage | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReleasePackage:
"""Pre-release test and packaging module."""
def _setup_deps(cls, rule_details, details_map):
"""Setup all dependencies."""
<|body_0|>
def _setup_tests(cls, rule_details, details_map):
"""Setup all tests."""
<|body_1|>
def _setup_link... | stack_v2_sparse_classes_36k_train_000299 | 3,935 | permissive | [
{
"docstring": "Setup all dependencies.",
"name": "_setup_deps",
"signature": "def _setup_deps(cls, rule_details, details_map)"
},
{
"docstring": "Setup all tests.",
"name": "_setup_tests",
"signature": "def _setup_tests(cls, rule_details, details_map)"
},
{
"docstring": "Setup l... | 5 | stack_v2_sparse_classes_30k_train_016959 | Implement the Python class `ReleasePackage` described below.
Class description:
Pre-release test and packaging module.
Method signatures and docstrings:
- def _setup_deps(cls, rule_details, details_map): Setup all dependencies.
- def _setup_tests(cls, rule_details, details_map): Setup all tests.
- def _setup_linking(... | Implement the Python class `ReleasePackage` described below.
Class description:
Pre-release test and packaging module.
Method signatures and docstrings:
- def _setup_deps(cls, rule_details, details_map): Setup all dependencies.
- def _setup_tests(cls, rule_details, details_map): Setup all tests.
- def _setup_linking(... | af028dd413dd2595cb8338a5a2c2d61a95adf7c6 | <|skeleton|>
class ReleasePackage:
"""Pre-release test and packaging module."""
def _setup_deps(cls, rule_details, details_map):
"""Setup all dependencies."""
<|body_0|>
def _setup_tests(cls, rule_details, details_map):
"""Setup all tests."""
<|body_1|>
def _setup_link... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ReleasePackage:
"""Pre-release test and packaging module."""
def _setup_deps(cls, rule_details, details_map):
"""Setup all dependencies."""
all_dep_paths = rule_details[su.ALL_DEP_PATHS_KEY][:]
for rule_symbol in rule_details[su.PACKAGE_MODULES_KEY]:
all_dep_paths.appe... | the_stack_v2_python_sparse | build_tool/bu.scripts/mool/release_package.py | rocketfuel/mool | train | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.