blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 7.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 467 8.64k | id stringlengths 40 40 | length_bytes int64 515 49.7k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 160 3.93k | prompted_full_text stringlengths 681 10.7k | revision_id stringlengths 40 40 | skeleton stringlengths 162 4.09k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | solution stringlengths 331 8.3k | source stringclasses 1
value | source_path stringlengths 5 177 | source_repo stringlengths 6 88 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f1f8b1d6f0a0890fb394dcec08c17e282adbd96b | [
"super().__init__(ccdata, *args, **kwargs)\nself.required_attrs = ('natom', 'atomcoords', 'atomnos')\nself.do_firstgeom = firstgeom\nself.do_lastgeom = lastgeom\nself.do_allgeom = allgeom\nself.natom = str(self.ccdata.natom)\nself.element_list = [self.pt.element[Z] for Z in self.ccdata.atomnos]",
"xyzblock = []\n... | <|body_start_0|>
super().__init__(ccdata, *args, **kwargs)
self.required_attrs = ('natom', 'atomcoords', 'atomnos')
self.do_firstgeom = firstgeom
self.do_lastgeom = lastgeom
self.do_allgeom = allgeom
self.natom = str(self.ccdata.natom)
self.element_list = [self.pt... | A writer for XYZ (Cartesian coordinate) files. | XYZ | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class XYZ:
"""A writer for XYZ (Cartesian coordinate) files."""
def __init__(self, ccdata: ccData, splitfiles: bool=False, firstgeom: bool=False, lastgeom: bool=False, allgeom: bool=False, *args, **kwargs) -> None:
"""Initialize the XYZ writer object. Inputs: ccdata - An instance of ccData... | stack_v2_sparse_classes_10k_train_008400 | 4,169 | permissive | [
{
"docstring": "Initialize the XYZ writer object. Inputs: ccdata - An instance of ccData, parse from a logfile. splitfiles - Boolean to write multiple files if multiple files are requested. [TODO] firstgeom - Boolean to write the first available geometry from the logfile. lastgeom - Boolean to write the last av... | 3 | stack_v2_sparse_classes_30k_train_000225 | Implement the Python class `XYZ` described below.
Class description:
A writer for XYZ (Cartesian coordinate) files.
Method signatures and docstrings:
- def __init__(self, ccdata: ccData, splitfiles: bool=False, firstgeom: bool=False, lastgeom: bool=False, allgeom: bool=False, *args, **kwargs) -> None: Initialize the ... | Implement the Python class `XYZ` described below.
Class description:
A writer for XYZ (Cartesian coordinate) files.
Method signatures and docstrings:
- def __init__(self, ccdata: ccData, splitfiles: bool=False, firstgeom: bool=False, lastgeom: bool=False, allgeom: bool=False, *args, **kwargs) -> None: Initialize the ... | b8d42a163ce9bafd4b660e2a933f56a8cc54fd9b | <|skeleton|>
class XYZ:
"""A writer for XYZ (Cartesian coordinate) files."""
def __init__(self, ccdata: ccData, splitfiles: bool=False, firstgeom: bool=False, lastgeom: bool=False, allgeom: bool=False, *args, **kwargs) -> None:
"""Initialize the XYZ writer object. Inputs: ccdata - An instance of ccData... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class XYZ:
"""A writer for XYZ (Cartesian coordinate) files."""
def __init__(self, ccdata: ccData, splitfiles: bool=False, firstgeom: bool=False, lastgeom: bool=False, allgeom: bool=False, *args, **kwargs) -> None:
"""Initialize the XYZ writer object. Inputs: ccdata - An instance of ccData, parse from ... | the_stack_v2_python_sparse | cclib/io/xyzwriter.py | cclib/cclib | train | 285 |
48dc73a1646dd8958b523ee088855d8c80f4c7d4 | [
"if index is None:\n index = 0\nif default is None:\n default = self._get_paths(include_application=True, include_pyrin=True)\nsuper().__init__('input_paths', index, default=default, **options)",
"include_application = options.get('include_app', False)\ninclude_pyrin = options.get('include_pyrin', False)\np... | <|body_start_0|>
if index is None:
index = 0
if default is None:
default = self._get_paths(include_application=True, include_pyrin=True)
super().__init__('input_paths', index, default=default, **options)
<|end_body_0|>
<|body_start_1|>
include_application = optio... | input paths param class. | InputPathsParam | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InputPathsParam:
"""input paths param class."""
def __init__(self, index=None, default=None, **options):
"""initializes an instance of InputPathsParam. :param int index: zero based index of this param in cli command inputs. defaults to 0 if not provided. :param object default: defaul... | stack_v2_sparse_classes_10k_train_008401 | 27,683 | permissive | [
{
"docstring": "initializes an instance of InputPathsParam. :param int index: zero based index of this param in cli command inputs. defaults to 0 if not provided. :param object default: default value to be emitted to cli if this param is not available. if set to None, this param will not be emitted at all. defa... | 3 | null | Implement the Python class `InputPathsParam` described below.
Class description:
input paths param class.
Method signatures and docstrings:
- def __init__(self, index=None, default=None, **options): initializes an instance of InputPathsParam. :param int index: zero based index of this param in cli command inputs. def... | Implement the Python class `InputPathsParam` described below.
Class description:
input paths param class.
Method signatures and docstrings:
- def __init__(self, index=None, default=None, **options): initializes an instance of InputPathsParam. :param int index: zero based index of this param in cli command inputs. def... | 9d4776498225de4f3d16a4600b5b19212abe8562 | <|skeleton|>
class InputPathsParam:
"""input paths param class."""
def __init__(self, index=None, default=None, **options):
"""initializes an instance of InputPathsParam. :param int index: zero based index of this param in cli command inputs. defaults to 0 if not provided. :param object default: defaul... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class InputPathsParam:
"""input paths param class."""
def __init__(self, index=None, default=None, **options):
"""initializes an instance of InputPathsParam. :param int index: zero based index of this param in cli command inputs. defaults to 0 if not provided. :param object default: default value to be... | the_stack_v2_python_sparse | src/pyrin/globalization/locale/babel/handlers/params.py | mononobi/pyrin | train | 20 |
ab50a40c51ec49071ac28573eca681a990def741 | [
"self.role_id = arg.get('role_id')\nself.user_id = arg.get('user_id')\nself.active = arg.get('active')",
"if commit:\n db.session.add(self)\n db.session.commit()",
"search = {'user_id': user_id, 'role_id': role_id}\nuser_role = UserRole.query\nresult = user_role.filter_by(**search).first()\nreturn result"... | <|body_start_0|>
self.role_id = arg.get('role_id')
self.user_id = arg.get('user_id')
self.active = arg.get('active')
<|end_body_0|>
<|body_start_1|>
if commit:
db.session.add(self)
db.session.commit()
<|end_body_1|>
<|body_start_2|>
search = {'user_id': ... | User role model | UserRole | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserRole:
"""User role model"""
def __init__(self, **arg):
"""User role cobstructor"""
<|body_0|>
def save(self, commit=True):
"""User role save"""
<|body_1|>
def get_by_uid_rid(self, user_id, role_id):
"""User role uid rid"""
<|body_... | stack_v2_sparse_classes_10k_train_008402 | 1,979 | no_license | [
{
"docstring": "User role cobstructor",
"name": "__init__",
"signature": "def __init__(self, **arg)"
},
{
"docstring": "User role save",
"name": "save",
"signature": "def save(self, commit=True)"
},
{
"docstring": "User role uid rid",
"name": "get_by_uid_rid",
"signature"... | 3 | stack_v2_sparse_classes_30k_train_000273 | Implement the Python class `UserRole` described below.
Class description:
User role model
Method signatures and docstrings:
- def __init__(self, **arg): User role cobstructor
- def save(self, commit=True): User role save
- def get_by_uid_rid(self, user_id, role_id): User role uid rid | Implement the Python class `UserRole` described below.
Class description:
User role model
Method signatures and docstrings:
- def __init__(self, **arg): User role cobstructor
- def save(self, commit=True): User role save
- def get_by_uid_rid(self, user_id, role_id): User role uid rid
<|skeleton|>
class UserRole:
... | 4dc5f5e816e3c461b8a60c5f61c7eafc08050579 | <|skeleton|>
class UserRole:
"""User role model"""
def __init__(self, **arg):
"""User role cobstructor"""
<|body_0|>
def save(self, commit=True):
"""User role save"""
<|body_1|>
def get_by_uid_rid(self, user_id, role_id):
"""User role uid rid"""
<|body_... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class UserRole:
"""User role model"""
def __init__(self, **arg):
"""User role cobstructor"""
self.role_id = arg.get('role_id')
self.user_id = arg.get('user_id')
self.active = arg.get('active')
def save(self, commit=True):
"""User role save"""
if commit:
... | the_stack_v2_python_sparse | app/models/user_role.py | ekramulmostafa/ms-auth | train | 0 |
76f32816b81a2645b48c5f143d13198f86ec11e7 | [
"if isinstance(value, (str, unicode)):\n try:\n value = int(value)\n except (ValueError, TypeError) as err:\n if value.lower() == 'true':\n value = True\n elif value.lower() == 'false':\n value = False\nif value:\n return 1\nelse:\n return 0",
"if value in (0... | <|body_start_0|>
if isinstance(value, (str, unicode)):
try:
value = int(value)
except (ValueError, TypeError) as err:
if value.lower() == 'true':
value = True
elif value.lower() == 'false':
value = Fa... | SFBool field/event type base-class | _SFBool | [
"GPL-1.0-or-later",
"MIT",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-other-copyleft",
"LGPL-2.1-or-later",
"GPL-3.0-only",
"LGPL-2.0-or-later",
"GPL-3.0-or-later"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _SFBool:
"""SFBool field/event type base-class"""
def coerce(self, value):
"""Coerce the given value to our type Allowable types: any object with true/false protocol"""
<|body_0|>
def check(self, value):
"""Check that the given value is of exactly expected type""... | stack_v2_sparse_classes_10k_train_008403 | 34,853 | permissive | [
{
"docstring": "Coerce the given value to our type Allowable types: any object with true/false protocol",
"name": "coerce",
"signature": "def coerce(self, value)"
},
{
"docstring": "Check that the given value is of exactly expected type",
"name": "check",
"signature": "def check(self, va... | 3 | null | Implement the Python class `_SFBool` described below.
Class description:
SFBool field/event type base-class
Method signatures and docstrings:
- def coerce(self, value): Coerce the given value to our type Allowable types: any object with true/false protocol
- def check(self, value): Check that the given value is of ex... | Implement the Python class `_SFBool` described below.
Class description:
SFBool field/event type base-class
Method signatures and docstrings:
- def coerce(self, value): Coerce the given value to our type Allowable types: any object with true/false protocol
- def check(self, value): Check that the given value is of ex... | 7f600ad153270feff12aa7aa86d7ed0a49ebc71c | <|skeleton|>
class _SFBool:
"""SFBool field/event type base-class"""
def coerce(self, value):
"""Coerce the given value to our type Allowable types: any object with true/false protocol"""
<|body_0|>
def check(self, value):
"""Check that the given value is of exactly expected type""... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class _SFBool:
"""SFBool field/event type base-class"""
def coerce(self, value):
"""Coerce the given value to our type Allowable types: any object with true/false protocol"""
if isinstance(value, (str, unicode)):
try:
value = int(value)
except (ValueError... | the_stack_v2_python_sparse | pythonAnimations/pyOpenGLChess/engineDirectory/oglc-env/lib/python2.7/site-packages/vrml/fieldtypes.py | alexus37/AugmentedRealityChess | train | 1 |
e3a2d212506b59b37efd258df0b7355e43697319 | [
"_query_builder = Configuration.get_base_uri()\n_query_builder += '/information/businessregistry'\n_query_url = APIHelper.clean_url(_query_builder)\n_headers = {'accept': 'application/json'}\n_request = self.http_client.get(_query_url, headers=_headers)\nOAuth2.apply(_request)\n_context = self.execute_request(_requ... | <|body_start_0|>
_query_builder = Configuration.get_base_uri()
_query_builder += '/information/businessregistry'
_query_url = APIHelper.clean_url(_query_builder)
_headers = {'accept': 'application/json'}
_request = self.http_client.get(_query_url, headers=_headers)
OAuth2... | A Controller to access Endpoints in the idfy_rest_client API. | BusinessRegistryController | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BusinessRegistryController:
"""A Controller to access Endpoints in the idfy_rest_client API."""
def list_registration_authorities(self):
"""Does a GET request to /information/businessregistry. Retrieves a list of business registration authorities globally Returns: mixed: Response fro... | stack_v2_sparse_classes_10k_train_008404 | 3,352 | permissive | [
{
"docstring": "Does a GET request to /information/businessregistry. Retrieves a list of business registration authorities globally Returns: mixed: Response from the API. OK Raises: APIException: When an error occurs while fetching the data from the remote API. This exception includes the HTTP Response code, an... | 2 | stack_v2_sparse_classes_30k_val_000343 | Implement the Python class `BusinessRegistryController` described below.
Class description:
A Controller to access Endpoints in the idfy_rest_client API.
Method signatures and docstrings:
- def list_registration_authorities(self): Does a GET request to /information/businessregistry. Retrieves a list of business regis... | Implement the Python class `BusinessRegistryController` described below.
Class description:
A Controller to access Endpoints in the idfy_rest_client API.
Method signatures and docstrings:
- def list_registration_authorities(self): Does a GET request to /information/businessregistry. Retrieves a list of business regis... | fa3918a6c54ea0eedb9146578645b7eb1755b642 | <|skeleton|>
class BusinessRegistryController:
"""A Controller to access Endpoints in the idfy_rest_client API."""
def list_registration_authorities(self):
"""Does a GET request to /information/businessregistry. Retrieves a list of business registration authorities globally Returns: mixed: Response fro... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BusinessRegistryController:
"""A Controller to access Endpoints in the idfy_rest_client API."""
def list_registration_authorities(self):
"""Does a GET request to /information/businessregistry. Retrieves a list of business registration authorities globally Returns: mixed: Response from the API. OK... | the_stack_v2_python_sparse | idfy_rest_client/controllers/business_registry_controller.py | dealflowteam/Idfy | train | 0 |
d10cab625a76da941cf8cda0e1fb65505639e4b4 | [
"nvars = 2\nif u0 is None:\n u0 = [2.0, 0.0]\nsuper().__init__((nvars, None, np.dtype('float64')))\nself._makeAttributeAndRegister('nvars', 'u0', localVars=locals(), readOnly=True)\nself._makeAttributeAndRegister('mu', 'newton_maxiter', 'newton_tol', 'stop_at_nan', 'crash_at_maxiter', localVars=locals())\nself.w... | <|body_start_0|>
nvars = 2
if u0 is None:
u0 = [2.0, 0.0]
super().__init__((nvars, None, np.dtype('float64')))
self._makeAttributeAndRegister('nvars', 'u0', localVars=locals(), readOnly=True)
self._makeAttributeAndRegister('mu', 'newton_maxiter', 'newton_tol', 'stop_a... | This class implements the stiff Van der Pol oscillator given by the equation .. math:: \\frac{d^2 u(t)}{d t^2} - \\mu (1 - u(t)^2) \\frac{d u(t)}{dt} + u(t) = 0. Parameters ---------- u0 : sequence of array_like, optional Initial condition. mu : float, optional Stiff parameter :math:`\\mu`. newton_maxiter : int, option... | vanderpol | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class vanderpol:
"""This class implements the stiff Van der Pol oscillator given by the equation .. math:: \\frac{d^2 u(t)}{d t^2} - \\mu (1 - u(t)^2) \\frac{d u(t)}{dt} + u(t) = 0. Parameters ---------- u0 : sequence of array_like, optional Initial condition. mu : float, optional Stiff parameter :math... | stack_v2_sparse_classes_10k_train_008405 | 5,657 | permissive | [
{
"docstring": "Initialization routine",
"name": "__init__",
"signature": "def __init__(self, u0=None, mu=5.0, newton_maxiter=100, newton_tol=1e-09, stop_at_nan=True, crash_at_maxiter=True)"
},
{
"docstring": "Routine to approximate the exact solution at time t by scipy or give initial condition... | 4 | stack_v2_sparse_classes_30k_train_002830 | Implement the Python class `vanderpol` described below.
Class description:
This class implements the stiff Van der Pol oscillator given by the equation .. math:: \\frac{d^2 u(t)}{d t^2} - \\mu (1 - u(t)^2) \\frac{d u(t)}{dt} + u(t) = 0. Parameters ---------- u0 : sequence of array_like, optional Initial condition. mu ... | Implement the Python class `vanderpol` described below.
Class description:
This class implements the stiff Van der Pol oscillator given by the equation .. math:: \\frac{d^2 u(t)}{d t^2} - \\mu (1 - u(t)^2) \\frac{d u(t)}{dt} + u(t) = 0. Parameters ---------- u0 : sequence of array_like, optional Initial condition. mu ... | 1a51834bedffd4472e344bed28f4d766614b1537 | <|skeleton|>
class vanderpol:
"""This class implements the stiff Van der Pol oscillator given by the equation .. math:: \\frac{d^2 u(t)}{d t^2} - \\mu (1 - u(t)^2) \\frac{d u(t)}{dt} + u(t) = 0. Parameters ---------- u0 : sequence of array_like, optional Initial condition. mu : float, optional Stiff parameter :math... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class vanderpol:
"""This class implements the stiff Van der Pol oscillator given by the equation .. math:: \\frac{d^2 u(t)}{d t^2} - \\mu (1 - u(t)^2) \\frac{d u(t)}{dt} + u(t) = 0. Parameters ---------- u0 : sequence of array_like, optional Initial condition. mu : float, optional Stiff parameter :math:`\\mu`. newt... | the_stack_v2_python_sparse | pySDC/implementations/problem_classes/Van_der_Pol_implicit.py | Parallel-in-Time/pySDC | train | 30 |
b2c9713d6bf1875145f87a41aaf70205e2b0f394 | [
"assert isinstance(block_string, str)\nops = block_string.split('_')\noptions = {}\nfor op in ops:\n splits = re.split('(\\\\d.*)', op)\n if len(splits) >= 2:\n key, value = splits[:2]\n options[key] = value\nassert 's' in options and len(options['s']) == 1 or (len(options['s']) == 2 and options... | <|body_start_0|>
assert isinstance(block_string, str)
ops = block_string.split('_')
options = {}
for op in ops:
splits = re.split('(\\d.*)', op)
if len(splits) >= 2:
key, value = splits[:2]
options[key] = value
assert 's' in... | Block Decoder for readability, straight from the official TensorFlow repository | BlockDecoder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BlockDecoder:
"""Block Decoder for readability, straight from the official TensorFlow repository"""
def _decode_block_string(block_string):
"""Gets a block through a string notation of arguments."""
<|body_0|>
def _encode_block_string(block):
"""Encodes a block t... | stack_v2_sparse_classes_10k_train_008406 | 48,558 | no_license | [
{
"docstring": "Gets a block through a string notation of arguments.",
"name": "_decode_block_string",
"signature": "def _decode_block_string(block_string)"
},
{
"docstring": "Encodes a block to a string.",
"name": "_encode_block_string",
"signature": "def _encode_block_string(block)"
... | 4 | stack_v2_sparse_classes_30k_train_005986 | Implement the Python class `BlockDecoder` described below.
Class description:
Block Decoder for readability, straight from the official TensorFlow repository
Method signatures and docstrings:
- def _decode_block_string(block_string): Gets a block through a string notation of arguments.
- def _encode_block_string(bloc... | Implement the Python class `BlockDecoder` described below.
Class description:
Block Decoder for readability, straight from the official TensorFlow repository
Method signatures and docstrings:
- def _decode_block_string(block_string): Gets a block through a string notation of arguments.
- def _encode_block_string(bloc... | 7e55a422588c1d1e00f35a3d3a3ff896cce59e18 | <|skeleton|>
class BlockDecoder:
"""Block Decoder for readability, straight from the official TensorFlow repository"""
def _decode_block_string(block_string):
"""Gets a block through a string notation of arguments."""
<|body_0|>
def _encode_block_string(block):
"""Encodes a block t... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BlockDecoder:
"""Block Decoder for readability, straight from the official TensorFlow repository"""
def _decode_block_string(block_string):
"""Gets a block through a string notation of arguments."""
assert isinstance(block_string, str)
ops = block_string.split('_')
options... | the_stack_v2_python_sparse | generated/test_lufficc_SSD.py | jansel/pytorch-jit-paritybench | train | 35 |
a1de288b022ee14afe31d8e2879742af9fbc6dbd | [
"self.validate_parameters(orgnumber=orgnumber)\n_query_builder = Configuration.get_base_uri()\n_query_builder += '/information/signroles/rights'\n_query_parameters = {'orgnumber': orgnumber, 'countrycode': countrycode}\n_query_builder = APIHelper.append_url_with_query_parameters(_query_builder, _query_parameters, C... | <|body_start_0|>
self.validate_parameters(orgnumber=orgnumber)
_query_builder = Configuration.get_base_uri()
_query_builder += '/information/signroles/rights'
_query_parameters = {'orgnumber': orgnumber, 'countrycode': countrycode}
_query_builder = APIHelper.append_url_with_query... | A Controller to access Endpoints in the idfy_rest_client API. | SignatureRolesCheckController | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SignatureRolesCheckController:
"""A Controller to access Endpoints in the idfy_rest_client API."""
def get_rights(self, orgnumber, countrycode=None):
"""Does a GET request to /information/signroles/rights. Check which person(s) that has the right to sign documents in an organization.... | stack_v2_sparse_classes_10k_train_008407 | 6,412 | permissive | [
{
"docstring": "Does a GET request to /information/signroles/rights. Check which person(s) that has the right to sign documents in an organization. You will receive lists with names and date of birth for the persons allowed for signing / prokura. Args: orgnumber (string): TODO: type description here. Example: c... | 2 | stack_v2_sparse_classes_30k_train_006895 | Implement the Python class `SignatureRolesCheckController` described below.
Class description:
A Controller to access Endpoints in the idfy_rest_client API.
Method signatures and docstrings:
- def get_rights(self, orgnumber, countrycode=None): Does a GET request to /information/signroles/rights. Check which person(s)... | Implement the Python class `SignatureRolesCheckController` described below.
Class description:
A Controller to access Endpoints in the idfy_rest_client API.
Method signatures and docstrings:
- def get_rights(self, orgnumber, countrycode=None): Does a GET request to /information/signroles/rights. Check which person(s)... | fa3918a6c54ea0eedb9146578645b7eb1755b642 | <|skeleton|>
class SignatureRolesCheckController:
"""A Controller to access Endpoints in the idfy_rest_client API."""
def get_rights(self, orgnumber, countrycode=None):
"""Does a GET request to /information/signroles/rights. Check which person(s) that has the right to sign documents in an organization.... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SignatureRolesCheckController:
"""A Controller to access Endpoints in the idfy_rest_client API."""
def get_rights(self, orgnumber, countrycode=None):
"""Does a GET request to /information/signroles/rights. Check which person(s) that has the right to sign documents in an organization. You will rec... | the_stack_v2_python_sparse | idfy_rest_client/controllers/signature_roles_check_controller.py | dealflowteam/Idfy | train | 0 |
1dac0e13dc3c0201506d2b6a4fdc19dec076e3bd | [
"self.__screen = screen\nself.__dns = DNS()\nself.__hostnameLabel = Label('Hostname')\nself.__primaryDNSLabel = Label('Primary DNS')\nself.__secondaryDNSLabel = Label('Secondary DNS')\nself.__searchListLabel = Label('Search')\nself.__hostname = Entry(15, socket.gethostname())\nself.__primaryDNS = Entry(15, self.__d... | <|body_start_0|>
self.__screen = screen
self.__dns = DNS()
self.__hostnameLabel = Label('Hostname')
self.__primaryDNSLabel = Label('Primary DNS')
self.__secondaryDNSLabel = Label('Secondary DNS')
self.__searchListLabel = Label('Search')
self.__hostname = Entry(15,... | Represents the DNS configuration screen | DNSConfig | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DNSConfig:
"""Represents the DNS configuration screen"""
def __init__(self, screen):
"""Constructor @type screen: SnackScreen @param screen: SnackScreen instance"""
<|body_0|>
def __writeConfig(self):
"""Write configuration into the file @rtype: None @returns: no... | stack_v2_sparse_classes_10k_train_008408 | 2,694 | no_license | [
{
"docstring": "Constructor @type screen: SnackScreen @param screen: SnackScreen instance",
"name": "__init__",
"signature": "def __init__(self, screen)"
},
{
"docstring": "Write configuration into the file @rtype: None @returns: nothing",
"name": "__writeConfig",
"signature": "def __wri... | 3 | stack_v2_sparse_classes_30k_train_006337 | Implement the Python class `DNSConfig` described below.
Class description:
Represents the DNS configuration screen
Method signatures and docstrings:
- def __init__(self, screen): Constructor @type screen: SnackScreen @param screen: SnackScreen instance
- def __writeConfig(self): Write configuration into the file @rty... | Implement the Python class `DNSConfig` described below.
Class description:
Represents the DNS configuration screen
Method signatures and docstrings:
- def __init__(self, screen): Constructor @type screen: SnackScreen @param screen: SnackScreen instance
- def __writeConfig(self): Write configuration into the file @rty... | 1c738fd5e6ee3f8fd4f47acf2207038f20868212 | <|skeleton|>
class DNSConfig:
"""Represents the DNS configuration screen"""
def __init__(self, screen):
"""Constructor @type screen: SnackScreen @param screen: SnackScreen instance"""
<|body_0|>
def __writeConfig(self):
"""Write configuration into the file @rtype: None @returns: no... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DNSConfig:
"""Represents the DNS configuration screen"""
def __init__(self, screen):
"""Constructor @type screen: SnackScreen @param screen: SnackScreen instance"""
self.__screen = screen
self.__dns = DNS()
self.__hostnameLabel = Label('Hostname')
self.__primaryDNS... | the_stack_v2_python_sparse | zfrobisher-installer/src/ui/networkcfg/dnsconfig.py | fedosu85nce/work | train | 2 |
66a0e6b0271323cc100c788251c1907cbb03e11a | [
"current_user = get_jwt_identity()\nif current_user:\n user = User.query.filter_by(email=current_user).first()\n helpers.abort_if_unknown_user(user)\n projects = ProjectModel.query.filter(or_(ProjectModel.members.any(Membership.user_id == user.id), ProjectModel.is_public)).order_by(ProjectModel.id.desc()).... | <|body_start_0|>
current_user = get_jwt_identity()
if current_user:
user = User.query.filter_by(email=current_user).first()
helpers.abort_if_unknown_user(user)
projects = ProjectModel.query.filter(or_(ProjectModel.members.any(Membership.user_id == user.id), ProjectMod... | Mapped to: /api/projects/ | Projects | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Projects:
"""Mapped to: /api/projects/"""
def get():
"""The projects the JWT user is a member of, otherwise all public projects."""
<|body_0|>
def post(self):
"""CREATE a project where sessions can be created"""
<|body_1|>
<|end_skeleton|>
<|body_start_... | stack_v2_sparse_classes_10k_train_008409 | 3,609 | no_license | [
{
"docstring": "The projects the JWT user is a member of, otherwise all public projects.",
"name": "get",
"signature": "def get()"
},
{
"docstring": "CREATE a project where sessions can be created",
"name": "post",
"signature": "def post(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002162 | Implement the Python class `Projects` described below.
Class description:
Mapped to: /api/projects/
Method signatures and docstrings:
- def get(): The projects the JWT user is a member of, otherwise all public projects.
- def post(self): CREATE a project where sessions can be created | Implement the Python class `Projects` described below.
Class description:
Mapped to: /api/projects/
Method signatures and docstrings:
- def get(): The projects the JWT user is a member of, otherwise all public projects.
- def post(self): CREATE a project where sessions can be created
<|skeleton|>
class Projects:
... | 716fa5a6e905380cb206c57868e87556805f2b7f | <|skeleton|>
class Projects:
"""Mapped to: /api/projects/"""
def get():
"""The projects the JWT user is a member of, otherwise all public projects."""
<|body_0|>
def post(self):
"""CREATE a project where sessions can be created"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Projects:
"""Mapped to: /api/projects/"""
def get():
"""The projects the JWT user is a member of, otherwise all public projects."""
current_user = get_jwt_identity()
if current_user:
user = User.query.filter_by(email=current_user).first()
helpers.abort_if_u... | the_stack_v2_python_sparse | gabber/api/projects.py | joseplj/GabberAPI | train | 0 |
e1503bdc515cff30f2d36cedff0c87f37cd12b73 | [
"Bar.__init__(self, w, h)\nself.character = character\nself._colour = HP_GREEN",
"self._base.fill(DARK_PURPLE)\nratio = self.character.curr_hp / self.character.max_hp\nif ratio > 0.5:\n self._colour = HP_GREEN\nelif ratio < 0.2:\n self._colour = HP_RED\nelse:\n self._colour = HP_YELLOW\nnew_w = int(ratio... | <|body_start_0|>
Bar.__init__(self, w, h)
self.character = character
self._colour = HP_GREEN
<|end_body_0|>
<|body_start_1|>
self._base.fill(DARK_PURPLE)
ratio = self.character.curr_hp / self.character.max_hp
if ratio > 0.5:
self._colour = HP_GREEN
el... | Class for drawing health bars in a battle screen. | HPBar | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HPBar:
"""Class for drawing health bars in a battle screen."""
def __init__(self, w, h, character):
"""Class constructor for HP bars. args: character: Character object; specifies the character associated with the bar colour: colour tuple; colour of the bar"""
<|body_0|>
... | stack_v2_sparse_classes_10k_train_008410 | 3,427 | no_license | [
{
"docstring": "Class constructor for HP bars. args: character: Character object; specifies the character associated with the bar colour: colour tuple; colour of the bar",
"name": "__init__",
"signature": "def __init__(self, w, h, character)"
},
{
"docstring": "Updates the bar based on current H... | 2 | stack_v2_sparse_classes_30k_train_005185 | Implement the Python class `HPBar` described below.
Class description:
Class for drawing health bars in a battle screen.
Method signatures and docstrings:
- def __init__(self, w, h, character): Class constructor for HP bars. args: character: Character object; specifies the character associated with the bar colour: co... | Implement the Python class `HPBar` described below.
Class description:
Class for drawing health bars in a battle screen.
Method signatures and docstrings:
- def __init__(self, w, h, character): Class constructor for HP bars. args: character: Character object; specifies the character associated with the bar colour: co... | e86420c145c1d929649ac5d4c98a4d1b75e218a7 | <|skeleton|>
class HPBar:
"""Class for drawing health bars in a battle screen."""
def __init__(self, w, h, character):
"""Class constructor for HP bars. args: character: Character object; specifies the character associated with the bar colour: colour tuple; colour of the bar"""
<|body_0|>
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class HPBar:
"""Class for drawing health bars in a battle screen."""
def __init__(self, w, h, character):
"""Class constructor for HP bars. args: character: Character object; specifies the character associated with the bar colour: colour tuple; colour of the bar"""
Bar.__init__(self, w, h)
... | the_stack_v2_python_sparse | src/entities/bar.py | nuclearkittens/ot-projekti | train | 0 |
c5bf2ddf795239e47efce42fd9be9cd3513c06bd | [
"if not name:\n name = self.GetDefaultName()\nsuper(ResourceCache, self).__init__(name=name, create=create, version=VERSION)",
"path = [config.Paths().cache_dir]\naccount = properties.VALUES.core.account.Get(required=False)\nif account:\n path.append(account)\nfiles.MakeDir(os.path.join(*path))\npath.append... | <|body_start_0|>
if not name:
name = self.GetDefaultName()
super(ResourceCache, self).__init__(name=name, create=create, version=VERSION)
<|end_body_0|>
<|body_start_1|>
path = [config.Paths().cache_dir]
account = properties.VALUES.core.account.Get(required=False)
if... | A resource cache object. | ResourceCache | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResourceCache:
"""A resource cache object."""
def __init__(self, name=None, create=True):
"""ResourceCache constructor. Args: name: The persistent cache object name. If None then a default name conditioned on the account name is used. <GLOBAL_CONFIG_DIR>/cache/<ACCOUNT>/resource.cach... | stack_v2_sparse_classes_10k_train_008411 | 21,185 | permissive | [
{
"docstring": "ResourceCache constructor. Args: name: The persistent cache object name. If None then a default name conditioned on the account name is used. <GLOBAL_CONFIG_DIR>/cache/<ACCOUNT>/resource.cache create: Create the cache if it doesn't exist if True.",
"name": "__init__",
"signature": "def _... | 2 | null | Implement the Python class `ResourceCache` described below.
Class description:
A resource cache object.
Method signatures and docstrings:
- def __init__(self, name=None, create=True): ResourceCache constructor. Args: name: The persistent cache object name. If None then a default name conditioned on the account name i... | Implement the Python class `ResourceCache` described below.
Class description:
A resource cache object.
Method signatures and docstrings:
- def __init__(self, name=None, create=True): ResourceCache constructor. Args: name: The persistent cache object name. If None then a default name conditioned on the account name i... | 85bb264e273568b5a0408f733b403c56373e2508 | <|skeleton|>
class ResourceCache:
"""A resource cache object."""
def __init__(self, name=None, create=True):
"""ResourceCache constructor. Args: name: The persistent cache object name. If None then a default name conditioned on the account name is used. <GLOBAL_CONFIG_DIR>/cache/<ACCOUNT>/resource.cach... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ResourceCache:
"""A resource cache object."""
def __init__(self, name=None, create=True):
"""ResourceCache constructor. Args: name: The persistent cache object name. If None then a default name conditioned on the account name is used. <GLOBAL_CONFIG_DIR>/cache/<ACCOUNT>/resource.cache create: Cre... | the_stack_v2_python_sparse | google-cloud-sdk/lib/googlecloudsdk/core/cache/resource_cache.py | bopopescu/socialliteapp | train | 0 |
5ebefc01e80cdd571928bceeb277005ef622e265 | [
"data_dict = json.loads(request.data)\nvalidator.validate(data_dict, validator.USER)\nuser = user_controller.register(data_dict)\nuser_dto = user_schema.serialize_user(user)\nresponse = Response(response=json.dumps(user_dto), status=201, mimetype='application/json')\nreturn response",
"user = user_controller.get_... | <|body_start_0|>
data_dict = json.loads(request.data)
validator.validate(data_dict, validator.USER)
user = user_controller.register(data_dict)
user_dto = user_schema.serialize_user(user)
response = Response(response=json.dumps(user_dto), status=201, mimetype='application/json')
... | UserResource | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserResource:
def post(self):
"""Register a new user"""
<|body_0|>
def get(self, user_id):
"""Get a user"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
data_dict = json.loads(request.data)
validator.validate(data_dict, validator.USER)
... | stack_v2_sparse_classes_10k_train_008412 | 4,871 | no_license | [
{
"docstring": "Register a new user",
"name": "post",
"signature": "def post(self)"
},
{
"docstring": "Get a user",
"name": "get",
"signature": "def get(self, user_id)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000197 | Implement the Python class `UserResource` described below.
Class description:
Implement the UserResource class.
Method signatures and docstrings:
- def post(self): Register a new user
- def get(self, user_id): Get a user | Implement the Python class `UserResource` described below.
Class description:
Implement the UserResource class.
Method signatures and docstrings:
- def post(self): Register a new user
- def get(self, user_id): Get a user
<|skeleton|>
class UserResource:
def post(self):
"""Register a new user"""
... | e0c8ea99886f10aea14b9ca95af8a4f42f2af493 | <|skeleton|>
class UserResource:
def post(self):
"""Register a new user"""
<|body_0|>
def get(self, user_id):
"""Get a user"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class UserResource:
def post(self):
"""Register a new user"""
data_dict = json.loads(request.data)
validator.validate(data_dict, validator.USER)
user = user_controller.register(data_dict)
user_dto = user_schema.serialize_user(user)
response = Response(response=json.du... | the_stack_v2_python_sparse | imdb_api/resources/user_resources.py | Matiasmoratti7/imdb | train | 0 | |
b60734479f1c0cb2ccbcb23571f67dd1c408a627 | [
"if hasattr(self.survey_record, 'grade'):\n grade = self.survey_record.grade\nvals_grade = {True: 'pass', False: 'fail'}\nself.data['grade'] = vals_grade.get(grade, None) or grade\nreturn super(GradeSurveyRecordForm, self).getFields(*args)",
"fields = super(GradeSurveyRecordForm, self).insertFields()\ngrade_ch... | <|body_start_0|>
if hasattr(self.survey_record, 'grade'):
grade = self.survey_record.grade
vals_grade = {True: 'pass', False: 'fail'}
self.data['grade'] = vals_grade.get(grade, None) or grade
return super(GradeSurveyRecordForm, self).getFields(*args)
<|end_body_0|>
<|body_st... | RecordForm for the GradeSurveyTakeForm. | GradeSurveyRecordForm | [
"Apache-2.0",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GradeSurveyRecordForm:
"""RecordForm for the GradeSurveyTakeForm."""
def getFields(self, *args):
"""Add the extra grade field's value from survey_record."""
<|body_0|>
def insertFields(self):
"""Add ordered fields to self.fields, add grade field with grade choice... | stack_v2_sparse_classes_10k_train_008413 | 9,757 | permissive | [
{
"docstring": "Add the extra grade field's value from survey_record.",
"name": "getFields",
"signature": "def getFields(self, *args)"
},
{
"docstring": "Add ordered fields to self.fields, add grade field with grade choices.",
"name": "insertFields",
"signature": "def insertFields(self)"... | 2 | null | Implement the Python class `GradeSurveyRecordForm` described below.
Class description:
RecordForm for the GradeSurveyTakeForm.
Method signatures and docstrings:
- def getFields(self, *args): Add the extra grade field's value from survey_record.
- def insertFields(self): Add ordered fields to self.fields, add grade fi... | Implement the Python class `GradeSurveyRecordForm` described below.
Class description:
RecordForm for the GradeSurveyTakeForm.
Method signatures and docstrings:
- def getFields(self, *args): Add the extra grade field's value from survey_record.
- def insertFields(self): Add ordered fields to self.fields, add grade fi... | 9bd45c168f8ddb5c0e6c04eacdcaeafd61908be7 | <|skeleton|>
class GradeSurveyRecordForm:
"""RecordForm for the GradeSurveyTakeForm."""
def getFields(self, *args):
"""Add the extra grade field's value from survey_record."""
<|body_0|>
def insertFields(self):
"""Add ordered fields to self.fields, add grade field with grade choice... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GradeSurveyRecordForm:
"""RecordForm for the GradeSurveyTakeForm."""
def getFields(self, *args):
"""Add the extra grade field's value from survey_record."""
if hasattr(self.survey_record, 'grade'):
grade = self.survey_record.grade
vals_grade = {True: 'pass', False: 'fa... | the_stack_v2_python_sparse | app/soc/modules/gsoc/views/models/grading_project_survey.py | pombredanne/Melange-1 | train | 0 |
cbd1743975b57d28dc5f6e2395d5fa06232d3228 | [
"gs = GameState.singleton()\nself.gs = gs\ngs.nickname = input('For multiplayer game, enter your nickname (default is single player):')\nif gs.nickname:\n gs.multiplayer = True\n while True:\n new_color_text = input(f\"Choose a color code ({', '.join(list(gs.colors()))}) (default is w):\")\n if ... | <|body_start_0|>
gs = GameState.singleton()
self.gs = gs
gs.nickname = input('For multiplayer game, enter your nickname (default is single player):')
if gs.nickname:
gs.multiplayer = True
while True:
new_color_text = input(f"Choose a color code ({'... | Manager for pygame | Game | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Game:
"""Manager for pygame"""
def __init__(self, maze_filename, host, port):
"""Initialize the game manager object. Arguments: maze_filename - name of human readable/writable text file containing the maze definition for use in single player mode"""
<|body_0|>
def play(s... | stack_v2_sparse_classes_10k_train_008414 | 3,509 | no_license | [
{
"docstring": "Initialize the game manager object. Arguments: maze_filename - name of human readable/writable text file containing the maze definition for use in single player mode",
"name": "__init__",
"signature": "def __init__(self, maze_filename, host, port)"
},
{
"docstring": "Main game lo... | 3 | stack_v2_sparse_classes_30k_test_000401 | Implement the Python class `Game` described below.
Class description:
Manager for pygame
Method signatures and docstrings:
- def __init__(self, maze_filename, host, port): Initialize the game manager object. Arguments: maze_filename - name of human readable/writable text file containing the maze definition for use in... | Implement the Python class `Game` described below.
Class description:
Manager for pygame
Method signatures and docstrings:
- def __init__(self, maze_filename, host, port): Initialize the game manager object. Arguments: maze_filename - name of human readable/writable text file containing the maze definition for use in... | 7e04ab7158f2c06c1d91962049578407400e944a | <|skeleton|>
class Game:
"""Manager for pygame"""
def __init__(self, maze_filename, host, port):
"""Initialize the game manager object. Arguments: maze_filename - name of human readable/writable text file containing the maze definition for use in single player mode"""
<|body_0|>
def play(s... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Game:
"""Manager for pygame"""
def __init__(self, maze_filename, host, port):
"""Initialize the game manager object. Arguments: maze_filename - name of human readable/writable text file containing the maze definition for use in single player mode"""
gs = GameState.singleton()
self... | the_stack_v2_python_sparse | Game.py | jonlmiller/pymaze | train | 0 |
f6e07f0dbdac9a8738a62930ed70d1e58feaebca | [
"self.lect = dialect\nself.recon = reconstruction\nself.root = LATIN[self.lect][self.recon]\nself.table = self.root['correspondence']\nself.diphs = self.root['diphthongs']\nself.punc = self.root['punctuation']\nself.macronizer = m.Macronizer('tag_ngram_123_backoff')",
"out = chars.base(ch).lower()\nlength = chars... | <|body_start_0|>
self.lect = dialect
self.recon = reconstruction
self.root = LATIN[self.lect][self.recon]
self.table = self.root['correspondence']
self.diphs = self.root['diphthongs']
self.punc = self.root['punctuation']
self.macronizer = m.Macronizer('tag_ngram_1... | Uses a reconstruction to transcribe a orthographic string into IPA. | Transcriber | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Transcriber:
"""Uses a reconstruction to transcribe a orthographic string into IPA."""
def __init__(self, dialect: str, reconstruction: str):
""":param dialect: Latin dialect :param reconstruction: reconstruction method"""
<|body_0|>
def _parse_diacritics(self, ch: str) ... | stack_v2_sparse_classes_10k_train_008415 | 25,882 | permissive | [
{
"docstring": ":param dialect: Latin dialect :param reconstruction: reconstruction method",
"name": "__init__",
"signature": "def __init__(self, dialect: str, reconstruction: str)"
},
{
"docstring": "EG: input with base a -> a/LENGTH/DIAERESIS/ :param ch: character :return: a string with separa... | 4 | stack_v2_sparse_classes_30k_train_003949 | Implement the Python class `Transcriber` described below.
Class description:
Uses a reconstruction to transcribe a orthographic string into IPA.
Method signatures and docstrings:
- def __init__(self, dialect: str, reconstruction: str): :param dialect: Latin dialect :param reconstruction: reconstruction method
- def _... | Implement the Python class `Transcriber` described below.
Class description:
Uses a reconstruction to transcribe a orthographic string into IPA.
Method signatures and docstrings:
- def __init__(self, dialect: str, reconstruction: str): :param dialect: Latin dialect :param reconstruction: reconstruction method
- def _... | 8a122113d2509aef85bebba8e2c303471c107ff4 | <|skeleton|>
class Transcriber:
"""Uses a reconstruction to transcribe a orthographic string into IPA."""
def __init__(self, dialect: str, reconstruction: str):
""":param dialect: Latin dialect :param reconstruction: reconstruction method"""
<|body_0|>
def _parse_diacritics(self, ch: str) ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Transcriber:
"""Uses a reconstruction to transcribe a orthographic string into IPA."""
def __init__(self, dialect: str, reconstruction: str):
""":param dialect: Latin dialect :param reconstruction: reconstruction method"""
self.lect = dialect
self.recon = reconstruction
se... | the_stack_v2_python_sparse | src/cltk/phonology/lat/transcription.py | cltk/cltk | train | 847 |
3338c146779a475893c9cc89ce3d8e9dbd3ca209 | [
"data_indices = output_dict['data_idx']\npred_logits = output_dict['logits']\npred_class_idxs = torch.argmax(pred_logits, dim=-1)\npredictions = {self._dataset.get_id(data_idx.item()): {'class_idx': pred_class_idx.item()} for data_idx, pred_class_idx in zip(list(data_indices.data), list(pred_class_idxs.data))}\nret... | <|body_start_0|>
data_indices = output_dict['data_idx']
pred_logits = output_dict['logits']
pred_class_idxs = torch.argmax(pred_logits, dim=-1)
predictions = {self._dataset.get_id(data_idx.item()): {'class_idx': pred_class_idx.item()} for data_idx, pred_class_idx in zip(list(data_indices... | Sequence Classification Mixin Class | SequenceClassification | [
"MIT",
"Apache-2.0",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SequenceClassification:
"""Sequence Classification Mixin Class"""
def make_predictions(self, output_dict):
"""Make predictions with model's output_dict * Args: output_dict: model's output dictionary consisting of - sequence_embed: embedding vector of the sequence - logits: representi... | stack_v2_sparse_classes_10k_train_008416 | 6,557 | permissive | [
{
"docstring": "Make predictions with model's output_dict * Args: output_dict: model's output dictionary consisting of - sequence_embed: embedding vector of the sequence - logits: representing unnormalized log probabilities of the class - class_idx: target class idx - data_idx: data idx - loss: a scalar loss to... | 5 | stack_v2_sparse_classes_30k_train_001847 | Implement the Python class `SequenceClassification` described below.
Class description:
Sequence Classification Mixin Class
Method signatures and docstrings:
- def make_predictions(self, output_dict): Make predictions with model's output_dict * Args: output_dict: model's output dictionary consisting of - sequence_emb... | Implement the Python class `SequenceClassification` described below.
Class description:
Sequence Classification Mixin Class
Method signatures and docstrings:
- def make_predictions(self, output_dict): Make predictions with model's output_dict * Args: output_dict: model's output dictionary consisting of - sequence_emb... | 89b3e5c5ec0486886876ea3bac381508c6a6bf58 | <|skeleton|>
class SequenceClassification:
"""Sequence Classification Mixin Class"""
def make_predictions(self, output_dict):
"""Make predictions with model's output_dict * Args: output_dict: model's output dictionary consisting of - sequence_embed: embedding vector of the sequence - logits: representi... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SequenceClassification:
"""Sequence Classification Mixin Class"""
def make_predictions(self, output_dict):
"""Make predictions with model's output_dict * Args: output_dict: model's output dictionary consisting of - sequence_embed: embedding vector of the sequence - logits: representing unnormaliz... | the_stack_v2_python_sparse | claf/model/sequence_classification/mixin.py | srlee-ai/claf | train | 0 |
5a48304f499ede37fd6566713c351806ebb8f96a | [
"size = int(request.GET.get('size', 15))\npage = int(request.GET.get('page', 0))\npats_list = patient_svc.get_infolist()\ntotalelements = len(pats_list)\nif totalelements == 0:\n return ResponseDto(success=False, message='数据库无数据')\ntotalpages = int(math.ceil(float(totalelements) / float(size)))\ntotalpatients = ... | <|body_start_0|>
size = int(request.GET.get('size', 15))
page = int(request.GET.get('page', 0))
pats_list = patient_svc.get_infolist()
totalelements = len(pats_list)
if totalelements == 0:
return ResponseDto(success=False, message='数据库无数据')
totalpages = int(ma... | Patient | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Patient:
def get(self, request):
"""provide patients information list :param size:the number of data on the current page :param page:current page :return: information list"""
<|body_0|>
def delete(self, request):
"""provide patients information list :param size:the n... | stack_v2_sparse_classes_10k_train_008417 | 2,554 | no_license | [
{
"docstring": "provide patients information list :param size:the number of data on the current page :param page:current page :return: information list",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "provide patients information list :param size:the number of data on th... | 2 | stack_v2_sparse_classes_30k_train_006322 | Implement the Python class `Patient` described below.
Class description:
Implement the Patient class.
Method signatures and docstrings:
- def get(self, request): provide patients information list :param size:the number of data on the current page :param page:current page :return: information list
- def delete(self, r... | Implement the Python class `Patient` described below.
Class description:
Implement the Patient class.
Method signatures and docstrings:
- def get(self, request): provide patients information list :param size:the number of data on the current page :param page:current page :return: information list
- def delete(self, r... | d3206f29d37735b5cc393744faaa55295fe7d6b1 | <|skeleton|>
class Patient:
def get(self, request):
"""provide patients information list :param size:the number of data on the current page :param page:current page :return: information list"""
<|body_0|>
def delete(self, request):
"""provide patients information list :param size:the n... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Patient:
def get(self, request):
"""provide patients information list :param size:the number of data on the current page :param page:current page :return: information list"""
size = int(request.GET.get('size', 15))
page = int(request.GET.get('page', 0))
pats_list = patient_svc.... | the_stack_v2_python_sparse | back_end/apps/patient/views.py | yongweili1/portal | train | 0 | |
e49fa94a3b9a59cf82ec296590b2156bf9e74624 | [
"self.username = ''\nself.password = ''\nself.baseUrl = 'http://{0}:{1}/'.format(hostname, port)",
"api = self.baseUrl + 'init'\ntry:\n return self._http_request(api, 'GET', timeout=30)\nexcept ServerUnavailableException:\n print('Dashboard is not available... bypassing.')\n return (False, None)",
"api... | <|body_start_0|>
self.username = ''
self.password = ''
self.baseUrl = 'http://{0}:{1}/'.format(hostname, port)
<|end_body_0|>
<|body_start_1|>
api = self.baseUrl + 'init'
try:
return self._http_request(api, 'GET', timeout=30)
except ServerUnavailableException... | Performance dashboard (cbkarma) REST API | CbKarmaClient | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CbKarmaClient:
"""Performance dashboard (cbkarma) REST API"""
def __init__(self, hostname, port='80'):
"""Create REST API client. Keyword arguments: hostname -- dashboard hostname/ip address port -- dashboard port"""
<|body_0|>
def init(self):
"""Get initial test... | stack_v2_sparse_classes_10k_train_008418 | 2,862 | permissive | [
{
"docstring": "Create REST API client. Keyword arguments: hostname -- dashboard hostname/ip address port -- dashboard port",
"name": "__init__",
"signature": "def __init__(self, hostname, port='80')"
},
{
"docstring": "Get initial test id (optional)",
"name": "init",
"signature": "def i... | 5 | null | Implement the Python class `CbKarmaClient` described below.
Class description:
Performance dashboard (cbkarma) REST API
Method signatures and docstrings:
- def __init__(self, hostname, port='80'): Create REST API client. Keyword arguments: hostname -- dashboard hostname/ip address port -- dashboard port
- def init(se... | Implement the Python class `CbKarmaClient` described below.
Class description:
Performance dashboard (cbkarma) REST API
Method signatures and docstrings:
- def __init__(self, hostname, port='80'): Create REST API client. Keyword arguments: hostname -- dashboard hostname/ip address port -- dashboard port
- def init(se... | 9d8220a0925327bddf0e10887e22b57c5d6adb37 | <|skeleton|>
class CbKarmaClient:
"""Performance dashboard (cbkarma) REST API"""
def __init__(self, hostname, port='80'):
"""Create REST API client. Keyword arguments: hostname -- dashboard hostname/ip address port -- dashboard port"""
<|body_0|>
def init(self):
"""Get initial test... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CbKarmaClient:
"""Performance dashboard (cbkarma) REST API"""
def __init__(self, hostname, port='80'):
"""Create REST API client. Keyword arguments: hostname -- dashboard hostname/ip address port -- dashboard port"""
self.username = ''
self.password = ''
self.baseUrl = 'ht... | the_stack_v2_python_sparse | lib/cbkarma/rest_client.py | couchbase/testrunner | train | 18 |
40f1eab4a770acfd7045bd836ae6533f061e3c66 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"conte... | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | ImageService defines the public APIs for managing images. | ImageServiceServicer | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImageServiceServicer:
"""ImageService defines the public APIs for managing images."""
def ListImages(self, request, context):
"""ListImages lists existing images."""
<|body_0|>
def ImageStatus(self, request, context):
"""ImageStatus returns the status of the imag... | stack_v2_sparse_classes_10k_train_008419 | 45,927 | permissive | [
{
"docstring": "ListImages lists existing images.",
"name": "ListImages",
"signature": "def ListImages(self, request, context)"
},
{
"docstring": "ImageStatus returns the status of the image. If the image is not present, returns a response with ImageStatusResponse.Image set to nil.",
"name":... | 5 | null | Implement the Python class `ImageServiceServicer` described below.
Class description:
ImageService defines the public APIs for managing images.
Method signatures and docstrings:
- def ListImages(self, request, context): ListImages lists existing images.
- def ImageStatus(self, request, context): ImageStatus returns t... | Implement the Python class `ImageServiceServicer` described below.
Class description:
ImageService defines the public APIs for managing images.
Method signatures and docstrings:
- def ListImages(self, request, context): ListImages lists existing images.
- def ImageStatus(self, request, context): ImageStatus returns t... | f825fde287f4eb2089aba2225ca73eeab3888040 | <|skeleton|>
class ImageServiceServicer:
"""ImageService defines the public APIs for managing images."""
def ListImages(self, request, context):
"""ListImages lists existing images."""
<|body_0|>
def ImageStatus(self, request, context):
"""ImageStatus returns the status of the imag... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ImageServiceServicer:
"""ImageService defines the public APIs for managing images."""
def ListImages(self, request, context):
"""ListImages lists existing images."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImp... | the_stack_v2_python_sparse | src/nodemgr/common/cri/api_pb2_grpc.py | tungstenfabric/tf-controller | train | 55 |
1a3c6dab9834b6741d8ae7f1456ba33c448ede51 | [
"self.dimensional_split = True\nself.transverse_waves = self.trans_cor\nself.num_dim = 3\nself.reflect_index = [1, 2, 3]\nself.aux1 = None\nself.aux2 = None\nself.aux3 = None\nself.work = None\nsuper(ClawSolver3D, self).__init__(riemann_solver, claw_package)",
"import numpy as np\nstate = solution.states[0]\nnum_... | <|body_start_0|>
self.dimensional_split = True
self.transverse_waves = self.trans_cor
self.num_dim = 3
self.reflect_index = [1, 2, 3]
self.aux1 = None
self.aux2 = None
self.aux3 = None
self.work = None
super(ClawSolver3D, self).__init__(riemann_sol... | 3D Classic (Clawpack) solver. Solve using the wave propagation algorithms of Randy LeVeque's Clawpack code (www.clawpack.org). In addition to the attributes of ClawSolver, ClawSolver3D also has the following options: .. attribute:: dimensional_split If True, use dimensional splitting (Godunov splitting). Dimensional sp... | ClawSolver3D | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClawSolver3D:
"""3D Classic (Clawpack) solver. Solve using the wave propagation algorithms of Randy LeVeque's Clawpack code (www.clawpack.org). In addition to the attributes of ClawSolver, ClawSolver3D also has the following options: .. attribute:: dimensional_split If True, use dimensional split... | stack_v2_sparse_classes_10k_train_008420 | 26,748 | permissive | [
{
"docstring": "Create 3d Clawpack solver See :class:`ClawSolver3D` for more info.",
"name": "__init__",
"signature": "def __init__(self, riemann_solver=None, claw_package=None)"
},
{
"docstring": "Allocate auxN and work arrays for use in Fortran subroutines.",
"name": "_allocate_workspace",... | 3 | stack_v2_sparse_classes_30k_train_000894 | Implement the Python class `ClawSolver3D` described below.
Class description:
3D Classic (Clawpack) solver. Solve using the wave propagation algorithms of Randy LeVeque's Clawpack code (www.clawpack.org). In addition to the attributes of ClawSolver, ClawSolver3D also has the following options: .. attribute:: dimension... | Implement the Python class `ClawSolver3D` described below.
Class description:
3D Classic (Clawpack) solver. Solve using the wave propagation algorithms of Randy LeVeque's Clawpack code (www.clawpack.org). In addition to the attributes of ClawSolver, ClawSolver3D also has the following options: .. attribute:: dimension... | 6323b7295b80f33285b958b1a2144f88f51be4b1 | <|skeleton|>
class ClawSolver3D:
"""3D Classic (Clawpack) solver. Solve using the wave propagation algorithms of Randy LeVeque's Clawpack code (www.clawpack.org). In addition to the attributes of ClawSolver, ClawSolver3D also has the following options: .. attribute:: dimensional_split If True, use dimensional split... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ClawSolver3D:
"""3D Classic (Clawpack) solver. Solve using the wave propagation algorithms of Randy LeVeque's Clawpack code (www.clawpack.org). In addition to the attributes of ClawSolver, ClawSolver3D also has the following options: .. attribute:: dimensional_split If True, use dimensional splitting (Godunov... | the_stack_v2_python_sparse | src/pyclaw/classic/solver.py | clawpack/pyclaw | train | 124 |
a72f8deb2bf1f0cf1efe6940c0a8cd5ac776836a | [
"super().__init__()\ntickers = tickers if tickers is not None else []\nif isinstance(tickers, list):\n self._tickers = tickers\nelse:\n self._tickers = tickers.replace('\\n', ';').split(';')\nself._n = len(self._tickers)\nif stockmarket not in [StockMarket.NASDAQ, StockMarket.NYSE]:\n msg = 'WikipediaDataP... | <|body_start_0|>
super().__init__()
tickers = tickers if tickers is not None else []
if isinstance(tickers, list):
self._tickers = tickers
else:
self._tickers = tickers.replace('\n', ';').split(';')
self._n = len(self._tickers)
if stockmarket not i... | Python implementation of a Wikipedia data provider. Please see: https://github.com/Qiskit/qiskit-tutorials/qiskit/finance/data_providers/time_series.ipynb for instructions on use. | WikipediaDataProvider | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WikipediaDataProvider:
"""Python implementation of a Wikipedia data provider. Please see: https://github.com/Qiskit/qiskit-tutorials/qiskit/finance/data_providers/time_series.ipynb for instructions on use."""
def __init__(self, token: Optional[str]=None, tickers: Optional[Union[str, List[str... | stack_v2_sparse_classes_10k_train_008421 | 4,296 | permissive | [
{
"docstring": "Initializer Args: token: quandl access token, which is not needed, strictly speaking tickers: tickers stockmarket: NASDAQ, NYSE start: start time end: end time Raises: QiskitFinanceError: provider doesn't support stock market input",
"name": "__init__",
"signature": "def __init__(self, t... | 3 | stack_v2_sparse_classes_30k_train_004842 | Implement the Python class `WikipediaDataProvider` described below.
Class description:
Python implementation of a Wikipedia data provider. Please see: https://github.com/Qiskit/qiskit-tutorials/qiskit/finance/data_providers/time_series.ipynb for instructions on use.
Method signatures and docstrings:
- def __init__(se... | Implement the Python class `WikipediaDataProvider` described below.
Class description:
Python implementation of a Wikipedia data provider. Please see: https://github.com/Qiskit/qiskit-tutorials/qiskit/finance/data_providers/time_series.ipynb for instructions on use.
Method signatures and docstrings:
- def __init__(se... | e13f66eda6d8b819a6f132319a2bac819941f6b1 | <|skeleton|>
class WikipediaDataProvider:
"""Python implementation of a Wikipedia data provider. Please see: https://github.com/Qiskit/qiskit-tutorials/qiskit/finance/data_providers/time_series.ipynb for instructions on use."""
def __init__(self, token: Optional[str]=None, tickers: Optional[Union[str, List[str... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class WikipediaDataProvider:
"""Python implementation of a Wikipedia data provider. Please see: https://github.com/Qiskit/qiskit-tutorials/qiskit/finance/data_providers/time_series.ipynb for instructions on use."""
def __init__(self, token: Optional[str]=None, tickers: Optional[Union[str, List[str]]]=None, sto... | the_stack_v2_python_sparse | qiskit/finance/data_providers/wikipedia_data_provider.py | Unathi-Skosana/qiskit-aqua | train | 2 |
0a2b8318c408ade9c01639129d4bdf4b9e82fe1f | [
"super(Decoder, self).__init__()\nself.N = N\nself.dm = dm\nself.embedding = tf.keras.layers.Embedding(target_vocab, dm)\nself.positional_encoding = positional_encoding(max_seq_len, dm)\nself.blocks = [DecoderBlock(dm, h, hidden, drop_rate) for i in range(N)]\nself.dropout = tf.keras.layers.Dropout(drop_rate)",
"... | <|body_start_0|>
super(Decoder, self).__init__()
self.N = N
self.dm = dm
self.embedding = tf.keras.layers.Embedding(target_vocab, dm)
self.positional_encoding = positional_encoding(max_seq_len, dm)
self.blocks = [DecoderBlock(dm, h, hidden, drop_rate) for i in range(N)]
... | create the decoder for a transformer | Decoder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Decoder:
"""create the decoder for a transformer"""
def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1):
"""N - the number of blocks in the encoder dm - the dimensionality of the model h - the number of heads hidden - the number of hidden units in the fully... | stack_v2_sparse_classes_10k_train_008422 | 3,024 | no_license | [
{
"docstring": "N - the number of blocks in the encoder dm - the dimensionality of the model h - the number of heads hidden - the number of hidden units in the fully connected layer target_vocab - the size of the target vocabulary max_seq_len - the maximum sequence length possible drop_rate - the dropout rate p... | 2 | stack_v2_sparse_classes_30k_train_006418 | Implement the Python class `Decoder` described below.
Class description:
create the decoder for a transformer
Method signatures and docstrings:
- def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): N - the number of blocks in the encoder dm - the dimensionality of the model h - the number ... | Implement the Python class `Decoder` described below.
Class description:
create the decoder for a transformer
Method signatures and docstrings:
- def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): N - the number of blocks in the encoder dm - the dimensionality of the model h - the number ... | e10b4e9b6f3fa00639e6e9e5b35f0cdb43a339a3 | <|skeleton|>
class Decoder:
"""create the decoder for a transformer"""
def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1):
"""N - the number of blocks in the encoder dm - the dimensionality of the model h - the number of heads hidden - the number of hidden units in the fully... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Decoder:
"""create the decoder for a transformer"""
def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1):
"""N - the number of blocks in the encoder dm - the dimensionality of the model h - the number of heads hidden - the number of hidden units in the fully connected la... | the_stack_v2_python_sparse | supervised_learning/0x11-attention/10-transformer_decoder.py | HeimerR/holbertonschool-machine_learning | train | 0 |
9e3d71ddc7f793801739392fb6fd5de9d5bfc673 | [
"COMPONENTS_AND_WEIGHTS = [(Heuristics.upper_lower_ratio, 0.01), (Heuristics.longest_repeat, 5), (Heuristics.occurrences('vote'), 10), (Heuristics.occurrences('lol'), 100), (Heuristics.length(comments=1, questions=20, answers=20), 1)]\nscore = 0\nfor pair in COMPONENTS_AND_WEIGHTS:\n fnc, weight = pair\n scor... | <|body_start_0|>
COMPONENTS_AND_WEIGHTS = [(Heuristics.upper_lower_ratio, 0.01), (Heuristics.longest_repeat, 5), (Heuristics.occurrences('vote'), 10), (Heuristics.occurrences('lol'), 100), (Heuristics.length(comments=1, questions=20, answers=20), 1)]
score = 0
for pair in COMPONENTS_AND_WEIGHTS:... | Hold functions that automatically classify a discussion entity's low-quality measure using heuristics when it is posted to the site. New heuristics can be added in get_low_quality_score(). | Heuristics | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Heuristics:
"""Hold functions that automatically classify a discussion entity's low-quality measure using heuristics when it is posted to the site. New heuristics can be added in get_low_quality_score()."""
def get_low_quality_score(text, feedback_type):
"""Combine a variety of heuri... | stack_v2_sparse_classes_10k_train_008423 | 27,291 | no_license | [
{
"docstring": "Combine a variety of heuristics to make a low-quality score. High scores signify lower-quality posts. Value's range: (0, inf).",
"name": "get_low_quality_score",
"signature": "def get_low_quality_score(text, feedback_type)"
},
{
"docstring": "Find the difference between the upper... | 5 | null | Implement the Python class `Heuristics` described below.
Class description:
Hold functions that automatically classify a discussion entity's low-quality measure using heuristics when it is posted to the site. New heuristics can be added in get_low_quality_score().
Method signatures and docstrings:
- def get_low_quali... | Implement the Python class `Heuristics` described below.
Class description:
Hold functions that automatically classify a discussion entity's low-quality measure using heuristics when it is posted to the site. New heuristics can be added in get_low_quality_score().
Method signatures and docstrings:
- def get_low_quali... | c6a3907d96d30f1cb43bf7bf2a392ff3e77a2568 | <|skeleton|>
class Heuristics:
"""Hold functions that automatically classify a discussion entity's low-quality measure using heuristics when it is posted to the site. New heuristics can be added in get_low_quality_score()."""
def get_low_quality_score(text, feedback_type):
"""Combine a variety of heuri... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Heuristics:
"""Hold functions that automatically classify a discussion entity's low-quality measure using heuristics when it is posted to the site. New heuristics can be added in get_low_quality_score()."""
def get_low_quality_score(text, feedback_type):
"""Combine a variety of heuristics to make... | the_stack_v2_python_sparse | discussion/discussion_models.py | PerceptumNL/KhanLatest | train | 3 |
79d23678a5920cced12ab90bb570cd4637464ceb | [
"for rec in self:\n if rec.container_id and rec.billing_type:\n if rec.billing_type == 'weight':\n if rec.container_id.weight < rec.weight:\n raise ValidationError('The weight is must be less than or equal to %s' % rec.container_id.weight)",
"for rec in self:\n if rec.contai... | <|body_start_0|>
for rec in self:
if rec.container_id and rec.billing_type:
if rec.billing_type == 'weight':
if rec.container_id.weight < rec.weight:
raise ValidationError('The weight is must be less than or equal to %s' % rec.container_id.... | FreightOrderLine | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FreightOrderLine:
def _check_weight(self):
"""Checking the weight of containers"""
<|body_0|>
def _check_volume(self):
"""Checking the volume of containers"""
<|body_1|>
def onchange_price(self):
"""Calculate the weight and volume of container"""... | stack_v2_sparse_classes_10k_train_008424 | 22,800 | no_license | [
{
"docstring": "Checking the weight of containers",
"name": "_check_weight",
"signature": "def _check_weight(self)"
},
{
"docstring": "Checking the volume of containers",
"name": "_check_volume",
"signature": "def _check_volume(self)"
},
{
"docstring": "Calculate the weight and v... | 4 | null | Implement the Python class `FreightOrderLine` described below.
Class description:
Implement the FreightOrderLine class.
Method signatures and docstrings:
- def _check_weight(self): Checking the weight of containers
- def _check_volume(self): Checking the volume of containers
- def onchange_price(self): Calculate the ... | Implement the Python class `FreightOrderLine` described below.
Class description:
Implement the FreightOrderLine class.
Method signatures and docstrings:
- def _check_weight(self): Checking the weight of containers
- def _check_volume(self): Checking the volume of containers
- def onchange_price(self): Calculate the ... | 4b1bcb8f17aad44fe9c80a8180eb0128e6bb2c14 | <|skeleton|>
class FreightOrderLine:
def _check_weight(self):
"""Checking the weight of containers"""
<|body_0|>
def _check_volume(self):
"""Checking the volume of containers"""
<|body_1|>
def onchange_price(self):
"""Calculate the weight and volume of container"""... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FreightOrderLine:
def _check_weight(self):
"""Checking the weight of containers"""
for rec in self:
if rec.container_id and rec.billing_type:
if rec.billing_type == 'weight':
if rec.container_id.weight < rec.weight:
raise ... | the_stack_v2_python_sparse | freight_management_system/model/freight_order.py | CybroOdoo/CybroAddons | train | 209 | |
4bca3d154293c09970035725a214dbddc7362607 | [
"self.measurements = []\nif self.data.get('level_measurement', None):\n for measurement in self.data['level_measurement']:\n if not measurement['time']:\n return\n obj = WellLevelMeasurement.objects.get(id=measurement['id']) if measurement['id'] else WellLevelMeasurement()\n self.... | <|body_start_0|>
self.measurements = []
if self.data.get('level_measurement', None):
for measurement in self.data['level_measurement']:
if not measurement['time']:
return
obj = WellLevelMeasurement.objects.get(id=measurement['id']) if measu... | Collection form for general information section | LevelMeasurementCreateForm | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LevelMeasurementCreateForm:
"""Collection form for general information section"""
def create(self):
"""create form from data"""
<|body_0|>
def save(self):
"""save all available data"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.measuremen... | stack_v2_sparse_classes_10k_train_008425 | 2,015 | no_license | [
{
"docstring": "create form from data",
"name": "create",
"signature": "def create(self)"
},
{
"docstring": "save all available data",
"name": "save",
"signature": "def save(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003366 | Implement the Python class `LevelMeasurementCreateForm` described below.
Class description:
Collection form for general information section
Method signatures and docstrings:
- def create(self): create form from data
- def save(self): save all available data | Implement the Python class `LevelMeasurementCreateForm` described below.
Class description:
Collection form for general information section
Method signatures and docstrings:
- def create(self): create form from data
- def save(self): save all available data
<|skeleton|>
class LevelMeasurementCreateForm:
"""Colle... | fc036f9f8346dee2d40287d08375a6c2af0a1a12 | <|skeleton|>
class LevelMeasurementCreateForm:
"""Collection form for general information section"""
def create(self):
"""create form from data"""
<|body_0|>
def save(self):
"""save all available data"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class LevelMeasurementCreateForm:
"""Collection form for general information section"""
def create(self):
"""create form from data"""
self.measurements = []
if self.data.get('level_measurement', None):
for measurement in self.data['level_measurement']:
if not... | the_stack_v2_python_sparse | views/form_group/level_measurement.py | Alexia-Water/IGRAC-WellAndMonitoringDatabase | train | 0 |
f48c37ee9c3331789aebddd2ba40d25147aa27b7 | [
"self.input = input\nself.output = output\nself.grid_mode = grid_mode\nself.filter = Filter(fltr)\nif self.filter.filename is None:\n raise ValueError('Could not find filter: ' + fltr)\nself.filter_resampled = False",
"if self.grid_mode:\n grid = FilesGrid(self.input)\n self.process_grid(grid)\nelse:\n ... | <|body_start_0|>
self.input = input
self.output = output
self.grid_mode = grid_mode
self.filter = Filter(fltr)
if self.filter.filename is None:
raise ValueError('Could not find filter: ' + fltr)
self.filter_resampled = False
<|end_body_0|>
<|body_start_1|>
... | ConvolveLimbDark | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConvolveLimbDark:
def __init__(self, input: str, output: str, fltr: str, grid_mode: bool=False):
"""Initialises object Args: input: Input filename/grid output: Output filename/directory fltr: Filter name grid_mode: Whether input is a grid"""
<|body_0|>
def __call__(self):
... | stack_v2_sparse_classes_10k_train_008426 | 4,186 | permissive | [
{
"docstring": "Initialises object Args: input: Input filename/grid output: Output filename/directory fltr: Filter name grid_mode: Whether input is a grid",
"name": "__init__",
"signature": "def __init__(self, input: str, output: str, fltr: str, grid_mode: bool=False)"
},
{
"docstring": "Process... | 4 | stack_v2_sparse_classes_30k_train_004942 | Implement the Python class `ConvolveLimbDark` described below.
Class description:
Implement the ConvolveLimbDark class.
Method signatures and docstrings:
- def __init__(self, input: str, output: str, fltr: str, grid_mode: bool=False): Initialises object Args: input: Input filename/grid output: Output filename/directo... | Implement the Python class `ConvolveLimbDark` described below.
Class description:
Implement the ConvolveLimbDark class.
Method signatures and docstrings:
- def __init__(self, input: str, output: str, fltr: str, grid_mode: bool=False): Initialises object Args: input: Input filename/grid output: Output filename/directo... | 648eb1758e3744d9e3d6669edc4a0c4753559f17 | <|skeleton|>
class ConvolveLimbDark:
def __init__(self, input: str, output: str, fltr: str, grid_mode: bool=False):
"""Initialises object Args: input: Input filename/grid output: Output filename/directory fltr: Filter name grid_mode: Whether input is a grid"""
<|body_0|>
def __call__(self):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ConvolveLimbDark:
def __init__(self, input: str, output: str, fltr: str, grid_mode: bool=False):
"""Initialises object Args: input: Input filename/grid output: Output filename/directory fltr: Filter name grid_mode: Whether input is a grid"""
self.input = input
self.output = output
... | the_stack_v2_python_sparse | spexxy/tools/filters/limbdark.py | thusser/spexxy | train | 4 | |
c8e847637c17cda71821a261333b1324523f675e | [
"total_collect = defaultdict(list)\nfor word in wordList:\n for num in range(len(beginWord)):\n key = word[:num] + '_' + word[num + 1:]\n total_collect[key].append(word)\nprint(str(total_collect))",
"current_word = beginWord\nword_seen = set(wordList)\nif beginWord in word_seen:\n word_seen.re... | <|body_start_0|>
total_collect = defaultdict(list)
for word in wordList:
for num in range(len(beginWord)):
key = word[:num] + '_' + word[num + 1:]
total_collect[key].append(word)
print(str(total_collect))
<|end_body_0|>
<|body_start_1|>
curren... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def ladderLengthBFS(self, beginWord, endWord, wordList):
""":param beginWord: :param endWord: :param wordList: :return:"""
<|body_0|>
def ladderLength(self, beginWord, endWord, wordList):
""":type beginWord: str :type endWord: str :type wordList: List[str] ... | stack_v2_sparse_classes_10k_train_008427 | 2,543 | no_license | [
{
"docstring": ":param beginWord: :param endWord: :param wordList: :return:",
"name": "ladderLengthBFS",
"signature": "def ladderLengthBFS(self, beginWord, endWord, wordList)"
},
{
"docstring": ":type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int",
"name": "ladderLe... | 2 | stack_v2_sparse_classes_30k_train_000439 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def ladderLengthBFS(self, beginWord, endWord, wordList): :param beginWord: :param endWord: :param wordList: :return:
- def ladderLength(self, beginWord, endWord, wordList): :type... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def ladderLengthBFS(self, beginWord, endWord, wordList): :param beginWord: :param endWord: :param wordList: :return:
- def ladderLength(self, beginWord, endWord, wordList): :type... | 8532260cda00453490b2fe554d521a54eaed219c | <|skeleton|>
class Solution:
def ladderLengthBFS(self, beginWord, endWord, wordList):
""":param beginWord: :param endWord: :param wordList: :return:"""
<|body_0|>
def ladderLength(self, beginWord, endWord, wordList):
""":type beginWord: str :type endWord: str :type wordList: List[str] ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def ladderLengthBFS(self, beginWord, endWord, wordList):
""":param beginWord: :param endWord: :param wordList: :return:"""
total_collect = defaultdict(list)
for word in wordList:
for num in range(len(beginWord)):
key = word[:num] + '_' + word[num +... | the_stack_v2_python_sparse | graph/wordLadder.py | Suriya0404/Algorithm | train | 0 | |
c29a43b382d84f96582e7cab0eb52baf35c280fe | [
"with schema_context(self.schema_name):\n query_settings = UserSettings.objects.all().first()\n if not query_settings:\n self.assertEqual(get_cost_type(self.request_context['request']), KOKU_DEFAULT_COST_TYPE)\n else:\n cost_type = query_settings.settings['cost_type']\n self.assertEqua... | <|body_start_0|>
with schema_context(self.schema_name):
query_settings = UserSettings.objects.all().first()
if not query_settings:
self.assertEqual(get_cost_type(self.request_context['request']), KOKU_DEFAULT_COST_TYPE)
else:
cost_type = query_... | Test general functions in utils | GeneralUtilsTest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GeneralUtilsTest:
"""Test general functions in utils"""
def test_get_cost_type(self):
"""Test the get_cost_type function in utils."""
<|body_0|>
def test_get_currency(self):
"""Test the get_currency function in utils."""
<|body_1|>
def test_get_user_... | stack_v2_sparse_classes_10k_train_008428 | 20,013 | permissive | [
{
"docstring": "Test the get_cost_type function in utils.",
"name": "test_get_cost_type",
"signature": "def test_get_cost_type(self)"
},
{
"docstring": "Test the get_currency function in utils.",
"name": "test_get_currency",
"signature": "def test_get_currency(self)"
},
{
"docstr... | 3 | null | Implement the Python class `GeneralUtilsTest` described below.
Class description:
Test general functions in utils
Method signatures and docstrings:
- def test_get_cost_type(self): Test the get_cost_type function in utils.
- def test_get_currency(self): Test the get_currency function in utils.
- def test_get_user_sett... | Implement the Python class `GeneralUtilsTest` described below.
Class description:
Test general functions in utils
Method signatures and docstrings:
- def test_get_cost_type(self): Test the get_cost_type function in utils.
- def test_get_currency(self): Test the get_currency function in utils.
- def test_get_user_sett... | 0416e5216eb1ec4b41c8dd4999adde218b1ab2e1 | <|skeleton|>
class GeneralUtilsTest:
"""Test general functions in utils"""
def test_get_cost_type(self):
"""Test the get_cost_type function in utils."""
<|body_0|>
def test_get_currency(self):
"""Test the get_currency function in utils."""
<|body_1|>
def test_get_user_... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GeneralUtilsTest:
"""Test general functions in utils"""
def test_get_cost_type(self):
"""Test the get_cost_type function in utils."""
with schema_context(self.schema_name):
query_settings = UserSettings.objects.all().first()
if not query_settings:
s... | the_stack_v2_python_sparse | koku/api/test_utils.py | project-koku/koku | train | 225 |
d55907702c44ca9531fabefddf017aa9af3da6a1 | [
"md5 = hashlib.md5()\nwith open(file_path, 'rb') as xml_file:\n md5.update(xml_file.read())\n return md5.hexdigest()",
"md5_1 = HashLibUtil.get_file_md5(file_path_1)\nmd5_2 = HashLibUtil.get_file_md5(file_path_2)\nif md5_1 == md5_2:\n return True\nelse:\n return False",
"file_md5 = {}\nres = []\nfor... | <|body_start_0|>
md5 = hashlib.md5()
with open(file_path, 'rb') as xml_file:
md5.update(xml_file.read())
return md5.hexdigest()
<|end_body_0|>
<|body_start_1|>
md5_1 = HashLibUtil.get_file_md5(file_path_1)
md5_2 = HashLibUtil.get_file_md5(file_path_2)
if ... | HashLibUtil | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HashLibUtil:
def get_file_md5(file_path):
"""获取文件的 MD5 值"""
<|body_0|>
def is_the_same_file(file_path_1, file_path_2):
"""判断两个文件是否是一个文件"""
<|body_1|>
def duplicate_checking(file_path_list):
"""文件查重,输出重复的文件,放在一个列表里面 DS : [[file_path_1, file_path_2... | stack_v2_sparse_classes_10k_train_008429 | 2,768 | no_license | [
{
"docstring": "获取文件的 MD5 值",
"name": "get_file_md5",
"signature": "def get_file_md5(file_path)"
},
{
"docstring": "判断两个文件是否是一个文件",
"name": "is_the_same_file",
"signature": "def is_the_same_file(file_path_1, file_path_2)"
},
{
"docstring": "文件查重,输出重复的文件,放在一个列表里面 DS : [[file_path_... | 3 | null | Implement the Python class `HashLibUtil` described below.
Class description:
Implement the HashLibUtil class.
Method signatures and docstrings:
- def get_file_md5(file_path): 获取文件的 MD5 值
- def is_the_same_file(file_path_1, file_path_2): 判断两个文件是否是一个文件
- def duplicate_checking(file_path_list): 文件查重,输出重复的文件,放在一个列表里面 DS ... | Implement the Python class `HashLibUtil` described below.
Class description:
Implement the HashLibUtil class.
Method signatures and docstrings:
- def get_file_md5(file_path): 获取文件的 MD5 值
- def is_the_same_file(file_path_1, file_path_2): 判断两个文件是否是一个文件
- def duplicate_checking(file_path_list): 文件查重,输出重复的文件,放在一个列表里面 DS ... | 32e64be10a6cd2856850f6720d70b4c6e7033f4e | <|skeleton|>
class HashLibUtil:
def get_file_md5(file_path):
"""获取文件的 MD5 值"""
<|body_0|>
def is_the_same_file(file_path_1, file_path_2):
"""判断两个文件是否是一个文件"""
<|body_1|>
def duplicate_checking(file_path_list):
"""文件查重,输出重复的文件,放在一个列表里面 DS : [[file_path_1, file_path_2... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class HashLibUtil:
def get_file_md5(file_path):
"""获取文件的 MD5 值"""
md5 = hashlib.md5()
with open(file_path, 'rb') as xml_file:
md5.update(xml_file.read())
return md5.hexdigest()
def is_the_same_file(file_path_1, file_path_2):
"""判断两个文件是否是一个文件"""
md... | the_stack_v2_python_sparse | BuiltinModule/Hashlib/HashlibUtil.py | newjokker/PyUtil | train | 0 | |
c5c2238404de988be843562786c303721e91daba | [
"if not isinstance(objs, list):\n objs = [objs]\nfor item in objs:\n fname = cls._parse_filename(filename=item.name, ext=item.settings['prefix'])\n with open(fname, 'wb') as f:\n pickle.dump({item.name: item}, f)",
"if project is None:\n project = Project()\np = cls._parse_filename(filename)\nw... | <|body_start_0|>
if not isinstance(objs, list):
objs = [objs]
for item in objs:
fname = cls._parse_filename(filename=item.name, ext=item.settings['prefix'])
with open(fname, 'wb') as f:
pickle.dump({item.name: item}, f)
<|end_body_0|>
<|body_start_1|>... | This class contains methods used for saving and loading OpenPNM Workspaces, Projects, and objects as Pickles. Notes ----- The methods in this class use the ``pickle`` module from the standard library. Aside from the security issues, these files can only be loaded by the exact same OpenPNM version used to save them. The... | Pickle | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Pickle:
"""This class contains methods used for saving and loading OpenPNM Workspaces, Projects, and objects as Pickles. Notes ----- The methods in this class use the ``pickle`` module from the standard library. Aside from the security issues, these files can only be loaded by the exact same Open... | stack_v2_sparse_classes_10k_train_008430 | 7,584 | permissive | [
{
"docstring": "Saves an OpenPNM object or list of objects to a file of set of files Parameters ---------- objs : Base or list of objects The object(s) to be saved",
"name": "save_object_to_file",
"signature": "def save_object_to_file(cls, objs)"
},
{
"docstring": "Loads an OpenPNM object from a... | 6 | stack_v2_sparse_classes_30k_train_001380 | Implement the Python class `Pickle` described below.
Class description:
This class contains methods used for saving and loading OpenPNM Workspaces, Projects, and objects as Pickles. Notes ----- The methods in this class use the ``pickle`` module from the standard library. Aside from the security issues, these files ca... | Implement the Python class `Pickle` described below.
Class description:
This class contains methods used for saving and loading OpenPNM Workspaces, Projects, and objects as Pickles. Notes ----- The methods in this class use the ``pickle`` module from the standard library. Aside from the security issues, these files ca... | 5ddd7f7317dd9c6d82e6db5256ec1800dd6eef5d | <|skeleton|>
class Pickle:
"""This class contains methods used for saving and loading OpenPNM Workspaces, Projects, and objects as Pickles. Notes ----- The methods in this class use the ``pickle`` module from the standard library. Aside from the security issues, these files can only be loaded by the exact same Open... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Pickle:
"""This class contains methods used for saving and loading OpenPNM Workspaces, Projects, and objects as Pickles. Notes ----- The methods in this class use the ``pickle`` module from the standard library. Aside from the security issues, these files can only be loaded by the exact same OpenPNM version u... | the_stack_v2_python_sparse | openpnm/io/_pickle.py | ma-sadeghi/OpenPNM | train | 1 |
64e15fa9ce188436ace05bcf08ff0538a4dc409f | [
"context = super().get_context_data(**kwargs)\nuser = get_user_model().objects.filter(id=kwargs['pk']).first()\nif not user:\n raise http.Http404(_('Unable to find user'))\ncontext['user'] = user\nreturn context",
"user = get_user_model().objects.filter(id=kwargs['pk']).first()\nif not user:\n raise http.Ht... | <|body_start_0|>
context = super().get_context_data(**kwargs)
user = get_user_model().objects.filter(id=kwargs['pk']).first()
if not user:
raise http.Http404(_('Unable to find user'))
context['user'] = user
return context
<|end_body_0|>
<|body_start_1|>
user ... | View to delete a "share" user in the workflow. | WorkflowShareDeleteView | [
"LGPL-2.0-or-later",
"BSD-3-Clause",
"MIT",
"Apache-2.0",
"LGPL-2.1-only",
"Python-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WorkflowShareDeleteView:
"""View to delete a "share" user in the workflow."""
def get_context_data(self, **kwargs):
"""Add pk and user email to the context."""
<|body_0|>
def post(self, request, *args, **kwargs):
"""Perform the share delete operation."""
... | stack_v2_sparse_classes_10k_train_008431 | 2,685 | permissive | [
{
"docstring": "Add pk and user email to the context.",
"name": "get_context_data",
"signature": "def get_context_data(self, **kwargs)"
},
{
"docstring": "Perform the share delete operation.",
"name": "post",
"signature": "def post(self, request, *args, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004537 | Implement the Python class `WorkflowShareDeleteView` described below.
Class description:
View to delete a "share" user in the workflow.
Method signatures and docstrings:
- def get_context_data(self, **kwargs): Add pk and user email to the context.
- def post(self, request, *args, **kwargs): Perform the share delete o... | Implement the Python class `WorkflowShareDeleteView` described below.
Class description:
View to delete a "share" user in the workflow.
Method signatures and docstrings:
- def get_context_data(self, **kwargs): Add pk and user email to the context.
- def post(self, request, *args, **kwargs): Perform the share delete o... | c432745dfff932cbe7397100422d49df78f0a882 | <|skeleton|>
class WorkflowShareDeleteView:
"""View to delete a "share" user in the workflow."""
def get_context_data(self, **kwargs):
"""Add pk and user email to the context."""
<|body_0|>
def post(self, request, *args, **kwargs):
"""Perform the share delete operation."""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class WorkflowShareDeleteView:
"""View to delete a "share" user in the workflow."""
def get_context_data(self, **kwargs):
"""Add pk and user email to the context."""
context = super().get_context_data(**kwargs)
user = get_user_model().objects.filter(id=kwargs['pk']).first()
if n... | the_stack_v2_python_sparse | ontask/workflow/views/share.py | abelardopardo/ontask_b | train | 43 |
9099bec8b50df6444fe1e5fa5f9ffd2e4a1bca1b | [
"if level is not None:\n self._target_level = level\nif self._target_level and self._target_level == self._deep_level:\n desc = {'type': self.__class__.__name__}\n desc.update(self.desc)\n return desc\ndesc = {'modules': [], 'type': self.__class__.__name__}\nif self._losses:\n desc['loss'] = self._lo... | <|body_start_0|>
if level is not None:
self._target_level = level
if self._target_level and self._target_level == self._deep_level:
desc = {'type': self.__class__.__name__}
desc.update(self.desc)
return desc
desc = {'modules': [], 'type': self.__cl... | Seriablizable Module class. | ModuleSerializable | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModuleSerializable:
"""Seriablizable Module class."""
def to_desc(self, level=None):
"""Convert Module to desc dict. :param level: Specifies witch level to convert. all conversions are performed as default."""
<|body_0|>
def update_from_desc(self, desc):
"""Updat... | stack_v2_sparse_classes_10k_train_008432 | 7,315 | permissive | [
{
"docstring": "Convert Module to desc dict. :param level: Specifies witch level to convert. all conversions are performed as default.",
"name": "to_desc",
"signature": "def to_desc(self, level=None)"
},
{
"docstring": "Update desc according to desc.",
"name": "update_from_desc",
"signat... | 3 | null | Implement the Python class `ModuleSerializable` described below.
Class description:
Seriablizable Module class.
Method signatures and docstrings:
- def to_desc(self, level=None): Convert Module to desc dict. :param level: Specifies witch level to convert. all conversions are performed as default.
- def update_from_de... | Implement the Python class `ModuleSerializable` described below.
Class description:
Seriablizable Module class.
Method signatures and docstrings:
- def to_desc(self, level=None): Convert Module to desc dict. :param level: Specifies witch level to convert. all conversions are performed as default.
- def update_from_de... | e4ef3a1c92d19d1d08c3ef0e2156b6fecefdbe04 | <|skeleton|>
class ModuleSerializable:
"""Seriablizable Module class."""
def to_desc(self, level=None):
"""Convert Module to desc dict. :param level: Specifies witch level to convert. all conversions are performed as default."""
<|body_0|>
def update_from_desc(self, desc):
"""Updat... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ModuleSerializable:
"""Seriablizable Module class."""
def to_desc(self, level=None):
"""Convert Module to desc dict. :param level: Specifies witch level to convert. all conversions are performed as default."""
if level is not None:
self._target_level = level
if self._t... | the_stack_v2_python_sparse | zeus/modules/operators/functions/serializable.py | huawei-noah/xingtian | train | 308 |
400d77524b00c0a9275ca1e13dde331d67c20c0d | [
"self.transition_matrix = transition_matrix\nself.hidden_state_objects = hidden_state_objects\nself.stationary_distribution = TransitionMatrix.get_stationary_distribution(transition_matrix)\nself.initial_distribution = self.stationary_distribution",
"validate_args(observations, distances)\nnhidden = len(self.hidd... | <|body_start_0|>
self.transition_matrix = transition_matrix
self.hidden_state_objects = hidden_state_objects
self.stationary_distribution = TransitionMatrix.get_stationary_distribution(transition_matrix)
self.initial_distribution = self.stationary_distribution
<|end_body_0|>
<|body_star... | MissingHMM | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MissingHMM:
def __init__(self, transition_matrix, hidden_state_objects):
"""@param transition_matrix: a numpy array that is a transition matrix among hidden states @param hidden_state_objects: a conformant list of hidden state objects"""
<|body_0|>
def scaled_forward_durbin(... | stack_v2_sparse_classes_10k_train_008433 | 8,288 | no_license | [
{
"docstring": "@param transition_matrix: a numpy array that is a transition matrix among hidden states @param hidden_state_objects: a conformant list of hidden state objects",
"name": "__init__",
"signature": "def __init__(self, transition_matrix, hidden_state_objects)"
},
{
"docstring": "For m... | 4 | null | Implement the Python class `MissingHMM` described below.
Class description:
Implement the MissingHMM class.
Method signatures and docstrings:
- def __init__(self, transition_matrix, hidden_state_objects): @param transition_matrix: a numpy array that is a transition matrix among hidden states @param hidden_state_objec... | Implement the Python class `MissingHMM` described below.
Class description:
Implement the MissingHMM class.
Method signatures and docstrings:
- def __init__(self, transition_matrix, hidden_state_objects): @param transition_matrix: a numpy array that is a transition matrix among hidden states @param hidden_state_objec... | 91c6f8331f18c914eb3dfc51bc166915998c5081 | <|skeleton|>
class MissingHMM:
def __init__(self, transition_matrix, hidden_state_objects):
"""@param transition_matrix: a numpy array that is a transition matrix among hidden states @param hidden_state_objects: a conformant list of hidden state objects"""
<|body_0|>
def scaled_forward_durbin(... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MissingHMM:
def __init__(self, transition_matrix, hidden_state_objects):
"""@param transition_matrix: a numpy array that is a transition matrix among hidden states @param hidden_state_objects: a conformant list of hidden state objects"""
self.transition_matrix = transition_matrix
self.... | the_stack_v2_python_sparse | MissingHMM.py | argriffing/xgcode | train | 1 | |
8c79d7fe29e8dd77452545909dff6a1e0d9d07fd | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn RecurrencePattern()",
"from .day_of_week import DayOfWeek\nfrom .recurrence_pattern_type import RecurrencePatternType\nfrom .week_index import WeekIndex\nfrom .day_of_week import DayOfWeek\nfrom .recurrence_pattern_type import Recurren... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return RecurrencePattern()
<|end_body_0|>
<|body_start_1|>
from .day_of_week import DayOfWeek
from .recurrence_pattern_type import RecurrencePatternType
from .week_index import WeekInde... | RecurrencePattern | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RecurrencePattern:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> RecurrencePattern:
"""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... | stack_v2_sparse_classes_10k_train_008434 | 5,400 | 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: RecurrencePattern",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_v... | 3 | null | Implement the Python class `RecurrencePattern` described below.
Class description:
Implement the RecurrencePattern class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> RecurrencePattern: Creates a new instance of the appropriate class based on discrim... | Implement the Python class `RecurrencePattern` described below.
Class description:
Implement the RecurrencePattern class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> RecurrencePattern: Creates a new instance of the appropriate class based on discrim... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class RecurrencePattern:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> RecurrencePattern:
"""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... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RecurrencePattern:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> RecurrencePattern:
"""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: Recu... | the_stack_v2_python_sparse | msgraph/generated/models/recurrence_pattern.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
0c2cd98161d69fdcdcebda67e9497789e7c637b2 | [
"res = []\n\ndef _dfs(root):\n if root:\n res.append(str(root.val))\n _dfs(root.left)\n _dfs(root.right)\n_dfs(root)\nreturn ''.join(res)",
"def _build(k, parent):\n if k >= len(data):\n return (None, k)\n root = TreeNode(int(data[k]))\n val = int(data[k + 1])\n parent =... | <|body_start_0|>
res = []
def _dfs(root):
if root:
res.append(str(root.val))
_dfs(root.left)
_dfs(root.right)
_dfs(root)
return ''.join(res)
<|end_body_0|>
<|body_start_1|>
def _build(k, parent):
if k >= le... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_10k_train_008435 | 2,230 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | stack_v2_sparse_classes_30k_train_007035 | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | 085b8dfa8e12f7c39107bab60110cd3b182f0c13 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
res = []
def _dfs(root):
if root:
res.append(str(root.val))
_dfs(root.left)
_dfs(root.right)
_dfs(root)
... | the_stack_v2_python_sparse | eet/Serialize_and_Deserialize_BST.py | wangyunge/algorithmpractice | train | 0 | |
1eaa369b85ea7d3e829bdb93c0bb1c4a6f956057 | [
"assert issubclass(paned.__class__, gi.repository.Gtk.Paned), u'GtkPaned manager type error'\nsetattr(self, '_last_position_%s' % paned.get_name(), paned.get_position())\nif resize_panel == 0:\n paned.set_position(paned.get_property('min-position'))\nelif resize_panel == 1:\n paned.set_position(paned.get_prop... | <|body_start_0|>
assert issubclass(paned.__class__, gi.repository.Gtk.Paned), u'GtkPaned manager type error'
setattr(self, '_last_position_%s' % paned.get_name(), paned.get_position())
if resize_panel == 0:
paned.set_position(paned.get_property('min-position'))
elif resize_pa... | GtkPaned manager. | iqGtkPanedManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class iqGtkPanedManager:
"""GtkPaned manager."""
def collapseGtkPanedPanel(self, paned, toolbar=None, collapse_tool=None, expand_tool=None, resize_panel=0, redraw=True):
"""Collapse the paned panel. :param paned: GtkPaned object. :param toolbar: GtkToolBar object. :param collapse_tool: Col... | stack_v2_sparse_classes_10k_train_008436 | 3,161 | no_license | [
{
"docstring": "Collapse the paned panel. :param paned: GtkPaned object. :param toolbar: GtkToolBar object. :param collapse_tool: Collapse tool item. :param expand_tool: Expand tool item. :param resize_panel: Resizable panel index. :param redraw: Redrawing object? :return: True/False.",
"name": "collapseGtk... | 2 | null | Implement the Python class `iqGtkPanedManager` described below.
Class description:
GtkPaned manager.
Method signatures and docstrings:
- def collapseGtkPanedPanel(self, paned, toolbar=None, collapse_tool=None, expand_tool=None, resize_panel=0, redraw=True): Collapse the paned panel. :param paned: GtkPaned object. :pa... | Implement the Python class `iqGtkPanedManager` described below.
Class description:
GtkPaned manager.
Method signatures and docstrings:
- def collapseGtkPanedPanel(self, paned, toolbar=None, collapse_tool=None, expand_tool=None, resize_panel=0, redraw=True): Collapse the paned panel. :param paned: GtkPaned object. :pa... | 7550e242746cb2fb1219474463f8db21f8e3e114 | <|skeleton|>
class iqGtkPanedManager:
"""GtkPaned manager."""
def collapseGtkPanedPanel(self, paned, toolbar=None, collapse_tool=None, expand_tool=None, resize_panel=0, redraw=True):
"""Collapse the paned panel. :param paned: GtkPaned object. :param toolbar: GtkToolBar object. :param collapse_tool: Col... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class iqGtkPanedManager:
"""GtkPaned manager."""
def collapseGtkPanedPanel(self, paned, toolbar=None, collapse_tool=None, expand_tool=None, resize_panel=0, redraw=True):
"""Collapse the paned panel. :param paned: GtkPaned object. :param toolbar: GtkToolBar object. :param collapse_tool: Collapse tool it... | the_stack_v2_python_sparse | iq/engine/gtk/gtkpaned_manager.py | XHermitOne/iq_framework | train | 1 |
e75ead4ba0a43d26c83292025beaabcefea02dd7 | [
"def helper(root):\n if root:\n result.append(str(root.val))\n helper(root.left)\n helper(root.right)\n else:\n result.append('#')\nresult = []\nhelper(root)\nreturn result",
"def helper():\n c = next(arr)\n if c == '#':\n return None\n newNode = TreeNode(int(c))\... | <|body_start_0|>
def helper(root):
if root:
result.append(str(root.val))
helper(root.left)
helper(root.right)
else:
result.append('#')
result = []
helper(root)
return result
<|end_body_0|>
<|body_sta... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_10k_train_008437 | 1,225 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | null | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | 6d361cad2821248350f1d8432fdfef86895ca281 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
def helper(root):
if root:
result.append(str(root.val))
helper(root.left)
helper(root.right)
else:
... | the_stack_v2_python_sparse | Design/serializeBST.py | tr1503/LeetCode | train | 0 | |
d248e953d7c346dfbb86386214ace38ead345ca7 | [
"self._char_index = char_index\nself._fixed_length_text = fixed_length_text\nself._fixed_length_word = fixed_length_word",
"idx = np.zeros((self._fixed_length_text, self._fixed_length_word))\nfor i in range(min(len(input_), self._fixed_length_text)):\n for j in range(min(len(input_[i]), self._fixed_length_word... | <|body_start_0|>
self._char_index = char_index
self._fixed_length_text = fixed_length_text
self._fixed_length_word = fixed_length_word
<|end_body_0|>
<|body_start_1|>
idx = np.zeros((self._fixed_length_text, self._fixed_length_word))
for i in range(min(len(input_), self._fixed_l... | CharacterIndexUnit for DIIN model. The input of :class:'CharacterIndexUnit' should be a list of word character list extracted from a text. The output is the character index representation of this text. :class:`NgramLetterUnit` and :class:`VocabularyUnit` are two essential prerequisite of :class:`CharacterIndexUnit`. Ex... | CharacterIndex | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CharacterIndex:
"""CharacterIndexUnit for DIIN model. The input of :class:'CharacterIndexUnit' should be a list of word character list extracted from a text. The output is the character index representation of this text. :class:`NgramLetterUnit` and :class:`VocabularyUnit` are two essential prere... | stack_v2_sparse_classes_10k_train_008438 | 2,019 | permissive | [
{
"docstring": "Class initialization. :param char_index: character-index mapping generated by :class:'VocabularyUnit'. :param fixed_length_text: maximize length of a text. :param fixed_length_word: maximize length of a word.",
"name": "__init__",
"signature": "def __init__(self, char_index: dict, fixed_... | 2 | stack_v2_sparse_classes_30k_train_002017 | Implement the Python class `CharacterIndex` described below.
Class description:
CharacterIndexUnit for DIIN model. The input of :class:'CharacterIndexUnit' should be a list of word character list extracted from a text. The output is the character index representation of this text. :class:`NgramLetterUnit` and :class:`... | Implement the Python class `CharacterIndex` described below.
Class description:
CharacterIndexUnit for DIIN model. The input of :class:'CharacterIndexUnit' should be a list of word character list extracted from a text. The output is the character index representation of this text. :class:`NgramLetterUnit` and :class:`... | 1f763062c6cc861e93ccdba23d0f1f0171f74145 | <|skeleton|>
class CharacterIndex:
"""CharacterIndexUnit for DIIN model. The input of :class:'CharacterIndexUnit' should be a list of word character list extracted from a text. The output is the character index representation of this text. :class:`NgramLetterUnit` and :class:`VocabularyUnit` are two essential prere... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CharacterIndex:
"""CharacterIndexUnit for DIIN model. The input of :class:'CharacterIndexUnit' should be a list of word character list extracted from a text. The output is the character index representation of this text. :class:`NgramLetterUnit` and :class:`VocabularyUnit` are two essential prerequisite of :c... | the_stack_v2_python_sparse | matchzoo/preprocessors/units/character_index.py | JRetza/MatchZoo | train | 1 |
6b43666e1543170ab30c957bb12edfc94a6f68b2 | [
"rslt, N = (list(s), len(s))\nleftCnt = rightCnt = 0\nfor i in range(N):\n if rslt[i] == '(':\n leftCnt += 1\n elif rslt[i] == ')':\n rightCnt += 1\n if leftCnt < rightCnt:\n rslt[i] = ''\n rightCnt -= 1\nleftCnt = rightCnt = 0\nfor i in reversed(range(N)):\n if r... | <|body_start_0|>
rslt, N = (list(s), len(s))
leftCnt = rightCnt = 0
for i in range(N):
if rslt[i] == '(':
leftCnt += 1
elif rslt[i] == ')':
rightCnt += 1
if leftCnt < rightCnt:
rslt[i] = ''
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minRemoveToMakeValid(self, s: str) -> str:
"""For any prefix in a valid string with parentheses, its left parentheses should be no less than its right parentheses, same as suffix. So we could scan from left to right to remove invalid right parentheses, then scan from right ... | stack_v2_sparse_classes_10k_train_008439 | 1,915 | no_license | [
{
"docstring": "For any prefix in a valid string with parentheses, its left parentheses should be no less than its right parentheses, same as suffix. So we could scan from left to right to remove invalid right parentheses, then scan from right to left to remove invalid left parentheses.",
"name": "minRemove... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minRemoveToMakeValid(self, s: str) -> str: For any prefix in a valid string with parentheses, its left parentheses should be no less than its right parentheses, same as suffi... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minRemoveToMakeValid(self, s: str) -> str: For any prefix in a valid string with parentheses, its left parentheses should be no less than its right parentheses, same as suffi... | edb870f83f0c4568cce0cacec04ee70cf6b545bf | <|skeleton|>
class Solution:
def minRemoveToMakeValid(self, s: str) -> str:
"""For any prefix in a valid string with parentheses, its left parentheses should be no less than its right parentheses, same as suffix. So we could scan from left to right to remove invalid right parentheses, then scan from right ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def minRemoveToMakeValid(self, s: str) -> str:
"""For any prefix in a valid string with parentheses, its left parentheses should be no less than its right parentheses, same as suffix. So we could scan from left to right to remove invalid right parentheses, then scan from right to left to rem... | the_stack_v2_python_sparse | 2021/minimum_remove_to_make_valid_parentheses.py | eronekogin/leetcode | train | 0 | |
dce82b60dd0ac35efad9427b0f7fb5878127c0ed | [
"cmd = 'nova'\nif api_version:\n cmd += ' --os-compute-api-version {0}'.format(api_version)\ncmd += ' list'\nexit_code, stdout, stderr = self.execute_command(cmd, timeout=config.SERVER_LIST_TIMEOUT, check=check)\nif check:\n list_result = output_parser.listing(stdout)\n assert_that(list_result, is_not(empt... | <|body_start_0|>
cmd = 'nova'
if api_version:
cmd += ' --os-compute-api-version {0}'.format(api_version)
cmd += ' list'
exit_code, stdout, stderr = self.execute_command(cmd, timeout=config.SERVER_LIST_TIMEOUT, check=check)
if check:
list_result = output_pa... | CLI nova client steps. | CliNovaSteps | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CliNovaSteps:
"""CLI nova client steps."""
def nova_list(self, api_version=None, check=True):
"""Step to get nova list. Args: api_version (str|None): micro version for nova list command check (bool): flag whether to check result or not Raises: TimeoutExpired|AssertionError: if check ... | stack_v2_sparse_classes_10k_train_008440 | 2,899 | no_license | [
{
"docstring": "Step to get nova list. Args: api_version (str|None): micro version for nova list command check (bool): flag whether to check result or not Raises: TimeoutExpired|AssertionError: if check failed after timeout",
"name": "nova_list",
"signature": "def nova_list(self, api_version=None, check... | 2 | null | Implement the Python class `CliNovaSteps` described below.
Class description:
CLI nova client steps.
Method signatures and docstrings:
- def nova_list(self, api_version=None, check=True): Step to get nova list. Args: api_version (str|None): micro version for nova list command check (bool): flag whether to check resul... | Implement the Python class `CliNovaSteps` described below.
Class description:
CLI nova client steps.
Method signatures and docstrings:
- def nova_list(self, api_version=None, check=True): Step to get nova list. Args: api_version (str|None): micro version for nova list command check (bool): flag whether to check resul... | e7583444cd24893ec6ae237b47db7c605b99b0c5 | <|skeleton|>
class CliNovaSteps:
"""CLI nova client steps."""
def nova_list(self, api_version=None, check=True):
"""Step to get nova list. Args: api_version (str|None): micro version for nova list command check (bool): flag whether to check result or not Raises: TimeoutExpired|AssertionError: if check ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CliNovaSteps:
"""CLI nova client steps."""
def nova_list(self, api_version=None, check=True):
"""Step to get nova list. Args: api_version (str|None): micro version for nova list command check (bool): flag whether to check result or not Raises: TimeoutExpired|AssertionError: if check failed after ... | the_stack_v2_python_sparse | stepler/cli_clients/steps/nova.py | Mirantis/stepler | train | 16 |
bfcb32b1b13f914bf5c07adfdf5124d167a8b091 | [
"self.combine_mode = combine_mode\nsuper().__init__(name, parent, hyperparameter_config, spatial_scale)\npass",
"new_block = gn.genes.ConvBlockGene('conv block', parent=self)\nself.children.append(new_block)\npass",
"if len(self.children) > 1 and self.hyperparam('spatial_mode') == 1:\n self.children[1].set(p... | <|body_start_0|>
self.combine_mode = combine_mode
super().__init__(name, parent, hyperparameter_config, spatial_scale)
pass
<|end_body_0|>
<|body_start_1|>
new_block = gn.genes.ConvBlockGene('conv block', parent=self)
self.children.append(new_block)
pass
<|end_body_1|>
... | A Gene for a module with parallel convolution block paths at multiple spatial scales. | SpatialPyramidGene | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SpatialPyramidGene:
"""A Gene for a module with parallel convolution block paths at multiple spatial scales."""
def __init__(self, combine_mode: str='add', name: str='spatial_pyramid', parent: Optional[gn.genes.ScaleGene]=None, hyperparameter_config: Optional[mt.HyperparameterConfig]=None, s... | stack_v2_sparse_classes_10k_train_008441 | 9,428 | no_license | [
{
"docstring": "Constructor. Args: combine_mode (str): Combination mode for the output of the multiscale feature maps. Must be 'add', for a residual connection, or 'merge' for a merge connection. name (str): This gene's name. parent (Optional[gn.ScaleGene]): Parent gene. hyperparameter_config (Optional[mt.Hyper... | 5 | stack_v2_sparse_classes_30k_train_001420 | Implement the Python class `SpatialPyramidGene` described below.
Class description:
A Gene for a module with parallel convolution block paths at multiple spatial scales.
Method signatures and docstrings:
- def __init__(self, combine_mode: str='add', name: str='spatial_pyramid', parent: Optional[gn.genes.ScaleGene]=No... | Implement the Python class `SpatialPyramidGene` described below.
Class description:
A Gene for a module with parallel convolution block paths at multiple spatial scales.
Method signatures and docstrings:
- def __init__(self, combine_mode: str='add', name: str='spatial_pyramid', parent: Optional[gn.genes.ScaleGene]=No... | 6b78dc5e1e793a206ae3f4860d3a9ac887e663e5 | <|skeleton|>
class SpatialPyramidGene:
"""A Gene for a module with parallel convolution block paths at multiple spatial scales."""
def __init__(self, combine_mode: str='add', name: str='spatial_pyramid', parent: Optional[gn.genes.ScaleGene]=None, hyperparameter_config: Optional[mt.HyperparameterConfig]=None, s... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SpatialPyramidGene:
"""A Gene for a module with parallel convolution block paths at multiple spatial scales."""
def __init__(self, combine_mode: str='add', name: str='spatial_pyramid', parent: Optional[gn.genes.ScaleGene]=None, hyperparameter_config: Optional[mt.HyperparameterConfig]=None, spatial_scale:... | the_stack_v2_python_sparse | example2/src/_private/SpatialPyramidGene.py | leapmanlab/examples | train | 1 |
636de2deb80c00a9eb846a12d37770d6653bccc8 | [
"query = '\\n INSERT IGNORE INTO yara_signature_references\\n VALUES (%(blob_id)s, %(username_hash)s, NOW(6))\\n '\nargs = {'blob_id': blob_id.AsBytes(), 'username_hash': mysql_utils.Hash(username)}\ntry:\n cursor.execute(query, args)\nexcept MySQLdb.IntegrityError:\n raise db.UnknownGRRUserError(use... | <|body_start_0|>
query = '\n INSERT IGNORE INTO yara_signature_references\n VALUES (%(blob_id)s, %(username_hash)s, NOW(6))\n '
args = {'blob_id': blob_id.AsBytes(), 'username_hash': mysql_utils.Hash(username)}
try:
cursor.execute(query, args)
except MySQLdb.Integrit... | A MySQL database mixin class with YARA-related methods. | MySQLDBYaraMixin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MySQLDBYaraMixin:
"""A MySQL database mixin class with YARA-related methods."""
def WriteYaraSignatureReference(self, blob_id: rdf_objects.BlobID, username: Text, cursor: MySQLdb.cursors.Cursor) -> None:
"""Marks specified blob id as a YARA signature."""
<|body_0|>
def V... | stack_v2_sparse_classes_10k_train_008442 | 1,462 | permissive | [
{
"docstring": "Marks specified blob id as a YARA signature.",
"name": "WriteYaraSignatureReference",
"signature": "def WriteYaraSignatureReference(self, blob_id: rdf_objects.BlobID, username: Text, cursor: MySQLdb.cursors.Cursor) -> None"
},
{
"docstring": "Verifies whether specified blob is a ... | 2 | null | Implement the Python class `MySQLDBYaraMixin` described below.
Class description:
A MySQL database mixin class with YARA-related methods.
Method signatures and docstrings:
- def WriteYaraSignatureReference(self, blob_id: rdf_objects.BlobID, username: Text, cursor: MySQLdb.cursors.Cursor) -> None: Marks specified blob... | Implement the Python class `MySQLDBYaraMixin` described below.
Class description:
A MySQL database mixin class with YARA-related methods.
Method signatures and docstrings:
- def WriteYaraSignatureReference(self, blob_id: rdf_objects.BlobID, username: Text, cursor: MySQLdb.cursors.Cursor) -> None: Marks specified blob... | 44c0eb8c938302098ef7efae8cfd6b90bcfbb2d6 | <|skeleton|>
class MySQLDBYaraMixin:
"""A MySQL database mixin class with YARA-related methods."""
def WriteYaraSignatureReference(self, blob_id: rdf_objects.BlobID, username: Text, cursor: MySQLdb.cursors.Cursor) -> None:
"""Marks specified blob id as a YARA signature."""
<|body_0|>
def V... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MySQLDBYaraMixin:
"""A MySQL database mixin class with YARA-related methods."""
def WriteYaraSignatureReference(self, blob_id: rdf_objects.BlobID, username: Text, cursor: MySQLdb.cursors.Cursor) -> None:
"""Marks specified blob id as a YARA signature."""
query = '\n INSERT IGNORE INTO ... | the_stack_v2_python_sparse | grr/server/grr_response_server/databases/mysql_yara.py | google/grr | train | 4,683 |
6cb05fedc0d07d6e102e21b7cc68d67d3c663358 | [
"if Capability.SHELL not in capability:\n return\nfacts = []\nfor fact in pwncat.victim.enumerate('screen-version'):\n progress.update(task, step=str(fact.data))\n if fact.data.vulnerable and fact.data.perms & 2048:\n facts.append(fact)\nfor fact in facts:\n progress.update(task, step=str(fact.da... | <|body_start_0|>
if Capability.SHELL not in capability:
return
facts = []
for fact in pwncat.victim.enumerate('screen-version'):
progress.update(task, step=str(fact.data))
if fact.data.vulnerable and fact.data.perms & 2048:
facts.append(fact)
... | Method | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Method:
def enumerate(self, progress, task, capability: int=Capability.ALL) -> List[Technique]:
"""Find all techniques known at this time"""
<|body_0|>
def execute(self, technique: Technique):
"""Run the specified technique"""
<|body_1|>
<|end_skeleton|>
<|... | stack_v2_sparse_classes_10k_train_008443 | 5,063 | no_license | [
{
"docstring": "Find all techniques known at this time",
"name": "enumerate",
"signature": "def enumerate(self, progress, task, capability: int=Capability.ALL) -> List[Technique]"
},
{
"docstring": "Run the specified technique",
"name": "execute",
"signature": "def execute(self, techniqu... | 2 | stack_v2_sparse_classes_30k_train_007248 | Implement the Python class `Method` described below.
Class description:
Implement the Method class.
Method signatures and docstrings:
- def enumerate(self, progress, task, capability: int=Capability.ALL) -> List[Technique]: Find all techniques known at this time
- def execute(self, technique: Technique): Run the spec... | Implement the Python class `Method` described below.
Class description:
Implement the Method class.
Method signatures and docstrings:
- def enumerate(self, progress, task, capability: int=Capability.ALL) -> List[Technique]: Find all techniques known at this time
- def execute(self, technique: Technique): Run the spec... | 30e084ab6e8c41fa2f0a43b557b308599eb0bdf3 | <|skeleton|>
class Method:
def enumerate(self, progress, task, capability: int=Capability.ALL) -> List[Technique]:
"""Find all techniques known at this time"""
<|body_0|>
def execute(self, technique: Technique):
"""Run the specified technique"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Method:
def enumerate(self, progress, task, capability: int=Capability.ALL) -> List[Technique]:
"""Find all techniques known at this time"""
if Capability.SHELL not in capability:
return
facts = []
for fact in pwncat.victim.enumerate('screen-version'):
p... | the_stack_v2_python_sparse | pwncat/privesc/screen.py | tilt41/pwncat | train | 1 | |
8b8f99308c08719fcdf6b9b418dac5dca68f25e9 | [
"text = Formatter.format_block(self, block)\ntext = self.indent(text, 2)\ntext = '::\\n\\n' + text\nreturn text",
"caption = elem.text\nif caption and caption.strip():\n caption = self.indent(textwrap.wrap(caption), 2)\n return '.. figure:: %s\\n\\n%s\\n' % (elem.get('filename'), caption)\nelse:\n return... | <|body_start_0|>
text = Formatter.format_block(self, block)
text = self.indent(text, 2)
text = '::\n\n' + text
return text
<|end_body_0|>
<|body_start_1|>
caption = elem.text
if caption and caption.strip():
caption = self.indent(textwrap.wrap(caption), 2)
... | Formatter for reST output. | ReSTFormatter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReSTFormatter:
"""Formatter for reST output."""
def format_block(self, block):
"""Format an <ipython-block> element."""
<|body_0|>
def format_figure(self, elem):
"""Format a <figure> element."""
<|body_1|>
def format_sheet(self, sheet):
"""Fo... | stack_v2_sparse_classes_10k_train_008444 | 2,064 | no_license | [
{
"docstring": "Format an <ipython-block> element.",
"name": "format_block",
"signature": "def format_block(self, block)"
},
{
"docstring": "Format a <figure> element.",
"name": "format_figure",
"signature": "def format_figure(self, elem)"
},
{
"docstring": "Format a reST sheet. ... | 3 | null | Implement the Python class `ReSTFormatter` described below.
Class description:
Formatter for reST output.
Method signatures and docstrings:
- def format_block(self, block): Format an <ipython-block> element.
- def format_figure(self, elem): Format a <figure> element.
- def format_sheet(self, sheet): Format a reST she... | Implement the Python class `ReSTFormatter` described below.
Class description:
Formatter for reST output.
Method signatures and docstrings:
- def format_block(self, block): Format an <ipython-block> element.
- def format_figure(self, elem): Format a <figure> element.
- def format_sheet(self, sheet): Format a reST she... | 9b32089282c94c706d819333a3a2388179e99e86 | <|skeleton|>
class ReSTFormatter:
"""Formatter for reST output."""
def format_block(self, block):
"""Format an <ipython-block> element."""
<|body_0|>
def format_figure(self, elem):
"""Format a <figure> element."""
<|body_1|>
def format_sheet(self, sheet):
"""Fo... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ReSTFormatter:
"""Formatter for reST output."""
def format_block(self, block):
"""Format an <ipython-block> element."""
text = Formatter.format_block(self, block)
text = self.indent(text, 2)
text = '::\n\n' + text
return text
def format_figure(self, elem):
... | the_stack_v2_python_sparse | google-rkern/trunk/notabene/rest.py | minrk/ipython-svn-archive | train | 0 |
cd0c432dfe65ca9a6084a4c1c702867b81f07f23 | [
"logger.info('Using Shared Key authentication for {%s, %s, %s}', hostname, device_id, module_id)\nsuper(SymmetricKeyAuthenticationProvider, self).__init__(hostname=hostname, device_id=device_id, module_id=module_id)\nself.shared_access_key = shared_access_key\nself.shared_access_key_name = shared_access_key_name\ns... | <|body_start_0|>
logger.info('Using Shared Key authentication for {%s, %s, %s}', hostname, device_id, module_id)
super(SymmetricKeyAuthenticationProvider, self).__init__(hostname=hostname, device_id=device_id, module_id=module_id)
self.shared_access_key = shared_access_key
self.shared_ac... | A Symmetric Key Authentication Provider. This provider needs to create the i Shared Access Signature that would be needed to connect to the IoT Hub. | SymmetricKeyAuthenticationProvider | [
"LicenseRef-scancode-generic-cla",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SymmetricKeyAuthenticationProvider:
"""A Symmetric Key Authentication Provider. This provider needs to create the i Shared Access Signature that would be needed to connect to the IoT Hub."""
def __init__(self, hostname, device_id, module_id, shared_access_key, shared_access_key_name=None, ga... | stack_v2_sparse_classes_10k_train_008445 | 5,309 | permissive | [
{
"docstring": "Constructor for SymmetricKey Authentication Provider",
"name": "__init__",
"signature": "def __init__(self, hostname, device_id, module_id, shared_access_key, shared_access_key_name=None, gateway_hostname=None)"
},
{
"docstring": "This method creates a Symmetric Key Authenticatio... | 3 | stack_v2_sparse_classes_30k_train_002480 | Implement the Python class `SymmetricKeyAuthenticationProvider` described below.
Class description:
A Symmetric Key Authentication Provider. This provider needs to create the i Shared Access Signature that would be needed to connect to the IoT Hub.
Method signatures and docstrings:
- def __init__(self, hostname, devi... | Implement the Python class `SymmetricKeyAuthenticationProvider` described below.
Class description:
A Symmetric Key Authentication Provider. This provider needs to create the i Shared Access Signature that would be needed to connect to the IoT Hub.
Method signatures and docstrings:
- def __init__(self, hostname, devi... | 50060e8c36d5751f8d207fa277db958ba89e9088 | <|skeleton|>
class SymmetricKeyAuthenticationProvider:
"""A Symmetric Key Authentication Provider. This provider needs to create the i Shared Access Signature that would be needed to connect to the IoT Hub."""
def __init__(self, hostname, device_id, module_id, shared_access_key, shared_access_key_name=None, ga... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SymmetricKeyAuthenticationProvider:
"""A Symmetric Key Authentication Provider. This provider needs to create the i Shared Access Signature that would be needed to connect to the IoT Hub."""
def __init__(self, hostname, device_id, module_id, shared_access_key, shared_access_key_name=None, gateway_hostnam... | the_stack_v2_python_sparse | azure-iot-device/azure/iot/device/iothub/auth/sk_authentication_provider.py | Azure/azure-iot-sdk-python-preview | train | 36 |
2f193cb1eaf7b5e99d20025716a248144af90b92 | [
"OdfFit.__init__(self, model, data)\nself._gfa = None\nself.npeaks = 5\nself._peak_values = None\nself._peak_indices = None\nself._qa = None",
"self.gqi_vector = self.model.cache_get('gqi_vector', key=sphere)\nif self.gqi_vector is None:\n if self.model.method == 'gqi2':\n H = squared_radial_component\n... | <|body_start_0|>
OdfFit.__init__(self, model, data)
self._gfa = None
self.npeaks = 5
self._peak_values = None
self._peak_indices = None
self._qa = None
<|end_body_0|>
<|body_start_1|>
self.gqi_vector = self.model.cache_get('gqi_vector', key=sphere)
if sel... | GeneralizedQSamplingFit | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GeneralizedQSamplingFit:
def __init__(self, model, data):
"""Calculates PDF and ODF for a single voxel Parameters ---------- model : object, DiffusionSpectrumModel data : 1d ndarray, signal values"""
<|body_0|>
def odf(self, sphere):
"""Calculates the discrete ODF fo... | stack_v2_sparse_classes_10k_train_008446 | 9,071 | permissive | [
{
"docstring": "Calculates PDF and ODF for a single voxel Parameters ---------- model : object, DiffusionSpectrumModel data : 1d ndarray, signal values",
"name": "__init__",
"signature": "def __init__(self, model, data)"
},
{
"docstring": "Calculates the discrete ODF for a given discrete sphere.... | 2 | stack_v2_sparse_classes_30k_train_003490 | Implement the Python class `GeneralizedQSamplingFit` described below.
Class description:
Implement the GeneralizedQSamplingFit class.
Method signatures and docstrings:
- def __init__(self, model, data): Calculates PDF and ODF for a single voxel Parameters ---------- model : object, DiffusionSpectrumModel data : 1d nd... | Implement the Python class `GeneralizedQSamplingFit` described below.
Class description:
Implement the GeneralizedQSamplingFit class.
Method signatures and docstrings:
- def __init__(self, model, data): Calculates PDF and ODF for a single voxel Parameters ---------- model : object, DiffusionSpectrumModel data : 1d nd... | 3c3acc55de8ba741e673063378e6cbaf10b64c7a | <|skeleton|>
class GeneralizedQSamplingFit:
def __init__(self, model, data):
"""Calculates PDF and ODF for a single voxel Parameters ---------- model : object, DiffusionSpectrumModel data : 1d ndarray, signal values"""
<|body_0|>
def odf(self, sphere):
"""Calculates the discrete ODF fo... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GeneralizedQSamplingFit:
def __init__(self, model, data):
"""Calculates PDF and ODF for a single voxel Parameters ---------- model : object, DiffusionSpectrumModel data : 1d ndarray, signal values"""
OdfFit.__init__(self, model, data)
self._gfa = None
self.npeaks = 5
se... | the_stack_v2_python_sparse | env/lib/python3.6/site-packages/dipy/reconst/gqi.py | Raniac/NEURO-LEARN | train | 9 | |
88f02e8874b0e6ab78bd7316645f517884066e40 | [
"username = self.request.user.email\nold_password = form.cleaned_data['old_password']\ncheckCredentialsResult = bsd_api.account_checkCredentials(username, old_password)\nassert_valid_account(checkCredentialsResult)",
"username = self.request.user.email\nnew_password = form.cleaned_data['new_password1']\nsetPasswo... | <|body_start_0|>
username = self.request.user.email
old_password = form.cleaned_data['old_password']
checkCredentialsResult = bsd_api.account_checkCredentials(username, old_password)
assert_valid_account(checkCredentialsResult)
<|end_body_0|>
<|body_start_1|>
username = self.req... | PasswordChangeView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PasswordChangeView:
def check_old_password(self, form):
"""Check if old password is valid in BSD"""
<|body_0|>
def set_new_password(self, form):
"""Set new password in BSD"""
<|body_1|>
def form_valid(self, form):
"""Check old password"""
... | stack_v2_sparse_classes_10k_train_008447 | 26,076 | permissive | [
{
"docstring": "Check if old password is valid in BSD",
"name": "check_old_password",
"signature": "def check_old_password(self, form)"
},
{
"docstring": "Set new password in BSD",
"name": "set_new_password",
"signature": "def set_new_password(self, form)"
},
{
"docstring": "Chec... | 3 | null | Implement the Python class `PasswordChangeView` described below.
Class description:
Implement the PasswordChangeView class.
Method signatures and docstrings:
- def check_old_password(self, form): Check if old password is valid in BSD
- def set_new_password(self, form): Set new password in BSD
- def form_valid(self, f... | Implement the Python class `PasswordChangeView` described below.
Class description:
Implement the PasswordChangeView class.
Method signatures and docstrings:
- def check_old_password(self, form): Check if old password is valid in BSD
- def set_new_password(self, form): Set new password in BSD
- def form_valid(self, f... | c8024b805ff5ff0e16f54dce7bf05097fd2f08e0 | <|skeleton|>
class PasswordChangeView:
def check_old_password(self, form):
"""Check if old password is valid in BSD"""
<|body_0|>
def set_new_password(self, form):
"""Set new password in BSD"""
<|body_1|>
def form_valid(self, form):
"""Check old password"""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PasswordChangeView:
def check_old_password(self, form):
"""Check if old password is valid in BSD"""
username = self.request.user.email
old_password = form.cleaned_data['old_password']
checkCredentialsResult = bsd_api.account_checkCredentials(username, old_password)
asse... | the_stack_v2_python_sparse | organizing_hub/views/views.py | Our-Revolution/site | train | 4 | |
ca63aac4d1f7230bf7b292ecf3e59f7ed20658f4 | [
"self.scr = scr\nself.label = TextLabel(scr=self.scr, text=TEXT_MESSAGE, color=TEXT_COLOR, size=FONT_SIZE)\nself.label.rect.center = self.scr.get_rect().center",
"self.scr.fill(SCREEN_COLOR)\nself.label.draw()\npygame.display.flip()"
] | <|body_start_0|>
self.scr = scr
self.label = TextLabel(scr=self.scr, text=TEXT_MESSAGE, color=TEXT_COLOR, size=FONT_SIZE)
self.label.rect.center = self.scr.get_rect().center
<|end_body_0|>
<|body_start_1|>
self.scr.fill(SCREEN_COLOR)
self.label.draw()
pygame.display.flip... | LoadingScreen | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoadingScreen:
def __init__(self, scr):
"""Input parameters: scr - Surface for drawing."""
<|body_0|>
def draw(self):
"""Fills the specified surface with solid color and renders the text label with message."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_10k_train_008448 | 851 | permissive | [
{
"docstring": "Input parameters: scr - Surface for drawing.",
"name": "__init__",
"signature": "def __init__(self, scr)"
},
{
"docstring": "Fills the specified surface with solid color and renders the text label with message.",
"name": "draw",
"signature": "def draw(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007210 | Implement the Python class `LoadingScreen` described below.
Class description:
Implement the LoadingScreen class.
Method signatures and docstrings:
- def __init__(self, scr): Input parameters: scr - Surface for drawing.
- def draw(self): Fills the specified surface with solid color and renders the text label with mes... | Implement the Python class `LoadingScreen` described below.
Class description:
Implement the LoadingScreen class.
Method signatures and docstrings:
- def __init__(self, scr): Input parameters: scr - Surface for drawing.
- def draw(self): Fills the specified surface with solid color and renders the text label with mes... | f15e9d609e763e70710cd3e0faea9a5a18dfd8a5 | <|skeleton|>
class LoadingScreen:
def __init__(self, scr):
"""Input parameters: scr - Surface for drawing."""
<|body_0|>
def draw(self):
"""Fills the specified surface with solid color and renders the text label with message."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class LoadingScreen:
def __init__(self, scr):
"""Input parameters: scr - Surface for drawing."""
self.scr = scr
self.label = TextLabel(scr=self.scr, text=TEXT_MESSAGE, color=TEXT_COLOR, size=FONT_SIZE)
self.label.rect.center = self.scr.get_rect().center
def draw(self):
"... | the_stack_v2_python_sparse | loading_screen.py | ammydolphin/space_racer | train | 0 | |
5a9b0798d7c7ffb85babad224f395cc8b4bfb9ec | [
"self.full_path = search_path\nself.directory_contents = listdir(self.full_path)\nself.config_filenames = []\nself.comp_filenames = []\nself.vi_list = []\nself._extract_config_filenames()",
"for filename in self.directory_contents:\n if fnmatch(filename, '*.conf'):\n self.config_filenames.append(filenam... | <|body_start_0|>
self.full_path = search_path
self.directory_contents = listdir(self.full_path)
self.config_filenames = []
self.comp_filenames = []
self.vi_list = []
self._extract_config_filenames()
<|end_body_0|>
<|body_start_1|>
for filename in self.directory_c... | Reads SECI configuration files and extracts VI names | ReadConfigFiles | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReadConfigFiles:
"""Reads SECI configuration files and extracts VI names"""
def __init__(self, search_path):
"""create lists for filenames and initialise to empty lists call methods for reading directory contents and searching for config filenames :param search_path: the search path ... | stack_v2_sparse_classes_10k_train_008449 | 3,583 | no_license | [
{
"docstring": "create lists for filenames and initialise to empty lists call methods for reading directory contents and searching for config filenames :param search_path: the search path for files",
"name": "__init__",
"signature": "def __init__(self, search_path)"
},
{
"docstring": "extract SE... | 6 | stack_v2_sparse_classes_30k_train_002688 | Implement the Python class `ReadConfigFiles` described below.
Class description:
Reads SECI configuration files and extracts VI names
Method signatures and docstrings:
- def __init__(self, search_path): create lists for filenames and initialise to empty lists call methods for reading directory contents and searching ... | Implement the Python class `ReadConfigFiles` described below.
Class description:
Reads SECI configuration files and extracts VI names
Method signatures and docstrings:
- def __init__(self, search_path): create lists for filenames and initialise to empty lists call methods for reading directory contents and searching ... | bcc5cf19773731979f3e3123a4f585a0bf723c1b | <|skeleton|>
class ReadConfigFiles:
"""Reads SECI configuration files and extracts VI names"""
def __init__(self, search_path):
"""create lists for filenames and initialise to empty lists call methods for reading directory contents and searching for config filenames :param search_path: the search path ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ReadConfigFiles:
"""Reads SECI configuration files and extracts VI names"""
def __init__(self, search_path):
"""create lists for filenames and initialise to empty lists call methods for reading directory contents and searching for config filenames :param search_path: the search path for files"""
... | the_stack_v2_python_sparse | SECI_Config_Analyser/Directory_Operations.py | ISISComputingGroup/ibex_utils | train | 0 |
ac72b15d3753c8c6976750c0b7350b07a8053b2f | [
"func = self.client.getCommandFunc('undo')\nif func is not None:\n func(('/undo', 'all', username), 'user', False)\nelse:\n self.client.sendServerMessage('Error: Could not find Undo command.')\nfunc = self.client.getCommandFunc('spec')\nif func is not None:\n func(('/spec', username), 'user', False)\nelse:... | <|body_start_0|>
func = self.client.getCommandFunc('undo')
if func is not None:
func(('/undo', 'all', username), 'user', False)
else:
self.client.sendServerMessage('Error: Could not find Undo command.')
func = self.client.getCommandFunc('spec')
if func is ... | xspec | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class xspec:
def commandXSpec(self, username, fromloc, overriderank):
"""/xspec username - Mod Undoes all builds by the user, specs them, and then kicks them."""
<|body_0|>
def commandUSpec(self, username, fromloc, overriderank):
"""/uspec username - Mod Undoes all builds ... | stack_v2_sparse_classes_10k_train_008450 | 2,046 | permissive | [
{
"docstring": "/xspec username - Mod Undoes all builds by the user, specs them, and then kicks them.",
"name": "commandXSpec",
"signature": "def commandXSpec(self, username, fromloc, overriderank)"
},
{
"docstring": "/uspec username - Mod Undoes all builds by the user and specs them.",
"nam... | 2 | stack_v2_sparse_classes_30k_train_000138 | Implement the Python class `xspec` described below.
Class description:
Implement the xspec class.
Method signatures and docstrings:
- def commandXSpec(self, username, fromloc, overriderank): /xspec username - Mod Undoes all builds by the user, specs them, and then kicks them.
- def commandUSpec(self, username, fromlo... | Implement the Python class `xspec` described below.
Class description:
Implement the xspec class.
Method signatures and docstrings:
- def commandXSpec(self, username, fromloc, overriderank): /xspec username - Mod Undoes all builds by the user, specs them, and then kicks them.
- def commandUSpec(self, username, fromlo... | 5482def8b50562fdbae980cda9b1708bfad8bffb | <|skeleton|>
class xspec:
def commandXSpec(self, username, fromloc, overriderank):
"""/xspec username - Mod Undoes all builds by the user, specs them, and then kicks them."""
<|body_0|>
def commandUSpec(self, username, fromloc, overriderank):
"""/uspec username - Mod Undoes all builds ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class xspec:
def commandXSpec(self, username, fromloc, overriderank):
"""/xspec username - Mod Undoes all builds by the user, specs them, and then kicks them."""
func = self.client.getCommandFunc('undo')
if func is not None:
func(('/undo', 'all', username), 'user', False)
... | the_stack_v2_python_sparse | core/plugins/xspec.py | TheArchives/Nexus | train | 1 | |
e29d37f279733ea606033c869a9d1ee48b514618 | [
"total_value = price * quantity\nself.product.update({'name': name, 'type': product_type, 'available_qty': quantity, 'sell_order': [], 'purchase_order': [], 'profit_loss': 0, 'valuation_price': total_value, 'purchase_value': total_value, 'sell_value': 0})\nif self.product['type'].lower() == 'service':\n self.pro... | <|body_start_0|>
total_value = price * quantity
self.product.update({'name': name, 'type': product_type, 'available_qty': quantity, 'sell_order': [], 'purchase_order': [], 'profit_loss': 0, 'valuation_price': total_value, 'purchase_value': total_value, 'sell_value': 0})
if self.product['type'].l... | Class Handles all operation on Product | Product | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Product:
"""Class Handles all operation on Product"""
def __init__(self, name, product_type, quantity, price):
"""func :- Defines product name, type and quantity. params :- product Name -string params :- product Type - string params :- product Quantity - integer params :- product pri... | stack_v2_sparse_classes_10k_train_008451 | 4,417 | no_license | [
{
"docstring": "func :- Defines product name, type and quantity. params :- product Name -string params :- product Type - string params :- product Quantity - integer params :- product price - integer returns :- nothing.",
"name": "__init__",
"signature": "def __init__(self, name, product_type, quantity, ... | 3 | stack_v2_sparse_classes_30k_train_001120 | Implement the Python class `Product` described below.
Class description:
Class Handles all operation on Product
Method signatures and docstrings:
- def __init__(self, name, product_type, quantity, price): func :- Defines product name, type and quantity. params :- product Name -string params :- product Type - string p... | Implement the Python class `Product` described below.
Class description:
Class Handles all operation on Product
Method signatures and docstrings:
- def __init__(self, name, product_type, quantity, price): func :- Defines product name, type and quantity. params :- product Name -string params :- product Type - string p... | 08668c834bdb4aee3abafdedc9126bba7aa041b8 | <|skeleton|>
class Product:
"""Class Handles all operation on Product"""
def __init__(self, name, product_type, quantity, price):
"""func :- Defines product name, type and quantity. params :- product Name -string params :- product Type - string params :- product Quantity - integer params :- product pri... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Product:
"""Class Handles all operation on Product"""
def __init__(self, name, product_type, quantity, price):
"""func :- Defines product name, type and quantity. params :- product Name -string params :- product Type - string params :- product Quantity - integer params :- product price - integer ... | the_stack_v2_python_sparse | productNew.py | maulikb-emipro/Python-Training | train | 0 |
9e6da15f6e988c32dedd8dd3a2a049e321732176 | [
"self.definitions = definitions\nself.per_client_bandwidth_limits = per_client_bandwidth_limits\nself.dscp_tag_value = dscp_tag_value\nself.priority = priority",
"if dictionary is None:\n return None\ndefinitions = None\nif dictionary.get('definitions') != None:\n definitions = list()\n for structure in ... | <|body_start_0|>
self.definitions = definitions
self.per_client_bandwidth_limits = per_client_bandwidth_limits
self.dscp_tag_value = dscp_tag_value
self.priority = priority
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
definitions = None
... | Implementation of the 'Rule13' model. TODO: type model description here. Attributes: definitions (list of DefinitionModel): A list of objects describing the definitions of your traffic shaping rule. At least one definition is required. per_client_bandwidth_limits (PerClientBandwidthLimitsModel): An object describing th... | Rule13Model | [
"MIT",
"Python-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Rule13Model:
"""Implementation of the 'Rule13' model. TODO: type model description here. Attributes: definitions (list of DefinitionModel): A list of objects describing the definitions of your traffic shaping rule. At least one definition is required. per_client_bandwidth_limits (PerClientBandwid... | stack_v2_sparse_classes_10k_train_008452 | 3,283 | permissive | [
{
"docstring": "Constructor for the Rule13Model class",
"name": "__init__",
"signature": "def __init__(self, definitions=None, per_client_bandwidth_limits=None, dscp_tag_value=None, priority=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionar... | 2 | null | Implement the Python class `Rule13Model` described below.
Class description:
Implementation of the 'Rule13' model. TODO: type model description here. Attributes: definitions (list of DefinitionModel): A list of objects describing the definitions of your traffic shaping rule. At least one definition is required. per_cl... | Implement the Python class `Rule13Model` described below.
Class description:
Implementation of the 'Rule13' model. TODO: type model description here. Attributes: definitions (list of DefinitionModel): A list of objects describing the definitions of your traffic shaping rule. At least one definition is required. per_cl... | 9894089eb013318243ae48869cc5130eb37f80c0 | <|skeleton|>
class Rule13Model:
"""Implementation of the 'Rule13' model. TODO: type model description here. Attributes: definitions (list of DefinitionModel): A list of objects describing the definitions of your traffic shaping rule. At least one definition is required. per_client_bandwidth_limits (PerClientBandwid... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Rule13Model:
"""Implementation of the 'Rule13' model. TODO: type model description here. Attributes: definitions (list of DefinitionModel): A list of objects describing the definitions of your traffic shaping rule. At least one definition is required. per_client_bandwidth_limits (PerClientBandwidthLimitsModel... | the_stack_v2_python_sparse | meraki_sdk/models/rule_13_model.py | RaulCatalano/meraki-python-sdk | train | 1 |
f7a9329d5ad32224207121fe82e976e8a2743832 | [
"super(FunctionGamma, self).__init__()\nself.num = num\nself.EPSILON = 1e-07",
"num = self.num\nif num < 0.5:\n return self.PI / (math.sin(self.PI * num) * FunctionGamma(1 - num).calculateEquation())\nelse:\n num -= 1\n x = lanczos_coef[0]\n for i in range(1, len(lanczos_coef)):\n x += lanczos_... | <|body_start_0|>
super(FunctionGamma, self).__init__()
self.num = num
self.EPSILON = 1e-07
<|end_body_0|>
<|body_start_1|>
num = self.num
if num < 0.5:
return self.PI / (math.sin(self.PI * num) * FunctionGamma(1 - num).calculateEquation())
else:
n... | Class used to calculate the Gamma function. | FunctionGamma | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FunctionGamma:
"""Class used to calculate the Gamma function."""
def __init__(self, num: float) -> None:
"""Constructor."""
<|body_0|>
def calculateEquation(self) -> float:
"""Function used to calculate the gamma function. Returns Gamma(self.num)"""
<|bod... | stack_v2_sparse_classes_10k_train_008453 | 1,589 | no_license | [
{
"docstring": "Constructor.",
"name": "__init__",
"signature": "def __init__(self, num: float) -> None"
},
{
"docstring": "Function used to calculate the gamma function. Returns Gamma(self.num)",
"name": "calculateEquation",
"signature": "def calculateEquation(self) -> float"
}
] | 2 | stack_v2_sparse_classes_30k_train_002181 | Implement the Python class `FunctionGamma` described below.
Class description:
Class used to calculate the Gamma function.
Method signatures and docstrings:
- def __init__(self, num: float) -> None: Constructor.
- def calculateEquation(self) -> float: Function used to calculate the gamma function. Returns Gamma(self.... | Implement the Python class `FunctionGamma` described below.
Class description:
Class used to calculate the Gamma function.
Method signatures and docstrings:
- def __init__(self, num: float) -> None: Constructor.
- def calculateEquation(self) -> float: Function used to calculate the gamma function. Returns Gamma(self.... | c1f864dabc5ba4a83da635f37002a2e5d07b7d25 | <|skeleton|>
class FunctionGamma:
"""Class used to calculate the Gamma function."""
def __init__(self, num: float) -> None:
"""Constructor."""
<|body_0|>
def calculateEquation(self) -> float:
"""Function used to calculate the gamma function. Returns Gamma(self.num)"""
<|bod... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FunctionGamma:
"""Class used to calculate the Gamma function."""
def __init__(self, num: float) -> None:
"""Constructor."""
super(FunctionGamma, self).__init__()
self.num = num
self.EPSILON = 1e-07
def calculateEquation(self) -> float:
"""Function used to calc... | the_stack_v2_python_sparse | src/FunctionGamma.py | shvnks/comp354_calculator | train | 0 |
31c53490c06bfa0e3c5ccca769db2e318c4527ff | [
"super(SimpleNet, self).__init__()\nself.conv_layers = None\nself.fc_layers = None\nself.loss_criterion = None\nself.conv_layers = nn.Sequential(nn.Conv2d(1, 10, kernel_size=5, stride=1), nn.ReLU(), nn.MaxPool2d(3), nn.Conv2d(10, 20, kernel_size=5, stride=1), nn.ReLU(), nn.MaxPool2d(3))\nconv_out = int(20 * 5 * 5)\... | <|body_start_0|>
super(SimpleNet, self).__init__()
self.conv_layers = None
self.fc_layers = None
self.loss_criterion = None
self.conv_layers = nn.Sequential(nn.Conv2d(1, 10, kernel_size=5, stride=1), nn.ReLU(), nn.MaxPool2d(3), nn.Conv2d(10, 20, kernel_size=5, stride=1), nn.ReLU(... | SimpleNet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SimpleNet:
def __init__(self):
"""Constructor for SimpleNet class to define the layers and loss function. Note: Use 'mean' reduction in the loss_criterion. Read Pytorch's documention to understand what this means."""
<|body_0|>
def forward(self, x: torch.Tensor) -> torch.Ten... | stack_v2_sparse_classes_10k_train_008454 | 2,210 | no_license | [
{
"docstring": "Constructor for SimpleNet class to define the layers and loss function. Note: Use 'mean' reduction in the loss_criterion. Read Pytorch's documention to understand what this means.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Perform the forward pass ... | 2 | stack_v2_sparse_classes_30k_train_006270 | Implement the Python class `SimpleNet` described below.
Class description:
Implement the SimpleNet class.
Method signatures and docstrings:
- def __init__(self): Constructor for SimpleNet class to define the layers and loss function. Note: Use 'mean' reduction in the loss_criterion. Read Pytorch's documention to unde... | Implement the Python class `SimpleNet` described below.
Class description:
Implement the SimpleNet class.
Method signatures and docstrings:
- def __init__(self): Constructor for SimpleNet class to define the layers and loss function. Note: Use 'mean' reduction in the loss_criterion. Read Pytorch's documention to unde... | fd47764547131cb6382124b27fe7d428cbf4c64a | <|skeleton|>
class SimpleNet:
def __init__(self):
"""Constructor for SimpleNet class to define the layers and loss function. Note: Use 'mean' reduction in the loss_criterion. Read Pytorch's documention to understand what this means."""
<|body_0|>
def forward(self, x: torch.Tensor) -> torch.Ten... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SimpleNet:
def __init__(self):
"""Constructor for SimpleNet class to define the layers and loss function. Note: Use 'mean' reduction in the loss_criterion. Read Pytorch's documention to understand what this means."""
super(SimpleNet, self).__init__()
self.conv_layers = None
sel... | the_stack_v2_python_sparse | proj5/proj5_code/simple_net.py | pranavshenoykp/computerVision | train | 2 | |
8371054e14af4463292b2d89bd3e6f1696336d5d | [
"class _Simple:\n pass\nr = pcapy.open_offline(TestPcapy._96PINGS)\nself.assertEqual(sys.getrefcount(r.next()[0]), sys.getrefcount(_Simple()))",
"class _Simple:\n pass\nr = pcapy.open_offline(TestPcapy._96PINGS)\ni = 0\nrefNone = sys.getrefcount(None)\ns = r.next()\nwhile not s[0] is None:\n s = r.next()... | <|body_start_0|>
class _Simple:
pass
r = pcapy.open_offline(TestPcapy._96PINGS)
self.assertEqual(sys.getrefcount(r.next()[0]), sys.getrefcount(_Simple()))
<|end_body_0|>
<|body_start_1|>
class _Simple:
pass
r = pcapy.open_offline(TestPcapy._96PINGS)
... | TestPcapy | [
"Apache-2.0",
"Apache-1.1",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestPcapy:
def testPacketHeaderRefCount(self):
"""#1:when next() creates a pkthdr it make one extra reference"""
<|body_0|>
def testEOFValue(self):
"""#1:when next() creates a pkthdr it make one extra reference"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|... | stack_v2_sparse_classes_10k_train_008455 | 1,545 | permissive | [
{
"docstring": "#1:when next() creates a pkthdr it make one extra reference",
"name": "testPacketHeaderRefCount",
"signature": "def testPacketHeaderRefCount(self)"
},
{
"docstring": "#1:when next() creates a pkthdr it make one extra reference",
"name": "testEOFValue",
"signature": "def t... | 2 | stack_v2_sparse_classes_30k_train_002246 | Implement the Python class `TestPcapy` described below.
Class description:
Implement the TestPcapy class.
Method signatures and docstrings:
- def testPacketHeaderRefCount(self): #1:when next() creates a pkthdr it make one extra reference
- def testEOFValue(self): #1:when next() creates a pkthdr it make one extra refe... | Implement the Python class `TestPcapy` described below.
Class description:
Implement the TestPcapy class.
Method signatures and docstrings:
- def testPacketHeaderRefCount(self): #1:when next() creates a pkthdr it make one extra reference
- def testEOFValue(self): #1:when next() creates a pkthdr it make one extra refe... | 8f929d72cd28275e1a841c8d949955b5573236a7 | <|skeleton|>
class TestPcapy:
def testPacketHeaderRefCount(self):
"""#1:when next() creates a pkthdr it make one extra reference"""
<|body_0|>
def testEOFValue(self):
"""#1:when next() creates a pkthdr it make one extra reference"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestPcapy:
def testPacketHeaderRefCount(self):
"""#1:when next() creates a pkthdr it make one extra reference"""
class _Simple:
pass
r = pcapy.open_offline(TestPcapy._96PINGS)
self.assertEqual(sys.getrefcount(r.next()[0]), sys.getrefcount(_Simple()))
def testEO... | the_stack_v2_python_sparse | pkgs/pcapy-0.10.8/build/scripts-2.7/pcapytests.py | DsRoyster/DeadlineRouting | train | 2 | |
f53e8d47c874f62e63b8b4e7a2f1b6c2e94f4df6 | [
"with datastore_services.get_ndb_context():\n latest_exploration = exp_fetchers.get_exploration_by_id(exp_id, strict=False)\n if latest_exploration is None:\n return result.Err((exp_id, Exception('Exploration does not exist.')))\n exploration_model = exp_models.ExplorationModel.get(exp_id)\nif explo... | <|body_start_0|>
with datastore_services.get_ndb_context():
latest_exploration = exp_fetchers.get_exploration_by_id(exp_id, strict=False)
if latest_exploration is None:
return result.Err((exp_id, Exception('Exploration does not exist.')))
exploration_model = e... | A reusable one-off job for testing the migration of all exp versions to the latest schema version. This job runs the state migration, but does not commit the new exploration to the datastore. | ExpSnapshotsMigrationAuditJob | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExpSnapshotsMigrationAuditJob:
"""A reusable one-off job for testing the migration of all exp versions to the latest schema version. This job runs the state migration, but does not commit the new exploration to the datastore."""
def _migrate_exploration_snapshot_model(exp_id: str, exp_snapsh... | stack_v2_sparse_classes_10k_train_008456 | 28,752 | permissive | [
{
"docstring": "Migrates exploration snapshot content model but does not put it in the datastore. Args: exp_id: str. The ID of the exploration. exp_snapshot_model: ExplorationSnapshotContentModel. The exploration model to migrate. Returns: Result((str, Exception)). Result containing tuple that consists of explo... | 2 | null | Implement the Python class `ExpSnapshotsMigrationAuditJob` described below.
Class description:
A reusable one-off job for testing the migration of all exp versions to the latest schema version. This job runs the state migration, but does not commit the new exploration to the datastore.
Method signatures and docstring... | Implement the Python class `ExpSnapshotsMigrationAuditJob` described below.
Class description:
A reusable one-off job for testing the migration of all exp versions to the latest schema version. This job runs the state migration, but does not commit the new exploration to the datastore.
Method signatures and docstring... | d16fdf23d790eafd63812bd7239532256e30a21d | <|skeleton|>
class ExpSnapshotsMigrationAuditJob:
"""A reusable one-off job for testing the migration of all exp versions to the latest schema version. This job runs the state migration, but does not commit the new exploration to the datastore."""
def _migrate_exploration_snapshot_model(exp_id: str, exp_snapsh... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ExpSnapshotsMigrationAuditJob:
"""A reusable one-off job for testing the migration of all exp versions to the latest schema version. This job runs the state migration, but does not commit the new exploration to the datastore."""
def _migrate_exploration_snapshot_model(exp_id: str, exp_snapshot_model: exp... | the_stack_v2_python_sparse | core/jobs/batch_jobs/exp_migration_jobs.py | oppia/oppia | train | 6,172 |
d646cb1df0afe8fbe23d81f04d56e56be8a4980d | [
"def sumNumbersRec(nd, sum, total):\n sum = sum * 10 + nd.val\n if not nd.left and (not nd.right):\n total.append(sum)\n if nd.left:\n sumNumbersRec(nd.left, sum, total)\n if nd.right:\n sumNumbersRec(nd.right, sum, total)\nif not root:\n return\nret = []\nsumNumbersRec(root, 0, ... | <|body_start_0|>
def sumNumbersRec(nd, sum, total):
sum = sum * 10 + nd.val
if not nd.left and (not nd.right):
total.append(sum)
if nd.left:
sumNumbersRec(nd.left, sum, total)
if nd.right:
sumNumbersRec(nd.right, sum... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def sumNumbers1(self, root):
""":type root: TreeNode :rtype: int"""
<|body_0|>
def sumNumbers2(self, root):
""":type root: TreeNode :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
def sumNumbersRec(nd, sum, total):
... | stack_v2_sparse_classes_10k_train_008457 | 1,579 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: int",
"name": "sumNumbers1",
"signature": "def sumNumbers1(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: int",
"name": "sumNumbers2",
"signature": "def sumNumbers2(self, root)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def sumNumbers1(self, root): :type root: TreeNode :rtype: int
- def sumNumbers2(self, root): :type root: TreeNode :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def sumNumbers1(self, root): :type root: TreeNode :rtype: int
- def sumNumbers2(self, root): :type root: TreeNode :rtype: int
<|skeleton|>
class Solution:
def sumNumbers1(s... | d3e8669f932fc2e22711e8b7590d3365d020e189 | <|skeleton|>
class Solution:
def sumNumbers1(self, root):
""":type root: TreeNode :rtype: int"""
<|body_0|>
def sumNumbers2(self, root):
""":type root: TreeNode :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def sumNumbers1(self, root):
""":type root: TreeNode :rtype: int"""
def sumNumbersRec(nd, sum, total):
sum = sum * 10 + nd.val
if not nd.left and (not nd.right):
total.append(sum)
if nd.left:
sumNumbersRec(nd.left, s... | the_stack_v2_python_sparse | leetcode/129.py | liuweilin17/algorithm | train | 3 | |
86a9a44e6fd9bce0bef0e38d3ac3871984b89cdb | [
"tokens = os.path.splitext(os.path.basename(limitfile))[0].split('_')\nif tokens[3] in ['point', 'dmap', 'dradial']:\n return True\nreturn tokens[2] in ['point', 'dmap', 'dradial']",
"tokens = os.path.splitext(os.path.basename(limitfile))[0].split('_')\nif tokens[3] in ['point', 'map', 'radial']:\n return T... | <|body_start_0|>
tokens = os.path.splitext(os.path.basename(limitfile))[0].split('_')
if tokens[3] in ['point', 'dmap', 'dradial']:
return True
return tokens[2] in ['point', 'dmap', 'dradial']
<|end_body_0|>
<|body_start_1|>
tokens = os.path.splitext(os.path.basename(limitfi... | Small class to collect limit results from a series of simulations. | CollectLimits | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CollectLimits:
"""Small class to collect limit results from a series of simulations."""
def is_decay_limits(limitfile):
"""Return true if a file has limits for decay"""
<|body_0|>
def is_ann_limits(limitfile):
"""Return true if a file has limits for annhilation""... | stack_v2_sparse_classes_10k_train_008458 | 11,467 | permissive | [
{
"docstring": "Return true if a file has limits for decay",
"name": "is_decay_limits",
"signature": "def is_decay_limits(limitfile)"
},
{
"docstring": "Return true if a file has limits for annhilation",
"name": "is_ann_limits",
"signature": "def is_ann_limits(limitfile)"
},
{
"d... | 4 | stack_v2_sparse_classes_30k_train_005133 | Implement the Python class `CollectLimits` described below.
Class description:
Small class to collect limit results from a series of simulations.
Method signatures and docstrings:
- def is_decay_limits(limitfile): Return true if a file has limits for decay
- def is_ann_limits(limitfile): Return true if a file has lim... | Implement the Python class `CollectLimits` described below.
Class description:
Small class to collect limit results from a series of simulations.
Method signatures and docstrings:
- def is_decay_limits(limitfile): Return true if a file has limits for decay
- def is_ann_limits(limitfile): Return true if a file has lim... | e5b3f950d18d5077f7abf46f53fcf59e97bb3301 | <|skeleton|>
class CollectLimits:
"""Small class to collect limit results from a series of simulations."""
def is_decay_limits(limitfile):
"""Return true if a file has limits for decay"""
<|body_0|>
def is_ann_limits(limitfile):
"""Return true if a file has limits for annhilation""... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CollectLimits:
"""Small class to collect limit results from a series of simulations."""
def is_decay_limits(limitfile):
"""Return true if a file has limits for decay"""
tokens = os.path.splitext(os.path.basename(limitfile))[0].split('_')
if tokens[3] in ['point', 'dmap', 'dradial'... | the_stack_v2_python_sparse | dmpipe/dm_collect.py | fermiPy/dmpipe | train | 1 |
3eb543f19fef7fe35fd0503d05c76772610b332f | [
"request_json = {'mode': 'test'}\nr = requests.post('http://localhost:{}/train'.format(port), json=request_json)\ntrain_complete = re.sub('\\\\W+', '', r.text)\nself.assertEqual(train_complete, 'true')",
"r = requests.post('http://localhost:{}/predict'.format(port))\nself.assertEqual(re.sub('\\n|\"', '', r.text),... | <|body_start_0|>
request_json = {'mode': 'test'}
r = requests.post('http://localhost:{}/train'.format(port), json=request_json)
train_complete = re.sub('\\W+', '', r.text)
self.assertEqual(train_complete, 'true')
<|end_body_0|>
<|body_start_1|>
r = requests.post('http://localhos... | test the essential functionality | ApiTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ApiTest:
"""test the essential functionality"""
def test_01_train(self):
"""test the train functionality"""
<|body_0|>
def test_02_predict_empty(self):
"""ensure appropriate failure types"""
<|body_1|>
def test_03_predict(self):
"""test the p... | stack_v2_sparse_classes_10k_train_008459 | 3,077 | no_license | [
{
"docstring": "test the train functionality",
"name": "test_01_train",
"signature": "def test_01_train(self)"
},
{
"docstring": "ensure appropriate failure types",
"name": "test_02_predict_empty",
"signature": "def test_02_predict_empty(self)"
},
{
"docstring": "test the predict... | 4 | stack_v2_sparse_classes_30k_train_001690 | Implement the Python class `ApiTest` described below.
Class description:
test the essential functionality
Method signatures and docstrings:
- def test_01_train(self): test the train functionality
- def test_02_predict_empty(self): ensure appropriate failure types
- def test_03_predict(self): test the predict function... | Implement the Python class `ApiTest` described below.
Class description:
test the essential functionality
Method signatures and docstrings:
- def test_01_train(self): test the train functionality
- def test_02_predict_empty(self): ensure appropriate failure types
- def test_03_predict(self): test the predict function... | 0b68917effa6128862d997c61dcae1d0df8ff109 | <|skeleton|>
class ApiTest:
"""test the essential functionality"""
def test_01_train(self):
"""test the train functionality"""
<|body_0|>
def test_02_predict_empty(self):
"""ensure appropriate failure types"""
<|body_1|>
def test_03_predict(self):
"""test the p... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ApiTest:
"""test the essential functionality"""
def test_01_train(self):
"""test the train functionality"""
request_json = {'mode': 'test'}
r = requests.post('http://localhost:{}/train'.format(port), json=request_json)
train_complete = re.sub('\\W+', '', r.text)
se... | the_stack_v2_python_sparse | unittests/api_tests.py | ryusat/capstonepeerreveiw | train | 0 |
b524d88baff6bdcc47fa3486a383a688a967b9fa | [
"try:\n from bokeh.plotting import Figure\nexcept (ModuleNotFoundError, ImportError) as Error:\n raise Error(\"Using 'BokehArtifact' requires bokeh package. Use pip install mlrun[bokeh] to install it.\")\nif figure is not None and (not isinstance(figure, Figure)):\n raise ValueError(\"BokehArtifact require... | <|body_start_0|>
try:
from bokeh.plotting import Figure
except (ModuleNotFoundError, ImportError) as Error:
raise Error("Using 'BokehArtifact' requires bokeh package. Use pip install mlrun[bokeh] to install it.")
if figure is not None and (not isinstance(figure, Figure)):... | Bokeh artifact is an artifact for saving Bokeh generated figures. They will be stored in a html format. | BokehArtifact | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BokehArtifact:
"""Bokeh artifact is an artifact for saving Bokeh generated figures. They will be stored in a html format."""
def __init__(self, figure=None, key: str=None, target_path: str=None):
"""Initialize a Bokeh artifact with the given figure. :param figure: Bokeh figure ('boke... | stack_v2_sparse_classes_10k_train_008460 | 15,717 | permissive | [
{
"docstring": "Initialize a Bokeh artifact with the given figure. :param figure: Bokeh figure ('bokeh.plotting.Figure' object) to save as an artifact. :param key: Key for the artifact to be stored in the database. :param target_path: Path to save the artifact.",
"name": "__init__",
"signature": "def __... | 2 | stack_v2_sparse_classes_30k_train_001678 | Implement the Python class `BokehArtifact` described below.
Class description:
Bokeh artifact is an artifact for saving Bokeh generated figures. They will be stored in a html format.
Method signatures and docstrings:
- def __init__(self, figure=None, key: str=None, target_path: str=None): Initialize a Bokeh artifact ... | Implement the Python class `BokehArtifact` described below.
Class description:
Bokeh artifact is an artifact for saving Bokeh generated figures. They will be stored in a html format.
Method signatures and docstrings:
- def __init__(self, figure=None, key: str=None, target_path: str=None): Initialize a Bokeh artifact ... | b5fe0c05ae7f5818a4a5a5a40245c851ff9b2c77 | <|skeleton|>
class BokehArtifact:
"""Bokeh artifact is an artifact for saving Bokeh generated figures. They will be stored in a html format."""
def __init__(self, figure=None, key: str=None, target_path: str=None):
"""Initialize a Bokeh artifact with the given figure. :param figure: Bokeh figure ('boke... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BokehArtifact:
"""Bokeh artifact is an artifact for saving Bokeh generated figures. They will be stored in a html format."""
def __init__(self, figure=None, key: str=None, target_path: str=None):
"""Initialize a Bokeh artifact with the given figure. :param figure: Bokeh figure ('bokeh.plotting.Fi... | the_stack_v2_python_sparse | mlrun/artifacts/plots.py | mlrun/mlrun | train | 1,093 |
b84426955d0c3729749742c688beacc5e4cd0aa3 | [
"self.logger = PatchLogger(__name__, debug=debug)\nself._COMMAND_PATH = '/etc/securetea/asp/commands.json'\nself.config_data = self.open_json(self._COMMAND_PATH)\nself.os_name = utils.categorize_os()\nif self.os_name:\n try:\n self.os_config_data = self.config_data[self.os_name]\n except KeyError:\n ... | <|body_start_0|>
self.logger = PatchLogger(__name__, debug=debug)
self._COMMAND_PATH = '/etc/securetea/asp/commands.json'
self.config_data = self.open_json(self._COMMAND_PATH)
self.os_name = utils.categorize_os()
if self.os_name:
try:
self.os_config_da... | Installer Class. | Installer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Installer:
"""Installer Class."""
def __init__(self, debug=False):
"""Initialize Installer. Args: debug (bool): Log on terminal or not Raises: None Returns: None"""
<|body_0|>
def open_json(path):
"""Read from JSON file. Args: path (str): Path of the JSON file Ra... | stack_v2_sparse_classes_10k_train_008461 | 3,574 | permissive | [
{
"docstring": "Initialize Installer. Args: debug (bool): Log on terminal or not Raises: None Returns: None",
"name": "__init__",
"signature": "def __init__(self, debug=False)"
},
{
"docstring": "Read from JSON file. Args: path (str): Path of the JSON file Raises: None Returns: None",
"name"... | 4 | stack_v2_sparse_classes_30k_train_001463 | Implement the Python class `Installer` described below.
Class description:
Installer Class.
Method signatures and docstrings:
- def __init__(self, debug=False): Initialize Installer. Args: debug (bool): Log on terminal or not Raises: None Returns: None
- def open_json(path): Read from JSON file. Args: path (str): Pat... | Implement the Python class `Installer` described below.
Class description:
Installer Class.
Method signatures and docstrings:
- def __init__(self, debug=False): Initialize Installer. Args: debug (bool): Log on terminal or not Raises: None Returns: None
- def open_json(path): Read from JSON file. Args: path (str): Pat... | 43dec187e5848b9ced8a6b4957b6e9028d4d43cd | <|skeleton|>
class Installer:
"""Installer Class."""
def __init__(self, debug=False):
"""Initialize Installer. Args: debug (bool): Log on terminal or not Raises: None Returns: None"""
<|body_0|>
def open_json(path):
"""Read from JSON file. Args: path (str): Path of the JSON file Ra... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Installer:
"""Installer Class."""
def __init__(self, debug=False):
"""Initialize Installer. Args: debug (bool): Log on terminal or not Raises: None Returns: None"""
self.logger = PatchLogger(__name__, debug=debug)
self._COMMAND_PATH = '/etc/securetea/asp/commands.json'
sel... | the_stack_v2_python_sparse | securetea/lib/auto_server_patcher/installer.py | rejahrehim/SecureTea-Project | train | 1 |
fa2751a9294b848831347ed228b6789c8d9406e2 | [
"if isinstance(user, int):\n userinfo = await self.db.users.find_one({'user_id': str(user)})\n if not userinfo:\n await ctx.send('Discord user with ID `{}` not found.'.format(user))\n return\n user = discord.Object(user)\nchat_block = time.time() + bantime.total_seconds()\ntry:\n await sel... | <|body_start_0|>
if isinstance(user, int):
userinfo = await self.db.users.find_one({'user_id': str(user)})
if not userinfo:
await ctx.send('Discord user with ID `{}` not found.'.format(user))
return
user = discord.Object(user)
chat_bloc... | User-related administration commands | Users | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Users:
"""User-related administration commands"""
async def xpban(self, ctx, bantime: commands.converter.TimedeltaConverter(default_unit='seconds'), *, user: Union[discord.User, int]):
"""Ban user from getting experience."""
<|body_0|>
async def setlevel(self, ctx, user:... | stack_v2_sparse_classes_10k_train_008462 | 2,971 | permissive | [
{
"docstring": "Ban user from getting experience.",
"name": "xpban",
"signature": "async def xpban(self, ctx, bantime: commands.converter.TimedeltaConverter(default_unit='seconds'), *, user: Union[discord.User, int])"
},
{
"docstring": "Set a user's level manually.",
"name": "setlevel",
... | 2 | stack_v2_sparse_classes_30k_train_006276 | Implement the Python class `Users` described below.
Class description:
User-related administration commands
Method signatures and docstrings:
- async def xpban(self, ctx, bantime: commands.converter.TimedeltaConverter(default_unit='seconds'), *, user: Union[discord.User, int]): Ban user from getting experience.
- asy... | Implement the Python class `Users` described below.
Class description:
User-related administration commands
Method signatures and docstrings:
- async def xpban(self, ctx, bantime: commands.converter.TimedeltaConverter(default_unit='seconds'), *, user: Union[discord.User, int]): Ban user from getting experience.
- asy... | c977b1d127629b858235b23dd86e5fe0756d1edb | <|skeleton|>
class Users:
"""User-related administration commands"""
async def xpban(self, ctx, bantime: commands.converter.TimedeltaConverter(default_unit='seconds'), *, user: Union[discord.User, int]):
"""Ban user from getting experience."""
<|body_0|>
async def setlevel(self, ctx, user:... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Users:
"""User-related administration commands"""
async def xpban(self, ctx, bantime: commands.converter.TimedeltaConverter(default_unit='seconds'), *, user: Union[discord.User, int]):
"""Ban user from getting experience."""
if isinstance(user, int):
userinfo = await self.db.u... | the_stack_v2_python_sparse | leveler/commands/lvladmin/users.py | fixator10/Fixator10-Cogs | train | 90 |
ac3a7a66cc07453c364ad30a3ede2d9bbbebae4f | [
"self._strategy = strategy\nself._ssl_dataset_name = ssl_dataset_name\nself._ds_dataset_name = ds_dataset_name\nself._model_path = model_path\nself._experiment_id = experiment_id\nself._batch_size = batch_size\nself._epochs = epochs\nself._learning_rate = learning_rate\nself._temperature = temperature\nself._embedd... | <|body_start_0|>
self._strategy = strategy
self._ssl_dataset_name = ssl_dataset_name
self._ds_dataset_name = ds_dataset_name
self._model_path = model_path
self._experiment_id = experiment_id
self._batch_size = batch_size
self._epochs = epochs
self._learnin... | Provides functionality for self-supervised constrastive learning model. | ContrastiveModel | [
"Apache-2.0",
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ContrastiveModel:
"""Provides functionality for self-supervised constrastive learning model."""
def __init__(self, strategy, ssl_dataset_name, ds_dataset_name, model_path, experiment_id, batch_size, epochs, learning_rate, embedding_dim, temperature, similarity_type, pooling_type, noise, step... | stack_v2_sparse_classes_10k_train_008463 | 4,801 | permissive | [
{
"docstring": "Initializes a contrastive model object.",
"name": "__init__",
"signature": "def __init__(self, strategy, ssl_dataset_name, ds_dataset_name, model_path, experiment_id, batch_size, epochs, learning_rate, embedding_dim, temperature, similarity_type, pooling_type, noise, steps_per_epoch=1000... | 4 | stack_v2_sparse_classes_30k_train_003751 | Implement the Python class `ContrastiveModel` described below.
Class description:
Provides functionality for self-supervised constrastive learning model.
Method signatures and docstrings:
- def __init__(self, strategy, ssl_dataset_name, ds_dataset_name, model_path, experiment_id, batch_size, epochs, learning_rate, em... | Implement the Python class `ContrastiveModel` described below.
Class description:
Provides functionality for self-supervised constrastive learning model.
Method signatures and docstrings:
- def __init__(self, strategy, ssl_dataset_name, ds_dataset_name, model_path, experiment_id, batch_size, epochs, learning_rate, em... | 5573d9c5822f4e866b6692769963ae819cb3f10d | <|skeleton|>
class ContrastiveModel:
"""Provides functionality for self-supervised constrastive learning model."""
def __init__(self, strategy, ssl_dataset_name, ds_dataset_name, model_path, experiment_id, batch_size, epochs, learning_rate, embedding_dim, temperature, similarity_type, pooling_type, noise, step... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ContrastiveModel:
"""Provides functionality for self-supervised constrastive learning model."""
def __init__(self, strategy, ssl_dataset_name, ds_dataset_name, model_path, experiment_id, batch_size, epochs, learning_rate, embedding_dim, temperature, similarity_type, pooling_type, noise, steps_per_epoch=1... | the_stack_v2_python_sparse | cola/contrastive.py | Jimmy-INL/google-research | train | 1 |
fa806ae87b567dddad8bc4f7564f14111ef7cada | [
"self._schema = customer_schema\nself._provider_uuid = provider_uuid\nself._manifest = None\nif manifest_id is not None:\n with ReportManifestDBAccessor() as manifest_accessor:\n self._manifest = manifest_accessor.get_manifest_by_id(manifest_id)\nself._date_accessor = DateAccessor()\nwith ProviderDBAccess... | <|body_start_0|>
self._schema = customer_schema
self._provider_uuid = provider_uuid
self._manifest = None
if manifest_id is not None:
with ReportManifestDBAccessor() as manifest_accessor:
self._manifest = manifest_accessor.get_manifest_by_id(manifest_id)
... | Update reporting summary tables. | ReportSummaryUpdater | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReportSummaryUpdater:
"""Update reporting summary tables."""
def __init__(self, customer_schema, provider_uuid, manifest_id=None):
"""Initializer. Args: customer_schema (str): Schema name for given customer. provider (str): The provider type."""
<|body_0|>
def _set_updat... | stack_v2_sparse_classes_10k_train_008464 | 7,462 | permissive | [
{
"docstring": "Initializer. Args: customer_schema (str): Schema name for given customer. provider (str): The provider type.",
"name": "__init__",
"signature": "def __init__(self, customer_schema, provider_uuid, manifest_id=None)"
},
{
"docstring": "Create the report summary updater object. Obje... | 5 | null | Implement the Python class `ReportSummaryUpdater` described below.
Class description:
Update reporting summary tables.
Method signatures and docstrings:
- def __init__(self, customer_schema, provider_uuid, manifest_id=None): Initializer. Args: customer_schema (str): Schema name for given customer. provider (str): The... | Implement the Python class `ReportSummaryUpdater` described below.
Class description:
Update reporting summary tables.
Method signatures and docstrings:
- def __init__(self, customer_schema, provider_uuid, manifest_id=None): Initializer. Args: customer_schema (str): Schema name for given customer. provider (str): The... | 2979f03fbdd1c20c3abc365a963a1282b426f321 | <|skeleton|>
class ReportSummaryUpdater:
"""Update reporting summary tables."""
def __init__(self, customer_schema, provider_uuid, manifest_id=None):
"""Initializer. Args: customer_schema (str): Schema name for given customer. provider (str): The provider type."""
<|body_0|>
def _set_updat... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ReportSummaryUpdater:
"""Update reporting summary tables."""
def __init__(self, customer_schema, provider_uuid, manifest_id=None):
"""Initializer. Args: customer_schema (str): Schema name for given customer. provider (str): The provider type."""
self._schema = customer_schema
self... | the_stack_v2_python_sparse | koku/masu/processor/report_summary_updater.py | luisfdez/koku | train | 0 |
6e1a3d39d264faa433393fac090468446e888bfe | [
"request = urllib2.Request(api_url + '/compliance/compliance_detail')\nresponse = urllib2.urlopen(request)\njson_object = json.load(response)\nreturn json_object",
"request = urllib2.Request(api_url + '/compliance/compliance_detail?&sort=requirement.name:asc')\nresponse = urllib2.urlopen(request)\njson_object = j... | <|body_start_0|>
request = urllib2.Request(api_url + '/compliance/compliance_detail')
response = urllib2.urlopen(request)
json_object = json.load(response)
return json_object
<|end_body_0|>
<|body_start_1|>
request = urllib2.Request(api_url + '/compliance/compliance_detail?&sort... | MockComplianceApiUtils | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MockComplianceApiUtils:
def grab_compliance_json(self, api_url):
"""Return the json grabbed from api :return:"""
<|body_0|>
def grab_sorted_ascending_compliance_json(self, api_url):
"""Return the json grabbed from api :return:"""
<|body_1|>
def grab_sort... | stack_v2_sparse_classes_10k_train_008465 | 1,145 | no_license | [
{
"docstring": "Return the json grabbed from api :return:",
"name": "grab_compliance_json",
"signature": "def grab_compliance_json(self, api_url)"
},
{
"docstring": "Return the json grabbed from api :return:",
"name": "grab_sorted_ascending_compliance_json",
"signature": "def grab_sorted... | 3 | stack_v2_sparse_classes_30k_test_000042 | Implement the Python class `MockComplianceApiUtils` described below.
Class description:
Implement the MockComplianceApiUtils class.
Method signatures and docstrings:
- def grab_compliance_json(self, api_url): Return the json grabbed from api :return:
- def grab_sorted_ascending_compliance_json(self, api_url): Return ... | Implement the Python class `MockComplianceApiUtils` described below.
Class description:
Implement the MockComplianceApiUtils class.
Method signatures and docstrings:
- def grab_compliance_json(self, api_url): Return the json grabbed from api :return:
- def grab_sorted_ascending_compliance_json(self, api_url): Return ... | 0a846753fea9773661bc4651001fcd151dd07fa9 | <|skeleton|>
class MockComplianceApiUtils:
def grab_compliance_json(self, api_url):
"""Return the json grabbed from api :return:"""
<|body_0|>
def grab_sorted_ascending_compliance_json(self, api_url):
"""Return the json grabbed from api :return:"""
<|body_1|>
def grab_sort... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MockComplianceApiUtils:
def grab_compliance_json(self, api_url):
"""Return the json grabbed from api :return:"""
request = urllib2.Request(api_url + '/compliance/compliance_detail')
response = urllib2.urlopen(request)
json_object = json.load(response)
return json_object... | the_stack_v2_python_sparse | tools/api/mock/MockComplianceApiUtils.py | cmarchis/TukTuk | train | 0 | |
8c3ca1adf6da96290f440693bcb619bed629612e | [
"HTMLParser.__init__(self)\nself.table_data = None\nself.data_list = []\nself.short_list = []\nhtml_count = 0\nself.start_tag = 0\nself.th = 0\nself.hr = 0\nfile_handle = open(file_name, 'r')\nself.feed(file_handle.read())\nfile_handle.close()\nself.data_list = tuple(self.data_list)",
"if tag == 'hr':\n self.h... | <|body_start_0|>
HTMLParser.__init__(self)
self.table_data = None
self.data_list = []
self.short_list = []
html_count = 0
self.start_tag = 0
self.th = 0
self.hr = 0
file_handle = open(file_name, 'r')
self.feed(file_handle.read())
fi... | @Name: HtmlParser @Description: An inherited class that uses specific core functionality from the CORE module HTMLParser. @inherits: HTMLParser | HtmlParser | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HtmlParser:
"""@Name: HtmlParser @Description: An inherited class that uses specific core functionality from the CORE module HTMLParser. @inherits: HTMLParser"""
def __init__(self, file_name):
"""@Name: __init__ @Description: The constructor to the HtmlParser class. @params: >file_na... | stack_v2_sparse_classes_10k_train_008466 | 5,564 | no_license | [
{
"docstring": "@Name: __init__ @Description: The constructor to the HtmlParser class. @params: >file_name: (String) The absolute path to the html file to be parsed. @Creator: Jesse Thomas",
"name": "__init__",
"signature": "def __init__(self, file_name)"
},
{
"docstring": "@Name: handle_startta... | 4 | null | Implement the Python class `HtmlParser` described below.
Class description:
@Name: HtmlParser @Description: An inherited class that uses specific core functionality from the CORE module HTMLParser. @inherits: HTMLParser
Method signatures and docstrings:
- def __init__(self, file_name): @Name: __init__ @Description: T... | Implement the Python class `HtmlParser` described below.
Class description:
@Name: HtmlParser @Description: An inherited class that uses specific core functionality from the CORE module HTMLParser. @inherits: HTMLParser
Method signatures and docstrings:
- def __init__(self, file_name): @Name: __init__ @Description: T... | d24805456e5a0126c036c1688a5d112bdcf4467a | <|skeleton|>
class HtmlParser:
"""@Name: HtmlParser @Description: An inherited class that uses specific core functionality from the CORE module HTMLParser. @inherits: HTMLParser"""
def __init__(self, file_name):
"""@Name: __init__ @Description: The constructor to the HtmlParser class. @params: >file_na... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class HtmlParser:
"""@Name: HtmlParser @Description: An inherited class that uses specific core functionality from the CORE module HTMLParser. @inherits: HTMLParser"""
def __init__(self, file_name):
"""@Name: __init__ @Description: The constructor to the HtmlParser class. @params: >file_name: (String) ... | the_stack_v2_python_sparse | app/util/gvrhtmlparser.py | priyatam0509/Automation-Testing | train | 0 |
e82e5be82db3255870ebe29969a056d3c8011a59 | [
"self.c2s_access_portal = c2s_access_portal\nself.ca_trusted_certificate = ca_trusted_certificate\nself.client_certificate = client_certificate\nself.client_private_key = client_private_key",
"if dictionary is None:\n return None\nc2s_access_portal = cohesity_management_sdk.models.c2s_access_portal.C2SAccessPo... | <|body_start_0|>
self.c2s_access_portal = c2s_access_portal
self.ca_trusted_certificate = ca_trusted_certificate
self.client_certificate = client_certificate
self.client_private_key = client_private_key
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return No... | Implementation of the 'C2SServerInfo' model. C2S Server Info. Specifies information required to connect to CAP to get AWS credentials. C2SAccessPortal(CAP) is AWS commercial cloud service access portal. Attributes: c2s_access_portal (C2SAccessPortal): Specifies the C2S Access Portal (CAP) which is used to get the aws c... | C2SServerInfo | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class C2SServerInfo:
"""Implementation of the 'C2SServerInfo' model. C2S Server Info. Specifies information required to connect to CAP to get AWS credentials. C2SAccessPortal(CAP) is AWS commercial cloud service access portal. Attributes: c2s_access_portal (C2SAccessPortal): Specifies the C2S Access Po... | stack_v2_sparse_classes_10k_train_008467 | 2,925 | permissive | [
{
"docstring": "Constructor for the C2SServerInfo class",
"name": "__init__",
"signature": "def __init__(self, c2s_access_portal=None, ca_trusted_certificate=None, client_certificate=None, client_private_key=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dict... | 2 | stack_v2_sparse_classes_30k_train_006919 | Implement the Python class `C2SServerInfo` described below.
Class description:
Implementation of the 'C2SServerInfo' model. C2S Server Info. Specifies information required to connect to CAP to get AWS credentials. C2SAccessPortal(CAP) is AWS commercial cloud service access portal. Attributes: c2s_access_portal (C2SAcc... | Implement the Python class `C2SServerInfo` described below.
Class description:
Implementation of the 'C2SServerInfo' model. C2S Server Info. Specifies information required to connect to CAP to get AWS credentials. C2SAccessPortal(CAP) is AWS commercial cloud service access portal. Attributes: c2s_access_portal (C2SAcc... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class C2SServerInfo:
"""Implementation of the 'C2SServerInfo' model. C2S Server Info. Specifies information required to connect to CAP to get AWS credentials. C2SAccessPortal(CAP) is AWS commercial cloud service access portal. Attributes: c2s_access_portal (C2SAccessPortal): Specifies the C2S Access Po... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class C2SServerInfo:
"""Implementation of the 'C2SServerInfo' model. C2S Server Info. Specifies information required to connect to CAP to get AWS credentials. C2SAccessPortal(CAP) is AWS commercial cloud service access portal. Attributes: c2s_access_portal (C2SAccessPortal): Specifies the C2S Access Portal (CAP) wh... | the_stack_v2_python_sparse | cohesity_management_sdk/models/c2s_server_info.py | cohesity/management-sdk-python | train | 24 |
3ff5716f5e3d1f877d70f8c4b49d662f9420f836 | [
"ids_with_two = 0\nids_with_three = 0\nfor id in self.lines:\n counts = set(Counter(id).values())\n if 2 in counts:\n ids_with_two += 1\n if 3 in counts:\n ids_with_three += 1\nchecksum = ids_with_three * ids_with_two\nprint(f'Checksum: {checksum}')",
"match_possibilities = set()\nfor id in... | <|body_start_0|>
ids_with_two = 0
ids_with_three = 0
for id in self.lines:
counts = set(Counter(id).values())
if 2 in counts:
ids_with_two += 1
if 3 in counts:
ids_with_three += 1
checksum = ids_with_three * ids_with_two... | Day 2 challenges | Challenge | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Challenge:
"""Day 2 challenges"""
def challenge1(self):
"""Day 2 challenge 1"""
<|body_0|>
def challenge2(self):
"""Day 2 challenge 2"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
ids_with_two = 0
ids_with_three = 0
for id in s... | stack_v2_sparse_classes_10k_train_008468 | 1,234 | permissive | [
{
"docstring": "Day 2 challenge 1",
"name": "challenge1",
"signature": "def challenge1(self)"
},
{
"docstring": "Day 2 challenge 2",
"name": "challenge2",
"signature": "def challenge2(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001975 | Implement the Python class `Challenge` described below.
Class description:
Day 2 challenges
Method signatures and docstrings:
- def challenge1(self): Day 2 challenge 1
- def challenge2(self): Day 2 challenge 2 | Implement the Python class `Challenge` described below.
Class description:
Day 2 challenges
Method signatures and docstrings:
- def challenge1(self): Day 2 challenge 1
- def challenge2(self): Day 2 challenge 2
<|skeleton|>
class Challenge:
"""Day 2 challenges"""
def challenge1(self):
"""Day 2 challe... | 6671ef8c16a837f697bb3fb91004d1bd892814ba | <|skeleton|>
class Challenge:
"""Day 2 challenges"""
def challenge1(self):
"""Day 2 challenge 1"""
<|body_0|>
def challenge2(self):
"""Day 2 challenge 2"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Challenge:
"""Day 2 challenges"""
def challenge1(self):
"""Day 2 challenge 1"""
ids_with_two = 0
ids_with_three = 0
for id in self.lines:
counts = set(Counter(id).values())
if 2 in counts:
ids_with_two += 1
if 3 in counts... | the_stack_v2_python_sparse | 2018/day2/challenge.py | ericgreveson/adventofcode | train | 0 |
2ef2d4c6fec829adb6502f7c13ec3acaa227ec87 | [
"self._input_size = input_size\nself._num_classes = num_classes\nself._num_channels = num_channels\nself._image_field_key = image_field_key\nself._label_field_key = label_field_key\nself._dtype = dtype\nself._label_dtype = label_dtype",
"image = tf.io.decode_raw(data[self._image_field_key], tf.as_dtype(tf.float32... | <|body_start_0|>
self._input_size = input_size
self._num_classes = num_classes
self._num_channels = num_channels
self._image_field_key = image_field_key
self._label_field_key = label_field_key
self._dtype = dtype
self._label_dtype = label_dtype
<|end_body_0|>
<|b... | Parser to parse an image and its annotations into a dictionary of tensors. | Parser | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Parser:
"""Parser to parse an image and its annotations into a dictionary of tensors."""
def __init__(self, input_size: Sequence[int], num_classes: int, num_channels: int=3, image_field_key: str='image/encoded', label_field_key: str='image/class/label', dtype: str='float32', label_dtype: str... | stack_v2_sparse_classes_10k_train_008469 | 4,231 | permissive | [
{
"docstring": "Initializes parameters for parsing annotations in the dataset. Args: input_size: The input tensor size of [height, width, volume] of input image. num_classes: The number of classes to be segmented. num_channels: The channel of input images. image_field_key: A `str` of the key name to encoded ima... | 4 | stack_v2_sparse_classes_30k_train_005629 | Implement the Python class `Parser` described below.
Class description:
Parser to parse an image and its annotations into a dictionary of tensors.
Method signatures and docstrings:
- def __init__(self, input_size: Sequence[int], num_classes: int, num_channels: int=3, image_field_key: str='image/encoded', label_field_... | Implement the Python class `Parser` described below.
Class description:
Parser to parse an image and its annotations into a dictionary of tensors.
Method signatures and docstrings:
- def __init__(self, input_size: Sequence[int], num_classes: int, num_channels: int=3, image_field_key: str='image/encoded', label_field_... | d3507b550a3ade40cade60a79eb5b8978b56c7ae | <|skeleton|>
class Parser:
"""Parser to parse an image and its annotations into a dictionary of tensors."""
def __init__(self, input_size: Sequence[int], num_classes: int, num_channels: int=3, image_field_key: str='image/encoded', label_field_key: str='image/class/label', dtype: str='float32', label_dtype: str... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Parser:
"""Parser to parse an image and its annotations into a dictionary of tensors."""
def __init__(self, input_size: Sequence[int], num_classes: int, num_channels: int=3, image_field_key: str='image/encoded', label_field_key: str='image/class/label', dtype: str='float32', label_dtype: str='float32'):
... | the_stack_v2_python_sparse | official/projects/volumetric_models/dataloaders/segmentation_input_3d.py | jianzhnie/models | train | 2 |
09576aa348035d8f1e17a44b150ffa3fe8b353f6 | [
"source = 'pipeline'\npipeline_resource_name = _LegacyExperimentService._get_experiment_or_pipeline_resource_name(name=pipeline, source=source, expected_schema=constants.SYSTEM_PIPELINE)\nreturn _LegacyExperimentService._query_runs_to_data_frame(context_id=pipeline, context_resource_name=pipeline_resource_name, sou... | <|body_start_0|>
source = 'pipeline'
pipeline_resource_name = _LegacyExperimentService._get_experiment_or_pipeline_resource_name(name=pipeline, source=source, expected_schema=constants.SYSTEM_PIPELINE)
return _LegacyExperimentService._query_runs_to_data_frame(context_id=pipeline, context_resourc... | Contains the exposed APIs to interact with the Managed Metadata Service. | _LegacyExperimentService | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _LegacyExperimentService:
"""Contains the exposed APIs to interact with the Managed Metadata Service."""
def get_pipeline_df(pipeline: str) -> 'pd.DataFrame':
"""Returns a Pandas DataFrame of the parameters and metrics associated with one pipeline. Args: pipeline: Name of the Pipelin... | stack_v2_sparse_classes_10k_train_008470 | 38,620 | permissive | [
{
"docstring": "Returns a Pandas DataFrame of the parameters and metrics associated with one pipeline. Args: pipeline: Name of the Pipeline to filter results. Returns: Pandas Dataframe of Pipeline with metrics and parameters.",
"name": "get_pipeline_df",
"signature": "def get_pipeline_df(pipeline: str) ... | 4 | null | Implement the Python class `_LegacyExperimentService` described below.
Class description:
Contains the exposed APIs to interact with the Managed Metadata Service.
Method signatures and docstrings:
- def get_pipeline_df(pipeline: str) -> 'pd.DataFrame': Returns a Pandas DataFrame of the parameters and metrics associat... | Implement the Python class `_LegacyExperimentService` described below.
Class description:
Contains the exposed APIs to interact with the Managed Metadata Service.
Method signatures and docstrings:
- def get_pipeline_df(pipeline: str) -> 'pd.DataFrame': Returns a Pandas DataFrame of the parameters and metrics associat... | 76b95b92c1d3b87c72d754d8c02b1bca652b9a27 | <|skeleton|>
class _LegacyExperimentService:
"""Contains the exposed APIs to interact with the Managed Metadata Service."""
def get_pipeline_df(pipeline: str) -> 'pd.DataFrame':
"""Returns a Pandas DataFrame of the parameters and metrics associated with one pipeline. Args: pipeline: Name of the Pipelin... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class _LegacyExperimentService:
"""Contains the exposed APIs to interact with the Managed Metadata Service."""
def get_pipeline_df(pipeline: str) -> 'pd.DataFrame':
"""Returns a Pandas DataFrame of the parameters and metrics associated with one pipeline. Args: pipeline: Name of the Pipeline to filter r... | the_stack_v2_python_sparse | google/cloud/aiplatform/metadata/metadata.py | googleapis/python-aiplatform | train | 418 |
e6376670bb76ef8b963e4188aa5075c3afb4535d | [
"found_categories = []\nprevious_categories = filter(lambda x: page in x.pages, Category.query.all())\npattern = re.compile('\\\\[\\\\[Category:[a-zA-Z0-9 _]+\\\\]\\\\]')\nmatches = re.findall(pattern, content)\nfor match in matches:\n category_name = match[11:-2].strip()\n is_new, category = CategoryAPI.get_... | <|body_start_0|>
found_categories = []
previous_categories = filter(lambda x: page in x.pages, Category.query.all())
pattern = re.compile('\\[\\[Category:[a-zA-Z0-9 _]+\\]\\]')
matches = re.findall(pattern, content)
for match in matches:
category_name = match[11:-2].s... | CategoryAPI | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CategoryAPI:
def update_categories_from_content(content, page):
"""Parse the string content for categories. The found categories in the content are processed as followed: * Existing categories are updated to save the path. * Unknown categories are created and save the path. Categories wh... | stack_v2_sparse_classes_10k_train_008471 | 3,400 | permissive | [
{
"docstring": "Parse the string content for categories. The found categories in the content are processed as followed: * Existing categories are updated to save the path. * Unknown categories are created and save the path. Categories which had this page, but are not found in the content are updated if the cate... | 2 | null | Implement the Python class `CategoryAPI` described below.
Class description:
Implement the CategoryAPI class.
Method signatures and docstrings:
- def update_categories_from_content(content, page): Parse the string content for categories. The found categories in the content are processed as followed: * Existing catego... | Implement the Python class `CategoryAPI` described below.
Class description:
Implement the CategoryAPI class.
Method signatures and docstrings:
- def update_categories_from_content(content, page): Parse the string content for categories. The found categories in the content are processed as followed: * Existing catego... | 1faec7e123c3fae7e8dbe1a354ad27b68f2a8cef | <|skeleton|>
class CategoryAPI:
def update_categories_from_content(content, page):
"""Parse the string content for categories. The found categories in the content are processed as followed: * Existing categories are updated to save the path. * Unknown categories are created and save the path. Categories wh... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CategoryAPI:
def update_categories_from_content(content, page):
"""Parse the string content for categories. The found categories in the content are processed as followed: * Existing categories are updated to save the path. * Unknown categories are created and save the path. Categories which had this p... | the_stack_v2_python_sparse | app/utils/category.py | viaict/viaduct | train | 11 | |
d24410b51d52fc0801c4a5e82a343c499991e556 | [
"if not root:\n return ''\nret, myQueue = ([], [root])\nlastNode, nextNode = (root, root)\nwhile len(myQueue) != 0:\n curNode = myQueue[0]\n myQueue.pop(0)\n ret.append(str(curNode.val))\n ret.append(' ')\n if curNode.left is not None:\n myQueue.append(curNode.left)\n nextNode = curN... | <|body_start_0|>
if not root:
return ''
ret, myQueue = ([], [root])
lastNode, nextNode = (root, root)
while len(myQueue) != 0:
curNode = myQueue[0]
myQueue.pop(0)
ret.append(str(curNode.val))
ret.append(' ')
if curNo... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_10k_train_008472 | 2,764 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | stack_v2_sparse_classes_30k_train_007291 | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | af5b37e45c89028aad119b1bc2c684e26dafd6e0 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
if not root:
return ''
ret, myQueue = ([], [root])
lastNode, nextNode = (root, root)
while len(myQueue) != 0:
curNode = myQueue[0]
... | the_stack_v2_python_sparse | BFS/449.py | LuluFighting/leetCodeEveryday | train | 2 | |
a8f692c5ccc1fb8d13e313b95847776a77df2470 | [
"s = s.strip()\nif not s:\n return 0\nsign = -1 if s[0] == '-' else 1\nval = 0\nfor c in s:\n if c.isdigit():\n val = val * 10 + ord(c) - ord('0')\nreturn sign * val",
"s = s.strip()\nif not s:\n return 0\nsign = -1 if s[0] == '-' else 1\nval, index = (0, 0)\nif s[0] in ['+', '-']:\n index = 1\... | <|body_start_0|>
s = s.strip()
if not s:
return 0
sign = -1 if s[0] == '-' else 1
val = 0
for c in s:
if c.isdigit():
val = val * 10 + ord(c) - ord('0')
return sign * val
<|end_body_0|>
<|body_start_1|>
s = s.strip()
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def myAtoi(self, s):
""":type str: str :rtype: int This is the sane version of the Idea ATOI where illegal chars in the given string 's' are ignored as one would. The version leetcode required was to quit when an illegal char is encountered and can be found here https://discuss... | stack_v2_sparse_classes_10k_train_008473 | 1,416 | no_license | [
{
"docstring": ":type str: str :rtype: int This is the sane version of the Idea ATOI where illegal chars in the given string 's' are ignored as one would. The version leetcode required was to quit when an illegal char is encountered and can be found here https://discuss.leetcode.com/topic/26920/60ms-python-solu... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def myAtoi(self, s): :type str: str :rtype: int This is the sane version of the Idea ATOI where illegal chars in the given string 's' are ignored as one would. The version leetco... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def myAtoi(self, s): :type str: str :rtype: int This is the sane version of the Idea ATOI where illegal chars in the given string 's' are ignored as one would. The version leetco... | 57212d700dfba0db4925d9d4896f7f0b9635a5b5 | <|skeleton|>
class Solution:
def myAtoi(self, s):
""":type str: str :rtype: int This is the sane version of the Idea ATOI where illegal chars in the given string 's' are ignored as one would. The version leetcode required was to quit when an illegal char is encountered and can be found here https://discuss... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def myAtoi(self, s):
""":type str: str :rtype: int This is the sane version of the Idea ATOI where illegal chars in the given string 's' are ignored as one would. The version leetcode required was to quit when an illegal char is encountered and can be found here https://discuss.leetcode.com/... | the_stack_v2_python_sparse | atoi.py | baloooo/coding_practice | train | 0 | |
b761155f673cc22acd2b9dd7f35dba9a81d581cd | [
"dict_string_set = set()\nres = 0\nfor string in A:\n odd_counts = dict()\n even_counts = dict()\n for i in range(len(string)):\n if i % 2:\n odd_counts[string[i]] = odd_counts.get(string[i], 0) + 1\n else:\n even_counts[string[i]] = even_counts.get(string[i], 0) + 1\n ... | <|body_start_0|>
dict_string_set = set()
res = 0
for string in A:
odd_counts = dict()
even_counts = dict()
for i in range(len(string)):
if i % 2:
odd_counts[string[i]] = odd_counts.get(string[i], 0) + 1
else:... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def numSpecialEquivGroups(self, A):
""":type A: List[str] :rtype: int"""
<|body_0|>
def dictToString(self, dict_left, dict_right):
"""Use a string to represent the elemnts of dict_left and dict_right"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>... | stack_v2_sparse_classes_10k_train_008474 | 3,688 | no_license | [
{
"docstring": ":type A: List[str] :rtype: int",
"name": "numSpecialEquivGroups",
"signature": "def numSpecialEquivGroups(self, A)"
},
{
"docstring": "Use a string to represent the elemnts of dict_left and dict_right",
"name": "dictToString",
"signature": "def dictToString(self, dict_lef... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numSpecialEquivGroups(self, A): :type A: List[str] :rtype: int
- def dictToString(self, dict_left, dict_right): Use a string to represent the elemnts of dict_left and dict_ri... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numSpecialEquivGroups(self, A): :type A: List[str] :rtype: int
- def dictToString(self, dict_left, dict_right): Use a string to represent the elemnts of dict_left and dict_ri... | f96a2273c6831a8035e1adacfa452f73c599ae16 | <|skeleton|>
class Solution:
def numSpecialEquivGroups(self, A):
""":type A: List[str] :rtype: int"""
<|body_0|>
def dictToString(self, dict_left, dict_right):
"""Use a string to represent the elemnts of dict_left and dict_right"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def numSpecialEquivGroups(self, A):
""":type A: List[str] :rtype: int"""
dict_string_set = set()
res = 0
for string in A:
odd_counts = dict()
even_counts = dict()
for i in range(len(string)):
if i % 2:
... | the_stack_v2_python_sparse | Python/GroupsofSpecial-EquivalentStrings.py | here0009/LeetCode | train | 1 | |
599471fca4ccb4ca24191a09dc5ffa6db27b94f2 | [
"super().__init__(validate)\nself._discriminator = discriminators\nself._n_circs = 0\nself._n_shots = 0\nself._n_slots = 0\nself._n_iq = 0",
"self._n_shots = 0\ntry:\n self._n_circs, self._n_shots, self._n_slots, self._n_iq = data.shape\nexcept ValueError as ex:\n raise DataProcessorError(f'The data given t... | <|body_start_0|>
super().__init__(validate)
self._discriminator = discriminators
self._n_circs = 0
self._n_shots = 0
self._n_slots = 0
self._n_iq = 0
<|end_body_0|>
<|body_start_1|>
self._n_shots = 0
try:
self._n_circs, self._n_shots, self._n_... | A class to discriminate kerneled data, e.g., IQ data, to produce counts. This node integrates into the data processing chain a serializable :class:`.BaseDiscriminator` subclass instance which must have a :meth:`~.BaseDiscriminator.predict` method that takes as input a list of lists and returns a list of labels. Crucial... | DiscriminatorNode | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DiscriminatorNode:
"""A class to discriminate kerneled data, e.g., IQ data, to produce counts. This node integrates into the data processing chain a serializable :class:`.BaseDiscriminator` subclass instance which must have a :meth:`~.BaseDiscriminator.predict` method that takes as input a list o... | stack_v2_sparse_classes_10k_train_008475 | 42,185 | permissive | [
{
"docstring": "Initialize the node with an object that can discriminate. Args: discriminators: The entity that will perform the discrimination. This needs to be a :class:`.BaseDiscriminator` or a list thereof that takes as input a list of lists and returns a list of labels. If a list of discriminators is given... | 3 | stack_v2_sparse_classes_30k_train_001276 | Implement the Python class `DiscriminatorNode` described below.
Class description:
A class to discriminate kerneled data, e.g., IQ data, to produce counts. This node integrates into the data processing chain a serializable :class:`.BaseDiscriminator` subclass instance which must have a :meth:`~.BaseDiscriminator.predi... | Implement the Python class `DiscriminatorNode` described below.
Class description:
A class to discriminate kerneled data, e.g., IQ data, to produce counts. This node integrates into the data processing chain a serializable :class:`.BaseDiscriminator` subclass instance which must have a :meth:`~.BaseDiscriminator.predi... | a387675a3fe817cef05b968bbf3e05799a09aaae | <|skeleton|>
class DiscriminatorNode:
"""A class to discriminate kerneled data, e.g., IQ data, to produce counts. This node integrates into the data processing chain a serializable :class:`.BaseDiscriminator` subclass instance which must have a :meth:`~.BaseDiscriminator.predict` method that takes as input a list o... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DiscriminatorNode:
"""A class to discriminate kerneled data, e.g., IQ data, to produce counts. This node integrates into the data processing chain a serializable :class:`.BaseDiscriminator` subclass instance which must have a :meth:`~.BaseDiscriminator.predict` method that takes as input a list of lists and r... | the_stack_v2_python_sparse | qiskit_experiments/data_processing/nodes.py | oliverdial/qiskit-experiments | train | 0 |
3ac7ff60666c3ac3478b1f1ab24da1f07554c38f | [
"only = ['id', 'hn', 'clinicID', 'governmentID', 'napID', 'name', 'sex', 'gender', 'nationality', 'healthInsurance', 'dateOfBirth', 'phoneNumbers']\npatient_schema = PatientSchema(many=True, exclude=PatientModel.relationship_keys, only=only)\npatients_query = PatientModel.query.order_by(PatientModel.clinicID).all()... | <|body_start_0|>
only = ['id', 'hn', 'clinicID', 'governmentID', 'napID', 'name', 'sex', 'gender', 'nationality', 'healthInsurance', 'dateOfBirth', 'phoneNumbers']
patient_schema = PatientSchema(many=True, exclude=PatientModel.relationship_keys, only=only)
patients_query = PatientModel.query.ord... | AllPatientResource | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AllPatientResource:
def get(self):
"""List all patients"""
<|body_0|>
def post(self):
"""Add new patient"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
only = ['id', 'hn', 'clinicID', 'governmentID', 'napID', 'name', 'sex', 'gender', 'nationality',... | stack_v2_sparse_classes_10k_train_008476 | 5,115 | no_license | [
{
"docstring": "List all patients",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "Add new patient",
"name": "post",
"signature": "def post(self)"
}
] | 2 | stack_v2_sparse_classes_30k_test_000028 | Implement the Python class `AllPatientResource` described below.
Class description:
Implement the AllPatientResource class.
Method signatures and docstrings:
- def get(self): List all patients
- def post(self): Add new patient | Implement the Python class `AllPatientResource` described below.
Class description:
Implement the AllPatientResource class.
Method signatures and docstrings:
- def get(self): List all patients
- def post(self): Add new patient
<|skeleton|>
class AllPatientResource:
def get(self):
"""List all patients"""... | 49fe5e4740736b2d4b34489065e29bc06cb1c0d2 | <|skeleton|>
class AllPatientResource:
def get(self):
"""List all patients"""
<|body_0|>
def post(self):
"""Add new patient"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AllPatientResource:
def get(self):
"""List all patients"""
only = ['id', 'hn', 'clinicID', 'governmentID', 'napID', 'name', 'sex', 'gender', 'nationality', 'healthInsurance', 'dateOfBirth', 'phoneNumbers']
patient_schema = PatientSchema(many=True, exclude=PatientModel.relationship_keys... | the_stack_v2_python_sparse | hivclinic/namespaces/patient/patient_resource.py | LedoKun/28hiv_clinic_backend | train | 0 | |
414066553086dd0ceb7e4a5861656b1c1695ed38 | [
"super(UserApplicationChangeForm, self).__init__(data=data, initial=initial, instance=instance)\nlocal_site_field = self.fields['local_site']\nlocal_site_field.queryset = LocalSite.objects.filter(users=user)\nlocal_site_field.widget.attrs['disabled'] = True",
"super(UserApplicationChangeForm, self).clean()\nif 'l... | <|body_start_0|>
super(UserApplicationChangeForm, self).__init__(data=data, initial=initial, instance=instance)
local_site_field = self.fields['local_site']
local_site_field.queryset = LocalSite.objects.filter(users=user)
local_site_field.widget.attrs['disabled'] = True
<|end_body_0|>
<... | A form for an end user to change an Application. | UserApplicationChangeForm | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserApplicationChangeForm:
"""A form for an end user to change an Application."""
def __init__(self, user, data=None, initial=None, instance=None):
"""Initialize the form. Args: user (django.contrib.auth.models.User): The user changing the form. Ignored, but included to match :py:met... | stack_v2_sparse_classes_10k_train_008477 | 13,782 | permissive | [
{
"docstring": "Initialize the form. Args: user (django.contrib.auth.models.User): The user changing the form. Ignored, but included to match :py:meth:`UserApplicationCreationForm.__init__`. data (dict): The provided data. initial (dict, optional): The initial form values. instance (reviewboard.oauth.models.App... | 2 | stack_v2_sparse_classes_30k_train_003496 | Implement the Python class `UserApplicationChangeForm` described below.
Class description:
A form for an end user to change an Application.
Method signatures and docstrings:
- def __init__(self, user, data=None, initial=None, instance=None): Initialize the form. Args: user (django.contrib.auth.models.User): The user ... | Implement the Python class `UserApplicationChangeForm` described below.
Class description:
A form for an end user to change an Application.
Method signatures and docstrings:
- def __init__(self, user, data=None, initial=None, instance=None): Initialize the form. Args: user (django.contrib.auth.models.User): The user ... | c3a991f1e9d7682239a1ab0e8661cee6da01d537 | <|skeleton|>
class UserApplicationChangeForm:
"""A form for an end user to change an Application."""
def __init__(self, user, data=None, initial=None, instance=None):
"""Initialize the form. Args: user (django.contrib.auth.models.User): The user changing the form. Ignored, but included to match :py:met... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class UserApplicationChangeForm:
"""A form for an end user to change an Application."""
def __init__(self, user, data=None, initial=None, instance=None):
"""Initialize the form. Args: user (django.contrib.auth.models.User): The user changing the form. Ignored, but included to match :py:meth:`UserApplic... | the_stack_v2_python_sparse | reviewboard/oauth/forms.py | reviewboard/reviewboard | train | 1,141 |
bf5cd501f4d3626381e1811a9ffc08e510437d04 | [
"self.m1 = m1\nself.m2 = m2\nself.scale = scale",
"from pytracer.reflection import ScaledBDF\nb1 = self.m1.get_bsdf(dg_g, dg_s)\nb2 = self.m2.get_bsdf(dg_g, dg_s)\ns1 = self.scale(dg_s).clip()\ns2 = (Spectrum(1.0) - s1).clip()\nfor i, b in b1.bdfs:\n b1.bdfs[i] = ScaledBDF(b, s1)\nfor i, b in b2.bdfs:\n b1.... | <|body_start_0|>
self.m1 = m1
self.m2 = m2
self.scale = scale
<|end_body_0|>
<|body_start_1|>
from pytracer.reflection import ScaledBDF
b1 = self.m1.get_bsdf(dg_g, dg_s)
b2 = self.m2.get_bsdf(dg_g, dg_s)
s1 = self.scale(dg_s).clip()
s2 = (Spectrum(1.0) - ... | MixMaterial Class Models mixed materials. Use texture spectrum to blend. | MixMaterial | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MixMaterial:
"""MixMaterial Class Models mixed materials. Use texture spectrum to blend."""
def __init__(self, m1: 'Material', m2: 'Material', scale: 'Texture'):
"""m1, m2: `Material` `Spectrum` scale: `Spectrum` `Texture` for blend"""
<|body_0|>
def get_bsdf(self, dg_g:... | stack_v2_sparse_classes_10k_train_008478 | 16,068 | permissive | [
{
"docstring": "m1, m2: `Material` `Spectrum` scale: `Spectrum` `Texture` for blend",
"name": "__init__",
"signature": "def __init__(self, m1: 'Material', m2: 'Material', scale: 'Texture')"
},
{
"docstring": "BSDF in m1 (i.e., `m1.bdfs`) is modified",
"name": "get_bsdf",
"signature": "de... | 2 | stack_v2_sparse_classes_30k_train_000017 | Implement the Python class `MixMaterial` described below.
Class description:
MixMaterial Class Models mixed materials. Use texture spectrum to blend.
Method signatures and docstrings:
- def __init__(self, m1: 'Material', m2: 'Material', scale: 'Texture'): m1, m2: `Material` `Spectrum` scale: `Spectrum` `Texture` for ... | Implement the Python class `MixMaterial` described below.
Class description:
MixMaterial Class Models mixed materials. Use texture spectrum to blend.
Method signatures and docstrings:
- def __init__(self, m1: 'Material', m2: 'Material', scale: 'Texture'): m1, m2: `Material` `Spectrum` scale: `Spectrum` `Texture` for ... | c2b4ef299ecbdca1c519059488f7cd2438943ee4 | <|skeleton|>
class MixMaterial:
"""MixMaterial Class Models mixed materials. Use texture spectrum to blend."""
def __init__(self, m1: 'Material', m2: 'Material', scale: 'Texture'):
"""m1, m2: `Material` `Spectrum` scale: `Spectrum` `Texture` for blend"""
<|body_0|>
def get_bsdf(self, dg_g:... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MixMaterial:
"""MixMaterial Class Models mixed materials. Use texture spectrum to blend."""
def __init__(self, m1: 'Material', m2: 'Material', scale: 'Texture'):
"""m1, m2: `Material` `Spectrum` scale: `Spectrum` `Texture` for blend"""
self.m1 = m1
self.m2 = m2
self.scale ... | the_stack_v2_python_sparse | pytracer/material/material.py | zjiayao/pyTracer | train | 11 |
b721db91b090e3eca710a4396d5e868d0a25c179 | [
"self._window_size = window_size\nself._batch_size = batch_size\nself._smoothing_perc = smoothing_perc\nself._n_predictions = n_predictions\nself._l_s = l_s\nself._error_buffer = error_buffer\nself._p = p\nself.window_size = self._window_size\nself.n_windows = int((channel.y_test.shape[0] - self._batch_size * self.... | <|body_start_0|>
self._window_size = window_size
self._batch_size = batch_size
self._smoothing_perc = smoothing_perc
self._n_predictions = n_predictions
self._l_s = l_s
self._error_buffer = error_buffer
self._p = p
self.window_size = self._window_size
... | Errors | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Errors:
def __init__(self, channel, window_size, batch_size, smoothing_perc, n_predictions, l_s, error_buffer, p):
"""Batch processing of errors between actual and predicted values for a channel. Args: channel (obj): Channel class object containing train/test data for X,y for a single ch... | stack_v2_sparse_classes_10k_train_008479 | 22,066 | permissive | [
{
"docstring": "Batch processing of errors between actual and predicted values for a channel. Args: channel (obj): Channel class object containing train/test data for X,y for a single channel config (obj): Config object containing parameters for processing run_id (str): Datetime referencing set of predictions i... | 4 | stack_v2_sparse_classes_30k_train_001559 | Implement the Python class `Errors` described below.
Class description:
Implement the Errors class.
Method signatures and docstrings:
- def __init__(self, channel, window_size, batch_size, smoothing_perc, n_predictions, l_s, error_buffer, p): Batch processing of errors between actual and predicted values for a channe... | Implement the Python class `Errors` described below.
Class description:
Implement the Errors class.
Method signatures and docstrings:
- def __init__(self, channel, window_size, batch_size, smoothing_perc, n_predictions, l_s, error_buffer, p): Batch processing of errors between actual and predicted values for a channe... | 314dd6efc6ed3f8d25e100b08de4115edc636e14 | <|skeleton|>
class Errors:
def __init__(self, channel, window_size, batch_size, smoothing_perc, n_predictions, l_s, error_buffer, p):
"""Batch processing of errors between actual and predicted values for a channel. Args: channel (obj): Channel class object containing train/test data for X,y for a single ch... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Errors:
def __init__(self, channel, window_size, batch_size, smoothing_perc, n_predictions, l_s, error_buffer, p):
"""Batch processing of errors between actual and predicted values for a channel. Args: channel (obj): Channel class object containing train/test data for X,y for a single channel config (... | the_stack_v2_python_sparse | tods/detection_algorithm/core/utils/errors.py | datamllab/tods | train | 1,094 | |
374602f9bc51ce386d2457609ed274f9e4b6d624 | [
"super().__init__(observation_spec)\nself._update_mode = update_mode\nself._clipping = float(clipping)\nself._fields = fields\nif fields is not None:\n observation_spec = dict([(field, alf.nest.get_field(observation_spec, field)) for field in fields])\nif mode == 'adaptive':\n self._normalizer = AdaptiveNorma... | <|body_start_0|>
super().__init__(observation_spec)
self._update_mode = update_mode
self._clipping = float(clipping)
self._fields = fields
if fields is not None:
observation_spec = dict([(field, alf.nest.get_field(observation_spec, field)) for field in fields])
... | ObservationNormalizer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ObservationNormalizer:
def __init__(self, observation_spec, fields=None, clipping=0.0, window_size=10000, update_rate=0.0001, speed=8.0, zero_mean=True, update_mode='replay', mode='adaptive'):
"""Create an observation normalizer with optional value clipping to be used as the ``data_trans... | stack_v2_sparse_classes_10k_train_008480 | 40,444 | permissive | [
{
"docstring": "Create an observation normalizer with optional value clipping to be used as the ``data_transformer`` of an algorithm. It will be called before both ``rollout_step()`` and ``train_step()``. The normalizer by default doesn't automatically update the mean and std. Instead, it will check when ``self... | 2 | null | Implement the Python class `ObservationNormalizer` described below.
Class description:
Implement the ObservationNormalizer class.
Method signatures and docstrings:
- def __init__(self, observation_spec, fields=None, clipping=0.0, window_size=10000, update_rate=0.0001, speed=8.0, zero_mean=True, update_mode='replay', ... | Implement the Python class `ObservationNormalizer` described below.
Class description:
Implement the ObservationNormalizer class.
Method signatures and docstrings:
- def __init__(self, observation_spec, fields=None, clipping=0.0, window_size=10000, update_rate=0.0001, speed=8.0, zero_mean=True, update_mode='replay', ... | b00ff2fa5e660de31020338ba340263183fbeaa4 | <|skeleton|>
class ObservationNormalizer:
def __init__(self, observation_spec, fields=None, clipping=0.0, window_size=10000, update_rate=0.0001, speed=8.0, zero_mean=True, update_mode='replay', mode='adaptive'):
"""Create an observation normalizer with optional value clipping to be used as the ``data_trans... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ObservationNormalizer:
def __init__(self, observation_spec, fields=None, clipping=0.0, window_size=10000, update_rate=0.0001, speed=8.0, zero_mean=True, update_mode='replay', mode='adaptive'):
"""Create an observation normalizer with optional value clipping to be used as the ``data_transformer`` of an... | the_stack_v2_python_sparse | alf/algorithms/data_transformer.py | HorizonRobotics/alf | train | 288 | |
46b0455592dded788b789dc9ba1a14f76d5a3ae3 | [
"self.type_mapping_dict = copy.deepcopy(type_dict)\nself.params_mapping_dict = copy.deepcopy(params_dict)\nself.backend_type = None\nif vega.is_torch_backend():\n self.backend_type = 'torch'\nelif vega.is_tf_backend():\n self.backend_type = 'tf'\nelif vega.is_ms_backend():\n self.backend_type = 'ms'\nelse:... | <|body_start_0|>
self.type_mapping_dict = copy.deepcopy(type_dict)
self.params_mapping_dict = copy.deepcopy(params_dict)
self.backend_type = None
if vega.is_torch_backend():
self.backend_type = 'torch'
elif vega.is_tf_backend():
self.backend_type = 'tf'
... | Config mapping according to backend. :param module_type: module type in trainer, 'optim', 'loss' or 'lr_scheduler' :type module_type: str | ConfigBackendMapping | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"BSD-3-Clause",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConfigBackendMapping:
"""Config mapping according to backend. :param module_type: module type in trainer, 'optim', 'loss' or 'lr_scheduler' :type module_type: str"""
def __init__(self, type_dict, params_dict):
"""Init config backend mapping."""
<|body_0|>
def backend_map... | stack_v2_sparse_classes_10k_train_008481 | 2,721 | permissive | [
{
"docstring": "Init config backend mapping.",
"name": "__init__",
"signature": "def __init__(self, type_dict, params_dict)"
},
{
"docstring": "Map config to specific backend. :param config: original config from config file :type config: Config or dict :return: config after mapping to backend :r... | 2 | null | Implement the Python class `ConfigBackendMapping` described below.
Class description:
Config mapping according to backend. :param module_type: module type in trainer, 'optim', 'loss' or 'lr_scheduler' :type module_type: str
Method signatures and docstrings:
- def __init__(self, type_dict, params_dict): Init config ba... | Implement the Python class `ConfigBackendMapping` described below.
Class description:
Config mapping according to backend. :param module_type: module type in trainer, 'optim', 'loss' or 'lr_scheduler' :type module_type: str
Method signatures and docstrings:
- def __init__(self, type_dict, params_dict): Init config ba... | 12e37a1991eb6771a2999fe0a46ddda920c47948 | <|skeleton|>
class ConfigBackendMapping:
"""Config mapping according to backend. :param module_type: module type in trainer, 'optim', 'loss' or 'lr_scheduler' :type module_type: str"""
def __init__(self, type_dict, params_dict):
"""Init config backend mapping."""
<|body_0|>
def backend_map... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ConfigBackendMapping:
"""Config mapping according to backend. :param module_type: module type in trainer, 'optim', 'loss' or 'lr_scheduler' :type module_type: str"""
def __init__(self, type_dict, params_dict):
"""Init config backend mapping."""
self.type_mapping_dict = copy.deepcopy(type_... | the_stack_v2_python_sparse | vega/trainer/modules/config_bakcend_map.py | huawei-noah/vega | train | 850 |
44c679df3ca1b985d206603b1192f1d3e55c3762 | [
"if self.count == 0 and (not self.allow_empty_first_page):\n return 0\nhits = min(self.max_result_window, max(1, self.count - self.orphans))\nreturn int(ceil(hits / float(self.per_page)))",
"try:\n number = int(number)\nexcept (TypeError, ValueError):\n raise PageNotAnInteger('That page number is not an ... | <|body_start_0|>
if self.count == 0 and (not self.allow_empty_first_page):
return 0
hits = min(self.max_result_window, max(1, self.count - self.orphans))
return int(ceil(hits / float(self.per_page)))
<|end_body_0|>
<|body_start_1|>
try:
number = int(number)
... | A better paginator for search results The normal Paginator does a .count() query and then a slice. Since ES results contain the total number of results, we can take an optimistic slice and then adjust the count. | ESPaginator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ESPaginator:
"""A better paginator for search results The normal Paginator does a .count() query and then a slice. Since ES results contain the total number of results, we can take an optimistic slice and then adjust the count."""
def num_pages(self):
"""Returns the total number of p... | stack_v2_sparse_classes_10k_train_008482 | 3,219 | permissive | [
{
"docstring": "Returns the total number of pages.",
"name": "num_pages",
"signature": "def num_pages(self)"
},
{
"docstring": "Validates the given 1-based page number. This class overrides the default behavior and ignores the upper bound.",
"name": "validate_number",
"signature": "def v... | 3 | null | Implement the Python class `ESPaginator` described below.
Class description:
A better paginator for search results The normal Paginator does a .count() query and then a slice. Since ES results contain the total number of results, we can take an optimistic slice and then adjust the count.
Method signatures and docstri... | Implement the Python class `ESPaginator` described below.
Class description:
A better paginator for search results The normal Paginator does a .count() query and then a slice. Since ES results contain the total number of results, we can take an optimistic slice and then adjust the count.
Method signatures and docstri... | e0f043bca8a64478e2ba62f877c9dc28620be22f | <|skeleton|>
class ESPaginator:
"""A better paginator for search results The normal Paginator does a .count() query and then a slice. Since ES results contain the total number of results, we can take an optimistic slice and then adjust the count."""
def num_pages(self):
"""Returns the total number of p... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ESPaginator:
"""A better paginator for search results The normal Paginator does a .count() query and then a slice. Since ES results contain the total number of results, we can take an optimistic slice and then adjust the count."""
def num_pages(self):
"""Returns the total number of pages."""
... | the_stack_v2_python_sparse | src/olympia/amo/pagination.py | mozilla/addons-server | train | 920 |
952c47525b3cb8ed2d97ec70f31695ae0a766477 | [
"seed(datetime.now())\nheight = randint(HEIGHT[0], HEIGHT[1])\nhandler = AVLHandler.from_scratch(height, POINT_CAP)\nreturn handler",
"successes = 0\nfailures = 0\niterations = NUM_CALLS\nfor _ in range(iterations):\n handler = self.new_handler()\n ret = check_golden(handler)\n if ret:\n successes... | <|body_start_0|>
seed(datetime.now())
height = randint(HEIGHT[0], HEIGHT[1])
handler = AVLHandler.from_scratch(height, POINT_CAP)
return handler
<|end_body_0|>
<|body_start_1|>
successes = 0
failures = 0
iterations = NUM_CALLS
for _ in range(iterations):
... | Test the state of the AVL tree upon generation from scratch | AVLNewGeneration | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AVLNewGeneration:
"""Test the state of the AVL tree upon generation from scratch"""
def new_handler():
"""create new handler to test"""
<|body_0|>
def test_golden_new(self):
"""make sure new avl is generated with correct golden node"""
<|body_1|>
def... | stack_v2_sparse_classes_10k_train_008483 | 20,558 | permissive | [
{
"docstring": "create new handler to test",
"name": "new_handler",
"signature": "def new_handler()"
},
{
"docstring": "make sure new avl is generated with correct golden node",
"name": "test_golden_new",
"signature": "def test_golden_new(self)"
},
{
"docstring": "make sure nodes... | 4 | stack_v2_sparse_classes_30k_train_005005 | Implement the Python class `AVLNewGeneration` described below.
Class description:
Test the state of the AVL tree upon generation from scratch
Method signatures and docstrings:
- def new_handler(): create new handler to test
- def test_golden_new(self): make sure new avl is generated with correct golden node
- def tes... | Implement the Python class `AVLNewGeneration` described below.
Class description:
Test the state of the AVL tree upon generation from scratch
Method signatures and docstrings:
- def new_handler(): create new handler to test
- def test_golden_new(self): make sure new avl is generated with correct golden node
- def tes... | a47c849ea97763eff1005273a58aa3d8ab663ff2 | <|skeleton|>
class AVLNewGeneration:
"""Test the state of the AVL tree upon generation from scratch"""
def new_handler():
"""create new handler to test"""
<|body_0|>
def test_golden_new(self):
"""make sure new avl is generated with correct golden node"""
<|body_1|>
def... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AVLNewGeneration:
"""Test the state of the AVL tree upon generation from scratch"""
def new_handler():
"""create new handler to test"""
seed(datetime.now())
height = randint(HEIGHT[0], HEIGHT[1])
handler = AVLHandler.from_scratch(height, POINT_CAP)
return handler
... | the_stack_v2_python_sparse | game_board/avl/test_avl.py | Plongesam/data-structures-game | train | 2 |
5e2f2255de96dec5a0bff573f08f65b13a47bd0d | [
"self.cap = 10007\nself.size = 0\nself.d = [LinkedListNode(0) for _ in xrange(self.cap)]",
"prev = dummy = self.d[key % self.cap]\ncurr = dummy.next\nwhile curr:\n if curr.val[0] == key:\n break\n prev = curr\n curr = curr.next\nif not curr:\n curr = LinkedListNode((key, value))\n curr.prev,... | <|body_start_0|>
self.cap = 10007
self.size = 0
self.d = [LinkedListNode(0) for _ in xrange(self.cap)]
<|end_body_0|>
<|body_start_1|>
prev = dummy = self.d[key % self.cap]
curr = dummy.next
while curr:
if curr.val[0] == key:
break
... | MyHashMap | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyHashMap:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def put(self, key, value):
"""value will always be non-negative. :type key: int :type value: int :rtype: void"""
<|body_1|>
def get(self, key):
"""Returns the va... | stack_v2_sparse_classes_10k_train_008484 | 2,146 | no_license | [
{
"docstring": "Initialize your data structure here.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "value will always be non-negative. :type key: int :type value: int :rtype: void",
"name": "put",
"signature": "def put(self, key, value)"
},
{
"docstrin... | 4 | stack_v2_sparse_classes_30k_train_006493 | Implement the Python class `MyHashMap` described below.
Class description:
Implement the MyHashMap class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def put(self, key, value): value will always be non-negative. :type key: int :type value: int :rtype: void
- def get(... | Implement the Python class `MyHashMap` described below.
Class description:
Implement the MyHashMap class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def put(self, key, value): value will always be non-negative. :type key: int :type value: int :rtype: void
- def get(... | 6fec95b9b4d735727160905e754a698513bfb7d8 | <|skeleton|>
class MyHashMap:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def put(self, key, value):
"""value will always be non-negative. :type key: int :type value: int :rtype: void"""
<|body_1|>
def get(self, key):
"""Returns the va... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MyHashMap:
def __init__(self):
"""Initialize your data structure here."""
self.cap = 10007
self.size = 0
self.d = [LinkedListNode(0) for _ in xrange(self.cap)]
def put(self, key, value):
"""value will always be non-negative. :type key: int :type value: int :rtype: ... | the_stack_v2_python_sparse | leetcode/design/design-hashmap.py | jwyx3/practices | train | 2 | |
4c9a9affa7add5d8a4ce7f303ed690a03d3fe072 | [
"zeroPad = 0\nres = 0\nnum1 = num1[::-1]\nnum2 = num2[::-1]\nfor i in num1:\n res += self.multiplyHelp(num2, i, zeroPad)\n zeroPad += 1\nreturn '{}'.format(res)",
"res = ['0'] * pos\nmultiplier = int(actor)\nnext_q = 0\nfor i in target:\n x = int(i)\n product = multiplier * x + next_q\n next_q = 0\... | <|body_start_0|>
zeroPad = 0
res = 0
num1 = num1[::-1]
num2 = num2[::-1]
for i in num1:
res += self.multiplyHelp(num2, i, zeroPad)
zeroPad += 1
return '{}'.format(res)
<|end_body_0|>
<|body_start_1|>
res = ['0'] * pos
multiplier = ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def multiply(self, num1: str, num2: str) -> str:
""":param num1: the first number as a string :param num2: the second number as a string :return: the product as a string working theory: zeroPad: the power of 10 to muliply by at every stage res = result as an integer; it is bett... | stack_v2_sparse_classes_10k_train_008485 | 2,336 | no_license | [
{
"docstring": ":param num1: the first number as a string :param num2: the second number as a string :return: the product as a string working theory: zeroPad: the power of 10 to muliply by at every stage res = result as an integer; it is better because string conversion will only happen once and direct addition... | 2 | stack_v2_sparse_classes_30k_train_000848 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def multiply(self, num1: str, num2: str) -> str: :param num1: the first number as a string :param num2: the second number as a string :return: the product as a string working the... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def multiply(self, num1: str, num2: str) -> str: :param num1: the first number as a string :param num2: the second number as a string :return: the product as a string working the... | 9d8dfd05f6367ea2b5e2b1c490f09a18fa5e8a14 | <|skeleton|>
class Solution:
def multiply(self, num1: str, num2: str) -> str:
""":param num1: the first number as a string :param num2: the second number as a string :return: the product as a string working theory: zeroPad: the power of 10 to muliply by at every stage res = result as an integer; it is bett... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def multiply(self, num1: str, num2: str) -> str:
""":param num1: the first number as a string :param num2: the second number as a string :return: the product as a string working theory: zeroPad: the power of 10 to muliply by at every stage res = result as an integer; it is better because str... | the_stack_v2_python_sparse | multiply strings.py | rehoboth23/leetcode-base | train | 1 | |
6135d22edf85e7f974ce4f3c62c492b1c4318f20 | [
"if len(self.raw_data) < SAMPLE_BYTES:\n raise SampleException('Flort_kn__stc_imodemParserDataParticleKey: No regex match of parsed sample data: [%s]', self.raw_data)\ntry:\n fields_prof = struct.unpack('>I f f f f h h h', self.raw_data)\n time_stamp = int(fields_prof[0])\n scatter = int(fields_prof[5])... | <|body_start_0|>
if len(self.raw_data) < SAMPLE_BYTES:
raise SampleException('Flort_kn__stc_imodemParserDataParticleKey: No regex match of parsed sample data: [%s]', self.raw_data)
try:
fields_prof = struct.unpack('>I f f f f h h h', self.raw_data)
time_stamp = int(fi... | Class for parsing data from the FLORT_KN__STC_IMODEM data set | Flort_kn__stc_imodemParserDataParticle | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Flort_kn__stc_imodemParserDataParticle:
"""Class for parsing data from the FLORT_KN__STC_IMODEM data set"""
def _build_parsed_values(self):
"""Take something in the data format and turn it into a particle with the appropriate tag. @throws SampleException If there is a problem with sa... | stack_v2_sparse_classes_10k_train_008486 | 4,612 | no_license | [
{
"docstring": "Take something in the data format and turn it into a particle with the appropriate tag. @throws SampleException If there is a problem with sample creation",
"name": "_build_parsed_values",
"signature": "def _build_parsed_values(self)"
},
{
"docstring": "Quick equality check for t... | 2 | stack_v2_sparse_classes_30k_train_002711 | Implement the Python class `Flort_kn__stc_imodemParserDataParticle` described below.
Class description:
Class for parsing data from the FLORT_KN__STC_IMODEM data set
Method signatures and docstrings:
- def _build_parsed_values(self): Take something in the data format and turn it into a particle with the appropriate t... | Implement the Python class `Flort_kn__stc_imodemParserDataParticle` described below.
Class description:
Class for parsing data from the FLORT_KN__STC_IMODEM data set
Method signatures and docstrings:
- def _build_parsed_values(self): Take something in the data format and turn it into a particle with the appropriate t... | e1485ecda888a331a1554450a1d16c58941b6391 | <|skeleton|>
class Flort_kn__stc_imodemParserDataParticle:
"""Class for parsing data from the FLORT_KN__STC_IMODEM data set"""
def _build_parsed_values(self):
"""Take something in the data format and turn it into a particle with the appropriate tag. @throws SampleException If there is a problem with sa... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Flort_kn__stc_imodemParserDataParticle:
"""Class for parsing data from the FLORT_KN__STC_IMODEM data set"""
def _build_parsed_values(self):
"""Take something in the data format and turn it into a particle with the appropriate tag. @throws SampleException If there is a problem with sample creation... | the_stack_v2_python_sparse | mi/dataset/parser/flort_kn__stc_imodem.py | kstiemke/marine-integrations | train | 0 |
acfdcb335c32e36881c60c686687326fa053f4ca | [
"self.model_type = model_type\nself.threshold = threshold\nself.curr_threshold = threshold\nself.fire = fire\nself.refract = refract\nself.t_max = self.fire + self.refract",
"if self.model_type == 'linear':\n if activation_time > 0:\n self.curr_threshold = self.threshold + (1 - self.threshold) * (1 - ac... | <|body_start_0|>
self.model_type = model_type
self.threshold = threshold
self.curr_threshold = threshold
self.fire = fire
self.refract = refract
self.t_max = self.fire + self.refract
<|end_body_0|>
<|body_start_1|>
if self.model_type == 'linear':
if a... | The model that describes how the neuron will fire given that it is activated. Attributes ---------- model_type : str A string describing the type of firing model for this Firing_Model instance threshold : float The value of input at which point the neuron goes from being inactive to active curr_threshold : float The cu... | Threshold_Model | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Threshold_Model:
"""The model that describes how the neuron will fire given that it is activated. Attributes ---------- model_type : str A string describing the type of firing model for this Firing_Model instance threshold : float The value of input at which point the neuron goes from being inact... | stack_v2_sparse_classes_10k_train_008487 | 13,526 | permissive | [
{
"docstring": "Parameters ---------- model_type : str A string describing the type of firing model for this Firing_Model instance threshold : float Defines the value of input at which point the neuron goes from being inactive to active curr_threshold : float Holds the current value of the threshold, which may ... | 2 | stack_v2_sparse_classes_30k_train_006092 | Implement the Python class `Threshold_Model` described below.
Class description:
The model that describes how the neuron will fire given that it is activated. Attributes ---------- model_type : str A string describing the type of firing model for this Firing_Model instance threshold : float The value of input at which... | Implement the Python class `Threshold_Model` described below.
Class description:
The model that describes how the neuron will fire given that it is activated. Attributes ---------- model_type : str A string describing the type of firing model for this Firing_Model instance threshold : float The value of input at which... | 93aa6312ab53e6a71f6ef5dd1fc6b2187d852ee1 | <|skeleton|>
class Threshold_Model:
"""The model that describes how the neuron will fire given that it is activated. Attributes ---------- model_type : str A string describing the type of firing model for this Firing_Model instance threshold : float The value of input at which point the neuron goes from being inact... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Threshold_Model:
"""The model that describes how the neuron will fire given that it is activated. Attributes ---------- model_type : str A string describing the type of firing model for this Firing_Model instance threshold : float The value of input at which point the neuron goes from being inactive to active... | the_stack_v2_python_sparse | neuralnet/neuron_stable_adjust.py | orrenravid1/AML | train | 0 |
f9388c25b30a2c91e3dc6c31b945f6e137a77ff0 | [
"if len(coins) == 0:\n return -1\nif amount == 0:\n return 0\ncoins.sort()\ndp = [amount + 1] * (amount + 1)\nfor i in range(1, amount + 1):\n for c in coins:\n if i == c:\n dp[i] = 1\n elif i - c > 0 and dp[i - c] > 0:\n dp[i] = min(dp[i], dp[i - c] + 1)\n else:\... | <|body_start_0|>
if len(coins) == 0:
return -1
if amount == 0:
return 0
coins.sort()
dp = [amount + 1] * (amount + 1)
for i in range(1, amount + 1):
for c in coins:
if i == c:
dp[i] = 1
elif i... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def coinChange(self, coins, amount):
""":type coins: List[int] :type amount: int :rtype: int"""
<|body_0|>
def coinChange(self, coins, amount):
""":type coins: List[int] :type amount: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>... | stack_v2_sparse_classes_10k_train_008488 | 2,034 | no_license | [
{
"docstring": ":type coins: List[int] :type amount: int :rtype: int",
"name": "coinChange",
"signature": "def coinChange(self, coins, amount)"
},
{
"docstring": ":type coins: List[int] :type amount: int :rtype: int",
"name": "coinChange",
"signature": "def coinChange(self, coins, amount... | 2 | stack_v2_sparse_classes_30k_train_001350 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def coinChange(self, coins, amount): :type coins: List[int] :type amount: int :rtype: int
- def coinChange(self, coins, amount): :type coins: List[int] :type amount: int :rtype: ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def coinChange(self, coins, amount): :type coins: List[int] :type amount: int :rtype: int
- def coinChange(self, coins, amount): :type coins: List[int] :type amount: int :rtype: ... | 63b7eedc720c1ce14880b80744dcd5ef7107065c | <|skeleton|>
class Solution:
def coinChange(self, coins, amount):
""":type coins: List[int] :type amount: int :rtype: int"""
<|body_0|>
def coinChange(self, coins, amount):
""":type coins: List[int] :type amount: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def coinChange(self, coins, amount):
""":type coins: List[int] :type amount: int :rtype: int"""
if len(coins) == 0:
return -1
if amount == 0:
return 0
coins.sort()
dp = [amount + 1] * (amount + 1)
for i in range(1, amount + 1):
... | the_stack_v2_python_sparse | problems/coinChange.py | joddiy/leetcode | train | 1 | |
b2a45618b02c9babe1661231eefdf1d309e6fe6d | [
"assert isinstance(response, scrapy.http.response.html.HtmlResponse)\ncurboard = response.selector.xpath('//div[contains(@class, \"titleBar\")]/h1/text()').extract()\nlast_page = MAX_PAGE[curboard[0].lower()]\n'try:\\n last_page = int(response.selector.xpath(\\'//nav/a[@class=\"PageNavNext\"]/following::... | <|body_start_0|>
assert isinstance(response, scrapy.http.response.html.HtmlResponse)
curboard = response.selector.xpath('//div[contains(@class, "titleBar")]/h1/text()').extract()
last_page = MAX_PAGE[curboard[0].lower()]
'try:\n last_page = int(response.selector.xpath(\'//nav/... | scrape reports from angling addicts forum | worldseafishingReportsSpider | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class worldseafishingReportsSpider:
"""scrape reports from angling addicts forum"""
def parse(self, response):
"""generate links to pages in a board yields: https://www.worldseafishing.com/forums/forums/south-east-catch-reports.39/, ..."""
<|body_0|>
def crawl_board_threads(se... | stack_v2_sparse_classes_10k_train_008489 | 9,045 | no_license | [
{
"docstring": "generate links to pages in a board yields: https://www.worldseafishing.com/forums/forums/south-east-catch-reports.39/, ...",
"name": "parse",
"signature": "def parse(self, response)"
},
{
"docstring": "crawl",
"name": "crawl_board_threads",
"signature": "def crawl_board_t... | 3 | null | Implement the Python class `worldseafishingReportsSpider` described below.
Class description:
scrape reports from angling addicts forum
Method signatures and docstrings:
- def parse(self, response): generate links to pages in a board yields: https://www.worldseafishing.com/forums/forums/south-east-catch-reports.39/, ... | Implement the Python class `worldseafishingReportsSpider` described below.
Class description:
scrape reports from angling addicts forum
Method signatures and docstrings:
- def parse(self, response): generate links to pages in a board yields: https://www.worldseafishing.com/forums/forums/south-east-catch-reports.39/, ... | 9123aa6baf538b662143b9098d963d55165e8409 | <|skeleton|>
class worldseafishingReportsSpider:
"""scrape reports from angling addicts forum"""
def parse(self, response):
"""generate links to pages in a board yields: https://www.worldseafishing.com/forums/forums/south-east-catch-reports.39/, ..."""
<|body_0|>
def crawl_board_threads(se... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class worldseafishingReportsSpider:
"""scrape reports from angling addicts forum"""
def parse(self, response):
"""generate links to pages in a board yields: https://www.worldseafishing.com/forums/forums/south-east-catch-reports.39/, ..."""
assert isinstance(response, scrapy.http.response.html.H... | the_stack_v2_python_sparse | imgscrape/spiders/worldseafishing_reports.py | gmonkman/python | train | 0 |
91bc824fbc850b3a8d04607956fc21673b175379 | [
"self.entity_description = description\nself.dht_client = dht_client\nself.temperature_offset = temperature_offset\nself.humidity_offset = humidity_offset\nself._attr_name = f'{name} {description.name}'",
"self.dht_client.update()\ntemperature_offset = self.temperature_offset\nhumidity_offset = self.humidity_offs... | <|body_start_0|>
self.entity_description = description
self.dht_client = dht_client
self.temperature_offset = temperature_offset
self.humidity_offset = humidity_offset
self._attr_name = f'{name} {description.name}'
<|end_body_0|>
<|body_start_1|>
self.dht_client.update()... | Implementation of the DHT sensor. | DHTSensor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DHTSensor:
"""Implementation of the DHT sensor."""
def __init__(self, dht_client, name, temperature_offset, humidity_offset, description: SensorEntityDescription):
"""Initialize the sensor."""
<|body_0|>
def update(self):
"""Get the latest data from the DHT and u... | stack_v2_sparse_classes_10k_train_008490 | 5,733 | permissive | [
{
"docstring": "Initialize the sensor.",
"name": "__init__",
"signature": "def __init__(self, dht_client, name, temperature_offset, humidity_offset, description: SensorEntityDescription)"
},
{
"docstring": "Get the latest data from the DHT and updates the states.",
"name": "update",
"sig... | 2 | stack_v2_sparse_classes_30k_train_005905 | Implement the Python class `DHTSensor` described below.
Class description:
Implementation of the DHT sensor.
Method signatures and docstrings:
- def __init__(self, dht_client, name, temperature_offset, humidity_offset, description: SensorEntityDescription): Initialize the sensor.
- def update(self): Get the latest da... | Implement the Python class `DHTSensor` described below.
Class description:
Implementation of the DHT sensor.
Method signatures and docstrings:
- def __init__(self, dht_client, name, temperature_offset, humidity_offset, description: SensorEntityDescription): Initialize the sensor.
- def update(self): Get the latest da... | 8de7966104911bca6f855a1755a6d71a07afb9de | <|skeleton|>
class DHTSensor:
"""Implementation of the DHT sensor."""
def __init__(self, dht_client, name, temperature_offset, humidity_offset, description: SensorEntityDescription):
"""Initialize the sensor."""
<|body_0|>
def update(self):
"""Get the latest data from the DHT and u... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DHTSensor:
"""Implementation of the DHT sensor."""
def __init__(self, dht_client, name, temperature_offset, humidity_offset, description: SensorEntityDescription):
"""Initialize the sensor."""
self.entity_description = description
self.dht_client = dht_client
self.temperat... | the_stack_v2_python_sparse | homeassistant/components/dht/sensor.py | AlexxIT/home-assistant | train | 9 |
3ae529ed25137259e089590503d195acaeb11622 | [
"kwargs = locals()\nimage, mask = zipp.zipper_interp_rows(**kwargs)\nreturn (image, mask)",
"min_cols = config.getint(cls.step_name, 'min_cols')\nmax_cols = config.getint(cls.step_name, 'max_cols')\ninterp_mask = maskbits.parse_badpix_mask(config.get(cls.step_name, 'interp_mask'))\ninvalid_mask = maskbits.parse_b... | <|body_start_0|>
kwargs = locals()
image, mask = zipp.zipper_interp_rows(**kwargs)
return (image, mask)
<|end_body_0|>
<|body_start_1|>
min_cols = config.getint(cls.step_name, 'min_cols')
max_cols = config.getint(cls.step_name, 'max_cols')
interp_mask = maskbits.parse_ba... | ZipperInterp | [
"NCSA"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ZipperInterp:
def __call__(cls, image, mask, interp_mask=DEFAULT_INTERP_MASK, BADPIX_INTERP=maskbits.BADPIX_INTERP, min_cols=DEFAULT_MINCOLS, max_cols=DEFAULT_MAXCOLS, invalid_mask=DEFAULT_INVALID_MASK, add_noise=DEFAULT_ADD_NOISE, clobber=DEFAULT_CLOBBER, block_size=DEFAULT_BLOCK_SIZE, logger=l... | stack_v2_sparse_classes_10k_train_008491 | 5,753 | permissive | [
{
"docstring": "Interpolate over selected pixels by inserting average of pixels to left and right of any bunch of adjacent selected pixels. If the interpolation region touches an edge, or the adjacent pixel has flags marking it as invalid, than the value at other border is used for interpolation. No interpolati... | 3 | stack_v2_sparse_classes_30k_train_001529 | Implement the Python class `ZipperInterp` described below.
Class description:
Implement the ZipperInterp class.
Method signatures and docstrings:
- def __call__(cls, image, mask, interp_mask=DEFAULT_INTERP_MASK, BADPIX_INTERP=maskbits.BADPIX_INTERP, min_cols=DEFAULT_MINCOLS, max_cols=DEFAULT_MAXCOLS, invalid_mask=DEF... | Implement the Python class `ZipperInterp` described below.
Class description:
Implement the ZipperInterp class.
Method signatures and docstrings:
- def __call__(cls, image, mask, interp_mask=DEFAULT_INTERP_MASK, BADPIX_INTERP=maskbits.BADPIX_INTERP, min_cols=DEFAULT_MINCOLS, max_cols=DEFAULT_MAXCOLS, invalid_mask=DEF... | 8a299e9368d01cac51f53af6e4937e797f378d7a | <|skeleton|>
class ZipperInterp:
def __call__(cls, image, mask, interp_mask=DEFAULT_INTERP_MASK, BADPIX_INTERP=maskbits.BADPIX_INTERP, min_cols=DEFAULT_MINCOLS, max_cols=DEFAULT_MAXCOLS, invalid_mask=DEFAULT_INVALID_MASK, add_noise=DEFAULT_ADD_NOISE, clobber=DEFAULT_CLOBBER, block_size=DEFAULT_BLOCK_SIZE, logger=l... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ZipperInterp:
def __call__(cls, image, mask, interp_mask=DEFAULT_INTERP_MASK, BADPIX_INTERP=maskbits.BADPIX_INTERP, min_cols=DEFAULT_MINCOLS, max_cols=DEFAULT_MAXCOLS, invalid_mask=DEFAULT_INVALID_MASK, add_noise=DEFAULT_ADD_NOISE, clobber=DEFAULT_CLOBBER, block_size=DEFAULT_BLOCK_SIZE, logger=logger):
... | the_stack_v2_python_sparse | python/pixcorrect/row_zipper.py | DarkEnergySurvey/pixcorrect | train | 1 | |
dc0908ada34fe75bb87b0a361044639694ec2c2c | [
"self.root = TrieNode()\nfor word in words:\n n = self.root\n word = word[::-1]\n for idx, c in enumerate(word):\n cid = ord(c) - ord('a')\n if n.mapping[cid] is None:\n n.mapping[cid] = TrieNode()\n n = n.mapping[cid]\n if idx == len(word) - 1:\n n.is_word... | <|body_start_0|>
self.root = TrieNode()
for word in words:
n = self.root
word = word[::-1]
for idx, c in enumerate(word):
cid = ord(c) - ord('a')
if n.mapping[cid] is None:
n.mapping[cid] = TrieNode()
... | StreamChecker | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StreamChecker:
def __init__(self, words):
""":type words: List[str]"""
<|body_0|>
def query(self, letter):
""":type letter: str :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.root = TrieNode()
for word in words:
... | stack_v2_sparse_classes_10k_train_008492 | 4,397 | no_license | [
{
"docstring": ":type words: List[str]",
"name": "__init__",
"signature": "def __init__(self, words)"
},
{
"docstring": ":type letter: str :rtype: bool",
"name": "query",
"signature": "def query(self, letter)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004489 | Implement the Python class `StreamChecker` described below.
Class description:
Implement the StreamChecker class.
Method signatures and docstrings:
- def __init__(self, words): :type words: List[str]
- def query(self, letter): :type letter: str :rtype: bool | Implement the Python class `StreamChecker` described below.
Class description:
Implement the StreamChecker class.
Method signatures and docstrings:
- def __init__(self, words): :type words: List[str]
- def query(self, letter): :type letter: str :rtype: bool
<|skeleton|>
class StreamChecker:
def __init__(self, w... | 4d73e4c1f2017828ff2d36058819988146356abe | <|skeleton|>
class StreamChecker:
def __init__(self, words):
""":type words: List[str]"""
<|body_0|>
def query(self, letter):
""":type letter: str :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class StreamChecker:
def __init__(self, words):
""":type words: List[str]"""
self.root = TrieNode()
for word in words:
n = self.root
word = word[::-1]
for idx, c in enumerate(word):
cid = ord(c) - ord('a')
if n.mapping[cid] ... | the_stack_v2_python_sparse | python/leetcode/string/1032_stream_of_char.py | zchen0211/topcoder | train | 0 | |
4c58f6ce4f5f92e69fa53334ce11acbf1e113b63 | [
"entity = self.entities.find_entity_by_id(event.entity_id)\nskill = self.entities.find_entity_by_id(event.skill_entity_id)\nentity_mana_component = entity.components.get('mana', None)\nskill_mana_component = skill.components.get('mana_consuming_skill', None)\nif not skill_mana_component:\n return\nif not entity_... | <|body_start_0|>
entity = self.entities.find_entity_by_id(event.entity_id)
skill = self.entities.find_entity_by_id(event.skill_entity_id)
entity_mana_component = entity.components.get('mana', None)
skill_mana_component = skill.components.get('mana_consuming_skill', None)
if not s... | Mana consuming skill system. | ManaConsumingSkillSystem | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ManaConsumingSkillSystem:
"""Mana consuming skill system."""
def on_entity_skill_usage_attempt(self, event):
"""Handle an entity skill usage attempt."""
<|body_0|>
def on_entity_skill_usage(self, event):
"""Handle an entity skill usage."""
<|body_1|>
<|e... | stack_v2_sparse_classes_10k_train_008493 | 21,180 | permissive | [
{
"docstring": "Handle an entity skill usage attempt.",
"name": "on_entity_skill_usage_attempt",
"signature": "def on_entity_skill_usage_attempt(self, event)"
},
{
"docstring": "Handle an entity skill usage.",
"name": "on_entity_skill_usage",
"signature": "def on_entity_skill_usage(self,... | 2 | stack_v2_sparse_classes_30k_train_002604 | Implement the Python class `ManaConsumingSkillSystem` described below.
Class description:
Mana consuming skill system.
Method signatures and docstrings:
- def on_entity_skill_usage_attempt(self, event): Handle an entity skill usage attempt.
- def on_entity_skill_usage(self, event): Handle an entity skill usage. | Implement the Python class `ManaConsumingSkillSystem` described below.
Class description:
Mana consuming skill system.
Method signatures and docstrings:
- def on_entity_skill_usage_attempt(self, event): Handle an entity skill usage attempt.
- def on_entity_skill_usage(self, event): Handle an entity skill usage.
<|sk... | 1d84c2869a242a112e57c6cafc6da7329f9d0808 | <|skeleton|>
class ManaConsumingSkillSystem:
"""Mana consuming skill system."""
def on_entity_skill_usage_attempt(self, event):
"""Handle an entity skill usage attempt."""
<|body_0|>
def on_entity_skill_usage(self, event):
"""Handle an entity skill usage."""
<|body_1|>
<|e... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ManaConsumingSkillSystem:
"""Mana consuming skill system."""
def on_entity_skill_usage_attempt(self, event):
"""Handle an entity skill usage attempt."""
entity = self.entities.find_entity_by_id(event.entity_id)
skill = self.entities.find_entity_by_id(event.skill_entity_id)
... | the_stack_v2_python_sparse | akurra/skills.py | multatronic/akurra | train | 0 |
54dc020b654c45e79beb5dc933e373a4f0e71d80 | [
"super(GAT, self).__init__()\nself.dropout = dropout\nself.attentions = [GraphAttentionLayer(nfeat, nhid, dropout=dropout, alpha=alpha, concat=True) for _ in range(nheads)]\nfor i, attention in enumerate(self.attentions):\n self.add_module('attention_{}'.format(i), attention)\nself.out_att = GraphAttentionLayer(... | <|body_start_0|>
super(GAT, self).__init__()
self.dropout = dropout
self.attentions = [GraphAttentionLayer(nfeat, nhid, dropout=dropout, alpha=alpha, concat=True) for _ in range(nheads)]
for i, attention in enumerate(self.attentions):
self.add_module('attention_{}'.format(i),... | GAT | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GAT:
def __init__(self, nfeat, nhid, nclass, dropout, alpha, nheads):
"""Dense version of GAT."""
<|body_0|>
def forward(self, x, adj):
"""Input: [node, nfeat], output: [node, nclass]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super(GAT, self).... | stack_v2_sparse_classes_10k_train_008494 | 8,391 | no_license | [
{
"docstring": "Dense version of GAT.",
"name": "__init__",
"signature": "def __init__(self, nfeat, nhid, nclass, dropout, alpha, nheads)"
},
{
"docstring": "Input: [node, nfeat], output: [node, nclass]",
"name": "forward",
"signature": "def forward(self, x, adj)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004945 | Implement the Python class `GAT` described below.
Class description:
Implement the GAT class.
Method signatures and docstrings:
- def __init__(self, nfeat, nhid, nclass, dropout, alpha, nheads): Dense version of GAT.
- def forward(self, x, adj): Input: [node, nfeat], output: [node, nclass] | Implement the Python class `GAT` described below.
Class description:
Implement the GAT class.
Method signatures and docstrings:
- def __init__(self, nfeat, nhid, nclass, dropout, alpha, nheads): Dense version of GAT.
- def forward(self, x, adj): Input: [node, nfeat], output: [node, nclass]
<|skeleton|>
class GAT:
... | c0b1e44be34b763622dac60ae8525803432fd52e | <|skeleton|>
class GAT:
def __init__(self, nfeat, nhid, nclass, dropout, alpha, nheads):
"""Dense version of GAT."""
<|body_0|>
def forward(self, x, adj):
"""Input: [node, nfeat], output: [node, nclass]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GAT:
def __init__(self, nfeat, nhid, nclass, dropout, alpha, nheads):
"""Dense version of GAT."""
super(GAT, self).__init__()
self.dropout = dropout
self.attentions = [GraphAttentionLayer(nfeat, nhid, dropout=dropout, alpha=alpha, concat=True) for _ in range(nheads)]
fo... | the_stack_v2_python_sparse | engineer/models/common/GCNattention.py | LittleFlyFish/Motion-Cycle-GCN | train | 0 | |
f20ed0c35271315c81ba179f5f36dfcc56d7ab27 | [
"MOD = int(1000000000.0 + 7)\ncnt = Counter(arr)\nkeys = list(sorted(cnt.keys()))\n\n@lru_cache(None)\ndef comb(n, r):\n r = min(r, n - r)\n if r == 0:\n return 1\n return int(comb(n - 1, r - 1) * n / r) % MOD\n\ndef backtrack(i, t, cur):\n if t == 0 and sum(cur.values()) == 3:\n ret = 1\n... | <|body_start_0|>
MOD = int(1000000000.0 + 7)
cnt = Counter(arr)
keys = list(sorted(cnt.keys()))
@lru_cache(None)
def comb(n, r):
r = min(r, n - r)
if r == 0:
return 1
return int(comb(n - 1, r - 1) * n / r) % MOD
def ba... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def threeSumMulti(self, arr: List[int], target: int) -> int:
"""TLE. This can be a generic solution with some modification."""
<|body_0|>
def threeSumMulti(self, arr: List[int], target: int) -> int:
"""Time complexity: O(n^2) Space complexity: O(n)"""
... | stack_v2_sparse_classes_10k_train_008495 | 3,954 | no_license | [
{
"docstring": "TLE. This can be a generic solution with some modification.",
"name": "threeSumMulti",
"signature": "def threeSumMulti(self, arr: List[int], target: int) -> int"
},
{
"docstring": "Time complexity: O(n^2) Space complexity: O(n)",
"name": "threeSumMulti",
"signature": "def... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def threeSumMulti(self, arr: List[int], target: int) -> int: TLE. This can be a generic solution with some modification.
- def threeSumMulti(self, arr: List[int], target: int) ->... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def threeSumMulti(self, arr: List[int], target: int) -> int: TLE. This can be a generic solution with some modification.
- def threeSumMulti(self, arr: List[int], target: int) ->... | 1389a009a02e90e8700a7a00e0b7f797c129cdf4 | <|skeleton|>
class Solution:
def threeSumMulti(self, arr: List[int], target: int) -> int:
"""TLE. This can be a generic solution with some modification."""
<|body_0|>
def threeSumMulti(self, arr: List[int], target: int) -> int:
"""Time complexity: O(n^2) Space complexity: O(n)"""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def threeSumMulti(self, arr: List[int], target: int) -> int:
"""TLE. This can be a generic solution with some modification."""
MOD = int(1000000000.0 + 7)
cnt = Counter(arr)
keys = list(sorted(cnt.keys()))
@lru_cache(None)
def comb(n, r):
... | the_stack_v2_python_sparse | leetcode/solved/959_3Sum_With_Multiplicity/solution.py | sungminoh/algorithms | train | 0 | |
d3dde0fc668294af4c3e0eb15a260e89dcf7a52c | [
"login_url = 'http://www.renren.com/ajaxLogin/login?1=1&uniqueTimestamp=2018822125828'\ndata = {'email': '15899962704', 'icode': '', 'origURL': 'http://www.renren.com/home', 'domain': 'renren.com', 'key_id': '1', 'captcha_type': 'web_login', 'password': '2c18e5058b11daacfa19994395734b2490de52f533def51d9eb68e009710a... | <|body_start_0|>
login_url = 'http://www.renren.com/ajaxLogin/login?1=1&uniqueTimestamp=2018822125828'
data = {'email': '15899962704', 'icode': '', 'origURL': 'http://www.renren.com/home', 'domain': 'renren.com', 'key_id': '1', 'captcha_type': 'web_login', 'password': '2c18e5058b11daacfa19994395734b2490... | LoginSpider | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoginSpider:
def start_requests(self):
"""人人网登录操作 使用 yield 与 scrapy 的 FormRequest 提交用户登录信息,并使用回调方法访问 parse 来接下来处理返回的代码。 注意:测试时请使用您的用户名与密码"""
<|body_0|>
def parse(self, response):
"""爬虫 start_requests 方法的回调函数。 返回的是 JSON 数据,解析 response 将数据取出,如果登录失败,显示其中的 failDescriptio... | stack_v2_sparse_classes_10k_train_008496 | 2,373 | permissive | [
{
"docstring": "人人网登录操作 使用 yield 与 scrapy 的 FormRequest 提交用户登录信息,并使用回调方法访问 parse 来接下来处理返回的代码。 注意:测试时请使用您的用户名与密码",
"name": "start_requests",
"signature": "def start_requests(self)"
},
{
"docstring": "爬虫 start_requests 方法的回调函数。 返回的是 JSON 数据,解析 response 将数据取出,如果登录失败,显示其中的 failDescription 值。 如果这个字段不... | 3 | stack_v2_sparse_classes_30k_train_003314 | Implement the Python class `LoginSpider` described below.
Class description:
Implement the LoginSpider class.
Method signatures and docstrings:
- def start_requests(self): 人人网登录操作 使用 yield 与 scrapy 的 FormRequest 提交用户登录信息,并使用回调方法访问 parse 来接下来处理返回的代码。 注意:测试时请使用您的用户名与密码
- def parse(self, response): 爬虫 start_requests 方法的... | Implement the Python class `LoginSpider` described below.
Class description:
Implement the LoginSpider class.
Method signatures and docstrings:
- def start_requests(self): 人人网登录操作 使用 yield 与 scrapy 的 FormRequest 提交用户登录信息,并使用回调方法访问 parse 来接下来处理返回的代码。 注意:测试时请使用您的用户名与密码
- def parse(self, response): 爬虫 start_requests 方法的... | e851524917b60e7308172bc235597b7c578882cc | <|skeleton|>
class LoginSpider:
def start_requests(self):
"""人人网登录操作 使用 yield 与 scrapy 的 FormRequest 提交用户登录信息,并使用回调方法访问 parse 来接下来处理返回的代码。 注意:测试时请使用您的用户名与密码"""
<|body_0|>
def parse(self, response):
"""爬虫 start_requests 方法的回调函数。 返回的是 JSON 数据,解析 response 将数据取出,如果登录失败,显示其中的 failDescriptio... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class LoginSpider:
def start_requests(self):
"""人人网登录操作 使用 yield 与 scrapy 的 FormRequest 提交用户登录信息,并使用回调方法访问 parse 来接下来处理返回的代码。 注意:测试时请使用您的用户名与密码"""
login_url = 'http://www.renren.com/ajaxLogin/login?1=1&uniqueTimestamp=2018822125828'
data = {'email': '15899962704', 'icode': '', 'origURL': 'ht... | the_stack_v2_python_sparse | 9th_week/homework/作业2/renren/renren/spiders/login.py | luhuadong/Python_Learning | train | 1 | |
00b0482e9a5e0c4f432ce3f4e8665411a39057cc | [
"app_id_list = self.request.query_params.get('selectedAppList')\nif not app_id_list:\n app_id_list = get_cc_app_id_by_user()\nelse:\n app_id_list = app_id_list.split(',')\nreturn EsCluster.objects.filter(app_id__in=app_id_list).order_by('-create_time')",
"try:\n post_data = request.data\n bk_username ... | <|body_start_0|>
app_id_list = self.request.query_params.get('selectedAppList')
if not app_id_list:
app_id_list = get_cc_app_id_by_user()
else:
app_id_list = app_id_list.split(',')
return EsCluster.objects.filter(app_id__in=app_id_list).order_by('-create_time')
<|... | es集群表视图 | EsClusterViewSet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EsClusterViewSet:
"""es集群表视图"""
def get_queryset(self):
"""重写get_queryset方法,根据用户的业务权限来输出对应记录,用户隔离"""
<|body_0|>
def create_cluster(self, request, *args, **kwargs):
"""POST /es/create_cluster es集群创建"""
<|body_1|>
def add_node(self, request):
"... | stack_v2_sparse_classes_10k_train_008497 | 10,026 | no_license | [
{
"docstring": "重写get_queryset方法,根据用户的业务权限来输出对应记录,用户隔离",
"name": "get_queryset",
"signature": "def get_queryset(self)"
},
{
"docstring": "POST /es/create_cluster es集群创建",
"name": "create_cluster",
"signature": "def create_cluster(self, request, *args, **kwargs)"
},
{
"docstring":... | 6 | stack_v2_sparse_classes_30k_train_007009 | Implement the Python class `EsClusterViewSet` described below.
Class description:
es集群表视图
Method signatures and docstrings:
- def get_queryset(self): 重写get_queryset方法,根据用户的业务权限来输出对应记录,用户隔离
- def create_cluster(self, request, *args, **kwargs): POST /es/create_cluster es集群创建
- def add_node(self, request): POST /api/es/... | Implement the Python class `EsClusterViewSet` described below.
Class description:
es集群表视图
Method signatures and docstrings:
- def get_queryset(self): 重写get_queryset方法,根据用户的业务权限来输出对应记录,用户隔离
- def create_cluster(self, request, *args, **kwargs): POST /es/create_cluster es集群创建
- def add_node(self, request): POST /api/es/... | 97cfac2ba94d67980d837f0b541caae70b68a595 | <|skeleton|>
class EsClusterViewSet:
"""es集群表视图"""
def get_queryset(self):
"""重写get_queryset方法,根据用户的业务权限来输出对应记录,用户隔离"""
<|body_0|>
def create_cluster(self, request, *args, **kwargs):
"""POST /es/create_cluster es集群创建"""
<|body_1|>
def add_node(self, request):
"... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class EsClusterViewSet:
"""es集群表视图"""
def get_queryset(self):
"""重写get_queryset方法,根据用户的业务权限来输出对应记录,用户隔离"""
app_id_list = self.request.query_params.get('selectedAppList')
if not app_id_list:
app_id_list = get_cc_app_id_by_user()
else:
app_id_list = app_id_... | the_stack_v2_python_sparse | apps/es/views.py | sdgdsffdsfff/bk-dop | train | 0 |
0e5694e355ae1dff3f960a093ff3daec430fb5fa | [
"super().__init__(*args, **kwargs)\nself.model_dir: str = model_dir\nself.config = Config.from_file(os.path.join(self.model_dir, ModelFile.CONFIGURATION))\nself.device = 'cuda' if ('device' not in kwargs or kwargs['device'] == 'gpu') and torch.cuda.is_available() else 'cpu'\nself.processor = None\nself.table_path =... | <|body_start_0|>
super().__init__(*args, **kwargs)
self.model_dir: str = model_dir
self.config = Config.from_file(os.path.join(self.model_dir, ModelFile.CONFIGURATION))
self.device = 'cuda' if ('device' not in kwargs or kwargs['device'] == 'gpu') and torch.cuda.is_available() else 'cpu'
... | ConversationalTextToSqlPreprocessor | [
"Apache-2.0",
"BSD-3-Clause",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConversationalTextToSqlPreprocessor:
def __init__(self, model_dir: str, *args, **kwargs):
"""preprocess the data Args: model_dir (str): model path"""
<|body_0|>
def __call__(self, data: Dict[str, Any]) -> Dict[str, Any]:
"""process the raw input data Args: data (dict... | stack_v2_sparse_classes_10k_train_008498 | 4,902 | permissive | [
{
"docstring": "preprocess the data Args: model_dir (str): model path",
"name": "__init__",
"signature": "def __init__(self, model_dir: str, *args, **kwargs)"
},
{
"docstring": "process the raw input data Args: data (dict): utterance: a sentence last_sql: predicted sql of last utterance Example:... | 2 | stack_v2_sparse_classes_30k_train_000011 | Implement the Python class `ConversationalTextToSqlPreprocessor` described below.
Class description:
Implement the ConversationalTextToSqlPreprocessor class.
Method signatures and docstrings:
- def __init__(self, model_dir: str, *args, **kwargs): preprocess the data Args: model_dir (str): model path
- def __call__(se... | Implement the Python class `ConversationalTextToSqlPreprocessor` described below.
Class description:
Implement the ConversationalTextToSqlPreprocessor class.
Method signatures and docstrings:
- def __init__(self, model_dir: str, *args, **kwargs): preprocess the data Args: model_dir (str): model path
- def __call__(se... | 8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6 | <|skeleton|>
class ConversationalTextToSqlPreprocessor:
def __init__(self, model_dir: str, *args, **kwargs):
"""preprocess the data Args: model_dir (str): model path"""
<|body_0|>
def __call__(self, data: Dict[str, Any]) -> Dict[str, Any]:
"""process the raw input data Args: data (dict... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ConversationalTextToSqlPreprocessor:
def __init__(self, model_dir: str, *args, **kwargs):
"""preprocess the data Args: model_dir (str): model path"""
super().__init__(*args, **kwargs)
self.model_dir: str = model_dir
self.config = Config.from_file(os.path.join(self.model_dir, Mo... | the_stack_v2_python_sparse | ai/modelscope/modelscope/preprocessors/nlp/space_T_en/conversational_text_to_sql_preprocessor.py | alldatacenter/alldata | train | 774 | |
6de0436abd47ba94fac9bb05fdbe77550bf7c91f | [
"self.column_names: List = kargs.pop('column_names')\nsuper().__init__(*args, **kargs)\nself.set_fields_from_dict(['item_column', 'confirm_items'])\nitem_column = self.fields['item_column'].initial\nif item_column is None:\n item_column = ('', '---')\nelse:\n item_column = (item_column, item_column)\nself.fie... | <|body_start_0|>
self.column_names: List = kargs.pop('column_names')
super().__init__(*args, **kargs)
self.set_fields_from_dict(['item_column', 'confirm_items'])
item_column = self.fields['item_column'].initial
if item_column is None:
item_column = ('', '---')
... | Form to process Basic JSON information. | JSONKeyForm | [
"MIT",
"LGPL-2.0-or-later",
"Python-2.0",
"BSD-3-Clause",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JSONKeyForm:
"""Form to process Basic JSON information."""
def __init__(self, *args, **kargs):
"""Store column names, payload and modify item_column and confirm."""
<|body_0|>
def clean(self):
"""Verify email values."""
<|body_1|>
<|end_skeleton|>
<|bod... | stack_v2_sparse_classes_10k_train_008499 | 20,237 | permissive | [
{
"docstring": "Store column names, payload and modify item_column and confirm.",
"name": "__init__",
"signature": "def __init__(self, *args, **kargs)"
},
{
"docstring": "Verify email values.",
"name": "clean",
"signature": "def clean(self)"
}
] | 2 | stack_v2_sparse_classes_30k_val_000105 | Implement the Python class `JSONKeyForm` described below.
Class description:
Form to process Basic JSON information.
Method signatures and docstrings:
- def __init__(self, *args, **kargs): Store column names, payload and modify item_column and confirm.
- def clean(self): Verify email values. | Implement the Python class `JSONKeyForm` described below.
Class description:
Form to process Basic JSON information.
Method signatures and docstrings:
- def __init__(self, *args, **kargs): Store column names, payload and modify item_column and confirm.
- def clean(self): Verify email values.
<|skeleton|>
class JSONK... | 5473e9faa24c71a2a1102d47ebc2cbf27608e42a | <|skeleton|>
class JSONKeyForm:
"""Form to process Basic JSON information."""
def __init__(self, *args, **kargs):
"""Store column names, payload and modify item_column and confirm."""
<|body_0|>
def clean(self):
"""Verify email values."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class JSONKeyForm:
"""Form to process Basic JSON information."""
def __init__(self, *args, **kargs):
"""Store column names, payload and modify item_column and confirm."""
self.column_names: List = kargs.pop('column_names')
super().__init__(*args, **kargs)
self.set_fields_from_di... | the_stack_v2_python_sparse | ontask/action/forms/run.py | LucasFranciscoCorreia/ontask_b | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.