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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cea713920e8a1de6c74949c45cac92101c2be289 | [
"self.method = method\nself.skip_features = skip_features\nself.verbose = verbose\nif method not in accepted_scalers:\n raise ae.WORCKeyError(f'{method} is not a ' + 'valid scaling method. Should be any of ' + f'{accepted_scalers}.')\nself.included_feature_indices = list()\nself.excluded_feature_indices = list()... | <|body_start_0|>
self.method = method
self.skip_features = skip_features
self.verbose = verbose
if method not in accepted_scalers:
raise ae.WORCKeyError(f'{method} is not a ' + 'valid scaling method. Should be any of ' + f'{accepted_scalers}.')
self.included_feature_i... | Scale features using an sklearn scaler. Additionally, several features can be excluded. Mostly useful when using also categorical features such as patient sex. | WORCScaler | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WORCScaler:
"""Scale features using an sklearn scaler. Additionally, several features can be excluded. Mostly useful when using also categorical features such as patient sex."""
def __init__(self, method='robust_z_score', skip_features=None, verbose=False):
"""Initialize object. Para... | stack_v2_sparse_classes_36k_train_028200 | 10,901 | permissive | [
{
"docstring": "Initialize object. Parameters ------------ method: string Name of scaler used: robust_z_score, z_score, robust, or minmax skip_features: list of strings If any of these elements occur as substring in a feature label, this feature is excluded.",
"name": "__init__",
"signature": "def __ini... | 3 | stack_v2_sparse_classes_30k_train_012836 | Implement the Python class `WORCScaler` described below.
Class description:
Scale features using an sklearn scaler. Additionally, several features can be excluded. Mostly useful when using also categorical features such as patient sex.
Method signatures and docstrings:
- def __init__(self, method='robust_z_score', sk... | Implement the Python class `WORCScaler` described below.
Class description:
Scale features using an sklearn scaler. Additionally, several features can be excluded. Mostly useful when using also categorical features such as patient sex.
Method signatures and docstrings:
- def __init__(self, method='robust_z_score', sk... | f267b3d05c8193939aa4f43e47c6e24f9307864e | <|skeleton|>
class WORCScaler:
"""Scale features using an sklearn scaler. Additionally, several features can be excluded. Mostly useful when using also categorical features such as patient sex."""
def __init__(self, method='robust_z_score', skip_features=None, verbose=False):
"""Initialize object. Para... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WORCScaler:
"""Scale features using an sklearn scaler. Additionally, several features can be excluded. Mostly useful when using also categorical features such as patient sex."""
def __init__(self, method='robust_z_score', skip_features=None, verbose=False):
"""Initialize object. Parameters ------... | the_stack_v2_python_sparse | WORC/featureprocessing/Scalers.py | MStarmans91/WORC | train | 65 |
5211b9209fbafc786f4de1559b977cfbf5a91bdc | [
"input_json, output_json = (request.data['APIParams'], {})\noutput_json['AuthenticationDetails'] = request.data['AuthenticationDetails']\nadd_state = self.insert_data_into_table(input_json)\nif add_state.data['Status'] == 'Success':\n output_json['Payload'] = dict(zip(['Status', 'Message', 'Payload'], ['Success'... | <|body_start_0|>
input_json, output_json = (request.data['APIParams'], {})
output_json['AuthenticationDetails'] = request.data['AuthenticationDetails']
add_state = self.insert_data_into_table(input_json)
if add_state.data['Status'] == 'Success':
output_json['Payload'] = dict(... | This covers the API for add state. | AddStateAPI | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AddStateAPI:
"""This covers the API for add state."""
def post(self, request):
"""This covers the API for add state."""
<|body_0|>
def insert_data_into_table(self, request):
"""Function to add country into database."""
<|body_1|>
<|end_skeleton|>
<|body... | stack_v2_sparse_classes_36k_train_028201 | 1,760 | no_license | [
{
"docstring": "This covers the API for add state.",
"name": "post",
"signature": "def post(self, request)"
},
{
"docstring": "Function to add country into database.",
"name": "insert_data_into_table",
"signature": "def insert_data_into_table(self, request)"
}
] | 2 | null | Implement the Python class `AddStateAPI` described below.
Class description:
This covers the API for add state.
Method signatures and docstrings:
- def post(self, request): This covers the API for add state.
- def insert_data_into_table(self, request): Function to add country into database. | Implement the Python class `AddStateAPI` described below.
Class description:
This covers the API for add state.
Method signatures and docstrings:
- def post(self, request): This covers the API for add state.
- def insert_data_into_table(self, request): Function to add country into database.
<|skeleton|>
class AddSta... | 36eb9931f330e64902354c6fc471be2adf4b7049 | <|skeleton|>
class AddStateAPI:
"""This covers the API for add state."""
def post(self, request):
"""This covers the API for add state."""
<|body_0|>
def insert_data_into_table(self, request):
"""Function to add country into database."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AddStateAPI:
"""This covers the API for add state."""
def post(self, request):
"""This covers the API for add state."""
input_json, output_json = (request.data['APIParams'], {})
output_json['AuthenticationDetails'] = request.data['AuthenticationDetails']
add_state = self.i... | the_stack_v2_python_sparse | Generic/common/location/api/addstate/views_addstate.py | archiemb303/common_backend_django | train | 0 |
cc417de6221f2432c0ecbe41c6e53e571b0f9d7f | [
"if isinstance(skill_identifier, int):\n return skill_identifier\nreturn getattr(skill_identifier, 'guid64', None)",
"if skill is None:\n return None\ntry:\n return skill.__class__.__name__\nexcept:\n return ''",
"if skills is None or not skills:\n return tuple()\nshort_names: List[str] = []\nfor... | <|body_start_0|>
if isinstance(skill_identifier, int):
return skill_identifier
return getattr(skill_identifier, 'guid64', None)
<|end_body_0|>
<|body_start_1|>
if skill is None:
return None
try:
return skill.__class__.__name__
except:
... | Utilities for manipulating Skills. | CommonSkillUtils | [
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CommonSkillUtils:
"""Utilities for manipulating Skills."""
def get_skill_id(skill_identifier: Union[int, Skill]) -> Union[int, None]:
"""get_skill_id(skill_identifier) Retrieve the decimal identifier of a Skill. :param skill_identifier: The identifier or instance of a Skill. :type sk... | stack_v2_sparse_classes_36k_train_028202 | 4,542 | permissive | [
{
"docstring": "get_skill_id(skill_identifier) Retrieve the decimal identifier of a Skill. :param skill_identifier: The identifier or instance of a Skill. :type skill_identifier: Union[int, Skill] :return: The decimal identifier of the Skill or None if the Skill does not have an id. :rtype: Union[int, None]",
... | 5 | null | Implement the Python class `CommonSkillUtils` described below.
Class description:
Utilities for manipulating Skills.
Method signatures and docstrings:
- def get_skill_id(skill_identifier: Union[int, Skill]) -> Union[int, None]: get_skill_id(skill_identifier) Retrieve the decimal identifier of a Skill. :param skill_id... | Implement the Python class `CommonSkillUtils` described below.
Class description:
Utilities for manipulating Skills.
Method signatures and docstrings:
- def get_skill_id(skill_identifier: Union[int, Skill]) -> Union[int, None]: get_skill_id(skill_identifier) Retrieve the decimal identifier of a Skill. :param skill_id... | 58e7beb30b9c818b294d35abd2436a0192cd3e82 | <|skeleton|>
class CommonSkillUtils:
"""Utilities for manipulating Skills."""
def get_skill_id(skill_identifier: Union[int, Skill]) -> Union[int, None]:
"""get_skill_id(skill_identifier) Retrieve the decimal identifier of a Skill. :param skill_identifier: The identifier or instance of a Skill. :type sk... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CommonSkillUtils:
"""Utilities for manipulating Skills."""
def get_skill_id(skill_identifier: Union[int, Skill]) -> Union[int, None]:
"""get_skill_id(skill_identifier) Retrieve the decimal identifier of a Skill. :param skill_identifier: The identifier or instance of a Skill. :type skill_identifie... | the_stack_v2_python_sparse | Scripts/sims4communitylib/utils/resources/common_skill_utils.py | ColonolNutty/Sims4CommunityLibrary | train | 183 |
33cb531d016b53d9e66de77beab3280ef808fe8e | [
"authenticated = request.user.is_authenticated()\nif action == Limiter.PASTE_UPLOAD and settings.MAX_PASTE_UPLOADS_PER_USER == -1 and (settings.MAX_PASTE_UPLOADS_PER_GUEST == -1):\n return 0\nelif action == Limiter.PASTE_EDIT and settings.MAX_PASTE_EDITS_PER_USER == -1:\n return 0\nelif action == Limiter.COMM... | <|body_start_0|>
authenticated = request.user.is_authenticated()
if action == Limiter.PASTE_UPLOAD and settings.MAX_PASTE_UPLOADS_PER_USER == -1 and (settings.MAX_PASTE_UPLOADS_PER_GUEST == -1):
return 0
elif action == Limiter.PASTE_EDIT and settings.MAX_PASTE_EDITS_PER_USER == -1:
... | Throttles the amount of actions an user can do | Limiter | [
"Unlicense"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Limiter:
"""Throttles the amount of actions an user can do"""
def get_action_count(request, action):
"""Get the raw count of actions a certain IP address has done"""
<|body_0|>
def increase_action_count(request, action, amount=1):
"""Increase the amount of action... | stack_v2_sparse_classes_36k_train_028203 | 6,890 | permissive | [
{
"docstring": "Get the raw count of actions a certain IP address has done",
"name": "get_action_count",
"signature": "def get_action_count(request, action)"
},
{
"docstring": "Increase the amount of actions by a certain amount (default=1)",
"name": "increase_action_count",
"signature": ... | 4 | stack_v2_sparse_classes_30k_train_018659 | Implement the Python class `Limiter` described below.
Class description:
Throttles the amount of actions an user can do
Method signatures and docstrings:
- def get_action_count(request, action): Get the raw count of actions a certain IP address has done
- def increase_action_count(request, action, amount=1): Increase... | Implement the Python class `Limiter` described below.
Class description:
Throttles the amount of actions an user can do
Method signatures and docstrings:
- def get_action_count(request, action): Get the raw count of actions a certain IP address has done
- def increase_action_count(request, action, amount=1): Increase... | 5e38637e5a417ab907a353af8544f64a0ad2b127 | <|skeleton|>
class Limiter:
"""Throttles the amount of actions an user can do"""
def get_action_count(request, action):
"""Get the raw count of actions a certain IP address has done"""
<|body_0|>
def increase_action_count(request, action, amount=1):
"""Increase the amount of action... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Limiter:
"""Throttles the amount of actions an user can do"""
def get_action_count(request, action):
"""Get the raw count of actions a certain IP address has done"""
authenticated = request.user.is_authenticated()
if action == Limiter.PASTE_UPLOAD and settings.MAX_PASTE_UPLOADS_PE... | the_stack_v2_python_sparse | users/models.py | xeddmc/pastebin-django | train | 0 |
091e613103660cf50e185f4b4a6f4785bc4c97e9 | [
"credentials = Credentials.get()\nDataLayer.config['host'] = credentials.get_host()\nDataLayer.config['user'] = credentials.get_user()\nDataLayer.config['password'] = credentials.get_password()\nDataLayer.config['database'] = credentials.get_database()\nDataLayer.config['port'] = credentials.get_port()\nDataLayer.c... | <|body_start_0|>
credentials = Credentials.get()
DataLayer.config['host'] = credentials.get_host()
DataLayer.config['user'] = credentials.get_user()
DataLayer.config['password'] = credentials.get_password()
DataLayer.config['database'] = credentials.get_database()
DataLay... | A client for requesting the controller to load a host definition. | LoadHostClient | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoadHostClient:
"""A client for requesting the controller to load a host definition."""
def __init__(self):
"""Object constructor."""
<|body_0|>
def main(self, filename):
"""The main function of load_schedule. :param str filename: The filename with the XML defini... | stack_v2_sparse_classes_36k_train_028204 | 1,688 | permissive | [
{
"docstring": "Object constructor.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "The main function of load_schedule. :param str filename: The filename with the XML definition of the host.",
"name": "main",
"signature": "def main(self, filename)"
}
] | 2 | stack_v2_sparse_classes_30k_train_009661 | Implement the Python class `LoadHostClient` described below.
Class description:
A client for requesting the controller to load a host definition.
Method signatures and docstrings:
- def __init__(self): Object constructor.
- def main(self, filename): The main function of load_schedule. :param str filename: The filenam... | Implement the Python class `LoadHostClient` described below.
Class description:
A client for requesting the controller to load a host definition.
Method signatures and docstrings:
- def __init__(self): Object constructor.
- def main(self, filename): The main function of load_schedule. :param str filename: The filenam... | ec0c33cdae4a0afeea37928743abd744ef291a9f | <|skeleton|>
class LoadHostClient:
"""A client for requesting the controller to load a host definition."""
def __init__(self):
"""Object constructor."""
<|body_0|>
def main(self, filename):
"""The main function of load_schedule. :param str filename: The filename with the XML defini... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LoadHostClient:
"""A client for requesting the controller to load a host definition."""
def __init__(self):
"""Object constructor."""
credentials = Credentials.get()
DataLayer.config['host'] = credentials.get_host()
DataLayer.config['user'] = credentials.get_user()
... | the_stack_v2_python_sparse | enarksh/controller/client/LoadHostClient.py | SetBased/py-enarksh | train | 3 |
d0834c310c60dc093de0b8f41a7bca579b4cb5db | [
"self.transforms = transformations\nis_instantiated = [isinstance(tfm, Transform) for tfm in self.transforms]\nif any(is_instantiated):\n raise TypeError('One or more transformations are instantiated')\nself.num_transforms = num_transforms\nif magnitude:\n assert magnitude >= 1, 'Magnitude should be within ra... | <|body_start_0|>
self.transforms = transformations
is_instantiated = [isinstance(tfm, Transform) for tfm in self.transforms]
if any(is_instantiated):
raise TypeError('One or more transformations are instantiated')
self.num_transforms = num_transforms
if magnitude:
... | RandAugment | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandAugment:
def __init__(self, transformations: list, num_transforms: int=1, magnitude: int=None, **kwargs):
"""Implementation of the RandAugment algorithm from Cubuk et al. (2020). Ispired by the RandAugment from the following notebook https://github.com/timeseriesAI/timeseriesAI/tutor... | stack_v2_sparse_classes_36k_train_028205 | 9,515 | no_license | [
{
"docstring": "Implementation of the RandAugment algorithm from Cubuk et al. (2020). Ispired by the RandAugment from the following notebook https://github.com/timeseriesAI/timeseriesAI/tutorial_nbs/03_Time_Series_Transforms.ipynb Args: transformations: A list of transformations num_transforms: The number of tr... | 2 | stack_v2_sparse_classes_30k_train_006597 | Implement the Python class `RandAugment` described below.
Class description:
Implement the RandAugment class.
Method signatures and docstrings:
- def __init__(self, transformations: list, num_transforms: int=1, magnitude: int=None, **kwargs): Implementation of the RandAugment algorithm from Cubuk et al. (2020). Ispir... | Implement the Python class `RandAugment` described below.
Class description:
Implement the RandAugment class.
Method signatures and docstrings:
- def __init__(self, transformations: list, num_transforms: int=1, magnitude: int=None, **kwargs): Implementation of the RandAugment algorithm from Cubuk et al. (2020). Ispir... | ef6d65069c82a7065a60c624c9e62b2fc37890bd | <|skeleton|>
class RandAugment:
def __init__(self, transformations: list, num_transforms: int=1, magnitude: int=None, **kwargs):
"""Implementation of the RandAugment algorithm from Cubuk et al. (2020). Ispired by the RandAugment from the following notebook https://github.com/timeseriesAI/timeseriesAI/tutor... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RandAugment:
def __init__(self, transformations: list, num_transforms: int=1, magnitude: int=None, **kwargs):
"""Implementation of the RandAugment algorithm from Cubuk et al. (2020). Ispired by the RandAugment from the following notebook https://github.com/timeseriesAI/timeseriesAI/tutorial_nbs/03_Tim... | the_stack_v2_python_sparse | dl4d/transforms.py | anonicmla/ssltsc | train | 0 | |
7f6a83b13e41852bfb6bf635e66d82ab2997389e | [
"super(MultiBandUpdateManager, self).__init__(kwargs_model, kwargs_constraints, kwargs_likelihood, kwargs_params)\nkwargs_lens_fixed_init, _, _, _, _, _ = self.fixed_kwargs\nself._kwargs_lens_fixed_init = copy.deepcopy(kwargs_lens_fixed_init)\nself._index_lens_model_list = kwargs_model.get('index_lens_model_list', ... | <|body_start_0|>
super(MultiBandUpdateManager, self).__init__(kwargs_model, kwargs_constraints, kwargs_likelihood, kwargs_params)
kwargs_lens_fixed_init, _, _, _, _, _ = self.fixed_kwargs
self._kwargs_lens_fixed_init = copy.deepcopy(kwargs_lens_fixed_init)
self._index_lens_model_list = k... | specific Manager to deal with multiple images with disjoint lens model parameterization. The class inherits the UpdateManager() class and adds functionalities to hold and relieve fixed all lens model parameters of a specific frame/image for more convenient use of the FittingSequence. | MultiBandUpdateManager | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiBandUpdateManager:
"""specific Manager to deal with multiple images with disjoint lens model parameterization. The class inherits the UpdateManager() class and adds functionalities to hold and relieve fixed all lens model parameters of a specific frame/image for more convenient use of the Fi... | stack_v2_sparse_classes_36k_train_028206 | 4,390 | permissive | [
{
"docstring": ":param kwargs_model: keyword arguments to describe all model components used in class_creator.create_class_instances() :param kwargs_constraints: keyword arguments of the Param() class to handle parameter constraints during the sampling (except upper and lower limits and sampling input mean and ... | 4 | stack_v2_sparse_classes_30k_train_007950 | Implement the Python class `MultiBandUpdateManager` described below.
Class description:
specific Manager to deal with multiple images with disjoint lens model parameterization. The class inherits the UpdateManager() class and adds functionalities to hold and relieve fixed all lens model parameters of a specific frame/... | Implement the Python class `MultiBandUpdateManager` described below.
Class description:
specific Manager to deal with multiple images with disjoint lens model parameterization. The class inherits the UpdateManager() class and adds functionalities to hold and relieve fixed all lens model parameters of a specific frame/... | 73c9645f26f6983fe7961104075ebe8bf7a4b54c | <|skeleton|>
class MultiBandUpdateManager:
"""specific Manager to deal with multiple images with disjoint lens model parameterization. The class inherits the UpdateManager() class and adds functionalities to hold and relieve fixed all lens model parameters of a specific frame/image for more convenient use of the Fi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MultiBandUpdateManager:
"""specific Manager to deal with multiple images with disjoint lens model parameterization. The class inherits the UpdateManager() class and adds functionalities to hold and relieve fixed all lens model parameters of a specific frame/image for more convenient use of the FittingSequence... | the_stack_v2_python_sparse | lenstronomy/Workflow/multi_band_manager.py | lenstronomy/lenstronomy | train | 41 |
1266f7719566fd126e6ff47f6cfcc301f604c94e | [
"param = request.GET\nowner_id = param.get('woid', request.webapp_owner_id)\ntemplate_type = 'ordinary'\nrecords = app_models.EvaluateTemplateSetting.objects(owner_id=int(owner_id))\nif records.count() > 0 and 'ordinary' != records.first().template_type:\n project_id = 'new_app:evaluate:%s' % records.first().rel... | <|body_start_0|>
param = request.GET
owner_id = param.get('woid', request.webapp_owner_id)
template_type = 'ordinary'
records = app_models.EvaluateTemplateSetting.objects(owner_id=int(owner_id))
if records.count() > 0 and 'ordinary' != records.first().template_type:
p... | MEvaluate | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MEvaluate:
def get(request):
"""渲染评价页面"""
<|body_0|>
def api_get(request):
"""获取商品以及评价数据"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
param = request.GET
owner_id = param.get('woid', request.webapp_owner_id)
template_type = 'ordin... | stack_v2_sparse_classes_36k_train_028207 | 4,326 | no_license | [
{
"docstring": "渲染评价页面",
"name": "get",
"signature": "def get(request)"
},
{
"docstring": "获取商品以及评价数据",
"name": "api_get",
"signature": "def api_get(request)"
}
] | 2 | null | Implement the Python class `MEvaluate` described below.
Class description:
Implement the MEvaluate class.
Method signatures and docstrings:
- def get(request): 渲染评价页面
- def api_get(request): 获取商品以及评价数据 | Implement the Python class `MEvaluate` described below.
Class description:
Implement the MEvaluate class.
Method signatures and docstrings:
- def get(request): 渲染评价页面
- def api_get(request): 获取商品以及评价数据
<|skeleton|>
class MEvaluate:
def get(request):
"""渲染评价页面"""
<|body_0|>
def api_get(reque... | 8b2f7befe92841bcc35e0e60cac5958ef3f3af54 | <|skeleton|>
class MEvaluate:
def get(request):
"""渲染评价页面"""
<|body_0|>
def api_get(request):
"""获取商品以及评价数据"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MEvaluate:
def get(request):
"""渲染评价页面"""
param = request.GET
owner_id = param.get('woid', request.webapp_owner_id)
template_type = 'ordinary'
records = app_models.EvaluateTemplateSetting.objects(owner_id=int(owner_id))
if records.count() > 0 and 'ordinary' != r... | the_stack_v2_python_sparse | weapp/apps/customerized_apps/evaluate/m_evaluate.py | chengdg/weizoom | train | 1 | |
3aa409a95e937bb58298c522be161823d5b7c902 | [
"if name is None:\n for widget in self.widget.values():\n if widget['state'] != 'normal':\n widget.configure(state='normal')\nelse:\n assert name in self.widget\n if self.widget[name]['state'] != 'normal':\n self.widget[name].configure(state='normal')",
"if name is None:\n for... | <|body_start_0|>
if name is None:
for widget in self.widget.values():
if widget['state'] != 'normal':
widget.configure(state='normal')
else:
assert name in self.widget
if self.widget[name]['state'] != 'normal':
self.... | Variable for radiobutton | RadiobuttonVar | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RadiobuttonVar:
"""Variable for radiobutton"""
def enable(self, name=None):
"""Enable changing variable value"""
<|body_0|>
def disable(self, name=None):
"""Disable changing variable value"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if name ... | stack_v2_sparse_classes_36k_train_028208 | 2,410 | permissive | [
{
"docstring": "Enable changing variable value",
"name": "enable",
"signature": "def enable(self, name=None)"
},
{
"docstring": "Disable changing variable value",
"name": "disable",
"signature": "def disable(self, name=None)"
}
] | 2 | stack_v2_sparse_classes_30k_train_014729 | Implement the Python class `RadiobuttonVar` described below.
Class description:
Variable for radiobutton
Method signatures and docstrings:
- def enable(self, name=None): Enable changing variable value
- def disable(self, name=None): Disable changing variable value | Implement the Python class `RadiobuttonVar` described below.
Class description:
Variable for radiobutton
Method signatures and docstrings:
- def enable(self, name=None): Enable changing variable value
- def disable(self, name=None): Disable changing variable value
<|skeleton|>
class RadiobuttonVar:
"""Variable f... | 272d88be7ab617a58d3f241d10f4f9fd17b91cbc | <|skeleton|>
class RadiobuttonVar:
"""Variable for radiobutton"""
def enable(self, name=None):
"""Enable changing variable value"""
<|body_0|>
def disable(self, name=None):
"""Disable changing variable value"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RadiobuttonVar:
"""Variable for radiobutton"""
def enable(self, name=None):
"""Enable changing variable value"""
if name is None:
for widget in self.widget.values():
if widget['state'] != 'normal':
widget.configure(state='normal')
el... | the_stack_v2_python_sparse | system/gui/widgets/variable.py | thuchula6792/AutoOED | train | 0 |
aedf936466ff4380e38f9b88ae221ef3c1da2400 | [
"map = set()\nfor x in nums:\n if x in map:\n return True\n else:\n map.add(x)\nreturn False",
"if len(nums) == len(set(nums)):\n return False\nelse:\n return True"
] | <|body_start_0|>
map = set()
for x in nums:
if x in map:
return True
else:
map.add(x)
return False
<|end_body_0|>
<|body_start_1|>
if len(nums) == len(set(nums)):
return False
else:
return True
<|end... | ContainsDuplicate | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ContainsDuplicate:
def containsDuplicate_1(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_0|>
def containsDuplicate_2(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
map = set()
... | stack_v2_sparse_classes_36k_train_028209 | 1,078 | permissive | [
{
"docstring": ":type nums: List[int] :rtype: bool",
"name": "containsDuplicate_1",
"signature": "def containsDuplicate_1(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: bool",
"name": "containsDuplicate_2",
"signature": "def containsDuplicate_2(self, nums)"
}
] | 2 | null | Implement the Python class `ContainsDuplicate` described below.
Class description:
Implement the ContainsDuplicate class.
Method signatures and docstrings:
- def containsDuplicate_1(self, nums): :type nums: List[int] :rtype: bool
- def containsDuplicate_2(self, nums): :type nums: List[int] :rtype: bool | Implement the Python class `ContainsDuplicate` described below.
Class description:
Implement the ContainsDuplicate class.
Method signatures and docstrings:
- def containsDuplicate_1(self, nums): :type nums: List[int] :rtype: bool
- def containsDuplicate_2(self, nums): :type nums: List[int] :rtype: bool
<|skeleton|>
... | 3e2484d19e6845f0f93e78f7b447909bba3efadd | <|skeleton|>
class ContainsDuplicate:
def containsDuplicate_1(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_0|>
def containsDuplicate_2(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ContainsDuplicate:
def containsDuplicate_1(self, nums):
""":type nums: List[int] :rtype: bool"""
map = set()
for x in nums:
if x in map:
return True
else:
map.add(x)
return False
def containsDuplicate_2(self, nums):
... | the_stack_v2_python_sparse | explore_easy/array/ContainsDuplicate.py | niefy/LeetCodeExam | train | 0 | |
6d6a172d2c448439d52eff39bafe0238b3987da4 | [
"ref = MetricModel.objects.filter(project_id=project_id, pk=metric_id).first()\nif not ref:\n raise error_codes.ResNotFoundError('metric不存在')\nperm = bcs_perm.Metric(request, project_id, metric_id, ref.name)\nperm.can_use(raise_exception=True)\nreturn BKAPIResponse(ref.to_json(), message='获取metric成功')",
"seria... | <|body_start_0|>
ref = MetricModel.objects.filter(project_id=project_id, pk=metric_id).first()
if not ref:
raise error_codes.ResNotFoundError('metric不存在')
perm = bcs_perm.Metric(request, project_id, metric_id, ref.name)
perm.can_use(raise_exception=True)
return BKAPIR... | 单个metric操作 | MetricDetail | [
"BSD-3-Clause",
"LicenseRef-scancode-unicode",
"ICU",
"LicenseRef-scancode-unknown-license-reference",
"Artistic-2.0",
"Zlib",
"LicenseRef-scancode-openssl",
"NAIST-2003",
"ISC",
"NTP",
"BSL-1.0",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MetricDetail:
"""单个metric操作"""
def get(self, request, project_id, metric_id):
"""获取metric"""
<|body_0|>
def put(self, request, project_id, metric_id):
"""更新put"""
<|body_1|>
def get_metric_info(self, project_id, metric_id):
"""获取metric信息"""
... | stack_v2_sparse_classes_36k_train_028210 | 10,522 | permissive | [
{
"docstring": "获取metric",
"name": "get",
"signature": "def get(self, request, project_id, metric_id)"
},
{
"docstring": "更新put",
"name": "put",
"signature": "def put(self, request, project_id, metric_id)"
},
{
"docstring": "获取metric信息",
"name": "get_metric_info",
"signat... | 5 | stack_v2_sparse_classes_30k_train_000643 | Implement the Python class `MetricDetail` described below.
Class description:
单个metric操作
Method signatures and docstrings:
- def get(self, request, project_id, metric_id): 获取metric
- def put(self, request, project_id, metric_id): 更新put
- def get_metric_info(self, project_id, metric_id): 获取metric信息
- def delete(self, ... | Implement the Python class `MetricDetail` described below.
Class description:
单个metric操作
Method signatures and docstrings:
- def get(self, request, project_id, metric_id): 获取metric
- def put(self, request, project_id, metric_id): 更新put
- def get_metric_info(self, project_id, metric_id): 获取metric信息
- def delete(self, ... | 96373cda9d87038aceb0b4858ce89e7873c8e149 | <|skeleton|>
class MetricDetail:
"""单个metric操作"""
def get(self, request, project_id, metric_id):
"""获取metric"""
<|body_0|>
def put(self, request, project_id, metric_id):
"""更新put"""
<|body_1|>
def get_metric_info(self, project_id, metric_id):
"""获取metric信息"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MetricDetail:
"""单个metric操作"""
def get(self, request, project_id, metric_id):
"""获取metric"""
ref = MetricModel.objects.filter(project_id=project_id, pk=metric_id).first()
if not ref:
raise error_codes.ResNotFoundError('metric不存在')
perm = bcs_perm.Metric(request... | the_stack_v2_python_sparse | bcs-app/backend/apps/metric/views.py | freyzheng/bk-bcs-saas | train | 0 |
8f67d59da3bc32ceb80cb28e394e6aca85cb7f3c | [
"args = [Arping.ARPING_COMMAND_NAME, Arping.INTERFACE_OPTION, device, Arping.COUNT_OPTION, str(count), Arping.TIMEOUT_OPTION, str(timeout)]\nif quiet is True:\n args.append(Arping.QUIET_OPTION)\nif firstReply is True:\n args.append(Arping.FIRST_REPLY_OPTION)\nargs.append(destination)\nrc = Command.execute(log... | <|body_start_0|>
args = [Arping.ARPING_COMMAND_NAME, Arping.INTERFACE_OPTION, device, Arping.COUNT_OPTION, str(count), Arping.TIMEOUT_OPTION, str(timeout)]
if quiet is True:
args.append(Arping.QUIET_OPTION)
if firstReply is True:
args.append(Arping.FIRST_REPLY_OPTION)
... | Arping | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Arping:
def sendArpRequest(logger, device, destination, count=3, timeout=1, quiet=False, firstReply=False, blocking=True):
"""This function sends ARP REQUEST to a neighbour host Args: logger device - Name of network device where to send ARP REQUEST packets destination - destination IP to... | stack_v2_sparse_classes_36k_train_028211 | 10,343 | no_license | [
{
"docstring": "This function sends ARP REQUEST to a neighbour host Args: logger device - Name of network device where to send ARP REQUEST packets destination - destination IP to ping count - stop after sending X ARP REQUEST packets timeout - specify a timeout, in seconds, before arping exits quiet - quiet outp... | 2 | stack_v2_sparse_classes_30k_train_015449 | Implement the Python class `Arping` described below.
Class description:
Implement the Arping class.
Method signatures and docstrings:
- def sendArpRequest(logger, device, destination, count=3, timeout=1, quiet=False, firstReply=False, blocking=True): This function sends ARP REQUEST to a neighbour host Args: logger de... | Implement the Python class `Arping` described below.
Class description:
Implement the Arping class.
Method signatures and docstrings:
- def sendArpRequest(logger, device, destination, count=3, timeout=1, quiet=False, firstReply=False, blocking=True): This function sends ARP REQUEST to a neighbour host Args: logger de... | 81bcc74fe7c0ca036ec483f634d7be0bab19a6d0 | <|skeleton|>
class Arping:
def sendArpRequest(logger, device, destination, count=3, timeout=1, quiet=False, firstReply=False, blocking=True):
"""This function sends ARP REQUEST to a neighbour host Args: logger device - Name of network device where to send ARP REQUEST packets destination - destination IP to... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Arping:
def sendArpRequest(logger, device, destination, count=3, timeout=1, quiet=False, firstReply=False, blocking=True):
"""This function sends ARP REQUEST to a neighbour host Args: logger device - Name of network device where to send ARP REQUEST packets destination - destination IP to ping count - ... | the_stack_v2_python_sparse | oscar/a/sys/net/lnx/neighbour.py | afeset/miner2-tools | train | 0 | |
689282f6b3e86fbe805d56e333185f8e45f41f01 | [
"self.bigheap = []\nself.smallheap = []\nself.n = 0",
"if self.n % 2 == 0:\n x = heappushpop(self.bigheap, num)\n heappush(self.smallheap, -x)\nelse:\n x = heappushpop(self.smallheap, -num)\n heappush(self.bigheap, -x)\nself.n += 1",
"if self.n == 0:\n return None\nelif self.n % 2 == 0:\n retu... | <|body_start_0|>
self.bigheap = []
self.smallheap = []
self.n = 0
<|end_body_0|>
<|body_start_1|>
if self.n % 2 == 0:
x = heappushpop(self.bigheap, num)
heappush(self.smallheap, -x)
else:
x = heappushpop(self.smallheap, -num)
heapp... | 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: None"""
<|body_1|>
def findMedian(self):
""":rtype: float"""
<|body_2|>
<|end_skeleton|>
<|body_sta... | stack_v2_sparse_classes_36k_train_028212 | 1,327 | no_license | [
{
"docstring": "initialize your data structure here.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": ":type num: int :rtype: None",
"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: None
- 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: None
- def findMedian(self): :rtype: float
<|skeleton|>
class Me... | 80e44f4e9d3a5b592fdebe0bf16d1df54e99991e | <|skeleton|>
class MedianFinder:
def __init__(self):
"""initialize your data structure here."""
<|body_0|>
def addNum(self, num):
""":type num: int :rtype: None"""
<|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.bigheap = []
self.smallheap = []
self.n = 0
def addNum(self, num):
""":type num: int :rtype: None"""
if self.n % 2 == 0:
x = heappushpop(self.bigheap, num)
... | the_stack_v2_python_sparse | Python/295 - Find Median from Data Stream/295_find-median-from-data-stream.py | aptend/leetcode-rua | train | 2 | |
b6941a852d51fb4a92441a683ecbec3ce34e0ae2 | [
"if task_token is None:\n task_token = self.last_tasktoken\nreturn self._swf.respond_activity_task_canceled(task_token, details)",
"if task_token is None:\n task_token = self.last_tasktoken\nreturn self._swf.respond_activity_task_completed(task_token, result)",
"if task_token is None:\n task_token = se... | <|body_start_0|>
if task_token is None:
task_token = self.last_tasktoken
return self._swf.respond_activity_task_canceled(task_token, details)
<|end_body_0|>
<|body_start_1|>
if task_token is None:
task_token = self.last_tasktoken
return self._swf.respond_activity... | Base class for SimpleWorkflow activity workers. | ActivityWorker | [
"CC-BY-3.0",
"LicenseRef-scancode-other-copyleft",
"LicenseRef-scancode-unknown-license-reference",
"ZPL-2.0",
"Unlicense",
"LGPL-3.0-only",
"CC0-1.0",
"LicenseRef-scancode-other-permissive",
"CNRI-Python",
"LicenseRef-scancode-warranty-disclaimer",
"GPL-2.0-or-later",
"Python-2.0",
"GPL-3.0... | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ActivityWorker:
"""Base class for SimpleWorkflow activity workers."""
def cancel(self, task_token=None, details=None):
"""RespondActivityTaskCanceled."""
<|body_0|>
def complete(self, task_token=None, result=None):
"""RespondActivityTaskCompleted."""
<|bo... | stack_v2_sparse_classes_36k_train_028213 | 13,056 | permissive | [
{
"docstring": "RespondActivityTaskCanceled.",
"name": "cancel",
"signature": "def cancel(self, task_token=None, details=None)"
},
{
"docstring": "RespondActivityTaskCompleted.",
"name": "complete",
"signature": "def complete(self, task_token=None, result=None)"
},
{
"docstring":... | 5 | null | Implement the Python class `ActivityWorker` described below.
Class description:
Base class for SimpleWorkflow activity workers.
Method signatures and docstrings:
- def cancel(self, task_token=None, details=None): RespondActivityTaskCanceled.
- def complete(self, task_token=None, result=None): RespondActivityTaskCompl... | Implement the Python class `ActivityWorker` described below.
Class description:
Base class for SimpleWorkflow activity workers.
Method signatures and docstrings:
- def cancel(self, task_token=None, details=None): RespondActivityTaskCanceled.
- def complete(self, task_token=None, result=None): RespondActivityTaskCompl... | dccb9467675c67b9c3399fc76c5de6d31bfb8255 | <|skeleton|>
class ActivityWorker:
"""Base class for SimpleWorkflow activity workers."""
def cancel(self, task_token=None, details=None):
"""RespondActivityTaskCanceled."""
<|body_0|>
def complete(self, task_token=None, result=None):
"""RespondActivityTaskCompleted."""
<|bo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ActivityWorker:
"""Base class for SimpleWorkflow activity workers."""
def cancel(self, task_token=None, details=None):
"""RespondActivityTaskCanceled."""
if task_token is None:
task_token = self.last_tasktoken
return self._swf.respond_activity_task_canceled(task_token,... | the_stack_v2_python_sparse | desktop/core/ext-py3/boto-2.49.0/boto/swf/layer2.py | cloudera/hue | train | 5,655 |
0526fadc2d51365bf721524d928ae24e9843ccd8 | [
"idx_set = {}\nfor i, item in enumerate(nums):\n idx = target - nums[i]\n if idx in idx_set:\n j = idx_set[idx]\n if len(j) != 0 and j[0] != i:\n return list([i, j[0]])\n if j[0] == i and len(j) > 1:\n return list([i, j[1]])\n else:\n idx_set[item] = [i]",
... | <|body_start_0|>
idx_set = {}
for i, item in enumerate(nums):
idx = target - nums[i]
if idx in idx_set:
j = idx_set[idx]
if len(j) != 0 and j[0] != i:
return list([i, j[0]])
if j[0] == i and len(j) > 1:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def twoSum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def twoSum_simple(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_st... | stack_v2_sparse_classes_36k_train_028214 | 1,166 | no_license | [
{
"docstring": ":type nums: List[int] :type target: int :rtype: List[int]",
"name": "twoSum",
"signature": "def twoSum(self, nums, target)"
},
{
"docstring": ":type nums: List[int] :type target: int :rtype: List[int]",
"name": "twoSum_simple",
"signature": "def twoSum_simple(self, nums, ... | 2 | stack_v2_sparse_classes_30k_test_000128 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int]
- def twoSum_simple(self, nums, target): :type nums: List[int] :type target: int :rtype:... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int]
- def twoSum_simple(self, nums, target): :type nums: List[int] :type target: int :rtype:... | 4ca9df3b5d093a467963640e2d2eb17fc640d4bd | <|skeleton|>
class Solution:
def twoSum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def twoSum_simple(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def twoSum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
idx_set = {}
for i, item in enumerate(nums):
idx = target - nums[i]
if idx in idx_set:
j = idx_set[idx]
if len(j) != 0 and j... | the_stack_v2_python_sparse | 1-9/9. twoSum(Easy)/twoSum.py | SherlockUnknowEn/leetcode | train | 36 | |
2647be727fa77323185af773d7920b6e120d484e | [
"super().__init__(device)\nself._attr_unique_id = f'{self.mac_or_serial}_{description.key}'\nself.entity_description = description",
"self._attr_is_on = True\nprofile = self.device.profiles[0]\nawait self.entity_description.turn_on_fn(self.device)(profile, self.entity_description.turn_on_data)",
"self._attr_is_... | <|body_start_0|>
super().__init__(device)
self._attr_unique_id = f'{self.mac_or_serial}_{description.key}'
self.entity_description = description
<|end_body_0|>
<|body_start_1|>
self._attr_is_on = True
profile = self.device.profiles[0]
await self.entity_description.turn_o... | An ONVIF switch. | ONVIFSwitch | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ONVIFSwitch:
"""An ONVIF switch."""
def __init__(self, device: ONVIFDevice, description: ONVIFSwitchEntityDescription) -> None:
"""Initialize the switch."""
<|body_0|>
async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn on switch."""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_028215 | 3,862 | permissive | [
{
"docstring": "Initialize the switch.",
"name": "__init__",
"signature": "def __init__(self, device: ONVIFDevice, description: ONVIFSwitchEntityDescription) -> None"
},
{
"docstring": "Turn on switch.",
"name": "async_turn_on",
"signature": "async def async_turn_on(self, **kwargs: Any) ... | 3 | null | Implement the Python class `ONVIFSwitch` described below.
Class description:
An ONVIF switch.
Method signatures and docstrings:
- def __init__(self, device: ONVIFDevice, description: ONVIFSwitchEntityDescription) -> None: Initialize the switch.
- async def async_turn_on(self, **kwargs: Any) -> None: Turn on switch.
-... | Implement the Python class `ONVIFSwitch` described below.
Class description:
An ONVIF switch.
Method signatures and docstrings:
- def __init__(self, device: ONVIFDevice, description: ONVIFSwitchEntityDescription) -> None: Initialize the switch.
- async def async_turn_on(self, **kwargs: Any) -> None: Turn on switch.
-... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class ONVIFSwitch:
"""An ONVIF switch."""
def __init__(self, device: ONVIFDevice, description: ONVIFSwitchEntityDescription) -> None:
"""Initialize the switch."""
<|body_0|>
async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn on switch."""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ONVIFSwitch:
"""An ONVIF switch."""
def __init__(self, device: ONVIFDevice, description: ONVIFSwitchEntityDescription) -> None:
"""Initialize the switch."""
super().__init__(device)
self._attr_unique_id = f'{self.mac_or_serial}_{description.key}'
self.entity_description = ... | the_stack_v2_python_sparse | homeassistant/components/onvif/switch.py | home-assistant/core | train | 35,501 |
bab1fe6877936cafc715e912e4bb3274e57f362a | [
"s, h = common.service_json_request(self.ipaddr, self.port, 'GET', self.URI_VPOOL_SHOW.format(vpooltype, uri), None)\no = common.json_decode(s)\nif o['inactive']:\n return None\nreturn o",
"if common.is_uri(name):\n return name\ns, h = common.service_json_request(self.ipaddr, self.port, 'GET', self.URI_VPOO... | <|body_start_0|>
s, h = common.service_json_request(self.ipaddr, self.port, 'GET', self.URI_VPOOL_SHOW.format(vpooltype, uri), None)
o = common.json_decode(s)
if o['inactive']:
return None
return o
<|end_body_0|>
<|body_start_1|>
if common.is_uri(name):
r... | VirtualPool | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VirtualPool:
def vpool_show_uri(self, vpooltype, uri):
"""Makes REST API call and retrieves vpool details based on UUID. This function will take uri as input and returns with all parameters of VPOOL like label, urn and type. :param vpooltype : Type of virtual pool {'block'} :param uri : ... | stack_v2_sparse_classes_36k_train_028216 | 2,887 | permissive | [
{
"docstring": "Makes REST API call and retrieves vpool details based on UUID. This function will take uri as input and returns with all parameters of VPOOL like label, urn and type. :param vpooltype : Type of virtual pool {'block'} :param uri : unique resource identifier of the vpool :returns: object containin... | 2 | stack_v2_sparse_classes_30k_train_004994 | Implement the Python class `VirtualPool` described below.
Class description:
Implement the VirtualPool class.
Method signatures and docstrings:
- def vpool_show_uri(self, vpooltype, uri): Makes REST API call and retrieves vpool details based on UUID. This function will take uri as input and returns with all parameter... | Implement the Python class `VirtualPool` described below.
Class description:
Implement the VirtualPool class.
Method signatures and docstrings:
- def vpool_show_uri(self, vpooltype, uri): Makes REST API call and retrieves vpool details based on UUID. This function will take uri as input and returns with all parameter... | f8f1a4fe4a6da6e77d5dbff4f96eb123ec445230 | <|skeleton|>
class VirtualPool:
def vpool_show_uri(self, vpooltype, uri):
"""Makes REST API call and retrieves vpool details based on UUID. This function will take uri as input and returns with all parameters of VPOOL like label, urn and type. :param vpooltype : Type of virtual pool {'block'} :param uri : ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VirtualPool:
def vpool_show_uri(self, vpooltype, uri):
"""Makes REST API call and retrieves vpool details based on UUID. This function will take uri as input and returns with all parameters of VPOOL like label, urn and type. :param vpooltype : Type of virtual pool {'block'} :param uri : unique resourc... | the_stack_v2_python_sparse | cinder/volume/drivers/coprhd/helpers/virtualpool.py | Nexenta/cinder | train | 3 | |
c93e1eee22a2562395ebb320b7f806528ac34663 | [
"try:\n _ = list(Metrics(api_key=config['api_key']).read_records(sync_mode=SyncMode.full_refresh))\nexcept Exception as e:\n return (False, repr(e))\nreturn (True, None)",
"api_key = config['api_key']\nstart_date = config['start_date']\nreturn [Campaigns(api_key=api_key), Events(api_key=api_key, start_date=... | <|body_start_0|>
try:
_ = list(Metrics(api_key=config['api_key']).read_records(sync_mode=SyncMode.full_refresh))
except Exception as e:
return (False, repr(e))
return (True, None)
<|end_body_0|>
<|body_start_1|>
api_key = config['api_key']
start_date = co... | SourceKlaviyo | [
"MIT",
"Elastic-2.0",
"Apache-2.0",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SourceKlaviyo:
def check_connection(self, logger, config: Mapping[str, Any]) -> Tuple[bool, Any]:
"""Connection check to validate that the user-provided config can be used to connect to the underlying API :param config: the user-input config object conforming to the connector's spec.json... | stack_v2_sparse_classes_36k_train_028217 | 1,790 | permissive | [
{
"docstring": "Connection check to validate that the user-provided config can be used to connect to the underlying API :param config: the user-input config object conforming to the connector's spec.json :param logger: logger object :return Tuple[bool, Any]: (True, None) if the input config can be used to conne... | 2 | stack_v2_sparse_classes_30k_train_005442 | Implement the Python class `SourceKlaviyo` described below.
Class description:
Implement the SourceKlaviyo class.
Method signatures and docstrings:
- def check_connection(self, logger, config: Mapping[str, Any]) -> Tuple[bool, Any]: Connection check to validate that the user-provided config can be used to connect to ... | Implement the Python class `SourceKlaviyo` described below.
Class description:
Implement the SourceKlaviyo class.
Method signatures and docstrings:
- def check_connection(self, logger, config: Mapping[str, Any]) -> Tuple[bool, Any]: Connection check to validate that the user-provided config can be used to connect to ... | 8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6 | <|skeleton|>
class SourceKlaviyo:
def check_connection(self, logger, config: Mapping[str, Any]) -> Tuple[bool, Any]:
"""Connection check to validate that the user-provided config can be used to connect to the underlying API :param config: the user-input config object conforming to the connector's spec.json... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SourceKlaviyo:
def check_connection(self, logger, config: Mapping[str, Any]) -> Tuple[bool, Any]:
"""Connection check to validate that the user-provided config can be used to connect to the underlying API :param config: the user-input config object conforming to the connector's spec.json :param logger... | the_stack_v2_python_sparse | dts/airbyte/airbyte-integrations/connectors/source-klaviyo/source_klaviyo/source.py | alldatacenter/alldata | train | 774 | |
8fe0b9f808eded3e83bdfd6d9e87e8e89fcdec9b | [
"conn, cursor = get_db_cursor()\nbuild = 'toy_build'\ntranscript_dict = talon.make_transcript_dict(cursor)\nconn.close()\nedges = (1, 2, 3)\ngene_ID, transcripts = talon.search_for_transcript_suffix(edges, transcript_dict)\nassert gene_ID == None",
"conn, cursor = get_db_cursor()\nbuild = 'toy_build'\ntranscript_... | <|body_start_0|>
conn, cursor = get_db_cursor()
build = 'toy_build'
transcript_dict = talon.make_transcript_dict(cursor)
conn.close()
edges = (1, 2, 3)
gene_ID, transcripts = talon.search_for_transcript_suffix(edges, transcript_dict)
assert gene_ID == None
<|end_b... | TestSearchForSuffix | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestSearchForSuffix:
def test_find_no_match(self):
"""Example where the toy transcript database contains no matches for the edge set."""
<|body_0|>
def test_find_match(self):
"""Example where the toy transcript database contains exactly one suffix match for the trans... | stack_v2_sparse_classes_36k_train_028218 | 2,506 | permissive | [
{
"docstring": "Example where the toy transcript database contains no matches for the edge set.",
"name": "test_find_no_match",
"signature": "def test_find_no_match(self)"
},
{
"docstring": "Example where the toy transcript database contains exactly one suffix match for the transcript.",
"na... | 4 | stack_v2_sparse_classes_30k_train_003816 | Implement the Python class `TestSearchForSuffix` described below.
Class description:
Implement the TestSearchForSuffix class.
Method signatures and docstrings:
- def test_find_no_match(self): Example where the toy transcript database contains no matches for the edge set.
- def test_find_match(self): Example where the... | Implement the Python class `TestSearchForSuffix` described below.
Class description:
Implement the TestSearchForSuffix class.
Method signatures and docstrings:
- def test_find_no_match(self): Example where the toy transcript database contains no matches for the edge set.
- def test_find_match(self): Example where the... | 8014faed5f982e5e106ec05239e47d65878e76c3 | <|skeleton|>
class TestSearchForSuffix:
def test_find_no_match(self):
"""Example where the toy transcript database contains no matches for the edge set."""
<|body_0|>
def test_find_match(self):
"""Example where the toy transcript database contains exactly one suffix match for the trans... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestSearchForSuffix:
def test_find_no_match(self):
"""Example where the toy transcript database contains no matches for the edge set."""
conn, cursor = get_db_cursor()
build = 'toy_build'
transcript_dict = talon.make_transcript_dict(cursor)
conn.close()
edges = ... | the_stack_v2_python_sparse | archived/qtests/test_search_for_suffix.py | kopardev/TALON | train | 0 | |
f17bc693587f8cf15c9c808117c8599155ca5f19 | [
"self.flip_probs = [hflip_prob, vflip_prob]\nself.asymmetric_prob = asymmetric_prob\nself.use_keys = use_keys\nself.ignore_keys = ignore_keys\nself.image_keys = list(image_keys)\nself.flow_keys = list(flow_keys)",
"valid_keys = _get_valid_keys(inputs.keys(), self.use_keys, self.ignore_keys)\nfor iorient in range(... | <|body_start_0|>
self.flip_probs = [hflip_prob, vflip_prob]
self.asymmetric_prob = asymmetric_prob
self.use_keys = use_keys
self.ignore_keys = ignore_keys
self.image_keys = list(image_keys)
self.flow_keys = list(flow_keys)
<|end_body_0|>
<|body_start_1|>
valid_ke... | Randomly horizontally and vertically flips the inputs. If asymmetric_prob > 0, then each input of the sequence may be flipped differently. | RandomFlip | [
"Apache-2.0",
"CC-BY-NC-SA-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandomFlip:
"""Randomly horizontally and vertically flips the inputs. If asymmetric_prob > 0, then each input of the sequence may be flipped differently."""
def __init__(self, hflip_prob: float=0.0, vflip_prob: float=0.0, asymmetric_prob: float=0.0, use_keys: Optional[Union[KeysView, Sequenc... | stack_v2_sparse_classes_36k_train_028219 | 42,078 | permissive | [
{
"docstring": "Initialize RandomFlip. Parameters ---------- hflip_prob : float, default 0.0 Probability of applying a horizontal flip. vflip_prob : float, default 0.0 Probability of applying a vertical flip. asymmetric_prob : float, default 0.0 Chance to apply an asymmetric transform, in which the parameters f... | 4 | stack_v2_sparse_classes_30k_train_000714 | Implement the Python class `RandomFlip` described below.
Class description:
Randomly horizontally and vertically flips the inputs. If asymmetric_prob > 0, then each input of the sequence may be flipped differently.
Method signatures and docstrings:
- def __init__(self, hflip_prob: float=0.0, vflip_prob: float=0.0, as... | Implement the Python class `RandomFlip` described below.
Class description:
Randomly horizontally and vertically flips the inputs. If asymmetric_prob > 0, then each input of the sequence may be flipped differently.
Method signatures and docstrings:
- def __init__(self, hflip_prob: float=0.0, vflip_prob: float=0.0, as... | d6582a0fd386517fdefbe2c347cef53150b5b1da | <|skeleton|>
class RandomFlip:
"""Randomly horizontally and vertically flips the inputs. If asymmetric_prob > 0, then each input of the sequence may be flipped differently."""
def __init__(self, hflip_prob: float=0.0, vflip_prob: float=0.0, asymmetric_prob: float=0.0, use_keys: Optional[Union[KeysView, Sequenc... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RandomFlip:
"""Randomly horizontally and vertically flips the inputs. If asymmetric_prob > 0, then each input of the sequence may be flipped differently."""
def __init__(self, hflip_prob: float=0.0, vflip_prob: float=0.0, asymmetric_prob: float=0.0, use_keys: Optional[Union[KeysView, Sequence[str]]]=None... | the_stack_v2_python_sparse | ptlflow/data/flow_transforms.py | hmorimitsu/ptlflow | train | 140 |
deaa8d0108b929185bc6bd5b5139f3e426eeb503 | [
"node = root\nqueue = [node]\nresult = list()\nwhile queue:\n nodes = list()\n nodesvalue = list()\n for node in queue:\n nodesvalue.append(node.val)\n if node.left:\n nodes.append(node.left)\n if node.right:\n nodes.append(node.right)\n result.append(nodesvalu... | <|body_start_0|>
node = root
queue = [node]
result = list()
while queue:
nodes = list()
nodesvalue = list()
for node in queue:
nodesvalue.append(node.val)
if node.left:
nodes.append(node.left)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findBottomLeftValue(self, root):
""":type root: TreeNode :rtype: int"""
<|body_0|>
def findBottomLeftValue_function2(self, root):
""":type root: TreeNode :rtype: int"""
<|body_1|>
def findBottomLeftValue_function3(self, root):
""":t... | stack_v2_sparse_classes_36k_train_028220 | 2,293 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: int",
"name": "findBottomLeftValue",
"signature": "def findBottomLeftValue(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: int",
"name": "findBottomLeftValue_function2",
"signature": "def findBottomLeftValue_function2(self, root)"... | 3 | stack_v2_sparse_classes_30k_train_013824 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findBottomLeftValue(self, root): :type root: TreeNode :rtype: int
- def findBottomLeftValue_function2(self, root): :type root: TreeNode :rtype: int
- def findBottomLeftValue_... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findBottomLeftValue(self, root): :type root: TreeNode :rtype: int
- def findBottomLeftValue_function2(self, root): :type root: TreeNode :rtype: int
- def findBottomLeftValue_... | 3f2de917df20de2d84446902fd6404ce1f15dd3d | <|skeleton|>
class Solution:
def findBottomLeftValue(self, root):
""":type root: TreeNode :rtype: int"""
<|body_0|>
def findBottomLeftValue_function2(self, root):
""":type root: TreeNode :rtype: int"""
<|body_1|>
def findBottomLeftValue_function3(self, root):
""":t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findBottomLeftValue(self, root):
""":type root: TreeNode :rtype: int"""
node = root
queue = [node]
result = list()
while queue:
nodes = list()
nodesvalue = list()
for node in queue:
nodesvalue.append(node... | the_stack_v2_python_sparse | leetcode/找树左下角的值.py | YimingXue/leetcode-sword2offer | train | 1 | |
673c03b1a82e6837ad910d3f7450c56d65962ee4 | [
"current_assignment[variable.get_name()] = value\nconstraints = variable.get_constraints()\nscore = 0\nfor constraint in constraints:\n if constraint.get_number_of_constraints(current_assignment) == 0:\n score += 1\nreturn score",
"current_assignment[variable.get_name()] = value\nconstraints = variable.... | <|body_start_0|>
current_assignment[variable.get_name()] = value
constraints = variable.get_constraints()
score = 0
for constraint in constraints:
if constraint.get_number_of_constraints(current_assignment) == 0:
score += 1
return score
<|end_body_0|>
... | LeastConstrainingValue | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LeastConstrainingValue:
def __get_conflict_score(self, variable, value, current_assignment):
"""The conflict score of the value. Returns the amount of constraints that are not satisfiable with the assignment of value to variable. The lower the better :param value: :return:"""
<|b... | stack_v2_sparse_classes_36k_train_028221 | 4,624 | no_license | [
{
"docstring": "The conflict score of the value. Returns the amount of constraints that are not satisfiable with the assignment of value to variable. The lower the better :param value: :return:",
"name": "__get_conflict_score",
"signature": "def __get_conflict_score(self, variable, value, current_assign... | 3 | stack_v2_sparse_classes_30k_train_015531 | Implement the Python class `LeastConstrainingValue` described below.
Class description:
Implement the LeastConstrainingValue class.
Method signatures and docstrings:
- def __get_conflict_score(self, variable, value, current_assignment): The conflict score of the value. Returns the amount of constraints that are not s... | Implement the Python class `LeastConstrainingValue` described below.
Class description:
Implement the LeastConstrainingValue class.
Method signatures and docstrings:
- def __get_conflict_score(self, variable, value, current_assignment): The conflict score of the value. Returns the amount of constraints that are not s... | 901a806cf38ba2ff898b0981c636cf1bf89def21 | <|skeleton|>
class LeastConstrainingValue:
def __get_conflict_score(self, variable, value, current_assignment):
"""The conflict score of the value. Returns the amount of constraints that are not satisfiable with the assignment of value to variable. The lower the better :param value: :return:"""
<|b... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LeastConstrainingValue:
def __get_conflict_score(self, variable, value, current_assignment):
"""The conflict score of the value. Returns the amount of constraints that are not satisfiable with the assignment of value to variable. The lower the better :param value: :return:"""
current_assignmen... | the_stack_v2_python_sparse | BackTrackHeuristics/LeastConstrainingValue.py | idosilverwater/ai-project | train | 0 | |
769d8ff79d6051a19642d5b074791d015241565f | [
"samples = [sample]\npersist_task = persist_result.s(sample['analysis_result'], MODULE_NAME)\ntask_chain = chain(filter_humann2_pathways.s(samples), persist_task)\nresult = task_chain.delay()\nreturn result",
"persist_task = persist_result.s(sample_group.analysis_result_uuid, MODULE_NAME)\ntask_chain = chain(filt... | <|body_start_0|>
samples = [sample]
persist_task = persist_result.s(sample['analysis_result'], MODULE_NAME)
task_chain = chain(filter_humann2_pathways.s(samples), persist_task)
result = task_chain.delay()
return result
<|end_body_0|>
<|body_start_1|>
persist_task = persi... | Task for generating Pathway results. | PathwayWrangler | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PathwayWrangler:
"""Task for generating Pathway results."""
def run_sample(cls, sample_id, sample):
"""Gather single sample and process."""
<|body_0|>
def run_sample_group(cls, sample_group, samples):
"""Gather samples and process."""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_36k_train_028222 | 1,077 | permissive | [
{
"docstring": "Gather single sample and process.",
"name": "run_sample",
"signature": "def run_sample(cls, sample_id, sample)"
},
{
"docstring": "Gather samples and process.",
"name": "run_sample_group",
"signature": "def run_sample_group(cls, sample_group, samples)"
}
] | 2 | null | Implement the Python class `PathwayWrangler` described below.
Class description:
Task for generating Pathway results.
Method signatures and docstrings:
- def run_sample(cls, sample_id, sample): Gather single sample and process.
- def run_sample_group(cls, sample_group, samples): Gather samples and process. | Implement the Python class `PathwayWrangler` described below.
Class description:
Task for generating Pathway results.
Method signatures and docstrings:
- def run_sample(cls, sample_id, sample): Gather single sample and process.
- def run_sample_group(cls, sample_group, samples): Gather samples and process.
<|skeleto... | 609cd57c626c857c8efde8237a1f22f4d1e6065d | <|skeleton|>
class PathwayWrangler:
"""Task for generating Pathway results."""
def run_sample(cls, sample_id, sample):
"""Gather single sample and process."""
<|body_0|>
def run_sample_group(cls, sample_group, samples):
"""Gather samples and process."""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PathwayWrangler:
"""Task for generating Pathway results."""
def run_sample(cls, sample_id, sample):
"""Gather single sample and process."""
samples = [sample]
persist_task = persist_result.s(sample['analysis_result'], MODULE_NAME)
task_chain = chain(filter_humann2_pathways... | the_stack_v2_python_sparse | app/display_modules/pathways/wrangler.py | MetaGenScope/metagenscope-server | train | 0 |
44cbd94e285adb6554f5e565192f72037dae8cc5 | [
"startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('henryhcy_wangyp', 'henryhcy_wangyp')\nincome = repo['henryhcy_wangyp.income']\npoverty = repo['henryhcy_wangyp.poverty']\ninfo = []\nfor i in income.find():\n i = i.copy()\n temp = poverty.find_one... | <|body_start_0|>
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('henryhcy_wangyp', 'henryhcy_wangyp')
income = repo['henryhcy_wangyp.income']
poverty = repo['henryhcy_wangyp.poverty']
info = []
f... | mergeIncomePoverty | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class mergeIncomePoverty:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing every... | stack_v2_sparse_classes_36k_train_028223 | 4,296 | no_license | [
{
"docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).",
"name": "execute",
"signature": "def execute(trial=False)"
},
{
"docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d... | 2 | stack_v2_sparse_classes_30k_train_015185 | Implement the Python class `mergeIncomePoverty` described below.
Class description:
Implement the mergeIncomePoverty class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity).
- def provenance(doc=prov.model.ProvDocument(), startTi... | Implement the Python class `mergeIncomePoverty` described below.
Class description:
Implement the mergeIncomePoverty class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity).
- def provenance(doc=prov.model.ProvDocument(), startTi... | 90284cf3debbac36eead07b8d2339cdd191b86cf | <|skeleton|>
class mergeIncomePoverty:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing every... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class mergeIncomePoverty:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('henryhcy_wangyp', 'henryhcy_wang... | the_stack_v2_python_sparse | henryhcy_wangyp/mergeIncomePoverty.py | maximega/course-2019-spr-proj | train | 2 | |
150895c4664da52bcfea9d7cdf9c6846fd7df7f5 | [
"d = defaultdict(int)\nl, r = (0, 0)\nn = len(s)\nres = 0\nwhile r < n:\n d[s[r]] += 1\n while d[s[r]] > 1:\n d[s[l]] -= 1\n l += 1\n res = max(res, r - l + 1)\n r += 1\nreturn res",
"n = len(s)\nst = set()\nL, R = (0, 0)\nres = 0\nwhile R < n:\n strlen = len(st)\n st.add(s[R])\n ... | <|body_start_0|>
d = defaultdict(int)
l, r = (0, 0)
n = len(s)
res = 0
while r < n:
d[s[r]] += 1
while d[s[r]] > 1:
d[s[l]] -= 1
l += 1
res = max(res, r - l + 1)
r += 1
return res
<|end_body_0... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lengthOfLongestSubstring(self, s):
"""字典 + 双指针实现滑动窗口 :type s: str :rtype: int"""
<|body_0|>
def lengthOfLongestSubstring2(self, s):
"""滑动窗口 :param s: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
d = defaultdict(int)
... | stack_v2_sparse_classes_36k_train_028224 | 1,648 | no_license | [
{
"docstring": "字典 + 双指针实现滑动窗口 :type s: str :rtype: int",
"name": "lengthOfLongestSubstring",
"signature": "def lengthOfLongestSubstring(self, s)"
},
{
"docstring": "滑动窗口 :param s: :return:",
"name": "lengthOfLongestSubstring2",
"signature": "def lengthOfLongestSubstring2(self, s)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLongestSubstring(self, s): 字典 + 双指针实现滑动窗口 :type s: str :rtype: int
- def lengthOfLongestSubstring2(self, s): 滑动窗口 :param s: :return: | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLongestSubstring(self, s): 字典 + 双指针实现滑动窗口 :type s: str :rtype: int
- def lengthOfLongestSubstring2(self, s): 滑动窗口 :param s: :return:
<|skeleton|>
class Solution:
... | 5d3574ccd282d0146c83c286ae28d8baaabd4910 | <|skeleton|>
class Solution:
def lengthOfLongestSubstring(self, s):
"""字典 + 双指针实现滑动窗口 :type s: str :rtype: int"""
<|body_0|>
def lengthOfLongestSubstring2(self, s):
"""滑动窗口 :param s: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def lengthOfLongestSubstring(self, s):
"""字典 + 双指针实现滑动窗口 :type s: str :rtype: int"""
d = defaultdict(int)
l, r = (0, 0)
n = len(s)
res = 0
while r < n:
d[s[r]] += 1
while d[s[r]] > 1:
d[s[l]] -= 1
... | the_stack_v2_python_sparse | 3_无重复字符的最长子串.py | lovehhf/LeetCode | train | 0 | |
e7b498e474050ea71bdd96a303b23022c8f1da2a | [
"self.stack_size = stack_size\nself.arr = [None] * stack_size * 3\nself.bottoms = [i * stack_size for i in range(3)]\nself.tops = [i * stack_size for i in range(3)]",
"i = stackno - 1\nif self.tops[i] - self.bottoms[i] == self.stack_size:\n raise Exception('push called on full stack {stackno}')\nself.arr[self.... | <|body_start_0|>
self.stack_size = stack_size
self.arr = [None] * stack_size * 3
self.bottoms = [i * stack_size for i in range(3)]
self.tops = [i * stack_size for i in range(3)]
<|end_body_0|>
<|body_start_1|>
i = stackno - 1
if self.tops[i] - self.bottoms[i] == self.sta... | Class implementing three stacks with one array | ThreeStacks | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ThreeStacks:
"""Class implementing three stacks with one array"""
def __init__(self, stack_size: int=10):
"""Init three stacks, each with initial allocated size `stack_size`"""
<|body_0|>
def push(self, stackno: int, val) -> None:
"""Push `val` onto stack number ... | stack_v2_sparse_classes_36k_train_028225 | 2,829 | no_license | [
{
"docstring": "Init three stacks, each with initial allocated size `stack_size`",
"name": "__init__",
"signature": "def __init__(self, stack_size: int=10)"
},
{
"docstring": "Push `val` onto stack number `stackno` (1, 2, or 3)",
"name": "push",
"signature": "def push(self, stackno: int,... | 3 | stack_v2_sparse_classes_30k_train_009860 | Implement the Python class `ThreeStacks` described below.
Class description:
Class implementing three stacks with one array
Method signatures and docstrings:
- def __init__(self, stack_size: int=10): Init three stacks, each with initial allocated size `stack_size`
- def push(self, stackno: int, val) -> None: Push `va... | Implement the Python class `ThreeStacks` described below.
Class description:
Class implementing three stacks with one array
Method signatures and docstrings:
- def __init__(self, stack_size: int=10): Init three stacks, each with initial allocated size `stack_size`
- def push(self, stackno: int, val) -> None: Push `va... | 12200cf58378bb858d1113a12c3f54054df91937 | <|skeleton|>
class ThreeStacks:
"""Class implementing three stacks with one array"""
def __init__(self, stack_size: int=10):
"""Init three stacks, each with initial allocated size `stack_size`"""
<|body_0|>
def push(self, stackno: int, val) -> None:
"""Push `val` onto stack number ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ThreeStacks:
"""Class implementing three stacks with one array"""
def __init__(self, stack_size: int=10):
"""Init three stacks, each with initial allocated size `stack_size`"""
self.stack_size = stack_size
self.arr = [None] * stack_size * 3
self.bottoms = [i * stack_size f... | the_stack_v2_python_sparse | chapter3/1_three_in_one.py | adityabads/cracking-coding-interview | train | 0 |
b087de4988bdfd99d2c3610f3806a500aacf169e | [
"if not s:\n return False\na = (s + s)[1:-1]\nreturn s in a",
"len_s = len(s)\ngap = 2\nwhile gap <= len_s:\n if len_s % gap != 0:\n gap += 1\n continue\n step = len_s / gap\n start = 0\n while start <= len_s - 2 * step:\n if s[start:start + step] != s[start + step:start + 2 * ... | <|body_start_0|>
if not s:
return False
a = (s + s)[1:-1]
return s in a
<|end_body_0|>
<|body_start_1|>
len_s = len(s)
gap = 2
while gap <= len_s:
if len_s % gap != 0:
gap += 1
continue
step = len_s / ga... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def repeatedSubstringPattern(self, s):
""":type s: str :rtype: bool"""
<|body_0|>
def ____repeatedSubstringPattern(self, s):
""":type s: str :rtype: bool"""
<|body_1|>
def ___repeatedSubstringPattern(self, s):
""":type s: str :rtype: bo... | stack_v2_sparse_classes_36k_train_028226 | 14,863 | permissive | [
{
"docstring": ":type s: str :rtype: bool",
"name": "repeatedSubstringPattern",
"signature": "def repeatedSubstringPattern(self, s)"
},
{
"docstring": ":type s: str :rtype: bool",
"name": "____repeatedSubstringPattern",
"signature": "def ____repeatedSubstringPattern(self, s)"
},
{
... | 5 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def repeatedSubstringPattern(self, s): :type s: str :rtype: bool
- def ____repeatedSubstringPattern(self, s): :type s: str :rtype: bool
- def ___repeatedSubstringPattern(self, s)... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def repeatedSubstringPattern(self, s): :type s: str :rtype: bool
- def ____repeatedSubstringPattern(self, s): :type s: str :rtype: bool
- def ___repeatedSubstringPattern(self, s)... | 0dd67edca4e0b0323cb5a7239f02ea46383cd15a | <|skeleton|>
class Solution:
def repeatedSubstringPattern(self, s):
""":type s: str :rtype: bool"""
<|body_0|>
def ____repeatedSubstringPattern(self, s):
""":type s: str :rtype: bool"""
<|body_1|>
def ___repeatedSubstringPattern(self, s):
""":type s: str :rtype: bo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def repeatedSubstringPattern(self, s):
""":type s: str :rtype: bool"""
if not s:
return False
a = (s + s)[1:-1]
return s in a
def ____repeatedSubstringPattern(self, s):
""":type s: str :rtype: bool"""
len_s = len(s)
gap = 2
... | the_stack_v2_python_sparse | 459.repeated-substring-pattern.py | windard/leeeeee | train | 0 | |
1a6281e2143db57d0e75b8987e9b3eaf7ec89c41 | [
"n = len(arr)\npre_sum = [0] * (n + 1)\nans = 0\nfor i in range(n):\n pre_sum[i + 1] = pre_sum[i] + arr[i]\nfor i in range(1, n + 1):\n for j in range(i):\n if (pre_sum[i] - pre_sum[j]) % 2 == 1:\n ans += 1\nreturn ans % (1000000000.0 + 7)",
"n = len(arr)\nans = 0\neven = 0\nodd = 0\nfor i... | <|body_start_0|>
n = len(arr)
pre_sum = [0] * (n + 1)
ans = 0
for i in range(n):
pre_sum[i + 1] = pre_sum[i] + arr[i]
for i in range(1, n + 1):
for j in range(i):
if (pre_sum[i] - pre_sum[j]) % 2 == 1:
ans += 1
r... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def numOfSubarrays_timeout(self, arr: List[int]) -> int:
"""deprecated: 超时"""
<|body_0|>
def numOfSubarrays(self, arr: List[int]) -> int:
"""优化:odd + odd => even / even + even => even / odd + even => odd 耗时:$O(n)$"""
<|body_1|>
<|end_skeleton|>
<|... | stack_v2_sparse_classes_36k_train_028227 | 2,738 | no_license | [
{
"docstring": "deprecated: 超时",
"name": "numOfSubarrays_timeout",
"signature": "def numOfSubarrays_timeout(self, arr: List[int]) -> int"
},
{
"docstring": "优化:odd + odd => even / even + even => even / odd + even => odd 耗时:$O(n)$",
"name": "numOfSubarrays",
"signature": "def numOfSubarra... | 2 | stack_v2_sparse_classes_30k_train_006255 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numOfSubarrays_timeout(self, arr: List[int]) -> int: deprecated: 超时
- def numOfSubarrays(self, arr: List[int]) -> int: 优化:odd + odd => even / even + even => even / odd + even... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numOfSubarrays_timeout(self, arr: List[int]) -> int: deprecated: 超时
- def numOfSubarrays(self, arr: List[int]) -> int: 优化:odd + odd => even / even + even => even / odd + even... | f832227c4d0e0b1c0cc326561187004ef24e2a68 | <|skeleton|>
class Solution:
def numOfSubarrays_timeout(self, arr: List[int]) -> int:
"""deprecated: 超时"""
<|body_0|>
def numOfSubarrays(self, arr: List[int]) -> int:
"""优化:odd + odd => even / even + even => even / odd + even => odd 耗时:$O(n)$"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def numOfSubarrays_timeout(self, arr: List[int]) -> int:
"""deprecated: 超时"""
n = len(arr)
pre_sum = [0] * (n + 1)
ans = 0
for i in range(n):
pre_sum[i + 1] = pre_sum[i] + arr[i]
for i in range(1, n + 1):
for j in range(i):
... | the_stack_v2_python_sparse | 1524.py | Gackle/leetcode_practice | train | 0 | |
dd9c6a80e3cdb9dad37839d2c6d98e65e3e248d4 | [
"if type(FocalPlaneInfo) == type(None):\n self.FocalPlaneInfo = [{'xpos': 0.0, 'ypos': 0.0, 'Pf': 0, 'Px': 0, 'Py': 0, 'Pc': 0, 'Pn': 0, 'Pa': 0, 'Pb': 0}]\nelse:\n self.FocalPlaneInfo = FocalPlaneInfo\nif type(ReceiverInfo) == type(None):\n self.ReceiverInfo = [{'sigma': 1.0, 'fknee': 1.0, 'SampRate': 100... | <|body_start_0|>
if type(FocalPlaneInfo) == type(None):
self.FocalPlaneInfo = [{'xpos': 0.0, 'ypos': 0.0, 'Pf': 0, 'Px': 0, 'Py': 0, 'Pc': 0, 'Pn': 0, 'Pa': 0, 'Pb': 0}]
else:
self.FocalPlaneInfo = FocalPlaneInfo
if type(ReceiverInfo) == type(None):
self.Recei... | Telescope | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Telescope:
def __init__(self, FocalPlaneInfo=None, ReceiverInfo=None, SkyMap=None, Healpix=False):
"""Simulated Telescope Arguments ObsInfo-- List of user defined observations KeyWord Arguments FocalPlaneInfo -- Information on focal positions of horns and TPoint values ReceiverInfo -- In... | stack_v2_sparse_classes_36k_train_028228 | 2,432 | no_license | [
{
"docstring": "Simulated Telescope Arguments ObsInfo-- List of user defined observations KeyWord Arguments FocalPlaneInfo -- Information on focal positions of horns and TPoint values ReceiverInfo -- Information of receiver noise and 1/f characteristics SkyMap -- Fits file containing image to be sampled",
"... | 2 | stack_v2_sparse_classes_30k_train_017648 | Implement the Python class `Telescope` described below.
Class description:
Implement the Telescope class.
Method signatures and docstrings:
- def __init__(self, FocalPlaneInfo=None, ReceiverInfo=None, SkyMap=None, Healpix=False): Simulated Telescope Arguments ObsInfo-- List of user defined observations KeyWord Argume... | Implement the Python class `Telescope` described below.
Class description:
Implement the Telescope class.
Method signatures and docstrings:
- def __init__(self, FocalPlaneInfo=None, ReceiverInfo=None, SkyMap=None, Healpix=False): Simulated Telescope Arguments ObsInfo-- List of user defined observations KeyWord Argume... | ef7caf1b05880a4a2f4c1c12ca439014f82dfe6b | <|skeleton|>
class Telescope:
def __init__(self, FocalPlaneInfo=None, ReceiverInfo=None, SkyMap=None, Healpix=False):
"""Simulated Telescope Arguments ObsInfo-- List of user defined observations KeyWord Arguments FocalPlaneInfo -- Information on focal positions of horns and TPoint values ReceiverInfo -- In... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Telescope:
def __init__(self, FocalPlaneInfo=None, ReceiverInfo=None, SkyMap=None, Healpix=False):
"""Simulated Telescope Arguments ObsInfo-- List of user defined observations KeyWord Arguments FocalPlaneInfo -- Information on focal positions of horns and TPoint values ReceiverInfo -- Information of r... | the_stack_v2_python_sparse | SIMTELE/Telescope.py | SharperJBCA/MFI-Pipeline | train | 0 | |
b3b64a7ce4301645d888c09c992089dbc780d216 | [
"if not kwargs.get('obj_ids') and (not kwargs.get('asn_ids')) and (not kwargs.get('equip_ids')):\n obj_model = facade.get_as_equipment_by_search(self.search)\n as_s = obj_model['query_set']\n only_main_property = False\nelse:\n obj_model = None\n only_main_property = True\n if kwargs.get('obj_ids'... | <|body_start_0|>
if not kwargs.get('obj_ids') and (not kwargs.get('asn_ids')) and (not kwargs.get('equip_ids')):
obj_model = facade.get_as_equipment_by_search(self.search)
as_s = obj_model['query_set']
only_main_property = False
else:
obj_model = None
... | AsEquipmentDBView | [
"Apache-2.0",
"BSD-3-Clause",
"MIT",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AsEquipmentDBView:
def get(self, request, *args, **kwargs):
"""Returns a list of AS's by ids ou dict."""
<|body_0|>
def post(self, request, *args, **kwargs):
"""Create new ASNEquipment."""
<|body_1|>
def delete(self, request, *args, **kwargs):
""... | stack_v2_sparse_classes_36k_train_028229 | 7,072 | permissive | [
{
"docstring": "Returns a list of AS's by ids ou dict.",
"name": "get",
"signature": "def get(self, request, *args, **kwargs)"
},
{
"docstring": "Create new ASNEquipment.",
"name": "post",
"signature": "def post(self, request, *args, **kwargs)"
},
{
"docstring": "Delete AS.",
... | 4 | null | Implement the Python class `AsEquipmentDBView` described below.
Class description:
Implement the AsEquipmentDBView class.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Returns a list of AS's by ids ou dict.
- def post(self, request, *args, **kwargs): Create new ASNEquipment.
- def delet... | Implement the Python class `AsEquipmentDBView` described below.
Class description:
Implement the AsEquipmentDBView class.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Returns a list of AS's by ids ou dict.
- def post(self, request, *args, **kwargs): Create new ASNEquipment.
- def delet... | eb27e1d977a1c4bb1fee8fb51b8d8050c64696d9 | <|skeleton|>
class AsEquipmentDBView:
def get(self, request, *args, **kwargs):
"""Returns a list of AS's by ids ou dict."""
<|body_0|>
def post(self, request, *args, **kwargs):
"""Create new ASNEquipment."""
<|body_1|>
def delete(self, request, *args, **kwargs):
""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AsEquipmentDBView:
def get(self, request, *args, **kwargs):
"""Returns a list of AS's by ids ou dict."""
if not kwargs.get('obj_ids') and (not kwargs.get('asn_ids')) and (not kwargs.get('equip_ids')):
obj_model = facade.get_as_equipment_by_search(self.search)
as_s = obj... | the_stack_v2_python_sparse | networkapi/api_asn/v4/views.py | globocom/GloboNetworkAPI | train | 86 | |
7e7cf52427bc3ecbabc84b62d8bb707e8899ec31 | [
"dp0, dp1 = (0, -prices[0])\nfor price in prices[1:]:\n tmp = dp0\n dp0 = max(dp0, dp1 + price)\n dp1 = max(dp1, tmp - price)\nreturn max(dp0, dp1)",
"len_prices = len(prices)\nif len_prices == 0:\n return 0\nprofit = 0\nindex = 0\nwhile index < len_prices - 1:\n if prices[index + 1] > prices[index... | <|body_start_0|>
dp0, dp1 = (0, -prices[0])
for price in prices[1:]:
tmp = dp0
dp0 = max(dp0, dp1 + price)
dp1 = max(dp1, tmp - price)
return max(dp0, dp1)
<|end_body_0|>
<|body_start_1|>
len_prices = len(prices)
if len_prices == 0:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxProfit(self, prices: List[int]) -> int:
"""执行用时: 48 ms , 在所有 Python3 提交中击败了 66.56% 的用户 内存消耗: 15.5 MB , 在所有 Python3 提交中击败了 74.51% 的用户"""
<|body_0|>
def maxProfit5(self, prices: List[int]) -> int:
"""执行用时: 44 ms , 在所有 Python3 提交中击败了 89.41% 的用户 内存消耗: 15... | stack_v2_sparse_classes_36k_train_028230 | 3,054 | no_license | [
{
"docstring": "执行用时: 48 ms , 在所有 Python3 提交中击败了 66.56% 的用户 内存消耗: 15.5 MB , 在所有 Python3 提交中击败了 74.51% 的用户",
"name": "maxProfit",
"signature": "def maxProfit(self, prices: List[int]) -> int"
},
{
"docstring": "执行用时: 44 ms , 在所有 Python3 提交中击败了 89.41% 的用户 内存消耗: 15.6 MB , 在所有 Python3 提交中击败了 53.92% 的... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit(self, prices: List[int]) -> int: 执行用时: 48 ms , 在所有 Python3 提交中击败了 66.56% 的用户 内存消耗: 15.5 MB , 在所有 Python3 提交中击败了 74.51% 的用户
- def maxProfit5(self, prices: List[int])... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit(self, prices: List[int]) -> int: 执行用时: 48 ms , 在所有 Python3 提交中击败了 66.56% 的用户 内存消耗: 15.5 MB , 在所有 Python3 提交中击败了 74.51% 的用户
- def maxProfit5(self, prices: List[int])... | d613ed8a5a2c15ace7d513965b372d128845d66a | <|skeleton|>
class Solution:
def maxProfit(self, prices: List[int]) -> int:
"""执行用时: 48 ms , 在所有 Python3 提交中击败了 66.56% 的用户 内存消耗: 15.5 MB , 在所有 Python3 提交中击败了 74.51% 的用户"""
<|body_0|>
def maxProfit5(self, prices: List[int]) -> int:
"""执行用时: 44 ms , 在所有 Python3 提交中击败了 89.41% 的用户 内存消耗: 15... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxProfit(self, prices: List[int]) -> int:
"""执行用时: 48 ms , 在所有 Python3 提交中击败了 66.56% 的用户 内存消耗: 15.5 MB , 在所有 Python3 提交中击败了 74.51% 的用户"""
dp0, dp1 = (0, -prices[0])
for price in prices[1:]:
tmp = dp0
dp0 = max(dp0, dp1 + price)
dp1 = m... | the_stack_v2_python_sparse | 买卖股票的最佳时机2.py | nomboy/leetcode | train | 0 | |
ad9c7b8eea210efa758866d01b2cf23a4ee745bb | [
"pygame.init()\nself.screen = pygame.display.set_mode((1200, 800))\npygame.display.set_caption('Trench Run')\nself.falcon = Falcon(self)\nself.bg_color = (0, 0, 230)",
"while True:\n for event in pygame.event.get():\n if event.type == pygame.QUIT:\n sys.exit()\n self.screen.fill(self.bg_co... | <|body_start_0|>
pygame.init()
self.screen = pygame.display.set_mode((1200, 800))
pygame.display.set_caption('Trench Run')
self.falcon = Falcon(self)
self.bg_color = (0, 0, 230)
<|end_body_0|>
<|body_start_1|>
while True:
for event in pygame.event.get():
... | Overall class to manage game assets and behavior. | TrenchRun | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TrenchRun:
"""Overall class to manage game assets and behavior."""
def __init__(self):
"""Initialize the game and create the game resources"""
<|body_0|>
def run_game(self):
"""start the main loop of the game"""
<|body_1|>
<|end_skeleton|>
<|body_start_... | stack_v2_sparse_classes_36k_train_028231 | 1,155 | no_license | [
{
"docstring": "Initialize the game and create the game resources",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "start the main loop of the game",
"name": "run_game",
"signature": "def run_game(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_020514 | Implement the Python class `TrenchRun` described below.
Class description:
Overall class to manage game assets and behavior.
Method signatures and docstrings:
- def __init__(self): Initialize the game and create the game resources
- def run_game(self): start the main loop of the game | Implement the Python class `TrenchRun` described below.
Class description:
Overall class to manage game assets and behavior.
Method signatures and docstrings:
- def __init__(self): Initialize the game and create the game resources
- def run_game(self): start the main loop of the game
<|skeleton|>
class TrenchRun:
... | 18784c7e3abfb74f85f8c96cb0f8e606cab6dccc | <|skeleton|>
class TrenchRun:
"""Overall class to manage game assets and behavior."""
def __init__(self):
"""Initialize the game and create the game resources"""
<|body_0|>
def run_game(self):
"""start the main loop of the game"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TrenchRun:
"""Overall class to manage game assets and behavior."""
def __init__(self):
"""Initialize the game and create the game resources"""
pygame.init()
self.screen = pygame.display.set_mode((1200, 800))
pygame.display.set_caption('Trench Run')
self.falcon = Fa... | the_stack_v2_python_sparse | chapter_12/falcon_game/blue_sky.py | mwnickerson/python-crash-course | train | 0 |
ae21aa746b4c75d3685e2efc153da4b275a9f268 | [
"try:\n detail_html = source.pop('bbd_html', '')\n detail_url = source.get('bbd_url', '')\n self.logger.info('开始解析:{} {}'.format(self.parser_info, detail_url))\n json_data = json.loads(detail_html)\n res_list = []\n for data in json_data['results']:\n determine_date = data.get('DETERMINEDAT... | <|body_start_0|>
try:
detail_html = source.pop('bbd_html', '')
detail_url = source.get('bbd_url', '')
self.logger.info('开始解析:{} {}'.format(self.parser_info, detail_url))
json_data = json.loads(detail_html)
res_list = []
for data in json_dat... | class Parser__qyxg_xzxk__credit_dongying for 信用中国(东营)-行政许可 | Parser__qyxg_xzxk__credit_dongying | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Parser__qyxg_xzxk__credit_dongying:
"""class Parser__qyxg_xzxk__credit_dongying for 信用中国(东营)-行政许可"""
def parse(self, source, *args, **kwargs):
"""parse logic :Keyword Arguments: self -- source -- *args -- **kwargs -- :return: None"""
<|body_0|>
def date_convert(self, tim... | stack_v2_sparse_classes_36k_train_028232 | 4,379 | no_license | [
{
"docstring": "parse logic :Keyword Arguments: self -- source -- *args -- **kwargs -- :return: None",
"name": "parse",
"signature": "def parse(self, source, *args, **kwargs)"
},
{
"docstring": ":Keyword Arguments: self -- timestamp -- :return: None",
"name": "date_convert",
"signature":... | 2 | null | Implement the Python class `Parser__qyxg_xzxk__credit_dongying` described below.
Class description:
class Parser__qyxg_xzxk__credit_dongying for 信用中国(东营)-行政许可
Method signatures and docstrings:
- def parse(self, source, *args, **kwargs): parse logic :Keyword Arguments: self -- source -- *args -- **kwargs -- :return: N... | Implement the Python class `Parser__qyxg_xzxk__credit_dongying` described below.
Class description:
class Parser__qyxg_xzxk__credit_dongying for 信用中国(东营)-行政许可
Method signatures and docstrings:
- def parse(self, source, *args, **kwargs): parse logic :Keyword Arguments: self -- source -- *args -- **kwargs -- :return: N... | 991902517a94e26fbe6378610d3cd12ff4a5c1f7 | <|skeleton|>
class Parser__qyxg_xzxk__credit_dongying:
"""class Parser__qyxg_xzxk__credit_dongying for 信用中国(东营)-行政许可"""
def parse(self, source, *args, **kwargs):
"""parse logic :Keyword Arguments: self -- source -- *args -- **kwargs -- :return: None"""
<|body_0|>
def date_convert(self, tim... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Parser__qyxg_xzxk__credit_dongying:
"""class Parser__qyxg_xzxk__credit_dongying for 信用中国(东营)-行政许可"""
def parse(self, source, *args, **kwargs):
"""parse logic :Keyword Arguments: self -- source -- *args -- **kwargs -- :return: None"""
try:
detail_html = source.pop('bbd_html', '... | the_stack_v2_python_sparse | parse/qyxg_xzxk/Parser__qyxg_xzxk__credit_dongying.py | ZhouForrest/Spider | train | 0 |
e7dd54e52d83e10f666f54125979c7491c6e8052 | [
"self._parent = parent\nself._fixed = {}\naxes: List[GridAxis] = []\nfor ax in parent.axes():\n if ax.name in fixed.keys():\n self._fixed[ax.name] = fixed[ax.name]\n else:\n axes.append(ax)\nGrid.__init__(self, axes, *args, **kwargs)\nself.log.info('Initializing sub interpolator...')\nfor ax, va... | <|body_start_0|>
self._parent = parent
self._fixed = {}
axes: List[GridAxis] = []
for ax in parent.axes():
if ax.name in fixed.keys():
self._fixed[ax.name] = fixed[ax.name]
else:
axes.append(ax)
Grid.__init__(self, axes, *ar... | A grid that only gives access to a part of the parent grid. | SubGrid | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SubGrid:
"""A grid that only gives access to a part of the parent grid."""
def __init__(self, parent: Grid, fixed: Dict[str, float], *args, **kwargs):
"""Initializes a new sub grid. Args: parent: Parent grid. fixed: Dictionary with fixed axis_name->value pairs."""
<|body_0|>
... | stack_v2_sparse_classes_36k_train_028233 | 1,800 | permissive | [
{
"docstring": "Initializes a new sub grid. Args: parent: Parent grid. fixed: Dictionary with fixed axis_name->value pairs.",
"name": "__init__",
"signature": "def __init__(self, parent: Grid, fixed: Dict[str, float], *args, **kwargs)"
},
{
"docstring": "Fetches the value for the given parameter... | 2 | null | Implement the Python class `SubGrid` described below.
Class description:
A grid that only gives access to a part of the parent grid.
Method signatures and docstrings:
- def __init__(self, parent: Grid, fixed: Dict[str, float], *args, **kwargs): Initializes a new sub grid. Args: parent: Parent grid. fixed: Dictionary ... | Implement the Python class `SubGrid` described below.
Class description:
A grid that only gives access to a part of the parent grid.
Method signatures and docstrings:
- def __init__(self, parent: Grid, fixed: Dict[str, float], *args, **kwargs): Initializes a new sub grid. Args: parent: Parent grid. fixed: Dictionary ... | 648eb1758e3744d9e3d6669edc4a0c4753559f17 | <|skeleton|>
class SubGrid:
"""A grid that only gives access to a part of the parent grid."""
def __init__(self, parent: Grid, fixed: Dict[str, float], *args, **kwargs):
"""Initializes a new sub grid. Args: parent: Parent grid. fixed: Dictionary with fixed axis_name->value pairs."""
<|body_0|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SubGrid:
"""A grid that only gives access to a part of the parent grid."""
def __init__(self, parent: Grid, fixed: Dict[str, float], *args, **kwargs):
"""Initializes a new sub grid. Args: parent: Parent grid. fixed: Dictionary with fixed axis_name->value pairs."""
self._parent = parent
... | the_stack_v2_python_sparse | spexxy/grid/sub.py | thusser/spexxy | train | 4 |
fe4ff4208f2499c29369c1a29482c4217c0cce77 | [
"qr = MapsPage(self.driver)\nqr.open()\nqr.click_quick_repair_btn()\nqr.input_equipNum(self.equipNum)\nqr.input_equipReTime(self.reTime)\nqr.input_faCode(self.faCode_orange)\nqr.click_submit_button()",
"qr = MapsPage(self.driver)\nqr.open()\nqr.click_quick_repair_btn()\nqr.input_equipNum(self.equipNum)\nqr.input_... | <|body_start_0|>
qr = MapsPage(self.driver)
qr.open()
qr.click_quick_repair_btn()
qr.input_equipNum(self.equipNum)
qr.input_equipReTime(self.reTime)
qr.input_faCode(self.faCode_orange)
qr.click_submit_button()
<|end_body_0|>
<|body_start_1|>
qr = MapsPage... | 测试雷达报修面板 | Test_StatusBox | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test_StatusBox:
"""测试雷达报修面板"""
def test_a_quick_repair(self):
"""报修故障预警雷达"""
<|body_0|>
def test_b_quick_repair_red(self):
"""报修紧急故障的雷达"""
<|body_1|>
def test_c_cancle_repair(self):
"""取消报修"""
<|body_2|>
def test_d_view_radar_gre... | stack_v2_sparse_classes_36k_train_028234 | 2,048 | no_license | [
{
"docstring": "报修故障预警雷达",
"name": "test_a_quick_repair",
"signature": "def test_a_quick_repair(self)"
},
{
"docstring": "报修紧急故障的雷达",
"name": "test_b_quick_repair_red",
"signature": "def test_b_quick_repair_red(self)"
},
{
"docstring": "取消报修",
"name": "test_c_cancle_repair",
... | 6 | stack_v2_sparse_classes_30k_train_007922 | Implement the Python class `Test_StatusBox` described below.
Class description:
测试雷达报修面板
Method signatures and docstrings:
- def test_a_quick_repair(self): 报修故障预警雷达
- def test_b_quick_repair_red(self): 报修紧急故障的雷达
- def test_c_cancle_repair(self): 取消报修
- def test_d_view_radar_green_info(self): 查看健康雷达信息
- def test_e_vie... | Implement the Python class `Test_StatusBox` described below.
Class description:
测试雷达报修面板
Method signatures and docstrings:
- def test_a_quick_repair(self): 报修故障预警雷达
- def test_b_quick_repair_red(self): 报修紧急故障的雷达
- def test_c_cancle_repair(self): 取消报修
- def test_d_view_radar_green_info(self): 查看健康雷达信息
- def test_e_vie... | 99f39af29df91c6d37e58e944c311eba478c4eb9 | <|skeleton|>
class Test_StatusBox:
"""测试雷达报修面板"""
def test_a_quick_repair(self):
"""报修故障预警雷达"""
<|body_0|>
def test_b_quick_repair_red(self):
"""报修紧急故障的雷达"""
<|body_1|>
def test_c_cancle_repair(self):
"""取消报修"""
<|body_2|>
def test_d_view_radar_gre... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Test_StatusBox:
"""测试雷达报修面板"""
def test_a_quick_repair(self):
"""报修故障预警雷达"""
qr = MapsPage(self.driver)
qr.open()
qr.click_quick_repair_btn()
qr.input_equipNum(self.equipNum)
qr.input_equipReTime(self.reTime)
qr.input_faCode(self.faCode_orange)
... | the_stack_v2_python_sparse | test_zbsq/test_case/test_mapsPage.py | Nicole7102/ZBSQ | train | 1 |
0021b7b30eff4399d0674ee7f96ece172067dc06 | [
"self.analyzer = analyzer\nself.data = self.analyzer.data\nself.hashtags = self.analyzer.hashtags\nreturn",
"data = self.data\ntret = pd.Series(data=data['RTs'].values, index=data['Date'])\nplt.title('Retweets along time')\ntret.plot(figsize=(16, 4), label='Retweets', color='g', legend=True)\nreturn",
"data = s... | <|body_start_0|>
self.analyzer = analyzer
self.data = self.analyzer.data
self.hashtags = self.analyzer.hashtags
return
<|end_body_0|>
<|body_start_1|>
data = self.data
tret = pd.Series(data=data['RTs'].values, index=data['Date'])
plt.title('Retweets along time')
... | TweetsVisualizer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TweetsVisualizer:
def __init__(self, analyzer):
"""Constructor function using a TweetsExtractor object."""
<|body_0|>
def retweets(self):
"""Function to plot time series of retweets."""
<|body_1|>
def likes(self):
"""Function to plot time series ... | stack_v2_sparse_classes_36k_train_028235 | 4,029 | no_license | [
{
"docstring": "Constructor function using a TweetsExtractor object.",
"name": "__init__",
"signature": "def __init__(self, analyzer)"
},
{
"docstring": "Function to plot time series of retweets.",
"name": "retweets",
"signature": "def retweets(self)"
},
{
"docstring": "Function ... | 6 | stack_v2_sparse_classes_30k_train_021290 | Implement the Python class `TweetsVisualizer` described below.
Class description:
Implement the TweetsVisualizer class.
Method signatures and docstrings:
- def __init__(self, analyzer): Constructor function using a TweetsExtractor object.
- def retweets(self): Function to plot time series of retweets.
- def likes(sel... | Implement the Python class `TweetsVisualizer` described below.
Class description:
Implement the TweetsVisualizer class.
Method signatures and docstrings:
- def __init__(self, analyzer): Constructor function using a TweetsExtractor object.
- def retweets(self): Function to plot time series of retweets.
- def likes(sel... | 02b77652d0901e6e06cb9b1e7cb3e59c675445c2 | <|skeleton|>
class TweetsVisualizer:
def __init__(self, analyzer):
"""Constructor function using a TweetsExtractor object."""
<|body_0|>
def retweets(self):
"""Function to plot time series of retweets."""
<|body_1|>
def likes(self):
"""Function to plot time series ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TweetsVisualizer:
def __init__(self, analyzer):
"""Constructor function using a TweetsExtractor object."""
self.analyzer = analyzer
self.data = self.analyzer.data
self.hashtags = self.analyzer.hashtags
return
def retweets(self):
"""Function to plot time ser... | the_stack_v2_python_sparse | 47/RodolfoFerro/scripts/visualizer.py | pybites/challenges | train | 764 | |
8a1188f7aa049b3334a0dcc0faca23dea623fd67 | [
"super(BinaryDSVReader, self).__init__()\nself._line_reader = binary_line_reader\nself._delimiter = delimiter",
"for line in self._line_reader.readlines():\n fields = line.split(self._delimiter)\n fields[-1] = fields[-1].strip(self._line_reader.end_of_line)\n yield fields"
] | <|body_start_0|>
super(BinaryDSVReader, self).__init__()
self._line_reader = binary_line_reader
self._delimiter = delimiter
<|end_body_0|>
<|body_start_1|>
for line in self._line_reader.readlines():
fields = line.split(self._delimiter)
fields[-1] = fields[-1].str... | Basic reader for delimiter separated text files of unknown encoding. This is used for reading data from text files where the content is unknown, or possibly using a mixed encoding. | BinaryDSVReader | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BinaryDSVReader:
"""Basic reader for delimiter separated text files of unknown encoding. This is used for reading data from text files where the content is unknown, or possibly using a mixed encoding."""
def __init__(self, binary_line_reader, delimiter):
"""Initializes the delimited ... | stack_v2_sparse_classes_36k_train_028236 | 6,009 | permissive | [
{
"docstring": "Initializes the delimited separated values reader. Args: binary_line_reader (BinaryLineReader): a binary file reader delimiter (bytes): field delimiter.",
"name": "__init__",
"signature": "def __init__(self, binary_line_reader, delimiter)"
},
{
"docstring": "Iterates over delimit... | 2 | null | Implement the Python class `BinaryDSVReader` described below.
Class description:
Basic reader for delimiter separated text files of unknown encoding. This is used for reading data from text files where the content is unknown, or possibly using a mixed encoding.
Method signatures and docstrings:
- def __init__(self, b... | Implement the Python class `BinaryDSVReader` described below.
Class description:
Basic reader for delimiter separated text files of unknown encoding. This is used for reading data from text files where the content is unknown, or possibly using a mixed encoding.
Method signatures and docstrings:
- def __init__(self, b... | d6022f8cfebfddf2d08ab2d300a41b61f3349933 | <|skeleton|>
class BinaryDSVReader:
"""Basic reader for delimiter separated text files of unknown encoding. This is used for reading data from text files where the content is unknown, or possibly using a mixed encoding."""
def __init__(self, binary_line_reader, delimiter):
"""Initializes the delimited ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BinaryDSVReader:
"""Basic reader for delimiter separated text files of unknown encoding. This is used for reading data from text files where the content is unknown, or possibly using a mixed encoding."""
def __init__(self, binary_line_reader, delimiter):
"""Initializes the delimited separated val... | the_stack_v2_python_sparse | plaso/lib/line_reader_file.py | log2timeline/plaso | train | 1,506 |
87a10518b89829441f5fd2f371f775e973872853 | [
"super(RDropLoss, self).__init__()\nif reduction not in ['sum', 'mean', 'none', 'batchmean']:\n raise ValueError(\"'reduction' in 'RDropLoss' should be 'sum', 'mean' 'batchmean', or 'none', but received {}.\".format(reduction))\nself.reduction = reduction",
"p_loss = F.kl_div(F.log_softmax(p, axis=-1), F.softm... | <|body_start_0|>
super(RDropLoss, self).__init__()
if reduction not in ['sum', 'mean', 'none', 'batchmean']:
raise ValueError("'reduction' in 'RDropLoss' should be 'sum', 'mean' 'batchmean', or 'none', but received {}.".format(reduction))
self.reduction = reduction
<|end_body_0|>
<|... | R-Drop Loss implementation For more information about R-drop please refer to this paper: https://arxiv.org/abs/2106.14448 Original implementation please refer to this code: https://github.com/dropreg/R-Drop | RDropLoss | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RDropLoss:
"""R-Drop Loss implementation For more information about R-drop please refer to this paper: https://arxiv.org/abs/2106.14448 Original implementation please refer to this code: https://github.com/dropreg/R-Drop"""
def __init__(self, reduction='none'):
"""reduction(obj:`str`... | stack_v2_sparse_classes_36k_train_028237 | 2,888 | no_license | [
{
"docstring": "reduction(obj:`str`, optional): Indicate how to average the loss, the candicates are ``'none'`` | ``'batchmean'`` | ``'mean'`` | ``'sum'``. If `reduction` is ``'mean'``, the reduced mean loss is returned; If `reduction` is ``'batchmean'``, the sum loss divided by batch size is returned; if `redu... | 2 | stack_v2_sparse_classes_30k_train_021254 | Implement the Python class `RDropLoss` described below.
Class description:
R-Drop Loss implementation For more information about R-drop please refer to this paper: https://arxiv.org/abs/2106.14448 Original implementation please refer to this code: https://github.com/dropreg/R-Drop
Method signatures and docstrings:
- ... | Implement the Python class `RDropLoss` described below.
Class description:
R-Drop Loss implementation For more information about R-drop please refer to this paper: https://arxiv.org/abs/2106.14448 Original implementation please refer to this code: https://github.com/dropreg/R-Drop
Method signatures and docstrings:
- ... | af8aa66703915aa5be3e820f2016bf02bea1fa2e | <|skeleton|>
class RDropLoss:
"""R-Drop Loss implementation For more information about R-drop please refer to this paper: https://arxiv.org/abs/2106.14448 Original implementation please refer to this code: https://github.com/dropreg/R-Drop"""
def __init__(self, reduction='none'):
"""reduction(obj:`str`... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RDropLoss:
"""R-Drop Loss implementation For more information about R-drop please refer to this paper: https://arxiv.org/abs/2106.14448 Original implementation please refer to this code: https://github.com/dropreg/R-Drop"""
def __init__(self, reduction='none'):
"""reduction(obj:`str`, optional): ... | the_stack_v2_python_sparse | paddlenlp/losses/rdrop.py | kevinng77/blenderbot_paddle | train | 12 |
63fab33222607228f3677223b6f05a52dc22e224 | [
"data = super(JsonApiV10Parser, self).parse(stream, media_type=media_type, parser_context=parser_context)\nfields_extra = parser_context.get('fields_extra', {})\nas_relationship = parser_context.get('as_relationship')\nif as_relationship:\n rel_field_data = fields_extra[as_relationship]\n expected_type = rel_... | <|body_start_0|>
data = super(JsonApiV10Parser, self).parse(stream, media_type=media_type, parser_context=parser_context)
fields_extra = parser_context.get('fields_extra', {})
as_relationship = parser_context.get('as_relationship')
if as_relationship:
rel_field_data = fields_... | JSON API v1.0 parser. This is a partial implementation, focused on the current needs of the API. For the full spec, see http://jsonapi.org/format/1.0/ | JsonApiV10Parser | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JsonApiV10Parser:
"""JSON API v1.0 parser. This is a partial implementation, focused on the current needs of the API. For the full spec, see http://jsonapi.org/format/1.0/"""
def parse(self, stream, media_type=None, parser_context=None):
"""Parse JSON API representation into DRF nati... | stack_v2_sparse_classes_36k_train_028238 | 7,890 | no_license | [
{
"docstring": "Parse JSON API representation into DRF native format.",
"name": "parse",
"signature": "def parse(self, stream, media_type=None, parser_context=None)"
},
{
"docstring": "Convert a relationships object. Partially implements full spec at: http://jsonapi.org/format/1.0/#document-reso... | 4 | null | Implement the Python class `JsonApiV10Parser` described below.
Class description:
JSON API v1.0 parser. This is a partial implementation, focused on the current needs of the API. For the full spec, see http://jsonapi.org/format/1.0/
Method signatures and docstrings:
- def parse(self, stream, media_type=None, parser_c... | Implement the Python class `JsonApiV10Parser` described below.
Class description:
JSON API v1.0 parser. This is a partial implementation, focused on the current needs of the API. For the full spec, see http://jsonapi.org/format/1.0/
Method signatures and docstrings:
- def parse(self, stream, media_type=None, parser_c... | bc092964153b03381aaff74a4d80f43a2b2dec19 | <|skeleton|>
class JsonApiV10Parser:
"""JSON API v1.0 parser. This is a partial implementation, focused on the current needs of the API. For the full spec, see http://jsonapi.org/format/1.0/"""
def parse(self, stream, media_type=None, parser_context=None):
"""Parse JSON API representation into DRF nati... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class JsonApiV10Parser:
"""JSON API v1.0 parser. This is a partial implementation, focused on the current needs of the API. For the full spec, see http://jsonapi.org/format/1.0/"""
def parse(self, stream, media_type=None, parser_context=None):
"""Parse JSON API representation into DRF native format."""... | the_stack_v2_python_sparse | browsercompat/webplatformcompat/v2/parsers.py | WeilerWebServices/MDN-Web-Docs | train | 1 |
49919c2323266cadcc59c59e708a976a5f266ba7 | [
"flags.AddParentFlagsToParser(parser)\nparser.add_argument('--location', metavar='LOCATION', required=True, help='Location')\nparser.add_argument('--insight-type', metavar='INSIGHT_TYPE', required=False, help='Insight type to list insights for. Supported insight-types can be found here: https://cloud.google.com/rec... | <|body_start_0|>
flags.AddParentFlagsToParser(parser)
parser.add_argument('--location', metavar='LOCATION', required=True, help='Location')
parser.add_argument('--insight-type', metavar='INSIGHT_TYPE', required=False, help='Insight type to list insights for. Supported insight-types can be found ... | List insights for a cloud entity. This command lists all insights for a given cloud entity, location and insight type. Supported insight-types can be found here: https://cloud.google.com/recommender/docs/insights/insight-types. Currently the following cloud_entity_types are supported: project, billing_account, folder a... | List | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class List:
"""List insights for a cloud entity. This command lists all insights for a given cloud entity, location and insight type. Supported insight-types can be found here: https://cloud.google.com/recommender/docs/insights/insight-types. Currently the following cloud_entity_types are supported: pr... | stack_v2_sparse_classes_36k_train_028239 | 6,196 | permissive | [
{
"docstring": "Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command.",
"name": "Args",
"signature": "def Args(parser)"
},
{
"docstring": "Run 'gcloud recommender insight... | 2 | stack_v2_sparse_classes_30k_train_006856 | Implement the Python class `List` described below.
Class description:
List insights for a cloud entity. This command lists all insights for a given cloud entity, location and insight type. Supported insight-types can be found here: https://cloud.google.com/recommender/docs/insights/insight-types. Currently the followi... | Implement the Python class `List` described below.
Class description:
List insights for a cloud entity. This command lists all insights for a given cloud entity, location and insight type. Supported insight-types can be found here: https://cloud.google.com/recommender/docs/insights/insight-types. Currently the followi... | 392abf004b16203030e6efd2f0af24db7c8d669e | <|skeleton|>
class List:
"""List insights for a cloud entity. This command lists all insights for a given cloud entity, location and insight type. Supported insight-types can be found here: https://cloud.google.com/recommender/docs/insights/insight-types. Currently the following cloud_entity_types are supported: pr... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class List:
"""List insights for a cloud entity. This command lists all insights for a given cloud entity, location and insight type. Supported insight-types can be found here: https://cloud.google.com/recommender/docs/insights/insight-types. Currently the following cloud_entity_types are supported: project, billin... | the_stack_v2_python_sparse | lib/surface/recommender/insights/list.py | google-cloud-sdk-unofficial/google-cloud-sdk | train | 9 |
07bb56677c0d05ef476e9fd344774bcc54542634 | [
"if self.account_sid == '':\n self.error_message = 'VoiceVerify(RongLian) Error: account_sid is empty'\nelif self.auth_token == '':\n self.error_message = 'VoiceVerify(RongLian) Error: auth_token is empty'\nelif self.app_id == '':\n self.error_message = 'VoiceVerify(RongLian) Error: app_id is empty'\nelif ... | <|body_start_0|>
if self.account_sid == '':
self.error_message = 'VoiceVerify(RongLian) Error: account_sid is empty'
elif self.auth_token == '':
self.error_message = 'VoiceVerify(RongLian) Error: auth_token is empty'
elif self.app_id == '':
self.error_message ... | RonglianVoiceVerify | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RonglianVoiceVerify:
def __init__(self):
"""check voice-verify service parameters from config.py"""
<|body_0|>
def send_voice_verify(self, receiver, content):
"""Send voice_verify through RongLian_YunTongXun service Example: XXX.send_voice_verify_by_RongLian("1821751... | stack_v2_sparse_classes_36k_train_028240 | 22,148 | permissive | [
{
"docstring": "check voice-verify service parameters from config.py",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Send voice_verify through RongLian_YunTongXun service Example: XXX.send_voice_verify_by_RongLian(\"18217511111\", \"1849\") :type receiver: str|unicode ... | 3 | stack_v2_sparse_classes_30k_train_000878 | Implement the Python class `RonglianVoiceVerify` described below.
Class description:
Implement the RonglianVoiceVerify class.
Method signatures and docstrings:
- def __init__(self): check voice-verify service parameters from config.py
- def send_voice_verify(self, receiver, content): Send voice_verify through RongLia... | Implement the Python class `RonglianVoiceVerify` described below.
Class description:
Implement the RonglianVoiceVerify class.
Method signatures and docstrings:
- def __init__(self): check voice-verify service parameters from config.py
- def send_voice_verify(self, receiver, content): Send voice_verify through RongLia... | 945c4fd2755f5b0dea11e54eb649eeb37ec93d01 | <|skeleton|>
class RonglianVoiceVerify:
def __init__(self):
"""check voice-verify service parameters from config.py"""
<|body_0|>
def send_voice_verify(self, receiver, content):
"""Send voice_verify through RongLian_YunTongXun service Example: XXX.send_voice_verify_by_RongLian("1821751... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RonglianVoiceVerify:
def __init__(self):
"""check voice-verify service parameters from config.py"""
if self.account_sid == '':
self.error_message = 'VoiceVerify(RongLian) Error: account_sid is empty'
elif self.auth_token == '':
self.error_message = 'VoiceVerify(... | the_stack_v2_python_sparse | open-hackathon-server/src/hackathon/util.py | kaiyuanshe/open-hackathon | train | 46 | |
2e4b657ef99e4bdfb3e56316e8fa6f8d332ef05b | [
"model_class = type(model)\nserializer_class = SERIALIZERS[model_class]\nserializer = serializer_class(model, context={'request': self.request})\nmapped = serializer.data\nmapped['type'] = model_class.__name__.lower()\nreturn mapped",
"excludes = []\nif self.request.user is None:\n for model in watson.get_regi... | <|body_start_0|>
model_class = type(model)
serializer_class = SERIALIZERS[model_class]
serializer = serializer_class(model, context={'request': self.request})
mapped = serializer.data
mapped['type'] = model_class.__name__.lower()
return mapped
<|end_body_0|>
<|body_start... | Watson searcher; hides is_published=False if the user isn't logged in. | WatsonSearchViewSet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WatsonSearchViewSet:
"""Watson searcher; hides is_published=False if the user isn't logged in."""
def convert_result(self, model):
"""Convert a model into JSON, using the model's associated serializer located via api.components.SERIALIZERS."""
<|body_0|>
def build_exclud... | stack_v2_sparse_classes_36k_train_028241 | 2,732 | no_license | [
{
"docstring": "Convert a model into JSON, using the model's associated serializer located via api.components.SERIALIZERS.",
"name": "convert_result",
"signature": "def convert_result(self, model)"
},
{
"docstring": "Return a list of querysets that should not be matched by Watson. If the request... | 3 | null | Implement the Python class `WatsonSearchViewSet` described below.
Class description:
Watson searcher; hides is_published=False if the user isn't logged in.
Method signatures and docstrings:
- def convert_result(self, model): Convert a model into JSON, using the model's associated serializer located via api.components... | Implement the Python class `WatsonSearchViewSet` described below.
Class description:
Watson searcher; hides is_published=False if the user isn't logged in.
Method signatures and docstrings:
- def convert_result(self, model): Convert a model into JSON, using the model's associated serializer located via api.components... | 5ca3b26d7414c6a32626a6192345efd158f81128 | <|skeleton|>
class WatsonSearchViewSet:
"""Watson searcher; hides is_published=False if the user isn't logged in."""
def convert_result(self, model):
"""Convert a model into JSON, using the model's associated serializer located via api.components.SERIALIZERS."""
<|body_0|>
def build_exclud... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WatsonSearchViewSet:
"""Watson searcher; hides is_published=False if the user isn't logged in."""
def convert_result(self, model):
"""Convert a model into JSON, using the model's associated serializer located via api.components.SERIALIZERS."""
model_class = type(model)
serializer_... | the_stack_v2_python_sparse | api/search.py | u4i-admin2/IPA | train | 1 |
82b64c92f299b647228a4be7a95b8367992f8e36 | [
"super(UserConfiguredURLHandler, self).__init__(url_pattern)\nself._url_map = url_map\nself._secret_hash = login.fake_admin()",
"admin_only = self._url_map.login == appinfo.LOGIN_ADMIN\nrequires_login = self._url_map.login == appinfo.LOGIN_REQUIRED or admin_only\nauth_fail_action = self._url_map.auth_fail_action\... | <|body_start_0|>
super(UserConfiguredURLHandler, self).__init__(url_pattern)
self._url_map = url_map
self._secret_hash = login.fake_admin()
<|end_body_0|>
<|body_start_1|>
admin_only = self._url_map.login == appinfo.LOGIN_ADMIN
requires_login = self._url_map.login == appinfo.LOG... | Abstract base class for handlers configured by the user. This provides common functionality for handlers that need to obey authorization restrictions. | UserConfiguredURLHandler | [
"Apache-2.0",
"LGPL-2.1-or-later",
"BSD-3-Clause",
"MIT",
"GPL-2.0-or-later",
"MPL-1.1"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserConfiguredURLHandler:
"""Abstract base class for handlers configured by the user. This provides common functionality for handlers that need to obey authorization restrictions."""
def __init__(self, url_map, url_pattern):
"""Initializer for UserConfiguredURLHandler. Args: url_map:... | stack_v2_sparse_classes_36k_train_028242 | 6,283 | permissive | [
{
"docstring": "Initializer for UserConfiguredURLHandler. Args: url_map: An appinfo.URLMap instance containing the configuration for this handler. url_pattern: A re.RegexObject that matches URLs that should be handled by this handler. It may also optionally bind groups.",
"name": "__init__",
"signature"... | 2 | null | Implement the Python class `UserConfiguredURLHandler` described below.
Class description:
Abstract base class for handlers configured by the user. This provides common functionality for handlers that need to obey authorization restrictions.
Method signatures and docstrings:
- def __init__(self, url_map, url_pattern):... | Implement the Python class `UserConfiguredURLHandler` described below.
Class description:
Abstract base class for handlers configured by the user. This provides common functionality for handlers that need to obey authorization restrictions.
Method signatures and docstrings:
- def __init__(self, url_map, url_pattern):... | be17e5f658d7b42b5aa7eeb7a5ddd4962f3ea82f | <|skeleton|>
class UserConfiguredURLHandler:
"""Abstract base class for handlers configured by the user. This provides common functionality for handlers that need to obey authorization restrictions."""
def __init__(self, url_map, url_pattern):
"""Initializer for UserConfiguredURLHandler. Args: url_map:... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserConfiguredURLHandler:
"""Abstract base class for handlers configured by the user. This provides common functionality for handlers that need to obey authorization restrictions."""
def __init__(self, url_map, url_pattern):
"""Initializer for UserConfiguredURLHandler. Args: url_map: An appinfo.U... | the_stack_v2_python_sparse | AppServer/google/appengine/tools/devappserver2/url_handler.py | obino/appscale | train | 1 |
46f324c5e26717807963c5ebe1bd34e28eacbc0e | [
"deity = Deity.objects.all()\nserializer = DeitySerializer(deity, many=True)\nreturn Response(serializer.data)",
"queryset = Deity.objects.all()\ndeity = get_object_or_404(queryset, pk=pk)\nserializer = DeitySerializer(deity)\nreturn Response(serializer.data)"
] | <|body_start_0|>
deity = Deity.objects.all()
serializer = DeitySerializer(deity, many=True)
return Response(serializer.data)
<|end_body_0|>
<|body_start_1|>
queryset = Deity.objects.all()
deity = get_object_or_404(queryset, pk=pk)
serializer = DeitySerializer(deity)
... | DeityView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DeityView:
def list(self, request):
"""Получение списка божеств"""
<|body_0|>
def retrieve(self, request, pk=None):
"""Получение божеств по идентификатору pk - идентификатор божества"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
deity = Deity.obje... | stack_v2_sparse_classes_36k_train_028243 | 12,404 | no_license | [
{
"docstring": "Получение списка божеств",
"name": "list",
"signature": "def list(self, request)"
},
{
"docstring": "Получение божеств по идентификатору pk - идентификатор божества",
"name": "retrieve",
"signature": "def retrieve(self, request, pk=None)"
}
] | 2 | stack_v2_sparse_classes_30k_val_001118 | Implement the Python class `DeityView` described below.
Class description:
Implement the DeityView class.
Method signatures and docstrings:
- def list(self, request): Получение списка божеств
- def retrieve(self, request, pk=None): Получение божеств по идентификатору pk - идентификатор божества | Implement the Python class `DeityView` described below.
Class description:
Implement the DeityView class.
Method signatures and docstrings:
- def list(self, request): Получение списка божеств
- def retrieve(self, request, pk=None): Получение божеств по идентификатору pk - идентификатор божества
<|skeleton|>
class De... | be47a0a6f50bf8680b22e0b9cae3e3b34a198a3d | <|skeleton|>
class DeityView:
def list(self, request):
"""Получение списка божеств"""
<|body_0|>
def retrieve(self, request, pk=None):
"""Получение божеств по идентификатору pk - идентификатор божества"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DeityView:
def list(self, request):
"""Получение списка божеств"""
deity = Deity.objects.all()
serializer = DeitySerializer(deity, many=True)
return Response(serializer.data)
def retrieve(self, request, pk=None):
"""Получение божеств по идентификатору pk - идентифи... | the_stack_v2_python_sparse | StarfinderBack/starfinder/views.py | Skirgus/StarfinderMasterAssistant | train | 0 | |
bf9588ee2a4af4d9357a51e13ab14a30f1f6561b | [
"self.res = []\nself.dfs(root, [], target)\nreturn self.res",
"if not root:\n return\npath.append(root.val)\ntarget -= root.val\nif target == 0 and (not root.left) and (not root.right):\n self.res.append(path[:])\nself.dfs(root.left, path, target)\nself.dfs(root.right, path, target)\npath.pop()"
] | <|body_start_0|>
self.res = []
self.dfs(root, [], target)
return self.res
<|end_body_0|>
<|body_start_1|>
if not root:
return
path.append(root.val)
target -= root.val
if target == 0 and (not root.left) and (not root.right):
self.res.append... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def pathSum(self, root, target):
"""Args: root: TreeNode target: int Return: list[list[int]]"""
<|body_0|>
def dfs(self, root, path, target):
"""Args: root: TreeNode path: list[int] target: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_028244 | 902 | no_license | [
{
"docstring": "Args: root: TreeNode target: int Return: list[list[int]]",
"name": "pathSum",
"signature": "def pathSum(self, root, target)"
},
{
"docstring": "Args: root: TreeNode path: list[int] target: int",
"name": "dfs",
"signature": "def dfs(self, root, path, target)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000520 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def pathSum(self, root, target): Args: root: TreeNode target: int Return: list[list[int]]
- def dfs(self, root, path, target): Args: root: TreeNode path: list[int] target: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def pathSum(self, root, target): Args: root: TreeNode target: int Return: list[list[int]]
- def dfs(self, root, path, target): Args: root: TreeNode path: list[int] target: int
<... | 101bce2fac8b188a4eb2f5e017293d21ad0ecb21 | <|skeleton|>
class Solution:
def pathSum(self, root, target):
"""Args: root: TreeNode target: int Return: list[list[int]]"""
<|body_0|>
def dfs(self, root, path, target):
"""Args: root: TreeNode path: list[int] target: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def pathSum(self, root, target):
"""Args: root: TreeNode target: int Return: list[list[int]]"""
self.res = []
self.dfs(root, [], target)
return self.res
def dfs(self, root, path, target):
"""Args: root: TreeNode path: list[int] target: int"""
if n... | the_stack_v2_python_sparse | 剑指offer/剑指 Offer 34. 二叉树中和为某一值的路径.py | AiZhanghan/Leetcode | train | 0 | |
0c5872e2b24b017ebfe90d8f905bdf3c8b7d7824 | [
"left, right = (0, len(nums) - 1)\nwhile left <= right:\n mid = left + (right - left) // 2\n if nums[mid] < target:\n left = mid + 1\n elif nums[mid] > target:\n right = mid - 1\n else:\n return mid\nreturn -1",
"left, right = (0, len(nums))\nwhile left < right:\n mid = left + ... | <|body_start_0|>
left, right = (0, len(nums) - 1)
while left <= right:
mid = left + (right - left) // 2
if nums[mid] < target:
left = mid + 1
elif nums[mid] > target:
right = mid - 1
else:
return mid
... | 使用二分法,需要同时满足两个体条件: 1、有顺序 2、无重复 | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""使用二分法,需要同时满足两个体条件: 1、有顺序 2、无重复"""
def search(self, nums: List[int], target: int) -> int:
"""时间复杂度:O(log n) 空间复杂度:O(1) [左闭右闭区间]"""
<|body_0|>
def search_2(self, nums: List[int], target: int) -> int:
"""时间复杂度:O(log n) 空间复杂度:O(1) [左闭右开区间)"""
<|b... | stack_v2_sparse_classes_36k_train_028245 | 2,200 | no_license | [
{
"docstring": "时间复杂度:O(log n) 空间复杂度:O(1) [左闭右闭区间]",
"name": "search",
"signature": "def search(self, nums: List[int], target: int) -> int"
},
{
"docstring": "时间复杂度:O(log n) 空间复杂度:O(1) [左闭右开区间)",
"name": "search_2",
"signature": "def search_2(self, nums: List[int], target: int) -> int"
... | 2 | null | Implement the Python class `Solution` described below.
Class description:
使用二分法,需要同时满足两个体条件: 1、有顺序 2、无重复
Method signatures and docstrings:
- def search(self, nums: List[int], target: int) -> int: 时间复杂度:O(log n) 空间复杂度:O(1) [左闭右闭区间]
- def search_2(self, nums: List[int], target: int) -> int: 时间复杂度:O(log n) 空间复杂度:O(1) [左... | Implement the Python class `Solution` described below.
Class description:
使用二分法,需要同时满足两个体条件: 1、有顺序 2、无重复
Method signatures and docstrings:
- def search(self, nums: List[int], target: int) -> int: 时间复杂度:O(log n) 空间复杂度:O(1) [左闭右闭区间]
- def search_2(self, nums: List[int], target: int) -> int: 时间复杂度:O(log n) 空间复杂度:O(1) [左... | c92a5ddcc56e3f69be1e6fb25e9c8ed277e57ee0 | <|skeleton|>
class Solution:
"""使用二分法,需要同时满足两个体条件: 1、有顺序 2、无重复"""
def search(self, nums: List[int], target: int) -> int:
"""时间复杂度:O(log n) 空间复杂度:O(1) [左闭右闭区间]"""
<|body_0|>
def search_2(self, nums: List[int], target: int) -> int:
"""时间复杂度:O(log n) 空间复杂度:O(1) [左闭右开区间)"""
<|b... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
"""使用二分法,需要同时满足两个体条件: 1、有顺序 2、无重复"""
def search(self, nums: List[int], target: int) -> int:
"""时间复杂度:O(log n) 空间复杂度:O(1) [左闭右闭区间]"""
left, right = (0, len(nums) - 1)
while left <= right:
mid = left + (right - left) // 2
if nums[mid] < target:
... | the_stack_v2_python_sparse | code_thinking/arrays/704_binary_search.py | EachenKuang/LeetCode | train | 28 |
391e045a964387721236f350439cccaa039db3a6 | [
"user = request.user\npage_admin_user = getattr(request, 'page_admin_user', None)\nauthorized = page_admin_user or user\nchannel = request.data.get('channel_name', '')\nsocket_id = request.data.get('socket_id', '')\napi_version = request.version\ndata = {'v2': {'user_id': authorized.pk, 'user': v2_serializers.UserS... | <|body_start_0|>
user = request.user
page_admin_user = getattr(request, 'page_admin_user', None)
authorized = page_admin_user or user
channel = request.data.get('channel_name', '')
socket_id = request.data.get('socket_id', '')
api_version = request.version
data = ... | Shoutit Pusher API Resources. | ShoutitPusherViewSet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ShoutitPusherViewSet:
"""Shoutit Pusher API Resources."""
def auth(self, request):
"""Authorize channel subscriptions. ###Not used directly by API clients. ---"""
<|body_0|>
def webhook(self, request):
"""Receive webhooks from Pusher. ###Not used directly by API ... | stack_v2_sparse_classes_36k_train_028246 | 3,953 | no_license | [
{
"docstring": "Authorize channel subscriptions. ###Not used directly by API clients. ---",
"name": "auth",
"signature": "def auth(self, request)"
},
{
"docstring": "Receive webhooks from Pusher. ###Not used directly by API clients.",
"name": "webhook",
"signature": "def webhook(self, re... | 2 | null | Implement the Python class `ShoutitPusherViewSet` described below.
Class description:
Shoutit Pusher API Resources.
Method signatures and docstrings:
- def auth(self, request): Authorize channel subscriptions. ###Not used directly by API clients. ---
- def webhook(self, request): Receive webhooks from Pusher. ###Not ... | Implement the Python class `ShoutitPusherViewSet` described below.
Class description:
Shoutit Pusher API Resources.
Method signatures and docstrings:
- def auth(self, request): Authorize channel subscriptions. ###Not used directly by API clients. ---
- def webhook(self, request): Receive webhooks from Pusher. ###Not ... | f3c95585ac639b45c28521712ed33a178ab36ea4 | <|skeleton|>
class ShoutitPusherViewSet:
"""Shoutit Pusher API Resources."""
def auth(self, request):
"""Authorize channel subscriptions. ###Not used directly by API clients. ---"""
<|body_0|>
def webhook(self, request):
"""Receive webhooks from Pusher. ###Not used directly by API ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ShoutitPusherViewSet:
"""Shoutit Pusher API Resources."""
def auth(self, request):
"""Authorize channel subscriptions. ###Not used directly by API clients. ---"""
user = request.user
page_admin_user = getattr(request, 'page_admin_user', None)
authorized = page_admin_user o... | the_stack_v2_python_sparse | src/shoutit_pusher/views.py | shoutit/shoutit-api | train | 0 |
4c5a70f78faa277a1942ab4d8526689946622ff1 | [
"super(ClassifierHeadModel, self).__init__()\nself.mcb_model = mcb_model\nself.dropout = dropout\nself.n_classes = n_classes\nself.drop = nn.Dropout(p=self.dropout)\nself.cls = nn.Linear(self.mcb_model.output_dim, self.n_classes)",
"lm_feats, pooled_output = self.mcb_model(vis_feats, input_ids, token_type_ids, at... | <|body_start_0|>
super(ClassifierHeadModel, self).__init__()
self.mcb_model = mcb_model
self.dropout = dropout
self.n_classes = n_classes
self.drop = nn.Dropout(p=self.dropout)
self.cls = nn.Linear(self.mcb_model.output_dim, self.n_classes)
<|end_body_0|>
<|body_start_1|... | Class classifier head for MCB style models. | ClassifierHeadModel | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClassifierHeadModel:
"""Class classifier head for MCB style models."""
def __init__(self, mcb_model, dropout=0.2, n_classes=3000):
"""Initialize SkipGramDistNet."""
<|body_0|>
def forward(self, vis_feats, input_ids, token_type_ids=None, attention_mask=None, labels=None, ... | stack_v2_sparse_classes_36k_train_028247 | 1,323 | no_license | [
{
"docstring": "Initialize SkipGramDistNet.",
"name": "__init__",
"signature": "def __init__(self, mcb_model, dropout=0.2, n_classes=3000)"
},
{
"docstring": "Forward Pass.",
"name": "forward",
"signature": "def forward(self, vis_feats, input_ids, token_type_ids=None, attention_mask=None... | 2 | stack_v2_sparse_classes_30k_train_006252 | Implement the Python class `ClassifierHeadModel` described below.
Class description:
Class classifier head for MCB style models.
Method signatures and docstrings:
- def __init__(self, mcb_model, dropout=0.2, n_classes=3000): Initialize SkipGramDistNet.
- def forward(self, vis_feats, input_ids, token_type_ids=None, at... | Implement the Python class `ClassifierHeadModel` described below.
Class description:
Class classifier head for MCB style models.
Method signatures and docstrings:
- def __init__(self, mcb_model, dropout=0.2, n_classes=3000): Initialize SkipGramDistNet.
- def forward(self, vis_feats, input_ids, token_type_ids=None, at... | fbfa1766dbc52cbf39036abe1a44f9315fad4a5c | <|skeleton|>
class ClassifierHeadModel:
"""Class classifier head for MCB style models."""
def __init__(self, mcb_model, dropout=0.2, n_classes=3000):
"""Initialize SkipGramDistNet."""
<|body_0|>
def forward(self, vis_feats, input_ids, token_type_ids=None, attention_mask=None, labels=None, ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ClassifierHeadModel:
"""Class classifier head for MCB style models."""
def __init__(self, mcb_model, dropout=0.2, n_classes=3000):
"""Initialize SkipGramDistNet."""
super(ClassifierHeadModel, self).__init__()
self.mcb_model = mcb_model
self.dropout = dropout
self.n... | the_stack_v2_python_sparse | mcbert/models/classifier_head.py | estebandito22/MC-BERT | train | 0 |
deda5fdfe0f7e945770d858b8c4d175804d22e4f | [
"points = sio.loadmat('BAdino2.mat')\nnewPoints2D = points['newPoints2D']\nnewPoints2D = np.asarray(newPoints2D.tolist())\nself.points = newPoints2D[0, :, :, :]",
"y1 = self.points[i1, :, :].T\ny2 = self.points[i2, :, :].T\nis_correspondence_y1 = np.array([np.any(y1 != -1, axis=1)], dtype='bool')\nis_corresponden... | <|body_start_0|>
points = sio.loadmat('BAdino2.mat')
newPoints2D = points['newPoints2D']
newPoints2D = np.asarray(newPoints2D.tolist())
self.points = newPoints2D[0, :, :, :]
<|end_body_0|>
<|body_start_1|>
y1 = self.points[i1, :, :].T
y2 = self.points[i2, :, :].T
... | Correspondences | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Correspondences:
def __init__(self):
"""#load noisy self.points = np.loadtxt('imgdata/points.txt')"""
<|body_0|>
def getCorrByIndices(self, i1, i2):
"""#load noisy y1 = self.points[:,i1*2:(i1*2)+2] y2 = self.points[:,i2*2:(i2*2)+2]"""
<|body_1|>
<|end_skelet... | stack_v2_sparse_classes_36k_train_028248 | 1,103 | no_license | [
{
"docstring": "#load noisy self.points = np.loadtxt('imgdata/points.txt')",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "#load noisy y1 = self.points[:,i1*2:(i1*2)+2] y2 = self.points[:,i2*2:(i2*2)+2]",
"name": "getCorrByIndices",
"signature": "def getCorrByI... | 2 | stack_v2_sparse_classes_30k_train_000454 | Implement the Python class `Correspondences` described below.
Class description:
Implement the Correspondences class.
Method signatures and docstrings:
- def __init__(self): #load noisy self.points = np.loadtxt('imgdata/points.txt')
- def getCorrByIndices(self, i1, i2): #load noisy y1 = self.points[:,i1*2:(i1*2)+2] y... | Implement the Python class `Correspondences` described below.
Class description:
Implement the Correspondences class.
Method signatures and docstrings:
- def __init__(self): #load noisy self.points = np.loadtxt('imgdata/points.txt')
- def getCorrByIndices(self, i1, i2): #load noisy y1 = self.points[:,i1*2:(i1*2)+2] y... | 5b2ba7b329f90841ed964d58984b7de6af40994a | <|skeleton|>
class Correspondences:
def __init__(self):
"""#load noisy self.points = np.loadtxt('imgdata/points.txt')"""
<|body_0|>
def getCorrByIndices(self, i1, i2):
"""#load noisy y1 = self.points[:,i1*2:(i1*2)+2] y2 = self.points[:,i2*2:(i2*2)+2]"""
<|body_1|>
<|end_skelet... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Correspondences:
def __init__(self):
"""#load noisy self.points = np.loadtxt('imgdata/points.txt')"""
points = sio.loadmat('BAdino2.mat')
newPoints2D = points['newPoints2D']
newPoints2D = np.asarray(newPoints2D.tolist())
self.points = newPoints2D[0, :, :, :]
def ge... | the_stack_v2_python_sparse | correspondences.py | isakengstrom/tsbb15-3d-reconstruction-project | train | 0 | |
8ec0ddc8b8d32afd52b2070f01a27d7faf7db5f3 | [
"self.n = n\n' Index of the band for which to compute effective mass.\\n\\n Can also be a callable taking the extraction object on input and\\n returning a number.\\n '\nsuper(EffectiveMass, self).__init__(**kwargs)",
"from numpy import average\nout = super(EffectiveMass, self).run(indiv, outdir,... | <|body_start_0|>
self.n = n
' Index of the band for which to compute effective mass.\n\n Can also be a callable taking the extraction object on input and\n returning a number.\n '
super(EffectiveMass, self).__init__(**kwargs)
<|end_body_0|>
<|body_start_1|>
from numpy i... | Evaluates effective mass. | EffectiveMass | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EffectiveMass:
"""Evaluates effective mass."""
def __init__(self, n=0, **kwargs):
"""Computes effective mass for a given direction. For other keyword arguments, see `Bandgap`. :Parameters: n : int or callable Index of the band for which to compute effective mass. If callable, takes t... | stack_v2_sparse_classes_36k_train_028249 | 9,676 | no_license | [
{
"docstring": "Computes effective mass for a given direction. For other keyword arguments, see `Bandgap`. :Parameters: n : int or callable Index of the band for which to compute effective mass. If callable, takes the extraction object on input and should return a number.",
"name": "__init__",
"signatur... | 2 | null | Implement the Python class `EffectiveMass` described below.
Class description:
Evaluates effective mass.
Method signatures and docstrings:
- def __init__(self, n=0, **kwargs): Computes effective mass for a given direction. For other keyword arguments, see `Bandgap`. :Parameters: n : int or callable Index of the band ... | Implement the Python class `EffectiveMass` described below.
Class description:
Evaluates effective mass.
Method signatures and docstrings:
- def __init__(self, n=0, **kwargs): Computes effective mass for a given direction. For other keyword arguments, see `Bandgap`. :Parameters: n : int or callable Index of the band ... | 9c0ab667f94dc4629404a8ec99cbeaa323f0c8b3 | <|skeleton|>
class EffectiveMass:
"""Evaluates effective mass."""
def __init__(self, n=0, **kwargs):
"""Computes effective mass for a given direction. For other keyword arguments, see `Bandgap`. :Parameters: n : int or callable Index of the band for which to compute effective mass. If callable, takes t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EffectiveMass:
"""Evaluates effective mass."""
def __init__(self, n=0, **kwargs):
"""Computes effective mass for a given direction. For other keyword arguments, see `Bandgap`. :Parameters: n : int or callable Index of the band for which to compute effective mass. If callable, takes the extraction... | the_stack_v2_python_sparse | ga/escan/evaluator.py | Shibu778/LaDa | train | 0 |
a34cfcdef57043cc7f41ac54d209257b20f9284b | [
"if pos_label not in (0, 1):\n raise ValueError('only {0, 1} are accepted for `pos_label`')\ny_true = convert_binary_labels(y_true).ravel()\nscore = _check_binary_score(score, pos_label)\nv = CArray(-y_true * score).astype(float)\nif bound is None:\n v = (1.0 + v.exp()).log()\nelse:\n v[v < bound] = (1.0 +... | <|body_start_0|>
if pos_label not in (0, 1):
raise ValueError('only {0, 1} are accepted for `pos_label`')
y_true = convert_binary_labels(y_true).ravel()
score = _check_binary_score(score, pos_label)
v = CArray(-y_true * score).astype(float)
if bound is None:
... | Logistic loss function. Attributes ---------- class_type : 'log' suitable_for : 'classification' | CLossLogistic | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CLossLogistic:
"""Logistic loss function. Attributes ---------- class_type : 'log' suitable_for : 'classification'"""
def loss(self, y_true, score, pos_label=1, bound=10):
"""Computes the value of the logistic loss function. Parameters ---------- y_true : CArray Ground truth (correct... | stack_v2_sparse_classes_36k_train_028250 | 4,170 | permissive | [
{
"docstring": "Computes the value of the logistic loss function. Parameters ---------- y_true : CArray Ground truth (correct), targets. Vector-like array. score : CArray Outputs (predicted), targets. 2-D array of shape (n_samples, n_classes) or 1-D flat array of shape (n_samples,). If 1-D array, the probabilit... | 2 | stack_v2_sparse_classes_30k_train_004098 | Implement the Python class `CLossLogistic` described below.
Class description:
Logistic loss function. Attributes ---------- class_type : 'log' suitable_for : 'classification'
Method signatures and docstrings:
- def loss(self, y_true, score, pos_label=1, bound=10): Computes the value of the logistic loss function. Pa... | Implement the Python class `CLossLogistic` described below.
Class description:
Logistic loss function. Attributes ---------- class_type : 'log' suitable_for : 'classification'
Method signatures and docstrings:
- def loss(self, y_true, score, pos_label=1, bound=10): Computes the value of the logistic loss function. Pa... | 431373e65d8cfe2cb7cf042ce1a6c9519ea5a14a | <|skeleton|>
class CLossLogistic:
"""Logistic loss function. Attributes ---------- class_type : 'log' suitable_for : 'classification'"""
def loss(self, y_true, score, pos_label=1, bound=10):
"""Computes the value of the logistic loss function. Parameters ---------- y_true : CArray Ground truth (correct... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CLossLogistic:
"""Logistic loss function. Attributes ---------- class_type : 'log' suitable_for : 'classification'"""
def loss(self, y_true, score, pos_label=1, bound=10):
"""Computes the value of the logistic loss function. Parameters ---------- y_true : CArray Ground truth (correct), targets. V... | the_stack_v2_python_sparse | src/secml/ml/classifiers/loss/c_loss_logistic.py | Cinofix/secml | train | 0 |
52c5e2c4087f40244dd3beac172b3d00beee0244 | [
"self.queue = deque([])\ncount = Counter(nums)\nself.judge = {}\nfor num in nums:\n self.queue.append(num)\n if count[num] == 1:\n self.judge[num] = True\n else:\n self.judge[num] = False",
"while self.queue and (not self.judge[self.queue[0]]):\n self.queue.popleft()\nif self.queue:\n ... | <|body_start_0|>
self.queue = deque([])
count = Counter(nums)
self.judge = {}
for num in nums:
self.queue.append(num)
if count[num] == 1:
self.judge[num] = True
else:
self.judge[num] = False
<|end_body_0|>
<|body_start_... | FirstUnique | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FirstUnique:
def __init__(self, nums: List[int]):
"""count = Counter(nums) self.unique = {} self.other = {} for item in nums: if count[item]==1: self.unique[item] = True else: if item not in self.other: self.other[item] = True"""
<|body_0|>
def showFirstUnique(self) -> int:
... | stack_v2_sparse_classes_36k_train_028251 | 1,725 | no_license | [
{
"docstring": "count = Counter(nums) self.unique = {} self.other = {} for item in nums: if count[item]==1: self.unique[item] = True else: if item not in self.other: self.other[item] = True",
"name": "__init__",
"signature": "def __init__(self, nums: List[int])"
},
{
"docstring": "if not self.un... | 3 | stack_v2_sparse_classes_30k_train_002871 | Implement the Python class `FirstUnique` described below.
Class description:
Implement the FirstUnique class.
Method signatures and docstrings:
- def __init__(self, nums: List[int]): count = Counter(nums) self.unique = {} self.other = {} for item in nums: if count[item]==1: self.unique[item] = True else: if item not ... | Implement the Python class `FirstUnique` described below.
Class description:
Implement the FirstUnique class.
Method signatures and docstrings:
- def __init__(self, nums: List[int]): count = Counter(nums) self.unique = {} self.other = {} for item in nums: if count[item]==1: self.unique[item] = True else: if item not ... | 90fd00246707b23d60a5d13b5a89d5b5f64ad008 | <|skeleton|>
class FirstUnique:
def __init__(self, nums: List[int]):
"""count = Counter(nums) self.unique = {} self.other = {} for item in nums: if count[item]==1: self.unique[item] = True else: if item not in self.other: self.other[item] = True"""
<|body_0|>
def showFirstUnique(self) -> int:
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FirstUnique:
def __init__(self, nums: List[int]):
"""count = Counter(nums) self.unique = {} self.other = {} for item in nums: if count[item]==1: self.unique[item] = True else: if item not in self.other: self.other[item] = True"""
self.queue = deque([])
count = Counter(nums)
sel... | the_stack_v2_python_sparse | python_solution/1429.py | Dongzi-dq394/leetcode | train | 0 | |
1c408ca2ce27c6ba728529bdc5f2cac8f776d6c5 | [
"ll = LinkedList()\nfor i in range(10):\n ll.push_to_tail(i)\ns = Solution()\nresult = s.reverse_range(ll.head, 2, 4)\nself.assertEqual(ll.to_array(), [0, 3, 2, 1, 4, 5, 6, 7, 8, 9])",
"ll = LinkedList()\nfor i in range(10):\n ll.push_to_tail(i)\ns = Solution2()\nresult = s.reverse_range(ll.head, 2, 4)\nsel... | <|body_start_0|>
ll = LinkedList()
for i in range(10):
ll.push_to_tail(i)
s = Solution()
result = s.reverse_range(ll.head, 2, 4)
self.assertEqual(ll.to_array(), [0, 3, 2, 1, 4, 5, 6, 7, 8, 9])
<|end_body_0|>
<|body_start_1|>
ll = LinkedList()
for i in... | TestSolution1 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestSolution1:
def test_simple(self):
"""Testing Recursive Solution"""
<|body_0|>
def test_simple2(self):
"""Testing Iteraive solution"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
ll = LinkedList()
for i in range(10):
ll.push_... | stack_v2_sparse_classes_36k_train_028252 | 3,067 | no_license | [
{
"docstring": "Testing Recursive Solution",
"name": "test_simple",
"signature": "def test_simple(self)"
},
{
"docstring": "Testing Iteraive solution",
"name": "test_simple2",
"signature": "def test_simple2(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_009917 | Implement the Python class `TestSolution1` described below.
Class description:
Implement the TestSolution1 class.
Method signatures and docstrings:
- def test_simple(self): Testing Recursive Solution
- def test_simple2(self): Testing Iteraive solution | Implement the Python class `TestSolution1` described below.
Class description:
Implement the TestSolution1 class.
Method signatures and docstrings:
- def test_simple(self): Testing Recursive Solution
- def test_simple2(self): Testing Iteraive solution
<|skeleton|>
class TestSolution1:
def test_simple(self):
... | 4619a23386bb62041a134afc782ff56918dd7b47 | <|skeleton|>
class TestSolution1:
def test_simple(self):
"""Testing Recursive Solution"""
<|body_0|>
def test_simple2(self):
"""Testing Iteraive solution"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestSolution1:
def test_simple(self):
"""Testing Recursive Solution"""
ll = LinkedList()
for i in range(10):
ll.push_to_tail(i)
s = Solution()
result = s.reverse_range(ll.head, 2, 4)
self.assertEqual(ll.to_array(), [0, 3, 2, 1, 4, 5, 6, 7, 8, 9])
... | the_stack_v2_python_sparse | 0092_reverse_linked_list_2.py | Kcheung42/Leet_Code | train | 0 | |
a2c14a26ab3b9fc14ddd689a20946e0c76618dc2 | [
"data = request.data\nuser = request.user\ntry:\n is_default = bool(data['is_default'])\n with transaction.atomic():\n if is_default is True:\n UserPickupAddr.objects.filter(user=user, is_default=True).update(is_default=False)\n UserPickupAddr(user=user, pickup_addr_id=address_id, is_... | <|body_start_0|>
data = request.data
user = request.user
try:
is_default = bool(data['is_default'])
with transaction.atomic():
if is_default is True:
UserPickupAddr.objects.filter(user=user, is_default=True).update(is_default=False)
... | PickupAddressView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PickupAddressView:
def post(self, request, address_id, format=None):
"""用户增加提货点 :param request: :param address_id:提货点id :param format: :return: SUCCESS_CODE:'成功’;SYSTEM_ERR_CODE:系统错误."""
<|body_0|>
def delete(self, request, address_id, format=None):
"""用户删除提货点 :param... | stack_v2_sparse_classes_36k_train_028253 | 11,545 | no_license | [
{
"docstring": "用户增加提货点 :param request: :param address_id:提货点id :param format: :return: SUCCESS_CODE:'成功’;SYSTEM_ERR_CODE:系统错误.",
"name": "post",
"signature": "def post(self, request, address_id, format=None)"
},
{
"docstring": "用户删除提货点 :param request: :param address_id:提货点id :param format: :ret... | 2 | null | Implement the Python class `PickupAddressView` described below.
Class description:
Implement the PickupAddressView class.
Method signatures and docstrings:
- def post(self, request, address_id, format=None): 用户增加提货点 :param request: :param address_id:提货点id :param format: :return: SUCCESS_CODE:'成功’;SYSTEM_ERR_CODE:系统错误... | Implement the Python class `PickupAddressView` described below.
Class description:
Implement the PickupAddressView class.
Method signatures and docstrings:
- def post(self, request, address_id, format=None): 用户增加提货点 :param request: :param address_id:提货点id :param format: :return: SUCCESS_CODE:'成功’;SYSTEM_ERR_CODE:系统错误... | 3d6198c2a1abc97fa9286408f52c1f5153883b7a | <|skeleton|>
class PickupAddressView:
def post(self, request, address_id, format=None):
"""用户增加提货点 :param request: :param address_id:提货点id :param format: :return: SUCCESS_CODE:'成功’;SYSTEM_ERR_CODE:系统错误."""
<|body_0|>
def delete(self, request, address_id, format=None):
"""用户删除提货点 :param... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PickupAddressView:
def post(self, request, address_id, format=None):
"""用户增加提货点 :param request: :param address_id:提货点id :param format: :return: SUCCESS_CODE:'成功’;SYSTEM_ERR_CODE:系统错误."""
data = request.data
user = request.user
try:
is_default = bool(data['is_default... | the_stack_v2_python_sparse | stars/apps/api/address/views.py | lisongwei15931/stars | train | 0 | |
7af276845954eb3385c3da846e6fbddae84b477d | [
"if 'pulsar_app' in kwds or 'job_manager' in kwds:\n self.job_manager_interface_class = LocalPulsarInterface\n pulsar_app = kwds.get('pulsar_app', None)\n job_manager = kwds.get('job_manager', None)\n file_cache = kwds.get('file_cache', None)\n self.job_manager_interface_args = dict(job_manager=job_m... | <|body_start_0|>
if 'pulsar_app' in kwds or 'job_manager' in kwds:
self.job_manager_interface_class = LocalPulsarInterface
pulsar_app = kwds.get('pulsar_app', None)
job_manager = kwds.get('job_manager', None)
file_cache = kwds.get('file_cache', None)
s... | Factory class to create Pulsar clients. This class was introduced for classes of clients that need to potential share state between multiple client connections. | ClientManager | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClientManager:
"""Factory class to create Pulsar clients. This class was introduced for classes of clients that need to potential share state between multiple client connections."""
def __init__(self, **kwds: Dict[str, Any]):
"""Build a HTTP client or a local client that talks direct... | stack_v2_sparse_classes_36k_train_028254 | 14,150 | permissive | [
{
"docstring": "Build a HTTP client or a local client that talks directly to a job manger.",
"name": "__init__",
"signature": "def __init__(self, **kwds: Dict[str, Any])"
},
{
"docstring": "Build a client given specific destination parameters and job_id.",
"name": "get_client",
"signatur... | 2 | stack_v2_sparse_classes_30k_train_012943 | Implement the Python class `ClientManager` described below.
Class description:
Factory class to create Pulsar clients. This class was introduced for classes of clients that need to potential share state between multiple client connections.
Method signatures and docstrings:
- def __init__(self, **kwds: Dict[str, Any])... | Implement the Python class `ClientManager` described below.
Class description:
Factory class to create Pulsar clients. This class was introduced for classes of clients that need to potential share state between multiple client connections.
Method signatures and docstrings:
- def __init__(self, **kwds: Dict[str, Any])... | 9b86949aebc17a86318c582e8d8a969d076cb83d | <|skeleton|>
class ClientManager:
"""Factory class to create Pulsar clients. This class was introduced for classes of clients that need to potential share state between multiple client connections."""
def __init__(self, **kwds: Dict[str, Any]):
"""Build a HTTP client or a local client that talks direct... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ClientManager:
"""Factory class to create Pulsar clients. This class was introduced for classes of clients that need to potential share state between multiple client connections."""
def __init__(self, **kwds: Dict[str, Any]):
"""Build a HTTP client or a local client that talks directly to a job m... | the_stack_v2_python_sparse | pulsar/client/manager.py | galaxyproject/pulsar | train | 35 |
f73e6f2de88634e45a4411e0a375430bc0ec99b6 | [
"t = 0\nwhile Y > X:\n if Y % 2 == 0:\n Y //= 2\n else:\n Y += 1\n t += 1\nreturn t + X - Y",
"q = [X]\nt = 0\nhas_larger = False\nwhile q:\n cur_q = []\n for e in q:\n if e == Y:\n return t\n cur = e * 2\n if cur >= 1:\n if cur > Y and (not ... | <|body_start_0|>
t = 0
while Y > X:
if Y % 2 == 0:
Y //= 2
else:
Y += 1
t += 1
return t + X - Y
<|end_body_0|>
<|body_start_1|>
q = [X]
t = 0
has_larger = False
while q:
cur_q = []
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def brokenCalc(self, X: int, Y: int) -> int:
"""004_greedy + work backward If Y is odd, we can do only Y = Y + 1 If Y is even, if we plus 1 to Y, then Y is odd, we need to plus another 1. And because (Y + 1 + 1) / 2 = (Y / 2) + 1, 3 operations are more than 2. We always choose ... | stack_v2_sparse_classes_36k_train_028255 | 2,145 | no_license | [
{
"docstring": "004_greedy + work backward If Y is odd, we can do only Y = Y + 1 If Y is even, if we plus 1 to Y, then Y is odd, we need to plus another 1. And because (Y + 1 + 1) / 2 = (Y / 2) + 1, 3 operations are more than 2. We always choose Y / 2 if Y is even.",
"name": "brokenCalc",
"signature": "... | 2 | stack_v2_sparse_classes_30k_val_000432 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def brokenCalc(self, X: int, Y: int) -> int: 004_greedy + work backward If Y is odd, we can do only Y = Y + 1 If Y is even, if we plus 1 to Y, then Y is odd, we need to plus anot... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def brokenCalc(self, X: int, Y: int) -> int: 004_greedy + work backward If Y is odd, we can do only Y = Y + 1 If Y is even, if we plus 1 to Y, then Y is odd, we need to plus anot... | 929dde1723fb2f54870c8a9badc80fc23e8400d3 | <|skeleton|>
class Solution:
def brokenCalc(self, X: int, Y: int) -> int:
"""004_greedy + work backward If Y is odd, we can do only Y = Y + 1 If Y is even, if we plus 1 to Y, then Y is odd, we need to plus another 1. And because (Y + 1 + 1) / 2 = (Y / 2) + 1, 3 operations are more than 2. We always choose ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def brokenCalc(self, X: int, Y: int) -> int:
"""004_greedy + work backward If Y is odd, we can do only Y = Y + 1 If Y is even, if we plus 1 to Y, then Y is odd, we need to plus another 1. And because (Y + 1 + 1) / 2 = (Y / 2) + 1, 3 operations are more than 2. We always choose Y / 2 if Y is ... | the_stack_v2_python_sparse | _algorithms_challenges/leetcode/LeetCode/991 Broken Calculator.py | syurskyi/Algorithms_and_Data_Structure | train | 4 | |
c00fe289eb2b02751a4404bf79361e1a4a5837bc | [
"try:\n sport = self.kwargs['sport']\nexcept KeyError:\n sport = 'nba'\nsite_sport_manager = sports.classes.SiteSportManager()\nreturn site_sport_manager.get_player_serializer_class(sport)",
"sport = self.kwargs['sport']\nsite_sport_manager = sports.classes.SiteSportManager()\nsite_sport = site_sport_manage... | <|body_start_0|>
try:
sport = self.kwargs['sport']
except KeyError:
sport = 'nba'
site_sport_manager = sports.classes.SiteSportManager()
return site_sport_manager.get_player_serializer_class(sport)
<|end_body_0|>
<|body_start_1|>
sport = self.kwargs['spor... | Get the players in the league, with more detailed information | LeaguePlayerAPIView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LeaguePlayerAPIView:
"""Get the players in the league, with more detailed information"""
def get_serializer_class(self):
"""use site sport manager to get the site_sport from the sport param"""
<|body_0|>
def get_queryset(self):
"""Return a QuerySet of the sports.... | stack_v2_sparse_classes_36k_train_028256 | 26,966 | no_license | [
{
"docstring": "use site sport manager to get the site_sport from the sport param",
"name": "get_serializer_class",
"signature": "def get_serializer_class(self)"
},
{
"docstring": "Return a QuerySet of the sports.<sport>.models.Team objects",
"name": "get_queryset",
"signature": "def get... | 2 | null | Implement the Python class `LeaguePlayerAPIView` described below.
Class description:
Get the players in the league, with more detailed information
Method signatures and docstrings:
- def get_serializer_class(self): use site sport manager to get the site_sport from the sport param
- def get_queryset(self): Return a Qu... | Implement the Python class `LeaguePlayerAPIView` described below.
Class description:
Get the players in the league, with more detailed information
Method signatures and docstrings:
- def get_serializer_class(self): use site sport manager to get the site_sport from the sport param
- def get_queryset(self): Return a Qu... | 4796fa9d88b56f80def011e2b043ce595bfce8c4 | <|skeleton|>
class LeaguePlayerAPIView:
"""Get the players in the league, with more detailed information"""
def get_serializer_class(self):
"""use site sport manager to get the site_sport from the sport param"""
<|body_0|>
def get_queryset(self):
"""Return a QuerySet of the sports.... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LeaguePlayerAPIView:
"""Get the players in the league, with more detailed information"""
def get_serializer_class(self):
"""use site sport manager to get the site_sport from the sport param"""
try:
sport = self.kwargs['sport']
except KeyError:
sport = 'nba'... | the_stack_v2_python_sparse | sports/views.py | nakamotohideyoshi/draftboard-web | train | 0 |
799bd8d1d7f9f9d94d16221f18b558c6dc28abaf | [
"today = timezone.now().date()\nqs = self.filter(end_date__gte=today, contract__payment__isnull=False, contract__pending_payment=False)\nreturn qs",
"late_limit = timezone.now() - timedelta(days=settings.LATE_PAYMENT)\nqs = self.annotate(payment_count=models.Count('contract__payment'))\nqs = qs.filter(models.Q(pa... | <|body_start_0|>
today = timezone.now().date()
qs = self.filter(end_date__gte=today, contract__payment__isnull=False, contract__pending_payment=False)
return qs
<|end_body_0|>
<|body_start_1|>
late_limit = timezone.now() - timedelta(days=settings.LATE_PAYMENT)
qs = self.annotate... | KlassManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KlassManager:
def active(self):
"""Filter klasses currently running from up to date contracts. Up to date contracts are the ones with one or more payments but not pending."""
<|body_0|>
def late_payment(self):
"""Lists classes unaccessible by tearcher and students. L... | stack_v2_sparse_classes_36k_train_028257 | 12,505 | no_license | [
{
"docstring": "Filter klasses currently running from up to date contracts. Up to date contracts are the ones with one or more payments but not pending.",
"name": "active",
"signature": "def active(self)"
},
{
"docstring": "Lists classes unaccessible by tearcher and students. Lists classes with ... | 2 | stack_v2_sparse_classes_30k_val_000390 | Implement the Python class `KlassManager` described below.
Class description:
Implement the KlassManager class.
Method signatures and docstrings:
- def active(self): Filter klasses currently running from up to date contracts. Up to date contracts are the ones with one or more payments but not pending.
- def late_paym... | Implement the Python class `KlassManager` described below.
Class description:
Implement the KlassManager class.
Method signatures and docstrings:
- def active(self): Filter klasses currently running from up to date contracts. Up to date contracts are the ones with one or more payments but not pending.
- def late_paym... | e2d24a82462a735fc722f0b228be04a4495185c1 | <|skeleton|>
class KlassManager:
def active(self):
"""Filter klasses currently running from up to date contracts. Up to date contracts are the ones with one or more payments but not pending."""
<|body_0|>
def late_payment(self):
"""Lists classes unaccessible by tearcher and students. L... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class KlassManager:
def active(self):
"""Filter klasses currently running from up to date contracts. Up to date contracts are the ones with one or more payments but not pending."""
today = timezone.now().date()
qs = self.filter(end_date__gte=today, contract__payment__isnull=False, contract__... | the_stack_v2_python_sparse | clients/models.py | fredericosachweh/amostra2 | train | 0 | |
081caee2d7425799f53590fdd7fc6c64c37aff29 | [
"self.problem = problem\nself.agents = agents\nself.max_value = max_value\nself.path_set = PathSet(self.agents, self.problem.heuristic)\nself.cats = []\nif cat is not None:\n self.cats.append(cat)\nself.cats.append(self.path_set.cat)\nself.stat_tracker = stat_tracker",
"agents = copy(self.agents)\ngroups = []\... | <|body_start_0|>
self.problem = problem
self.agents = agents
self.max_value = max_value
self.path_set = PathSet(self.agents, self.problem.heuristic)
self.cats = []
if cat is not None:
self.cats.append(cat)
self.cats.append(self.path_set.cat)
se... | Solver that uses Independence Detection: First solve for all agents individually. If paths are conflicting, merge the agents and solve for the new group | IDSolver | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IDSolver:
"""Solver that uses Independence Detection: First solve for all agents individually. If paths are conflicting, merge the agents and solve for the new group"""
def __init__(self, problem: MAPFProblem, agents: List[Agent], cat: Optional[CAT], stat_tracker, max_value=float('inf')):
... | stack_v2_sparse_classes_36k_train_028258 | 4,961 | permissive | [
{
"docstring": "Constructs an IDSolver instance :param problem: MAPF problem instance that needs to be solved :param agents: Agents that belong to the problem :param cat: Additional Collision Avoidance Table that should be used in calculating the result :param stat_tracker Statistic tracker :param max_value: Ma... | 3 | stack_v2_sparse_classes_30k_val_000942 | Implement the Python class `IDSolver` described below.
Class description:
Solver that uses Independence Detection: First solve for all agents individually. If paths are conflicting, merge the agents and solve for the new group
Method signatures and docstrings:
- def __init__(self, problem: MAPFProblem, agents: List[A... | Implement the Python class `IDSolver` described below.
Class description:
Solver that uses Independence Detection: First solve for all agents individually. If paths are conflicting, merge the agents and solve for the new group
Method signatures and docstrings:
- def __init__(self, problem: MAPFProblem, agents: List[A... | 13d8716f932bb98398fe8e190e668ee65bcf0f34 | <|skeleton|>
class IDSolver:
"""Solver that uses Independence Detection: First solve for all agents individually. If paths are conflicting, merge the agents and solve for the new group"""
def __init__(self, problem: MAPFProblem, agents: List[Agent], cat: Optional[CAT], stat_tracker, max_value=float('inf')):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IDSolver:
"""Solver that uses Independence Detection: First solve for all agents individually. If paths are conflicting, merge the agents and solve for the new group"""
def __init__(self, problem: MAPFProblem, agents: List[Agent], cat: Optional[CAT], stat_tracker, max_value=float('inf')):
"""Cons... | the_stack_v2_python_sparse | src/solver/epeastar/independence_detection.py | tbvanderwoude/matching-epea-star | train | 0 |
88d97b5e06aa620503689cd5c1db0939e3ed04a2 | [
"clone = self._clone()\nclone.query.add_custom_query(custom_query)\nreturn clone",
"clone = self._clone()\nclone.query.add_nested(terms, path, field)\nreturn clone"
] | <|body_start_0|>
clone = self._clone()
clone.query.add_custom_query(custom_query)
return clone
<|end_body_0|>
<|body_start_1|>
clone = self._clone()
clone.query.add_nested(terms, path, field)
return clone
<|end_body_1|>
| ConfigurableSearchQuerySet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConfigurableSearchQuerySet:
def custom_query(self, custom_query=None):
"""Adds a custom query"""
<|body_0|>
def nested(self, terms=None, path='tags', field='tag'):
"""Adds arguments for nested to the query"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_028259 | 7,620 | no_license | [
{
"docstring": "Adds a custom query",
"name": "custom_query",
"signature": "def custom_query(self, custom_query=None)"
},
{
"docstring": "Adds arguments for nested to the query",
"name": "nested",
"signature": "def nested(self, terms=None, path='tags', field='tag')"
}
] | 2 | stack_v2_sparse_classes_30k_train_011820 | Implement the Python class `ConfigurableSearchQuerySet` described below.
Class description:
Implement the ConfigurableSearchQuerySet class.
Method signatures and docstrings:
- def custom_query(self, custom_query=None): Adds a custom query
- def nested(self, terms=None, path='tags', field='tag'): Adds arguments for ne... | Implement the Python class `ConfigurableSearchQuerySet` described below.
Class description:
Implement the ConfigurableSearchQuerySet class.
Method signatures and docstrings:
- def custom_query(self, custom_query=None): Adds a custom query
- def nested(self, terms=None, path='tags', field='tag'): Adds arguments for ne... | af2b5f16f5f8853fbb772b1a3cf70cac03a06ea6 | <|skeleton|>
class ConfigurableSearchQuerySet:
def custom_query(self, custom_query=None):
"""Adds a custom query"""
<|body_0|>
def nested(self, terms=None, path='tags', field='tag'):
"""Adds arguments for nested to the query"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ConfigurableSearchQuerySet:
def custom_query(self, custom_query=None):
"""Adds a custom query"""
clone = self._clone()
clone.query.add_custom_query(custom_query)
return clone
def nested(self, terms=None, path='tags', field='tag'):
"""Adds arguments for nested to th... | the_stack_v2_python_sparse | shoutourbiz/main/custom_elasticsearch.py | superdev0505/Django_Influencer_marketing | train | 0 | |
49d717a463fe1aa2aba56a457a609fd5ef28eaef | [
"question = 'What language did you first learn to speak?'\nmy_survey = AnonymousSurvey(question)\nmy_survey.store_response('English')\nself.assertIn('English', my_survey.responses)",
"question = 'What language did you first learn to speak?'\nmy_survey = AnonymousSurvey(question)\nresponses = ['English', 'German',... | <|body_start_0|>
question = 'What language did you first learn to speak?'
my_survey = AnonymousSurvey(question)
my_survey.store_response('English')
self.assertIn('English', my_survey.responses)
<|end_body_0|>
<|body_start_1|>
question = 'What language did you first learn to spea... | Test for class AnonymousSurvey. | TestAnonymousSurvey | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestAnonymousSurvey:
"""Test for class AnonymousSurvey."""
def test_store_single_response(self):
"""Test that a single response is stored."""
<|body_0|>
def test_store_three_responses(self):
"""Test that 3 individual responses are stored properly."""
<|bo... | stack_v2_sparse_classes_36k_train_028260 | 912 | no_license | [
{
"docstring": "Test that a single response is stored.",
"name": "test_store_single_response",
"signature": "def test_store_single_response(self)"
},
{
"docstring": "Test that 3 individual responses are stored properly.",
"name": "test_store_three_responses",
"signature": "def test_store... | 2 | stack_v2_sparse_classes_30k_train_020209 | Implement the Python class `TestAnonymousSurvey` described below.
Class description:
Test for class AnonymousSurvey.
Method signatures and docstrings:
- def test_store_single_response(self): Test that a single response is stored.
- def test_store_three_responses(self): Test that 3 individual responses are stored prop... | Implement the Python class `TestAnonymousSurvey` described below.
Class description:
Test for class AnonymousSurvey.
Method signatures and docstrings:
- def test_store_single_response(self): Test that a single response is stored.
- def test_store_three_responses(self): Test that 3 individual responses are stored prop... | 0cacfab443d3eeeb274836b7be4b7205585f7758 | <|skeleton|>
class TestAnonymousSurvey:
"""Test for class AnonymousSurvey."""
def test_store_single_response(self):
"""Test that a single response is stored."""
<|body_0|>
def test_store_three_responses(self):
"""Test that 3 individual responses are stored properly."""
<|bo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestAnonymousSurvey:
"""Test for class AnonymousSurvey."""
def test_store_single_response(self):
"""Test that a single response is stored."""
question = 'What language did you first learn to speak?'
my_survey = AnonymousSurvey(question)
my_survey.store_response('English')
... | the_stack_v2_python_sparse | Code Testing/test_survey.py | Ebyy/python_projects | train | 0 |
5a42022912e928b317a6e250a5544de75f5eeab8 | [
"res = []\nsList = list(s)\n\ndef backtrack(x):\n if x == len(sList) - 1:\n res.append(''.join(sList))\n return\n temp_set = set()\n for i in range(x, len(sList)):\n if sList[i] in temp_set:\n continue\n temp_set.add(sList[i])\n sList[i], sList[x] = (sList[x], ... | <|body_start_0|>
res = []
sList = list(s)
def backtrack(x):
if x == len(sList) - 1:
res.append(''.join(sList))
return
temp_set = set()
for i in range(x, len(sList)):
if sList[i] in temp_set:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def ArrangementOfStrings(self, s):
"""字符串排列——》回溯递归 :param s: :return:"""
<|body_0|>
def ResverNum(self, nums: List[int], n: int) -> List[int]:
"""逆序数组中前n个数字 :param nums: :return:"""
<|body_1|>
def next_n(n):
"""find next n [POJ2453] :pa... | stack_v2_sparse_classes_36k_train_028261 | 3,562 | no_license | [
{
"docstring": "字符串排列——》回溯递归 :param s: :return:",
"name": "ArrangementOfStrings",
"signature": "def ArrangementOfStrings(self, s)"
},
{
"docstring": "逆序数组中前n个数字 :param nums: :return:",
"name": "ResverNum",
"signature": "def ResverNum(self, nums: List[int], n: int) -> List[int]"
},
{
... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def ArrangementOfStrings(self, s): 字符串排列——》回溯递归 :param s: :return:
- def ResverNum(self, nums: List[int], n: int) -> List[int]: 逆序数组中前n个数字 :param nums: :return:
- def next_n(n): ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def ArrangementOfStrings(self, s): 字符串排列——》回溯递归 :param s: :return:
- def ResverNum(self, nums: List[int], n: int) -> List[int]: 逆序数组中前n个数字 :param nums: :return:
- def next_n(n): ... | 32941ee052d0985a9569441d314378700ff4d225 | <|skeleton|>
class Solution:
def ArrangementOfStrings(self, s):
"""字符串排列——》回溯递归 :param s: :return:"""
<|body_0|>
def ResverNum(self, nums: List[int], n: int) -> List[int]:
"""逆序数组中前n个数字 :param nums: :return:"""
<|body_1|>
def next_n(n):
"""find next n [POJ2453] :pa... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def ArrangementOfStrings(self, s):
"""字符串排列——》回溯递归 :param s: :return:"""
res = []
sList = list(s)
def backtrack(x):
if x == len(sList) - 1:
res.append(''.join(sList))
return
temp_set = set()
for i in... | the_stack_v2_python_sparse | cecilia-python/剑指offer/chapter-1/ArrangementOfStrings.py | Cecilia520/algorithmic-learning-leetcode | train | 7 | |
82ae17cdc5863bf5bf0f52f8fd4bc6763614ff28 | [
"self.parent = parent\nself.press = None\nself.background = None\nself.x = x\nself.line = axes.axvline(x)\nself.connect()\nif len(self.parent.line_list) == 1:\n self.BOX = axes.axvspan(self.parent.line_list[0].x, self.x, alpha=0.15)",
"self.cidpress1 = self.line.figure.canvas.mpl_connect('button_press_event', ... | <|body_start_0|>
self.parent = parent
self.press = None
self.background = None
self.x = x
self.line = axes.axvline(x)
self.connect()
if len(self.parent.line_list) == 1:
self.BOX = axes.axvspan(self.parent.line_list[0].x, self.x, alpha=0.15)
<|end_body_... | This is a class to create an vertical line that can be drag in a vertical fashion. Documentation of this part is not torough as it does not come from me. I took some part of another code and adapted it to this one. Attributes: parent : tkinter frame in which the matplotlib pyplot is gridded into. press : This attribute... | VerticalDraggableLine | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VerticalDraggableLine:
"""This is a class to create an vertical line that can be drag in a vertical fashion. Documentation of this part is not torough as it does not come from me. I took some part of another code and adapted it to this one. Attributes: parent : tkinter frame in which the matplotl... | stack_v2_sparse_classes_36k_train_028262 | 32,818 | no_license | [
{
"docstring": "The constructor for the HorizontalDraggableLine Class. Parameters: parent : tkinter Frame object where the object is placed in. y : Initial position of your horizontal line on the y axis Axis : axis of your pyplot graphic that will contain this line.",
"name": "__init__",
"signature": "d... | 6 | stack_v2_sparse_classes_30k_train_020266 | Implement the Python class `VerticalDraggableLine` described below.
Class description:
This is a class to create an vertical line that can be drag in a vertical fashion. Documentation of this part is not torough as it does not come from me. I took some part of another code and adapted it to this one. Attributes: paren... | Implement the Python class `VerticalDraggableLine` described below.
Class description:
This is a class to create an vertical line that can be drag in a vertical fashion. Documentation of this part is not torough as it does not come from me. I took some part of another code and adapted it to this one. Attributes: paren... | 6e479850a21c337c0c47379538f002bca97e03f1 | <|skeleton|>
class VerticalDraggableLine:
"""This is a class to create an vertical line that can be drag in a vertical fashion. Documentation of this part is not torough as it does not come from me. I took some part of another code and adapted it to this one. Attributes: parent : tkinter frame in which the matplotl... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VerticalDraggableLine:
"""This is a class to create an vertical line that can be drag in a vertical fashion. Documentation of this part is not torough as it does not come from me. I took some part of another code and adapted it to this one. Attributes: parent : tkinter frame in which the matplotlib pyplot is ... | the_stack_v2_python_sparse | Labo_Env/ultrafastGUI/Graphic.py | UltraFastQ/femtoQ-Intruments | train | 2 |
8413b7d86917ba9e26b2fc6aba161653862e9457 | [
"if not self._errors:\n self._errors = ErrorDict()\nself._errors['upload_of_work'] = self.error_class([DEF_NO_UPLOAD])",
"cleaned_data = self.cleaned_data\nupload = cleaned_data.get('upload_of_work')\nif not upload:\n raise gci_forms.ValidationError(DEF_NO_UPLOAD)\nreturn upload"
] | <|body_start_0|>
if not self._errors:
self._errors = ErrorDict()
self._errors['upload_of_work'] = self.error_class([DEF_NO_UPLOAD])
<|end_body_0|>
<|body_start_1|>
cleaned_data = self.cleaned_data
upload = cleaned_data.get('upload_of_work')
if not upload:
... | Django form for submitting work as file. | WorkSubmissionFileForm | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WorkSubmissionFileForm:
"""Django form for submitting work as file."""
def addFileRequiredError(self):
"""Appends a form error message indicating that this field is required."""
<|body_0|>
def clean_upload_of_work(self):
"""Ensure that file field has data."""
... | stack_v2_sparse_classes_36k_train_028263 | 26,251 | permissive | [
{
"docstring": "Appends a form error message indicating that this field is required.",
"name": "addFileRequiredError",
"signature": "def addFileRequiredError(self)"
},
{
"docstring": "Ensure that file field has data.",
"name": "clean_upload_of_work",
"signature": "def clean_upload_of_wor... | 2 | stack_v2_sparse_classes_30k_train_009922 | Implement the Python class `WorkSubmissionFileForm` described below.
Class description:
Django form for submitting work as file.
Method signatures and docstrings:
- def addFileRequiredError(self): Appends a form error message indicating that this field is required.
- def clean_upload_of_work(self): Ensure that file f... | Implement the Python class `WorkSubmissionFileForm` described below.
Class description:
Django form for submitting work as file.
Method signatures and docstrings:
- def addFileRequiredError(self): Appends a form error message indicating that this field is required.
- def clean_upload_of_work(self): Ensure that file f... | f581989f168189fa3a58c028eff327a16c03e438 | <|skeleton|>
class WorkSubmissionFileForm:
"""Django form for submitting work as file."""
def addFileRequiredError(self):
"""Appends a form error message indicating that this field is required."""
<|body_0|>
def clean_upload_of_work(self):
"""Ensure that file field has data."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WorkSubmissionFileForm:
"""Django form for submitting work as file."""
def addFileRequiredError(self):
"""Appends a form error message indicating that this field is required."""
if not self._errors:
self._errors = ErrorDict()
self._errors['upload_of_work'] = self.error... | the_stack_v2_python_sparse | app/soc/modules/gci/views/task.py | sambitgaan/nupic.son | train | 0 |
cc741e45350e53e8777c31456edc4e3a5ee3e882 | [
"super().at_object_creation()\nself.db.tutorial_info = 'This object changes its desc randomly, and makes sure to remember which one you saw.'\nself.db.puzzle_descs = ['You see a normal stone slab']\nself.locks.add('get:false()')",
"descs = self.db.puzzle_descs\nclueindex = random.randint(0, len(descs) - 1)\nstrin... | <|body_start_0|>
super().at_object_creation()
self.db.tutorial_info = 'This object changes its desc randomly, and makes sure to remember which one you saw.'
self.db.puzzle_descs = ['You see a normal stone slab']
self.locks.add('get:false()')
<|end_body_0|>
<|body_start_1|>
descs... | This object changes its description randomly, and which is shown determines which order "clue id" is stored on the Character for future puzzles. Important Attribute: puzzle_descs (list): list of descriptions. One of these is picked randomly when this object is looked at and its index in the list is used as a key for to... | Obelisk | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Obelisk:
"""This object changes its description randomly, and which is shown determines which order "clue id" is stored on the Character for future puzzles. Important Attribute: puzzle_descs (list): list of descriptions. One of these is picked randomly when this object is looked at and its index ... | stack_v2_sparse_classes_36k_train_028264 | 42,155 | permissive | [
{
"docstring": "Called when object is created.",
"name": "at_object_creation",
"signature": "def at_object_creation(self)"
},
{
"docstring": "This hook is called by the look command to get the description of the object. We overload it with our own version.",
"name": "return_appearance",
... | 2 | null | Implement the Python class `Obelisk` described below.
Class description:
This object changes its description randomly, and which is shown determines which order "clue id" is stored on the Character for future puzzles. Important Attribute: puzzle_descs (list): list of descriptions. One of these is picked randomly when ... | Implement the Python class `Obelisk` described below.
Class description:
This object changes its description randomly, and which is shown determines which order "clue id" is stored on the Character for future puzzles. Important Attribute: puzzle_descs (list): list of descriptions. One of these is picked randomly when ... | b3ca58b5c1325a3bf57051dfe23560a08d2947b7 | <|skeleton|>
class Obelisk:
"""This object changes its description randomly, and which is shown determines which order "clue id" is stored on the Character for future puzzles. Important Attribute: puzzle_descs (list): list of descriptions. One of these is picked randomly when this object is looked at and its index ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Obelisk:
"""This object changes its description randomly, and which is shown determines which order "clue id" is stored on the Character for future puzzles. Important Attribute: puzzle_descs (list): list of descriptions. One of these is picked randomly when this object is looked at and its index in the list i... | the_stack_v2_python_sparse | evennia/contrib/tutorials/tutorial_world/objects.py | evennia/evennia | train | 1,781 |
8c7aa92aa4ca212a63b1552454663ab55879021f | [
"self.is_breaking = is_breaking\nself.lease_break_type = lease_break_type\nself.lease_tye = lease_tye",
"if dictionary is None:\n return None\nis_breaking = dictionary.get('isBreaking')\nlease_break_type = dictionary.get('leaseBreakType')\nlease_tye = dictionary.get('leaseTye')\nreturn cls(is_breaking, lease_b... | <|body_start_0|>
self.is_breaking = is_breaking
self.lease_break_type = lease_break_type
self.lease_tye = lease_tye
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
is_breaking = dictionary.get('isBreaking')
lease_break_type = dictionary.get... | Implementation of the 'SmbLeaseInfo' model. TODO: type description here. Attributes: is_breaking (bool): Whether lease break is in progress lease_break_type (list of string): Lease type that is attempted to being broken. lease_tye (list of string): Lease type granted for open. | SmbLeaseInfo | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SmbLeaseInfo:
"""Implementation of the 'SmbLeaseInfo' model. TODO: type description here. Attributes: is_breaking (bool): Whether lease break is in progress lease_break_type (list of string): Lease type that is attempted to being broken. lease_tye (list of string): Lease type granted for open."""... | stack_v2_sparse_classes_36k_train_028265 | 1,876 | permissive | [
{
"docstring": "Constructor for the SmbLeaseInfo class",
"name": "__init__",
"signature": "def __init__(self, is_breaking=None, lease_break_type=None, lease_tye=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representatio... | 2 | stack_v2_sparse_classes_30k_test_000892 | Implement the Python class `SmbLeaseInfo` described below.
Class description:
Implementation of the 'SmbLeaseInfo' model. TODO: type description here. Attributes: is_breaking (bool): Whether lease break is in progress lease_break_type (list of string): Lease type that is attempted to being broken. lease_tye (list of s... | Implement the Python class `SmbLeaseInfo` described below.
Class description:
Implementation of the 'SmbLeaseInfo' model. TODO: type description here. Attributes: is_breaking (bool): Whether lease break is in progress lease_break_type (list of string): Lease type that is attempted to being broken. lease_tye (list of s... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class SmbLeaseInfo:
"""Implementation of the 'SmbLeaseInfo' model. TODO: type description here. Attributes: is_breaking (bool): Whether lease break is in progress lease_break_type (list of string): Lease type that is attempted to being broken. lease_tye (list of string): Lease type granted for open."""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SmbLeaseInfo:
"""Implementation of the 'SmbLeaseInfo' model. TODO: type description here. Attributes: is_breaking (bool): Whether lease break is in progress lease_break_type (list of string): Lease type that is attempted to being broken. lease_tye (list of string): Lease type granted for open."""
def __i... | the_stack_v2_python_sparse | cohesity_management_sdk/models/smb_lease_info.py | cohesity/management-sdk-python | train | 24 |
444aedf4d1584bfa79da3c4bb31fc19620c7f1d3 | [
"ctx.save_for_backward(input)\nrst = torch.where(input > thrd, torch.tensor(1.0, device=device, requires_grad=True), torch.tensor(0.0, device=device, requires_grad=True))\nreturn rst",
"input, = ctx.saved_tensors\ngrad_input = grad_output.clone()\n'\\n Return results number should corresponding with .forwa... | <|body_start_0|>
ctx.save_for_backward(input)
rst = torch.where(input > thrd, torch.tensor(1.0, device=device, requires_grad=True), torch.tensor(0.0, device=device, requires_grad=True))
return rst
<|end_body_0|>
<|body_start_1|>
input, = ctx.saved_tensors
grad_input = grad_outpu... | We can implement our own custom autograd Functions by subclassing torch.autograd.Function and implementing the forward and backward passes which operate on Tensors. | GradWhere | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GradWhere:
"""We can implement our own custom autograd Functions by subclassing torch.autograd.Function and implementing the forward and backward passes which operate on Tensors."""
def forward(ctx, input, thrd, device):
"""In the forward pass we receive a Tensor containing the input... | stack_v2_sparse_classes_36k_train_028266 | 8,147 | no_license | [
{
"docstring": "In the forward pass we receive a Tensor containing the input and return a Tensor containing the output. ctx is a context object that can be used to stash information for backward computation. You can cache arbitrary objects for use in the backward pass using the ctx.save_for_backward method.",
... | 2 | stack_v2_sparse_classes_30k_train_019722 | Implement the Python class `GradWhere` described below.
Class description:
We can implement our own custom autograd Functions by subclassing torch.autograd.Function and implementing the forward and backward passes which operate on Tensors.
Method signatures and docstrings:
- def forward(ctx, input, thrd, device): In ... | Implement the Python class `GradWhere` described below.
Class description:
We can implement our own custom autograd Functions by subclassing torch.autograd.Function and implementing the forward and backward passes which operate on Tensors.
Method signatures and docstrings:
- def forward(ctx, input, thrd, device): In ... | 36e51e876eebb5928d1643ab051cbd12963746fa | <|skeleton|>
class GradWhere:
"""We can implement our own custom autograd Functions by subclassing torch.autograd.Function and implementing the forward and backward passes which operate on Tensors."""
def forward(ctx, input, thrd, device):
"""In the forward pass we receive a Tensor containing the input... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GradWhere:
"""We can implement our own custom autograd Functions by subclassing torch.autograd.Function and implementing the forward and backward passes which operate on Tensors."""
def forward(ctx, input, thrd, device):
"""In the forward pass we receive a Tensor containing the input and return a... | the_stack_v2_python_sparse | trojan/GTA.py | xujing1994/GraphBackdoor | train | 0 |
8cf87ac601beafab70bad8c09070e71336985cba | [
"if len(flowerbed) == 1:\n if flowerbed[0] == 1:\n return True if n == 0 else False\n else:\n return True if n < 2 else False\nfor i in range(len(flowerbed)):\n if i == 0 and flowerbed[i] == 0 and (flowerbed[i + 1] == 0):\n flowerbed[i] = 1\n n -= 1\n elif i == len(flowerbed)... | <|body_start_0|>
if len(flowerbed) == 1:
if flowerbed[0] == 1:
return True if n == 0 else False
else:
return True if n < 2 else False
for i in range(len(flowerbed)):
if i == 0 and flowerbed[i] == 0 and (flowerbed[i + 1] == 0):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def canPlaceFlowers(self, flowerbed, n):
""":type flowerbed: List[int] :type n: int :rtype: bool"""
<|body_0|>
def canPlaceFlowersCleanCode(self, flowerbed, n):
""":type flowerbed: List[int] :type n: int :rtype: bool"""
<|body_1|>
<|end_skeleton|>
... | stack_v2_sparse_classes_36k_train_028267 | 2,323 | no_license | [
{
"docstring": ":type flowerbed: List[int] :type n: int :rtype: bool",
"name": "canPlaceFlowers",
"signature": "def canPlaceFlowers(self, flowerbed, n)"
},
{
"docstring": ":type flowerbed: List[int] :type n: int :rtype: bool",
"name": "canPlaceFlowersCleanCode",
"signature": "def canPlac... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def canPlaceFlowers(self, flowerbed, n): :type flowerbed: List[int] :type n: int :rtype: bool
- def canPlaceFlowersCleanCode(self, flowerbed, n): :type flowerbed: List[int] :type... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def canPlaceFlowers(self, flowerbed, n): :type flowerbed: List[int] :type n: int :rtype: bool
- def canPlaceFlowersCleanCode(self, flowerbed, n): :type flowerbed: List[int] :type... | 810575368ecffa97677bdb51744d1f716140bbb1 | <|skeleton|>
class Solution:
def canPlaceFlowers(self, flowerbed, n):
""":type flowerbed: List[int] :type n: int :rtype: bool"""
<|body_0|>
def canPlaceFlowersCleanCode(self, flowerbed, n):
""":type flowerbed: List[int] :type n: int :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def canPlaceFlowers(self, flowerbed, n):
""":type flowerbed: List[int] :type n: int :rtype: bool"""
if len(flowerbed) == 1:
if flowerbed[0] == 1:
return True if n == 0 else False
else:
return True if n < 2 else False
for... | the_stack_v2_python_sparse | C/CanPlaceFlowers.py | bssrdf/pyleet | train | 2 | |
01c46bc9f88c9866560d0d5e715eec62e25096cf | [
"super(FeaturePyramidNetwork, self).__init__(name='FeaturePyramidNetwork')\nself.backbone = get_backbone()\nself.conv_c3_1x1 = layers.Conv2D(filters=256, kernel_size=1, strides=1, padding='same')\nself.conv_c4_1x1 = layers.Conv2D(filters=256, kernel_size=1, strides=1, padding='same')\nself.conv_c5_1x1 = layers.Conv... | <|body_start_0|>
super(FeaturePyramidNetwork, self).__init__(name='FeaturePyramidNetwork')
self.backbone = get_backbone()
self.conv_c3_1x1 = layers.Conv2D(filters=256, kernel_size=1, strides=1, padding='same')
self.conv_c4_1x1 = layers.Conv2D(filters=256, kernel_size=1, strides=1, paddin... | 特征金字塔网络(基于ResNet50实现). Reference: - [Lin, T. Y. , et al., 2017](https://arxiv.org/abs/1612.03144v2) | FeaturePyramidNetwork | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FeaturePyramidNetwork:
"""特征金字塔网络(基于ResNet50实现). Reference: - [Lin, T. Y. , et al., 2017](https://arxiv.org/abs/1612.03144v2)"""
def __init__(self):
"""初始化特征金字塔网络."""
<|body_0|>
def call(self, inputs, training=False, **kwargs):
"""实例化特征金字塔网络. Args: inputs: tf.Ten... | stack_v2_sparse_classes_36k_train_028268 | 2,634 | permissive | [
{
"docstring": "初始化特征金字塔网络.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "实例化特征金字塔网络. Args: inputs: tf.Tensor, 输入网络层. training: bool, default=False, 网络是否可训练. Returns: 特征金字塔的五个尺度输出.",
"name": "call",
"signature": "def call(self, inputs, training=False, **kwarg... | 2 | stack_v2_sparse_classes_30k_train_021552 | Implement the Python class `FeaturePyramidNetwork` described below.
Class description:
特征金字塔网络(基于ResNet50实现). Reference: - [Lin, T. Y. , et al., 2017](https://arxiv.org/abs/1612.03144v2)
Method signatures and docstrings:
- def __init__(self): 初始化特征金字塔网络.
- def call(self, inputs, training=False, **kwargs): 实例化特征金字塔网络.... | Implement the Python class `FeaturePyramidNetwork` described below.
Class description:
特征金字塔网络(基于ResNet50实现). Reference: - [Lin, T. Y. , et al., 2017](https://arxiv.org/abs/1612.03144v2)
Method signatures and docstrings:
- def __init__(self): 初始化特征金字塔网络.
- def call(self, inputs, training=False, **kwargs): 实例化特征金字塔网络.... | 357edda03cdc1f976764b6ed4fcad6e639646142 | <|skeleton|>
class FeaturePyramidNetwork:
"""特征金字塔网络(基于ResNet50实现). Reference: - [Lin, T. Y. , et al., 2017](https://arxiv.org/abs/1612.03144v2)"""
def __init__(self):
"""初始化特征金字塔网络."""
<|body_0|>
def call(self, inputs, training=False, **kwargs):
"""实例化特征金字塔网络. Args: inputs: tf.Ten... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FeaturePyramidNetwork:
"""特征金字塔网络(基于ResNet50实现). Reference: - [Lin, T. Y. , et al., 2017](https://arxiv.org/abs/1612.03144v2)"""
def __init__(self):
"""初始化特征金字塔网络."""
super(FeaturePyramidNetwork, self).__init__(name='FeaturePyramidNetwork')
self.backbone = get_backbone()
s... | the_stack_v2_python_sparse | RetinaNet/model/feature_pyramid_network.py | sun1638650145/RetinaNet | train | 2 |
acf02da5f3329d62da543069ba8a863c044a73e6 | [
"def preOrder(root):\n if root:\n vals.append(str(root.val))\n preOrder(root.left)\n preOrder(root.right)\nvals = []\npreOrder(root)\nreturn ''.join(vals)",
"vals = list(map(int, data.split()))\nvals.reverse()\n\ndef build(minVal, maxVal):\n if vals and minVal <= vals[-1] <= maxVal:\n ... | <|body_start_0|>
def preOrder(root):
if root:
vals.append(str(root.val))
preOrder(root.left)
preOrder(root.right)
vals = []
preOrder(root)
return ''.join(vals)
<|end_body_0|>
<|body_start_1|>
vals = list(map(int, data.s... | 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_028269 | 979 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | stack_v2_sparse_classes_30k_train_013274 | 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:... | 11c8fc663888b48b5417256aab1bf872190267ba | <|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 preOrder(root):
if root:
vals.append(str(root.val))
preOrder(root.left)
preOrder(root.right)
vals = []
pre... | the_stack_v2_python_sparse | Serialize and Deserialize BST.py | lfdyf20/Leetcode | train | 1 | |
13b1c91c9b480b9b8a34acfead9d359617857920 | [
"if self == Format.finalfusion:\n embeddings.write(path)\nelif self == Format.word2vec:\n write_word2vec(path, embeddings)\nelif self == Format.text:\n write_text(path, embeddings)\nelif self == Format.textdims:\n write_text_dims(path, embeddings)\nelif self == Format.fasttext:\n write_fasttext(path,... | <|body_start_0|>
if self == Format.finalfusion:
embeddings.write(path)
elif self == Format.word2vec:
write_word2vec(path, embeddings)
elif self == Format.text:
write_text(path, embeddings)
elif self == Format.textdims:
write_text_dims(path,... | Supported embedding formats. | Format | [
"BlueOak-1.0.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Format:
"""Supported embedding formats."""
def write(self, path: str, embeddings: Embeddings):
"""Helper to write different Formats"""
<|body_0|>
def load(self, path: str, lossy: bool, mmap: bool) -> Embeddings:
"""Helper to load different Formats"""
<|bo... | stack_v2_sparse_classes_36k_train_028270 | 3,054 | permissive | [
{
"docstring": "Helper to write different Formats",
"name": "write",
"signature": "def write(self, path: str, embeddings: Embeddings)"
},
{
"docstring": "Helper to load different Formats",
"name": "load",
"signature": "def load(self, path: str, lossy: bool, mmap: bool) -> Embeddings"
}... | 2 | stack_v2_sparse_classes_30k_val_000980 | Implement the Python class `Format` described below.
Class description:
Supported embedding formats.
Method signatures and docstrings:
- def write(self, path: str, embeddings: Embeddings): Helper to write different Formats
- def load(self, path: str, lossy: bool, mmap: bool) -> Embeddings: Helper to load different Fo... | Implement the Python class `Format` described below.
Class description:
Supported embedding formats.
Method signatures and docstrings:
- def write(self, path: str, embeddings: Embeddings): Helper to write different Formats
- def load(self, path: str, lossy: bool, mmap: bool) -> Embeddings: Helper to load different Fo... | f7ab0174a66731d0f71635c45d172f7711f6aec8 | <|skeleton|>
class Format:
"""Supported embedding formats."""
def write(self, path: str, embeddings: Embeddings):
"""Helper to write different Formats"""
<|body_0|>
def load(self, path: str, lossy: bool, mmap: bool) -> Embeddings:
"""Helper to load different Formats"""
<|bo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Format:
"""Supported embedding formats."""
def write(self, path: str, embeddings: Embeddings):
"""Helper to write different Formats"""
if self == Format.finalfusion:
embeddings.write(path)
elif self == Format.word2vec:
write_word2vec(path, embeddings)
... | the_stack_v2_python_sparse | src/finalfusion/scripts/util.py | finalfusion/finalfusion-python | train | 5 |
0ed711127c75018f363df7b2454d65ba3204fb65 | [
"shader = Shader.load(Shader.SL_GLSL, fragment=frag, vertex=vert)\nShaderRegistry.shaders[identifier] = shader\nprint(f'Registered shader {identifier}')",
"if identifier not in ShaderRegistry.shaders:\n raise NotInRegistryError(identifier)\nreturn ShaderRegistry.shaders.get(identifier)"
] | <|body_start_0|>
shader = Shader.load(Shader.SL_GLSL, fragment=frag, vertex=vert)
ShaderRegistry.shaders[identifier] = shader
print(f'Registered shader {identifier}')
<|end_body_0|>
<|body_start_1|>
if identifier not in ShaderRegistry.shaders:
raise NotInRegistryError(identi... | ShaderRegistry | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ShaderRegistry:
def register(identifier: str, frag: str, vert: str):
"""Register shader All shaders must be in GLSL with separate .frag and .vert files! Shader identifiers should be formatted by where they are used e.g.: Full scene render effects are prefixed with 'render:' CheesyEffects... | stack_v2_sparse_classes_36k_train_028271 | 2,157 | permissive | [
{
"docstring": "Register shader All shaders must be in GLSL with separate .frag and .vert files! Shader identifiers should be formatted by where they are used e.g.: Full scene render effects are prefixed with 'render:' CheesyEffects are prefixed with 'ce:' Make-A-Toon shaders are prefixed with 'mat:' etc. :para... | 2 | stack_v2_sparse_classes_30k_train_015078 | Implement the Python class `ShaderRegistry` described below.
Class description:
Implement the ShaderRegistry class.
Method signatures and docstrings:
- def register(identifier: str, frag: str, vert: str): Register shader All shaders must be in GLSL with separate .frag and .vert files! Shader identifiers should be for... | Implement the Python class `ShaderRegistry` described below.
Class description:
Implement the ShaderRegistry class.
Method signatures and docstrings:
- def register(identifier: str, frag: str, vert: str): Register shader All shaders must be in GLSL with separate .frag and .vert files! Shader identifiers should be for... | 7847717dda5e2f75f0028c5554bf3f78e5fd8860 | <|skeleton|>
class ShaderRegistry:
def register(identifier: str, frag: str, vert: str):
"""Register shader All shaders must be in GLSL with separate .frag and .vert files! Shader identifiers should be formatted by where they are used e.g.: Full scene render effects are prefixed with 'render:' CheesyEffects... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ShaderRegistry:
def register(identifier: str, frag: str, vert: str):
"""Register shader All shaders must be in GLSL with separate .frag and .vert files! Shader identifiers should be formatted by where they are used e.g.: Full scene render effects are prefixed with 'render:' CheesyEffects are prefixed ... | the_stack_v2_python_sparse | ott/ShaderRegistry.py | ttoff/OpenLevelEditor | train | 0 | |
2330016e0d526967fd0434a1e9a6da06d0bd7be3 | [
"self.sensor = sensor\nself.sensor.enable(polling_rate)\nlookup_table_vals = [654, 614, 552, 491, 327, 276, 225, 184, 153, 123, 82]\nlookup_table_dists = [0.06, 0.07, 0.08, 0.1, 0.15, 0.2, 0.25, 0.3, 0.4, 0.5, 0.8]\nself.pairs = list(zip(zip(lookup_table_vals, lookup_table_vals[1:]), zip(lookup_table_dists, lookup_... | <|body_start_0|>
self.sensor = sensor
self.sensor.enable(polling_rate)
lookup_table_vals = [654, 614, 552, 491, 327, 276, 225, 184, 153, 123, 82]
lookup_table_dists = [0.06, 0.07, 0.08, 0.1, 0.15, 0.2, 0.25, 0.3, 0.4, 0.5, 0.8]
self.pairs = list(zip(zip(lookup_table_vals, lookup_... | IRSensor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IRSensor:
def __init__(self, sensor, polling_rate):
"""Initialize the IR sensor and create the linear interpolation values for converting measured values into a distance in m. Values taken from sensor datasheet."""
<|body_0|>
def get_distance(self):
"""Returns distan... | stack_v2_sparse_classes_36k_train_028272 | 1,426 | no_license | [
{
"docstring": "Initialize the IR sensor and create the linear interpolation values for converting measured values into a distance in m. Values taken from sensor datasheet.",
"name": "__init__",
"signature": "def __init__(self, sensor, polling_rate)"
},
{
"docstring": "Returns distance in m by p... | 2 | stack_v2_sparse_classes_30k_train_015634 | Implement the Python class `IRSensor` described below.
Class description:
Implement the IRSensor class.
Method signatures and docstrings:
- def __init__(self, sensor, polling_rate): Initialize the IR sensor and create the linear interpolation values for converting measured values into a distance in m. Values taken fr... | Implement the Python class `IRSensor` described below.
Class description:
Implement the IRSensor class.
Method signatures and docstrings:
- def __init__(self, sensor, polling_rate): Initialize the IR sensor and create the linear interpolation values for converting measured values into a distance in m. Values taken fr... | 5e0f01d9b0064530a24671488130a373182a589d | <|skeleton|>
class IRSensor:
def __init__(self, sensor, polling_rate):
"""Initialize the IR sensor and create the linear interpolation values for converting measured values into a distance in m. Values taken from sensor datasheet."""
<|body_0|>
def get_distance(self):
"""Returns distan... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IRSensor:
def __init__(self, sensor, polling_rate):
"""Initialize the IR sensor and create the linear interpolation values for converting measured values into a distance in m. Values taken from sensor datasheet."""
self.sensor = sensor
self.sensor.enable(polling_rate)
lookup_ta... | the_stack_v2_python_sparse | Suboptimal_solution/controllers/robot_controller/infrared_controller.py | DaveDuck321/IDP_2021 | train | 0 | |
a1389f1fbf319aa1d32f5c14781987aa8aac9afb | [
"super(VAE, self).__init__()\nself.encoder = self.EncoderRNN(input_size, hidden_size)\nself.decoder = self.DecoderRNN(input_size, hidden_size)\nself.input_size = input_size\nself.hidden_size = hidden_size\nself.latent_size = latent_size\nself.conditional_size = conditional_size\nself.max_length = max_length\nself.t... | <|body_start_0|>
super(VAE, self).__init__()
self.encoder = self.EncoderRNN(input_size, hidden_size)
self.decoder = self.DecoderRNN(input_size, hidden_size)
self.input_size = input_size
self.hidden_size = hidden_size
self.latent_size = latent_size
self.conditional... | VAE | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VAE:
def __init__(self, input_size, hidden_size, latent_size, conditional_size, max_length):
""":param input_size: 28 :param hidden_size: 256 or 512 :param latent_size: 32 :param conditional_size: 8"""
<|body_0|>
def forward(self, input_tensor, encoder_hidden_state, encoder_... | stack_v2_sparse_classes_36k_train_028273 | 9,452 | no_license | [
{
"docstring": ":param input_size: 28 :param hidden_size: 256 or 512 :param latent_size: 32 :param conditional_size: 8",
"name": "__init__",
"signature": "def __init__(self, input_size, hidden_size, latent_size, conditional_size, max_length)"
},
{
"docstring": "forwarding a word in VAE (This is ... | 5 | stack_v2_sparse_classes_30k_train_021489 | Implement the Python class `VAE` described below.
Class description:
Implement the VAE class.
Method signatures and docstrings:
- def __init__(self, input_size, hidden_size, latent_size, conditional_size, max_length): :param input_size: 28 :param hidden_size: 256 or 512 :param latent_size: 32 :param conditional_size:... | Implement the Python class `VAE` described below.
Class description:
Implement the VAE class.
Method signatures and docstrings:
- def __init__(self, input_size, hidden_size, latent_size, conditional_size, max_length): :param input_size: 28 :param hidden_size: 256 or 512 :param latent_size: 32 :param conditional_size:... | de439e62928f1fe8daec7665946ce9133b3d8d7a | <|skeleton|>
class VAE:
def __init__(self, input_size, hidden_size, latent_size, conditional_size, max_length):
""":param input_size: 28 :param hidden_size: 256 or 512 :param latent_size: 32 :param conditional_size: 8"""
<|body_0|>
def forward(self, input_tensor, encoder_hidden_state, encoder_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VAE:
def __init__(self, input_size, hidden_size, latent_size, conditional_size, max_length):
""":param input_size: 28 :param hidden_size: 256 or 512 :param latent_size: 32 :param conditional_size: 8"""
super(VAE, self).__init__()
self.encoder = self.EncoderRNN(input_size, hidden_size)
... | the_stack_v2_python_sparse | Lab5/model.py | Louis5228/DLP-lab | train | 1 | |
9195ec4578d0075d9fbc79d6212e6aa20c055db2 | [
"departments = self.env['hr.department'].search([])\ndepartments.write({'manager_id': employee_id})\nrecords = departments\nresult_msg = _('Finished doing something')\nreturn (records, result_msg)",
"self.ensure_one()\nprocess_xml_id = 'sample_pabi_async_process.do_something'\njob_desc = _('Do Something...')\nfun... | <|body_start_0|>
departments = self.env['hr.department'].search([])
departments.write({'manager_id': employee_id})
records = departments
result_msg = _('Finished doing something')
return (records, result_msg)
<|end_body_0|>
<|body_start_1|>
self.ensure_one()
proc... | PABI Action for Do Something | PabiActionDoSomething | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PabiActionDoSomething:
"""PABI Action for Do Something"""
def do_something(self, employee_id):
"""This must by of type @api.model, all paramas must not be value"""
<|body_0|>
def pabi_action(self):
"""Interited Function, to use Job Queue"""
<|body_1|>
<|... | stack_v2_sparse_classes_36k_train_028274 | 1,511 | no_license | [
{
"docstring": "This must by of type @api.model, all paramas must not be value",
"name": "do_something",
"signature": "def do_something(self, employee_id)"
},
{
"docstring": "Interited Function, to use Job Queue",
"name": "pabi_action",
"signature": "def pabi_action(self)"
}
] | 2 | null | Implement the Python class `PabiActionDoSomething` described below.
Class description:
PABI Action for Do Something
Method signatures and docstrings:
- def do_something(self, employee_id): This must by of type @api.model, all paramas must not be value
- def pabi_action(self): Interited Function, to use Job Queue | Implement the Python class `PabiActionDoSomething` described below.
Class description:
PABI Action for Do Something
Method signatures and docstrings:
- def do_something(self, employee_id): This must by of type @api.model, all paramas must not be value
- def pabi_action(self): Interited Function, to use Job Queue
<|s... | e8c21082c187f4639373b29a7a0905d069d770f2 | <|skeleton|>
class PabiActionDoSomething:
"""PABI Action for Do Something"""
def do_something(self, employee_id):
"""This must by of type @api.model, all paramas must not be value"""
<|body_0|>
def pabi_action(self):
"""Interited Function, to use Job Queue"""
<|body_1|>
<|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PabiActionDoSomething:
"""PABI Action for Do Something"""
def do_something(self, employee_id):
"""This must by of type @api.model, all paramas must not be value"""
departments = self.env['hr.department'].search([])
departments.write({'manager_id': employee_id})
records = d... | the_stack_v2_python_sparse | sample_pabi_async_process/pabi_action_do_something/pabi_action_do_something.py | pabi2/pb2_addons | train | 6 |
baaf9649b84c2f922dbe86dabe06cfcde8e925fc | [
"def preorder(node):\n if node is None:\n serial.append('#')\n else:\n serial.append(str(node.val))\n preorder(node.left)\n preorder(node.right)\nif root is None:\n return ''\nserial = []\npreorder(root)\nreturn ','.join(serial)",
"if data == '':\n return None\nserial = dat... | <|body_start_0|>
def preorder(node):
if node is None:
serial.append('#')
else:
serial.append(str(node.val))
preorder(node.left)
preorder(node.right)
if root is None:
return ''
serial = []
... | 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_028275 | 1,764 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | stack_v2_sparse_classes_30k_train_000435 | 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:... | e12025e754547d18d5bb50a9dbe5e725fd03fd9c | <|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 preorder(node):
if node is None:
serial.append('#')
else:
serial.append(str(node.val))
preorder(node.left)
... | the_stack_v2_python_sparse | leetcode_review/297serialize_and_deserialize_BT.py | clovery410/mycode | train | 1 | |
6d5f686bad698a983f2b5e18d94daa47bcd9287c | [
"if n < 2:\n raise ValueError('Please input a number greater then 2')\nprimes = []\ni = 2\nwhile i < n:\n j = 2\n isPrime = True\n '\\n We only need to consider j < sqrt(i) for example if we consider 36 we know that if we consider\\n 9 it has a factor less then 6 which is 4\\n ... | <|body_start_0|>
if n < 2:
raise ValueError('Please input a number greater then 2')
primes = []
i = 2
while i < n:
j = 2
isPrime = True
'\n We only need to consider j < sqrt(i) for example if we consider 36 we know that if we con... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def naive_enumeration(self, n: int) -> List[int]:
"""Enumerates all primes up to the number n input ---- n : integer output ---- res : list of integers Complexity ---- Time : O(N^3/2) Space : O(N)"""
<|body_0|>
def sieve_eratosthenes(self, n: int) -> List[int]:
... | stack_v2_sparse_classes_36k_train_028276 | 2,164 | no_license | [
{
"docstring": "Enumerates all primes up to the number n input ---- n : integer output ---- res : list of integers Complexity ---- Time : O(N^3/2) Space : O(N)",
"name": "naive_enumeration",
"signature": "def naive_enumeration(self, n: int) -> List[int]"
},
{
"docstring": "Enumerates all primes ... | 2 | stack_v2_sparse_classes_30k_train_003823 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def naive_enumeration(self, n: int) -> List[int]: Enumerates all primes up to the number n input ---- n : integer output ---- res : list of integers Complexity ---- Time : O(N^3/... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def naive_enumeration(self, n: int) -> List[int]: Enumerates all primes up to the number n input ---- n : integer output ---- res : list of integers Complexity ---- Time : O(N^3/... | c0d49423885832b616ae3c7cd58e8f24c17cfd4d | <|skeleton|>
class Solution:
def naive_enumeration(self, n: int) -> List[int]:
"""Enumerates all primes up to the number n input ---- n : integer output ---- res : list of integers Complexity ---- Time : O(N^3/2) Space : O(N)"""
<|body_0|>
def sieve_eratosthenes(self, n: int) -> List[int]:
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def naive_enumeration(self, n: int) -> List[int]:
"""Enumerates all primes up to the number n input ---- n : integer output ---- res : list of integers Complexity ---- Time : O(N^3/2) Space : O(N)"""
if n < 2:
raise ValueError('Please input a number greater then 2')
... | the_stack_v2_python_sparse | Arrays/enumerate_primes.py | miaviles/Data-Structures-Algorithms-Python | train | 0 | |
d022351a743e73150d6eff39d9cd1afe36bd4ac6 | [
"ImageProcessor.__init__(self, **kwargs)\nself._masks: Dict[str, Dict[str, NDArray[Any]]] = {}\nfor instrument, group in masks.items():\n self._masks[instrument] = {}\n for binning, mask in group.items():\n if isinstance(mask, np.ndarray):\n self._masks[instrument][binning] = mask\n e... | <|body_start_0|>
ImageProcessor.__init__(self, **kwargs)
self._masks: Dict[str, Dict[str, NDArray[Any]]] = {}
for instrument, group in masks.items():
self._masks[instrument] = {}
for binning, mask in group.items():
if isinstance(mask, np.ndarray):
... | Add mask to image. | AddMask | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AddMask:
"""Add mask to image."""
def __init__(self, masks: Dict[str, Dict[str, Union[NDArray[Any], str]]], **kwargs: Any):
"""Init an image processor that adds a mask to an image. Args: masks: Dictionary containing instrument->binning->mask, with binning as string, e.g. '1x1'."""
... | stack_v2_sparse_classes_36k_train_028277 | 1,856 | permissive | [
{
"docstring": "Init an image processor that adds a mask to an image. Args: masks: Dictionary containing instrument->binning->mask, with binning as string, e.g. '1x1'.",
"name": "__init__",
"signature": "def __init__(self, masks: Dict[str, Dict[str, Union[NDArray[Any], str]]], **kwargs: Any)"
},
{
... | 2 | stack_v2_sparse_classes_30k_train_012941 | Implement the Python class `AddMask` described below.
Class description:
Add mask to image.
Method signatures and docstrings:
- def __init__(self, masks: Dict[str, Dict[str, Union[NDArray[Any], str]]], **kwargs: Any): Init an image processor that adds a mask to an image. Args: masks: Dictionary containing instrument-... | Implement the Python class `AddMask` described below.
Class description:
Add mask to image.
Method signatures and docstrings:
- def __init__(self, masks: Dict[str, Dict[str, Union[NDArray[Any], str]]], **kwargs: Any): Init an image processor that adds a mask to an image. Args: masks: Dictionary containing instrument-... | 2d7a06e5485b61b6ca7e51d99b08651ea6021086 | <|skeleton|>
class AddMask:
"""Add mask to image."""
def __init__(self, masks: Dict[str, Dict[str, Union[NDArray[Any], str]]], **kwargs: Any):
"""Init an image processor that adds a mask to an image. Args: masks: Dictionary containing instrument->binning->mask, with binning as string, e.g. '1x1'."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AddMask:
"""Add mask to image."""
def __init__(self, masks: Dict[str, Dict[str, Union[NDArray[Any], str]]], **kwargs: Any):
"""Init an image processor that adds a mask to an image. Args: masks: Dictionary containing instrument->binning->mask, with binning as string, e.g. '1x1'."""
ImagePr... | the_stack_v2_python_sparse | pyobs/images/processors/misc/addmask.py | pyobs/pyobs-core | train | 9 |
1ea05c60d2612c9f7023a9f82d52e17347e0bf2c | [
"from enthought.tvtk.pipeline.browser import PipelineBrowser\nself.browser = PipelineBrowser()\nself.browser.show(parent=parent)\nreturn self.browser.ui.control",
"map(self._remove_scene, event.removed)\nmap(self._add_scene, event.added)\nreturn",
"self.browser.renwins.append(scene)\nself.browser.root_object.ap... | <|body_start_0|>
from enthought.tvtk.pipeline.browser import PipelineBrowser
self.browser = PipelineBrowser()
self.browser.show(parent=parent)
return self.browser.ui.control
<|end_body_0|>
<|body_start_1|>
map(self._remove_scene, event.removed)
map(self._add_scene, event... | The TVTK pipeline browser view. | BrowserView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BrowserView:
"""The TVTK pipeline browser view."""
def create_control(self, parent):
"""Create the toolkit-specific control that represents the view."""
<|body_0|>
def _on_scenes_changed(self, event):
"""Dynamic trait change handler. This is called when scenes ar... | stack_v2_sparse_classes_36k_train_028278 | 3,017 | no_license | [
{
"docstring": "Create the toolkit-specific control that represents the view.",
"name": "create_control",
"signature": "def create_control(self, parent)"
},
{
"docstring": "Dynamic trait change handler. This is called when scenes are added/removed from the scene manager, it is used to add and re... | 4 | stack_v2_sparse_classes_30k_train_000191 | Implement the Python class `BrowserView` described below.
Class description:
The TVTK pipeline browser view.
Method signatures and docstrings:
- def create_control(self, parent): Create the toolkit-specific control that represents the view.
- def _on_scenes_changed(self, event): Dynamic trait change handler. This is ... | Implement the Python class `BrowserView` described below.
Class description:
The TVTK pipeline browser view.
Method signatures and docstrings:
- def create_control(self, parent): Create the toolkit-specific control that represents the view.
- def _on_scenes_changed(self, event): Dynamic trait change handler. This is ... | 5466f5858dbd2f1f082fa0d7417b57c8fb068fad | <|skeleton|>
class BrowserView:
"""The TVTK pipeline browser view."""
def create_control(self, parent):
"""Create the toolkit-specific control that represents the view."""
<|body_0|>
def _on_scenes_changed(self, event):
"""Dynamic trait change handler. This is called when scenes ar... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BrowserView:
"""The TVTK pipeline browser view."""
def create_control(self, parent):
"""Create the toolkit-specific control that represents the view."""
from enthought.tvtk.pipeline.browser import PipelineBrowser
self.browser = PipelineBrowser()
self.browser.show(parent=pa... | the_stack_v2_python_sparse | maps/build/mayavi/enthought/tvtk/plugins/browser/browser_view.py | m-elhussieny/code | train | 0 |
cb4617bfd62cf707bf596ee8ea9eb768b7fbc76c | [
"obj = self.get(id=pk)\nobj.pk = None\nobj.title += ' (cloned)'\nobj.save()\nreturn obj",
"if not get_user_model().objects.filter(username=new_uid).exists():\n logger.debug('UID %s does not exist. Getting it from LDAP.' % new_uid)\n ldapobj = LDAPBackend()\n user = ldapobj.populate_user(new_uid)\n if ... | <|body_start_0|>
obj = self.get(id=pk)
obj.pk = None
obj.title += ' (cloned)'
obj.save()
return obj
<|end_body_0|>
<|body_start_1|>
if not get_user_model().objects.filter(username=new_uid).exists():
logger.debug('UID %s does not exist. Getting it from LDAP.' ... | Configuration go here!! | ConfigurationManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConfigurationManager:
"""Configuration go here!!"""
def clone(self, pk):
"""Clone an object and returns"""
<|body_0|>
def clone_and_assign_new_uid(self, pk, new_uid):
"""if new_uid is not on the DB, populates it from the ldap"""
<|body_1|>
def clone_... | stack_v2_sparse_classes_36k_train_028279 | 3,440 | no_license | [
{
"docstring": "Clone an object and returns",
"name": "clone",
"signature": "def clone(self, pk)"
},
{
"docstring": "if new_uid is not on the DB, populates it from the ldap",
"name": "clone_and_assign_new_uid",
"signature": "def clone_and_assign_new_uid(self, pk, new_uid)"
},
{
"... | 3 | stack_v2_sparse_classes_30k_train_000587 | Implement the Python class `ConfigurationManager` described below.
Class description:
Configuration go here!!
Method signatures and docstrings:
- def clone(self, pk): Clone an object and returns
- def clone_and_assign_new_uid(self, pk, new_uid): if new_uid is not on the DB, populates it from the ldap
- def clone_and_... | Implement the Python class `ConfigurationManager` described below.
Class description:
Configuration go here!!
Method signatures and docstrings:
- def clone(self, pk): Clone an object and returns
- def clone_and_assign_new_uid(self, pk, new_uid): if new_uid is not on the DB, populates it from the ldap
- def clone_and_... | 507ff81617abf583edd4ef4858985daefc0afcbe | <|skeleton|>
class ConfigurationManager:
"""Configuration go here!!"""
def clone(self, pk):
"""Clone an object and returns"""
<|body_0|>
def clone_and_assign_new_uid(self, pk, new_uid):
"""if new_uid is not on the DB, populates it from the ldap"""
<|body_1|>
def clone_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ConfigurationManager:
"""Configuration go here!!"""
def clone(self, pk):
"""Clone an object and returns"""
obj = self.get(id=pk)
obj.pk = None
obj.title += ' (cloned)'
obj.save()
return obj
def clone_and_assign_new_uid(self, pk, new_uid):
"""if... | the_stack_v2_python_sparse | src/server/apps/configuration/models/abstract.py | bidochon/WebReduction | train | 0 |
e89a149388e0a425974768dfe727f30a495ec9f8 | [
"value = '<div>'\nclase = 'actions_fase'\ncontroller = './'\nif UrlParser.parse_nombre(request.url, 'post_buscar'):\n controller = '../'\nid_fase = UrlParser.parse_id(request.url, 'fases')\nid = str(obj.id_lb)\nif PoseePermiso('abrir-cerrar lb', id_fase=id_fase).is_met(request.environ):\n if obj.estado in [u'... | <|body_start_0|>
value = '<div>'
clase = 'actions_fase'
controller = './'
if UrlParser.parse_nombre(request.url, 'post_buscar'):
controller = '../'
id_fase = UrlParser.parse_id(request.url, 'fases')
id = str(obj.id_lb)
if PoseePermiso('abrir-cerrar lb'... | LineaBaseTableFiller | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LineaBaseTableFiller:
def __actions__(self, obj):
"""Links de acciones para un registro dado"""
<|body_0|>
def _do_get_provider_count_and_objs(self, id_fase=None, id_lb=None, **kw):
"""Recupera las lineas bases de una fase, o aquellas para las que tenemos algún permi... | stack_v2_sparse_classes_36k_train_028280 | 21,724 | no_license | [
{
"docstring": "Links de acciones para un registro dado",
"name": "__actions__",
"signature": "def __actions__(self, obj)"
},
{
"docstring": "Recupera las lineas bases de una fase, o aquellas para las que tenemos algún permiso.",
"name": "_do_get_provider_count_and_objs",
"signature": "d... | 2 | stack_v2_sparse_classes_30k_train_017510 | Implement the Python class `LineaBaseTableFiller` described below.
Class description:
Implement the LineaBaseTableFiller class.
Method signatures and docstrings:
- def __actions__(self, obj): Links de acciones para un registro dado
- def _do_get_provider_count_and_objs(self, id_fase=None, id_lb=None, **kw): Recupera ... | Implement the Python class `LineaBaseTableFiller` described below.
Class description:
Implement the LineaBaseTableFiller class.
Method signatures and docstrings:
- def __actions__(self, obj): Links de acciones para un registro dado
- def _do_get_provider_count_and_objs(self, id_fase=None, id_lb=None, **kw): Recupera ... | 997531e130d1951b483f4a6a67f2df7467cd9fd1 | <|skeleton|>
class LineaBaseTableFiller:
def __actions__(self, obj):
"""Links de acciones para un registro dado"""
<|body_0|>
def _do_get_provider_count_and_objs(self, id_fase=None, id_lb=None, **kw):
"""Recupera las lineas bases de una fase, o aquellas para las que tenemos algún permi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LineaBaseTableFiller:
def __actions__(self, obj):
"""Links de acciones para un registro dado"""
value = '<div>'
clase = 'actions_fase'
controller = './'
if UrlParser.parse_nombre(request.url, 'post_buscar'):
controller = '../'
id_fase = UrlParser.par... | the_stack_v2_python_sparse | lpm/controllers/lineabase.py | jorgeramirez/LPM | train | 1 | |
33f01f6a41f63f4a22c9c3457d71ed2d44853e5e | [
"super(AccelerateToVelocity, self).__init__(name)\nself.logger.debug('%s.__init__()' % self.__class__.__name__)\nself._control = carla.VehicleControl()\nself._actor = actor\nself._throttle_value = throttle_value\nself._target_velocity = target_velocity\nself._control.steering = 0",
"new_status = py_trees.common.S... | <|body_start_0|>
super(AccelerateToVelocity, self).__init__(name)
self.logger.debug('%s.__init__()' % self.__class__.__name__)
self._control = carla.VehicleControl()
self._actor = actor
self._throttle_value = throttle_value
self._target_velocity = target_velocity
... | This class contains an atomic acceleration behavior. The controlled traffic participant will accelerate with _throttle_value_ until reaching a given _target_velocity_ | AccelerateToVelocity | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AccelerateToVelocity:
"""This class contains an atomic acceleration behavior. The controlled traffic participant will accelerate with _throttle_value_ until reaching a given _target_velocity_"""
def __init__(self, actor, throttle_value, target_velocity, name='Acceleration'):
"""Setup... | stack_v2_sparse_classes_36k_train_028281 | 25,380 | permissive | [
{
"docstring": "Setup parameters including acceleration value (via throttle_value) and target velocity",
"name": "__init__",
"signature": "def __init__(self, actor, throttle_value, target_velocity, name='Acceleration')"
},
{
"docstring": "Set throttle to throttle_value, as long as velocity is < ... | 2 | stack_v2_sparse_classes_30k_train_014214 | Implement the Python class `AccelerateToVelocity` described below.
Class description:
This class contains an atomic acceleration behavior. The controlled traffic participant will accelerate with _throttle_value_ until reaching a given _target_velocity_
Method signatures and docstrings:
- def __init__(self, actor, thr... | Implement the Python class `AccelerateToVelocity` described below.
Class description:
This class contains an atomic acceleration behavior. The controlled traffic participant will accelerate with _throttle_value_ until reaching a given _target_velocity_
Method signatures and docstrings:
- def __init__(self, actor, thr... | 1d3e8339f8e60f7bdcaefeff49ec238b1746b047 | <|skeleton|>
class AccelerateToVelocity:
"""This class contains an atomic acceleration behavior. The controlled traffic participant will accelerate with _throttle_value_ until reaching a given _target_velocity_"""
def __init__(self, actor, throttle_value, target_velocity, name='Acceleration'):
"""Setup... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AccelerateToVelocity:
"""This class contains an atomic acceleration behavior. The controlled traffic participant will accelerate with _throttle_value_ until reaching a given _target_velocity_"""
def __init__(self, actor, throttle_value, target_velocity, name='Acceleration'):
"""Setup parameters i... | the_stack_v2_python_sparse | srunner/scenariomanager/atomic_scenario_behavior.py | chauvinSimon/scenario_runner | train | 2 |
b646f8da92e2d5ea0b22ef3db8ac593d1043997d | [
"self.format = format\nself.encoding = encoding\nself.index = index",
"if self.format == 'json_map':\n try:\n return assert_list(json.loads(content.decode(self.encoding))[self.index])\n except (KeyError, UnicodeDecodeError, ValueError) as e:\n raise self.ResponseParserError('Error while parsin... | <|body_start_0|>
self.format = format
self.encoding = encoding
self.index = index
<|end_body_0|>
<|body_start_1|>
if self.format == 'json_map':
try:
return assert_list(json.loads(content.decode(self.encoding))[self.index])
except (KeyError, Unicod... | Resolver response parser utility class. :API: public | ResponseParser | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResponseParser:
"""Resolver response parser utility class. :API: public"""
def __init__(self, format='json_map', encoding='utf-8', index='hostlist'):
""":API: public"""
<|body_0|>
def parse(self, content):
"""Parse raw response content for a list of remote artifa... | stack_v2_sparse_classes_36k_train_028282 | 3,806 | permissive | [
{
"docstring": ":API: public",
"name": "__init__",
"signature": "def __init__(self, format='json_map', encoding='utf-8', index='hostlist')"
},
{
"docstring": "Parse raw response content for a list of remote artifact cache URLs. :API: public",
"name": "parse",
"signature": "def parse(self... | 2 | null | Implement the Python class `ResponseParser` described below.
Class description:
Resolver response parser utility class. :API: public
Method signatures and docstrings:
- def __init__(self, format='json_map', encoding='utf-8', index='hostlist'): :API: public
- def parse(self, content): Parse raw response content for a ... | Implement the Python class `ResponseParser` described below.
Class description:
Resolver response parser utility class. :API: public
Method signatures and docstrings:
- def __init__(self, format='json_map', encoding='utf-8', index='hostlist'): :API: public
- def parse(self, content): Parse raw response content for a ... | f0627cfa6ab05fc9a10686a499d1fb1d6ebdb68b | <|skeleton|>
class ResponseParser:
"""Resolver response parser utility class. :API: public"""
def __init__(self, format='json_map', encoding='utf-8', index='hostlist'):
""":API: public"""
<|body_0|>
def parse(self, content):
"""Parse raw response content for a list of remote artifa... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ResponseParser:
"""Resolver response parser utility class. :API: public"""
def __init__(self, format='json_map', encoding='utf-8', index='hostlist'):
""":API: public"""
self.format = format
self.encoding = encoding
self.index = index
def parse(self, content):
... | the_stack_v2_python_sparse | src/python/pants/cache/resolver.py | foursquare/pants | train | 1 |
a076e171968789c1698e6b08a516acf4761d1a9e | [
"params = kwarg['params']\ncmd = 'tc chain {} '.format(command)\nreturn cmd",
"params = kwarg['params']\ncmd = 'tc chain {} '.format(command)\nreturn cmd"
] | <|body_start_0|>
params = kwarg['params']
cmd = 'tc chain {} '.format(command)
return cmd
<|end_body_0|>
<|body_start_1|>
params = kwarg['params']
cmd = 'tc chain {} '.format(command)
return cmd
<|end_body_1|>
| LinuxTcChainImpl | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LinuxTcChainImpl:
def format_modify(self, command, *argv, **kwarg):
"""tc [ OPTIONS ] chain [ add | delete | get ] dev DEV [ parent qdisc-id | root ] filtertype [ filtertype specific parameters ] tc [ OPTIONS ] chain [ add | delete | get ] block BLOCK_INDEX filtertype [ filter‐ type spec... | stack_v2_sparse_classes_36k_train_028283 | 945 | permissive | [
{
"docstring": "tc [ OPTIONS ] chain [ add | delete | get ] dev DEV [ parent qdisc-id | root ] filtertype [ filtertype specific parameters ] tc [ OPTIONS ] chain [ add | delete | get ] block BLOCK_INDEX filtertype [ filter‐ type specific parameters ]",
"name": "format_modify",
"signature": "def format_m... | 2 | stack_v2_sparse_classes_30k_val_000377 | Implement the Python class `LinuxTcChainImpl` described below.
Class description:
Implement the LinuxTcChainImpl class.
Method signatures and docstrings:
- def format_modify(self, command, *argv, **kwarg): tc [ OPTIONS ] chain [ add | delete | get ] dev DEV [ parent qdisc-id | root ] filtertype [ filtertype specific ... | Implement the Python class `LinuxTcChainImpl` described below.
Class description:
Implement the LinuxTcChainImpl class.
Method signatures and docstrings:
- def format_modify(self, command, *argv, **kwarg): tc [ OPTIONS ] chain [ add | delete | get ] dev DEV [ parent qdisc-id | root ] filtertype [ filtertype specific ... | e4c8221e18cd94e7424c30e12eb0fb82f7767267 | <|skeleton|>
class LinuxTcChainImpl:
def format_modify(self, command, *argv, **kwarg):
"""tc [ OPTIONS ] chain [ add | delete | get ] dev DEV [ parent qdisc-id | root ] filtertype [ filtertype specific parameters ] tc [ OPTIONS ] chain [ add | delete | get ] block BLOCK_INDEX filtertype [ filter‐ type spec... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LinuxTcChainImpl:
def format_modify(self, command, *argv, **kwarg):
"""tc [ OPTIONS ] chain [ add | delete | get ] dev DEV [ parent qdisc-id | root ] filtertype [ filtertype specific parameters ] tc [ OPTIONS ] chain [ add | delete | get ] block BLOCK_INDEX filtertype [ filter‐ type specific parameter... | the_stack_v2_python_sparse | Amazon_Framework/DentOsTestbedLib/src/dent_os_testbed/lib/tc/linux/linux_tc_chain_impl.py | tld3daniel/testing | train | 0 | |
7e83908737f415d44a76619161db6b95cbc5b415 | [
"if item != 'maps' and (not item.endswith('.txt')):\n item = item + '.txt'\nif item in self:\n return super(_DictionaryOfMapLists, self).__getitem__(item)\nvalue = self[item] = _MapList(item)\nreturn value",
"source = int(ServerVar('gg_map_vote_list_source'))\nif source in source_types:\n return self[str... | <|body_start_0|>
if item != 'maps' and (not item.endswith('.txt')):
item = item + '.txt'
if item in self:
return super(_DictionaryOfMapLists, self).__getitem__(item)
value = self[item] = _MapList(item)
return value
<|end_body_0|>
<|body_start_1|>
source =... | Class used to store all map lists when initiated | _DictionaryOfMapLists | [
"Artistic-1.0",
"LicenseRef-scancode-public-domain"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _DictionaryOfMapLists:
"""Class used to store all map lists when initiated"""
def __getitem__(self, item):
"""Override the __getitem__ method to store items as a _MapList instance"""
<|body_0|>
def current(self):
"""Returns the current maplist"""
<|body_1... | stack_v2_sparse_classes_36k_train_028284 | 5,517 | permissive | [
{
"docstring": "Override the __getitem__ method to store items as a _MapList instance",
"name": "__getitem__",
"signature": "def __getitem__(self, item)"
},
{
"docstring": "Returns the current maplist",
"name": "current",
"signature": "def current(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_008497 | Implement the Python class `_DictionaryOfMapLists` described below.
Class description:
Class used to store all map lists when initiated
Method signatures and docstrings:
- def __getitem__(self, item): Override the __getitem__ method to store items as a _MapList instance
- def current(self): Returns the current maplis... | Implement the Python class `_DictionaryOfMapLists` described below.
Class description:
Class used to store all map lists when initiated
Method signatures and docstrings:
- def __getitem__(self, item): Override the __getitem__ method to store items as a _MapList instance
- def current(self): Returns the current maplis... | ebf4624626266f552189a32612b8d09cd5b4c5a3 | <|skeleton|>
class _DictionaryOfMapLists:
"""Class used to store all map lists when initiated"""
def __getitem__(self, item):
"""Override the __getitem__ method to store items as a _MapList instance"""
<|body_0|>
def current(self):
"""Returns the current maplist"""
<|body_1... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _DictionaryOfMapLists:
"""Class used to store all map lists when initiated"""
def __getitem__(self, item):
"""Override the __getitem__ method to store items as a _MapList instance"""
if item != 'maps' and (not item.endswith('.txt')):
item = item + '.txt'
if item in sel... | the_stack_v2_python_sparse | cstrike/addons/eventscripts/gungame51/scripts/included/gg_map_vote/modules/maplists.py | GunGame-Dev-Team/GunGame51 | train | 0 |
86acbfae0409f8a112f9946006172131aa1c4be8 | [
"if updater is None:\n raise ValueError('No updater specified')\nelif not isinstance(updater, UpdateProtocol):\n raise ValueError(\"updater '%r' is not an instance of '%r'\" % (updater, UpdateProtocol))\nelse:\n self.updater = updater\nif detector is None:\n LOG.warning('No IP detector specified, fallin... | <|body_start_0|>
if updater is None:
raise ValueError('No updater specified')
elif not isinstance(updater, UpdateProtocol):
raise ValueError("updater '%r' is not an instance of '%r'" % (updater, UpdateProtocol))
else:
self.updater = updater
if detector... | This class represents a client to the dynamic dns service. | DynDnsClient | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DynDnsClient:
"""This class represents a client to the dynamic dns service."""
def __init__(self, updater=None, detector=None, plugins=None, detect_interval=300):
"""Initialize. :param detect_interval: amount of time in seconds that can elapse between checks"""
<|body_0|>
... | stack_v2_sparse_classes_36k_train_028285 | 7,339 | permissive | [
{
"docstring": "Initialize. :param detect_interval: amount of time in seconds that can elapse between checks",
"name": "__init__",
"signature": "def __init__(self, updater=None, detector=None, plugins=None, detect_interval=300)"
},
{
"docstring": "Synchronize the registered IP with the detected ... | 6 | stack_v2_sparse_classes_30k_train_019793 | Implement the Python class `DynDnsClient` described below.
Class description:
This class represents a client to the dynamic dns service.
Method signatures and docstrings:
- def __init__(self, updater=None, detector=None, plugins=None, detect_interval=300): Initialize. :param detect_interval: amount of time in seconds... | Implement the Python class `DynDnsClient` described below.
Class description:
This class represents a client to the dynamic dns service.
Method signatures and docstrings:
- def __init__(self, updater=None, detector=None, plugins=None, detect_interval=300): Initialize. :param detect_interval: amount of time in seconds... | f5102935281ef1e9f2b85ecb34cb4c5cbd97036d | <|skeleton|>
class DynDnsClient:
"""This class represents a client to the dynamic dns service."""
def __init__(self, updater=None, detector=None, plugins=None, detect_interval=300):
"""Initialize. :param detect_interval: amount of time in seconds that can elapse between checks"""
<|body_0|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DynDnsClient:
"""This class represents a client to the dynamic dns service."""
def __init__(self, updater=None, detector=None, plugins=None, detect_interval=300):
"""Initialize. :param detect_interval: amount of time in seconds that can elapse between checks"""
if updater is None:
... | the_stack_v2_python_sparse | dyndnsc/core.py | infothrill/python-dyndnsc | train | 39 |
1bebf5d0ceac2ebb9379f272ee52d5b9dac018d6 | [
"key = LibraryLocatorV2.from_string(lib_key_str)\napi.require_permission_for_library_key(key, request.user, permissions.CAN_VIEW_THIS_CONTENT_LIBRARY)\nresult = api.get_library(key)\nreturn Response(ContentLibraryMetadataSerializer(result).data)",
"key = LibraryLocatorV2.from_string(lib_key_str)\napi.require_perm... | <|body_start_0|>
key = LibraryLocatorV2.from_string(lib_key_str)
api.require_permission_for_library_key(key, request.user, permissions.CAN_VIEW_THIS_CONTENT_LIBRARY)
result = api.get_library(key)
return Response(ContentLibraryMetadataSerializer(result).data)
<|end_body_0|>
<|body_start_... | Views to work with a specific content library | LibraryDetailsView | [
"AGPL-3.0-only",
"AGPL-3.0-or-later",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LibraryDetailsView:
"""Views to work with a specific content library"""
def get(self, request, lib_key_str):
"""Get a specific content library"""
<|body_0|>
def patch(self, request, lib_key_str):
"""Update a content library"""
<|body_1|>
def delete(s... | stack_v2_sparse_classes_36k_train_028286 | 42,120 | permissive | [
{
"docstring": "Get a specific content library",
"name": "get",
"signature": "def get(self, request, lib_key_str)"
},
{
"docstring": "Update a content library",
"name": "patch",
"signature": "def patch(self, request, lib_key_str)"
},
{
"docstring": "Delete a content library",
... | 3 | null | Implement the Python class `LibraryDetailsView` described below.
Class description:
Views to work with a specific content library
Method signatures and docstrings:
- def get(self, request, lib_key_str): Get a specific content library
- def patch(self, request, lib_key_str): Update a content library
- def delete(self,... | Implement the Python class `LibraryDetailsView` described below.
Class description:
Views to work with a specific content library
Method signatures and docstrings:
- def get(self, request, lib_key_str): Get a specific content library
- def patch(self, request, lib_key_str): Update a content library
- def delete(self,... | 5809eaca7079a15ee56b0b7fcfea425337046c97 | <|skeleton|>
class LibraryDetailsView:
"""Views to work with a specific content library"""
def get(self, request, lib_key_str):
"""Get a specific content library"""
<|body_0|>
def patch(self, request, lib_key_str):
"""Update a content library"""
<|body_1|>
def delete(s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LibraryDetailsView:
"""Views to work with a specific content library"""
def get(self, request, lib_key_str):
"""Get a specific content library"""
key = LibraryLocatorV2.from_string(lib_key_str)
api.require_permission_for_library_key(key, request.user, permissions.CAN_VIEW_THIS_CON... | the_stack_v2_python_sparse | Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/openedx/core/djangoapps/content_libraries/views.py | luque/better-ways-of-thinking-about-software | train | 3 |
251758d6fa340d2d026cbddecd3386a14dc91a07 | [
"if provider:\n if args.get('region') and provider.region != args['region']:\n LOGGER.debug('not using provider; requested region does not match')\n return False\n LOGGER.debug('using provider')\n return True\nreturn False",
"LOGGER.debug('describing stack: %s', query.stack_name)\nstack = c... | <|body_start_0|>
if provider:
if args.get('region') and provider.region != args['region']:
LOGGER.debug('not using provider; requested region does not match')
return False
LOGGER.debug('using provider')
return True
return False
<|end_bo... | CloudFormation Stack Output lookup. | CfnLookup | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CfnLookup:
"""CloudFormation Stack Output lookup."""
def should_use_provider(args: Dict[str, str], provider: Optional[Provider]) -> bool:
"""Determine if the provider should be used for the lookup. This will open happen when the lookup is used with CFNgin. Args: args: Parsed argument... | stack_v2_sparse_classes_36k_train_028287 | 4,919 | permissive | [
{
"docstring": "Determine if the provider should be used for the lookup. This will open happen when the lookup is used with CFNgin. Args: args: Parsed arguments provided to the lookup. provider: CFNgin provider.",
"name": "should_use_provider",
"signature": "def should_use_provider(args: Dict[str, str],... | 3 | null | Implement the Python class `CfnLookup` described below.
Class description:
CloudFormation Stack Output lookup.
Method signatures and docstrings:
- def should_use_provider(args: Dict[str, str], provider: Optional[Provider]) -> bool: Determine if the provider should be used for the lookup. This will open happen when th... | Implement the Python class `CfnLookup` described below.
Class description:
CloudFormation Stack Output lookup.
Method signatures and docstrings:
- def should_use_provider(args: Dict[str, str], provider: Optional[Provider]) -> bool: Determine if the provider should be used for the lookup. This will open happen when th... | 0763b06aee07d2cf3f037a49ca0cb81a048c5deb | <|skeleton|>
class CfnLookup:
"""CloudFormation Stack Output lookup."""
def should_use_provider(args: Dict[str, str], provider: Optional[Provider]) -> bool:
"""Determine if the provider should be used for the lookup. This will open happen when the lookup is used with CFNgin. Args: args: Parsed argument... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CfnLookup:
"""CloudFormation Stack Output lookup."""
def should_use_provider(args: Dict[str, str], provider: Optional[Provider]) -> bool:
"""Determine if the provider should be used for the lookup. This will open happen when the lookup is used with CFNgin. Args: args: Parsed arguments provided to... | the_stack_v2_python_sparse | runway/lookups/handlers/cfn.py | onicagroup/runway | train | 156 |
ae9237b196abd683aaa021043cb239ec62808d12 | [
"self.wage, self.age = np.loadtxt(filename, delimiter=',', usecols=(0, 1), unpack=True, dtype=float, comments='#')\nself.doneSort = False\nself.arr = self.wage",
"if self.doneSort == False:\n self.sortArray()\nw, thisQ = binarySearch(self.sortArr, thisW)\nreturn thisQ / self.sortArr.shape[0] * 100"
] | <|body_start_0|>
self.wage, self.age = np.loadtxt(filename, delimiter=',', usecols=(0, 1), unpack=True, dtype=float, comments='#')
self.doneSort = False
self.arr = self.wage
<|end_body_0|>
<|body_start_1|>
if self.doneSort == False:
self.sortArray()
w, thisQ = binary... | Class to hold and manipulate data | newSorter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class newSorter:
"""Class to hold and manipulate data"""
def __init__(self, filename):
"""Initialise by reading data from a file"""
<|body_0|>
def findQuartile(self, thisW):
"""Find a quartile of percentage q"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_028288 | 2,267 | no_license | [
{
"docstring": "Initialise by reading data from a file",
"name": "__init__",
"signature": "def __init__(self, filename)"
},
{
"docstring": "Find a quartile of percentage q",
"name": "findQuartile",
"signature": "def findQuartile(self, thisW)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006064 | Implement the Python class `newSorter` described below.
Class description:
Class to hold and manipulate data
Method signatures and docstrings:
- def __init__(self, filename): Initialise by reading data from a file
- def findQuartile(self, thisW): Find a quartile of percentage q | Implement the Python class `newSorter` described below.
Class description:
Class to hold and manipulate data
Method signatures and docstrings:
- def __init__(self, filename): Initialise by reading data from a file
- def findQuartile(self, thisW): Find a quartile of percentage q
<|skeleton|>
class newSorter:
"""C... | 6b44963217e1f8358123920155f2794527b43b21 | <|skeleton|>
class newSorter:
"""Class to hold and manipulate data"""
def __init__(self, filename):
"""Initialise by reading data from a file"""
<|body_0|>
def findQuartile(self, thisW):
"""Find a quartile of percentage q"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class newSorter:
"""Class to hold and manipulate data"""
def __init__(self, filename):
"""Initialise by reading data from a file"""
self.wage, self.age = np.loadtxt(filename, delimiter=',', usecols=(0, 1), unpack=True, dtype=float, comments='#')
self.doneSort = False
self.arr = ... | the_stack_v2_python_sparse | week2/binary_search/finishedQuartiles.py | edinburgh-university-OOSA/OOSA-code-public | train | 5 |
f9536df9852c4d11ef853d101cf5f1d93f2ec65f | [
"self.args = args\nself.train_args = load_args(args.checkpoint_paths[0])\nif (self.train_args.features_path is not None or self.train_args.features_generator is not None) and args.features_generator is None:\n raise ValueError('Features were used during training so they must be specified again during prediction ... | <|body_start_0|>
self.args = args
self.train_args = load_args(args.checkpoint_paths[0])
if (self.train_args.features_path is not None or self.train_args.features_generator is not None) and args.features_generator is None:
raise ValueError('Features were used during training so they m... | A :class:`ChempropModel` is a wrapper around a :class:`~chemprop.models.model.MoleculeModel` for interpretation. | ChempropModel | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChempropModel:
"""A :class:`ChempropModel` is a wrapper around a :class:`~chemprop.models.model.MoleculeModel` for interpretation."""
def __init__(self, args: InterpretArgs) -> None:
""":param args: A :class:`~chemprop.args.InterpretArgs` object containing arguments for interpretatio... | stack_v2_sparse_classes_36k_train_028289 | 13,921 | permissive | [
{
"docstring": ":param args: A :class:`~chemprop.args.InterpretArgs` object containing arguments for interpretation.",
"name": "__init__",
"signature": "def __init__(self, args: InterpretArgs) -> None"
},
{
"docstring": "Makes predictions on a list of SMILES. :param smiles: A list of SMILES to m... | 2 | null | Implement the Python class `ChempropModel` described below.
Class description:
A :class:`ChempropModel` is a wrapper around a :class:`~chemprop.models.model.MoleculeModel` for interpretation.
Method signatures and docstrings:
- def __init__(self, args: InterpretArgs) -> None: :param args: A :class:`~chemprop.args.Int... | Implement the Python class `ChempropModel` described below.
Class description:
A :class:`ChempropModel` is a wrapper around a :class:`~chemprop.models.model.MoleculeModel` for interpretation.
Method signatures and docstrings:
- def __init__(self, args: InterpretArgs) -> None: :param args: A :class:`~chemprop.args.Int... | f3d1bff19a6e1b03d28e9cfabdf4c80dd8c67382 | <|skeleton|>
class ChempropModel:
"""A :class:`ChempropModel` is a wrapper around a :class:`~chemprop.models.model.MoleculeModel` for interpretation."""
def __init__(self, args: InterpretArgs) -> None:
""":param args: A :class:`~chemprop.args.InterpretArgs` object containing arguments for interpretatio... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ChempropModel:
"""A :class:`ChempropModel` is a wrapper around a :class:`~chemprop.models.model.MoleculeModel` for interpretation."""
def __init__(self, args: InterpretArgs) -> None:
""":param args: A :class:`~chemprop.args.InterpretArgs` object containing arguments for interpretation."""
... | the_stack_v2_python_sparse | chemprop/interpret.py | chemprop/chemprop | train | 1,139 |
eca0b321a0e50117f6e6279a032335409d667249 | [
"for s, t in zip_longest(self.get_next(S), self.get_next(T)):\n if s != t:\n return False\nreturn True",
"hash_count = 0\nfor c in reversed(s):\n if c == '#':\n hash_count += 1\n elif hash_count > 0:\n hash_count -= 1\n else:\n yield c"
] | <|body_start_0|>
for s, t in zip_longest(self.get_next(S), self.get_next(T)):
if s != t:
return False
return True
<|end_body_0|>
<|body_start_1|>
hash_count = 0
for c in reversed(s):
if c == '#':
hash_count += 1
elif ha... | Runtime: 24 ms, faster than 99.92% of Python3 online submissions for Backspace String Compare. Memory Usage: 13.3 MB, less than 9.92% of Python3 online submissions for Backspace String Compare. | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""Runtime: 24 ms, faster than 99.92% of Python3 online submissions for Backspace String Compare. Memory Usage: 13.3 MB, less than 9.92% of Python3 online submissions for Backspace String Compare."""
def backspaceCompare(self, S, T):
"""Given two strings S and T, return if ... | stack_v2_sparse_classes_36k_train_028290 | 1,928 | no_license | [
{
"docstring": "Given two strings S and T, return if they are equal when both are typed into empty text editors. # means a backspace character. Example 1: Input: S = \"ab#c\", T = \"ad#c\" Output: true Explanation: Both S and T become \"ac\". Example 2: Input: S = \"ab##\", T = \"c#d#\" Output: true Explanation... | 2 | stack_v2_sparse_classes_30k_train_006133 | Implement the Python class `Solution` described below.
Class description:
Runtime: 24 ms, faster than 99.92% of Python3 online submissions for Backspace String Compare. Memory Usage: 13.3 MB, less than 9.92% of Python3 online submissions for Backspace String Compare.
Method signatures and docstrings:
- def backspaceC... | Implement the Python class `Solution` described below.
Class description:
Runtime: 24 ms, faster than 99.92% of Python3 online submissions for Backspace String Compare. Memory Usage: 13.3 MB, less than 9.92% of Python3 online submissions for Backspace String Compare.
Method signatures and docstrings:
- def backspaceC... | 01fe893ba2e37c9bda79e3081c556698f0b6d2f0 | <|skeleton|>
class Solution:
"""Runtime: 24 ms, faster than 99.92% of Python3 online submissions for Backspace String Compare. Memory Usage: 13.3 MB, less than 9.92% of Python3 online submissions for Backspace String Compare."""
def backspaceCompare(self, S, T):
"""Given two strings S and T, return if ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
"""Runtime: 24 ms, faster than 99.92% of Python3 online submissions for Backspace String Compare. Memory Usage: 13.3 MB, less than 9.92% of Python3 online submissions for Backspace String Compare."""
def backspaceCompare(self, S, T):
"""Given two strings S and T, return if they are equa... | the_stack_v2_python_sparse | LeetCode/844_backspace_string_compare.py | KKosukeee/CodingQuestions | train | 1 |
725638e3324986a74500d31db22aae5ed36aa4d7 | [
"self.matrix = matrix\nself.prefix_sum = [[0 for i in range(len(matrix[0]))] for j in range(len(matrix))]\nfor i in range(len(matrix)):\n for j in range(len(matrix[0])):\n if i == 0:\n self.prefix_sum[i][j] = matrix[i][j]\n else:\n self.prefix_sum[i][j] = matrix[i][j] + self.p... | <|body_start_0|>
self.matrix = matrix
self.prefix_sum = [[0 for i in range(len(matrix[0]))] for j in range(len(matrix))]
for i in range(len(matrix)):
for j in range(len(matrix[0])):
if i == 0:
self.prefix_sum[i][j] = matrix[i][j]
el... | NumMatrix1 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NumMatrix1:
def __init__(self, matrix):
""":type matrix: List[List[int]]"""
<|body_0|>
def update(self, row, col, val):
""":type row: int :type col: int :type val: int :rtype: void"""
<|body_1|>
def sumRegion(self, row1, col1, row2, col2):
""":ty... | stack_v2_sparse_classes_36k_train_028291 | 4,080 | no_license | [
{
"docstring": ":type matrix: List[List[int]]",
"name": "__init__",
"signature": "def __init__(self, matrix)"
},
{
"docstring": ":type row: int :type col: int :type val: int :rtype: void",
"name": "update",
"signature": "def update(self, row, col, val)"
},
{
"docstring": ":type r... | 3 | null | Implement the Python class `NumMatrix1` described below.
Class description:
Implement the NumMatrix1 class.
Method signatures and docstrings:
- def __init__(self, matrix): :type matrix: List[List[int]]
- def update(self, row, col, val): :type row: int :type col: int :type val: int :rtype: void
- def sumRegion(self, r... | Implement the Python class `NumMatrix1` described below.
Class description:
Implement the NumMatrix1 class.
Method signatures and docstrings:
- def __init__(self, matrix): :type matrix: List[List[int]]
- def update(self, row, col, val): :type row: int :type col: int :type val: int :rtype: void
- def sumRegion(self, r... | c7bf3eed366b91d6bdebb79d0f11680cf7c18344 | <|skeleton|>
class NumMatrix1:
def __init__(self, matrix):
""":type matrix: List[List[int]]"""
<|body_0|>
def update(self, row, col, val):
""":type row: int :type col: int :type val: int :rtype: void"""
<|body_1|>
def sumRegion(self, row1, col1, row2, col2):
""":ty... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NumMatrix1:
def __init__(self, matrix):
""":type matrix: List[List[int]]"""
self.matrix = matrix
self.prefix_sum = [[0 for i in range(len(matrix[0]))] for j in range(len(matrix))]
for i in range(len(matrix)):
for j in range(len(matrix[0])):
if i == 0... | the_stack_v2_python_sparse | ch09/optional/0817-range-sum-query-2d-mutable.py | zzy1120716/my-nine-chapter | train | 0 | |
aaf1cc68b214526cdbe98271be6fc697064772a1 | [
"StaticWidget.__init__(self, name, divclass)\nself.datarange = (min, max, step)\nself.width = width\nself.show_range = show_range\nif default is None:\n self.default = min\nelse:\n self.default = default",
"min, max, step = self.datarange\nimport numpy as np\nreturn np.arange(min, max + step, step)",
"sty... | <|body_start_0|>
StaticWidget.__init__(self, name, divclass)
self.datarange = (min, max, step)
self.width = width
self.show_range = show_range
if default is None:
self.default = min
else:
self.default = default
<|end_body_0|>
<|body_start_1|>
... | Range (slider) widget The class overloads :meth:`html <pyquickhelper.ipythonhelper.widgets.RangeWidget.html>` and :meth:`values <pyquickhelper.ipythonhelper.widgets.RangeWidget.values>`. | RangeWidget | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RangeWidget:
"""Range (slider) widget The class overloads :meth:`html <pyquickhelper.ipythonhelper.widgets.RangeWidget.html>` and :meth:`values <pyquickhelper.ipythonhelper.widgets.RangeWidget.values>`."""
def __init__(self, min, max, step=1, name=None, default=None, width=350, divclass=None... | stack_v2_sparse_classes_36k_train_028292 | 9,315 | permissive | [
{
"docstring": "@param min min value @param max max value @param step step @param name name @param default default value @param width width in pixel @param divclass class for div section @param show_range boolean",
"name": "__init__",
"signature": "def __init__(self, min, max, step=1, name=None, default... | 3 | stack_v2_sparse_classes_30k_train_011184 | Implement the Python class `RangeWidget` described below.
Class description:
Range (slider) widget The class overloads :meth:`html <pyquickhelper.ipythonhelper.widgets.RangeWidget.html>` and :meth:`values <pyquickhelper.ipythonhelper.widgets.RangeWidget.values>`.
Method signatures and docstrings:
- def __init__(self,... | Implement the Python class `RangeWidget` described below.
Class description:
Range (slider) widget The class overloads :meth:`html <pyquickhelper.ipythonhelper.widgets.RangeWidget.html>` and :meth:`values <pyquickhelper.ipythonhelper.widgets.RangeWidget.values>`.
Method signatures and docstrings:
- def __init__(self,... | 860ec5b9a53bae4fc616076c0b52dbe2a1153d30 | <|skeleton|>
class RangeWidget:
"""Range (slider) widget The class overloads :meth:`html <pyquickhelper.ipythonhelper.widgets.RangeWidget.html>` and :meth:`values <pyquickhelper.ipythonhelper.widgets.RangeWidget.values>`."""
def __init__(self, min, max, step=1, name=None, default=None, width=350, divclass=None... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RangeWidget:
"""Range (slider) widget The class overloads :meth:`html <pyquickhelper.ipythonhelper.widgets.RangeWidget.html>` and :meth:`values <pyquickhelper.ipythonhelper.widgets.RangeWidget.values>`."""
def __init__(self, min, max, step=1, name=None, default=None, width=350, divclass=None, show_range=... | the_stack_v2_python_sparse | src/pyquickhelper/ipythonhelper/widgets.py | Pandinosaurus/pyquickhelper | train | 0 |
116472480ac9a187946ecf313adf79c484c55185 | [
"super(CNN3d, self).__init__()\nself.conv_0 = nn.Conv3d(in_channels=in_channels, out_channels=out_channels_0, kernel_size=3, stride=1, pad_mode='same', has_bias=True, weight_init=initializer.Uniform(0.01), bias_init='zeros')\nself.conv_1 = nn.Conv3d(in_channels=out_channels_0, out_channels=out_channels_1, kernel_si... | <|body_start_0|>
super(CNN3d, self).__init__()
self.conv_0 = nn.Conv3d(in_channels=in_channels, out_channels=out_channels_0, kernel_size=3, stride=1, pad_mode='same', has_bias=True, weight_init=initializer.Uniform(0.01), bias_init='zeros')
self.conv_1 = nn.Conv3d(in_channels=out_channels_0, out_... | Add a 3d convlution layer with relu and max pooling layer. x: a tensor with shape [batch_size, 2 * (stack_num+1), max_turn_num, max_turn_len, max_turn_len] Returns: a flattened tensor with shape [batch, num_features] | CNN3d | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CNN3d:
"""Add a 3d convlution layer with relu and max pooling layer. x: a tensor with shape [batch_size, 2 * (stack_num+1), max_turn_num, max_turn_len, max_turn_len] Returns: a flattened tensor with shape [batch, num_features]"""
def __init__(self, in_channels, out_channels_0, out_channels_1... | stack_v2_sparse_classes_36k_train_028293 | 9,655 | permissive | [
{
"docstring": ":param in_channels: 2 * (stack_num + 1) :param out_channels_0: ubuntu:32 douban:16 :param out_channels_1: ubuntu:16 douban:16 :param add_relu:",
"name": "__init__",
"signature": "def __init__(self, in_channels, out_channels_0, out_channels_1, add_relu=True)"
},
{
"docstring": "3d... | 2 | stack_v2_sparse_classes_30k_train_008685 | Implement the Python class `CNN3d` described below.
Class description:
Add a 3d convlution layer with relu and max pooling layer. x: a tensor with shape [batch_size, 2 * (stack_num+1), max_turn_num, max_turn_len, max_turn_len] Returns: a flattened tensor with shape [batch, num_features]
Method signatures and docstrin... | Implement the Python class `CNN3d` described below.
Class description:
Add a 3d convlution layer with relu and max pooling layer. x: a tensor with shape [batch_size, 2 * (stack_num+1), max_turn_num, max_turn_len, max_turn_len] Returns: a flattened tensor with shape [batch, num_features]
Method signatures and docstrin... | eab643f51336dbf7d711f02d27e6516e5affee59 | <|skeleton|>
class CNN3d:
"""Add a 3d convlution layer with relu and max pooling layer. x: a tensor with shape [batch_size, 2 * (stack_num+1), max_turn_num, max_turn_len, max_turn_len] Returns: a flattened tensor with shape [batch, num_features]"""
def __init__(self, in_channels, out_channels_0, out_channels_1... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CNN3d:
"""Add a 3d convlution layer with relu and max pooling layer. x: a tensor with shape [batch_size, 2 * (stack_num+1), max_turn_num, max_turn_len, max_turn_len] Returns: a flattened tensor with shape [batch, num_features]"""
def __init__(self, in_channels, out_channels_0, out_channels_1, add_relu=Tr... | the_stack_v2_python_sparse | research/nlp/dam/src/layers.py | mindspore-ai/models | train | 301 |
8c0cef3be3ccf9ea2e4f9f929f838e303d108e63 | [
"self.head, self.tail = (None, None)\nself.capacity, self.count = (capacity, 0)\nself.cache = {}",
"if not key in self.cache:\n return -1\nself.unlink_node(self.cache[key])\nself.update_tail(self.cache[key])\nreturn self.cache[key].val",
"if not self.head:\n self.head = self.tail = ListNode(key, value)\n ... | <|body_start_0|>
self.head, self.tail = (None, None)
self.capacity, self.count = (capacity, 0)
self.cache = {}
<|end_body_0|>
<|body_start_1|>
if not key in self.cache:
return -1
self.unlink_node(self.cache[key])
self.update_tail(self.cache[key])
retu... | Runtime: 236 ms, faster than 56.73% of Python3 online submissions for LRU Cache. Memory Usage: 23.3 MB, less than 6.06% of Python3 online submissions for LRU Cache. | LRUCache | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LRUCache:
"""Runtime: 236 ms, faster than 56.73% of Python3 online submissions for LRU Cache. Memory Usage: 23.3 MB, less than 6.06% of Python3 online submissions for LRU Cache."""
def __init__(self, capacity):
"""Initialization method Args: capacity(int):"""
<|body_0|>
... | stack_v2_sparse_classes_36k_train_028294 | 3,173 | no_license | [
{
"docstring": "Initialization method Args: capacity(int):",
"name": "__init__",
"signature": "def __init__(self, capacity)"
},
{
"docstring": "Get the value (will always be positive) of the key if the key exists in the cache, otherwise return -1 Args: key(int): Returns:",
"name": "get",
... | 5 | null | Implement the Python class `LRUCache` described below.
Class description:
Runtime: 236 ms, faster than 56.73% of Python3 online submissions for LRU Cache. Memory Usage: 23.3 MB, less than 6.06% of Python3 online submissions for LRU Cache.
Method signatures and docstrings:
- def __init__(self, capacity): Initializatio... | Implement the Python class `LRUCache` described below.
Class description:
Runtime: 236 ms, faster than 56.73% of Python3 online submissions for LRU Cache. Memory Usage: 23.3 MB, less than 6.06% of Python3 online submissions for LRU Cache.
Method signatures and docstrings:
- def __init__(self, capacity): Initializatio... | 01fe893ba2e37c9bda79e3081c556698f0b6d2f0 | <|skeleton|>
class LRUCache:
"""Runtime: 236 ms, faster than 56.73% of Python3 online submissions for LRU Cache. Memory Usage: 23.3 MB, less than 6.06% of Python3 online submissions for LRU Cache."""
def __init__(self, capacity):
"""Initialization method Args: capacity(int):"""
<|body_0|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LRUCache:
"""Runtime: 236 ms, faster than 56.73% of Python3 online submissions for LRU Cache. Memory Usage: 23.3 MB, less than 6.06% of Python3 online submissions for LRU Cache."""
def __init__(self, capacity):
"""Initialization method Args: capacity(int):"""
self.head, self.tail = (None,... | the_stack_v2_python_sparse | LeetCode/146_lru_cache.py | KKosukeee/CodingQuestions | train | 1 |
460e74a392f8586e88a120885f7cfe6c1400c525 | [
"\"\"\"\n Idea (direactly with extra spaces):\n 1. scan the matrix and store indexes of zeroes.\n 2. set rows and columns zeroes.\n \"\"\"\nm = len(matrix)\nn = len(matrix[0])\nif n == 0 or m == 0:\n return\nindexes = []\nfor i, row in enumerate(matrix):\n for j, element in enumera... | <|body_start_0|>
"""
Idea (direactly with extra spaces):
1. scan the matrix and store indexes of zeroes.
2. set rows and columns zeroes.
"""
m = len(matrix)
n = len(matrix[0])
if n == 0 or m == 0:
return
... | Solution | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def setZeroes(self, matrix) -> None:
"""Do not return anything, modify matrix in-place instead."""
<|body_0|>
def setZeroes_v2(self, matrix) -> None:
"""Idea (a constant space solution): 1. Scan the matrix. 2. If meet a zero, label the head elements of this... | stack_v2_sparse_classes_36k_train_028295 | 2,957 | permissive | [
{
"docstring": "Do not return anything, modify matrix in-place instead.",
"name": "setZeroes",
"signature": "def setZeroes(self, matrix) -> None"
},
{
"docstring": "Idea (a constant space solution): 1. Scan the matrix. 2. If meet a zero, label the head elements of this row and this column. For e... | 2 | stack_v2_sparse_classes_30k_train_020441 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def setZeroes(self, matrix) -> None: Do not return anything, modify matrix in-place instead.
- def setZeroes_v2(self, matrix) -> None: Idea (a constant space solution): 1. Scan t... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def setZeroes(self, matrix) -> None: Do not return anything, modify matrix in-place instead.
- def setZeroes_v2(self, matrix) -> None: Idea (a constant space solution): 1. Scan t... | 226cecde136531341ce23cdf88529345be1912fc | <|skeleton|>
class Solution:
def setZeroes(self, matrix) -> None:
"""Do not return anything, modify matrix in-place instead."""
<|body_0|>
def setZeroes_v2(self, matrix) -> None:
"""Idea (a constant space solution): 1. Scan the matrix. 2. If meet a zero, label the head elements of this... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def setZeroes(self, matrix) -> None:
"""Do not return anything, modify matrix in-place instead."""
"""
Idea (direactly with extra spaces):
1. scan the matrix and store indexes of zeroes.
2. set rows and columns zeroes.
"... | the_stack_v2_python_sparse | Leetcode/Intermediate/Array_and_string/73_Set_Matrix_Zeroes.py | ZR-Huang/AlgorithmsPractices | train | 1 | |
f1d587037d67f00fc090604e9bd7d81ab1dc1bc3 | [
"if data is None:\n if n < 1:\n raise ValueError('n must be a positive value')\n if p <= 0 or p >= 1:\n raise ValueError('p must be greater than 0 and less than 1')\n self.n = n\n self.p = p\nelse:\n if not isinstance(data, list):\n raise TypeError('data must be a list')\n if ... | <|body_start_0|>
if data is None:
if n < 1:
raise ValueError('n must be a positive value')
if p <= 0 or p >= 1:
raise ValueError('p must be greater than 0 and less than 1')
self.n = n
self.p = p
else:
if not isin... | The Binomial Class | Binomial | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Binomial:
"""The Binomial Class"""
def __init__(self, data=None, n=1, p=0.5):
"""Init of n, for number of trials, and p, probability of success"""
<|body_0|>
def factorial(self, n):
"""n factorial"""
<|body_1|>
def pmf(self, k):
"""The PMF of... | stack_v2_sparse_classes_36k_train_028296 | 1,863 | no_license | [
{
"docstring": "Init of n, for number of trials, and p, probability of success",
"name": "__init__",
"signature": "def __init__(self, data=None, n=1, p=0.5)"
},
{
"docstring": "n factorial",
"name": "factorial",
"signature": "def factorial(self, n)"
},
{
"docstring": "The PMF of ... | 4 | stack_v2_sparse_classes_30k_train_014743 | Implement the Python class `Binomial` described below.
Class description:
The Binomial Class
Method signatures and docstrings:
- def __init__(self, data=None, n=1, p=0.5): Init of n, for number of trials, and p, probability of success
- def factorial(self, n): n factorial
- def pmf(self, k): The PMF of a binomial dis... | Implement the Python class `Binomial` described below.
Class description:
The Binomial Class
Method signatures and docstrings:
- def __init__(self, data=None, n=1, p=0.5): Init of n, for number of trials, and p, probability of success
- def factorial(self, n): n factorial
- def pmf(self, k): The PMF of a binomial dis... | 4200798bdbbe828db94e5585b62a595e3a96c3e6 | <|skeleton|>
class Binomial:
"""The Binomial Class"""
def __init__(self, data=None, n=1, p=0.5):
"""Init of n, for number of trials, and p, probability of success"""
<|body_0|>
def factorial(self, n):
"""n factorial"""
<|body_1|>
def pmf(self, k):
"""The PMF of... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Binomial:
"""The Binomial Class"""
def __init__(self, data=None, n=1, p=0.5):
"""Init of n, for number of trials, and p, probability of success"""
if data is None:
if n < 1:
raise ValueError('n must be a positive value')
if p <= 0 or p >= 1:
... | the_stack_v2_python_sparse | math/0x03-probability/binomial.py | JohnCook17/holbertonschool-machine_learning | train | 3 |
c4eeb9b0f2227bc32a04f2175c8f590c52cdba29 | [
"self.restore_to_original_site = restore_to_original_site\nself.site_owner_list = site_owner_list\nself.target_document_library_name = target_document_library_name\nself.target_document_library_prefix = target_document_library_prefix\nself.target_site = target_site",
"if dictionary is None:\n return None\nrest... | <|body_start_0|>
self.restore_to_original_site = restore_to_original_site
self.site_owner_list = site_owner_list
self.target_document_library_name = target_document_library_name
self.target_document_library_prefix = target_document_library_prefix
self.target_site = target_site
<|... | Implementation of the 'SharePointRestoreParameters' model. Specifies information needed for recovering SharePoint Site and items. Attributes: restore_to_original_site (bool): Specifies whether the objects are to be restored to the original drive. site_owner_list (list of SiteOwner): Specifies the list of SharePoint Sit... | SharePointRestoreParameters | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SharePointRestoreParameters:
"""Implementation of the 'SharePointRestoreParameters' model. Specifies information needed for recovering SharePoint Site and items. Attributes: restore_to_original_site (bool): Specifies whether the objects are to be restored to the original drive. site_owner_list (l... | stack_v2_sparse_classes_36k_train_028297 | 3,700 | permissive | [
{
"docstring": "Constructor for the SharePointRestoreParameters class",
"name": "__init__",
"signature": "def __init__(self, restore_to_original_site=None, site_owner_list=None, target_document_library_name=None, target_document_library_prefix=None, target_site=None)"
},
{
"docstring": "Creates ... | 2 | stack_v2_sparse_classes_30k_val_000274 | Implement the Python class `SharePointRestoreParameters` described below.
Class description:
Implementation of the 'SharePointRestoreParameters' model. Specifies information needed for recovering SharePoint Site and items. Attributes: restore_to_original_site (bool): Specifies whether the objects are to be restored to... | Implement the Python class `SharePointRestoreParameters` described below.
Class description:
Implementation of the 'SharePointRestoreParameters' model. Specifies information needed for recovering SharePoint Site and items. Attributes: restore_to_original_site (bool): Specifies whether the objects are to be restored to... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class SharePointRestoreParameters:
"""Implementation of the 'SharePointRestoreParameters' model. Specifies information needed for recovering SharePoint Site and items. Attributes: restore_to_original_site (bool): Specifies whether the objects are to be restored to the original drive. site_owner_list (l... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SharePointRestoreParameters:
"""Implementation of the 'SharePointRestoreParameters' model. Specifies information needed for recovering SharePoint Site and items. Attributes: restore_to_original_site (bool): Specifies whether the objects are to be restored to the original drive. site_owner_list (list of SiteOw... | the_stack_v2_python_sparse | cohesity_management_sdk/models/share_point_restore_parameters.py | cohesity/management-sdk-python | train | 24 |
52444e67beaf3ab78beb93a6e2b972ba069b2c1c | [
"self.client_type = client_type\nself.sbt_params = sbt_params\nself.tags = tags",
"if dictionary is None:\n return None\nclient_type = dictionary.get('clientType')\nsbt_params = cohesity_management_sdk.models.externally_triggered_job_params_externally_triggered_sbt_params.ExternallyTriggeredJobParams_Externall... | <|body_start_0|>
self.client_type = client_type
self.sbt_params = sbt_params
self.tags = tags
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
client_type = dictionary.get('clientType')
sbt_params = cohesity_management_sdk.models.externally_... | Implementation of the 'ExternallyTriggeredJobParams' model. Message to capture any additional backup params specific to externally triggered backup job. Attributes: client_type (int): The client type for this job. sbt_params (ExternallyTriggeredJobParams_ExternallyTriggeredSbtParams): The SBT parameters. tags (list of ... | ExternallyTriggeredJobParams | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExternallyTriggeredJobParams:
"""Implementation of the 'ExternallyTriggeredJobParams' model. Message to capture any additional backup params specific to externally triggered backup job. Attributes: client_type (int): The client type for this job. sbt_params (ExternallyTriggeredJobParams_Externall... | stack_v2_sparse_classes_36k_train_028298 | 2,467 | permissive | [
{
"docstring": "Constructor for the ExternallyTriggeredJobParams class",
"name": "__init__",
"signature": "def __init__(self, client_type=None, sbt_params=None, tags=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary represen... | 2 | null | Implement the Python class `ExternallyTriggeredJobParams` described below.
Class description:
Implementation of the 'ExternallyTriggeredJobParams' model. Message to capture any additional backup params specific to externally triggered backup job. Attributes: client_type (int): The client type for this job. sbt_params ... | Implement the Python class `ExternallyTriggeredJobParams` described below.
Class description:
Implementation of the 'ExternallyTriggeredJobParams' model. Message to capture any additional backup params specific to externally triggered backup job. Attributes: client_type (int): The client type for this job. sbt_params ... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class ExternallyTriggeredJobParams:
"""Implementation of the 'ExternallyTriggeredJobParams' model. Message to capture any additional backup params specific to externally triggered backup job. Attributes: client_type (int): The client type for this job. sbt_params (ExternallyTriggeredJobParams_Externall... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ExternallyTriggeredJobParams:
"""Implementation of the 'ExternallyTriggeredJobParams' model. Message to capture any additional backup params specific to externally triggered backup job. Attributes: client_type (int): The client type for this job. sbt_params (ExternallyTriggeredJobParams_ExternallyTriggeredSbt... | the_stack_v2_python_sparse | cohesity_management_sdk/models/externally_triggered_job_params.py | cohesity/management-sdk-python | train | 24 |
29d16acbd64de712e15ce622727f04808c53b035 | [
"if warmup_type is not None:\n if warmup_type not in ['constant', 'linear', 'exp']:\n raise ValueError('\"{}\" is not a supported type for warming up, valid types are \"constant\" and \"linear\"'.format(warmup_type))\nif warmup_type is not None:\n if not isinstance(warmup_iters, int) or warmup_iters <=... | <|body_start_0|>
if warmup_type is not None:
if warmup_type not in ['constant', 'linear', 'exp']:
raise ValueError('"{}" is not a supported type for warming up, valid types are "constant" and "linear"'.format(warmup_type))
if warmup_type is not None:
if not isinst... | An WarmupScheduler, inherit from torch.optim.lr_scheduler._LRScheduler. :param optimizer: Description of parameter `optimizer`. :type optimizer: torch.optim.optimizer :param by_epoch: step by epoch or by iter. :type by_epoch: bool :param warmup_type: one of ['constant', 'linear', 'exp'], default is None. :type warmup_t... | WarmupScheduler | [
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WarmupScheduler:
"""An WarmupScheduler, inherit from torch.optim.lr_scheduler._LRScheduler. :param optimizer: Description of parameter `optimizer`. :type optimizer: torch.optim.optimizer :param by_epoch: step by epoch or by iter. :type by_epoch: bool :param warmup_type: one of ['constant', 'linea... | stack_v2_sparse_classes_36k_train_028299 | 7,093 | permissive | [
{
"docstring": "Init WarmupScheduler.",
"name": "__init__",
"signature": "def __init__(self, optimizer, epochs, steps, by_epoch=True, warmup_type=None, warmup_iters=0, warmup_ratio=0.1, after_scheduler_config=None, after_scheduler_by_epoch=True, **kwargs)"
},
{
"docstring": "Init after_scheduler... | 4 | null | Implement the Python class `WarmupScheduler` described below.
Class description:
An WarmupScheduler, inherit from torch.optim.lr_scheduler._LRScheduler. :param optimizer: Description of parameter `optimizer`. :type optimizer: torch.optim.optimizer :param by_epoch: step by epoch or by iter. :type by_epoch: bool :param ... | Implement the Python class `WarmupScheduler` described below.
Class description:
An WarmupScheduler, inherit from torch.optim.lr_scheduler._LRScheduler. :param optimizer: Description of parameter `optimizer`. :type optimizer: torch.optim.optimizer :param by_epoch: step by epoch or by iter. :type by_epoch: bool :param ... | df51ed9c1d6dbde1deef63f2a037a369f8554406 | <|skeleton|>
class WarmupScheduler:
"""An WarmupScheduler, inherit from torch.optim.lr_scheduler._LRScheduler. :param optimizer: Description of parameter `optimizer`. :type optimizer: torch.optim.optimizer :param by_epoch: step by epoch or by iter. :type by_epoch: bool :param warmup_type: one of ['constant', 'linea... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WarmupScheduler:
"""An WarmupScheduler, inherit from torch.optim.lr_scheduler._LRScheduler. :param optimizer: Description of parameter `optimizer`. :type optimizer: torch.optim.optimizer :param by_epoch: step by epoch or by iter. :type by_epoch: bool :param warmup_type: one of ['constant', 'linear', 'exp'], d... | the_stack_v2_python_sparse | built-in/TensorFlow/Research/cv/image_classification/Cars_for_TensorFlow/automl/vega/core/trainer/modules/lr_schedulers/warmup_scheduler.py | Huawei-Ascend/modelzoo | train | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.