blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 7.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 378 8.64k | id stringlengths 44 44 | length_bytes int64 505 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.88k | prompted_full_text stringlengths 565 12.5k | revision_id stringlengths 40 40 | skeleton stringlengths 162 5.05k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | snapshot_total_rows int64 75.8k 75.8k | solution stringlengths 242 8.3k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
410e8504519287c91d94412a3f2065c8d071f739 | [
"self.__key = key\nself.base_url = base_url\nself.endpoint = endpoint\nself.domain = domain\nself.default_language = default_language",
"if not language:\n language = self.default_language\nif not texts:\n return ResponseBody(documents=[])\nheaders = {'Content-Type': 'application/json', 'Accept': 'applicati... | <|body_start_0|>
self.__key = key
self.base_url = base_url
self.endpoint = endpoint
self.domain = domain
self.default_language = default_language
<|end_body_0|>
<|body_start_1|>
if not language:
language = self.default_language
if not texts:
... | Client for Azure Text Analytics Entity Recognition API. | TextAnalyticsClient | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TextAnalyticsClient:
"""Client for Azure Text Analytics Entity Recognition API."""
def __init__(self, key: str, base_url: str, endpoint: Endpoint=Endpoint.PII, domain: str='phi', default_language: str='en'):
"""Initialize TextAnalyticsClient key (str): The key used to authenticate to... | stack_v2_sparse_classes_75kplus_train_001000 | 3,102 | permissive | [
{
"docstring": "Initialize TextAnalyticsClient key (str): The key used to authenticate to Text Analytics Azure Instance. base_url (str): Supported Cognitive Services or Text Analytics resource endpoints (protocol and hostname). endpoint (Endpoint): Endpoint for prediction. Defaults to PII. domain (str): Domain ... | 2 | stack_v2_sparse_classes_30k_train_051809 | Implement the Python class `TextAnalyticsClient` described below.
Class description:
Client for Azure Text Analytics Entity Recognition API.
Method signatures and docstrings:
- def __init__(self, key: str, base_url: str, endpoint: Endpoint=Endpoint.PII, domain: str='phi', default_language: str='en'): Initialize TextA... | Implement the Python class `TextAnalyticsClient` described below.
Class description:
Client for Azure Text Analytics Entity Recognition API.
Method signatures and docstrings:
- def __init__(self, key: str, base_url: str, endpoint: Endpoint=Endpoint.PII, domain: str='phi', default_language: str='en'): Initialize TextA... | e24a085669b4db6918ffeb2752846089d8dee57a | <|skeleton|>
class TextAnalyticsClient:
"""Client for Azure Text Analytics Entity Recognition API."""
def __init__(self, key: str, base_url: str, endpoint: Endpoint=Endpoint.PII, domain: str='phi', default_language: str='en'):
"""Initialize TextAnalyticsClient key (str): The key used to authenticate to... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TextAnalyticsClient:
"""Client for Azure Text Analytics Entity Recognition API."""
def __init__(self, key: str, base_url: str, endpoint: Endpoint=Endpoint.PII, domain: str='phi', default_language: str='en'):
"""Initialize TextAnalyticsClient key (str): The key used to authenticate to Text Analyti... | the_stack_v2_python_sparse | tutorials/ner_pytorch_medical/scripts/azure/text_analytics.py | explosion/projects | train | 1,171 |
78f943e7998cc9c7843a94d4f0facbf11c657ed0 | [
"token = request.headers['Authorization']\nif 'Bearer ' in token:\n token = token[token.index(' ') + 1:]\ntoken_decode = jwt.decode(token, current_app.config['SECRET_KEY'])\nemail = token_decode['user']\ndiagram = json.loads(api.payload['diagram'])\ntry:\n existing_user = db.db.users.update_one({'email': emai... | <|body_start_0|>
token = request.headers['Authorization']
if 'Bearer ' in token:
token = token[token.index(' ') + 1:]
token_decode = jwt.decode(token, current_app.config['SECRET_KEY'])
email = token_decode['user']
diagram = json.loads(api.payload['diagram'])
t... | Diagram | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Diagram:
def post(self):
"""Guargar un diagrama"""
<|body_0|>
def get(self):
"""Obtener el diagrama de un usuario"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
token = request.headers['Authorization']
if 'Bearer ' in token:
tok... | stack_v2_sparse_classes_75kplus_train_001001 | 2,535 | no_license | [
{
"docstring": "Guargar un diagrama",
"name": "post",
"signature": "def post(self)"
},
{
"docstring": "Obtener el diagrama de un usuario",
"name": "get",
"signature": "def get(self)"
}
] | 2 | stack_v2_sparse_classes_30k_val_002128 | Implement the Python class `Diagram` described below.
Class description:
Implement the Diagram class.
Method signatures and docstrings:
- def post(self): Guargar un diagrama
- def get(self): Obtener el diagrama de un usuario | Implement the Python class `Diagram` described below.
Class description:
Implement the Diagram class.
Method signatures and docstrings:
- def post(self): Guargar un diagrama
- def get(self): Obtener el diagrama de un usuario
<|skeleton|>
class Diagram:
def post(self):
"""Guargar un diagrama"""
<... | e15639e3a857680a12564f55282c7dfa9fb9b8bd | <|skeleton|>
class Diagram:
def post(self):
"""Guargar un diagrama"""
<|body_0|>
def get(self):
"""Obtener el diagrama de un usuario"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Diagram:
def post(self):
"""Guargar un diagrama"""
token = request.headers['Authorization']
if 'Bearer ' in token:
token = token[token.index(' ') + 1:]
token_decode = jwt.decode(token, current_app.config['SECRET_KEY'])
email = token_decode['user']
di... | the_stack_v2_python_sparse | apis/diagram.py | martinez-acosta/api-tt-2019-b052 | train | 0 | |
cffb471ddf853185f296bd72e85f2fa44d538f81 | [
"Fonts._font_map['MessageAuthor'] = Font(family='Ariel', size=10, weight='bold')\nFonts._font_map['MessageTimestamp'] = Font(family='Ariel', size=7, slant='italic')\nFonts._font_map['MessageText'] = Font(family='Ariel', size=12)\nFonts._font_map['EntryText'] = Font(family='Ariel', size=12)\nFonts._font_map['EmptyAr... | <|body_start_0|>
Fonts._font_map['MessageAuthor'] = Font(family='Ariel', size=10, weight='bold')
Fonts._font_map['MessageTimestamp'] = Font(family='Ariel', size=7, slant='italic')
Fonts._font_map['MessageText'] = Font(family='Ariel', size=12)
Fonts._font_map['EntryText'] = Font(family='A... | Class holding fonts available to UI | Fonts | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Fonts:
"""Class holding fonts available to UI"""
def init():
"""Initialize all fonts"""
<|body_0|>
def get(font_name):
"""Retrieves font with given identifier"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
Fonts._font_map['MessageAuthor'] = Fon... | stack_v2_sparse_classes_75kplus_train_001002 | 1,088 | no_license | [
{
"docstring": "Initialize all fonts",
"name": "init",
"signature": "def init()"
},
{
"docstring": "Retrieves font with given identifier",
"name": "get",
"signature": "def get(font_name)"
}
] | 2 | stack_v2_sparse_classes_30k_train_052241 | Implement the Python class `Fonts` described below.
Class description:
Class holding fonts available to UI
Method signatures and docstrings:
- def init(): Initialize all fonts
- def get(font_name): Retrieves font with given identifier | Implement the Python class `Fonts` described below.
Class description:
Class holding fonts available to UI
Method signatures and docstrings:
- def init(): Initialize all fonts
- def get(font_name): Retrieves font with given identifier
<|skeleton|>
class Fonts:
"""Class holding fonts available to UI"""
def i... | 812d9fded6492655cb1af729dae915784b74f642 | <|skeleton|>
class Fonts:
"""Class holding fonts available to UI"""
def init():
"""Initialize all fonts"""
<|body_0|>
def get(font_name):
"""Retrieves font with given identifier"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Fonts:
"""Class holding fonts available to UI"""
def init():
"""Initialize all fonts"""
Fonts._font_map['MessageAuthor'] = Font(family='Ariel', size=10, weight='bold')
Fonts._font_map['MessageTimestamp'] = Font(family='Ariel', size=7, slant='italic')
Fonts._font_map['Messa... | the_stack_v2_python_sparse | src/ui/fonts.py | B3W/Endpoints | train | 0 |
dcf26af44efbf3d2013b5fd0f7909b927dfe3076 | [
"self = object.__new__(cls)\nself.handler = handler\nself.touhou_character = touhou_character\nreturn self",
"if event.user is not event.message.interaction.user:\n return\nimage_detail = await self.handler.get_image(client, event)\nembed = build_touhou_character_embed(self.touhou_character, image_detail)\nif ... | <|body_start_0|>
self = object.__new__(cls)
self.handler = handler
self.touhou_character = touhou_character
return self
<|end_body_0|>
<|body_start_1|>
if event.user is not event.message.interaction.user:
return
image_detail = await self.handler.get_image(cli... | Represents a component command used to renew a touhou character. Attributes ---------- handler : ``ImageHandlerBase`` The handler to use. touhou_character : ``TouhouCharacter`` The respective touhou character. | NewTouhouCharacter | [
"LicenseRef-scancode-warranty-disclaimer"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NewTouhouCharacter:
"""Represents a component command used to renew a touhou character. Attributes ---------- handler : ``ImageHandlerBase`` The handler to use. touhou_character : ``TouhouCharacter`` The respective touhou character."""
def __new__(cls, handler, touhou_character):
"""... | stack_v2_sparse_classes_75kplus_train_001003 | 4,132 | no_license | [
{
"docstring": "Creates a new touhou character renewer. Parameters ---------- handler : ``ImageHandlerBase`` The handler to use. touhou_character : ``TouhouCharacter`` The respective touhou character.",
"name": "__new__",
"signature": "def __new__(cls, handler, touhou_character)"
},
{
"docstring... | 2 | stack_v2_sparse_classes_30k_val_000945 | Implement the Python class `NewTouhouCharacter` described below.
Class description:
Represents a component command used to renew a touhou character. Attributes ---------- handler : ``ImageHandlerBase`` The handler to use. touhou_character : ``TouhouCharacter`` The respective touhou character.
Method signatures and do... | Implement the Python class `NewTouhouCharacter` described below.
Class description:
Represents a component command used to renew a touhou character. Attributes ---------- handler : ``ImageHandlerBase`` The handler to use. touhou_character : ``TouhouCharacter`` The respective touhou character.
Method signatures and do... | 74f92b598e86606ea3a269311316cddd84a5215f | <|skeleton|>
class NewTouhouCharacter:
"""Represents a component command used to renew a touhou character. Attributes ---------- handler : ``ImageHandlerBase`` The handler to use. touhou_character : ``TouhouCharacter`` The respective touhou character."""
def __new__(cls, handler, touhou_character):
"""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NewTouhouCharacter:
"""Represents a component command used to renew a touhou character. Attributes ---------- handler : ``ImageHandlerBase`` The handler to use. touhou_character : ``TouhouCharacter`` The respective touhou character."""
def __new__(cls, handler, touhou_character):
"""Creates a new... | the_stack_v2_python_sparse | koishi/plugins/image_handling_commands/touhou_character/touhou_character.py | HuyaneMatsu/Koishi | train | 17 |
caeed1b210a50ec2a401ee47fa9afa18597c12b6 | [
"super(FileParameter, self).__init__(name, FileParameter.PARAM_TYPE, required=required)\nself.media_types = media_types\nself.multiple = multiple",
"warnings = super(FileParameter, self).validate_connection(connecting_parameter)\nif not self.multiple and connecting_parameter.multiple:\n msg = \"Parameter '%s' ... | <|body_start_0|>
super(FileParameter, self).__init__(name, FileParameter.PARAM_TYPE, required=required)
self.media_types = media_types
self.multiple = multiple
<|end_body_0|>
<|body_start_1|>
warnings = super(FileParameter, self).validate_connection(connecting_parameter)
if not ... | Represents a file(s) parameter | FileParameter | [
"LicenseRef-scancode-free-unknown",
"Apache-2.0",
"LicenseRef-scancode-public-domain"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FileParameter:
"""Represents a file(s) parameter"""
def __init__(self, name, media_types, required=True, multiple=False):
"""Constructor :param name: The name of the parameter :type name: string :param media_types: The list of valid file media types :type media_types: list :param req... | stack_v2_sparse_classes_75kplus_train_001004 | 5,620 | permissive | [
{
"docstring": "Constructor :param name: The name of the parameter :type name: string :param media_types: The list of valid file media types :type media_types: list :param required: Whether this parameter is required :type required: bool :param multiple: Whether this parameter accepts multiple files :type multi... | 2 | null | Implement the Python class `FileParameter` described below.
Class description:
Represents a file(s) parameter
Method signatures and docstrings:
- def __init__(self, name, media_types, required=True, multiple=False): Constructor :param name: The name of the parameter :type name: string :param media_types: The list of ... | Implement the Python class `FileParameter` described below.
Class description:
Represents a file(s) parameter
Method signatures and docstrings:
- def __init__(self, name, media_types, required=True, multiple=False): Constructor :param name: The name of the parameter :type name: string :param media_types: The list of ... | 28618aee07ceed9e4a6eb7b8d0e6f05b31d8fd6b | <|skeleton|>
class FileParameter:
"""Represents a file(s) parameter"""
def __init__(self, name, media_types, required=True, multiple=False):
"""Constructor :param name: The name of the parameter :type name: string :param media_types: The list of valid file media types :type media_types: list :param req... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FileParameter:
"""Represents a file(s) parameter"""
def __init__(self, name, media_types, required=True, multiple=False):
"""Constructor :param name: The name of the parameter :type name: string :param media_types: The list of valid file media types :type media_types: list :param required: Whethe... | the_stack_v2_python_sparse | scale/data/interface/parameter.py | kfconsultant/scale | train | 0 |
3844f1743d91d1dde5f0db73e19da8caea6a9f89 | [
"self._delta_t_minutes = delta_time_minutes\nself._t_fusion_mode = t_fusion_mode\nself._transition_matrices = transition_matrices\nself._all_transitions = build_flat_list_of_visits(transition_matrices)\nself._root_node = None",
"for transition in self._all_transitions:\n baby_node = SpatialTimeModelNode.build_... | <|body_start_0|>
self._delta_t_minutes = delta_time_minutes
self._t_fusion_mode = t_fusion_mode
self._transition_matrices = transition_matrices
self._all_transitions = build_flat_list_of_visits(transition_matrices)
self._root_node = None
<|end_body_0|>
<|body_start_1|>
f... | SpatialTimeModelBuilder | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SpatialTimeModelBuilder:
def __init__(self, transition_matrices: List[TransitionMatrix], delta_time_minutes, t_fusion_mode):
"""Basic constructor :param transition_matrices: The transition matrices representing all of the mobility data windows. :param delta_time_minutes: The time interva... | stack_v2_sparse_classes_75kplus_train_001005 | 5,379 | permissive | [
{
"docstring": "Basic constructor :param transition_matrices: The transition matrices representing all of the mobility data windows. :param delta_time_minutes: The time interval used for considering similarities of nodes during. :param t_fusion_mode: The time fusion mode to employ when consolidating different d... | 6 | stack_v2_sparse_classes_30k_train_033560 | Implement the Python class `SpatialTimeModelBuilder` described below.
Class description:
Implement the SpatialTimeModelBuilder class.
Method signatures and docstrings:
- def __init__(self, transition_matrices: List[TransitionMatrix], delta_time_minutes, t_fusion_mode): Basic constructor :param transition_matrices: Th... | Implement the Python class `SpatialTimeModelBuilder` described below.
Class description:
Implement the SpatialTimeModelBuilder class.
Method signatures and docstrings:
- def __init__(self, transition_matrices: List[TransitionMatrix], delta_time_minutes, t_fusion_mode): Basic constructor :param transition_matrices: Th... | b058185ca028abd1902edbb35a52d3565b06f8b0 | <|skeleton|>
class SpatialTimeModelBuilder:
def __init__(self, transition_matrices: List[TransitionMatrix], delta_time_minutes, t_fusion_mode):
"""Basic constructor :param transition_matrices: The transition matrices representing all of the mobility data windows. :param delta_time_minutes: The time interva... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SpatialTimeModelBuilder:
def __init__(self, transition_matrices: List[TransitionMatrix], delta_time_minutes, t_fusion_mode):
"""Basic constructor :param transition_matrices: The transition matrices representing all of the mobility data windows. :param delta_time_minutes: The time interval used for con... | the_stack_v2_python_sparse | stm/SpatialTimeModelBuilder.py | s0lver/stm-creator | train | 0 | |
49dd4f8dd6259ccdf9ef9901934cedcd5c96701b | [
"shape = self._compute_shape(x._shape, y._shape)\nsuper(_BinaryOp, self).__init__(shape, graph)\nself._arguments['x'] = x\nself._arguments['y'] = y",
"if x_shape._ndims == 0:\n return y_shape._raw_shape\nelif y_shape._ndims == 0:\n return x_shape._raw_shape\nshape = []\nmin_ndims = np.minimum(x_shape._ndims... | <|body_start_0|>
shape = self._compute_shape(x._shape, y._shape)
super(_BinaryOp, self).__init__(shape, graph)
self._arguments['x'] = x
self._arguments['y'] = y
<|end_body_0|>
<|body_start_1|>
if x_shape._ndims == 0:
return y_shape._raw_shape
elif y_shape._nd... | Base class for all binary arithmetic operations. Supports broadcasting. | _BinaryOp | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _BinaryOp:
"""Base class for all binary arithmetic operations. Supports broadcasting."""
def __init__(self, x, y, graph=None):
"""Constructor. Args: x: a Node instance, the first operand. y: a Node instance, the second operand. graph: a Graph instance."""
<|body_0|>
def ... | stack_v2_sparse_classes_75kplus_train_001006 | 11,120 | permissive | [
{
"docstring": "Constructor. Args: x: a Node instance, the first operand. y: a Node instance, the second operand. graph: a Graph instance.",
"name": "__init__",
"signature": "def __init__(self, x, y, graph=None)"
},
{
"docstring": "Computs the shape of the resulting Node. Args: x_shape: a Tensor... | 3 | null | Implement the Python class `_BinaryOp` described below.
Class description:
Base class for all binary arithmetic operations. Supports broadcasting.
Method signatures and docstrings:
- def __init__(self, x, y, graph=None): Constructor. Args: x: a Node instance, the first operand. y: a Node instance, the second operand.... | Implement the Python class `_BinaryOp` described below.
Class description:
Base class for all binary arithmetic operations. Supports broadcasting.
Method signatures and docstrings:
- def __init__(self, x, y, graph=None): Constructor. Args: x: a Node instance, the first operand. y: a Node instance, the second operand.... | 4b21a8895755072f8e0390ce4cc96b17308f8a90 | <|skeleton|>
class _BinaryOp:
"""Base class for all binary arithmetic operations. Supports broadcasting."""
def __init__(self, x, y, graph=None):
"""Constructor. Args: x: a Node instance, the first operand. y: a Node instance, the second operand. graph: a Graph instance."""
<|body_0|>
def ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class _BinaryOp:
"""Base class for all binary arithmetic operations. Supports broadcasting."""
def __init__(self, x, y, graph=None):
"""Constructor. Args: x: a Node instance, the first operand. y: a Node instance, the second operand. graph: a Graph instance."""
shape = self._compute_shape(x._sh... | the_stack_v2_python_sparse | nodes/arithmetic.py | chao-ji/np-auto-diff | train | 2 |
53a1bbf736bc78d7ab89ba0ad9aeb375b3afc2d3 | [
"backend = self.get_backend_for_app(app_id)\nauth_client = get_backend_authenticated_client(request.user.username, backend)\nowner = auth_client.get_application_owner(app_id)\nreturn self.respond({'owner': owner, 'remote': git_remote(get_backend_api_url(backend), app_id)})",
"data = json.loads(request.body)\nback... | <|body_start_0|>
backend = self.get_backend_for_app(app_id)
auth_client = get_backend_authenticated_client(request.user.username, backend)
owner = auth_client.get_application_owner(app_id)
return self.respond({'owner': owner, 'remote': git_remote(get_backend_api_url(backend), app_id)})
<... | AppDetailsApiView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AppDetailsApiView:
def get(self, request, app_id):
"""Get information about this app. Returns a JSON with the following fields: { "owner": "userid", "remote": "ssh://git@hostname.com/app.git" } :param django.http.HttpRequest request: the request object :param str app_id: the ID of the ap... | stack_v2_sparse_classes_75kplus_train_001007 | 2,429 | no_license | [
{
"docstring": "Get information about this app. Returns a JSON with the following fields: { \"owner\": \"userid\", \"remote\": \"ssh://git@hostname.com/app.git\" } :param django.http.HttpRequest request: the request object :param str app_id: the ID of the app :rtype: django.http.HttpResponse",
"name": "get"... | 3 | null | Implement the Python class `AppDetailsApiView` described below.
Class description:
Implement the AppDetailsApiView class.
Method signatures and docstrings:
- def get(self, request, app_id): Get information about this app. Returns a JSON with the following fields: { "owner": "userid", "remote": "ssh://git@hostname.com... | Implement the Python class `AppDetailsApiView` described below.
Class description:
Implement the AppDetailsApiView class.
Method signatures and docstrings:
- def get(self, request, app_id): Get information about this app. Returns a JSON with the following fields: { "owner": "userid", "remote": "ssh://git@hostname.com... | df2bbc2c0f7b593930a5c5bc038232f66394f8c5 | <|skeleton|>
class AppDetailsApiView:
def get(self, request, app_id):
"""Get information about this app. Returns a JSON with the following fields: { "owner": "userid", "remote": "ssh://git@hostname.com/app.git" } :param django.http.HttpRequest request: the request object :param str app_id: the ID of the ap... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AppDetailsApiView:
def get(self, request, app_id):
"""Get information about this app. Returns a JSON with the following fields: { "owner": "userid", "remote": "ssh://git@hostname.com/app.git" } :param django.http.HttpRequest request: the request object :param str app_id: the ID of the app :rtype: djan... | the_stack_v2_python_sparse | web/api_server/api/app_details_api_view.py | TigerAppsOrg/TigerHost | train | 0 | |
30e3ca8b72cc31243d061348299db2db33ef26de | [
"self._absolute_value = absolute_value\nself._comparator_fn = comparator_fn\nself._error_loss_fn = error_loss_fn\nsuper(AbsoluteConstraint, self).__init__(time_step_spec, action_spec, constraint_network, error_loss_fn=self._error_loss_fn, name=name)",
"predicted_values, _ = self._constraint_network(observation, t... | <|body_start_0|>
self._absolute_value = absolute_value
self._comparator_fn = comparator_fn
self._error_loss_fn = error_loss_fn
super(AbsoluteConstraint, self).__init__(time_step_spec, action_spec, constraint_network, error_loss_fn=self._error_loss_fn, name=name)
<|end_body_0|>
<|body_st... | Class for representing a trainable absolute value constraint. This constraint class implements an absolute value constraint such as ``` expected_value(action) >= absolute_value ``` or ``` expected_value(action) <= absolute_value ``` | AbsoluteConstraint | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AbsoluteConstraint:
"""Class for representing a trainable absolute value constraint. This constraint class implements an absolute value constraint such as ``` expected_value(action) >= absolute_value ``` or ``` expected_value(action) <= absolute_value ```"""
def __init__(self, time_step_spec... | stack_v2_sparse_classes_75kplus_train_001008 | 22,532 | permissive | [
{
"docstring": "Creates a trainable absolute constraint using a neural network. Args: time_step_spec: A `TimeStep` spec of the expected time_steps. action_spec: A nest of `BoundedTensorSpec` representing the actions. constraint_network: An instance of `tf_agents.network.Network` used to provide estimates of act... | 2 | stack_v2_sparse_classes_30k_train_013431 | Implement the Python class `AbsoluteConstraint` described below.
Class description:
Class for representing a trainable absolute value constraint. This constraint class implements an absolute value constraint such as ``` expected_value(action) >= absolute_value ``` or ``` expected_value(action) <= absolute_value ```
M... | Implement the Python class `AbsoluteConstraint` described below.
Class description:
Class for representing a trainable absolute value constraint. This constraint class implements an absolute value constraint such as ``` expected_value(action) >= absolute_value ``` or ``` expected_value(action) <= absolute_value ```
M... | eca1093d3a047e538f17f6ab92ab4d8144284f23 | <|skeleton|>
class AbsoluteConstraint:
"""Class for representing a trainable absolute value constraint. This constraint class implements an absolute value constraint such as ``` expected_value(action) >= absolute_value ``` or ``` expected_value(action) <= absolute_value ```"""
def __init__(self, time_step_spec... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AbsoluteConstraint:
"""Class for representing a trainable absolute value constraint. This constraint class implements an absolute value constraint such as ``` expected_value(action) >= absolute_value ``` or ``` expected_value(action) <= absolute_value ```"""
def __init__(self, time_step_spec: types.TimeS... | the_stack_v2_python_sparse | tf_agents/bandits/policies/constraints.py | tensorflow/agents | train | 2,755 |
36350c4455c39cf98ca52152abdf02326bb62057 | [
"plain = [ord(i) for i in text]\nkey = []\ncipher = []\nfor i in plain:\n k = random.randint(1, 300)\n c = (i + k) * k\n cipher.append(c)\n key.append(k)\nreturn (cipher, key)",
"plain = []\nfor i in range(len(key)):\n p = int((cipher[i] - key[i] ** 2) / key[i])\n plain.append(chr(p))\nplain = '... | <|body_start_0|>
plain = [ord(i) for i in text]
key = []
cipher = []
for i in plain:
k = random.randint(1, 300)
c = (i + k) * k
cipher.append(c)
key.append(k)
return (cipher, key)
<|end_body_0|>
<|body_start_1|>
plain = []
... | Onepad | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Onepad:
def encrypt(self, text):
"""Function to encrypt text using psedo-random numbers"""
<|body_0|>
def decrypt(self, cipher, key):
"""Function to decrypt text using psedo-random numbers."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
plain = [or... | stack_v2_sparse_classes_75kplus_train_001009 | 1,574 | permissive | [
{
"docstring": "Function to encrypt text using psedo-random numbers",
"name": "encrypt",
"signature": "def encrypt(self, text)"
},
{
"docstring": "Function to decrypt text using psedo-random numbers.",
"name": "decrypt",
"signature": "def decrypt(self, cipher, key)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006472 | Implement the Python class `Onepad` described below.
Class description:
Implement the Onepad class.
Method signatures and docstrings:
- def encrypt(self, text): Function to encrypt text using psedo-random numbers
- def decrypt(self, cipher, key): Function to decrypt text using psedo-random numbers. | Implement the Python class `Onepad` described below.
Class description:
Implement the Onepad class.
Method signatures and docstrings:
- def encrypt(self, text): Function to encrypt text using psedo-random numbers
- def decrypt(self, cipher, key): Function to decrypt text using psedo-random numbers.
<|skeleton|>
clas... | 398d1dbf4b780d1725aeae9a91b4c79f4410e2f0 | <|skeleton|>
class Onepad:
def encrypt(self, text):
"""Function to encrypt text using psedo-random numbers"""
<|body_0|>
def decrypt(self, cipher, key):
"""Function to decrypt text using psedo-random numbers."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Onepad:
def encrypt(self, text):
"""Function to encrypt text using psedo-random numbers"""
plain = [ord(i) for i in text]
key = []
cipher = []
for i in plain:
k = random.randint(1, 300)
c = (i + k) * k
cipher.append(c)
key... | the_stack_v2_python_sparse | ciphers/onepad_cipher.py | tg12/Python | train | 0 | |
dbfb4853b878677e58b0addcbf521a147e64db45 | [
"pigsty_size = env_info.get('size', 7)\nself.init_state = None\nself.vision = env_info.get('vision', False)\nself.action_type = 'Categorical'\nself.n_agents = 2\nself.api_type = 'unified'\nreturn EnvCatchPigs(pigsty_size, True)",
"self.env.reset()\nobs_list = self.env.get_obs()\nself.init_state = {'0': obs_list[0... | <|body_start_0|>
pigsty_size = env_info.get('size', 7)
self.init_state = None
self.vision = env_info.get('vision', False)
self.action_type = 'Categorical'
self.n_agents = 2
self.api_type = 'unified'
return EnvCatchPigs(pigsty_size, True)
<|end_body_0|>
<|body_sta... | Encapsulates multi-agents on catch pigs. | MaEnvCatchPigs | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MaEnvCatchPigs:
"""Encapsulates multi-agents on catch pigs."""
def init_env(self, env_info):
"""Create a atari environment instance. :param: the config information of environment. :return: the instance of environment"""
<|body_0|>
def reset(self):
"""Reset the en... | stack_v2_sparse_classes_75kplus_train_001010 | 3,231 | permissive | [
{
"docstring": "Create a atari environment instance. :param: the config information of environment. :return: the instance of environment",
"name": "init_env",
"signature": "def init_env(self, env_info)"
},
{
"docstring": "Reset the environment, if done is true, must clear obs array. :return: the... | 3 | stack_v2_sparse_classes_30k_train_025219 | Implement the Python class `MaEnvCatchPigs` described below.
Class description:
Encapsulates multi-agents on catch pigs.
Method signatures and docstrings:
- def init_env(self, env_info): Create a atari environment instance. :param: the config information of environment. :return: the instance of environment
- def rese... | Implement the Python class `MaEnvCatchPigs` described below.
Class description:
Encapsulates multi-agents on catch pigs.
Method signatures and docstrings:
- def init_env(self, env_info): Create a atari environment instance. :param: the config information of environment. :return: the instance of environment
- def rese... | e4ef3a1c92d19d1d08c3ef0e2156b6fecefdbe04 | <|skeleton|>
class MaEnvCatchPigs:
"""Encapsulates multi-agents on catch pigs."""
def init_env(self, env_info):
"""Create a atari environment instance. :param: the config information of environment. :return: the instance of environment"""
<|body_0|>
def reset(self):
"""Reset the en... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MaEnvCatchPigs:
"""Encapsulates multi-agents on catch pigs."""
def init_env(self, env_info):
"""Create a atari environment instance. :param: the config information of environment. :return: the instance of environment"""
pigsty_size = env_info.get('size', 7)
self.init_state = None
... | the_stack_v2_python_sparse | xt/environment/ma/catchpigs.py | huawei-noah/xingtian | train | 308 |
87bb4b351d07c14f251df6c431c2af35d97d6c5c | [
"h = _parse_hue_channel(match['hsv_H'])\ns = _parse_percent_channel(match['hsv_S'])\nv = _parse_percent_channel(match['hsv_V'])\nif h is None or s is None or v is None:\n return None\nr, g, b = _hsv_to_rgb(h, s, v)\nreturn '#%02X%02X%02Xff' % (r, g, b)",
"r = _channel_to_decimal(color[1:3])\ng = _channel_to_de... | <|body_start_0|>
h = _parse_hue_channel(match['hsv_H'])
s = _parse_percent_channel(match['hsv_S'])
v = _parse_percent_channel(match['hsv_V'])
if h is None or s is None or v is None:
return None
r, g, b = _hsv_to_rgb(h, s, v)
return '#%02X%02X%02Xff' % (r, g, b... | A class for converting colors in hsv representation to a canonical one. | _HsvColorConverter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _HsvColorConverter:
"""A class for converting colors in hsv representation to a canonical one."""
def to_color(self, match):
"""Get a color match into a canonical color representation. Arguments: - match - a dict with matched color formats. Returns a canonical color representation fo... | stack_v2_sparse_classes_75kplus_train_001011 | 17,300 | no_license | [
{
"docstring": "Get a color match into a canonical color representation. Arguments: - match - a dict with matched color formats. Returns a canonical color representation for the match.",
"name": "to_color",
"signature": "def to_color(self, match)"
},
{
"docstring": "Convert a canonical color rep... | 2 | null | Implement the Python class `_HsvColorConverter` described below.
Class description:
A class for converting colors in hsv representation to a canonical one.
Method signatures and docstrings:
- def to_color(self, match): Get a color match into a canonical color representation. Arguments: - match - a dict with matched c... | Implement the Python class `_HsvColorConverter` described below.
Class description:
A class for converting colors in hsv representation to a canonical one.
Method signatures and docstrings:
- def to_color(self, match): Get a color match into a canonical color representation. Arguments: - match - a dict with matched c... | 83d469af3fc11d1aedb5193976ef84c59b595d6c | <|skeleton|>
class _HsvColorConverter:
"""A class for converting colors in hsv representation to a canonical one."""
def to_color(self, match):
"""Get a color match into a canonical color representation. Arguments: - match - a dict with matched color formats. Returns a canonical color representation fo... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class _HsvColorConverter:
"""A class for converting colors in hsv representation to a canonical one."""
def to_color(self, match):
"""Get a color match into a canonical color representation. Arguments: - match - a dict with matched color formats. Returns a canonical color representation for the match."... | the_stack_v2_python_sparse | .config/sublime-text-2/Packages/Color Highlighter/color_converter.py | Wallkerock/X-setup | train | 10 |
1e40b010948c844d9e26d963543a903b022f645b | [
"material_count = weixin_models.Material.objects.filter(owner=request.manager, is_deleted=False).count()\nif material_count > 0:\n has_material = True\nelse:\n has_material = False\nc = RequestContext(request, {'first_nav_name': FIRST_NAV, 'second_navs': export.get_weixin_second_navs(request), 'second_nav_nam... | <|body_start_0|>
material_count = weixin_models.Material.objects.filter(owner=request.manager, is_deleted=False).count()
if material_count > 0:
has_material = True
else:
has_material = False
c = RequestContext(request, {'first_nav_name': FIRST_NAV, 'second_navs': ... | 图文资源 | Materials | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Materials:
"""图文资源"""
def get(request):
"""获取图文列表页面"""
<|body_0|>
def api_get(request):
"""获取素材集合的json表示"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
material_count = weixin_models.Material.objects.filter(owner=request.manager, is_deleted=Fal... | stack_v2_sparse_classes_75kplus_train_001012 | 3,354 | no_license | [
{
"docstring": "获取图文列表页面",
"name": "get",
"signature": "def get(request)"
},
{
"docstring": "获取素材集合的json表示",
"name": "api_get",
"signature": "def api_get(request)"
}
] | 2 | stack_v2_sparse_classes_30k_train_037459 | Implement the Python class `Materials` described below.
Class description:
图文资源
Method signatures and docstrings:
- def get(request): 获取图文列表页面
- def api_get(request): 获取素材集合的json表示 | Implement the Python class `Materials` described below.
Class description:
图文资源
Method signatures and docstrings:
- def get(request): 获取图文列表页面
- def api_get(request): 获取素材集合的json表示
<|skeleton|>
class Materials:
"""图文资源"""
def get(request):
"""获取图文列表页面"""
<|body_0|>
def api_get(request):... | 8b2f7befe92841bcc35e0e60cac5958ef3f3af54 | <|skeleton|>
class Materials:
"""图文资源"""
def get(request):
"""获取图文列表页面"""
<|body_0|>
def api_get(request):
"""获取素材集合的json表示"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Materials:
"""图文资源"""
def get(request):
"""获取图文列表页面"""
material_count = weixin_models.Material.objects.filter(owner=request.manager, is_deleted=False).count()
if material_count > 0:
has_material = True
else:
has_material = False
c = RequestC... | the_stack_v2_python_sparse | weapp/weixin2/advance_manage/materials.py | chengdg/weizoom | train | 1 |
01ff6c31ba85c254b525dd78001b442180481f95 | [
"device_type = request.query_params.get('type')\ndevices = Device.objects.filter(type=device_type) if device_type else Device.objects.all()\nserializer = DeviceDetailSerializer(devices, many=True)\nreturn Response(serializer.data)",
"serializer = DeviceDetailSerializer(data=request.data)\nif serializer.is_valid()... | <|body_start_0|>
device_type = request.query_params.get('type')
devices = Device.objects.filter(type=device_type) if device_type else Device.objects.all()
serializer = DeviceDetailSerializer(devices, many=True)
return Response(serializer.data)
<|end_body_0|>
<|body_start_1|>
ser... | DeviceList | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DeviceList:
def get(self, request):
"""Get all devices if parameter type it'll filter by type :param request: :return: Response"""
<|body_0|>
def post(self, request):
"""Add new device :param request: :return: Response"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_75kplus_train_001013 | 9,166 | no_license | [
{
"docstring": "Get all devices if parameter type it'll filter by type :param request: :return: Response",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "Add new device :param request: :return: Response",
"name": "post",
"signature": "def post(self, request)"
}... | 2 | stack_v2_sparse_classes_30k_train_054465 | Implement the Python class `DeviceList` described below.
Class description:
Implement the DeviceList class.
Method signatures and docstrings:
- def get(self, request): Get all devices if parameter type it'll filter by type :param request: :return: Response
- def post(self, request): Add new device :param request: :re... | Implement the Python class `DeviceList` described below.
Class description:
Implement the DeviceList class.
Method signatures and docstrings:
- def get(self, request): Get all devices if parameter type it'll filter by type :param request: :return: Response
- def post(self, request): Add new device :param request: :re... | cdfe2893a0ddb9288039012bafbc1bf5e39a0c75 | <|skeleton|>
class DeviceList:
def get(self, request):
"""Get all devices if parameter type it'll filter by type :param request: :return: Response"""
<|body_0|>
def post(self, request):
"""Add new device :param request: :return: Response"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DeviceList:
def get(self, request):
"""Get all devices if parameter type it'll filter by type :param request: :return: Response"""
device_type = request.query_params.get('type')
devices = Device.objects.filter(type=device_type) if device_type else Device.objects.all()
serialize... | the_stack_v2_python_sparse | devices/views.py | player64/home-automation-backend | train | 0 | |
b93f6751f00497c23c4164f98599a3954d40a9b9 | [
"super().__init__(language_code)\nif self.language_code_short in LANG:\n self.supports_language = True",
"if text_input and self.supports_language:\n return alpha2digit(text_input, self.language_code_short, relaxed=True, ordinal_threshold=0)\nelif text_input:\n return text_input\nelse:\n return ''"
] | <|body_start_0|>
super().__init__(language_code)
if self.language_code_short in LANG:
self.supports_language = True
<|end_body_0|>
<|body_start_1|>
if text_input and self.supports_language:
return alpha2digit(text_input, self.language_code_short, relaxed=True, ordinal_th... | Convert numbers written as text ('two hundred', 'zweihundert') to real numbers | TextToNumberProcessor | [
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TextToNumberProcessor:
"""Convert numbers written as text ('two hundred', 'zweihundert') to real numbers"""
def __init__(self, language_code: str=None):
"""Create text2num processor for specific language"""
<|body_0|>
def process(self, text_input: str):
"""Take i... | stack_v2_sparse_classes_75kplus_train_001014 | 7,351 | permissive | [
{
"docstring": "Create text2num processor for specific language",
"name": "__init__",
"signature": "def __init__(self, language_code: str=None)"
},
{
"docstring": "Take input text and replace number strings with real numbers",
"name": "process",
"signature": "def process(self, text_input... | 2 | null | Implement the Python class `TextToNumberProcessor` described below.
Class description:
Convert numbers written as text ('two hundred', 'zweihundert') to real numbers
Method signatures and docstrings:
- def __init__(self, language_code: str=None): Create text2num processor for specific language
- def process(self, tex... | Implement the Python class `TextToNumberProcessor` described below.
Class description:
Convert numbers written as text ('two hundred', 'zweihundert') to real numbers
Method signatures and docstrings:
- def __init__(self, language_code: str=None): Create text2num processor for specific language
- def process(self, tex... | 11991dc8d2220fef19e9a5ed10acbb3e6311bca8 | <|skeleton|>
class TextToNumberProcessor:
"""Convert numbers written as text ('two hundred', 'zweihundert') to real numbers"""
def __init__(self, language_code: str=None):
"""Create text2num processor for specific language"""
<|body_0|>
def process(self, text_input: str):
"""Take i... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TextToNumberProcessor:
"""Convert numbers written as text ('two hundred', 'zweihundert') to real numbers"""
def __init__(self, language_code: str=None):
"""Create text2num processor for specific language"""
super().__init__(language_code)
if self.language_code_short in LANG:
... | the_stack_v2_python_sparse | src/text_processor.py | SEPIA-Framework/sepia-stt-server | train | 98 |
2fa7516cf18741938375619cd35e8c99d1226e85 | [
"for proc in psutil.process_iter():\n if proc.name() == PROC_NAME:\n URVoiceService.pid = proc.pid\n return True\nreturn False",
"exe_path = Path(FS.ur_install_path, PROC_NAME)\nif not exe_path.exists():\n raise FileNotFoundError(exe_path)\nLOGGER.info('starting UR voice service: %s', exe_path... | <|body_start_0|>
for proc in psutil.process_iter():
if proc.name() == PROC_NAME:
URVoiceService.pid = proc.pid
return True
return False
<|end_body_0|>
<|body_start_1|>
exe_path = Path(FS.ur_install_path, PROC_NAME)
if not exe_path.exists():
... | Manages UR voice service executable | URVoiceService | [
"MIT",
"GPL-3.0-only"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class URVoiceService:
"""Manages UR voice service executable"""
def is_running() -> bool:
"""Returns UR voice service status"""
<|body_0|>
def start_service():
"""Starts UR voice service"""
<|body_1|>
def poll():
"""Checks that UR voice service is ... | stack_v2_sparse_classes_75kplus_train_001015 | 1,832 | permissive | [
{
"docstring": "Returns UR voice service status",
"name": "is_running",
"signature": "def is_running() -> bool"
},
{
"docstring": "Starts UR voice service",
"name": "start_service",
"signature": "def start_service()"
},
{
"docstring": "Checks that UR voice service is running",
... | 4 | stack_v2_sparse_classes_30k_train_047031 | Implement the Python class `URVoiceService` described below.
Class description:
Manages UR voice service executable
Method signatures and docstrings:
- def is_running() -> bool: Returns UR voice service status
- def start_service(): Starts UR voice service
- def poll(): Checks that UR voice service is running
- def k... | Implement the Python class `URVoiceService` described below.
Class description:
Manages UR voice service executable
Method signatures and docstrings:
- def is_running() -> bool: Returns UR voice service status
- def start_service(): Starts UR voice service
- def poll(): Checks that UR voice service is running
- def k... | ac41cd0c07af8ca8532997f533756c529c9609a4 | <|skeleton|>
class URVoiceService:
"""Manages UR voice service executable"""
def is_running() -> bool:
"""Returns UR voice service status"""
<|body_0|>
def start_service():
"""Starts UR voice service"""
<|body_1|>
def poll():
"""Checks that UR voice service is ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class URVoiceService:
"""Manages UR voice service executable"""
def is_running() -> bool:
"""Returns UR voice service status"""
for proc in psutil.process_iter():
if proc.name() == PROC_NAME:
URVoiceService.pid = proc.pid
return True
return Fa... | the_stack_v2_python_sparse | esst/atis/_univers_radio/_ur_voice_service.py | theendsofinvention/esst | train | 1 |
1ec151078e1a647d7601e55555abcfe1f7f5fcbe | [
"if not path_preload is None:\n self.df = pd.read_csv(path_preload, index_col=0)\n if self.df.index.name == 'art_lbl':\n self.df = self.df.reset_index()\nelse:\n self.df = pd.DataFrame([], columns=['art_lbl', 'true_lbl', 's_train', 's_val', 's_test', 'size_tot'])\nself.exclude = exclude_lbls",
"if... | <|body_start_0|>
if not path_preload is None:
self.df = pd.read_csv(path_preload, index_col=0)
if self.df.index.name == 'art_lbl':
self.df = self.df.reset_index()
else:
self.df = pd.DataFrame([], columns=['art_lbl', 'true_lbl', 's_train', 's_val', 's_t... | Keeps track of all true labels and allows for easy index conversion. Instead of using a fixed dictionary, this allows us to easily adapt to different classification scenarios, if e.g. changing code in the dataset.process_label function | LabelConverter | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LabelConverter:
"""Keeps track of all true labels and allows for easy index conversion. Instead of using a fixed dictionary, this allows us to easily adapt to different classification scenarios, if e.g. changing code in the dataset.process_label function"""
def __init__(self, exclude_lbls=[]... | stack_v2_sparse_classes_75kplus_train_001016 | 4,037 | permissive | [
{
"docstring": "Initialize. Accepts: - exclude_lbls (List of Strings): Ignore all of the labels passed here. - path_preload (path): Load pre-existing dataframe for the label conversion Returns: - Nothing",
"name": "__init__",
"signature": "def __init__(self, exclude_lbls=[], path_preload=None)"
},
{... | 5 | stack_v2_sparse_classes_30k_val_002650 | Implement the Python class `LabelConverter` described below.
Class description:
Keeps track of all true labels and allows for easy index conversion. Instead of using a fixed dictionary, this allows us to easily adapt to different classification scenarios, if e.g. changing code in the dataset.process_label function
Me... | Implement the Python class `LabelConverter` described below.
Class description:
Keeps track of all true labels and allows for easy index conversion. Instead of using a fixed dictionary, this allows us to easily adapt to different classification scenarios, if e.g. changing code in the dataset.process_label function
Me... | 18d21b17fcdf01278826ca1caa8d3cff76c93644 | <|skeleton|>
class LabelConverter:
"""Keeps track of all true labels and allows for easy index conversion. Instead of using a fixed dictionary, this allows us to easily adapt to different classification scenarios, if e.g. changing code in the dataset.process_label function"""
def __init__(self, exclude_lbls=[]... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LabelConverter:
"""Keeps track of all true labels and allows for easy index conversion. Instead of using a fixed dictionary, this allows us to easily adapt to different classification scenarios, if e.g. changing code in the dataset.process_label function"""
def __init__(self, exclude_lbls=[], path_preloa... | the_stack_v2_python_sparse | ml_pipeline/label_converter.py | doparmin/SCEMILA | train | 0 |
7d2bf70a1736b50409a315ef6f4f601f3d63e250 | [
"super(Matern32, self).__init__(n_dims=n_dims, active_dims=active_dims, name=name)\nlogger.debug('Initializing %s kernel.' % self.name)\nself.variance = np.float64(variance)\nself.lengthscale = np.float64(lengthscale)\nself.parameter_list = ['variance', 'lengthscale']\nself.constraint_map = {'variance': '+ve', 'len... | <|body_start_0|>
super(Matern32, self).__init__(n_dims=n_dims, active_dims=active_dims, name=name)
logger.debug('Initializing %s kernel.' % self.name)
self.variance = np.float64(variance)
self.lengthscale = np.float64(lengthscale)
self.parameter_list = ['variance', 'lengthscale']... | Matern32 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Matern32:
def __init__(self, n_dims, variance=1.0, lengthscale=1.0, active_dims=None, name=None):
"""squared exponential kernel Inputs: n_dims : number of dimensions variance : kernel variance lengthscale : kernel lengthscale active_dims : all dims active by default, subset can be specif... | stack_v2_sparse_classes_75kplus_train_001017 | 9,047 | no_license | [
{
"docstring": "squared exponential kernel Inputs: n_dims : number of dimensions variance : kernel variance lengthscale : kernel lengthscale active_dims : all dims active by default, subset can be specified",
"name": "__init__",
"signature": "def __init__(self, n_dims, variance=1.0, lengthscale=1.0, act... | 2 | stack_v2_sparse_classes_30k_train_022435 | Implement the Python class `Matern32` described below.
Class description:
Implement the Matern32 class.
Method signatures and docstrings:
- def __init__(self, n_dims, variance=1.0, lengthscale=1.0, active_dims=None, name=None): squared exponential kernel Inputs: n_dims : number of dimensions variance : kernel varianc... | Implement the Python class `Matern32` described below.
Class description:
Implement the Matern32 class.
Method signatures and docstrings:
- def __init__(self, n_dims, variance=1.0, lengthscale=1.0, active_dims=None, name=None): squared exponential kernel Inputs: n_dims : number of dimensions variance : kernel varianc... | 1bed882b8a94ee58fd0bde6920ee85f81ffb77bb | <|skeleton|>
class Matern32:
def __init__(self, n_dims, variance=1.0, lengthscale=1.0, active_dims=None, name=None):
"""squared exponential kernel Inputs: n_dims : number of dimensions variance : kernel variance lengthscale : kernel lengthscale active_dims : all dims active by default, subset can be specif... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Matern32:
def __init__(self, n_dims, variance=1.0, lengthscale=1.0, active_dims=None, name=None):
"""squared exponential kernel Inputs: n_dims : number of dimensions variance : kernel variance lengthscale : kernel lengthscale active_dims : all dims active by default, subset can be specified"""
... | the_stack_v2_python_sparse | gp_grief/kern/stationary.py | scwolof/gp_grief | train | 2 | |
bf244c8d59f7592201f06cb1c6b38b4b540dd931 | [
"if not request.user.has_perm('Users.prop_get'):\n return HttpResponseForbidden()\nuser = user_backend.get(username=name)\nvalue = property_backend.get(user=user, key=subname)\nreturn HttpRestAuthResponse(request, value)",
"if not request.user.has_perm('Users.prop_set'):\n return HttpResponseForbidden()\nva... | <|body_start_0|>
if not request.user.has_perm('Users.prop_get'):
return HttpResponseForbidden()
user = user_backend.get(username=name)
value = property_backend.get(user=user, key=subname)
return HttpRestAuthResponse(request, value)
<|end_body_0|>
<|body_start_1|>
if ... | Handle requests to ``/users/<user>/props/<prop>/``. | UserPropHandler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserPropHandler:
"""Handle requests to ``/users/<user>/props/<prop>/``."""
def get(self, request, largs, name, subname):
"""Get value of a single property."""
<|body_0|>
def put(self, request, largs, name, subname):
"""Set value of a single property."""
<... | stack_v2_sparse_classes_75kplus_train_001018 | 9,743 | no_license | [
{
"docstring": "Get value of a single property.",
"name": "get",
"signature": "def get(self, request, largs, name, subname)"
},
{
"docstring": "Set value of a single property.",
"name": "put",
"signature": "def put(self, request, largs, name, subname)"
},
{
"docstring": "Delete a... | 3 | stack_v2_sparse_classes_30k_train_026113 | Implement the Python class `UserPropHandler` described below.
Class description:
Handle requests to ``/users/<user>/props/<prop>/``.
Method signatures and docstrings:
- def get(self, request, largs, name, subname): Get value of a single property.
- def put(self, request, largs, name, subname): Set value of a single p... | Implement the Python class `UserPropHandler` described below.
Class description:
Handle requests to ``/users/<user>/props/<prop>/``.
Method signatures and docstrings:
- def get(self, request, largs, name, subname): Get value of a single property.
- def put(self, request, largs, name, subname): Set value of a single p... | 60769f6b4965836b2220878cfa2e1bc403d8f8a3 | <|skeleton|>
class UserPropHandler:
"""Handle requests to ``/users/<user>/props/<prop>/``."""
def get(self, request, largs, name, subname):
"""Get value of a single property."""
<|body_0|>
def put(self, request, largs, name, subname):
"""Set value of a single property."""
<... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UserPropHandler:
"""Handle requests to ``/users/<user>/props/<prop>/``."""
def get(self, request, largs, name, subname):
"""Get value of a single property."""
if not request.user.has_perm('Users.prop_get'):
return HttpResponseForbidden()
user = user_backend.get(usernam... | the_stack_v2_python_sparse | env/lib/python3.6/site-packages/RestAuth/Users/views.py | sachinlokesh05/login-registration-forgotpassword-and-resetpassword-using-django-rest-framework- | train | 3 |
1b8288f681b7d6290681a3a99f05cf38444b377b | [
"self.application_parameters = application_parameters\nself.enable_system_backup = enable_system_backup\nself.file_paths = file_paths\nself.metadata_file_path = metadata_file_path\nself.skip_nested_volumes_vec = skip_nested_volumes_vec\nself.uses_skip_nested_volumes_vec = uses_skip_nested_volumes_vec\nself.volume_g... | <|body_start_0|>
self.application_parameters = application_parameters
self.enable_system_backup = enable_system_backup
self.file_paths = file_paths
self.metadata_file_path = metadata_file_path
self.skip_nested_volumes_vec = skip_nested_volumes_vec
self.uses_skip_nested_vo... | Implementation of the 'PhysicalSpecialParameters' model. Specifies additional special settings applicable for a Protection Source of 'kPhysical' type in a Protection Job. Attributes: application_parameters (ApplicationParameters): Specifies parameters that are related to applications running on the Protection Source. e... | PhysicalSpecialParameters | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PhysicalSpecialParameters:
"""Implementation of the 'PhysicalSpecialParameters' model. Specifies additional special settings applicable for a Protection Source of 'kPhysical' type in a Protection Job. Attributes: application_parameters (ApplicationParameters): Specifies parameters that are relate... | stack_v2_sparse_classes_75kplus_train_001019 | 5,344 | permissive | [
{
"docstring": "Constructor for the PhysicalSpecialParameters class",
"name": "__init__",
"signature": "def __init__(self, application_parameters=None, enable_system_backup=None, file_paths=None, metadata_file_path=None, skip_nested_volumes_vec=None, uses_skip_nested_volumes_vec=None, volume_guid=None, ... | 2 | stack_v2_sparse_classes_30k_train_040363 | Implement the Python class `PhysicalSpecialParameters` described below.
Class description:
Implementation of the 'PhysicalSpecialParameters' model. Specifies additional special settings applicable for a Protection Source of 'kPhysical' type in a Protection Job. Attributes: application_parameters (ApplicationParameters... | Implement the Python class `PhysicalSpecialParameters` described below.
Class description:
Implementation of the 'PhysicalSpecialParameters' model. Specifies additional special settings applicable for a Protection Source of 'kPhysical' type in a Protection Job. Attributes: application_parameters (ApplicationParameters... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class PhysicalSpecialParameters:
"""Implementation of the 'PhysicalSpecialParameters' model. Specifies additional special settings applicable for a Protection Source of 'kPhysical' type in a Protection Job. Attributes: application_parameters (ApplicationParameters): Specifies parameters that are relate... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PhysicalSpecialParameters:
"""Implementation of the 'PhysicalSpecialParameters' model. Specifies additional special settings applicable for a Protection Source of 'kPhysical' type in a Protection Job. Attributes: application_parameters (ApplicationParameters): Specifies parameters that are related to applicat... | the_stack_v2_python_sparse | cohesity_management_sdk/models/physical_special_parameters.py | cohesity/management-sdk-python | train | 24 |
7b7e87a259172baf39c7a34f7314164416272f82 | [
"sorted_array = sorted(nums)\ni, j = (0, len(nums) - 1)\nis_sorted = True\nwhile i < len(nums) and j >= 0 and (i <= j) and (nums[i] == sorted_array[i] or nums[j] == sorted_array[j]):\n if nums[i] != sorted_array[i]:\n is_sorted = False\n else:\n i += 1\n if nums[j] != sorted_array[j]:\n ... | <|body_start_0|>
sorted_array = sorted(nums)
i, j = (0, len(nums) - 1)
is_sorted = True
while i < len(nums) and j >= 0 and (i <= j) and (nums[i] == sorted_array[i] or nums[j] == sorted_array[j]):
if nums[i] != sorted_array[i]:
is_sorted = False
els... | Runtime: 236 ms, faster than 83.62% of Python3 online submissions for Shortest Unsorted Continuous Subarray. Memory Usage: 15.1 MB, less than 5.48% of Python3 online submissions for Shortest Unsorted Continuous Subarray. | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""Runtime: 236 ms, faster than 83.62% of Python3 online submissions for Shortest Unsorted Continuous Subarray. Memory Usage: 15.1 MB, less than 5.48% of Python3 online submissions for Shortest Unsorted Continuous Subarray."""
def findUnsortedSubarray(self, nums):
"""Given ... | stack_v2_sparse_classes_75kplus_train_001020 | 3,567 | no_license | [
{
"docstring": "Given an integer array, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole array will be sorted in ascending order, too. You need to find the shortest such subarray and output its length. Example 1: Input: [2, 6, 4, 8, 10, 9, 15] Outpu... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Runtime: 236 ms, faster than 83.62% of Python3 online submissions for Shortest Unsorted Continuous Subarray. Memory Usage: 15.1 MB, less than 5.48% of Python3 online submissions for Shortest Unsorted Continuous Subarray.
Method signatures and d... | Implement the Python class `Solution` described below.
Class description:
Runtime: 236 ms, faster than 83.62% of Python3 online submissions for Shortest Unsorted Continuous Subarray. Memory Usage: 15.1 MB, less than 5.48% of Python3 online submissions for Shortest Unsorted Continuous Subarray.
Method signatures and d... | 01fe893ba2e37c9bda79e3081c556698f0b6d2f0 | <|skeleton|>
class Solution:
"""Runtime: 236 ms, faster than 83.62% of Python3 online submissions for Shortest Unsorted Continuous Subarray. Memory Usage: 15.1 MB, less than 5.48% of Python3 online submissions for Shortest Unsorted Continuous Subarray."""
def findUnsortedSubarray(self, nums):
"""Given ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
"""Runtime: 236 ms, faster than 83.62% of Python3 online submissions for Shortest Unsorted Continuous Subarray. Memory Usage: 15.1 MB, less than 5.48% of Python3 online submissions for Shortest Unsorted Continuous Subarray."""
def findUnsortedSubarray(self, nums):
"""Given an integer ar... | the_stack_v2_python_sparse | LeetCode/581_shortest_unsorted_continuous_subarray.py | KKosukeee/CodingQuestions | train | 1 |
d3067af5c53f9a9d6e6870148b36130fa9df5093 | [
"if matrix is None or len(matrix) == 0:\n return\nm = len(matrix)\nn = len(matrix[0])\nzero_row = set()\nzero_col = set()\nfor i in range(m):\n for j in range(n):\n if matrix[i][j] == 0:\n zero_row.add(i)\n zero_col.add(j)\nfor i in range(m):\n for j in range(n):\n if i ... | <|body_start_0|>
if matrix is None or len(matrix) == 0:
return
m = len(matrix)
n = len(matrix[0])
zero_row = set()
zero_col = set()
for i in range(m):
for j in range(n):
if matrix[i][j] == 0:
zero_row.add(i)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def setZeroes(self, matrix) -> None:
"""Do not return anything, modify matrix in-place instead. O(m*n)时间复杂度,O(m+n)空间复杂度"""
<|body_0|>
def setZeroes(self, matrix):
"""设置虚拟值,O(1)的额外空间"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if matrix... | stack_v2_sparse_classes_75kplus_train_001021 | 2,731 | no_license | [
{
"docstring": "Do not return anything, modify matrix in-place instead. O(m*n)时间复杂度,O(m+n)空间复杂度",
"name": "setZeroes",
"signature": "def setZeroes(self, matrix) -> None"
},
{
"docstring": "设置虚拟值,O(1)的额外空间",
"name": "setZeroes",
"signature": "def setZeroes(self, matrix)"
}
] | 2 | stack_v2_sparse_classes_30k_train_035343 | 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. O(m*n)时间复杂度,O(m+n)空间复杂度
- def setZeroes(self, matrix): 设置虚拟值,O(1)的额外空间 | 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. O(m*n)时间复杂度,O(m+n)空间复杂度
- def setZeroes(self, matrix): 设置虚拟值,O(1)的额外空间
<|skeleton|>
... | 13e7ec9fe7a92ab13b247bd4edeb1ada5de81a08 | <|skeleton|>
class Solution:
def setZeroes(self, matrix) -> None:
"""Do not return anything, modify matrix in-place instead. O(m*n)时间复杂度,O(m+n)空间复杂度"""
<|body_0|>
def setZeroes(self, matrix):
"""设置虚拟值,O(1)的额外空间"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def setZeroes(self, matrix) -> None:
"""Do not return anything, modify matrix in-place instead. O(m*n)时间复杂度,O(m+n)空间复杂度"""
if matrix is None or len(matrix) == 0:
return
m = len(matrix)
n = len(matrix[0])
zero_row = set()
zero_col = set()
... | the_stack_v2_python_sparse | Algorithms/73_Set_Matrix_Zeroes/Set_Matrix_Zeroes.py | lirui-ML/my_leetcode | train | 1 | |
e0a05eefd0fa0485116cdaafc7be800bf6e082e8 | [
"samples_lims = []\nfor sample in samples:\n LOG.debug(f\"{sample['name']}: prepare LIMS input\")\n samples_lims.append({'name': sample['name'], 'container': sample.get('container') or 'Tube', 'container_name': sample.get('container_name'), 'well_position': sample.get('well_position'), 'index_sequence': sampl... | <|body_start_0|>
samples_lims = []
for sample in samples:
LOG.debug(f"{sample['name']}: prepare LIMS input")
samples_lims.append({'name': sample['name'], 'container': sample.get('container') or 'Tube', 'container_name': sample.get('container_name'), 'well_position': sample.get('w... | LimsHandler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LimsHandler:
def to_lims(customer: str, samples: List[dict]) -> List[dict]:
"""Convert order input to lims interface input."""
<|body_0|>
def process_lims(self, data: dict, samples: List[dict]):
"""Process samples to add them to LIMS."""
<|body_1|>
<|end_ske... | stack_v2_sparse_classes_75kplus_train_001022 | 3,155 | no_license | [
{
"docstring": "Convert order input to lims interface input.",
"name": "to_lims",
"signature": "def to_lims(customer: str, samples: List[dict]) -> List[dict]"
},
{
"docstring": "Process samples to add them to LIMS.",
"name": "process_lims",
"signature": "def process_lims(self, data: dict... | 2 | stack_v2_sparse_classes_30k_train_047261 | Implement the Python class `LimsHandler` described below.
Class description:
Implement the LimsHandler class.
Method signatures and docstrings:
- def to_lims(customer: str, samples: List[dict]) -> List[dict]: Convert order input to lims interface input.
- def process_lims(self, data: dict, samples: List[dict]): Proce... | Implement the Python class `LimsHandler` described below.
Class description:
Implement the LimsHandler class.
Method signatures and docstrings:
- def to_lims(customer: str, samples: List[dict]) -> List[dict]: Convert order input to lims interface input.
- def process_lims(self, data: dict, samples: List[dict]): Proce... | 987b422511ff0299712a59bfe523e9a35dbd3171 | <|skeleton|>
class LimsHandler:
def to_lims(customer: str, samples: List[dict]) -> List[dict]:
"""Convert order input to lims interface input."""
<|body_0|>
def process_lims(self, data: dict, samples: List[dict]):
"""Process samples to add them to LIMS."""
<|body_1|>
<|end_ske... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LimsHandler:
def to_lims(customer: str, samples: List[dict]) -> List[dict]:
"""Convert order input to lims interface input."""
samples_lims = []
for sample in samples:
LOG.debug(f"{sample['name']}: prepare LIMS input")
samples_lims.append({'name': sample['name']... | the_stack_v2_python_sparse | cg/meta/orders/lims.py | dnil/cg | train | 2 | |
f3203396f99f255294b25d2d8fac0176d698f926 | [
"time.sleep(6)\nPcenterPage(login).click_order()\ntry:\n assert OrderlistPage(login).get_ordertext() == order_data.order_success['check']\n logging.info('成功进入订单页面')\nexcept:\n logging.error('断言失败')\n common.save_screenShot(login, model_name='订单查询页面')\n raise",
"time.sleep(6)\nPcenterPage(login).cli... | <|body_start_0|>
time.sleep(6)
PcenterPage(login).click_order()
try:
assert OrderlistPage(login).get_ordertext() == order_data.order_success['check']
logging.info('成功进入订单页面')
except:
logging.error('断言失败')
common.save_screenShot(login, model... | 查询我的订单 | Testsearchorder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Testsearchorder:
"""查询我的订单"""
def test_allorder(self, login):
"""成功查询全部订单"""
<|body_0|>
def test_pending(self, login):
"""成功查询待付款订单"""
<|body_1|>
def test_processing(self, login):
"""成功查询待发货订单"""
<|body_2|>
def test_delivering(se... | stack_v2_sparse_classes_75kplus_train_001023 | 2,948 | no_license | [
{
"docstring": "成功查询全部订单",
"name": "test_allorder",
"signature": "def test_allorder(self, login)"
},
{
"docstring": "成功查询待付款订单",
"name": "test_pending",
"signature": "def test_pending(self, login)"
},
{
"docstring": "成功查询待发货订单",
"name": "test_processing",
"signature": "de... | 5 | null | Implement the Python class `Testsearchorder` described below.
Class description:
查询我的订单
Method signatures and docstrings:
- def test_allorder(self, login): 成功查询全部订单
- def test_pending(self, login): 成功查询待付款订单
- def test_processing(self, login): 成功查询待发货订单
- def test_delivering(self, login): 成功查询已发货订单
- def test_complet... | Implement the Python class `Testsearchorder` described below.
Class description:
查询我的订单
Method signatures and docstrings:
- def test_allorder(self, login): 成功查询全部订单
- def test_pending(self, login): 成功查询待付款订单
- def test_processing(self, login): 成功查询待发货订单
- def test_delivering(self, login): 成功查询已发货订单
- def test_complet... | b262c13e55a6e9eae1d4fa11d50b71814028261c | <|skeleton|>
class Testsearchorder:
"""查询我的订单"""
def test_allorder(self, login):
"""成功查询全部订单"""
<|body_0|>
def test_pending(self, login):
"""成功查询待付款订单"""
<|body_1|>
def test_processing(self, login):
"""成功查询待发货订单"""
<|body_2|>
def test_delivering(se... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Testsearchorder:
"""查询我的订单"""
def test_allorder(self, login):
"""成功查询全部订单"""
time.sleep(6)
PcenterPage(login).click_order()
try:
assert OrderlistPage(login).get_ordertext() == order_data.order_success['check']
logging.info('成功进入订单页面')
except... | the_stack_v2_python_sparse | TestCase/test_C_phone/test_searorder.py | xjx985426946/Test_UI | train | 0 |
592413a9bc7bff971ad2dffda78a106b9e2831f1 | [
"rmax = arr[-1]\nfor i in range(len(arr) - 1, 0, -1):\n temp = arr[i]\n arr[i] = rmax\n rmax = max(temp, rmax)\narr[0] = rmax\narr[-1] = -1\nreturn arr",
"for i in range(len(arr) - 1):\n arr[i] = max(arr[i + 1:])\narr[-1] = -1\nreturn arr"
] | <|body_start_0|>
rmax = arr[-1]
for i in range(len(arr) - 1, 0, -1):
temp = arr[i]
arr[i] = rmax
rmax = max(temp, rmax)
arr[0] = rmax
arr[-1] = -1
return arr
<|end_body_0|>
<|body_start_1|>
for i in range(len(arr) - 1):
arr... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def replaceElements(self, arr):
""":type arr: List[int] :rtype: List[int]"""
<|body_0|>
def replaceElements(self, arr):
""":type arr: List[int] :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
rmax = arr[-1]
for i ... | stack_v2_sparse_classes_75kplus_train_001024 | 659 | no_license | [
{
"docstring": ":type arr: List[int] :rtype: List[int]",
"name": "replaceElements",
"signature": "def replaceElements(self, arr)"
},
{
"docstring": ":type arr: List[int] :rtype: List[int]",
"name": "replaceElements",
"signature": "def replaceElements(self, arr)"
}
] | 2 | stack_v2_sparse_classes_30k_train_048204 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def replaceElements(self, arr): :type arr: List[int] :rtype: List[int]
- def replaceElements(self, arr): :type arr: List[int] :rtype: List[int] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def replaceElements(self, arr): :type arr: List[int] :rtype: List[int]
- def replaceElements(self, arr): :type arr: List[int] :rtype: List[int]
<|skeleton|>
class Solution:
... | a509b383a42f54313970168d9faa11f088f18708 | <|skeleton|>
class Solution:
def replaceElements(self, arr):
""":type arr: List[int] :rtype: List[int]"""
<|body_0|>
def replaceElements(self, arr):
""":type arr: List[int] :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def replaceElements(self, arr):
""":type arr: List[int] :rtype: List[int]"""
rmax = arr[-1]
for i in range(len(arr) - 1, 0, -1):
temp = arr[i]
arr[i] = rmax
rmax = max(temp, rmax)
arr[0] = rmax
arr[-1] = -1
return ar... | the_stack_v2_python_sparse | 1299_Replace_Elements_with_Greatest_Element_on_Right_Side.py | bingli8802/leetcode | train | 0 | |
21908cfbba2010fa49e453bc29acec605e55b66d | [
"AutoSqlField.__init__(self, autosql, parent=parent, delim=delim)\ntry:\n self.attr['size'] = int(self.attr['size'])\n self.attr['size_is_int'] = True\nexcept ValueError:\n self.attr['size_is_int'] = False",
"if self.formatter != str:\n try:\n retval = tuple([self.formatter(X) for X in text.str... | <|body_start_0|>
AutoSqlField.__init__(self, autosql, parent=parent, delim=delim)
try:
self.attr['size'] = int(self.attr['size'])
self.attr['size_is_int'] = True
except ValueError:
self.attr['size_is_int'] = False
<|end_body_0|>
<|body_start_1|>
if se... | Parser factory for autoSql fields of type ``fieldType `[` fieldSize `]` fieldName ';' comment`` Parameters ---------- autosql : str Block of autoSql text specifying format of element parent : instance of subclass of |AbstractAutoSqlObject| or None, optional Parent / enclosing element. Default: None delim : str, optiona... | SizedAutoSqlField | [
"BSD-3-Clause",
"MIT",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SizedAutoSqlField:
"""Parser factory for autoSql fields of type ``fieldType `[` fieldSize `]` fieldName ';' comment`` Parameters ---------- autosql : str Block of autoSql text specifying format of element parent : instance of subclass of |AbstractAutoSqlObject| or None, optional Parent / enclosin... | stack_v2_sparse_classes_75kplus_train_001025 | 24,558 | permissive | [
{
"docstring": "Create a |SizedAutoSqlField| Parameters ---------- autosql : str Block of autoSql text specifying format of element parent : instance of subclass of |AbstractAutoSqlObject| or None, optional Parent / enclosing element. Default: None delim : str, optional Field delimiter (default: tab)",
"nam... | 2 | null | Implement the Python class `SizedAutoSqlField` described below.
Class description:
Parser factory for autoSql fields of type ``fieldType `[` fieldSize `]` fieldName ';' comment`` Parameters ---------- autosql : str Block of autoSql text specifying format of element parent : instance of subclass of |AbstractAutoSqlObje... | Implement the Python class `SizedAutoSqlField` described below.
Class description:
Parser factory for autoSql fields of type ``fieldType `[` fieldSize `]` fieldName ';' comment`` Parameters ---------- autosql : str Block of autoSql text specifying format of element parent : instance of subclass of |AbstractAutoSqlObje... | d97f239d73b3a7c2eff46f71928b777431891f90 | <|skeleton|>
class SizedAutoSqlField:
"""Parser factory for autoSql fields of type ``fieldType `[` fieldSize `]` fieldName ';' comment`` Parameters ---------- autosql : str Block of autoSql text specifying format of element parent : instance of subclass of |AbstractAutoSqlObject| or None, optional Parent / enclosin... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SizedAutoSqlField:
"""Parser factory for autoSql fields of type ``fieldType `[` fieldSize `]` fieldName ';' comment`` Parameters ---------- autosql : str Block of autoSql text specifying format of element parent : instance of subclass of |AbstractAutoSqlObject| or None, optional Parent / enclosing element. De... | the_stack_v2_python_sparse | plastid/readers/autosql.py | joshuagryphon/plastid | train | 35 |
40b37e7e96924811468d9e0e368beb798c02949a | [
"self.parser = argparse.ArgumentParser(prog='switchmap-ng-cli', description=additional_help, formatter_class=argparse.RawTextHelpFormatter)\nsubparsers = self.parser.add_subparsers(dest='action')\n_Show(subparsers)\n_Start(subparsers)\n_Stop(subparsers)\n_Restart(subparsers)\n_Test(subparsers)\nself.args = self.par... | <|body_start_0|>
self.parser = argparse.ArgumentParser(prog='switchmap-ng-cli', description=additional_help, formatter_class=argparse.RawTextHelpFormatter)
subparsers = self.parser.add_subparsers(dest='action')
_Show(subparsers)
_Start(subparsers)
_Stop(subparsers)
_Resta... | Class that manages the CLI. | CLI | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CLI:
"""Class that manages the CLI."""
def __init__(self, additional_help=''):
"""Method initializing the class. Args: additional_help: String for additional help information Returns: None"""
<|body_0|>
def process(self):
"""Act on CLI arguments. Args: None Retur... | stack_v2_sparse_classes_75kplus_train_001026 | 14,010 | permissive | [
{
"docstring": "Method initializing the class. Args: additional_help: String for additional help information Returns: None",
"name": "__init__",
"signature": "def __init__(self, additional_help='')"
},
{
"docstring": "Act on CLI arguments. Args: None Returns: None",
"name": "process",
"s... | 2 | stack_v2_sparse_classes_30k_train_048282 | Implement the Python class `CLI` described below.
Class description:
Class that manages the CLI.
Method signatures and docstrings:
- def __init__(self, additional_help=''): Method initializing the class. Args: additional_help: String for additional help information Returns: None
- def process(self): Act on CLI argume... | Implement the Python class `CLI` described below.
Class description:
Class that manages the CLI.
Method signatures and docstrings:
- def __init__(self, additional_help=''): Method initializing the class. Args: additional_help: String for additional help information Returns: None
- def process(self): Act on CLI argume... | ae82589fbbab77fef6d6be09c1fcca5846f595a8 | <|skeleton|>
class CLI:
"""Class that manages the CLI."""
def __init__(self, additional_help=''):
"""Method initializing the class. Args: additional_help: String for additional help information Returns: None"""
<|body_0|>
def process(self):
"""Act on CLI arguments. Args: None Retur... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CLI:
"""Class that manages the CLI."""
def __init__(self, additional_help=''):
"""Method initializing the class. Args: additional_help: String for additional help information Returns: None"""
self.parser = argparse.ArgumentParser(prog='switchmap-ng-cli', description=additional_help, forma... | the_stack_v2_python_sparse | switchmap/cli/cli.py | PalisadoesFoundation/switchmap-ng | train | 8 |
f9d492fed0c304ee288365981622ef19f9c7a7cb | [
"lat = math.radians(lat_d)\nlon = math.radians(lon_d)\nfrac_year = math.pi * 2 / 365 * (day_of_year - 1)\neq_time = 229.18 * (7.5e-05 + 0.001868 * math.cos(frac_year) - 0.032077 * math.sin(frac_year) - 0.014615 * math.cos(2 * frac_year) - 0.040849 * math.sin(2 * frac_year))\ndecl = 0.006918 - 0.399912 * math.cos(fr... | <|body_start_0|>
lat = math.radians(lat_d)
lon = math.radians(lon_d)
frac_year = math.pi * 2 / 365 * (day_of_year - 1)
eq_time = 229.18 * (7.5e-05 + 0.001868 * math.cos(frac_year) - 0.032077 * math.sin(frac_year) - 0.014615 * math.cos(2 * frac_year) - 0.040849 * math.sin(2 * frac_year))
... | sunsetTimes | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class sunsetTimes:
def __init__(self, lat_d, lon_d, day_of_year, time_zone=0):
"""lat_d: float Latitude in degrees lon_d: float Longitude in degrees date: int Day of the year time_zone: int Offset to the UTC-Timezone"""
<|body_0|>
def utc_times(self, lon, hour_angle, eq_time):
... | stack_v2_sparse_classes_75kplus_train_001027 | 6,908 | no_license | [
{
"docstring": "lat_d: float Latitude in degrees lon_d: float Longitude in degrees date: int Day of the year time_zone: int Offset to the UTC-Timezone",
"name": "__init__",
"signature": "def __init__(self, lat_d, lon_d, day_of_year, time_zone=0)"
},
{
"docstring": "returns utc sunrise and sunset... | 3 | stack_v2_sparse_classes_30k_train_032250 | Implement the Python class `sunsetTimes` described below.
Class description:
Implement the sunsetTimes class.
Method signatures and docstrings:
- def __init__(self, lat_d, lon_d, day_of_year, time_zone=0): lat_d: float Latitude in degrees lon_d: float Longitude in degrees date: int Day of the year time_zone: int Offs... | Implement the Python class `sunsetTimes` described below.
Class description:
Implement the sunsetTimes class.
Method signatures and docstrings:
- def __init__(self, lat_d, lon_d, day_of_year, time_zone=0): lat_d: float Latitude in degrees lon_d: float Longitude in degrees date: int Day of the year time_zone: int Offs... | b7999ef35646c14f8b30d489aae6f5e1114593d8 | <|skeleton|>
class sunsetTimes:
def __init__(self, lat_d, lon_d, day_of_year, time_zone=0):
"""lat_d: float Latitude in degrees lon_d: float Longitude in degrees date: int Day of the year time_zone: int Offset to the UTC-Timezone"""
<|body_0|>
def utc_times(self, lon, hour_angle, eq_time):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class sunsetTimes:
def __init__(self, lat_d, lon_d, day_of_year, time_zone=0):
"""lat_d: float Latitude in degrees lon_d: float Longitude in degrees date: int Day of the year time_zone: int Offset to the UTC-Timezone"""
lat = math.radians(lat_d)
lon = math.radians(lon_d)
frac_year = ... | the_stack_v2_python_sparse | server/modules/sonnen_auf_und_untergang.py | TimHeideck/LUNA | train | 0 | |
06ca5f88badc833510d948f797ba3ffa9d1729b7 | [
"def write(root):\n if not root:\n return\n res.append(str(root.val))\n for child in root.children:\n write(child)\n res.append('#')\nres = []\nwrite(root)\nreturn ' '.join(res)",
"if not data:\n return None\ndata = collections.deque(data.split(' '))\nroot = Node(int(data.popleft()), ... | <|body_start_0|>
def write(root):
if not root:
return
res.append(str(root.val))
for child in root.children:
write(child)
res.append('#')
res = []
write(root)
return ' '.join(res)
<|end_body_0|>
<|body_start_... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: Node"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|... | stack_v2_sparse_classes_75kplus_train_001028 | 1,306 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: Node :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: Node",
"name": "deserialize",
"signature": "def deserialize(self, ... | 2 | stack_v2_sparse_classes_30k_test_002924 | 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: Node :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: Nod... | 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: Node :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: Nod... | 431b763bf3019bac7c08619d7ffef37e638940e8 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: Node"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
def write(root):
if not root:
return
res.append(str(root.val))
for child in root.children:
write(child)
res.ap... | the_stack_v2_python_sparse | notes/0428/0428.py | PaulGuo5/Leetcode-notes | train | 1 | |
eb607464bf4a290475e750e3e218a9925c788e6b | [
"if isinstance(value, str):\n return json.loads(value)\nreturn value",
"if isinstance(data, str):\n try:\n return json.loads(data)\n except ValueError as e:\n raise serializers.ValidationError(str(e)) from e\nreturn data",
"if isinstance(data, str):\n return json.loads(data)\nreturn da... | <|body_start_0|>
if isinstance(value, str):
return json.loads(value)
return value
<|end_body_0|>
<|body_start_1|>
if isinstance(data, str):
try:
return json.loads(data)
except ValueError as e:
raise serializers.ValidationError(... | Deserialize a string instance containing a JSON document to a Python object. | JsonField | [
"BSD-2-Clause",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JsonField:
"""Deserialize a string instance containing a JSON document to a Python object."""
def to_representation(self, value):
"""Deserialize ``value`` a `str` instance containing a JSON document to a Python object."""
<|body_0|>
def to_internal_value(self, data):
... | stack_v2_sparse_classes_75kplus_train_001029 | 1,166 | permissive | [
{
"docstring": "Deserialize ``value`` a `str` instance containing a JSON document to a Python object.",
"name": "to_representation",
"signature": "def to_representation(self, value)"
},
{
"docstring": "Deserialize ``value`` a `str` instance containing a JSON document to a Python object.",
"n... | 3 | stack_v2_sparse_classes_30k_train_001950 | Implement the Python class `JsonField` described below.
Class description:
Deserialize a string instance containing a JSON document to a Python object.
Method signatures and docstrings:
- def to_representation(self, value): Deserialize ``value`` a `str` instance containing a JSON document to a Python object.
- def to... | Implement the Python class `JsonField` described below.
Class description:
Deserialize a string instance containing a JSON document to a Python object.
Method signatures and docstrings:
- def to_representation(self, value): Deserialize ``value`` a `str` instance containing a JSON document to a Python object.
- def to... | e5bdec91cb47179172b515bbcb91701262ff3377 | <|skeleton|>
class JsonField:
"""Deserialize a string instance containing a JSON document to a Python object."""
def to_representation(self, value):
"""Deserialize ``value`` a `str` instance containing a JSON document to a Python object."""
<|body_0|>
def to_internal_value(self, data):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class JsonField:
"""Deserialize a string instance containing a JSON document to a Python object."""
def to_representation(self, value):
"""Deserialize ``value`` a `str` instance containing a JSON document to a Python object."""
if isinstance(value, str):
return json.loads(value)
... | the_stack_v2_python_sparse | onadata/libs/serializers/fields/json_field.py | onaio/onadata | train | 177 |
ff813229ad023f9a1978988508e641f0409dc0ee | [
"config = ConfigObj()\nconfig.filename = filename\nfor k, v in cls.defaults.items():\n config[k] = v.default\nconfig.write()",
"if not os.path.exists(filename):\n self.create_default(filename)\nconfig = ConfigObj(filename)\nfor k, v in self.defaults.items():\n try:\n value = config.get(k, v.defaul... | <|body_start_0|>
config = ConfigObj()
config.filename = filename
for k, v in cls.defaults.items():
config[k] = v.default
config.write()
<|end_body_0|>
<|body_start_1|>
if not os.path.exists(filename):
self.create_default(filename)
config = ConfigO... | Config | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Config:
def create_default(cls, filename: str):
"""Create a default configuration file using the provided filename. Parameters ---------- filename : str The filename to save the default configuration to. Returns -------"""
<|body_0|>
def __init__(self, filename: str):
... | stack_v2_sparse_classes_75kplus_train_001030 | 4,719 | no_license | [
{
"docstring": "Create a default configuration file using the provided filename. Parameters ---------- filename : str The filename to save the default configuration to. Returns -------",
"name": "create_default",
"signature": "def create_default(cls, filename: str)"
},
{
"docstring": "Handles lo... | 2 | stack_v2_sparse_classes_30k_train_041457 | Implement the Python class `Config` described below.
Class description:
Implement the Config class.
Method signatures and docstrings:
- def create_default(cls, filename: str): Create a default configuration file using the provided filename. Parameters ---------- filename : str The filename to save the default configu... | Implement the Python class `Config` described below.
Class description:
Implement the Config class.
Method signatures and docstrings:
- def create_default(cls, filename: str): Create a default configuration file using the provided filename. Parameters ---------- filename : str The filename to save the default configu... | 1e0bb23e1bb1899c6380a631b1a5001b4058aa7a | <|skeleton|>
class Config:
def create_default(cls, filename: str):
"""Create a default configuration file using the provided filename. Parameters ---------- filename : str The filename to save the default configuration to. Returns -------"""
<|body_0|>
def __init__(self, filename: str):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Config:
def create_default(cls, filename: str):
"""Create a default configuration file using the provided filename. Parameters ---------- filename : str The filename to save the default configuration to. Returns -------"""
config = ConfigObj()
config.filename = filename
for k, ... | the_stack_v2_python_sparse | src/config.py | ICRAR/rfi_ml | train | 1 | |
7199bee165bcb0a6ae55af40f28adaf8bc0bd30b | [
"current_app.logger.info('<Transaction.get for invoice : %s, payment : %s, transaction %s', invoice_id, payment_id, transaction_id)\ntry:\n response, status = (TransactionService.find_by_id(transaction_id).asdict(), HTTPStatus.OK)\nexcept BusinessException as exception:\n return exception.response()\ncurrent_... | <|body_start_0|>
current_app.logger.info('<Transaction.get for invoice : %s, payment : %s, transaction %s', invoice_id, payment_id, transaction_id)
try:
response, status = (TransactionService.find_by_id(transaction_id).asdict(), HTTPStatus.OK)
except BusinessException as exception:
... | Endpoint resource to get transaction. | Transactions | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Transactions:
"""Endpoint resource to get transaction."""
def get(invoice_id: int=None, payment_id: int=None, transaction_id=None):
"""Get the Transaction record."""
<|body_0|>
def patch(invoice_id: int=None, payment_id: int=None, transaction_id=None):
"""Update ... | stack_v2_sparse_classes_75kplus_train_001031 | 4,955 | permissive | [
{
"docstring": "Get the Transaction record.",
"name": "get",
"signature": "def get(invoice_id: int=None, payment_id: int=None, transaction_id=None)"
},
{
"docstring": "Update the transaction record by querying payment system.",
"name": "patch",
"signature": "def patch(invoice_id: int=Non... | 2 | stack_v2_sparse_classes_30k_train_025078 | Implement the Python class `Transactions` described below.
Class description:
Endpoint resource to get transaction.
Method signatures and docstrings:
- def get(invoice_id: int=None, payment_id: int=None, transaction_id=None): Get the Transaction record.
- def patch(invoice_id: int=None, payment_id: int=None, transact... | Implement the Python class `Transactions` described below.
Class description:
Endpoint resource to get transaction.
Method signatures and docstrings:
- def get(invoice_id: int=None, payment_id: int=None, transaction_id=None): Get the Transaction record.
- def patch(invoice_id: int=None, payment_id: int=None, transact... | 0d71d37b0e08d11f6b6d9f59a4b202dfabc98fc1 | <|skeleton|>
class Transactions:
"""Endpoint resource to get transaction."""
def get(invoice_id: int=None, payment_id: int=None, transaction_id=None):
"""Get the Transaction record."""
<|body_0|>
def patch(invoice_id: int=None, payment_id: int=None, transaction_id=None):
"""Update ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Transactions:
"""Endpoint resource to get transaction."""
def get(invoice_id: int=None, payment_id: int=None, transaction_id=None):
"""Get the Transaction record."""
current_app.logger.info('<Transaction.get for invoice : %s, payment : %s, transaction %s', invoice_id, payment_id, transact... | the_stack_v2_python_sparse | pay-api/src/pay_api/resources/transaction.py | bcgov/sbc-pay | train | 6 |
ea24f51eb52a437f6c43dac6c0169fcf311ea198 | [
"self.hasher = PBKDF2Sha256Hasher(iterations or self.iterations, salt_length or self.salt_length)\nif value is not None and value.count('$') != 3:\n raise HashValidationError('This is not a valid hash: {}'.format(value))\nself.value = value",
"if isinstance(value, str):\n if self.hasher.verify(value, self.v... | <|body_start_0|>
self.hasher = PBKDF2Sha256Hasher(iterations or self.iterations, salt_length or self.salt_length)
if value is not None and value.count('$') != 3:
raise HashValidationError('This is not a valid hash: {}'.format(value))
self.value = value
<|end_body_0|>
<|body_start_1|... | Define a Mutable Hash. This provides utilities to securely store and compare passwords or other values that need to be hashed. This class supports changing the number of iterations or the length of the salt transparently and the update to existing hashes will be done the first time a value is compared successfully to t... | SecureHash | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SecureHash:
"""Define a Mutable Hash. This provides utilities to securely store and compare passwords or other values that need to be hashed. This class supports changing the number of iterations or the length of the salt transparently and the update to existing hashes will be done the first time... | stack_v2_sparse_classes_75kplus_train_001032 | 6,682 | permissive | [
{
"docstring": "Create a new Hash with the given parameters. If `value` is not None, then it must be an already hashed value. To create a hash of a new value, please use the `SecureHash.hash`. :param value: current hash value :param iterations: number of iterations to make with the hashing algorithm if it suppo... | 3 | stack_v2_sparse_classes_30k_train_022541 | Implement the Python class `SecureHash` described below.
Class description:
Define a Mutable Hash. This provides utilities to securely store and compare passwords or other values that need to be hashed. This class supports changing the number of iterations or the length of the salt transparently and the update to exis... | Implement the Python class `SecureHash` described below.
Class description:
Define a Mutable Hash. This provides utilities to securely store and compare passwords or other values that need to be hashed. This class supports changing the number of iterations or the length of the salt transparently and the update to exis... | dc85c0dde1a9fbc00a637beba16ce519438415bb | <|skeleton|>
class SecureHash:
"""Define a Mutable Hash. This provides utilities to securely store and compare passwords or other values that need to be hashed. This class supports changing the number of iterations or the length of the salt transparently and the update to existing hashes will be done the first time... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SecureHash:
"""Define a Mutable Hash. This provides utilities to securely store and compare passwords or other values that need to be hashed. This class supports changing the number of iterations or the length of the salt transparently and the update to existing hashes will be done the first time a value is c... | the_stack_v2_python_sparse | backend/crypto.py | BenjaminSchubert/web-polls | train | 0 |
0517445561126a770cafbea0bc07bbd219ad8f25 | [
"super().__init__()\nself.init_size = img_size // 4\nself.fc = torch.nn.Sequential(torch.nn.Linear(latent_dim, 128 * self.init_size ** 2))\nself.shared_conv = torch.nn.Sequential(torch.nn.BatchNorm2d(128), torch.nn.Upsample(scale_factor=2), torch.nn.Conv2d(128, 128, 3, stride=1, padding=1), torch.nn.BatchNorm2d(128... | <|body_start_0|>
super().__init__()
self.init_size = img_size // 4
self.fc = torch.nn.Sequential(torch.nn.Linear(latent_dim, 128 * self.init_size ** 2))
self.shared_conv = torch.nn.Sequential(torch.nn.BatchNorm2d(128), torch.nn.Upsample(scale_factor=2), torch.nn.Conv2d(128, 128, 3, strid... | Network of coupled generators (coupling is done via parameter sharing) | CoupledGenerators | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CoupledGenerators:
"""Network of coupled generators (coupling is done via parameter sharing)"""
def __init__(self, img_size, latent_dim, in_channels):
"""Parameters ---------- img_size : int size of input images latent_dim : int size of latent dimension in_channels : int number of im... | stack_v2_sparse_classes_75kplus_train_001033 | 4,565 | permissive | [
{
"docstring": "Parameters ---------- img_size : int size of input images latent_dim : int size of latent dimension in_channels : int number of image channels",
"name": "__init__",
"signature": "def __init__(self, img_size, latent_dim, in_channels)"
},
{
"docstring": "Feeds input noise through t... | 2 | stack_v2_sparse_classes_30k_train_011444 | Implement the Python class `CoupledGenerators` described below.
Class description:
Network of coupled generators (coupling is done via parameter sharing)
Method signatures and docstrings:
- def __init__(self, img_size, latent_dim, in_channels): Parameters ---------- img_size : int size of input images latent_dim : in... | Implement the Python class `CoupledGenerators` described below.
Class description:
Network of coupled generators (coupling is done via parameter sharing)
Method signatures and docstrings:
- def __init__(self, img_size, latent_dim, in_channels): Parameters ---------- img_size : int size of input images latent_dim : in... | 1078f5030b8aac2bf022daf5fa14d66f74c3c893 | <|skeleton|>
class CoupledGenerators:
"""Network of coupled generators (coupling is done via parameter sharing)"""
def __init__(self, img_size, latent_dim, in_channels):
"""Parameters ---------- img_size : int size of input images latent_dim : int size of latent dimension in_channels : int number of im... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CoupledGenerators:
"""Network of coupled generators (coupling is done via parameter sharing)"""
def __init__(self, img_size, latent_dim, in_channels):
"""Parameters ---------- img_size : int size of input images latent_dim : int size of latent dimension in_channels : int number of image channels"... | the_stack_v2_python_sparse | dlutils/models/gans/coupled/models.py | justusschock/dl-utils | train | 15 |
02e25189efdd6f843086e08855dc3669191f9085 | [
"MobileText = self.find_element(*self.MobileTextElement)\nMobileText.send_keys(mobilevalue)\nlogger.info('MobileText is sendValues!')\nself.getScreenShot()",
"VerifyCodeText = self.find_element(*self.VerifyCodeTextElement)\nVerifyCodeText.send_keys('111222')\nlogger.info('VerifyCodeText is sendValues!')\nself.get... | <|body_start_0|>
MobileText = self.find_element(*self.MobileTextElement)
MobileText.send_keys(mobilevalue)
logger.info('MobileText is sendValues!')
self.getScreenShot()
<|end_body_0|>
<|body_start_1|>
VerifyCodeText = self.find_element(*self.VerifyCodeTextElement)
Verify... | Teacher | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Teacher:
def MobileTextObj(self, mobilevalue):
"""输入手机号"""
<|body_0|>
def VerifyCodeTextObj(self):
"""输入验证码"""
<|body_1|>
def LoginBtnObj(self):
"""登录按钮"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
MobileText = self.find_elem... | stack_v2_sparse_classes_75kplus_train_001034 | 1,932 | no_license | [
{
"docstring": "输入手机号",
"name": "MobileTextObj",
"signature": "def MobileTextObj(self, mobilevalue)"
},
{
"docstring": "输入验证码",
"name": "VerifyCodeTextObj",
"signature": "def VerifyCodeTextObj(self)"
},
{
"docstring": "登录按钮",
"name": "LoginBtnObj",
"signature": "def Login... | 3 | stack_v2_sparse_classes_30k_train_051555 | Implement the Python class `Teacher` described below.
Class description:
Implement the Teacher class.
Method signatures and docstrings:
- def MobileTextObj(self, mobilevalue): 输入手机号
- def VerifyCodeTextObj(self): 输入验证码
- def LoginBtnObj(self): 登录按钮 | Implement the Python class `Teacher` described below.
Class description:
Implement the Teacher class.
Method signatures and docstrings:
- def MobileTextObj(self, mobilevalue): 输入手机号
- def VerifyCodeTextObj(self): 输入验证码
- def LoginBtnObj(self): 登录按钮
<|skeleton|>
class Teacher:
def MobileTextObj(self, mobilevalue... | c4e11c8aa67306111ca2831a18af4363831af939 | <|skeleton|>
class Teacher:
def MobileTextObj(self, mobilevalue):
"""输入手机号"""
<|body_0|>
def VerifyCodeTextObj(self):
"""输入验证码"""
<|body_1|>
def LoginBtnObj(self):
"""登录按钮"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Teacher:
def MobileTextObj(self, mobilevalue):
"""输入手机号"""
MobileText = self.find_element(*self.MobileTextElement)
MobileText.send_keys(mobilevalue)
logger.info('MobileText is sendValues!')
self.getScreenShot()
def VerifyCodeTextObj(self):
"""输入验证码"""
... | the_stack_v2_python_sparse | Public/Pages/teacher.py | alexzeger/android_teacher | train | 0 | |
a95ea775b95eb69dcd1353ed29ee2e29e46a9504 | [
"self.pq = None\nif data is not None:\n self.pq = ListNode(data, None)",
"if self.pq is None:\n self.pq = ListNode(element, None)\nelif self.pq.val[1] > element[1]:\n new_node = ListNode(element, self.pq)\n self.pq = new_node\nelse:\n current = self.pq\n while current.next is not None:\n ... | <|body_start_0|>
self.pq = None
if data is not None:
self.pq = ListNode(data, None)
<|end_body_0|>
<|body_start_1|>
if self.pq is None:
self.pq = ListNode(element, None)
elif self.pq.val[1] > element[1]:
new_node = ListNode(element, self.pq)
... | PriorityQueue | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PriorityQueue:
def __init__(self, data=None):
""":param data: the first data user wants to input"""
<|body_0|>
def enqueue(self, element):
"""User call this method to add element to self.pq sorted by element[1] :param element: Tuple(Any, int), sort with element[1] fo... | stack_v2_sparse_classes_75kplus_train_001035 | 2,594 | no_license | [
{
"docstring": ":param data: the first data user wants to input",
"name": "__init__",
"signature": "def __init__(self, data=None)"
},
{
"docstring": "User call this method to add element to self.pq sorted by element[1] :param element: Tuple(Any, int), sort with element[1] for priority queue",
... | 5 | stack_v2_sparse_classes_30k_train_021509 | Implement the Python class `PriorityQueue` described below.
Class description:
Implement the PriorityQueue class.
Method signatures and docstrings:
- def __init__(self, data=None): :param data: the first data user wants to input
- def enqueue(self, element): User call this method to add element to self.pq sorted by e... | Implement the Python class `PriorityQueue` described below.
Class description:
Implement the PriorityQueue class.
Method signatures and docstrings:
- def __init__(self, data=None): :param data: the first data user wants to input
- def enqueue(self, element): User call this method to add element to self.pq sorted by e... | 6bd29c6c428b8708b8d35dc3624e07346e595f39 | <|skeleton|>
class PriorityQueue:
def __init__(self, data=None):
""":param data: the first data user wants to input"""
<|body_0|>
def enqueue(self, element):
"""User call this method to add element to self.pq sorted by element[1] :param element: Tuple(Any, int), sort with element[1] fo... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PriorityQueue:
def __init__(self, data=None):
""":param data: the first data user wants to input"""
self.pq = None
if data is not None:
self.pq = ListNode(data, None)
def enqueue(self, element):
"""User call this method to add element to self.pq sorted by eleme... | the_stack_v2_python_sparse | huffman_encoding/ds.py | c-wade/python_project | train | 0 | |
afd7e44a50b542db8182b5deb5496a6a47839ef0 | [
"super(DotAttention, self).__init__()\nself.key_size = key_size\nself.value_size = value_size\nself.scale = math.sqrt(key_size)\nself.drop = nn.Dropout(dropout)\nself.softmax = nn.Softmax(dim=-1)",
"output = torch.matmul(Q, K.transpose(-1, -2)) / self.scale\nif mask_out is not None:\n output.masked_fill_(mask_... | <|body_start_0|>
super(DotAttention, self).__init__()
self.key_size = key_size
self.value_size = value_size
self.scale = math.sqrt(key_size)
self.drop = nn.Dropout(dropout)
self.softmax = nn.Softmax(dim=-1)
<|end_body_0|>
<|body_start_1|>
output = torch.matmul(Q,... | DotAttention,作为MultiHeadAttention的组成部分 | DotAttention | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DotAttention:
"""DotAttention,作为MultiHeadAttention的组成部分"""
def __init__(self, key_size, value_size, dropout=0.0):
""":param key_size: 键的维度 :param value_size: 一般和key_size相等 :param dropout:"""
<|body_0|>
def forward(self, Q, K, V, mask_out=None):
""":param Q: [...,... | stack_v2_sparse_classes_75kplus_train_001036 | 3,744 | no_license | [
{
"docstring": ":param key_size: 键的维度 :param value_size: 一般和key_size相等 :param dropout:",
"name": "__init__",
"signature": "def __init__(self, key_size, value_size, dropout=0.0)"
},
{
"docstring": ":param Q: [..., seq_len_q, key_size] :param K: [..., seq_len_k, key_size] :param V: [..., seq_len_k... | 2 | stack_v2_sparse_classes_30k_train_009528 | Implement the Python class `DotAttention` described below.
Class description:
DotAttention,作为MultiHeadAttention的组成部分
Method signatures and docstrings:
- def __init__(self, key_size, value_size, dropout=0.0): :param key_size: 键的维度 :param value_size: 一般和key_size相等 :param dropout:
- def forward(self, Q, K, V, mask_out=N... | Implement the Python class `DotAttention` described below.
Class description:
DotAttention,作为MultiHeadAttention的组成部分
Method signatures and docstrings:
- def __init__(self, key_size, value_size, dropout=0.0): :param key_size: 键的维度 :param value_size: 一般和key_size相等 :param dropout:
- def forward(self, Q, K, V, mask_out=N... | 78e961622520cf323fde2c7e97d074e416dae33c | <|skeleton|>
class DotAttention:
"""DotAttention,作为MultiHeadAttention的组成部分"""
def __init__(self, key_size, value_size, dropout=0.0):
""":param key_size: 键的维度 :param value_size: 一般和key_size相等 :param dropout:"""
<|body_0|>
def forward(self, Q, K, V, mask_out=None):
""":param Q: [...,... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DotAttention:
"""DotAttention,作为MultiHeadAttention的组成部分"""
def __init__(self, key_size, value_size, dropout=0.0):
""":param key_size: 键的维度 :param value_size: 一般和key_size相等 :param dropout:"""
super(DotAttention, self).__init__()
self.key_size = key_size
self.value_size = va... | the_stack_v2_python_sparse | Modules/encoder/attention.py | DarrenYing/nlp_pro | train | 2 |
8ea32bc2b6d1dac589325ba3a5e41cf5cd50569c | [
"api_response = requests.get(backend_api + '/data/' + geonameid, headers=make_headers(), verify=False)\nif api_response.status_code == 401:\n return invalid_token_response()\nif api_response.status_code == 404:\n dataAdd_rend = render_template('error.html', error_type=404, error='wrong_geonameid')\n resp =... | <|body_start_0|>
api_response = requests.get(backend_api + '/data/' + geonameid, headers=make_headers(), verify=False)
if api_response.status_code == 401:
return invalid_token_response()
if api_response.status_code == 404:
dataAdd_rend = render_template('error.html', erro... | Classe de Consultation, modification et suppression de données d'un lieu | Data | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Data:
"""Classe de Consultation, modification et suppression de données d'un lieu"""
def get(self, geonameid):
"""Méthode GET, affiche les informations de l'élément d'id 'geonameid' sous forme d'un tableau"""
<|body_0|>
def post(self, geonameid):
"""Méthode POST,... | stack_v2_sparse_classes_75kplus_train_001037 | 5,280 | no_license | [
{
"docstring": "Méthode GET, affiche les informations de l'élément d'id 'geonameid' sous forme d'un tableau",
"name": "get",
"signature": "def get(self, geonameid)"
},
{
"docstring": "Méthode POST, modifie les informations de l'élément",
"name": "post",
"signature": "def post(self, geona... | 3 | stack_v2_sparse_classes_30k_val_001545 | Implement the Python class `Data` described below.
Class description:
Classe de Consultation, modification et suppression de données d'un lieu
Method signatures and docstrings:
- def get(self, geonameid): Méthode GET, affiche les informations de l'élément d'id 'geonameid' sous forme d'un tableau
- def post(self, geon... | Implement the Python class `Data` described below.
Class description:
Classe de Consultation, modification et suppression de données d'un lieu
Method signatures and docstrings:
- def get(self, geonameid): Méthode GET, affiche les informations de l'élément d'id 'geonameid' sous forme d'un tableau
- def post(self, geon... | 3b8318e4d783d85257b5bef9a447aa55fbf38643 | <|skeleton|>
class Data:
"""Classe de Consultation, modification et suppression de données d'un lieu"""
def get(self, geonameid):
"""Méthode GET, affiche les informations de l'élément d'id 'geonameid' sous forme d'un tableau"""
<|body_0|>
def post(self, geonameid):
"""Méthode POST,... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Data:
"""Classe de Consultation, modification et suppression de données d'un lieu"""
def get(self, geonameid):
"""Méthode GET, affiche les informations de l'élément d'id 'geonameid' sous forme d'un tableau"""
api_response = requests.get(backend_api + '/data/' + geonameid, headers=make_hea... | the_stack_v2_python_sparse | frontend/resources/data.py | camille-rey-taffin/projet_tecweb_1 | train | 0 |
e4c0af4eb3c97f8942a6cff4465914e4aeebfc8b | [
"i, j = (0, 0)\nm, n = (len(s), len(t))\nwhile i < m and j < n:\n if s[i] == t[j]:\n i += 1\n j += 1\nif i == m:\n return True\nelse:\n return False",
"m, n = (len(s), len(t))\ndp = [[0] * (n + 1) for _ in range(m + 1)]\nfor i in range(1, m + 1):\n for j in range(1, n + 1):\n if s[i -... | <|body_start_0|>
i, j = (0, 0)
m, n = (len(s), len(t))
while i < m and j < n:
if s[i] == t[j]:
i += 1
j += 1
if i == m:
return True
else:
return False
<|end_body_0|>
<|body_start_1|>
m, n = (len(s), len(t))
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isSubsequence1(self, s: str, t: str) -> bool:
"""思路:双指针移动 时间复杂度:O(n)"""
<|body_0|>
def isSubsequence2(self, s: str, t: str) -> bool:
"""思路:动态规划法 时间复杂度:O(mn)"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
i, j = (0, 0)
m, n = (... | stack_v2_sparse_classes_75kplus_train_001038 | 1,979 | no_license | [
{
"docstring": "思路:双指针移动 时间复杂度:O(n)",
"name": "isSubsequence1",
"signature": "def isSubsequence1(self, s: str, t: str) -> bool"
},
{
"docstring": "思路:动态规划法 时间复杂度:O(mn)",
"name": "isSubsequence2",
"signature": "def isSubsequence2(self, s: str, t: str) -> bool"
}
] | 2 | stack_v2_sparse_classes_30k_train_006436 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isSubsequence1(self, s: str, t: str) -> bool: 思路:双指针移动 时间复杂度:O(n)
- def isSubsequence2(self, s: str, t: str) -> bool: 思路:动态规划法 时间复杂度:O(mn) | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isSubsequence1(self, s: str, t: str) -> bool: 思路:双指针移动 时间复杂度:O(n)
- def isSubsequence2(self, s: str, t: str) -> bool: 思路:动态规划法 时间复杂度:O(mn)
<|skeleton|>
class Solution:
... | e43ee86c5a8cdb808da09b4b6138e10275abadb5 | <|skeleton|>
class Solution:
def isSubsequence1(self, s: str, t: str) -> bool:
"""思路:双指针移动 时间复杂度:O(n)"""
<|body_0|>
def isSubsequence2(self, s: str, t: str) -> bool:
"""思路:动态规划法 时间复杂度:O(mn)"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def isSubsequence1(self, s: str, t: str) -> bool:
"""思路:双指针移动 时间复杂度:O(n)"""
i, j = (0, 0)
m, n = (len(s), len(t))
while i < m and j < n:
if s[i] == t[j]:
i += 1
j += 1
if i == m:
return True
else:
... | the_stack_v2_python_sparse | LeetCode/字符串/392. 判断子序列.py | yiming1012/MyLeetCode | train | 2 | |
d671733d96b60dcc49f6fa371faf8ba4ba944d05 | [
"player_index = 2\ngame_roles = list(large_game_roles)\nnew_roles = list(large_game_roles)\nnew_roles[2], new_roles[7] = (new_roles[7], new_roles[2])\nexpected = (Statement('I am a Robber and I swapped with Player 7. I am now a Wolf.', ((2, frozenset({Role.ROBBER})), (7, frozenset({Role.WOLF}))), ((SwitchPriority.R... | <|body_start_0|>
player_index = 2
game_roles = list(large_game_roles)
new_roles = list(large_game_roles)
new_roles[2], new_roles[7] = (new_roles[7], new_roles[2])
expected = (Statement('I am a Robber and I swapped with Player 7. I am now a Wolf.', ((2, frozenset({Role.ROBBER})), ... | Tests for the Robber player class. | TestRobber | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestRobber:
"""Tests for the Robber player class."""
def test_awake_init(large_game_roles: tuple[Role, ...]) -> None:
"""Should initialize a Robber. Note that the player_index of the Robber is not necessarily the index where the true Robber is located."""
<|body_0|>
def ... | stack_v2_sparse_classes_75kplus_train_001039 | 3,014 | permissive | [
{
"docstring": "Should initialize a Robber. Note that the player_index of the Robber is not necessarily the index where the true Robber is located.",
"name": "test_awake_init",
"signature": "def test_awake_init(large_game_roles: tuple[Role, ...]) -> None"
},
{
"docstring": "Execute initializatio... | 3 | null | Implement the Python class `TestRobber` described below.
Class description:
Tests for the Robber player class.
Method signatures and docstrings:
- def test_awake_init(large_game_roles: tuple[Role, ...]) -> None: Should initialize a Robber. Note that the player_index of the Robber is not necessarily the index where th... | Implement the Python class `TestRobber` described below.
Class description:
Tests for the Robber player class.
Method signatures and docstrings:
- def test_awake_init(large_game_roles: tuple[Role, ...]) -> None: Should initialize a Robber. Note that the player_index of the Robber is not necessarily the index where th... | 6e91c2f24e72f9374c4f703bd966963ea6626e8e | <|skeleton|>
class TestRobber:
"""Tests for the Robber player class."""
def test_awake_init(large_game_roles: tuple[Role, ...]) -> None:
"""Should initialize a Robber. Note that the player_index of the Robber is not necessarily the index where the true Robber is located."""
<|body_0|>
def ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestRobber:
"""Tests for the Robber player class."""
def test_awake_init(large_game_roles: tuple[Role, ...]) -> None:
"""Should initialize a Robber. Note that the player_index of the Robber is not necessarily the index where the true Robber is located."""
player_index = 2
game_rol... | the_stack_v2_python_sparse | unit_test/roles/village/robber_test.py | srijan-deepsource/wolfbot | train | 0 |
0d13ef110b2caf49b2d9f39b5ecdc41ffda29fd1 | [
"super(Resnet18_8s, self).__init__()\nresnet18_8s = resnet18(fully_conv=True, output_stride=8, pretrained_path=pretrained_path, remove_avg_pool_layer=True)\nself.ver_dim = ver_dim\nself.seg_dim = seg_dim\nself.conv_init = HeUniform(negative_slope=math.sqrt(5), mode='fan_in', nonlinearity='leaky_relu')\nresnet18_8s.... | <|body_start_0|>
super(Resnet18_8s, self).__init__()
resnet18_8s = resnet18(fully_conv=True, output_stride=8, pretrained_path=pretrained_path, remove_avg_pool_layer=True)
self.ver_dim = ver_dim
self.seg_dim = seg_dim
self.conv_init = HeUniform(negative_slope=math.sqrt(5), mode='f... | Resnet18_8s Network | Resnet18_8s | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Resnet18_8s:
"""Resnet18_8s Network"""
def __init__(self, ver_dim, seg_dim=2, fcdim=256, s8dim=128, s4dim=64, s2dim=32, raw_dim=32, pretrained_path=None):
"""__init__"""
<|body_0|>
def construct(self, x, feature_alignment=False):
"""construct Network"""
<... | stack_v2_sparse_classes_75kplus_train_001040 | 8,234 | permissive | [
{
"docstring": "__init__",
"name": "__init__",
"signature": "def __init__(self, ver_dim, seg_dim=2, fcdim=256, s8dim=128, s4dim=64, s2dim=32, raw_dim=32, pretrained_path=None)"
},
{
"docstring": "construct Network",
"name": "construct",
"signature": "def construct(self, x, feature_alignm... | 2 | stack_v2_sparse_classes_30k_train_042669 | Implement the Python class `Resnet18_8s` described below.
Class description:
Resnet18_8s Network
Method signatures and docstrings:
- def __init__(self, ver_dim, seg_dim=2, fcdim=256, s8dim=128, s4dim=64, s2dim=32, raw_dim=32, pretrained_path=None): __init__
- def construct(self, x, feature_alignment=False): construct... | Implement the Python class `Resnet18_8s` described below.
Class description:
Resnet18_8s Network
Method signatures and docstrings:
- def __init__(self, ver_dim, seg_dim=2, fcdim=256, s8dim=128, s4dim=64, s2dim=32, raw_dim=32, pretrained_path=None): __init__
- def construct(self, x, feature_alignment=False): construct... | eab643f51336dbf7d711f02d27e6516e5affee59 | <|skeleton|>
class Resnet18_8s:
"""Resnet18_8s Network"""
def __init__(self, ver_dim, seg_dim=2, fcdim=256, s8dim=128, s4dim=64, s2dim=32, raw_dim=32, pretrained_path=None):
"""__init__"""
<|body_0|>
def construct(self, x, feature_alignment=False):
"""construct Network"""
<... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Resnet18_8s:
"""Resnet18_8s Network"""
def __init__(self, ver_dim, seg_dim=2, fcdim=256, s8dim=128, s4dim=64, s2dim=32, raw_dim=32, pretrained_path=None):
"""__init__"""
super(Resnet18_8s, self).__init__()
resnet18_8s = resnet18(fully_conv=True, output_stride=8, pretrained_path=pr... | the_stack_v2_python_sparse | official/cv/PVNet/src/model_reposity.py | mindspore-ai/models | train | 301 |
f97e7309d3b6b685c2df70094f26ce46ade820db | [
"self.heap = []\nself.k = k\nmap(self.add, nums)",
"if len(self.heap) < self.k:\n heapq.heappush(self.heap, val)\nelif val > self.heap[0]:\n heapq.heapreplace(self.heap, val)\nreturn self.heap[0]"
] | <|body_start_0|>
self.heap = []
self.k = k
map(self.add, nums)
<|end_body_0|>
<|body_start_1|>
if len(self.heap) < self.k:
heapq.heappush(self.heap, val)
elif val > self.heap[0]:
heapq.heapreplace(self.heap, val)
return self.heap[0]
<|end_body_1|>... | KthLargest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
<|body_0|>
def add(self, val):
""":type val: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.heap = []
self.k = k
map(self.add, nu... | stack_v2_sparse_classes_75kplus_train_001041 | 1,720 | no_license | [
{
"docstring": ":type k: int :type nums: List[int]",
"name": "__init__",
"signature": "def __init__(self, k, nums)"
},
{
"docstring": ":type val: int :rtype: int",
"name": "add",
"signature": "def add(self, val)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002677 | Implement the Python class `KthLargest` described below.
Class description:
Implement the KthLargest class.
Method signatures and docstrings:
- def __init__(self, k, nums): :type k: int :type nums: List[int]
- def add(self, val): :type val: int :rtype: int | Implement the Python class `KthLargest` described below.
Class description:
Implement the KthLargest class.
Method signatures and docstrings:
- def __init__(self, k, nums): :type k: int :type nums: List[int]
- def add(self, val): :type val: int :rtype: int
<|skeleton|>
class KthLargest:
def __init__(self, k, nu... | fe9fb43fca35ba493c2c57baa66f126571450ef9 | <|skeleton|>
class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
<|body_0|>
def add(self, val):
""":type val: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
self.heap = []
self.k = k
map(self.add, nums)
def add(self, val):
""":type val: int :rtype: int"""
if len(self.heap) < self.k:
heapq.heappush(self.heap, val)
... | the_stack_v2_python_sparse | Week_03/id_26/LeetCode_703_26.py | xiaoluome/algorithm | train | 1 | |
32cfffbc9e8b8e88e9c4cbbcd04ddcc6a58e643f | [
"user = User.objects.create_user(username=username, password=password)\nuser.groups.add(rol)\nreturn self.create(tipo=self.model.ADMINISTRATIVO, usuario=user, **kwargs)",
"user = User.objects.create_user(username=username, password=password)\nuser.groups.add(rol)\nmedico = self.create(tipo=self.model.MEDICO, usua... | <|body_start_0|>
user = User.objects.create_user(username=username, password=password)
user.groups.add(rol)
return self.create(tipo=self.model.ADMINISTRATIVO, usuario=user, **kwargs)
<|end_body_0|>
<|body_start_1|>
user = User.objects.create_user(username=username, password=password)
... | Manager personalizado para el modelo Empleado. | EmpleadoManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EmpleadoManager:
"""Manager personalizado para el modelo Empleado."""
def crear_empleado_administrativo(self, username, password, rol, **kwargs):
"""Permite crear un empleado administrativo"""
<|body_0|>
def crear_medico(self, username, password, rol, instituciones, **kw... | stack_v2_sparse_classes_75kplus_train_001042 | 2,324 | no_license | [
{
"docstring": "Permite crear un empleado administrativo",
"name": "crear_empleado_administrativo",
"signature": "def crear_empleado_administrativo(self, username, password, rol, **kwargs)"
},
{
"docstring": "Permite crear un empleado administrativo",
"name": "crear_medico",
"signature":... | 2 | stack_v2_sparse_classes_30k_train_037725 | Implement the Python class `EmpleadoManager` described below.
Class description:
Manager personalizado para el modelo Empleado.
Method signatures and docstrings:
- def crear_empleado_administrativo(self, username, password, rol, **kwargs): Permite crear un empleado administrativo
- def crear_medico(self, username, pa... | Implement the Python class `EmpleadoManager` described below.
Class description:
Manager personalizado para el modelo Empleado.
Method signatures and docstrings:
- def crear_empleado_administrativo(self, username, password, rol, **kwargs): Permite crear un empleado administrativo
- def crear_medico(self, username, pa... | b8f8df111432bfab537853ed8e8dbd4603e9707d | <|skeleton|>
class EmpleadoManager:
"""Manager personalizado para el modelo Empleado."""
def crear_empleado_administrativo(self, username, password, rol, **kwargs):
"""Permite crear un empleado administrativo"""
<|body_0|>
def crear_medico(self, username, password, rol, instituciones, **kw... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EmpleadoManager:
"""Manager personalizado para el modelo Empleado."""
def crear_empleado_administrativo(self, username, password, rol, **kwargs):
"""Permite crear un empleado administrativo"""
user = User.objects.create_user(username=username, password=password)
user.groups.add(ro... | the_stack_v2_python_sparse | organizacional/managers.py | geovanniberdugo/medhis | train | 0 |
23bb8e671463c4b5c60b4d5ac1b3eee2cc2f1eb4 | [
"self.window = window\nself.wizards = wizards\nwsp = WizardSelectionPage(wizards=wizards, id='wizard_selection')\nwsp.on_trait_change(self.on_wizard_changed, 'wizard')\nself.pages = [wsp]\nsuper(WizardSelectionWizard, self).__init__(**traits)",
"if new is not None:\n app = self.window.application\n wizard_k... | <|body_start_0|>
self.window = window
self.wizards = wizards
wsp = WizardSelectionPage(wizards=wizards, id='wizard_selection')
wsp.on_trait_change(self.on_wizard_changed, 'wizard')
self.pages = [wsp]
super(WizardSelectionWizard, self).__init__(**traits)
<|end_body_0|>
<|... | A wizard for wizard selection. | WizardSelectionWizard | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WizardSelectionWizard:
"""A wizard for wizard selection."""
def __init__(self, window, wizards, **traits):
"""Returns a new WizardSelectionWizard instance."""
<|body_0|>
def on_wizard_changed(self, new):
"""Handles the selected wizard changing."""
<|body_... | stack_v2_sparse_classes_75kplus_train_001043 | 6,572 | permissive | [
{
"docstring": "Returns a new WizardSelectionWizard instance.",
"name": "__init__",
"signature": "def __init__(self, window, wizards, **traits)"
},
{
"docstring": "Handles the selected wizard changing.",
"name": "on_wizard_changed",
"signature": "def on_wizard_changed(self, new)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002257 | Implement the Python class `WizardSelectionWizard` described below.
Class description:
A wizard for wizard selection.
Method signatures and docstrings:
- def __init__(self, window, wizards, **traits): Returns a new WizardSelectionWizard instance.
- def on_wizard_changed(self, new): Handles the selected wizard changin... | Implement the Python class `WizardSelectionWizard` described below.
Class description:
A wizard for wizard selection.
Method signatures and docstrings:
- def __init__(self, window, wizards, **traits): Returns a new WizardSelectionWizard instance.
- def on_wizard_changed(self, new): Handles the selected wizard changin... | e8fc0b2d6b9b08e60389fc4714a5cf51f628b57f | <|skeleton|>
class WizardSelectionWizard:
"""A wizard for wizard selection."""
def __init__(self, window, wizards, **traits):
"""Returns a new WizardSelectionWizard instance."""
<|body_0|>
def on_wizard_changed(self, new):
"""Handles the selected wizard changing."""
<|body_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WizardSelectionWizard:
"""A wizard for wizard selection."""
def __init__(self, window, wizards, **traits):
"""Returns a new WizardSelectionWizard instance."""
self.window = window
self.wizards = wizards
wsp = WizardSelectionPage(wizards=wizards, id='wizard_selection')
... | the_stack_v2_python_sparse | puddle/resource/wizard/wizard_selection_wizard.py | rwl/puddle | train | 2 |
7cb2b763156118e11292e4784a5b869a27d2f49f | [
"self.grid_size_y = grid_size_y\nself.grid_size_x = grid_size_x\nself.x_range = x_range\nself.y_range = x_range * (grid_size_y / grid_size_x)\nself.dx = real_t(x_range / grid_size_x)\nself.num_threads = num_threads\nself.real_t = real_t\npyfftw_construct = spne.FFTPyFFTW2D(grid_size_y=2 * grid_size_y, grid_size_x=2... | <|body_start_0|>
self.grid_size_y = grid_size_y
self.grid_size_x = grid_size_x
self.x_range = x_range
self.y_range = x_range * (grid_size_y / grid_size_x)
self.dx = real_t(x_range / grid_size_x)
self.num_threads = num_threads
self.real_t = real_t
pyfftw_co... | Class for solving unbounded Poisson in 2D via PyFFTW. | UnboundedPoissonSolverPYFFTW2D | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UnboundedPoissonSolverPYFFTW2D:
"""Class for solving unbounded Poisson in 2D via PyFFTW."""
def __init__(self, grid_size_y: int, grid_size_x: int, x_range: float=1.0, num_threads: int=1, real_t: type=np.float64) -> None:
"""Class initialiser."""
<|body_0|>
def _construct... | stack_v2_sparse_classes_75kplus_train_001044 | 5,311 | permissive | [
{
"docstring": "Class initialiser.",
"name": "__init__",
"signature": "def __init__(self, grid_size_y: int, grid_size_x: int, x_range: float=1.0, num_threads: int=1, real_t: type=np.float64) -> None"
},
{
"docstring": "Construct the unbounded Greens function.",
"name": "_construct_fourier_gr... | 4 | stack_v2_sparse_classes_30k_train_008145 | Implement the Python class `UnboundedPoissonSolverPYFFTW2D` described below.
Class description:
Class for solving unbounded Poisson in 2D via PyFFTW.
Method signatures and docstrings:
- def __init__(self, grid_size_y: int, grid_size_x: int, x_range: float=1.0, num_threads: int=1, real_t: type=np.float64) -> None: Cla... | Implement the Python class `UnboundedPoissonSolverPYFFTW2D` described below.
Class description:
Class for solving unbounded Poisson in 2D via PyFFTW.
Method signatures and docstrings:
- def __init__(self, grid_size_y: int, grid_size_x: int, x_range: float=1.0, num_threads: int=1, real_t: type=np.float64) -> None: Cla... | 99a094e0d6e635e5b2385a69bdee239a4d1fb530 | <|skeleton|>
class UnboundedPoissonSolverPYFFTW2D:
"""Class for solving unbounded Poisson in 2D via PyFFTW."""
def __init__(self, grid_size_y: int, grid_size_x: int, x_range: float=1.0, num_threads: int=1, real_t: type=np.float64) -> None:
"""Class initialiser."""
<|body_0|>
def _construct... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UnboundedPoissonSolverPYFFTW2D:
"""Class for solving unbounded Poisson in 2D via PyFFTW."""
def __init__(self, grid_size_y: int, grid_size_x: int, x_range: float=1.0, num_threads: int=1, real_t: type=np.float64) -> None:
"""Class initialiser."""
self.grid_size_y = grid_size_y
self... | the_stack_v2_python_sparse | sopht/numeric/eulerian_grid_ops/poisson_solver_2d/UnboundedPoissonSolverPYFFTW2D.py | SophT-Team/SophT | train | 2 |
a7b71c941db485bfa8b423f413a785dfb4fd4da2 | [
"versions = []\nfor key, data in VERSIONS.items():\n v = BaseVersion(data['id'], data['status'], request.application_url, data['updated'])\n versions.append(v)\nreturn wsgi.Result(VersionsDataView(versions))",
"data = VERSIONS[request.url_version]\nv = Version(data['id'], data['status'], request.application... | <|body_start_0|>
versions = []
for key, data in VERSIONS.items():
v = BaseVersion(data['id'], data['status'], request.application_url, data['updated'])
versions.append(v)
return wsgi.Result(VersionsDataView(versions))
<|end_body_0|>
<|body_start_1|>
data = VERSIO... | VersionsController | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VersionsController:
def index(self, request):
"""Respond to a request for API versions."""
<|body_0|>
def show(self, request):
"""Respond to a request for a specific API version."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
versions = []
... | stack_v2_sparse_classes_75kplus_train_001045 | 3,164 | permissive | [
{
"docstring": "Respond to a request for API versions.",
"name": "index",
"signature": "def index(self, request)"
},
{
"docstring": "Respond to a request for a specific API version.",
"name": "show",
"signature": "def show(self, request)"
}
] | 2 | stack_v2_sparse_classes_30k_test_001745 | Implement the Python class `VersionsController` described below.
Class description:
Implement the VersionsController class.
Method signatures and docstrings:
- def index(self, request): Respond to a request for API versions.
- def show(self, request): Respond to a request for a specific API version. | Implement the Python class `VersionsController` described below.
Class description:
Implement the VersionsController class.
Method signatures and docstrings:
- def index(self, request): Respond to a request for API versions.
- def show(self, request): Respond to a request for a specific API version.
<|skeleton|>
cla... | 4288b8f78250cc3a1c93b019e2c3b4bf78df177c | <|skeleton|>
class VersionsController:
def index(self, request):
"""Respond to a request for API versions."""
<|body_0|>
def show(self, request):
"""Respond to a request for a specific API version."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class VersionsController:
def index(self, request):
"""Respond to a request for API versions."""
versions = []
for key, data in VERSIONS.items():
v = BaseVersion(data['id'], data['status'], request.application_url, data['updated'])
versions.append(v)
return ws... | the_stack_v2_python_sparse | trove/versions.py | openstack/trove | train | 258 | |
47d9cc4dec13dc5654f59dc6a0f9b53b54fdde32 | [
"self.DEBUG = DEBUG\nself.logger = get_logger(name='IP_Discovery', DEBUG=self.DEBUG)\nself.provider = provider\nself.data = None\nself.topology = None",
"runner = CliMultiRunner(provider=self.provider, ips=ips, workers=6)\nrunner.actions = ['get_neighbors']\nrunner.run()\nself.data = runner.data\ntopo = CliTopolo... | <|body_start_0|>
self.DEBUG = DEBUG
self.logger = get_logger(name='IP_Discovery', DEBUG=self.DEBUG)
self.provider = provider
self.data = None
self.topology = None
<|end_body_0|>
<|body_start_1|>
runner = CliMultiRunner(provider=self.provider, ips=ips, workers=6)
... | This function performs discovery of the network devices based on their IP addresses. | IP_Discovery | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IP_Discovery:
"""This function performs discovery of the network devices based on their IP addresses."""
def __init__(self, provider, DEBUG=False):
""":param dict provider: Provider dictionary containing information for creating connection object, such as credentials :param bool DEBU... | stack_v2_sparse_classes_75kplus_train_001046 | 1,265 | permissive | [
{
"docstring": ":param dict provider: Provider dictionary containing information for creating connection object, such as credentials :param bool DEBUG: Enables debugging output",
"name": "__init__",
"signature": "def __init__(self, provider, DEBUG=False)"
},
{
"docstring": "Main entry function. ... | 2 | null | Implement the Python class `IP_Discovery` described below.
Class description:
This function performs discovery of the network devices based on their IP addresses.
Method signatures and docstrings:
- def __init__(self, provider, DEBUG=False): :param dict provider: Provider dictionary containing information for creatin... | Implement the Python class `IP_Discovery` described below.
Class description:
This function performs discovery of the network devices based on their IP addresses.
Method signatures and docstrings:
- def __init__(self, provider, DEBUG=False): :param dict provider: Provider dictionary containing information for creatin... | 3e050be98404dac79c071eb035d30095bda33fac | <|skeleton|>
class IP_Discovery:
"""This function performs discovery of the network devices based on their IP addresses."""
def __init__(self, provider, DEBUG=False):
""":param dict provider: Provider dictionary containing information for creating connection object, such as credentials :param bool DEBU... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class IP_Discovery:
"""This function performs discovery of the network devices based on their IP addresses."""
def __init__(self, provider, DEBUG=False):
""":param dict provider: Provider dictionary containing information for creating connection object, such as credentials :param bool DEBUG: Enables de... | the_stack_v2_python_sparse | nuaal/Discovery/IP_Discovery.py | mihudec/nuaal | train | 1 |
d335be2507f4a31d063e8a15f24a24da121bbd2c | [
"if isinstance(cards[0], list):\n cards = [card for sublist in cards for card in sublist]\ncards = [self.str_to_int(card) for card in cards]\ncards.sort()\nif nest:\n cards = [[self.int_to_str(card) for card in cards if card % 4 == suit] for suit in range(4)]\nelif trump_suit is not None:\n tmp_trumps = []... | <|body_start_0|>
if isinstance(cards[0], list):
cards = [card for sublist in cards for card in sublist]
cards = [self.str_to_int(card) for card in cards]
cards.sort()
if nest:
cards = [[self.int_to_str(card) for card in cards if card % 4 == suit] for suit in range... | OhHell_Tools | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OhHell_Tools:
def sort_cards(self, cards, nest=False, trump_suit=None):
"""name: sort_cards() synopsis: sort list of cards by ascending value input(s): cards, a list of cards or list of list of cards nest, an optional Boolean trump, an optional arg. output(s): either a list of lists of c... | stack_v2_sparse_classes_75kplus_train_001047 | 3,288 | no_license | [
{
"docstring": "name: sort_cards() synopsis: sort list of cards by ascending value input(s): cards, a list of cards or list of list of cards nest, an optional Boolean trump, an optional arg. output(s): either a list of lists of cards or, a list of cards",
"name": "sort_cards",
"signature": "def sort_car... | 2 | null | Implement the Python class `OhHell_Tools` described below.
Class description:
Implement the OhHell_Tools class.
Method signatures and docstrings:
- def sort_cards(self, cards, nest=False, trump_suit=None): name: sort_cards() synopsis: sort list of cards by ascending value input(s): cards, a list of cards or list of l... | Implement the Python class `OhHell_Tools` described below.
Class description:
Implement the OhHell_Tools class.
Method signatures and docstrings:
- def sort_cards(self, cards, nest=False, trump_suit=None): name: sort_cards() synopsis: sort list of cards by ascending value input(s): cards, a list of cards or list of l... | 85ea39e5395aa7d4b24154447976a41414ee3f28 | <|skeleton|>
class OhHell_Tools:
def sort_cards(self, cards, nest=False, trump_suit=None):
"""name: sort_cards() synopsis: sort list of cards by ascending value input(s): cards, a list of cards or list of list of cards nest, an optional Boolean trump, an optional arg. output(s): either a list of lists of c... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class OhHell_Tools:
def sort_cards(self, cards, nest=False, trump_suit=None):
"""name: sort_cards() synopsis: sort list of cards by ascending value input(s): cards, a list of cards or list of list of cards nest, an optional Boolean trump, an optional arg. output(s): either a list of lists of cards or, a lis... | the_stack_v2_python_sparse | Application/Models/OhHell_Model/OhHell_Tools.py | NickMoignard/proj3 | train | 0 | |
8a5e444508cef5730c1e736ae8c149a49db6b298 | [
"self.input_nodes = input_nodes\nself.hidden_nodes = hidden_nodes\nself.output_nodes = output_nodes\nself.weights_input_to_hidden = np.random.normal(0.0, self.input_nodes ** (-0.5), size=(self.input_nodes, self.hidden_nodes))\nself.weights_hidden_to_output = np.random.normal(0.0, self.hidden_nodes ** (-0.5), size=(... | <|body_start_0|>
self.input_nodes = input_nodes
self.hidden_nodes = hidden_nodes
self.output_nodes = output_nodes
self.weights_input_to_hidden = np.random.normal(0.0, self.input_nodes ** (-0.5), size=(self.input_nodes, self.hidden_nodes))
self.weights_hidden_to_output = np.random... | NeuralNetwork | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NeuralNetwork:
def __init__(self, input_nodes, hidden_nodes, output_nodes, learning_rate):
""":param input_nodes: 输入的节点数量 (特征数量) :param hidden_nodes: 隐藏层节点数量 :param output_nodes: 输出层节点数量 :param learning_rate:"""
<|body_0|>
def train(self, features, targets):
"""使用 ba... | stack_v2_sparse_classes_75kplus_train_001048 | 9,221 | no_license | [
{
"docstring": ":param input_nodes: 输入的节点数量 (特征数量) :param hidden_nodes: 隐藏层节点数量 :param output_nodes: 输出层节点数量 :param learning_rate:",
"name": "__init__",
"signature": "def __init__(self, input_nodes, hidden_nodes, output_nodes, learning_rate)"
},
{
"docstring": "使用 batch==1 的features and targets训... | 3 | stack_v2_sparse_classes_30k_train_007058 | Implement the Python class `NeuralNetwork` described below.
Class description:
Implement the NeuralNetwork class.
Method signatures and docstrings:
- def __init__(self, input_nodes, hidden_nodes, output_nodes, learning_rate): :param input_nodes: 输入的节点数量 (特征数量) :param hidden_nodes: 隐藏层节点数量 :param output_nodes: 输出层节点数量... | Implement the Python class `NeuralNetwork` described below.
Class description:
Implement the NeuralNetwork class.
Method signatures and docstrings:
- def __init__(self, input_nodes, hidden_nodes, output_nodes, learning_rate): :param input_nodes: 输入的节点数量 (特征数量) :param hidden_nodes: 隐藏层节点数量 :param output_nodes: 输出层节点数量... | 92ce097ce085a339c7635a8a704199543b9fc919 | <|skeleton|>
class NeuralNetwork:
def __init__(self, input_nodes, hidden_nodes, output_nodes, learning_rate):
""":param input_nodes: 输入的节点数量 (特征数量) :param hidden_nodes: 隐藏层节点数量 :param output_nodes: 输出层节点数量 :param learning_rate:"""
<|body_0|>
def train(self, features, targets):
"""使用 ba... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NeuralNetwork:
def __init__(self, input_nodes, hidden_nodes, output_nodes, learning_rate):
""":param input_nodes: 输入的节点数量 (特征数量) :param hidden_nodes: 隐藏层节点数量 :param output_nodes: 输出层节点数量 :param learning_rate:"""
self.input_nodes = input_nodes
self.hidden_nodes = hidden_nodes
se... | the_stack_v2_python_sparse | p34.bike.py | zhangcj5131/tensorflow_teaching | train | 4 | |
4f46799b8fd352920257c71a7cb54d2e801ed2d0 | [
"a_bitmask = np.zeros((10, 10), dtype=np.uint8)\na_bitmask[4:, 4:] = 1\nb_bitmask = np.ones((10, 10), dtype=np.uint8)\nb_bitmask[:7, :7] = 0\nhist = fast_hist(a_bitmask, b_bitmask, 3)[:-1, :-1]\ngt_hist = np.array([[40, 24], [9, 27]])\nself.assertTrue((hist == gt_hist).all())",
"a_bitmask = np.zeros((10, 10), dty... | <|body_start_0|>
a_bitmask = np.zeros((10, 10), dtype=np.uint8)
a_bitmask[4:, 4:] = 1
b_bitmask = np.ones((10, 10), dtype=np.uint8)
b_bitmask[:7, :7] = 0
hist = fast_hist(a_bitmask, b_bitmask, 3)[:-1, :-1]
gt_hist = np.array([[40, 24], [9, 27]])
self.assertTrue((h... | Test cases for the fast_hist function. | TestFastHist | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestFastHist:
"""Test cases for the fast_hist function."""
def test_a_mock_case(self) -> None:
"""Test the correctness for fast_hist."""
<|body_0|>
def test_pred_overflow(self) -> None:
"""Test the blank prediction overflows."""
<|body_1|>
<|end_skeleton... | stack_v2_sparse_classes_75kplus_train_001049 | 3,852 | permissive | [
{
"docstring": "Test the correctness for fast_hist.",
"name": "test_a_mock_case",
"signature": "def test_a_mock_case(self) -> None"
},
{
"docstring": "Test the blank prediction overflows.",
"name": "test_pred_overflow",
"signature": "def test_pred_overflow(self) -> None"
}
] | 2 | stack_v2_sparse_classes_30k_train_024790 | Implement the Python class `TestFastHist` described below.
Class description:
Test cases for the fast_hist function.
Method signatures and docstrings:
- def test_a_mock_case(self) -> None: Test the correctness for fast_hist.
- def test_pred_overflow(self) -> None: Test the blank prediction overflows. | Implement the Python class `TestFastHist` described below.
Class description:
Test cases for the fast_hist function.
Method signatures and docstrings:
- def test_a_mock_case(self) -> None: Test the correctness for fast_hist.
- def test_pred_overflow(self) -> None: Test the blank prediction overflows.
<|skeleton|>
cl... | a4bfa9dc0c79abe90b2c06d20e84b79fbd9f2e38 | <|skeleton|>
class TestFastHist:
"""Test cases for the fast_hist function."""
def test_a_mock_case(self) -> None:
"""Test the correctness for fast_hist."""
<|body_0|>
def test_pred_overflow(self) -> None:
"""Test the blank prediction overflows."""
<|body_1|>
<|end_skeleton... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestFastHist:
"""Test cases for the fast_hist function."""
def test_a_mock_case(self) -> None:
"""Test the correctness for fast_hist."""
a_bitmask = np.zeros((10, 10), dtype=np.uint8)
a_bitmask[4:, 4:] = 1
b_bitmask = np.ones((10, 10), dtype=np.uint8)
b_bitmask[:7,... | the_stack_v2_python_sparse | bdd100k/eval/seg_test.py | navcul3108/bdd100k | train | 0 |
2ef86a20c82f79bb562fe19ce5ab78cd9d9334b8 | [
"super(DumpDeviceState, self).__init__()\nself.devices = devices\nself.target = target\nreturn",
"device = self.devices[parameters.nodes.parameters]\nself.logger.info(str(device))\nif self.target is not None:\n self.target(str(device))\nreturn"
] | <|body_start_0|>
super(DumpDeviceState, self).__init__()
self.devices = devices
self.target = target
return
<|end_body_0|>
<|body_start_1|>
device = self.devices[parameters.nodes.parameters]
self.logger.info(str(device))
if self.target is not None:
se... | A class to record the state of a device. | DumpDeviceState | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DumpDeviceState:
"""A class to record the state of a device."""
def __init__(self, devices, target=None):
""":param: - `devices`: a dictionary of id:device pairs - `target`: optional callable object to pass output"""
<|body_0|>
def __call__(self, parameters):
"""... | stack_v2_sparse_classes_75kplus_train_001050 | 832 | permissive | [
{
"docstring": ":param: - `devices`: a dictionary of id:device pairs - `target`: optional callable object to pass output",
"name": "__init__",
"signature": "def __init__(self, devices, target=None)"
},
{
"docstring": ":param: - `parameters`: a named tuple (expects parameters.nodes.parameters)",
... | 2 | stack_v2_sparse_classes_30k_train_003894 | Implement the Python class `DumpDeviceState` described below.
Class description:
A class to record the state of a device.
Method signatures and docstrings:
- def __init__(self, devices, target=None): :param: - `devices`: a dictionary of id:device pairs - `target`: optional callable object to pass output
- def __call_... | Implement the Python class `DumpDeviceState` described below.
Class description:
A class to record the state of a device.
Method signatures and docstrings:
- def __init__(self, devices, target=None): :param: - `devices`: a dictionary of id:device pairs - `target`: optional callable object to pass output
- def __call_... | b4d1c77e1d611fe2b30768b42bdc7493afb0ea95 | <|skeleton|>
class DumpDeviceState:
"""A class to record the state of a device."""
def __init__(self, devices, target=None):
""":param: - `devices`: a dictionary of id:device pairs - `target`: optional callable object to pass output"""
<|body_0|>
def __call__(self, parameters):
"""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DumpDeviceState:
"""A class to record the state of a device."""
def __init__(self, devices, target=None):
""":param: - `devices`: a dictionary of id:device pairs - `target`: optional callable object to pass output"""
super(DumpDeviceState, self).__init__()
self.devices = devices
... | the_stack_v2_python_sparse | apetools/tools/dumpdevicestate.py | russell-n/oldape | train | 0 |
5113a6947545f2fd914724d49f73ecf76bd96241 | [
"self.__table = {}\nfor a in args:\n self.__table[a] = True",
"try:\n return self.__table[item]\nexcept KeyError:\n return False",
"if self.has(item):\n return\nelse:\n self.__table[item] = True"
] | <|body_start_0|>
self.__table = {}
for a in args:
self.__table[a] = True
<|end_body_0|>
<|body_start_1|>
try:
return self.__table[item]
except KeyError:
return False
<|end_body_1|>
<|body_start_2|>
if self.has(item):
return
... | A class to represent a dictionary with just present/not present functionality. Mostly useful for not having to worry about stupid keyvalue errors. | BoolTable | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BoolTable:
"""A class to represent a dictionary with just present/not present functionality. Mostly useful for not having to worry about stupid keyvalue errors."""
def __init__(self, *args):
"""Constructor. @param args: Optional variable list of items to put into the table."""
... | stack_v2_sparse_classes_75kplus_train_001051 | 1,104 | permissive | [
{
"docstring": "Constructor. @param args: Optional variable list of items to put into the table.",
"name": "__init__",
"signature": "def __init__(self, *args)"
},
{
"docstring": "Checks if the BoolTable has the given item. @param item: The item to check for in the table. @return: True if present... | 3 | stack_v2_sparse_classes_30k_train_033358 | Implement the Python class `BoolTable` described below.
Class description:
A class to represent a dictionary with just present/not present functionality. Mostly useful for not having to worry about stupid keyvalue errors.
Method signatures and docstrings:
- def __init__(self, *args): Constructor. @param args: Optiona... | Implement the Python class `BoolTable` described below.
Class description:
A class to represent a dictionary with just present/not present functionality. Mostly useful for not having to worry about stupid keyvalue errors.
Method signatures and docstrings:
- def __init__(self, *args): Constructor. @param args: Optiona... | 31e416aaf8c8e04c148fae660d293677f02421e5 | <|skeleton|>
class BoolTable:
"""A class to represent a dictionary with just present/not present functionality. Mostly useful for not having to worry about stupid keyvalue errors."""
def __init__(self, *args):
"""Constructor. @param args: Optional variable list of items to put into the table."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BoolTable:
"""A class to represent a dictionary with just present/not present functionality. Mostly useful for not having to worry about stupid keyvalue errors."""
def __init__(self, *args):
"""Constructor. @param args: Optional variable list of items to put into the table."""
self.__tabl... | the_stack_v2_python_sparse | chef_global/adt.py | afcarl/swedish_chef | train | 0 |
aa5c17d04a1d0ee26f937c73f2304e37feff252e | [
"super().__init__(coordinator, _id, spc, DEVICE_CLASS_CONNECTIVITY)\nif self._attr_device_info:\n self._attr_device_info['identifiers'] = {(DOMAIN, str(self._id))}\nself._attr_available = self.is_on",
"hub: SureHub\nonline: bool = False\nif (hub := self._coordinator.data[self._id]):\n self._attr_extra_state... | <|body_start_0|>
super().__init__(coordinator, _id, spc, DEVICE_CLASS_CONNECTIVITY)
if self._attr_device_info:
self._attr_device_info['identifiers'] = {(DOMAIN, str(self._id))}
self._attr_available = self.is_on
<|end_body_0|>
<|body_start_1|>
hub: SureHub
online: boo... | Sure Petcare Pet. | Hub | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Hub:
"""Sure Petcare Pet."""
def __init__(self, coordinator, _id: int, spc: SurePetcareAPI) -> None:
"""Initialize a Sure Petcare Hub."""
<|body_0|>
def is_on(self) -> bool:
"""Return True if the hub is on."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|... | stack_v2_sparse_classes_75kplus_train_001052 | 8,000 | permissive | [
{
"docstring": "Initialize a Sure Petcare Hub.",
"name": "__init__",
"signature": "def __init__(self, coordinator, _id: int, spc: SurePetcareAPI) -> None"
},
{
"docstring": "Return True if the hub is on.",
"name": "is_on",
"signature": "def is_on(self) -> bool"
}
] | 2 | stack_v2_sparse_classes_30k_train_012653 | Implement the Python class `Hub` described below.
Class description:
Sure Petcare Pet.
Method signatures and docstrings:
- def __init__(self, coordinator, _id: int, spc: SurePetcareAPI) -> None: Initialize a Sure Petcare Hub.
- def is_on(self) -> bool: Return True if the hub is on. | Implement the Python class `Hub` described below.
Class description:
Sure Petcare Pet.
Method signatures and docstrings:
- def __init__(self, coordinator, _id: int, spc: SurePetcareAPI) -> None: Initialize a Sure Petcare Hub.
- def is_on(self) -> bool: Return True if the hub is on.
<|skeleton|>
class Hub:
"""Sur... | 77ff2da40a4fb55ad99eea1f60d39694584cc490 | <|skeleton|>
class Hub:
"""Sure Petcare Pet."""
def __init__(self, coordinator, _id: int, spc: SurePetcareAPI) -> None:
"""Initialize a Sure Petcare Hub."""
<|body_0|>
def is_on(self) -> bool:
"""Return True if the hub is on."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Hub:
"""Sure Petcare Pet."""
def __init__(self, coordinator, _id: int, spc: SurePetcareAPI) -> None:
"""Initialize a Sure Petcare Hub."""
super().__init__(coordinator, _id, spc, DEVICE_CLASS_CONNECTIVITY)
if self._attr_device_info:
self._attr_device_info['identifiers']... | the_stack_v2_python_sparse | binary_sensor.py | benleb/sureha | train | 12 |
7c083965d9c593cc5611e07778410c8f0e3bf067 | [
"super().__init__(listRef.localControlRef)\nself.getFunction = getFunction\nself.setFunction = setFunction\nself.data = getFunction()\nlistRef.addUndoObj(self, notRedo)",
"if redoRef != None:\n StateSettingUndo(redoRef, self.getFunction, self.setFunction, False)\nself.setFunction(self.data)"
] | <|body_start_0|>
super().__init__(listRef.localControlRef)
self.getFunction = getFunction
self.setFunction = setFunction
self.data = getFunction()
listRef.addUndoObj(self, notRedo)
<|end_body_0|>
<|body_start_1|>
if redoRef != None:
StateSettingUndo(redoRef, ... | Info for undo/redo of objects with get/set functions for attributes. | StateSettingUndo | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StateSettingUndo:
"""Info for undo/redo of objects with get/set functions for attributes."""
def __init__(self, listRef, getFunction, setFunction, notRedo=True):
"""Create the data undo class and add it to the undoStore. Arguments: listRef -- a ref to the undo/redo list this gets add... | stack_v2_sparse_classes_75kplus_train_001053 | 17,816 | no_license | [
{
"docstring": "Create the data undo class and add it to the undoStore. Arguments: listRef -- a ref to the undo/redo list this gets added to getFunction -- a function ref that returns a state variable setFunction -- a function ref that restores from the state varible notRedo -- if True, clear redo list (after c... | 2 | stack_v2_sparse_classes_30k_train_022978 | Implement the Python class `StateSettingUndo` described below.
Class description:
Info for undo/redo of objects with get/set functions for attributes.
Method signatures and docstrings:
- def __init__(self, listRef, getFunction, setFunction, notRedo=True): Create the data undo class and add it to the undoStore. Argume... | Implement the Python class `StateSettingUndo` described below.
Class description:
Info for undo/redo of objects with get/set functions for attributes.
Method signatures and docstrings:
- def __init__(self, listRef, getFunction, setFunction, notRedo=True): Create the data undo class and add it to the undoStore. Argume... | c9429496e8ed15116746a23f3a90f262cf54f755 | <|skeleton|>
class StateSettingUndo:
"""Info for undo/redo of objects with get/set functions for attributes."""
def __init__(self, listRef, getFunction, setFunction, notRedo=True):
"""Create the data undo class and add it to the undoStore. Arguments: listRef -- a ref to the undo/redo list this gets add... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class StateSettingUndo:
"""Info for undo/redo of objects with get/set functions for attributes."""
def __init__(self, listRef, getFunction, setFunction, notRedo=True):
"""Create the data undo class and add it to the undoStore. Arguments: listRef -- a ref to the undo/redo list this gets added to getFunc... | the_stack_v2_python_sparse | source/undo.py | doug-101/TreeLine | train | 121 |
0d8030a03931dee943fa9d0869eb70e0e97a33d2 | [
"parser.add_argument('--bind-repo-ro', action='store_true', default=True, help='Makes a read-only bind-mount of the current Buck project into the vm at the same location as it is on the host. This is needed to run binaries that are built to be run in-place and for binaries that make assumptions about files being av... | <|body_start_0|>
parser.add_argument('--bind-repo-ro', action='store_true', default=True, help='Makes a read-only bind-mount of the current Buck project into the vm at the same location as it is on the host. This is needed to run binaries that are built to be run in-place and for binaries that make assumptions ... | This is the common set of arguments that can be passed to an `antlir.vm` cli. | VMExecOpts | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VMExecOpts:
"""This is the common set of arguments that can be passed to an `antlir.vm` cli."""
def setup_cli(cls, parser) -> None:
"""Add attributes defined on this type to the parser. Subclasses of `VMExecOpts` should overload this classmethod to provide their own arguments. Subcla... | stack_v2_sparse_classes_75kplus_train_001054 | 21,990 | permissive | [
{
"docstring": "Add attributes defined on this type to the parser. Subclasses of `VMExecOpts` should overload this classmethod to provide their own arguments. Subclass implementors should take care to call `super(<SubClassType>, cls).setup_cli(parser)` to make sure that these base class args are added.",
"n... | 2 | stack_v2_sparse_classes_30k_train_024543 | Implement the Python class `VMExecOpts` described below.
Class description:
This is the common set of arguments that can be passed to an `antlir.vm` cli.
Method signatures and docstrings:
- def setup_cli(cls, parser) -> None: Add attributes defined on this type to the parser. Subclasses of `VMExecOpts` should overloa... | Implement the Python class `VMExecOpts` described below.
Class description:
This is the common set of arguments that can be passed to an `antlir.vm` cli.
Method signatures and docstrings:
- def setup_cli(cls, parser) -> None: Add attributes defined on this type to the parser. Subclasses of `VMExecOpts` should overloa... | 677a3c45124b57e2ea96739d5f79816a26917417 | <|skeleton|>
class VMExecOpts:
"""This is the common set of arguments that can be passed to an `antlir.vm` cli."""
def setup_cli(cls, parser) -> None:
"""Add attributes defined on this type to the parser. Subclasses of `VMExecOpts` should overload this classmethod to provide their own arguments. Subcla... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class VMExecOpts:
"""This is the common set of arguments that can be passed to an `antlir.vm` cli."""
def setup_cli(cls, parser) -> None:
"""Add attributes defined on this type to the parser. Subclasses of `VMExecOpts` should overload this classmethod to provide their own arguments. Subclass implemento... | the_stack_v2_python_sparse | antlir/vm/vm.py | facebookincubator/antlir | train | 52 |
d30b0f0a79c1681d120ca1292675d4831eb20f83 | [
"try:\n if not rep_delay:\n rep_delay = self._backend.configuration().rep_delay_range[0]\nexcept AttributeError as error:\n raise DataProcessorError('The restless experiment can not be enabled because the attribute rep_delay_range is not defined for this backend and a minimum rep_delay can not be set.'... | <|body_start_0|>
try:
if not rep_delay:
rep_delay = self._backend.configuration().rep_delay_range[0]
except AttributeError as error:
raise DataProcessorError('The restless experiment can not be enabled because the attribute rep_delay_range is not defined for this ... | A mixin to facilitate restless experiments. This class defines the following methods: - :meth:`~.RestlessMixin.enable_restless` - :meth:`~.RestlessMixin._get_restless_processor` - :meth:`~.RestlessMixin._t1_check` A restless enabled experiment is an experiment that can be run in a restless measurement setting. In restl... | RestlessMixin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RestlessMixin:
"""A mixin to facilitate restless experiments. This class defines the following methods: - :meth:`~.RestlessMixin.enable_restless` - :meth:`~.RestlessMixin._get_restless_processor` - :meth:`~.RestlessMixin._t1_check` A restless enabled experiment is an experiment that can be run in... | stack_v2_sparse_classes_75kplus_train_001055 | 9,549 | permissive | [
{
"docstring": "Enables a restless experiment by setting the restless run options and the restless data processor. Args: rep_delay: The repetition delay. This is the delay between a measurement and the subsequent quantum circuit. Since the backends have dynamic repetition rates, the repetition delay can be set ... | 3 | null | Implement the Python class `RestlessMixin` described below.
Class description:
A mixin to facilitate restless experiments. This class defines the following methods: - :meth:`~.RestlessMixin.enable_restless` - :meth:`~.RestlessMixin._get_restless_processor` - :meth:`~.RestlessMixin._t1_check` A restless enabled experim... | Implement the Python class `RestlessMixin` described below.
Class description:
A mixin to facilitate restless experiments. This class defines the following methods: - :meth:`~.RestlessMixin.enable_restless` - :meth:`~.RestlessMixin._get_restless_processor` - :meth:`~.RestlessMixin._t1_check` A restless enabled experim... | a387675a3fe817cef05b968bbf3e05799a09aaae | <|skeleton|>
class RestlessMixin:
"""A mixin to facilitate restless experiments. This class defines the following methods: - :meth:`~.RestlessMixin.enable_restless` - :meth:`~.RestlessMixin._get_restless_processor` - :meth:`~.RestlessMixin._t1_check` A restless enabled experiment is an experiment that can be run in... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RestlessMixin:
"""A mixin to facilitate restless experiments. This class defines the following methods: - :meth:`~.RestlessMixin.enable_restless` - :meth:`~.RestlessMixin._get_restless_processor` - :meth:`~.RestlessMixin._t1_check` A restless enabled experiment is an experiment that can be run in a restless m... | the_stack_v2_python_sparse | qiskit_experiments/framework/restless_mixin.py | oliverdial/qiskit-experiments | train | 0 |
04d564a8b348a03006d5afb91d476609760a7d1d | [
"self.array = collections.deque()\nself.size = size\nself.count = 0\nself.mysum = 0",
"self.array.append(val)\nself.count += 1\nself.mysum += val\nif self.count > self.size:\n self.mysum -= self.array.popleft()\n self.count -= 1\nreturn self.mysum / float(self.count)"
] | <|body_start_0|>
self.array = collections.deque()
self.size = size
self.count = 0
self.mysum = 0
<|end_body_0|>
<|body_start_1|>
self.array.append(val)
self.count += 1
self.mysum += val
if self.count > self.size:
self.mysum -= self.array.pople... | MovingAverage | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MovingAverage:
def __init__(self, size):
"""Initialize your data structure here. :type size: int"""
<|body_0|>
def next(self, val):
""":type val: int :rtype: float"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.array = collections.deque()
... | stack_v2_sparse_classes_75kplus_train_001056 | 740 | no_license | [
{
"docstring": "Initialize your data structure here. :type size: int",
"name": "__init__",
"signature": "def __init__(self, size)"
},
{
"docstring": ":type val: int :rtype: float",
"name": "next",
"signature": "def next(self, val)"
}
] | 2 | null | Implement the Python class `MovingAverage` described below.
Class description:
Implement the MovingAverage class.
Method signatures and docstrings:
- def __init__(self, size): Initialize your data structure here. :type size: int
- def next(self, val): :type val: int :rtype: float | Implement the Python class `MovingAverage` described below.
Class description:
Implement the MovingAverage class.
Method signatures and docstrings:
- def __init__(self, size): Initialize your data structure here. :type size: int
- def next(self, val): :type val: int :rtype: float
<|skeleton|>
class MovingAverage:
... | 59c17c221ddc6e2a4dc95cf11fda34574611c832 | <|skeleton|>
class MovingAverage:
def __init__(self, size):
"""Initialize your data structure here. :type size: int"""
<|body_0|>
def next(self, val):
""":type val: int :rtype: float"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MovingAverage:
def __init__(self, size):
"""Initialize your data structure here. :type size: int"""
self.array = collections.deque()
self.size = size
self.count = 0
self.mysum = 0
def next(self, val):
""":type val: int :rtype: float"""
self.array.ap... | the_stack_v2_python_sparse | Leetcode/Queue/346_Moving_Average_from_Data_Stream.py | poweihuang17/practice_leetcode_and_interview | train | 5 | |
5b466c63247fe1f17e39d4f876dd8a55b54e9de3 | [
"self.operation_obj = operation_obj\nself.image = image\nself.name = name\nself.instance = instance\nself.flavor = flavor\nself.region = region\nself.bandwidth = bandwidth\nself.snapshot = snapshot\nself.size = size\nself.kwargs = kwargs",
"if kwargs is None:\n return None\ncontext = ScaleContext('', '')\nfor ... | <|body_start_0|>
self.operation_obj = operation_obj
self.image = image
self.name = name
self.instance = instance
self.flavor = flavor
self.region = region
self.bandwidth = bandwidth
self.snapshot = snapshot
self.size = size
self.kwargs = kw... | ScaleContext | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ScaleContext:
def __init__(self, name='ali', operation_obj='instance', image=None, instance=None, flavor=None, region=None, bandwidth=None, snapshot=None, size=None, **kwargs):
""":param instance: id of instance :param name :the name of cloud :param operation_obj:volume or instance :para... | stack_v2_sparse_classes_75kplus_train_001057 | 1,716 | no_license | [
{
"docstring": ":param instance: id of instance :param name :the name of cloud :param operation_obj:volume or instance :param image:image id :param flavor: flavor like small.tiny1 :param region: region :param bandwidth:400 :param snapshot: snapshot of volume :param size: size of volume :param kwargs: other args... | 2 | stack_v2_sparse_classes_30k_val_001053 | Implement the Python class `ScaleContext` described below.
Class description:
Implement the ScaleContext class.
Method signatures and docstrings:
- def __init__(self, name='ali', operation_obj='instance', image=None, instance=None, flavor=None, region=None, bandwidth=None, snapshot=None, size=None, **kwargs): :param ... | Implement the Python class `ScaleContext` described below.
Class description:
Implement the ScaleContext class.
Method signatures and docstrings:
- def __init__(self, name='ali', operation_obj='instance', image=None, instance=None, flavor=None, region=None, bandwidth=None, snapshot=None, size=None, **kwargs): :param ... | d26ddb2fe7aaecdff4c1dfcd495b53c4086c5360 | <|skeleton|>
class ScaleContext:
def __init__(self, name='ali', operation_obj='instance', image=None, instance=None, flavor=None, region=None, bandwidth=None, snapshot=None, size=None, **kwargs):
""":param instance: id of instance :param name :the name of cloud :param operation_obj:volume or instance :para... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ScaleContext:
def __init__(self, name='ali', operation_obj='instance', image=None, instance=None, flavor=None, region=None, bandwidth=None, snapshot=None, size=None, **kwargs):
""":param instance: id of instance :param name :the name of cloud :param operation_obj:volume or instance :param image:image ... | the_stack_v2_python_sparse | scaling/_scaling/context.py | wjybluse/cloudsdk | train | 0 | |
a9d2c76ac6f137cfe4359cbf0fee26f06c99ee21 | [
"r = SuperSocket.recv(self, x)\nif r:\n return r.payload",
"iff = pkt.route()[0]\nif iff is None:\n iff = conf.iface\nif self.assigned_interface != iff:\n try:\n fcntl.ioctl(self.outs, BIOCSETIF, struct.pack('16s16x', iff.encode()))\n except IOError:\n raise Scapy_Exception('BIOCSETIF fa... | <|body_start_0|>
r = SuperSocket.recv(self, x)
if r:
return r.payload
<|end_body_0|>
<|body_start_1|>
iff = pkt.route()[0]
if iff is None:
iff = conf.iface
if self.assigned_interface != iff:
try:
fcntl.ioctl(self.outs, BIOCSETI... | L3bpfSocket | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class L3bpfSocket:
def recv(self, x=BPF_BUFFER_LENGTH):
"""Receive on layer 3"""
<|body_0|>
def send(self, pkt):
"""Send a packet"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
r = SuperSocket.recv(self, x)
if r:
return r.payload
<|en... | stack_v2_sparse_classes_75kplus_train_001058 | 12,710 | permissive | [
{
"docstring": "Receive on layer 3",
"name": "recv",
"signature": "def recv(self, x=BPF_BUFFER_LENGTH)"
},
{
"docstring": "Send a packet",
"name": "send",
"signature": "def send(self, pkt)"
}
] | 2 | stack_v2_sparse_classes_30k_train_010485 | Implement the Python class `L3bpfSocket` described below.
Class description:
Implement the L3bpfSocket class.
Method signatures and docstrings:
- def recv(self, x=BPF_BUFFER_LENGTH): Receive on layer 3
- def send(self, pkt): Send a packet | Implement the Python class `L3bpfSocket` described below.
Class description:
Implement the L3bpfSocket class.
Method signatures and docstrings:
- def recv(self, x=BPF_BUFFER_LENGTH): Receive on layer 3
- def send(self, pkt): Send a packet
<|skeleton|>
class L3bpfSocket:
def recv(self, x=BPF_BUFFER_LENGTH):
... | e6cccba69335816442c515d65d9aedea9e7dc58b | <|skeleton|>
class L3bpfSocket:
def recv(self, x=BPF_BUFFER_LENGTH):
"""Receive on layer 3"""
<|body_0|>
def send(self, pkt):
"""Send a packet"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class L3bpfSocket:
def recv(self, x=BPF_BUFFER_LENGTH):
"""Receive on layer 3"""
r = SuperSocket.recv(self, x)
if r:
return r.payload
def send(self, pkt):
"""Send a packet"""
iff = pkt.route()[0]
if iff is None:
iff = conf.iface
if... | the_stack_v2_python_sparse | Botnets/App/App Web/PDG-env/lib/python3.6/site-packages/scapy/arch/bpf/supersocket.py | i2tResearch/Ciberseguridad_web | train | 14 | |
103f12bf86b08838c29e10229d3e3bec620ca505 | [
"print('This command was deprecated, and will be removed in 0.2.0 use:')\nprint('rally plugin show %s' % query)\nplugin.PluginCommands().show(query)\nreturn 1",
"print('This command was deprecated, and will be removed in 0.2.0 use:')\nprint('rally plugin list')\nplugin.PluginCommands().list()\nreturn 1"
] | <|body_start_0|>
print('This command was deprecated, and will be removed in 0.2.0 use:')
print('rally plugin show %s' % query)
plugin.PluginCommands().show(query)
return 1
<|end_body_0|>
<|body_start_1|>
print('This command was deprecated, and will be removed in 0.2.0 use:')
... | [deprecated] Allows you to get quick doc of rally entities. | InfoCommands | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InfoCommands:
"""[deprecated] Allows you to get quick doc of rally entities."""
def find(self, query):
"""Search for an entity that matches the query and print info about it. :param query: search query."""
<|body_0|>
def list(self):
"""List main entities in Rally... | stack_v2_sparse_classes_75kplus_train_001059 | 1,610 | permissive | [
{
"docstring": "Search for an entity that matches the query and print info about it. :param query: search query.",
"name": "find",
"signature": "def find(self, query)"
},
{
"docstring": "List main entities in Rally for which rally info find works. Lists task scenario groups, deploy engines and s... | 2 | stack_v2_sparse_classes_30k_test_000626 | Implement the Python class `InfoCommands` described below.
Class description:
[deprecated] Allows you to get quick doc of rally entities.
Method signatures and docstrings:
- def find(self, query): Search for an entity that matches the query and print info about it. :param query: search query.
- def list(self): List m... | Implement the Python class `InfoCommands` described below.
Class description:
[deprecated] Allows you to get quick doc of rally entities.
Method signatures and docstrings:
- def find(self, query): Search for an entity that matches the query and print info about it. :param query: search query.
- def list(self): List m... | 4b3fa606e2bca7d7f0326ef3d0cfa67e93cbc18b | <|skeleton|>
class InfoCommands:
"""[deprecated] Allows you to get quick doc of rally entities."""
def find(self, query):
"""Search for an entity that matches the query and print info about it. :param query: search query."""
<|body_0|>
def list(self):
"""List main entities in Rally... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class InfoCommands:
"""[deprecated] Allows you to get quick doc of rally entities."""
def find(self, query):
"""Search for an entity that matches the query and print info about it. :param query: search query."""
print('This command was deprecated, and will be removed in 0.2.0 use:')
pri... | the_stack_v2_python_sparse | rally/cli/commands/info.py | cernops/rally | train | 1 |
f2dd0adc1e4e1d42062a7456aeee4218dc58244d | [
"if root is None:\n return root\nif root.val > key:\n root.left = self.deleteNode(root.left, key)\nelif root.val < key:\n root.right = self.deleteNode(root.right, key)\nelif root.left is None and root.right is None:\n root = None\nelif root.right is not None:\n root.val = self.successor(root.right)\n... | <|body_start_0|>
if root is None:
return root
if root.val > key:
root.left = self.deleteNode(root.left, key)
elif root.val < key:
root.right = self.deleteNode(root.right, key)
elif root.left is None and root.right is None:
root = None
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def deleteNode(self, root, key):
""":type root: TreeNode :type key: int :rtype: TreeNode"""
<|body_0|>
def successor(self, root):
"""always left"""
<|body_1|>
def predecessor(self, root):
"""always right"""
<|body_2|>
<|end_ske... | stack_v2_sparse_classes_75kplus_train_001060 | 2,055 | no_license | [
{
"docstring": ":type root: TreeNode :type key: int :rtype: TreeNode",
"name": "deleteNode",
"signature": "def deleteNode(self, root, key)"
},
{
"docstring": "always left",
"name": "successor",
"signature": "def successor(self, root)"
},
{
"docstring": "always right",
"name":... | 3 | stack_v2_sparse_classes_30k_train_051235 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def deleteNode(self, root, key): :type root: TreeNode :type key: int :rtype: TreeNode
- def successor(self, root): always left
- def predecessor(self, root): always right | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def deleteNode(self, root, key): :type root: TreeNode :type key: int :rtype: TreeNode
- def successor(self, root): always left
- def predecessor(self, root): always right
<|skel... | e4d21223c85b622b5a905d1a056dfb2f300964b1 | <|skeleton|>
class Solution:
def deleteNode(self, root, key):
""":type root: TreeNode :type key: int :rtype: TreeNode"""
<|body_0|>
def successor(self, root):
"""always left"""
<|body_1|>
def predecessor(self, root):
"""always right"""
<|body_2|>
<|end_ske... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def deleteNode(self, root, key):
""":type root: TreeNode :type key: int :rtype: TreeNode"""
if root is None:
return root
if root.val > key:
root.left = self.deleteNode(root.left, key)
elif root.val < key:
root.right = self.deleteNod... | the_stack_v2_python_sparse | Algorithms/tree/450.delete-node-in-a-bst/delete-node-in-a-bst.py | gosyang/leetcode | train | 1 | |
42305a3a50c3af039dce76843791a38f88c54719 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')"
] | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | Proto file describing the FeedMapping service. Service to manage feed mappings. | FeedMappingServiceServicer | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FeedMappingServiceServicer:
"""Proto file describing the FeedMapping service. Service to manage feed mappings."""
def GetFeedMapping(self, request, context):
"""Returns the requested feed mapping in full detail."""
<|body_0|>
def MutateFeedMappings(self, request, context... | stack_v2_sparse_classes_75kplus_train_001061 | 3,358 | permissive | [
{
"docstring": "Returns the requested feed mapping in full detail.",
"name": "GetFeedMapping",
"signature": "def GetFeedMapping(self, request, context)"
},
{
"docstring": "Creates or removes feed mappings. Operation statuses are returned.",
"name": "MutateFeedMappings",
"signature": "def... | 2 | stack_v2_sparse_classes_30k_train_049488 | Implement the Python class `FeedMappingServiceServicer` described below.
Class description:
Proto file describing the FeedMapping service. Service to manage feed mappings.
Method signatures and docstrings:
- def GetFeedMapping(self, request, context): Returns the requested feed mapping in full detail.
- def MutateFee... | Implement the Python class `FeedMappingServiceServicer` described below.
Class description:
Proto file describing the FeedMapping service. Service to manage feed mappings.
Method signatures and docstrings:
- def GetFeedMapping(self, request, context): Returns the requested feed mapping in full detail.
- def MutateFee... | 0fc8a7dbf31d9e8e2a4364df93bec5f6b7edd50a | <|skeleton|>
class FeedMappingServiceServicer:
"""Proto file describing the FeedMapping service. Service to manage feed mappings."""
def GetFeedMapping(self, request, context):
"""Returns the requested feed mapping in full detail."""
<|body_0|>
def MutateFeedMappings(self, request, context... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FeedMappingServiceServicer:
"""Proto file describing the FeedMapping service. Service to manage feed mappings."""
def GetFeedMapping(self, request, context):
"""Returns the requested feed mapping in full detail."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_detail... | the_stack_v2_python_sparse | google/ads/google_ads/v2/proto/services/feed_mapping_service_pb2_grpc.py | juanmacugat/google-ads-python | train | 1 |
3391a72e584a415e2472887241bdc48025314a2b | [
"self.req_fields = req_fields\nif not self._validate_req_fields():\n return self.selected_data\nself.selected_data = self._iterate_json()\nnew_context_map = MapSelect(json_data=self.selected_data)\nself.json_map = new_context_map.mapit()\nself.final_fields_order = self._get_available_fields('?', mode='')\nreturn... | <|body_start_0|>
self.req_fields = req_fields
if not self._validate_req_fields():
return self.selected_data
self.selected_data = self._iterate_json()
new_context_map = MapSelect(json_data=self.selected_data)
self.json_map = new_context_map.mapit()
self.final_f... | Json operation to change the context of the json output. | JsonContextor | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JsonContextor:
"""Json operation to change the context of the json output."""
def iterate(self, req_fields):
"""Get the selected fields from json data."""
<|body_0|>
def _iterate_list(self):
"""Iterate through the list data found."""
<|body_1|>
def _... | stack_v2_sparse_classes_75kplus_train_001062 | 28,440 | permissive | [
{
"docstring": "Get the selected fields from json data.",
"name": "iterate",
"signature": "def iterate(self, req_fields)"
},
{
"docstring": "Iterate through the list data found.",
"name": "_iterate_list",
"signature": "def _iterate_list(self)"
},
{
"docstring": "Iterate through t... | 3 | null | Implement the Python class `JsonContextor` described below.
Class description:
Json operation to change the context of the json output.
Method signatures and docstrings:
- def iterate(self, req_fields): Get the selected fields from json data.
- def _iterate_list(self): Iterate through the list data found.
- def _iter... | Implement the Python class `JsonContextor` described below.
Class description:
Json operation to change the context of the json output.
Method signatures and docstrings:
- def iterate(self, req_fields): Get the selected fields from json data.
- def _iterate_list(self): Iterate through the list data found.
- def _iter... | 62bbb20d15c78d2554d7258bdae655452ac826c7 | <|skeleton|>
class JsonContextor:
"""Json operation to change the context of the json output."""
def iterate(self, req_fields):
"""Get the selected fields from json data."""
<|body_0|>
def _iterate_list(self):
"""Iterate through the list data found."""
<|body_1|>
def _... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class JsonContextor:
"""Json operation to change the context of the json output."""
def iterate(self, req_fields):
"""Get the selected fields from json data."""
self.req_fields = req_fields
if not self._validate_req_fields():
return self.selected_data
self.selected_d... | the_stack_v2_python_sparse | rbkcli/core/handlers/jsometa.py | rubrikinc/rbkcli | train | 12 |
296b09bf3bc7e476538bb530f54b2ca888f4f602 | [
"self.obj = obj\nself.attrGetter = xobj_attrgetter(varName)\nself.previousValue = self.attrGetter(self.obj)\nself.callback = callback",
"value = self.attrGetter(self.obj)\nif value != self.previousValue:\n self.previousValue = value\n self.callback(value)"
] | <|body_start_0|>
self.obj = obj
self.attrGetter = xobj_attrgetter(varName)
self.previousValue = self.attrGetter(self.obj)
self.callback = callback
<|end_body_0|>
<|body_start_1|>
value = self.attrGetter(self.obj)
if value != self.previousValue:
self.previousV... | Represents a watch placed on a particular variable of an object | VarWatch | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VarWatch:
"""Represents a watch placed on a particular variable of an object"""
def __init__(self, obj, varName, callback):
"""Initialize the Watch with the object and its variable to watch and the callback to fire"""
<|body_0|>
def checkChange(self):
"""Check if... | stack_v2_sparse_classes_75kplus_train_001063 | 702 | no_license | [
{
"docstring": "Initialize the Watch with the object and its variable to watch and the callback to fire",
"name": "__init__",
"signature": "def __init__(self, obj, varName, callback)"
},
{
"docstring": "Check if the value has changed",
"name": "checkChange",
"signature": "def checkChange... | 2 | stack_v2_sparse_classes_30k_train_030081 | Implement the Python class `VarWatch` described below.
Class description:
Represents a watch placed on a particular variable of an object
Method signatures and docstrings:
- def __init__(self, obj, varName, callback): Initialize the Watch with the object and its variable to watch and the callback to fire
- def checkC... | Implement the Python class `VarWatch` described below.
Class description:
Represents a watch placed on a particular variable of an object
Method signatures and docstrings:
- def __init__(self, obj, varName, callback): Initialize the Watch with the object and its variable to watch and the callback to fire
- def checkC... | 19b7bf08658ce329c7b076ce2014bae9f5f09268 | <|skeleton|>
class VarWatch:
"""Represents a watch placed on a particular variable of an object"""
def __init__(self, obj, varName, callback):
"""Initialize the Watch with the object and its variable to watch and the callback to fire"""
<|body_0|>
def checkChange(self):
"""Check if... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class VarWatch:
"""Represents a watch placed on a particular variable of an object"""
def __init__(self, obj, varName, callback):
"""Initialize the Watch with the object and its variable to watch and the callback to fire"""
self.obj = obj
self.attrGetter = xobj_attrgetter(varName)
... | the_stack_v2_python_sparse | src/knot/watches/var_watch.py | cloew/Knot | train | 1 |
97a1dbd8c7bdfc06a9c4e7dd10cb76a6927a4955 | [
"heapq.heapify(nums)\nlast = heapq.heappop(nums)\nret = 0\nwhile nums:\n cur = heapq.heappop(nums)\n ret = max(ret, cur - last)\n last = cur\nreturn ret",
"if len(nums) < 2:\n return 0\nnums.sort()\nreturn min([nums[i] - nums[i - 1] for i in range(1, len(nums))])"
] | <|body_start_0|>
heapq.heapify(nums)
last = heapq.heappop(nums)
ret = 0
while nums:
cur = heapq.heappop(nums)
ret = max(ret, cur - last)
last = cur
return ret
<|end_body_0|>
<|body_start_1|>
if len(nums) < 2:
return 0
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maximumGap(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def maximumGap_1(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
heapq.heapify(nums)
last = heapq.heap... | stack_v2_sparse_classes_75kplus_train_001064 | 726 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "maximumGap",
"signature": "def maximumGap(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "maximumGap_1",
"signature": "def maximumGap_1(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_train_051017 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maximumGap(self, nums): :type nums: List[int] :rtype: int
- def maximumGap_1(self, nums): :type nums: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maximumGap(self, nums): :type nums: List[int] :rtype: int
- def maximumGap_1(self, nums): :type nums: List[int] :rtype: int
<|skeleton|>
class Solution:
def maximumGap(... | 70bdd75b6af2e1811c1beab22050c01d28d7373e | <|skeleton|>
class Solution:
def maximumGap(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def maximumGap_1(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def maximumGap(self, nums):
""":type nums: List[int] :rtype: int"""
heapq.heapify(nums)
last = heapq.heappop(nums)
ret = 0
while nums:
cur = heapq.heappop(nums)
ret = max(ret, cur - last)
last = cur
return ret
d... | the_stack_v2_python_sparse | python/leetcode/164_Maximum_Gap.py | bobcaoge/my-code | train | 0 | |
85a718358a7e953af77e517d0df35e684db9d288 | [
"try:\n img = Image.open(path)\n arr = np.array(img)\n print(f'Loading image of dimensions {arr.shape[0]} x {arr.shape[1]}')\n return np.divide(arr[:, :, 0:3], 255)\nexcept Exception as e:\n print(f'Exception : {e.__class__.__name__} -- strerror: {e}')\nreturn None",
"array = np.multiply(array, 255... | <|body_start_0|>
try:
img = Image.open(path)
arr = np.array(img)
print(f'Loading image of dimensions {arr.shape[0]} x {arr.shape[1]}')
return np.divide(arr[:, :, 0:3], 255)
except Exception as e:
print(f'Exception : {e.__class__.__name__} -- st... | ImageProcessor class | ImageProcessor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImageProcessor:
"""ImageProcessor class"""
def load(self, path):
"""Load the image"""
<|body_0|>
def display(self, array):
"""Display the image"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
try:
img = Image.open(path)
a... | stack_v2_sparse_classes_75kplus_train_001065 | 718 | no_license | [
{
"docstring": "Load the image",
"name": "load",
"signature": "def load(self, path)"
},
{
"docstring": "Display the image",
"name": "display",
"signature": "def display(self, array)"
}
] | 2 | null | Implement the Python class `ImageProcessor` described below.
Class description:
ImageProcessor class
Method signatures and docstrings:
- def load(self, path): Load the image
- def display(self, array): Display the image | Implement the Python class `ImageProcessor` described below.
Class description:
ImageProcessor class
Method signatures and docstrings:
- def load(self, path): Load the image
- def display(self, array): Display the image
<|skeleton|>
class ImageProcessor:
"""ImageProcessor class"""
def load(self, path):
... | d47cab16cbad806a14b1323014dbab8da5a000aa | <|skeleton|>
class ImageProcessor:
"""ImageProcessor class"""
def load(self, path):
"""Load the image"""
<|body_0|>
def display(self, array):
"""Display the image"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ImageProcessor:
"""ImageProcessor class"""
def load(self, path):
"""Load the image"""
try:
img = Image.open(path)
arr = np.array(img)
print(f'Loading image of dimensions {arr.shape[0]} x {arr.shape[1]}')
return np.divide(arr[:, :, 0:3], 255)... | the_stack_v2_python_sparse | day03/ex03/ImageProcessor.py | cclaude42/python_bootcamp | train | 7 |
e1cb1e3768220792ad158298cad831727be01cd2 | [
"super().__init__()\nself.mainWindow = mainWindow\nself.getListboxData()",
"if not self.getModules():\n self.mainWindow.status = False\n return\nself.getTopics()\nself.getProblems()\nself.getAssignments()",
"if self.mainWindow.values['-MODULE-'][0] in self.topicsDict.keys():\n topicsData = self.topicsD... | <|body_start_0|>
super().__init__()
self.mainWindow = mainWindow
self.getListboxData()
<|end_body_0|>
<|body_start_1|>
if not self.getModules():
self.mainWindow.status = False
return
self.getTopics()
self.getProblems()
self.getAssignments(... | A class to use for generating the assignment listboxs which will also download the data if needed. Parameters ---------- dataHandelerClass : class The data handeler class to inherit from, that will manage the downloading and retriving of saved data. Attributes ---------- mainWindow : object The PySimpleGUI window objec... | assignmentsListboxClass | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class assignmentsListboxClass:
"""A class to use for generating the assignment listboxs which will also download the data if needed. Parameters ---------- dataHandelerClass : class The data handeler class to inherit from, that will manage the downloading and retriving of saved data. Attributes --------... | stack_v2_sparse_classes_75kplus_train_001066 | 3,866 | permissive | [
{
"docstring": "The constructor for assignmentsListboxClass. Parameters ---------- mainWindow : object The PySimpleGUI window object that has been opened.",
"name": "__init__",
"signature": "def __init__(self, mainWindow)"
},
{
"docstring": "Retrieve the saved data or download new data for modul... | 5 | stack_v2_sparse_classes_30k_train_029021 | Implement the Python class `assignmentsListboxClass` described below.
Class description:
A class to use for generating the assignment listboxs which will also download the data if needed. Parameters ---------- dataHandelerClass : class The data handeler class to inherit from, that will manage the downloading and retri... | Implement the Python class `assignmentsListboxClass` described below.
Class description:
A class to use for generating the assignment listboxs which will also download the data if needed. Parameters ---------- dataHandelerClass : class The data handeler class to inherit from, that will manage the downloading and retri... | e65f5aa64919649690059da37f7bd608b823ca6a | <|skeleton|>
class assignmentsListboxClass:
"""A class to use for generating the assignment listboxs which will also download the data if needed. Parameters ---------- dataHandelerClass : class The data handeler class to inherit from, that will manage the downloading and retriving of saved data. Attributes --------... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class assignmentsListboxClass:
"""A class to use for generating the assignment listboxs which will also download the data if needed. Parameters ---------- dataHandelerClass : class The data handeler class to inherit from, that will manage the downloading and retriving of saved data. Attributes ---------- mainWindow... | the_stack_v2_python_sparse | assignments/layout/listbox.py | GingerNinja2962/wtc-lms-GUI | train | 2 |
5ef38e080883e34d9790017f7f0ceeebd5c77741 | [
"self._test_start('test for correct ETOPO1 data')\nsd_test = [SeismicData(Point(-122.65, 49.21667, 0)), SeismicData(Point(-114.0833, 51.05, 0))]\nself.assertTrue(UCVM.query(sd_test, 'usgs-noaa', ['elevation']))\nself.assertAlmostEqual(sd_test[0].elevation_properties.elevation, 19.994, 3)\nself.assertEqual(sd_test[0... | <|body_start_0|>
self._test_start('test for correct ETOPO1 data')
sd_test = [SeismicData(Point(-122.65, 49.21667, 0)), SeismicData(Point(-114.0833, 51.05, 0))]
self.assertTrue(UCVM.query(sd_test, 'usgs-noaa', ['elevation']))
self.assertAlmostEqual(sd_test[0].elevation_properties.elevatio... | Defines the test cases for the USGS/NOAA elevation model. Three cases are tested in total. | USGSNOAAElevationModelTest | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class USGSNOAAElevationModelTest:
"""Defines the test cases for the USGS/NOAA elevation model. Three cases are tested in total."""
def test_etopo1_basic(self):
"""Tests that the USGS/NOAA map delivers the expected ETOPO1 data at certain latitudes and longitudes around the world. Returns: N... | stack_v2_sparse_classes_75kplus_train_001067 | 4,164 | permissive | [
{
"docstring": "Tests that the USGS/NOAA map delivers the expected ETOPO1 data at certain latitudes and longitudes around the world. Returns: None",
"name": "test_etopo1_basic",
"signature": "def test_etopo1_basic(self)"
},
{
"docstring": "Tests that the USGS/NOAA map delivers the expected Natio... | 4 | stack_v2_sparse_classes_30k_train_041975 | Implement the Python class `USGSNOAAElevationModelTest` described below.
Class description:
Defines the test cases for the USGS/NOAA elevation model. Three cases are tested in total.
Method signatures and docstrings:
- def test_etopo1_basic(self): Tests that the USGS/NOAA map delivers the expected ETOPO1 data at cert... | Implement the Python class `USGSNOAAElevationModelTest` described below.
Class description:
Defines the test cases for the USGS/NOAA elevation model. Three cases are tested in total.
Method signatures and docstrings:
- def test_etopo1_basic(self): Tests that the USGS/NOAA map delivers the expected ETOPO1 data at cert... | 716db787a1b5b444d791547eeca4e2a3ee613da1 | <|skeleton|>
class USGSNOAAElevationModelTest:
"""Defines the test cases for the USGS/NOAA elevation model. Three cases are tested in total."""
def test_etopo1_basic(self):
"""Tests that the USGS/NOAA map delivers the expected ETOPO1 data at certain latitudes and longitudes around the world. Returns: N... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class USGSNOAAElevationModelTest:
"""Defines the test cases for the USGS/NOAA elevation model. Three cases are tested in total."""
def test_etopo1_basic(self):
"""Tests that the USGS/NOAA map delivers the expected ETOPO1 data at certain latitudes and longitudes around the world. Returns: None"""
... | the_stack_v2_python_sparse | ucvm/models/dem/usgs-noaa/test_usgs-noaa.py | meihuisu/UCVM-reallyOld | train | 0 |
f17bc693587f8cf15c9c808117c8599155ca5f19 | [
"self.size = size\nself.scale = scale\nself.min_pool_binary = min_pool_binary\nself.binary_keys = list(binary_keys)\nself.flow_keys = list(flow_keys)",
"h, w = inputs[list(inputs.keys())[0]].shape[2:4]\nif self.size is None or self.size[0] < 1 or self.size[1] < 1:\n self.size = (int(self.scale * h), int(self.s... | <|body_start_0|>
self.size = size
self.scale = scale
self.min_pool_binary = min_pool_binary
self.binary_keys = list(binary_keys)
self.flow_keys = list(flow_keys)
<|end_body_0|>
<|body_start_1|>
h, w = inputs[list(inputs.keys())[0]].shape[2:4]
if self.size is None... | Resize the image to a given size or scale. Size is checked first, if any of its values is zero, then scale is used. | Resize | [
"Apache-2.0",
"CC-BY-NC-SA-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Resize:
"""Resize the image to a given size or scale. Size is checked first, if any of its values is zero, then scale is used."""
def __init__(self, size: Tuple[int, int]=(0, 0), scale: float=1.0, min_pool_binary: bool=True, binary_keys: Union[KeysView, Sequence[str]]=('mbs', 'occs', 'valids... | stack_v2_sparse_classes_75kplus_train_001068 | 42,078 | permissive | [
{
"docstring": "Initialize Resize. Parameters ---------- size : Tuple[int, int], default (0, 0) The target size to resize the inputs. If it is zeros, then the scale will be used instead. scale : float, default 1.0 The scale factor to resize the images. Only used if size is zeros. min_pool_binary : bool, default... | 2 | stack_v2_sparse_classes_30k_test_001216 | Implement the Python class `Resize` described below.
Class description:
Resize the image to a given size or scale. Size is checked first, if any of its values is zero, then scale is used.
Method signatures and docstrings:
- def __init__(self, size: Tuple[int, int]=(0, 0), scale: float=1.0, min_pool_binary: bool=True,... | Implement the Python class `Resize` described below.
Class description:
Resize the image to a given size or scale. Size is checked first, if any of its values is zero, then scale is used.
Method signatures and docstrings:
- def __init__(self, size: Tuple[int, int]=(0, 0), scale: float=1.0, min_pool_binary: bool=True,... | d6582a0fd386517fdefbe2c347cef53150b5b1da | <|skeleton|>
class Resize:
"""Resize the image to a given size or scale. Size is checked first, if any of its values is zero, then scale is used."""
def __init__(self, size: Tuple[int, int]=(0, 0), scale: float=1.0, min_pool_binary: bool=True, binary_keys: Union[KeysView, Sequence[str]]=('mbs', 'occs', 'valids... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Resize:
"""Resize the image to a given size or scale. Size is checked first, if any of its values is zero, then scale is used."""
def __init__(self, size: Tuple[int, int]=(0, 0), scale: float=1.0, min_pool_binary: bool=True, binary_keys: Union[KeysView, Sequence[str]]=('mbs', 'occs', 'valids', 'mbs_b', '... | the_stack_v2_python_sparse | ptlflow/data/flow_transforms.py | hmorimitsu/ptlflow | train | 140 |
4bf97502c07d2c5de5e7e363bdd913c74cb29790 | [
"MyImage(self.driver).login_into_MyImage()\nMyImage(self.driver).deploy_image()\npo = MyImage(self.driver)\nself.assertEqual(po.deploy_image_success(), '创建服务')\nfunction.insert_img(self.driver, 'MyImage_deploy_image.png')",
"MyImage(self.driver).login_into_MyImage()\nMyImage(self.driver).check_image_checkbox()\nM... | <|body_start_0|>
MyImage(self.driver).login_into_MyImage()
MyImage(self.driver).deploy_image()
po = MyImage(self.driver)
self.assertEqual(po.deploy_image_success(), '创建服务')
function.insert_img(self.driver, 'MyImage_deploy_image.png')
<|end_body_0|>
<|body_start_1|>
MyIma... | 我的镜像界面测试 | MyImageTst | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyImageTst:
"""我的镜像界面测试"""
def test_1_deploy_image_test(self):
"""我的镜像-部署镜像测试"""
<|body_0|>
def test_2_export_image_test(self):
"""我的镜像-导出镜像测试"""
<|body_1|>
def test_3_collect_image_test(self):
"""我的镜像-收藏镜像测试"""
<|body_2|>
<|end_skel... | stack_v2_sparse_classes_75kplus_train_001069 | 1,466 | no_license | [
{
"docstring": "我的镜像-部署镜像测试",
"name": "test_1_deploy_image_test",
"signature": "def test_1_deploy_image_test(self)"
},
{
"docstring": "我的镜像-导出镜像测试",
"name": "test_2_export_image_test",
"signature": "def test_2_export_image_test(self)"
},
{
"docstring": "我的镜像-收藏镜像测试",
"name": ... | 3 | stack_v2_sparse_classes_30k_train_003781 | Implement the Python class `MyImageTst` described below.
Class description:
我的镜像界面测试
Method signatures and docstrings:
- def test_1_deploy_image_test(self): 我的镜像-部署镜像测试
- def test_2_export_image_test(self): 我的镜像-导出镜像测试
- def test_3_collect_image_test(self): 我的镜像-收藏镜像测试 | Implement the Python class `MyImageTst` described below.
Class description:
我的镜像界面测试
Method signatures and docstrings:
- def test_1_deploy_image_test(self): 我的镜像-部署镜像测试
- def test_2_export_image_test(self): 我的镜像-导出镜像测试
- def test_3_collect_image_test(self): 我的镜像-收藏镜像测试
<|skeleton|>
class MyImageTst:
"""我的镜像界面测试"... | dbd8aab0e0c479afd41f911198c4409d423e15f2 | <|skeleton|>
class MyImageTst:
"""我的镜像界面测试"""
def test_1_deploy_image_test(self):
"""我的镜像-部署镜像测试"""
<|body_0|>
def test_2_export_image_test(self):
"""我的镜像-导出镜像测试"""
<|body_1|>
def test_3_collect_image_test(self):
"""我的镜像-收藏镜像测试"""
<|body_2|>
<|end_skel... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MyImageTst:
"""我的镜像界面测试"""
def test_1_deploy_image_test(self):
"""我的镜像-部署镜像测试"""
MyImage(self.driver).login_into_MyImage()
MyImage(self.driver).deploy_image()
po = MyImage(self.driver)
self.assertEqual(po.deploy_image_success(), '创建服务')
function.insert_img(... | the_stack_v2_python_sparse | bcm/testcase/myimage_sttta.py | xiaohuang0807/auto | train | 0 |
de1b565ab92f8b99e1e726f62cb4d87d2a621710 | [
"storage = get_storage()\nrole = storage.read_role(role_id)\nreturn jsonify(RoleSchema().dump(role))",
"storage = get_storage()\nstorage.delete_role(role_id)\nreturn ('', 204)"
] | <|body_start_0|>
storage = get_storage()
role = storage.read_role(role_id)
return jsonify(RoleSchema().dump(role))
<|end_body_0|>
<|body_start_1|>
storage = get_storage()
storage.delete_role(role_id)
return ('', 204)
<|end_body_1|>
| RoleView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RoleView:
def get(self, role_id):
"""--- summary: Get information about a Role. parameters: - role_id tags: - Roles responses: 200: description: Role created successfully. content: application/json: schema: $ref: '#/components/schemas/RoleSchema' 401: $ref: '#/components/responses/401-Un... | stack_v2_sparse_classes_75kplus_train_001070 | 5,492 | permissive | [
{
"docstring": "--- summary: Get information about a Role. parameters: - role_id tags: - Roles responses: 200: description: Role created successfully. content: application/json: schema: $ref: '#/components/schemas/RoleSchema' 401: $ref: '#/components/responses/401-Unauthorized' 404: $ref: '#/components/response... | 2 | stack_v2_sparse_classes_30k_train_007659 | Implement the Python class `RoleView` described below.
Class description:
Implement the RoleView class.
Method signatures and docstrings:
- def get(self, role_id): --- summary: Get information about a Role. parameters: - role_id tags: - Roles responses: 200: description: Role created successfully. content: applicatio... | Implement the Python class `RoleView` described below.
Class description:
Implement the RoleView class.
Method signatures and docstrings:
- def get(self, role_id): --- summary: Get information about a Role. parameters: - role_id tags: - Roles responses: 200: description: Role created successfully. content: applicatio... | 280800c73eb7cfd49029462b352887e78f1ff91b | <|skeleton|>
class RoleView:
def get(self, role_id):
"""--- summary: Get information about a Role. parameters: - role_id tags: - Roles responses: 200: description: Role created successfully. content: application/json: schema: $ref: '#/components/schemas/RoleSchema' 401: $ref: '#/components/responses/401-Un... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RoleView:
def get(self, role_id):
"""--- summary: Get information about a Role. parameters: - role_id tags: - Roles responses: 200: description: Role created successfully. content: application/json: schema: $ref: '#/components/schemas/RoleSchema' 401: $ref: '#/components/responses/401-Unauthorized' 40... | the_stack_v2_python_sparse | sfa_api/roles.py | SolarArbiter/solarforecastarbiter-api | train | 9 | |
8db818f2b3f593301f6866cb0b2d1272cefb109c | [
"if len(self) >= len(other):\n return False\nfor e in other:\n if e not in self:\n return False\nreturn True",
"result = type(self)()\nfor e in self:\n result.add(e)\nfor e in other:\n result.add(e)\nreturn result"
] | <|body_start_0|>
if len(self) >= len(other):
return False
for e in other:
if e not in self:
return False
return True
<|end_body_0|>
<|body_start_1|>
result = type(self)()
for e in self:
result.add(e)
for e in other:
... | Set | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Set:
def __lt__(self, other):
"""Return True if this set is a subset of other."""
<|body_0|>
def __or__(self, other):
"""Return a new set that is the union of two existing sets."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if len(self) >= len(oth... | stack_v2_sparse_classes_75kplus_train_001071 | 592 | no_license | [
{
"docstring": "Return True if this set is a subset of other.",
"name": "__lt__",
"signature": "def __lt__(self, other)"
},
{
"docstring": "Return a new set that is the union of two existing sets.",
"name": "__or__",
"signature": "def __or__(self, other)"
}
] | 2 | stack_v2_sparse_classes_30k_train_015237 | Implement the Python class `Set` described below.
Class description:
Implement the Set class.
Method signatures and docstrings:
- def __lt__(self, other): Return True if this set is a subset of other.
- def __or__(self, other): Return a new set that is the union of two existing sets. | Implement the Python class `Set` described below.
Class description:
Implement the Set class.
Method signatures and docstrings:
- def __lt__(self, other): Return True if this set is a subset of other.
- def __or__(self, other): Return a new set that is the union of two existing sets.
<|skeleton|>
class Set:
def... | 1e9ed8a5e95f6b1735516461a0aa15ceb78608f2 | <|skeleton|>
class Set:
def __lt__(self, other):
"""Return True if this set is a subset of other."""
<|body_0|>
def __or__(self, other):
"""Return a new set that is the union of two existing sets."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Set:
def __lt__(self, other):
"""Return True if this set is a subset of other."""
if len(self) >= len(other):
return False
for e in other:
if e not in self:
return False
return True
def __or__(self, other):
"""Return a new se... | the_stack_v2_python_sparse | set_operations.py | ajitluhach/algorithms | train | 0 | |
99994b10ce19355f3621eb6aaf7f4948c9f51257 | [
"try:\n parser.add_argument('--max-complexity', default=10, type=int, help='Max complexity threshold')\nexcept ArgumentError:\n pass",
"params = ctx.get_params('mccabe')\noptions = ctx.options\nif options:\n params.setdefault('max-complexity', options.max_complexity)\nMcCabeChecker.max_complexity = int(p... | <|body_start_0|>
try:
parser.add_argument('--max-complexity', default=10, type=int, help='Max complexity threshold')
except ArgumentError:
pass
<|end_body_0|>
<|body_start_1|>
params = ctx.get_params('mccabe')
options = ctx.options
if options:
... | Run complexity checking. | Linter | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Linter:
"""Run complexity checking."""
def add_args(cls, parser: ArgumentParser):
"""Add --max-complexity option."""
<|body_0|>
def run_check(self, ctx: RunContext):
"""Run Mccabe code checker."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
try... | stack_v2_sparse_classes_75kplus_train_001072 | 1,355 | permissive | [
{
"docstring": "Add --max-complexity option.",
"name": "add_args",
"signature": "def add_args(cls, parser: ArgumentParser)"
},
{
"docstring": "Run Mccabe code checker.",
"name": "run_check",
"signature": "def run_check(self, ctx: RunContext)"
}
] | 2 | stack_v2_sparse_classes_30k_train_029526 | Implement the Python class `Linter` described below.
Class description:
Run complexity checking.
Method signatures and docstrings:
- def add_args(cls, parser: ArgumentParser): Add --max-complexity option.
- def run_check(self, ctx: RunContext): Run Mccabe code checker. | Implement the Python class `Linter` described below.
Class description:
Run complexity checking.
Method signatures and docstrings:
- def add_args(cls, parser: ArgumentParser): Add --max-complexity option.
- def run_check(self, ctx: RunContext): Run Mccabe code checker.
<|skeleton|>
class Linter:
"""Run complexit... | 53ad214de0aa9534e59bcd5f97d9d723d16cfdb8 | <|skeleton|>
class Linter:
"""Run complexity checking."""
def add_args(cls, parser: ArgumentParser):
"""Add --max-complexity option."""
<|body_0|>
def run_check(self, ctx: RunContext):
"""Run Mccabe code checker."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Linter:
"""Run complexity checking."""
def add_args(cls, parser: ArgumentParser):
"""Add --max-complexity option."""
try:
parser.add_argument('--max-complexity', default=10, type=int, help='Max complexity threshold')
except ArgumentError:
pass
def run_... | the_stack_v2_python_sparse | pylama/lint/pylama_mccabe.py | klen/pylama | train | 1,022 |
2904747960a0ee16dbd6271054ddbcfee599a5cd | [
"self.driver = driver\nself.comp_name = comp_name\nself.element = self.get_component()",
"try:\n self.element.find_element_by_css_selector('div.field-title')\n return True\nexcept Exception as ex:\n print('流程催办历史控件获取控件title异常:%s' % ex)\n return False",
"try:\n return self.element.find_element_by_... | <|body_start_0|>
self.driver = driver
self.comp_name = comp_name
self.element = self.get_component()
<|end_body_0|>
<|body_start_1|>
try:
self.element.find_element_by_css_selector('div.field-title')
return True
except Exception as ex:
print('流... | 流程催办历史控件 | FlowRemindHistoryPage | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FlowRemindHistoryPage:
"""流程催办历史控件"""
def __init__(self, driver, comp_name):
"""类初始化执行"""
<|body_0|>
def check_title(self):
"""获取控件title是否存在"""
<|body_1|>
def get_table_head_first_td_text(self):
"""获取控件table head里第一个td的text值"""
<|body... | stack_v2_sparse_classes_75kplus_train_001073 | 3,071 | no_license | [
{
"docstring": "类初始化执行",
"name": "__init__",
"signature": "def __init__(self, driver, comp_name)"
},
{
"docstring": "获取控件title是否存在",
"name": "check_title",
"signature": "def check_title(self)"
},
{
"docstring": "获取控件table head里第一个td的text值",
"name": "get_table_head_first_td_te... | 5 | null | Implement the Python class `FlowRemindHistoryPage` described below.
Class description:
流程催办历史控件
Method signatures and docstrings:
- def __init__(self, driver, comp_name): 类初始化执行
- def check_title(self): 获取控件title是否存在
- def get_table_head_first_td_text(self): 获取控件table head里第一个td的text值
- def get_table_tbody_first_td_t... | Implement the Python class `FlowRemindHistoryPage` described below.
Class description:
流程催办历史控件
Method signatures and docstrings:
- def __init__(self, driver, comp_name): 类初始化执行
- def check_title(self): 获取控件title是否存在
- def get_table_head_first_td_text(self): 获取控件table head里第一个td的text值
- def get_table_tbody_first_td_t... | 78768989a79a14013b983024cf6e4838d51ed595 | <|skeleton|>
class FlowRemindHistoryPage:
"""流程催办历史控件"""
def __init__(self, driver, comp_name):
"""类初始化执行"""
<|body_0|>
def check_title(self):
"""获取控件title是否存在"""
<|body_1|>
def get_table_head_first_td_text(self):
"""获取控件table head里第一个td的text值"""
<|body... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FlowRemindHistoryPage:
"""流程催办历史控件"""
def __init__(self, driver, comp_name):
"""类初始化执行"""
self.driver = driver
self.comp_name = comp_name
self.element = self.get_component()
def check_title(self):
"""获取控件title是否存在"""
try:
self.element.find_... | the_stack_v2_python_sparse | test_case/page_obj/form/flow_remind_history_page.py | pylk/pythonSelenium | train | 0 |
b1caf9569175fdab2b1fb78317c8efa1a91f47d6 | [
"self.materials = materials\nself.robocrys = robocrys\nself.condenser = StructureCondenser()\nself.describer = StructureDescriber(describe_symmetry_labels=False)\nsuper().__init__(source=materials, target=robocrys, ufn=self.calc, projection=['structure'], **kwargs)",
"self.logger.debug('Running robocrys on {}'.fo... | <|body_start_0|>
self.materials = materials
self.robocrys = robocrys
self.condenser = StructureCondenser()
self.describer = StructureDescriber(describe_symmetry_labels=False)
super().__init__(source=materials, target=robocrys, ufn=self.calc, projection=['structure'], **kwargs)
<|... | RobocrysBuilder | [
"LicenseRef-scancode-hdf5",
"LicenseRef-scancode-generic-cla",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RobocrysBuilder:
def __init__(self, materials, robocrys, **kwargs):
"""Runs robocrystallographer to get the condensed structure and structure description. Args: materials (Store): Store of materials documents. robocrys (Store): Store of condensed structure and text structure description.... | stack_v2_sparse_classes_75kplus_train_001074 | 4,599 | permissive | [
{
"docstring": "Runs robocrystallographer to get the condensed structure and structure description. Args: materials (Store): Store of materials documents. robocrys (Store): Store of condensed structure and text structure description. **kwargs: Keyword arguments that will get passed to the builder super method."... | 2 | null | Implement the Python class `RobocrysBuilder` described below.
Class description:
Implement the RobocrysBuilder class.
Method signatures and docstrings:
- def __init__(self, materials, robocrys, **kwargs): Runs robocrystallographer to get the condensed structure and structure description. Args: materials (Store): Stor... | Implement the Python class `RobocrysBuilder` described below.
Class description:
Implement the RobocrysBuilder class.
Method signatures and docstrings:
- def __init__(self, materials, robocrys, **kwargs): Runs robocrystallographer to get the condensed structure and structure description. Args: materials (Store): Stor... | 2540fd8f6905be7290ead1b8a9dadca84d5d03fa | <|skeleton|>
class RobocrysBuilder:
def __init__(self, materials, robocrys, **kwargs):
"""Runs robocrystallographer to get the condensed structure and structure description. Args: materials (Store): Store of materials documents. robocrys (Store): Store of condensed structure and text structure description.... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RobocrysBuilder:
def __init__(self, materials, robocrys, **kwargs):
"""Runs robocrystallographer to get the condensed structure and structure description. Args: materials (Store): Store of materials documents. robocrys (Store): Store of condensed structure and text structure description. **kwargs: Key... | the_stack_v2_python_sparse | emmet/materials/robocrys.py | jerrymlin/emmet | train | 2 | |
d52725004c81e07c897824281529fb6dc8978fd4 | [
"self.model = model\nself.data = data\nself.qgrid_sz = self.model.qgrid_size\nself.dn = self.model.dn\nself._gfa = None\nself.npeaks = 5\nself._peak_values = None\nself._peak_indices = None",
"values = self.data * self.model.filter\nSq = np.zeros((self.qgrid_sz, self.qgrid_sz, self.qgrid_sz))\nfor i in range(len(... | <|body_start_0|>
self.model = model
self.data = data
self.qgrid_sz = self.model.qgrid_size
self.dn = self.model.dn
self._gfa = None
self.npeaks = 5
self._peak_values = None
self._peak_indices = None
<|end_body_0|>
<|body_start_1|>
values = self.da... | DiffusionSpectrumFit | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DiffusionSpectrumFit:
def __init__(self, model, data):
"""Calculates PDF and ODF and other properties for a single voxel Parameters ---------- model : object, DiffusionSpectrumModel data : 1d ndarray, signal values"""
<|body_0|>
def pdf(self, normalized=True):
"""App... | stack_v2_sparse_classes_75kplus_train_001075 | 21,859 | permissive | [
{
"docstring": "Calculates PDF and ODF and other properties for a single voxel Parameters ---------- model : object, DiffusionSpectrumModel data : 1d ndarray, signal values",
"name": "__init__",
"signature": "def __init__(self, model, data)"
},
{
"docstring": "Applies the 3D FFT in the q-space g... | 6 | stack_v2_sparse_classes_30k_train_013958 | Implement the Python class `DiffusionSpectrumFit` described below.
Class description:
Implement the DiffusionSpectrumFit class.
Method signatures and docstrings:
- def __init__(self, model, data): Calculates PDF and ODF and other properties for a single voxel Parameters ---------- model : object, DiffusionSpectrumMod... | Implement the Python class `DiffusionSpectrumFit` described below.
Class description:
Implement the DiffusionSpectrumFit class.
Method signatures and docstrings:
- def __init__(self, model, data): Calculates PDF and ODF and other properties for a single voxel Parameters ---------- model : object, DiffusionSpectrumMod... | 3c3acc55de8ba741e673063378e6cbaf10b64c7a | <|skeleton|>
class DiffusionSpectrumFit:
def __init__(self, model, data):
"""Calculates PDF and ODF and other properties for a single voxel Parameters ---------- model : object, DiffusionSpectrumModel data : 1d ndarray, signal values"""
<|body_0|>
def pdf(self, normalized=True):
"""App... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DiffusionSpectrumFit:
def __init__(self, model, data):
"""Calculates PDF and ODF and other properties for a single voxel Parameters ---------- model : object, DiffusionSpectrumModel data : 1d ndarray, signal values"""
self.model = model
self.data = data
self.qgrid_sz = self.mod... | the_stack_v2_python_sparse | env/lib/python3.6/site-packages/dipy/reconst/dsi.py | Raniac/NEURO-LEARN | train | 9 | |
5c1e7f3037ccc0dc58862c5580b6c1c2e567f5c1 | [
"super(pip, self).__init__(**kwargs)\nself.__alternatives = kwargs.get('alternatives', False)\nself.__args = kwargs.get('args', ['--no-cache-dir'])\nself.__epel = False\nself.__ospackages = kwargs.get('ospackages', None)\nself.__packages = kwargs.get('packages', [])\nself.__pip = kwargs.get('pip', 'pip')\nself.__re... | <|body_start_0|>
super(pip, self).__init__(**kwargs)
self.__alternatives = kwargs.get('alternatives', False)
self.__args = kwargs.get('args', ['--no-cache-dir'])
self.__epel = False
self.__ospackages = kwargs.get('ospackages', None)
self.__packages = kwargs.get('packages'... | The `pip` building block installs Python packages from PyPi. # Parameters alternatives: Boolean flag to specify whether to configure alternatives for `python` and `pip`. RHEL-based 8.x distributions do not setup `python` by [default](https://developers.redhat.com/blog/2019/05/07/what-no-python-in-red-hat-enterprise-lin... | pip | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class pip:
"""The `pip` building block installs Python packages from PyPi. # Parameters alternatives: Boolean flag to specify whether to configure alternatives for `python` and `pip`. RHEL-based 8.x distributions do not setup `python` by [default](https://developers.redhat.com/blog/2019/05/07/what-no-p... | stack_v2_sparse_classes_75kplus_train_001076 | 6,551 | permissive | [
{
"docstring": "Initialize building block",
"name": "__init__",
"signature": "def __init__(self, **kwargs)"
},
{
"docstring": "Fill in container instructions",
"name": "__instructions",
"signature": "def __instructions(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_009419 | Implement the Python class `pip` described below.
Class description:
The `pip` building block installs Python packages from PyPi. # Parameters alternatives: Boolean flag to specify whether to configure alternatives for `python` and `pip`. RHEL-based 8.x distributions do not setup `python` by [default](https://develope... | Implement the Python class `pip` described below.
Class description:
The `pip` building block installs Python packages from PyPi. # Parameters alternatives: Boolean flag to specify whether to configure alternatives for `python` and `pip`. RHEL-based 8.x distributions do not setup `python` by [default](https://develope... | 60fd2a51c171258a6b3f93c2523101cb7018ba1b | <|skeleton|>
class pip:
"""The `pip` building block installs Python packages from PyPi. # Parameters alternatives: Boolean flag to specify whether to configure alternatives for `python` and `pip`. RHEL-based 8.x distributions do not setup `python` by [default](https://developers.redhat.com/blog/2019/05/07/what-no-p... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class pip:
"""The `pip` building block installs Python packages from PyPi. # Parameters alternatives: Boolean flag to specify whether to configure alternatives for `python` and `pip`. RHEL-based 8.x distributions do not setup `python` by [default](https://developers.redhat.com/blog/2019/05/07/what-no-python-in-red-... | the_stack_v2_python_sparse | hpccm/building_blocks/pip.py | NVIDIA/hpc-container-maker | train | 419 |
fd7d45849aec7fe660ba60b07c97d468b06f671c | [
"gr = FakeGraph()\ngr.add_edus(1, 2, 3)\ngr.add_rel('a', 1, 2)\ngr.add_cdu('X', [1, 2])\nmembers = gr.cdu_members('X')\nexpected = frozenset(['1', '2'])\nself.assertEqual(expected, members)",
"gr = FakeGraph()\ngr.add_edus('a1', 'a2', 'b')\ngr.add_cdu('A', ['a1', 'a2'])\nns1 = frozenset(gr.neighbors('a1'))\nexpec... | <|body_start_0|>
gr = FakeGraph()
gr.add_edus(1, 2, 3)
gr.add_rel('a', 1, 2)
gr.add_cdu('X', [1, 2])
members = gr.cdu_members('X')
expected = frozenset(['1', '2'])
self.assertEqual(expected, members)
<|end_body_0|>
<|body_start_1|>
gr = FakeGraph()
... | BasicGraphTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BasicGraphTest:
def test_cdu_members_trivial(self):
"""trivial CDU membership"""
<|body_0|>
def test_cdu_neighbors(self):
"""does belong in the same CDU make you a neighbour?"""
<|body_1|>
def test_copy(self):
"""graph in essentially two componen... | stack_v2_sparse_classes_75kplus_train_001077 | 11,843 | no_license | [
{
"docstring": "trivial CDU membership",
"name": "test_cdu_members_trivial",
"signature": "def test_cdu_members_trivial(self)"
},
{
"docstring": "does belong in the same CDU make you a neighbour?",
"name": "test_cdu_neighbors",
"signature": "def test_cdu_neighbors(self)"
},
{
"do... | 3 | stack_v2_sparse_classes_30k_train_053015 | Implement the Python class `BasicGraphTest` described below.
Class description:
Implement the BasicGraphTest class.
Method signatures and docstrings:
- def test_cdu_members_trivial(self): trivial CDU membership
- def test_cdu_neighbors(self): does belong in the same CDU make you a neighbour?
- def test_copy(self): gr... | Implement the Python class `BasicGraphTest` described below.
Class description:
Implement the BasicGraphTest class.
Method signatures and docstrings:
- def test_cdu_members_trivial(self): trivial CDU membership
- def test_cdu_neighbors(self): does belong in the same CDU make you a neighbour?
- def test_copy(self): gr... | c550f4383016e05fe20ad7180a027979e3540d1f | <|skeleton|>
class BasicGraphTest:
def test_cdu_members_trivial(self):
"""trivial CDU membership"""
<|body_0|>
def test_cdu_neighbors(self):
"""does belong in the same CDU make you a neighbour?"""
<|body_1|>
def test_copy(self):
"""graph in essentially two componen... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BasicGraphTest:
def test_cdu_members_trivial(self):
"""trivial CDU membership"""
gr = FakeGraph()
gr.add_edus(1, 2, 3)
gr.add_rel('a', 1, 2)
gr.add_cdu('X', [1, 2])
members = gr.cdu_members('X')
expected = frozenset(['1', '2'])
self.assertEqual(e... | the_stack_v2_python_sparse | educe/tests.py | kowey/educe | train | 1 | |
81ced1b0db5c3c2bef0869a46ada2a260d27e6e9 | [
"self.request.data['content_type'] = kwargs['content_type'].pk\nself.request.data['object_id'] = str(kwargs['pk'])\nself.request.data['author'] = self.request.user.pk\nreturn super().create(self.request, *args, **kwargs)",
"queryset = self.queryset.filter(content_type=kwargs['content_type']).filter(object_id=kwar... | <|body_start_0|>
self.request.data['content_type'] = kwargs['content_type'].pk
self.request.data['object_id'] = str(kwargs['pk'])
self.request.data['author'] = self.request.user.pk
return super().create(self.request, *args, **kwargs)
<|end_body_0|>
<|body_start_1|>
queryset = se... | CommentViewSet | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CommentViewSet:
def create(self, request, *args, **kwargs):
"""Add content_type, object_id and author to the comment."""
<|body_0|>
def list(self, request, *args, **kwargs):
"""list as in DRF but filter the queryset with kwargs. this is why we (have to) overwrite the... | stack_v2_sparse_classes_75kplus_train_001078 | 1,262 | permissive | [
{
"docstring": "Add content_type, object_id and author to the comment.",
"name": "create",
"signature": "def create(self, request, *args, **kwargs)"
},
{
"docstring": "list as in DRF but filter the queryset with kwargs. this is why we (have to) overwrite the whole thing.",
"name": "list",
... | 2 | stack_v2_sparse_classes_30k_test_001544 | Implement the Python class `CommentViewSet` described below.
Class description:
Implement the CommentViewSet class.
Method signatures and docstrings:
- def create(self, request, *args, **kwargs): Add content_type, object_id and author to the comment.
- def list(self, request, *args, **kwargs): list as in DRF but filt... | Implement the Python class `CommentViewSet` described below.
Class description:
Implement the CommentViewSet class.
Method signatures and docstrings:
- def create(self, request, *args, **kwargs): Add content_type, object_id and author to the comment.
- def list(self, request, *args, **kwargs): list as in DRF but filt... | 5b5529b307643f37fc34bdda412e2b90c3d444e1 | <|skeleton|>
class CommentViewSet:
def create(self, request, *args, **kwargs):
"""Add content_type, object_id and author to the comment."""
<|body_0|>
def list(self, request, *args, **kwargs):
"""list as in DRF but filter the queryset with kwargs. this is why we (have to) overwrite the... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CommentViewSet:
def create(self, request, *args, **kwargs):
"""Add content_type, object_id and author to the comment."""
self.request.data['content_type'] = kwargs['content_type'].pk
self.request.data['object_id'] = str(kwargs['pk'])
self.request.data['author'] = self.request.u... | the_stack_v2_python_sparse | server/apps/comments/views.py | ojengwa/base | train | 11 | |
96e7a3727af3de16264909d787d43a76aacf64ff | [
"assert isinstance(path_of_file, str)\ndf = pd.read_csv(path_of_file, header=header)\nif index != 'default':\n df = df.set_index(index)\nif fillnan != 'no_fill':\n df = df.fillna(fillnan)\nreturn df",
"assert isinstance(path_of_file, str)\nassert isinstance(sh_name, str)\nassert isinstance(header, int)\nass... | <|body_start_0|>
assert isinstance(path_of_file, str)
df = pd.read_csv(path_of_file, header=header)
if index != 'default':
df = df.set_index(index)
if fillnan != 'no_fill':
df = df.fillna(fillnan)
return df
<|end_body_0|>
<|body_start_1|>
assert i... | DataHandler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataHandler:
def gather_data_from_csv(path_of_file, index='default', header=0, fillnan='no_fill'):
"""This function is used to gather data from a file that has an extension of "csv". :path_of_file: string; is the path of the csv file that needs to be loaded into a dataframe :index: strin... | stack_v2_sparse_classes_75kplus_train_001079 | 2,789 | no_license | [
{
"docstring": "This function is used to gather data from a file that has an extension of \"csv\". :path_of_file: string; is the path of the csv file that needs to be loaded into a dataframe :index: string; gives the name of column that needs to be set as the index; 'default' implies no specific column to be se... | 3 | stack_v2_sparse_classes_30k_train_033156 | Implement the Python class `DataHandler` described below.
Class description:
Implement the DataHandler class.
Method signatures and docstrings:
- def gather_data_from_csv(path_of_file, index='default', header=0, fillnan='no_fill'): This function is used to gather data from a file that has an extension of "csv". :path... | Implement the Python class `DataHandler` described below.
Class description:
Implement the DataHandler class.
Method signatures and docstrings:
- def gather_data_from_csv(path_of_file, index='default', header=0, fillnan='no_fill'): This function is used to gather data from a file that has an extension of "csv". :path... | 5f6f27e7195cb7398f4f90e19bcc26b0d4f324ef | <|skeleton|>
class DataHandler:
def gather_data_from_csv(path_of_file, index='default', header=0, fillnan='no_fill'):
"""This function is used to gather data from a file that has an extension of "csv". :path_of_file: string; is the path of the csv file that needs to be loaded into a dataframe :index: strin... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DataHandler:
def gather_data_from_csv(path_of_file, index='default', header=0, fillnan='no_fill'):
"""This function is used to gather data from a file that has an extension of "csv". :path_of_file: string; is the path of the csv file that needs to be loaded into a dataframe :index: string; gives the n... | the_stack_v2_python_sparse | Code/class_gather_data.py | ShreyaNayak7/ECE143_FinalProject | train | 0 | |
41c90b097d5e3d50c2e8234ba740ef99038953b2 | [
"self.driver = driver\nself.comp_name = comp_name\nself.element = self.get_component()",
"self.hide_activity_box()\nself.element.click()\nreturn self.find_elems('select[name=\"' + self.comp_name + '\"] option')",
"self.hide_activity_box()\ndeptlist = self.get_department_list()\nif deptlist:\n deptlist[num].c... | <|body_start_0|>
self.driver = driver
self.comp_name = comp_name
self.element = self.get_component()
<|end_body_0|>
<|body_start_1|>
self.hide_activity_box()
self.element.click()
return self.find_elems('select[name="' + self.comp_name + '"] option')
<|end_body_1|>
<|bod... | 部门选择框控件 | DepartmentPage | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DepartmentPage:
"""部门选择框控件"""
def __init__(self, driver, comp_name):
"""类初始化执行"""
<|body_0|>
def get_department_list(self):
"""获取部门选择框的选项"""
<|body_1|>
def select_department_num(self, num):
"""获取某个部门的选择值"""
<|body_2|>
def get_dep... | stack_v2_sparse_classes_75kplus_train_001080 | 2,660 | no_license | [
{
"docstring": "类初始化执行",
"name": "__init__",
"signature": "def __init__(self, driver, comp_name)"
},
{
"docstring": "获取部门选择框的选项",
"name": "get_department_list",
"signature": "def get_department_list(self)"
},
{
"docstring": "获取某个部门的选择值",
"name": "select_department_num",
"... | 5 | stack_v2_sparse_classes_30k_test_001642 | Implement the Python class `DepartmentPage` described below.
Class description:
部门选择框控件
Method signatures and docstrings:
- def __init__(self, driver, comp_name): 类初始化执行
- def get_department_list(self): 获取部门选择框的选项
- def select_department_num(self, num): 获取某个部门的选择值
- def get_department_list_name(self): 获取部门选择框的选项
- de... | Implement the Python class `DepartmentPage` described below.
Class description:
部门选择框控件
Method signatures and docstrings:
- def __init__(self, driver, comp_name): 类初始化执行
- def get_department_list(self): 获取部门选择框的选项
- def select_department_num(self, num): 获取某个部门的选择值
- def get_department_list_name(self): 获取部门选择框的选项
- de... | 78768989a79a14013b983024cf6e4838d51ed595 | <|skeleton|>
class DepartmentPage:
"""部门选择框控件"""
def __init__(self, driver, comp_name):
"""类初始化执行"""
<|body_0|>
def get_department_list(self):
"""获取部门选择框的选项"""
<|body_1|>
def select_department_num(self, num):
"""获取某个部门的选择值"""
<|body_2|>
def get_dep... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DepartmentPage:
"""部门选择框控件"""
def __init__(self, driver, comp_name):
"""类初始化执行"""
self.driver = driver
self.comp_name = comp_name
self.element = self.get_component()
def get_department_list(self):
"""获取部门选择框的选项"""
self.hide_activity_box()
self.... | the_stack_v2_python_sparse | test_case/page_obj/form/department_page.py | pylk/pythonSelenium | train | 0 |
38d927479820cc7eaf0e716e535388d63e1b8785 | [
"self.k = k\nself.nums = nums\nself.size = len(nums)\nheapq.heapify(self.nums)\nwhile len(nums) > self.k:\n heapq.heappop(self.nums)\n self.size -= 1",
"if self.size < self.k:\n heapq.heappush(self.nums, val)\n self.size += 1\nelif self.nums[0] < val:\n heapq.heapreplace(self.nums, val)\nreturn sel... | <|body_start_0|>
self.k = k
self.nums = nums
self.size = len(nums)
heapq.heapify(self.nums)
while len(nums) > self.k:
heapq.heappop(self.nums)
self.size -= 1
<|end_body_0|>
<|body_start_1|>
if self.size < self.k:
heapq.heappush(self.nu... | KthLargest | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
<|body_0|>
def add(self, val):
""":type val: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.k = k
self.nums = nums
self.size = le... | stack_v2_sparse_classes_75kplus_train_001081 | 882 | permissive | [
{
"docstring": ":type k: int :type nums: List[int]",
"name": "__init__",
"signature": "def __init__(self, k, nums)"
},
{
"docstring": ":type val: int :rtype: int",
"name": "add",
"signature": "def add(self, val)"
}
] | 2 | stack_v2_sparse_classes_30k_train_040278 | Implement the Python class `KthLargest` described below.
Class description:
Implement the KthLargest class.
Method signatures and docstrings:
- def __init__(self, k, nums): :type k: int :type nums: List[int]
- def add(self, val): :type val: int :rtype: int | Implement the Python class `KthLargest` described below.
Class description:
Implement the KthLargest class.
Method signatures and docstrings:
- def __init__(self, k, nums): :type k: int :type nums: List[int]
- def add(self, val): :type val: int :rtype: int
<|skeleton|>
class KthLargest:
def __init__(self, k, nu... | 1d5635f1fac200d4d289c5c7960b4e10d6fe7705 | <|skeleton|>
class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
<|body_0|>
def add(self, val):
""":type val: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
self.k = k
self.nums = nums
self.size = len(nums)
heapq.heapify(self.nums)
while len(nums) > self.k:
heapq.heappop(self.nums)
self.size -= 1
def add(se... | the_stack_v2_python_sparse | 703. Kth Largest Element in a Stream/703v2.py | xyzrlee/LeetCode | train | 0 | |
e41ca4c1e9ace0f1c28209b209b31a61a90656be | [
"parameters = json_parameters()\nbytes_param = param_get(parameters, 'bytes')\ntry:\n set_local_account_limit(account=account, rse=rse, bytes_=bytes_param, issuer=request.environ.get('issuer'), vo=request.environ.get('vo'))\nexcept AccessDenied as error:\n return generate_http_error_flask(401, error)\nexcept ... | <|body_start_0|>
parameters = json_parameters()
bytes_param = param_get(parameters, 'bytes')
try:
set_local_account_limit(account=account, rse=rse, bytes_=bytes_param, issuer=request.environ.get('issuer'), vo=request.environ.get('vo'))
except AccessDenied as error:
... | LocalAccountLimit | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LocalAccountLimit:
def post(self, account, rse):
"""Create or update an account limit. .. :quickref: LocalAccountLimit; Create/update local account limits. :param account: Account name. :param rse: RSE name. :status 201: Successfully created or updated. :status 401: Invalid auth token. :... | stack_v2_sparse_classes_75kplus_train_001082 | 6,053 | permissive | [
{
"docstring": "Create or update an account limit. .. :quickref: LocalAccountLimit; Create/update local account limits. :param account: Account name. :param rse: RSE name. :status 201: Successfully created or updated. :status 401: Invalid auth token. :status 404: RSE not found. :status 404: Account not found",
... | 2 | stack_v2_sparse_classes_30k_val_002131 | Implement the Python class `LocalAccountLimit` described below.
Class description:
Implement the LocalAccountLimit class.
Method signatures and docstrings:
- def post(self, account, rse): Create or update an account limit. .. :quickref: LocalAccountLimit; Create/update local account limits. :param account: Account na... | Implement the Python class `LocalAccountLimit` described below.
Class description:
Implement the LocalAccountLimit class.
Method signatures and docstrings:
- def post(self, account, rse): Create or update an account limit. .. :quickref: LocalAccountLimit; Create/update local account limits. :param account: Account na... | f2a2ffe00b0d99a5973390c5476167821b6d821e | <|skeleton|>
class LocalAccountLimit:
def post(self, account, rse):
"""Create or update an account limit. .. :quickref: LocalAccountLimit; Create/update local account limits. :param account: Account name. :param rse: RSE name. :status 201: Successfully created or updated. :status 401: Invalid auth token. :... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LocalAccountLimit:
def post(self, account, rse):
"""Create or update an account limit. .. :quickref: LocalAccountLimit; Create/update local account limits. :param account: Account name. :param rse: RSE name. :status 201: Successfully created or updated. :status 401: Invalid auth token. :status 404: RS... | the_stack_v2_python_sparse | lib/rucio/web/rest/flaskapi/v1/accountlimits.py | martynia/rucio | train | 0 | |
3dfc79de16b0f3694142bda4657dff716ae1ecb1 | [
"if category == Category.Discovery and len(components) == 0:\n pass\nelif category == Category.Logs and len(components) == 0:\n log = factory.create(ComponentDescriptor(Category.Logs, None, 'null', None))\n log.configure(ComponentConfig())\n components.append(log)\nelif category == Category.Counters and... | <|body_start_0|>
if category == Category.Discovery and len(components) == 0:
pass
elif category == Category.Logs and len(components) == 0:
log = factory.create(ComponentDescriptor(Category.Logs, None, 'null', None))
log.configure(ComponentConfig())
compone... | Builds microservice components using configuration as a build recipe. | Builder | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Builder:
"""Builds microservice components using configuration as a build recipe."""
def _build_section_defaults(factory, category, components):
"""Builds default components for specified configuration section. Args: factory: ComponentFactory that creates component instances. categor... | stack_v2_sparse_classes_75kplus_train_001083 | 5,133 | permissive | [
{
"docstring": "Builds default components for specified configuration section. Args: factory: ComponentFactory that creates component instances. category: a name of the section inside configuration. components: IComponent list with section components Returns: IComponent list with section components for chaining... | 3 | stack_v2_sparse_classes_30k_train_047421 | Implement the Python class `Builder` described below.
Class description:
Builds microservice components using configuration as a build recipe.
Method signatures and docstrings:
- def _build_section_defaults(factory, category, components): Builds default components for specified configuration section. Args: factory: C... | Implement the Python class `Builder` described below.
Class description:
Builds microservice components using configuration as a build recipe.
Method signatures and docstrings:
- def _build_section_defaults(factory, category, components): Builds default components for specified configuration section. Args: factory: C... | 70eca1ffc44bfdc45c9c65b0ee347fa578368849 | <|skeleton|>
class Builder:
"""Builds microservice components using configuration as a build recipe."""
def _build_section_defaults(factory, category, components):
"""Builds default components for specified configuration section. Args: factory: ComponentFactory that creates component instances. categor... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Builder:
"""Builds microservice components using configuration as a build recipe."""
def _build_section_defaults(factory, category, components):
"""Builds default components for specified configuration section. Args: factory: ComponentFactory that creates component instances. category: a name of ... | the_stack_v2_python_sparse | pip_services_runtime/build/Builder.py | pip-services-archive/pip-services-runtime-python | train | 0 |
46e1975029254cb0276015e345579a248b0496f8 | [
"self.validate_parameters(request_id=request_id)\n_query_builder = Configuration.get_base_uri()\n_query_builder += '/identification/log/requestId/{requestId}'\n_query_builder = APIHelper.append_url_with_template_parameters(_query_builder, {'requestId': request_id})\n_query_url = APIHelper.clean_url(_query_builder)\... | <|body_start_0|>
self.validate_parameters(request_id=request_id)
_query_builder = Configuration.get_base_uri()
_query_builder += '/identification/log/requestId/{requestId}'
_query_builder = APIHelper.append_url_with_template_parameters(_query_builder, {'requestId': request_id})
_... | A Controller to access Endpoints in the idfy_rest_client API. | LogController | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LogController:
"""A Controller to access Endpoints in the idfy_rest_client API."""
def retrieve_a_log_entry(self, request_id):
"""Does a GET request to /identification/log/requestId/{requestId}. Gets an historic identification session (older than 14 days) Args: request_id (string): A... | stack_v2_sparse_classes_75kplus_train_001084 | 5,865 | permissive | [
{
"docstring": "Does a GET request to /identification/log/requestId/{requestId}. Gets an historic identification session (older than 14 days) Args: request_id (string): A request object Returns: IdentificationLogItem: Response from the API. OK Raises: APIException: When an error occurs while fetching the data f... | 2 | stack_v2_sparse_classes_30k_val_002477 | Implement the Python class `LogController` described below.
Class description:
A Controller to access Endpoints in the idfy_rest_client API.
Method signatures and docstrings:
- def retrieve_a_log_entry(self, request_id): Does a GET request to /identification/log/requestId/{requestId}. Gets an historic identification ... | Implement the Python class `LogController` described below.
Class description:
A Controller to access Endpoints in the idfy_rest_client API.
Method signatures and docstrings:
- def retrieve_a_log_entry(self, request_id): Does a GET request to /identification/log/requestId/{requestId}. Gets an historic identification ... | fa3918a6c54ea0eedb9146578645b7eb1755b642 | <|skeleton|>
class LogController:
"""A Controller to access Endpoints in the idfy_rest_client API."""
def retrieve_a_log_entry(self, request_id):
"""Does a GET request to /identification/log/requestId/{requestId}. Gets an historic identification session (older than 14 days) Args: request_id (string): A... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LogController:
"""A Controller to access Endpoints in the idfy_rest_client API."""
def retrieve_a_log_entry(self, request_id):
"""Does a GET request to /identification/log/requestId/{requestId}. Gets an historic identification session (older than 14 days) Args: request_id (string): A request obje... | the_stack_v2_python_sparse | idfy_rest_client/controllers/log_controller.py | dealflowteam/Idfy | train | 0 |
548afeb111dd06882184d21a0a5fcdbf416e5825 | [
"if not nums or len(nums) == 1:\n return 0\nif nums[0] + 1 >= len(nums):\n return 1\nmemo = [float('inf') for _ in range(len(nums))]\nmemo[0] = 0\nm = 1\nfor i, n in enumerate(nums):\n for j in range(m, min(len(nums), i + n + 1)):\n memo[j] = min(memo[j], memo[i] + 1)\n m = max(m, i + n)\nreturn ... | <|body_start_0|>
if not nums or len(nums) == 1:
return 0
if nums[0] + 1 >= len(nums):
return 1
memo = [float('inf') for _ in range(len(nums))]
memo[0] = 0
m = 1
for i, n in enumerate(nums):
for j in range(m, min(len(nums), i + n + 1)):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def jump(self, nums):
"""08/07/2018 06:05"""
<|body_0|>
def jump(self, nums):
"""08/10/2018 18:13"""
<|body_1|>
def jump(self, nums: List[int]) -> int:
"""DP Time complexity: O(n*m) Space complexity: O(n)"""
<|body_2|>
def ... | stack_v2_sparse_classes_75kplus_train_001085 | 4,016 | no_license | [
{
"docstring": "08/07/2018 06:05",
"name": "jump",
"signature": "def jump(self, nums)"
},
{
"docstring": "08/10/2018 18:13",
"name": "jump",
"signature": "def jump(self, nums)"
},
{
"docstring": "DP Time complexity: O(n*m) Space complexity: O(n)",
"name": "jump",
"signatu... | 6 | stack_v2_sparse_classes_30k_train_033090 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def jump(self, nums): 08/07/2018 06:05
- def jump(self, nums): 08/10/2018 18:13
- def jump(self, nums: List[int]) -> int: DP Time complexity: O(n*m) Space complexity: O(n)
- def ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def jump(self, nums): 08/07/2018 06:05
- def jump(self, nums): 08/10/2018 18:13
- def jump(self, nums: List[int]) -> int: DP Time complexity: O(n*m) Space complexity: O(n)
- def ... | 1389a009a02e90e8700a7a00e0b7f797c129cdf4 | <|skeleton|>
class Solution:
def jump(self, nums):
"""08/07/2018 06:05"""
<|body_0|>
def jump(self, nums):
"""08/10/2018 18:13"""
<|body_1|>
def jump(self, nums: List[int]) -> int:
"""DP Time complexity: O(n*m) Space complexity: O(n)"""
<|body_2|>
def ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def jump(self, nums):
"""08/07/2018 06:05"""
if not nums or len(nums) == 1:
return 0
if nums[0] + 1 >= len(nums):
return 1
memo = [float('inf') for _ in range(len(nums))]
memo[0] = 0
m = 1
for i, n in enumerate(nums):
... | the_stack_v2_python_sparse | leetcode/solved/45_Jump_Game_II/solution.py | sungminoh/algorithms | train | 0 | |
bf2fbfd2a89129fe663f35e010a692ca14bbcfba | [
"img = make_qrcode(data['url'])\ndata.setdefault('image', img)\nmodel = Treasure(**data)\ndb.session.add(model)\ndb.session.commit()\nreturn model.id",
"if 'id' in data and data['id']:\n model = Treasure.query.get(data['id'])\n return (1, model.to_dict())\nfilter = {}\nif 'name' in data and data['name'] and... | <|body_start_0|>
img = make_qrcode(data['url'])
data.setdefault('image', img)
model = Treasure(**data)
db.session.add(model)
db.session.commit()
return model.id
<|end_body_0|>
<|body_start_1|>
if 'id' in data and data['id']:
model = Treasure.query.get... | Service | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Service:
def create(self, data):
""":param data: :return:"""
<|body_0|>
def search(self, data):
""":param data: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
img = make_qrcode(data['url'])
data.setdefault('image', img)
mod... | stack_v2_sparse_classes_75kplus_train_001086 | 1,686 | no_license | [
{
"docstring": ":param data: :return:",
"name": "create",
"signature": "def create(self, data)"
},
{
"docstring": ":param data: :return:",
"name": "search",
"signature": "def search(self, data)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002431 | Implement the Python class `Service` described below.
Class description:
Implement the Service class.
Method signatures and docstrings:
- def create(self, data): :param data: :return:
- def search(self, data): :param data: :return: | Implement the Python class `Service` described below.
Class description:
Implement the Service class.
Method signatures and docstrings:
- def create(self, data): :param data: :return:
- def search(self, data): :param data: :return:
<|skeleton|>
class Service:
def create(self, data):
""":param data: :ret... | 95205a4636d76a6020570e5acac0f57912514bf4 | <|skeleton|>
class Service:
def create(self, data):
""":param data: :return:"""
<|body_0|>
def search(self, data):
""":param data: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Service:
def create(self, data):
""":param data: :return:"""
img = make_qrcode(data['url'])
data.setdefault('image', img)
model = Treasure(**data)
db.session.add(model)
db.session.commit()
return model.id
def search(self, data):
""":param da... | the_stack_v2_python_sparse | quality/app/treasure/service.py | beitou/flask-AntDesign | train | 1 | |
28cfe63e21c3b9c788d853e633271f2b80d35eea | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn AutomaticRepliesMailTips()",
"from .date_time_time_zone import DateTimeTimeZone\nfrom .locale_info import LocaleInfo\nfrom .date_time_time_zone import DateTimeTimeZone\nfrom .locale_info import LocaleInfo\nfields: Dict[str, Callable[[A... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return AutomaticRepliesMailTips()
<|end_body_0|>
<|body_start_1|>
from .date_time_time_zone import DateTimeTimeZone
from .locale_info import LocaleInfo
from .date_time_time_zone import ... | AutomaticRepliesMailTips | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AutomaticRepliesMailTips:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AutomaticRepliesMailTips:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and cre... | stack_v2_sparse_classes_75kplus_train_001087 | 3,738 | permissive | [
{
"docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: AutomaticRepliesMailTips",
"name": "create_from_discriminator_value",
"signature": "def create_from_discrimi... | 3 | stack_v2_sparse_classes_30k_train_033657 | Implement the Python class `AutomaticRepliesMailTips` described below.
Class description:
Implement the AutomaticRepliesMailTips class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AutomaticRepliesMailTips: Creates a new instance of the appropriate c... | Implement the Python class `AutomaticRepliesMailTips` described below.
Class description:
Implement the AutomaticRepliesMailTips class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AutomaticRepliesMailTips: Creates a new instance of the appropriate c... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class AutomaticRepliesMailTips:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AutomaticRepliesMailTips:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and cre... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AutomaticRepliesMailTips:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AutomaticRepliesMailTips:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object... | the_stack_v2_python_sparse | msgraph/generated/models/automatic_replies_mail_tips.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
e85e9f9f8890b0728d0f4ea677c3528ba5239040 | [
"super(ListOfListsAction, self).__init__(option_strings, dest, **kwargs)\nself.dtype = type\nif self.dtype is None:\n self.dtype = np.int32",
"decoded_list = []\nremoved1 = values.replace('[', '')\nremoved2 = removed1.replace(']', '')\nout_list = removed2.split(':')\nfor line in out_list:\n in_list = []\n ... | <|body_start_0|>
super(ListOfListsAction, self).__init__(option_strings, dest, **kwargs)
self.dtype = type
if self.dtype is None:
self.dtype = np.int32
<|end_body_0|>
<|body_start_1|>
decoded_list = []
removed1 = values.replace('[', '')
removed2 = removed1.re... | This class extends the argparse.Action class by instantiating an argparser that constructs a list-of-lists from an input (command-line option or argument) given as a string. | ListOfListsAction | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ListOfListsAction:
"""This class extends the argparse.Action class by instantiating an argparser that constructs a list-of-lists from an input (command-line option or argument) given as a string."""
def __init__(self, option_strings, dest, type, **kwargs):
"""Initialize a ListOfLists... | stack_v2_sparse_classes_75kplus_train_001088 | 28,110 | permissive | [
{
"docstring": "Initialize a ListOfListsAction object. If no type is specified, an integer is assumed by default as the type for the elements of the list-of-lists. Parameters ---------- option_strings : string String to parse dest : object Object to store the output (in this case the parsed list-of-lists). type... | 2 | stack_v2_sparse_classes_30k_train_022918 | Implement the Python class `ListOfListsAction` described below.
Class description:
This class extends the argparse.Action class by instantiating an argparser that constructs a list-of-lists from an input (command-line option or argument) given as a string.
Method signatures and docstrings:
- def __init__(self, option... | Implement the Python class `ListOfListsAction` described below.
Class description:
This class extends the argparse.Action class by instantiating an argparser that constructs a list-of-lists from an input (command-line option or argument) given as a string.
Method signatures and docstrings:
- def __init__(self, option... | f6a3da8818308c9edcd9fedbcf831dd5968efcdd | <|skeleton|>
class ListOfListsAction:
"""This class extends the argparse.Action class by instantiating an argparser that constructs a list-of-lists from an input (command-line option or argument) given as a string."""
def __init__(self, option_strings, dest, type, **kwargs):
"""Initialize a ListOfLists... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ListOfListsAction:
"""This class extends the argparse.Action class by instantiating an argparser that constructs a list-of-lists from an input (command-line option or argument) given as a string."""
def __init__(self, option_strings, dest, type, **kwargs):
"""Initialize a ListOfListsAction object... | the_stack_v2_python_sparse | common/parsing_utils.py | ECP-CANDLE/Benchmarks | train | 65 |
7d215195fdc57076e764c358d7356a30f7420a88 | [
"choice = Object.strip_and_lower(choice)\nval = None\ntry:\n if Object.is_dict(options):\n val = min([key for key, val in options.items() if choice in Object.strip_and_lower(key)])\n elif Object.is_list(options):\n val = min([val for val in options if choice in Object.strip_and_lower(val)])\n ... | <|body_start_0|>
choice = Object.strip_and_lower(choice)
val = None
try:
if Object.is_dict(options):
val = min([key for key, val in options.items() if choice in Object.strip_and_lower(key)])
elif Object.is_list(options):
val = min([val for ... | Select | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Select:
def by_choices(cls, choice, options, fallback=None):
"""Select user choices and return the corresponding options Args: choice (str) - Expected choice options (list,tuple,dict): Collection of options to select from. fallback (str,int, optional): Fallback choice if original expecte... | stack_v2_sparse_classes_75kplus_train_001089 | 5,048 | permissive | [
{
"docstring": "Select user choices and return the corresponding options Args: choice (str) - Expected choice options (list,tuple,dict): Collection of options to select from. fallback (str,int, optional): Fallback choice if original expected choice is not found.",
"name": "by_choices",
"signature": "def... | 3 | stack_v2_sparse_classes_30k_train_047532 | Implement the Python class `Select` described below.
Class description:
Implement the Select class.
Method signatures and docstrings:
- def by_choices(cls, choice, options, fallback=None): Select user choices and return the corresponding options Args: choice (str) - Expected choice options (list,tuple,dict): Collecti... | Implement the Python class `Select` described below.
Class description:
Implement the Select class.
Method signatures and docstrings:
- def by_choices(cls, choice, options, fallback=None): Select user choices and return the corresponding options Args: choice (str) - Expected choice options (list,tuple,dict): Collecti... | 6613b71e4b3ab8ffae15539eea0f51e0fd5343ac | <|skeleton|>
class Select:
def by_choices(cls, choice, options, fallback=None):
"""Select user choices and return the corresponding options Args: choice (str) - Expected choice options (list,tuple,dict): Collection of options to select from. fallback (str,int, optional): Fallback choice if original expecte... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Select:
def by_choices(cls, choice, options, fallback=None):
"""Select user choices and return the corresponding options Args: choice (str) - Expected choice options (list,tuple,dict): Collection of options to select from. fallback (str,int, optional): Fallback choice if original expected choice is no... | the_stack_v2_python_sparse | pydatpiff/utils/utils.py | cbedroid/pydatpiff | train | 26 | |
7cb2d08ba18ded50369b6f39de48ed005ae671c5 | [
"model_copy = copy.deepcopy(model)\nmodel_layers_copy = {}\nmodules_in_copy = list(model_copy.modules())\nfor index, module in enumerate(model.modules()):\n if id(module) in model_layers:\n existing_layer = model_layers[id(module)]\n new_layer = lad.Layer(modules_in_copy[index], existing_layer.name... | <|body_start_0|>
model_copy = copy.deepcopy(model)
model_layers_copy = {}
modules_in_copy = list(model_copy.modules())
for index, module in enumerate(model.modules()):
if id(module) in model_layers:
existing_layer = model_layers[id(module)]
new... | Creates a compressed model by iterating over the selected layers in the model using the corresponding ranks | ModelPruner | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModelPruner:
"""Creates a compressed model by iterating over the selected layers in the model using the corresponding ranks"""
def _copy_model(cls, model, model_layers):
"""Creates a copy of the original model and its layers :param model: the original model :param model_layers: origi... | stack_v2_sparse_classes_75kplus_train_001090 | 8,255 | permissive | [
{
"docstring": "Creates a copy of the original model and its layers :param model: the original model :param model_layers: original model's layers :return:",
"name": "_copy_model",
"signature": "def _copy_model(cls, model, model_layers)"
},
{
"docstring": "Creates and returns a compressed model u... | 2 | null | Implement the Python class `ModelPruner` described below.
Class description:
Creates a compressed model by iterating over the selected layers in the model using the corresponding ranks
Method signatures and docstrings:
- def _copy_model(cls, model, model_layers): Creates a copy of the original model and its layers :p... | Implement the Python class `ModelPruner` described below.
Class description:
Creates a compressed model by iterating over the selected layers in the model using the corresponding ranks
Method signatures and docstrings:
- def _copy_model(cls, model, model_layers): Creates a copy of the original model and its layers :p... | 5a406e657082b6a4f6e4bf48f0e46e085cb1e351 | <|skeleton|>
class ModelPruner:
"""Creates a compressed model by iterating over the selected layers in the model using the corresponding ranks"""
def _copy_model(cls, model, model_layers):
"""Creates a copy of the original model and its layers :param model: the original model :param model_layers: origi... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ModelPruner:
"""Creates a compressed model by iterating over the selected layers in the model using the corresponding ranks"""
def _copy_model(cls, model, model_layers):
"""Creates a copy of the original model and its layers :param model: the original model :param model_layers: original model's l... | the_stack_v2_python_sparse | TrainingExtensions/torch/src/python/aimet_torch/svd/svd_pruner_deprecated.py | quic/aimet | train | 1,676 |
ee99310755e9eaf485f0ad26c59c70786da38a92 | [
"args = authentication_parser.parse_args()\nusername = authentication_header_parser(args['Authorization'])\nthoughts = ThoughtModel.query.filter(ThoughtModel.username == username).order_by('id').all()\nnum_thoughts = len(thoughts)\napp.logger.info(f'Retrieved {num_thoughts} thoughts for user {username}')\nreturn th... | <|body_start_0|>
args = authentication_parser.parse_args()
username = authentication_header_parser(args['Authorization'])
thoughts = ThoughtModel.query.filter(ThoughtModel.username == username).order_by('id').all()
num_thoughts = len(thoughts)
app.logger.info(f'Retrieved {num_tho... | MeThoughtListCreate | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MeThoughtListCreate:
def get(self):
"""Retrieves all the thoughts"""
<|body_0|>
def post(self):
"""Create a new thought"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
args = authentication_parser.parse_args()
username = authentication_heade... | stack_v2_sparse_classes_75kplus_train_001091 | 4,198 | permissive | [
{
"docstring": "Retrieves all the thoughts",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "Create a new thought",
"name": "post",
"signature": "def post(self)"
}
] | 2 | null | Implement the Python class `MeThoughtListCreate` described below.
Class description:
Implement the MeThoughtListCreate class.
Method signatures and docstrings:
- def get(self): Retrieves all the thoughts
- def post(self): Create a new thought | Implement the Python class `MeThoughtListCreate` described below.
Class description:
Implement the MeThoughtListCreate class.
Method signatures and docstrings:
- def get(self): Retrieves all the thoughts
- def post(self): Create a new thought
<|skeleton|>
class MeThoughtListCreate:
def get(self):
"""Ret... | 2ed9899e9df566c0a087682b3a85798b1c0380e9 | <|skeleton|>
class MeThoughtListCreate:
def get(self):
"""Retrieves all the thoughts"""
<|body_0|>
def post(self):
"""Create a new thought"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MeThoughtListCreate:
def get(self):
"""Retrieves all the thoughts"""
args = authentication_parser.parse_args()
username = authentication_header_parser(args['Authorization'])
thoughts = ThoughtModel.query.filter(ThoughtModel.username == username).order_by('id').all()
num... | the_stack_v2_python_sparse | Chapter10/microservices/thoughts_backend/ThoughtsBackend/thoughts_backend/api_namespace.py | PacktPublishing/Hands-On-Docker-for-Microservices-with-Python | train | 200 | |
23a5e10db8c624438e883e159dcc9db0e04cc3d9 | [
"data = deserialize(serializers.UserInParamsSerializer, request.query_params).data\nif 'user' in data:\n try:\n user = User.objects.get(username=data['user'])\n except User.DoesNotExist:\n raise NotFound()\nelse:\n user = request.user\ntasks = Task.all_with_user_solution(user)\nserializer = s... | <|body_start_0|>
data = deserialize(serializers.UserInParamsSerializer, request.query_params).data
if 'user' in data:
try:
user = User.objects.get(username=data['user'])
except User.DoesNotExist:
raise NotFound()
else:
user = re... | TasksListView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TasksListView:
def get(self, request, format=None):
"""Список заданий"""
<|body_0|>
def post(self, request, format=None):
"""Создание нового задания"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
data = deserialize(serializers.UserInParamsSerialize... | stack_v2_sparse_classes_75kplus_train_001092 | 13,598 | no_license | [
{
"docstring": "Список заданий",
"name": "get",
"signature": "def get(self, request, format=None)"
},
{
"docstring": "Создание нового задания",
"name": "post",
"signature": "def post(self, request, format=None)"
}
] | 2 | null | Implement the Python class `TasksListView` described below.
Class description:
Implement the TasksListView class.
Method signatures and docstrings:
- def get(self, request, format=None): Список заданий
- def post(self, request, format=None): Создание нового задания | Implement the Python class `TasksListView` described below.
Class description:
Implement the TasksListView class.
Method signatures and docstrings:
- def get(self, request, format=None): Список заданий
- def post(self, request, format=None): Создание нового задания
<|skeleton|>
class TasksListView:
def get(self... | c5f60f8c54efb10822ba63ccc88e84ff52c22110 | <|skeleton|>
class TasksListView:
def get(self, request, format=None):
"""Список заданий"""
<|body_0|>
def post(self, request, format=None):
"""Создание нового задания"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TasksListView:
def get(self, request, format=None):
"""Список заданий"""
data = deserialize(serializers.UserInParamsSerializer, request.query_params).data
if 'user' in data:
try:
user = User.objects.get(username=data['user'])
except User.DoesNotE... | the_stack_v2_python_sparse | app/judge/api/views.py | Sapunov/edujudge | train | 0 | |
9aaa3219a96fbb78e9a1be0648a1514bc24d0402 | [
"self.logger = AntiVirusLogger(__name__, debug=debug)\nif not utils.check_root():\n self.logger.log('Please run as root exiting.', logtype='error')\n sys.exit(0)\nif cred is not None:\n self.cred = cred\nelse:\n self.logger.log('SecureTea AntiVirus credentials not found.', logtype='error')\n sys.exit... | <|body_start_0|>
self.logger = AntiVirusLogger(__name__, debug=debug)
if not utils.check_root():
self.logger.log('Please run as root exiting.', logtype='error')
sys.exit(0)
if cred is not None:
self.cred = cred
else:
self.logger.log('Secure... | SecureTeaAntiVirus class. | SecureTeaAntiVirus | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SecureTeaAntiVirus:
"""SecureTeaAntiVirus class."""
def __init__(self, debug=False, cred=None):
"""Initialize SecureTeaAntiVirus. Args: debug (bool): Log on terminal or not cred (dict): SecureTea AntiVirus credentials Raises: None Returns: None"""
<|body_0|>
def start(se... | stack_v2_sparse_classes_75kplus_train_001093 | 3,217 | permissive | [
{
"docstring": "Initialize SecureTeaAntiVirus. Args: debug (bool): Log on terminal or not cred (dict): SecureTea AntiVirus credentials Raises: None Returns: None",
"name": "__init__",
"signature": "def __init__(self, debug=False, cred=None)"
},
{
"docstring": "Start AntiVirus core engine. Args: ... | 2 | stack_v2_sparse_classes_30k_train_038530 | Implement the Python class `SecureTeaAntiVirus` described below.
Class description:
SecureTeaAntiVirus class.
Method signatures and docstrings:
- def __init__(self, debug=False, cred=None): Initialize SecureTeaAntiVirus. Args: debug (bool): Log on terminal or not cred (dict): SecureTea AntiVirus credentials Raises: N... | Implement the Python class `SecureTeaAntiVirus` described below.
Class description:
SecureTeaAntiVirus class.
Method signatures and docstrings:
- def __init__(self, debug=False, cred=None): Initialize SecureTeaAntiVirus. Args: debug (bool): Log on terminal or not cred (dict): SecureTea AntiVirus credentials Raises: N... | 43dec187e5848b9ced8a6b4957b6e9028d4d43cd | <|skeleton|>
class SecureTeaAntiVirus:
"""SecureTeaAntiVirus class."""
def __init__(self, debug=False, cred=None):
"""Initialize SecureTeaAntiVirus. Args: debug (bool): Log on terminal or not cred (dict): SecureTea AntiVirus credentials Raises: None Returns: None"""
<|body_0|>
def start(se... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SecureTeaAntiVirus:
"""SecureTeaAntiVirus class."""
def __init__(self, debug=False, cred=None):
"""Initialize SecureTeaAntiVirus. Args: debug (bool): Log on terminal or not cred (dict): SecureTea AntiVirus credentials Raises: None Returns: None"""
self.logger = AntiVirusLogger(__name__, d... | the_stack_v2_python_sparse | securetea/lib/antivirus/secureTeaAntiVirus.py | rejahrehim/SecureTea-Project | train | 1 |
113ee2fc3c555b764ebeb7f7599f299d57a023e0 | [
"super().__init__(screen_width, screen_height, State.MENU, screen, 0, 0, debug)\nself.write(self.title_font, WHITE, 'Space Invaders', self.screen_width // 2, self.screen_height // 5)\nself.rect_play = self.write(self.end_font, WHITE, 'Play', self.screen_width // 2, self.screen_height // 2)\nself.rect_highscore = se... | <|body_start_0|>
super().__init__(screen_width, screen_height, State.MENU, screen, 0, 0, debug)
self.write(self.title_font, WHITE, 'Space Invaders', self.screen_width // 2, self.screen_height // 5)
self.rect_play = self.write(self.end_font, WHITE, 'Play', self.screen_width // 2, self.screen_heig... | MenuScreen | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MenuScreen:
def __init__(self, screen_width: int, screen_height: int, screen, debug: bool=False):
"""Constructor for the Main Menu screen"""
<|body_0|>
def update_keypresses(self) -> State:
"""Track the keypress for the menu"""
<|body_1|>
def check_mouse... | stack_v2_sparse_classes_75kplus_train_001094 | 3,083 | permissive | [
{
"docstring": "Constructor for the Main Menu screen",
"name": "__init__",
"signature": "def __init__(self, screen_width: int, screen_height: int, screen, debug: bool=False)"
},
{
"docstring": "Track the keypress for the menu",
"name": "update_keypresses",
"signature": "def update_keypre... | 4 | stack_v2_sparse_classes_30k_train_005465 | Implement the Python class `MenuScreen` described below.
Class description:
Implement the MenuScreen class.
Method signatures and docstrings:
- def __init__(self, screen_width: int, screen_height: int, screen, debug: bool=False): Constructor for the Main Menu screen
- def update_keypresses(self) -> State: Track the k... | Implement the Python class `MenuScreen` described below.
Class description:
Implement the MenuScreen class.
Method signatures and docstrings:
- def __init__(self, screen_width: int, screen_height: int, screen, debug: bool=False): Constructor for the Main Menu screen
- def update_keypresses(self) -> State: Track the k... | 6f8f2da4fd26ef1d77c0c6183230c3a5e6bf0bb9 | <|skeleton|>
class MenuScreen:
def __init__(self, screen_width: int, screen_height: int, screen, debug: bool=False):
"""Constructor for the Main Menu screen"""
<|body_0|>
def update_keypresses(self) -> State:
"""Track the keypress for the menu"""
<|body_1|>
def check_mouse... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MenuScreen:
def __init__(self, screen_width: int, screen_height: int, screen, debug: bool=False):
"""Constructor for the Main Menu screen"""
super().__init__(screen_width, screen_height, State.MENU, screen, 0, 0, debug)
self.write(self.title_font, WHITE, 'Space Invaders', self.screen_w... | the_stack_v2_python_sparse | gym_invaders/gym_game/envs/classes/Game/Screens/MenuScreen.py | Jh123x/Orbital | train | 4 | |
76b358129e6c21f15705f0fc8e976c50425dbe91 | [
"self.add_to_layout(None)\nbutton_add = wx.Button(self, -1, 'Add')\nbutton_add.Bind(wx.EVT_BUTTON, self.button_add_pressed)\nbutton_add.SetToolTip(wx.ToolTip('Add new register'))\nbutton_add.SetDefault()\nbutton_edit = wx.Button(self, -1, 'Edit')\nbutton_edit.Bind(wx.EVT_BUTTON, self.button_edit_pressed)\nbutton_ed... | <|body_start_0|>
self.add_to_layout(None)
button_add = wx.Button(self, -1, 'Add')
button_add.Bind(wx.EVT_BUTTON, self.button_add_pressed)
button_add.SetToolTip(wx.ToolTip('Add new register'))
button_add.SetDefault()
button_edit = wx.Button(self, -1, 'Edit')
button... | Register definition page | RegisterPage | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RegisterPage:
"""Register definition page"""
def add_list_buttons(self):
"""Add list management buttons to the page"""
<|body_0|>
def button_add_pressed(self, event):
"""Button "Add" pressed"""
<|body_1|>
def button_remove_pressed(self, event):
... | stack_v2_sparse_classes_75kplus_train_001095 | 17,994 | no_license | [
{
"docstring": "Add list management buttons to the page",
"name": "add_list_buttons",
"signature": "def add_list_buttons(self)"
},
{
"docstring": "Button \"Add\" pressed",
"name": "button_add_pressed",
"signature": "def button_add_pressed(self, event)"
},
{
"docstring": "Button \... | 5 | null | Implement the Python class `RegisterPage` described below.
Class description:
Register definition page
Method signatures and docstrings:
- def add_list_buttons(self): Add list management buttons to the page
- def button_add_pressed(self, event): Button "Add" pressed
- def button_remove_pressed(self, event): Button "R... | Implement the Python class `RegisterPage` described below.
Class description:
Register definition page
Method signatures and docstrings:
- def add_list_buttons(self): Add list management buttons to the page
- def button_add_pressed(self, event): Button "Add" pressed
- def button_remove_pressed(self, event): Button "R... | 4c5b4ab455b62a9b1b0a1477121997ca8a495aef | <|skeleton|>
class RegisterPage:
"""Register definition page"""
def add_list_buttons(self):
"""Add list management buttons to the page"""
<|body_0|>
def button_add_pressed(self, event):
"""Button "Add" pressed"""
<|body_1|>
def button_remove_pressed(self, event):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RegisterPage:
"""Register definition page"""
def add_list_buttons(self):
"""Add list management buttons to the page"""
self.add_to_layout(None)
button_add = wx.Button(self, -1, 'Add')
button_add.Bind(wx.EVT_BUTTON, self.button_add_pressed)
button_add.SetToolTip(wx.... | the_stack_v2_python_sparse | python/swapmaker/wizard.py | ntruchsess/panstamp | train | 3 |
81876ccd754274a281e78fd6ab59805c8ec4960b | [
"items = []\nparent_urls = response.xpath('//div[@id=\"tab01\"]/div/h3/a/@href').extract()\nparent_titles = response.xpath('//div[@id=\"tab01\"]/div/h3/a/text()').extract()\nsub_urls = response.xpath('//div[@class=\"clearfix\"]/ul/li/a/@href').extract()\nsub_titles = response.xpath('//div[@class=\"clearfix\"]/ul/li... | <|body_start_0|>
items = []
parent_urls = response.xpath('//div[@id="tab01"]/div/h3/a/@href').extract()
parent_titles = response.xpath('//div[@id="tab01"]/div/h3/a/text()').extract()
sub_urls = response.xpath('//div[@class="clearfix"]/ul/li/a/@href').extract()
sub_titles = respon... | SinaSpider | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SinaSpider:
def parse(self, response):
"""解析所有大类title,url; 小类title,url。获取小类中文章的url,交给content_parse处理 :param response: :return:"""
<|body_0|>
def sub_pares(self, response):
"""对于返回的小类sub_url,进行递归请求 :param response: :return:"""
<|body_1|>
def content_parse... | stack_v2_sparse_classes_75kplus_train_001096 | 3,641 | no_license | [
{
"docstring": "解析所有大类title,url; 小类title,url。获取小类中文章的url,交给content_parse处理 :param response: :return:",
"name": "parse",
"signature": "def parse(self, response)"
},
{
"docstring": "对于返回的小类sub_url,进行递归请求 :param response: :return:",
"name": "sub_pares",
"signature": "def sub_pares(self, res... | 3 | stack_v2_sparse_classes_30k_train_041525 | Implement the Python class `SinaSpider` described below.
Class description:
Implement the SinaSpider class.
Method signatures and docstrings:
- def parse(self, response): 解析所有大类title,url; 小类title,url。获取小类中文章的url,交给content_parse处理 :param response: :return:
- def sub_pares(self, response): 对于返回的小类sub_url,进行递归请求 :param ... | Implement the Python class `SinaSpider` described below.
Class description:
Implement the SinaSpider class.
Method signatures and docstrings:
- def parse(self, response): 解析所有大类title,url; 小类title,url。获取小类中文章的url,交给content_parse处理 :param response: :return:
- def sub_pares(self, response): 对于返回的小类sub_url,进行递归请求 :param ... | bac744667f60618b5ed96d301293955ccfce7f91 | <|skeleton|>
class SinaSpider:
def parse(self, response):
"""解析所有大类title,url; 小类title,url。获取小类中文章的url,交给content_parse处理 :param response: :return:"""
<|body_0|>
def sub_pares(self, response):
"""对于返回的小类sub_url,进行递归请求 :param response: :return:"""
<|body_1|>
def content_parse... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SinaSpider:
def parse(self, response):
"""解析所有大类title,url; 小类title,url。获取小类中文章的url,交给content_parse处理 :param response: :return:"""
items = []
parent_urls = response.xpath('//div[@id="tab01"]/div/h3/a/@href').extract()
parent_titles = response.xpath('//div[@id="tab01"]/div/h3/a/t... | the_stack_v2_python_sparse | sinanews/sinanews/spiders/sina.py | Cprocc/spiderStudy | train | 0 | |
7518ec57cee1db9011db43c2edee61b1aaee2e03 | [
"if settings.EMAIL_HOST:\n try:\n result = super().send_mail(template_prefix, email, context)\n except Exception:\n log_error('account email')\n result = False\n return result\nreturn False",
"from InvenTree.helpers_model import construct_absolute_url\nurl = super().get_email_confirm... | <|body_start_0|>
if settings.EMAIL_HOST:
try:
result = super().send_mail(template_prefix, email, context)
except Exception:
log_error('account email')
result = False
return result
return False
<|end_body_0|>
<|body_star... | Override of adapter to use dynamic settings. | CustomAccountAdapter | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CustomAccountAdapter:
"""Override of adapter to use dynamic settings."""
def send_mail(self, template_prefix, email, context):
"""Only send mail if backend configured."""
<|body_0|>
def get_email_confirmation_url(self, request, emailconfirmation):
"""Construct th... | stack_v2_sparse_classes_75kplus_train_001097 | 12,546 | permissive | [
{
"docstring": "Only send mail if backend configured.",
"name": "send_mail",
"signature": "def send_mail(self, template_prefix, email, context)"
},
{
"docstring": "Construct the email confirmation url",
"name": "get_email_confirmation_url",
"signature": "def get_email_confirmation_url(se... | 2 | stack_v2_sparse_classes_30k_train_008548 | Implement the Python class `CustomAccountAdapter` described below.
Class description:
Override of adapter to use dynamic settings.
Method signatures and docstrings:
- def send_mail(self, template_prefix, email, context): Only send mail if backend configured.
- def get_email_confirmation_url(self, request, emailconfir... | Implement the Python class `CustomAccountAdapter` described below.
Class description:
Override of adapter to use dynamic settings.
Method signatures and docstrings:
- def send_mail(self, template_prefix, email, context): Only send mail if backend configured.
- def get_email_confirmation_url(self, request, emailconfir... | e88a8e99a5f0b201c67a95cba097c729f090d5e2 | <|skeleton|>
class CustomAccountAdapter:
"""Override of adapter to use dynamic settings."""
def send_mail(self, template_prefix, email, context):
"""Only send mail if backend configured."""
<|body_0|>
def get_email_confirmation_url(self, request, emailconfirmation):
"""Construct th... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CustomAccountAdapter:
"""Override of adapter to use dynamic settings."""
def send_mail(self, template_prefix, email, context):
"""Only send mail if backend configured."""
if settings.EMAIL_HOST:
try:
result = super().send_mail(template_prefix, email, context)
... | the_stack_v2_python_sparse | InvenTree/InvenTree/forms.py | inventree/InvenTree | train | 3,077 |
03326e5d815585ef329d2b77a700a04df5a77a3e | [
"self.nodeMatrix = initTestRoom()\nself.finalNodeMatrix = initFinalTestRoom()\nself.stepsize = 1 / 20\nself.roomNbr = 2\nself.testMesh = Mesh(self.nodeMatrix, self.roomNbr, self.stepsize)\nself.testMeshDyn = MeshDyn(self.stepsize, self.nodeMatrix)\nself.finalTestMesh = Mesh(self.finalNodeMatrix, self.roomNbr, self.... | <|body_start_0|>
self.nodeMatrix = initTestRoom()
self.finalNodeMatrix = initFinalTestRoom()
self.stepsize = 1 / 20
self.roomNbr = 2
self.testMesh = Mesh(self.nodeMatrix, self.roomNbr, self.stepsize)
self.testMeshDyn = MeshDyn(self.stepsize, self.nodeMatrix)
self.... | Test class to test the classes Mesh and Node for the third Project | TestClasses | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestClasses:
"""Test class to test the classes Mesh and Node for the third Project"""
def setUp(self):
"""sets up a test mesh and test nodes"""
<|body_0|>
def testGetNode(self):
"""Tests the get functions of the node class"""
<|body_1|>
def testGetMe... | stack_v2_sparse_classes_75kplus_train_001098 | 4,469 | no_license | [
{
"docstring": "sets up a test mesh and test nodes",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Tests the get functions of the node class",
"name": "testGetNode",
"signature": "def testGetNode(self)"
},
{
"docstring": "Tests the get functions of the Mesh c... | 6 | stack_v2_sparse_classes_30k_train_046382 | Implement the Python class `TestClasses` described below.
Class description:
Test class to test the classes Mesh and Node for the third Project
Method signatures and docstrings:
- def setUp(self): sets up a test mesh and test nodes
- def testGetNode(self): Tests the get functions of the node class
- def testGetMesh(s... | Implement the Python class `TestClasses` described below.
Class description:
Test class to test the classes Mesh and Node for the third Project
Method signatures and docstrings:
- def setUp(self): sets up a test mesh and test nodes
- def testGetNode(self): Tests the get functions of the node class
- def testGetMesh(s... | d0c22a683afa1cdf7b27b0c89b3d57a4ea64e379 | <|skeleton|>
class TestClasses:
"""Test class to test the classes Mesh and Node for the third Project"""
def setUp(self):
"""sets up a test mesh and test nodes"""
<|body_0|>
def testGetNode(self):
"""Tests the get functions of the node class"""
<|body_1|>
def testGetMe... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestClasses:
"""Test class to test the classes Mesh and Node for the third Project"""
def setUp(self):
"""sets up a test mesh and test nodes"""
self.nodeMatrix = initTestRoom()
self.finalNodeMatrix = initFinalTestRoom()
self.stepsize = 1 / 20
self.roomNbr = 2
... | the_stack_v2_python_sparse | Project_3/TestsWithDyn.py | TuongL94/NumericalAlgorithmAssignments | train | 0 |
baf53e7da6ecad69cd56647b7e9a54103e28fb5d | [
"num_issues = ProcessingIssue.objects.filter(project=project).count()\nlast_seen = ProcessingIssue.objects.filter(project=project).order_by('-datetime').first()\nresolveable_issues, has_more = ProcessingIssue.objects.find_resolved(project_id=project.id)\nreprocessing_issues = ReprocessingReport.objects.filter(proje... | <|body_start_0|>
num_issues = ProcessingIssue.objects.filter(project=project).count()
last_seen = ProcessingIssue.objects.filter(project=project).order_by('-datetime').first()
resolveable_issues, has_more = ProcessingIssue.objects.find_resolved(project_id=project.id)
reprocessing_issues ... | ProjectProcessingIssuesEndpoint | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProjectProcessingIssuesEndpoint:
def get(self, request, project):
"""List a project's processing issues."""
<|body_0|>
def delete(self, request, project):
"""This deletes all open processing issues and triggers reprocessing if the user disabled the checkbox"""
... | stack_v2_sparse_classes_75kplus_train_001099 | 4,504 | permissive | [
{
"docstring": "List a project's processing issues.",
"name": "get",
"signature": "def get(self, request, project)"
},
{
"docstring": "This deletes all open processing issues and triggers reprocessing if the user disabled the checkbox",
"name": "delete",
"signature": "def delete(self, re... | 2 | stack_v2_sparse_classes_30k_train_031835 | Implement the Python class `ProjectProcessingIssuesEndpoint` described below.
Class description:
Implement the ProjectProcessingIssuesEndpoint class.
Method signatures and docstrings:
- def get(self, request, project): List a project's processing issues.
- def delete(self, request, project): This deletes all open pro... | Implement the Python class `ProjectProcessingIssuesEndpoint` described below.
Class description:
Implement the ProjectProcessingIssuesEndpoint class.
Method signatures and docstrings:
- def get(self, request, project): List a project's processing issues.
- def delete(self, request, project): This deletes all open pro... | b937615079d7b24dc225a83b99b1b65da932fc66 | <|skeleton|>
class ProjectProcessingIssuesEndpoint:
def get(self, request, project):
"""List a project's processing issues."""
<|body_0|>
def delete(self, request, project):
"""This deletes all open processing issues and triggers reprocessing if the user disabled the checkbox"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ProjectProcessingIssuesEndpoint:
def get(self, request, project):
"""List a project's processing issues."""
num_issues = ProcessingIssue.objects.filter(project=project).count()
last_seen = ProcessingIssue.objects.filter(project=project).order_by('-datetime').first()
resolveable... | the_stack_v2_python_sparse | src/sentry/api/endpoints/project_processingissues.py | atlassian/sentry | train | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.