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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
09ceeff88db61da4ecf6a84878bedc5302bdf39a | [
"if request.version == 'v6':\n return self._post_v6(request)\nelif request.version == 'v7':\n return self._post_v6(request)\nraise Http404()",
"configuration = rest_util.parse_dict(request, 'configuration')\nvalidation = Scan.objects.validate_scan_v6(configuration=configuration)\nresp_dict = {'is_valid': va... | <|body_start_0|>
if request.version == 'v6':
return self._post_v6(request)
elif request.version == 'v7':
return self._post_v6(request)
raise Http404()
<|end_body_0|>
<|body_start_1|>
configuration = rest_util.parse_dict(request, 'configuration')
validatio... | This view is the endpoint for validating a new Scan process before attempting to actually create it | ScansValidationView | [
"LicenseRef-scancode-free-unknown",
"Apache-2.0",
"LicenseRef-scancode-public-domain"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ScansValidationView:
"""This view is the endpoint for validating a new Scan process before attempting to actually create it"""
def post(self, request):
"""Validates a new Scan process and returns any warnings discovered :param request: the HTTP POST request :type request: :class:`res... | stack_v2_sparse_classes_10k_train_002400 | 30,689 | permissive | [
{
"docstring": "Validates a new Scan process and returns any warnings discovered :param request: the HTTP POST request :type request: :class:`rest_framework.request.Request` :rtype: :class:`rest_framework.response.Response` :returns: the HTTP response to send back to the user",
"name": "post",
"signatur... | 2 | null | Implement the Python class `ScansValidationView` described below.
Class description:
This view is the endpoint for validating a new Scan process before attempting to actually create it
Method signatures and docstrings:
- def post(self, request): Validates a new Scan process and returns any warnings discovered :param ... | Implement the Python class `ScansValidationView` described below.
Class description:
This view is the endpoint for validating a new Scan process before attempting to actually create it
Method signatures and docstrings:
- def post(self, request): Validates a new Scan process and returns any warnings discovered :param ... | 28618aee07ceed9e4a6eb7b8d0e6f05b31d8fd6b | <|skeleton|>
class ScansValidationView:
"""This view is the endpoint for validating a new Scan process before attempting to actually create it"""
def post(self, request):
"""Validates a new Scan process and returns any warnings discovered :param request: the HTTP POST request :type request: :class:`res... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ScansValidationView:
"""This view is the endpoint for validating a new Scan process before attempting to actually create it"""
def post(self, request):
"""Validates a new Scan process and returns any warnings discovered :param request: the HTTP POST request :type request: :class:`rest_framework.r... | the_stack_v2_python_sparse | scale/ingest/views.py | kfconsultant/scale | train | 0 |
cba5c6a180efb7a7f707eda93d6c7fa4bdc67032 | [
"if not trans.user_is_admin:\n trans.response.status = 403\n return 'You are not authorized to view the list of forms.'\nquery = trans.sa_session.query(trans.app.model.FormDefinition)\nrval = []\nfor form_definition in query:\n item = form_definition.to_dict(value_mapper={'id': trans.security.encode_id, 'f... | <|body_start_0|>
if not trans.user_is_admin:
trans.response.status = 403
return 'You are not authorized to view the list of forms.'
query = trans.sa_session.query(trans.app.model.FormDefinition)
rval = []
for form_definition in query:
item = form_defin... | FormDefinitionAPIController | [
"CC-BY-2.5",
"AFL-2.1",
"AFL-3.0",
"CC-BY-3.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FormDefinitionAPIController:
def index(self, trans, **kwd):
"""GET /api/forms Displays a collection (list) of forms."""
<|body_0|>
def show(self, trans, id, **kwd):
"""GET /api/forms/{encoded_form_id} Displays information about a form."""
<|body_1|>
def ... | stack_v2_sparse_classes_10k_train_002401 | 3,129 | permissive | [
{
"docstring": "GET /api/forms Displays a collection (list) of forms.",
"name": "index",
"signature": "def index(self, trans, **kwd)"
},
{
"docstring": "GET /api/forms/{encoded_form_id} Displays information about a form.",
"name": "show",
"signature": "def show(self, trans, id, **kwd)"
... | 3 | null | Implement the Python class `FormDefinitionAPIController` described below.
Class description:
Implement the FormDefinitionAPIController class.
Method signatures and docstrings:
- def index(self, trans, **kwd): GET /api/forms Displays a collection (list) of forms.
- def show(self, trans, id, **kwd): GET /api/forms/{enc... | Implement the Python class `FormDefinitionAPIController` described below.
Class description:
Implement the FormDefinitionAPIController class.
Method signatures and docstrings:
- def index(self, trans, **kwd): GET /api/forms Displays a collection (list) of forms.
- def show(self, trans, id, **kwd): GET /api/forms/{enc... | d194520fdfe08e48c0b3d0d2299cd2adcb8f5952 | <|skeleton|>
class FormDefinitionAPIController:
def index(self, trans, **kwd):
"""GET /api/forms Displays a collection (list) of forms."""
<|body_0|>
def show(self, trans, id, **kwd):
"""GET /api/forms/{encoded_form_id} Displays information about a form."""
<|body_1|>
def ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FormDefinitionAPIController:
def index(self, trans, **kwd):
"""GET /api/forms Displays a collection (list) of forms."""
if not trans.user_is_admin:
trans.response.status = 403
return 'You are not authorized to view the list of forms.'
query = trans.sa_session.qu... | the_stack_v2_python_sparse | lib/galaxy/webapps/galaxy/api/forms.py | bwlang/galaxy | train | 0 | |
d6dae09b0fd339f6e9055fcb9005ce68cb0f2921 | [
"self.mean = mean\nself.icdf_array = np.asarray(icdf_array)\nself.CDF_RES = len(icdf_array) - 1\nself.time_steps_per_day = pe.Parameters.instance().time_steps_per_day",
"rand_num = random.random()\nq = rand_num * self.CDF_RES\ni = math.floor(q)\nq -= float(i)\nti = self.mean * (q * self.icdf_array[i + 1] + (1.0 -... | <|body_start_0|>
self.mean = mean
self.icdf_array = np.asarray(icdf_array)
self.CDF_RES = len(icdf_array) - 1
self.time_steps_per_day = pe.Parameters.instance().time_steps_per_day
<|end_body_0|>
<|body_start_1|>
rand_num = random.random()
q = rand_num * self.CDF_RES
... | Class of inverse cumulative distribution functions (icdf) and their associated methods, in a style similar to CovidSim. | InverseCdf | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InverseCdf:
"""Class of inverse cumulative distribution functions (icdf) and their associated methods, in a style similar to CovidSim."""
def __init__(self, mean, icdf_array):
"""Constructor Method Parameters ---------- mean : float Mean of the icdf icdf_array : np.ndarray Array of q... | stack_v2_sparse_classes_10k_train_002402 | 2,643 | permissive | [
{
"docstring": "Constructor Method Parameters ---------- mean : float Mean of the icdf icdf_array : np.ndarray Array of quantiles of the icdf_array, values in array must be evenly spaced with the final value being as close to one as possible",
"name": "__init__",
"signature": "def __init__(self, mean, i... | 3 | stack_v2_sparse_classes_30k_train_006586 | Implement the Python class `InverseCdf` described below.
Class description:
Class of inverse cumulative distribution functions (icdf) and their associated methods, in a style similar to CovidSim.
Method signatures and docstrings:
- def __init__(self, mean, icdf_array): Constructor Method Parameters ---------- mean : ... | Implement the Python class `InverseCdf` described below.
Class description:
Class of inverse cumulative distribution functions (icdf) and their associated methods, in a style similar to CovidSim.
Method signatures and docstrings:
- def __init__(self, mean, icdf_array): Constructor Method Parameters ---------- mean : ... | c11de122c6bfdf9103162e4045758808da5df322 | <|skeleton|>
class InverseCdf:
"""Class of inverse cumulative distribution functions (icdf) and their associated methods, in a style similar to CovidSim."""
def __init__(self, mean, icdf_array):
"""Constructor Method Parameters ---------- mean : float Mean of the icdf icdf_array : np.ndarray Array of q... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class InverseCdf:
"""Class of inverse cumulative distribution functions (icdf) and their associated methods, in a style similar to CovidSim."""
def __init__(self, mean, icdf_array):
"""Constructor Method Parameters ---------- mean : float Mean of the icdf icdf_array : np.ndarray Array of quantiles of t... | the_stack_v2_python_sparse | pyEpiabm/pyEpiabm/utility/inverse_cdf.py | SABS-R3-Epidemiology/epiabm | train | 21 |
bffb5b2ec43fe0dda7a7121250061023acb31905 | [
"probs = torch.sigmoid(logits)\nnumer = 2 * (probs * labels).sum(dim=1) + smooth\ndenor = (probs.pow(p) + labels.pow(p)).sum(dim=1) + smooth\nloss = 1.0 - numer / denor\nctx.vars = (probs, labels, numer, denor, p, smooth)\nreturn loss",
"probs, labels, numer, denor, p, smooth = ctx.vars\nnumer, denor = (numer.vie... | <|body_start_0|>
probs = torch.sigmoid(logits)
numer = 2 * (probs * labels).sum(dim=1) + smooth
denor = (probs.pow(p) + labels.pow(p)).sum(dim=1) + smooth
loss = 1.0 - numer / denor
ctx.vars = (probs, labels, numer, denor, p, smooth)
return loss
<|end_body_0|>
<|body_sta... | compute backward directly for better numeric stability | SoftDiceLossV2Func | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SoftDiceLossV2Func:
"""compute backward directly for better numeric stability"""
def forward(ctx, logits, labels, p, smooth):
"""inputs: logits: (N, L) labels: (N, L) outpus: loss: (N,)"""
<|body_0|>
def backward(ctx, grad_output):
"""compute gradient of soft-dic... | stack_v2_sparse_classes_10k_train_002403 | 7,172 | permissive | [
{
"docstring": "inputs: logits: (N, L) labels: (N, L) outpus: loss: (N,)",
"name": "forward",
"signature": "def forward(ctx, logits, labels, p, smooth)"
},
{
"docstring": "compute gradient of soft-dice loss",
"name": "backward",
"signature": "def backward(ctx, grad_output)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000512 | Implement the Python class `SoftDiceLossV2Func` described below.
Class description:
compute backward directly for better numeric stability
Method signatures and docstrings:
- def forward(ctx, logits, labels, p, smooth): inputs: logits: (N, L) labels: (N, L) outpus: loss: (N,)
- def backward(ctx, grad_output): compute... | Implement the Python class `SoftDiceLossV2Func` described below.
Class description:
compute backward directly for better numeric stability
Method signatures and docstrings:
- def forward(ctx, logits, labels, p, smooth): inputs: logits: (N, L) labels: (N, L) outpus: loss: (N,)
- def backward(ctx, grad_output): compute... | 99e04f64fb2ce46c2e6906750a716b93984fbe97 | <|skeleton|>
class SoftDiceLossV2Func:
"""compute backward directly for better numeric stability"""
def forward(ctx, logits, labels, p, smooth):
"""inputs: logits: (N, L) labels: (N, L) outpus: loss: (N,)"""
<|body_0|>
def backward(ctx, grad_output):
"""compute gradient of soft-dic... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SoftDiceLossV2Func:
"""compute backward directly for better numeric stability"""
def forward(ctx, logits, labels, p, smooth):
"""inputs: logits: (N, L) labels: (N, L) outpus: loss: (N,)"""
probs = torch.sigmoid(logits)
numer = 2 * (probs * labels).sum(dim=1) + smooth
denor... | the_stack_v2_python_sparse | soft_dice_loss.py | CoinCheung/pytorch-loss | train | 2,079 |
c40b0c63acda4376adc692aefdcf5468ef603442 | [
"progress_bar = ProgressBar(spinnman_constants.MAX_TAG_ID, 'Clearing tags')\nfor tag_id in range(spinnman_constants.MAX_TAG_ID):\n transceiver.clear_ip_tag(tag_id)\n progress_bar.update()\nprogress_bar.end()\nprogress_bar = None\nif tags is not None:\n progress_bar = ProgressBar(len(list(tags.ip_tags)) + l... | <|body_start_0|>
progress_bar = ProgressBar(spinnman_constants.MAX_TAG_ID, 'Clearing tags')
for tag_id in range(spinnman_constants.MAX_TAG_ID):
transceiver.clear_ip_tag(tag_id)
progress_bar.update()
progress_bar.end()
progress_bar = None
if tags is not Non... | Loads tags onto the machine | FrontEndCommonTagsLoader | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FrontEndCommonTagsLoader:
"""Loads tags onto the machine"""
def __call__(self, transceiver, tags=None, iptags=None, reverse_iptags=None):
""":param tags: the tags object which contains ip and reverse ip tags. could be none if these are being given in separate lists :param iptags: a l... | stack_v2_sparse_classes_10k_train_002404 | 2,725 | permissive | [
{
"docstring": ":param tags: the tags object which contains ip and reverse ip tags. could be none if these are being given in separate lists :param iptags: a list of iptags, given when tags is none :param reverse_iptags: a list of reverse iptags when tags is none. :param transceiver: the transceiver object :ret... | 3 | stack_v2_sparse_classes_30k_train_006683 | Implement the Python class `FrontEndCommonTagsLoader` described below.
Class description:
Loads tags onto the machine
Method signatures and docstrings:
- def __call__(self, transceiver, tags=None, iptags=None, reverse_iptags=None): :param tags: the tags object which contains ip and reverse ip tags. could be none if t... | Implement the Python class `FrontEndCommonTagsLoader` described below.
Class description:
Loads tags onto the machine
Method signatures and docstrings:
- def __call__(self, transceiver, tags=None, iptags=None, reverse_iptags=None): :param tags: the tags object which contains ip and reverse ip tags. could be none if t... | 04fa1eaf78778edea3ba3afa4c527d20c491718e | <|skeleton|>
class FrontEndCommonTagsLoader:
"""Loads tags onto the machine"""
def __call__(self, transceiver, tags=None, iptags=None, reverse_iptags=None):
""":param tags: the tags object which contains ip and reverse ip tags. could be none if these are being given in separate lists :param iptags: a l... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FrontEndCommonTagsLoader:
"""Loads tags onto the machine"""
def __call__(self, transceiver, tags=None, iptags=None, reverse_iptags=None):
""":param tags: the tags object which contains ip and reverse ip tags. could be none if these are being given in separate lists :param iptags: a list of iptags... | the_stack_v2_python_sparse | src/spinnaker_ros_lsm/venv/lib/python2.7/site-packages/spinn_front_end_common/interface/interface_functions/front_end_common_tags_loader.py | Roboy/LSM_SpiNNaker_MyoArm | train | 2 |
740ec3a924d08100f6fc19da9bbd53f0cc1391d4 | [
"self.error = 0\nself.errorPrevious = 0\nself.eP = 0\nself.eI = 0\nself.eD = 0\nself.kP = kp\nself.kI = ki\nself.kD = kd\nself.u = 0",
"self.errorPrevious = self.error\nif abs(error) < 90:\n self.error = error\nelse:\n pass\nself.eP = self.error\nself.eD = self.error - self.errorPrevious\nself.eI = self.eI ... | <|body_start_0|>
self.error = 0
self.errorPrevious = 0
self.eP = 0
self.eI = 0
self.eD = 0
self.kP = kp
self.kI = ki
self.kD = kd
self.u = 0
<|end_body_0|>
<|body_start_1|>
self.errorPrevious = self.error
if abs(error) < 90:
... | PIDController | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PIDController:
def __init__(self, kp, ki, kd):
"""Initialize the PID controller. :param kp: (float) Proportional gain :param ki: (float) Integral gain :param kd: (float) Differential gain"""
<|body_0|>
def update(self, error, dt=None):
"""Update the PID controller wi... | stack_v2_sparse_classes_10k_train_002405 | 1,428 | no_license | [
{
"docstring": "Initialize the PID controller. :param kp: (float) Proportional gain :param ki: (float) Integral gain :param kd: (float) Differential gain",
"name": "__init__",
"signature": "def __init__(self, kp, ki, kd)"
},
{
"docstring": "Update the PID controller with new error values. :param... | 2 | stack_v2_sparse_classes_30k_train_002645 | Implement the Python class `PIDController` described below.
Class description:
Implement the PIDController class.
Method signatures and docstrings:
- def __init__(self, kp, ki, kd): Initialize the PID controller. :param kp: (float) Proportional gain :param ki: (float) Integral gain :param kd: (float) Differential gai... | Implement the Python class `PIDController` described below.
Class description:
Implement the PIDController class.
Method signatures and docstrings:
- def __init__(self, kp, ki, kd): Initialize the PID controller. :param kp: (float) Proportional gain :param ki: (float) Integral gain :param kd: (float) Differential gai... | e6c9686c440486831ce5ea246ab05af5b4f6ea01 | <|skeleton|>
class PIDController:
def __init__(self, kp, ki, kd):
"""Initialize the PID controller. :param kp: (float) Proportional gain :param ki: (float) Integral gain :param kd: (float) Differential gain"""
<|body_0|>
def update(self, error, dt=None):
"""Update the PID controller wi... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PIDController:
def __init__(self, kp, ki, kd):
"""Initialize the PID controller. :param kp: (float) Proportional gain :param ki: (float) Integral gain :param kd: (float) Differential gain"""
self.error = 0
self.errorPrevious = 0
self.eP = 0
self.eI = 0
self.eD =... | the_stack_v2_python_sparse | Controllers/PIDController.py | augustusellis/balance_bot | train | 1 | |
687341131ab5ad62d11898a65a9c9362f4160ad3 | [
"if not isfile(local_file_name):\n with DLProgress(unit='B', unit_scale=True, miniters=1, desc=local_file_name + 'Dataset') as pbar:\n urlretrieve(url, local_file_name, pbar.hook)\nelse:\n logger.info('Resusing the file: {}'.format(local_file_name))\nreturn local_file_name",
"extracted_folder_name = ... | <|body_start_0|>
if not isfile(local_file_name):
with DLProgress(unit='B', unit_scale=True, miniters=1, desc=local_file_name + 'Dataset') as pbar:
urlretrieve(url, local_file_name, pbar.hook)
else:
logger.info('Resusing the file: {}'.format(local_file_name))
... | Class to download data sets form the web. | Downloader | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Downloader:
"""Class to download data sets form the web."""
def get(url: str, local_file_name: str):
""":param url: URL of the file to be downloaded :param local_file_name: File path where to be locally to be stored :return:"""
<|body_0|>
def extract_tar(file_name: str, ... | stack_v2_sparse_classes_10k_train_002406 | 1,702 | no_license | [
{
"docstring": ":param url: URL of the file to be downloaded :param local_file_name: File path where to be locally to be stored :return:",
"name": "get",
"signature": "def get(url: str, local_file_name: str)"
},
{
"docstring": "Extracts the file contents :param file_name: Tar file path :return:"... | 2 | stack_v2_sparse_classes_30k_train_006478 | Implement the Python class `Downloader` described below.
Class description:
Class to download data sets form the web.
Method signatures and docstrings:
- def get(url: str, local_file_name: str): :param url: URL of the file to be downloaded :param local_file_name: File path where to be locally to be stored :return:
- ... | Implement the Python class `Downloader` described below.
Class description:
Class to download data sets form the web.
Method signatures and docstrings:
- def get(url: str, local_file_name: str): :param url: URL of the file to be downloaded :param local_file_name: File path where to be locally to be stored :return:
- ... | 37927094c279e5c8a95d845c379fcebb409cfdff | <|skeleton|>
class Downloader:
"""Class to download data sets form the web."""
def get(url: str, local_file_name: str):
""":param url: URL of the file to be downloaded :param local_file_name: File path where to be locally to be stored :return:"""
<|body_0|>
def extract_tar(file_name: str, ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Downloader:
"""Class to download data sets form the web."""
def get(url: str, local_file_name: str):
""":param url: URL of the file to be downloaded :param local_file_name: File path where to be locally to be stored :return:"""
if not isfile(local_file_name):
with DLProgress(u... | the_stack_v2_python_sparse | dhira/data/download/downloader.py | Mageswaran1989/dhira | train | 4 |
ec378a4eafebcc67cd3f41015e660edb3dfb0c18 | [
"super(DataQualityOperator, self).__init__(*args, **kwargs)\nself.conn_id = conn_id\nself.table = table\nself.pkey = pkey\nself.params = {'pkey': S.Identifier(self.pkey), 'table': S.Identifier(self.table)}\nself.qf_rowcount = S.SQL(DataQualityOperator.q_rowcount).format(**self.params)\nself.qf_pkeycount = S.SQL(Dat... | <|body_start_0|>
super(DataQualityOperator, self).__init__(*args, **kwargs)
self.conn_id = conn_id
self.table = table
self.pkey = pkey
self.params = {'pkey': S.Identifier(self.pkey), 'table': S.Identifier(self.table)}
self.qf_rowcount = S.SQL(DataQualityOperator.q_rowcoun... | Data Quality Checks: 1. Check the target table has a positive number of rows 2. Check the target table has no duplicate primary key Properties: - q_rowcount: query used to count the number of rows - q_pkeycount: query used to count the number of rows per primary key - qf_ stands for a template query q_ formatted with a... | DataQualityOperator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataQualityOperator:
"""Data Quality Checks: 1. Check the target table has a positive number of rows 2. Check the target table has no duplicate primary key Properties: - q_rowcount: query used to count the number of rows - q_pkeycount: query used to count the number of rows per primary key - qf_ ... | stack_v2_sparse_classes_10k_train_002407 | 2,790 | no_license | [
{
"docstring": "Args: conn_id (str): in Airflow Connection Database, name of Redshift connection pkey (str): Name of primary key of table table (str): Name of table *args: **kwargs:",
"name": "__init__",
"signature": "def __init__(self, conn_id='', pkey='', table='', *args, **kwargs)"
},
{
"docs... | 2 | stack_v2_sparse_classes_30k_train_005328 | Implement the Python class `DataQualityOperator` described below.
Class description:
Data Quality Checks: 1. Check the target table has a positive number of rows 2. Check the target table has no duplicate primary key Properties: - q_rowcount: query used to count the number of rows - q_pkeycount: query used to count th... | Implement the Python class `DataQualityOperator` described below.
Class description:
Data Quality Checks: 1. Check the target table has a positive number of rows 2. Check the target table has no duplicate primary key Properties: - q_rowcount: query used to count the number of rows - q_pkeycount: query used to count th... | ec7f881b6e11d7e3294176128290fdd1ad684fc0 | <|skeleton|>
class DataQualityOperator:
"""Data Quality Checks: 1. Check the target table has a positive number of rows 2. Check the target table has no duplicate primary key Properties: - q_rowcount: query used to count the number of rows - q_pkeycount: query used to count the number of rows per primary key - qf_ ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DataQualityOperator:
"""Data Quality Checks: 1. Check the target table has a positive number of rows 2. Check the target table has no duplicate primary key Properties: - q_rowcount: query used to count the number of rows - q_pkeycount: query used to count the number of rows per primary key - qf_ stands for a ... | the_stack_v2_python_sparse | p5_pipeline_airflow/airflowcode/plugins/operators/data_quality.py | ogierpaul/Udacity-Data-Engineer-NanoDegree | train | 1 |
bea53f239bec18e6712a642e62da2a2be538149a | [
"if self.sprite:\n self.sprite._focus_exit()\npygame.sprite.GroupSingle.add(self, *sprites)\nself.sprite._focus_enter(focus)",
"if self.sprite:\n self.sprite._focus_exit()\npygame.sprite.GroupSingle.empty(self)"
] | <|body_start_0|>
if self.sprite:
self.sprite._focus_exit()
pygame.sprite.GroupSingle.add(self, *sprites)
self.sprite._focus_enter(focus)
<|end_body_0|>
<|body_start_1|>
if self.sprite:
self.sprite._focus_exit()
pygame.sprite.GroupSingle.empty(self)
<|end_... | Contains currently focused widget. | Focus | [
"MIT",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Focus:
"""Contains currently focused widget."""
def add(self, focus=0, *sprites):
"""Extend add to call _focus_exit and _focus_enter methods."""
<|body_0|>
def empty(self):
"""Extend empty to call _focus_exit method."""
<|body_1|>
<|end_skeleton|>
<|bod... | stack_v2_sparse_classes_10k_train_002408 | 13,593 | permissive | [
{
"docstring": "Extend add to call _focus_exit and _focus_enter methods.",
"name": "add",
"signature": "def add(self, focus=0, *sprites)"
},
{
"docstring": "Extend empty to call _focus_exit method.",
"name": "empty",
"signature": "def empty(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003153 | Implement the Python class `Focus` described below.
Class description:
Contains currently focused widget.
Method signatures and docstrings:
- def add(self, focus=0, *sprites): Extend add to call _focus_exit and _focus_enter methods.
- def empty(self): Extend empty to call _focus_exit method. | Implement the Python class `Focus` described below.
Class description:
Contains currently focused widget.
Method signatures and docstrings:
- def add(self, focus=0, *sprites): Extend add to call _focus_exit and _focus_enter methods.
- def empty(self): Extend empty to call _focus_exit method.
<|skeleton|>
class Focus... | 95cb53b664f312e0830f010c0c96be94d4a4db90 | <|skeleton|>
class Focus:
"""Contains currently focused widget."""
def add(self, focus=0, *sprites):
"""Extend add to call _focus_exit and _focus_enter methods."""
<|body_0|>
def empty(self):
"""Extend empty to call _focus_exit method."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Focus:
"""Contains currently focused widget."""
def add(self, focus=0, *sprites):
"""Extend add to call _focus_exit and _focus_enter methods."""
if self.sprite:
self.sprite._focus_exit()
pygame.sprite.GroupSingle.add(self, *sprites)
self.sprite._focus_enter(foc... | the_stack_v2_python_sparse | pygame/GUI- widgets-SGC/sgc3/widgets/_locals.py | furas/python-examples | train | 176 |
d7574f28e4db453db0a88019d12ef1d5568176c6 | [
"super(ModelSelector, self).__init__(None, neg_sample_generator)\nself.models = models\nself.lookup = lookup",
"model_batches = dict()\nfor model_name, _ in list(self.models.items()):\n model_batches[model_name] = dict()\n mask = [self.lookup[elem] == model_name for elem in pra.tolist()]\n model_batches[... | <|body_start_0|>
super(ModelSelector, self).__init__(None, neg_sample_generator)
self.models = models
self.lookup = lookup
<|end_body_0|>
<|body_start_1|>
model_batches = dict()
for model_name, _ in list(self.models.items()):
model_batches[model_name] = dict()
... | Emsemble model with choose model by given relation with performance of model | ModelSelector | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModelSelector:
"""Emsemble model with choose model by given relation with performance of model"""
def __init__(self, models, neg_sample_generator, lookup):
"""init model selector with list of models and lookup :param models: list of models :param lookup: A dict with (relation id, bes... | stack_v2_sparse_classes_10k_train_002409 | 5,944 | permissive | [
{
"docstring": "init model selector with list of models and lookup :param models: list of models :param lookup: A dict with (relation id, best_performed_model)",
"name": "__init__",
"signature": "def __init__(self, models, neg_sample_generator, lookup)"
},
{
"docstring": "Splits batchs per relat... | 4 | stack_v2_sparse_classes_30k_train_001993 | Implement the Python class `ModelSelector` described below.
Class description:
Emsemble model with choose model by given relation with performance of model
Method signatures and docstrings:
- def __init__(self, models, neg_sample_generator, lookup): init model selector with list of models and lookup :param models: li... | Implement the Python class `ModelSelector` described below.
Class description:
Emsemble model with choose model by given relation with performance of model
Method signatures and docstrings:
- def __init__(self, models, neg_sample_generator, lookup): init model selector with list of models and lookup :param models: li... | 0bf63bf210f506e287f8492e716bb3394137d74b | <|skeleton|>
class ModelSelector:
"""Emsemble model with choose model by given relation with performance of model"""
def __init__(self, models, neg_sample_generator, lookup):
"""init model selector with list of models and lookup :param models: list of models :param lookup: A dict with (relation id, bes... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ModelSelector:
"""Emsemble model with choose model by given relation with performance of model"""
def __init__(self, models, neg_sample_generator, lookup):
"""init model selector with list of models and lookup :param models: list of models :param lookup: A dict with (relation id, best_performed_m... | the_stack_v2_python_sparse | src/models/ensemble/model_selector.py | wang-yuhao/Practical-Big-Data-Science-ADL-AI | train | 0 |
b7965422ed2e90ebb81b5d5af35798dac106e409 | [
"import collections\ndicts_row = collections.defaultdict(set)\nfor point in points:\n dicts_row[point[0]].add(point[1])\nl = len(points)\nmin_val = float('inf')\nfor i in range(l - 1):\n for j in range(i + 1, l):\n if points[i][0] != points[j][0] and points[i][1] != points[j][1]:\n if points... | <|body_start_0|>
import collections
dicts_row = collections.defaultdict(set)
for point in points:
dicts_row[point[0]].add(point[1])
l = len(points)
min_val = float('inf')
for i in range(l - 1):
for j in range(i + 1, l):
if points[i]... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minAreaRect(self, points):
""":type points: List[List[int]] :rtype: int 2028 ms"""
<|body_0|>
def minAreaRect_1(self, points):
"""112ms :param points: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
import collections
... | stack_v2_sparse_classes_10k_train_002410 | 2,528 | no_license | [
{
"docstring": ":type points: List[List[int]] :rtype: int 2028 ms",
"name": "minAreaRect",
"signature": "def minAreaRect(self, points)"
},
{
"docstring": "112ms :param points: :return:",
"name": "minAreaRect_1",
"signature": "def minAreaRect_1(self, points)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001659 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minAreaRect(self, points): :type points: List[List[int]] :rtype: int 2028 ms
- def minAreaRect_1(self, points): 112ms :param points: :return: | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minAreaRect(self, points): :type points: List[List[int]] :rtype: int 2028 ms
- def minAreaRect_1(self, points): 112ms :param points: :return:
<|skeleton|>
class Solution:
... | 679a2b246b8b6bb7fc55ed1c8096d3047d6d4461 | <|skeleton|>
class Solution:
def minAreaRect(self, points):
""":type points: List[List[int]] :rtype: int 2028 ms"""
<|body_0|>
def minAreaRect_1(self, points):
"""112ms :param points: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def minAreaRect(self, points):
""":type points: List[List[int]] :rtype: int 2028 ms"""
import collections
dicts_row = collections.defaultdict(set)
for point in points:
dicts_row[point[0]].add(point[1])
l = len(points)
min_val = float('inf')... | the_stack_v2_python_sparse | MinimumAreaRectangle_MID_939.py | 953250587/leetcode-python | train | 2 | |
dfbc6ec5d62f7a63d52bd6c329ba0a6f4a015049 | [
"row, col = (len(dungeon), len(dungeon[0]))\ndp = [[0] * col for _ in range(row)]\ndp[row - 1][col - 1] = 1\nfor i in range(row - 2, -1, -1):\n dp[i][col - 1] = max(1, dp[i + 1][col - 1] - dungeon[i + 1][col - 1])\nfor j in range(col - 2, -1, -1):\n dp[row - 1][j] = max(1, dp[row - 1][j + 1] - dungeon[row - 1... | <|body_start_0|>
row, col = (len(dungeon), len(dungeon[0]))
dp = [[0] * col for _ in range(row)]
dp[row - 1][col - 1] = 1
for i in range(row - 2, -1, -1):
dp[i][col - 1] = max(1, dp[i + 1][col - 1] - dungeon[i + 1][col - 1])
for j in range(col - 2, -1, -1):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def calculateMinimumHP(self, dungeon):
""":type dungeon: List[List[int]] :rtype: int"""
<|body_0|>
def online_On(self, dungeon):
""":type dungeon: List[List[int]] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
row, col = (len(... | stack_v2_sparse_classes_10k_train_002411 | 1,499 | no_license | [
{
"docstring": ":type dungeon: List[List[int]] :rtype: int",
"name": "calculateMinimumHP",
"signature": "def calculateMinimumHP(self, dungeon)"
},
{
"docstring": ":type dungeon: List[List[int]] :rtype: int",
"name": "online_On",
"signature": "def online_On(self, dungeon)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def calculateMinimumHP(self, dungeon): :type dungeon: List[List[int]] :rtype: int
- def online_On(self, dungeon): :type dungeon: List[List[int]] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def calculateMinimumHP(self, dungeon): :type dungeon: List[List[int]] :rtype: int
- def online_On(self, dungeon): :type dungeon: List[List[int]] :rtype: int
<|skeleton|>
class S... | 11c8fc663888b48b5417256aab1bf872190267ba | <|skeleton|>
class Solution:
def calculateMinimumHP(self, dungeon):
""":type dungeon: List[List[int]] :rtype: int"""
<|body_0|>
def online_On(self, dungeon):
""":type dungeon: List[List[int]] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def calculateMinimumHP(self, dungeon):
""":type dungeon: List[List[int]] :rtype: int"""
row, col = (len(dungeon), len(dungeon[0]))
dp = [[0] * col for _ in range(row)]
dp[row - 1][col - 1] = 1
for i in range(row - 2, -1, -1):
dp[i][col - 1] = max(1... | the_stack_v2_python_sparse | Dungeon Game.py | lfdyf20/Leetcode | train | 1 | |
46d107c6f69a2034c9e4829373205d80ba3843b9 | [
"self.policy_store = PolicyStore()\nself.service_store = {}\nfrom ranger_performance_tool import perf_globals\nenabled_services = perf_globals.CONFIG_READER.get_config_value('secondary', 'enabled_services')\nservice_type_mapping = perf_globals.CONFIG_READER.get_config_value('secondary', 'service_type_mapping')\nfor... | <|body_start_0|>
self.policy_store = PolicyStore()
self.service_store = {}
from ranger_performance_tool import perf_globals
enabled_services = perf_globals.CONFIG_READER.get_config_value('secondary', 'enabled_services')
service_type_mapping = perf_globals.CONFIG_READER.get_config... | Primary class to connect object stores to the Ranger API Attributes ---------- service_store : dict Mapping of service type to service store objects. Add new service names here if required or unsupported. policy_store: PolicyStore object to create objects associated with policy api's. Methods ------- get_service_type_f... | RangerAPIObjectStore | [
"Apache-2.0",
"BSD-3-Clause",
"WTFPL",
"MIT",
"GPL-2.0-only"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RangerAPIObjectStore:
"""Primary class to connect object stores to the Ranger API Attributes ---------- service_store : dict Mapping of service type to service store objects. Add new service names here if required or unsupported. policy_store: PolicyStore object to create objects associated with ... | stack_v2_sparse_classes_10k_train_002412 | 10,846 | permissive | [
{
"docstring": "Constructor Modify if new object stores are added",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Returns the service type for the given service name :parameter service_name: Service name for the service type to be returned :return: Service type for the... | 5 | stack_v2_sparse_classes_30k_train_006402 | Implement the Python class `RangerAPIObjectStore` described below.
Class description:
Primary class to connect object stores to the Ranger API Attributes ---------- service_store : dict Mapping of service type to service store objects. Add new service names here if required or unsupported. policy_store: PolicyStore ob... | Implement the Python class `RangerAPIObjectStore` described below.
Class description:
Primary class to connect object stores to the Ranger API Attributes ---------- service_store : dict Mapping of service type to service store objects. Add new service names here if required or unsupported. policy_store: PolicyStore ob... | 8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6 | <|skeleton|>
class RangerAPIObjectStore:
"""Primary class to connect object stores to the Ranger API Attributes ---------- service_store : dict Mapping of service type to service store objects. Add new service names here if required or unsupported. policy_store: PolicyStore object to create objects associated with ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RangerAPIObjectStore:
"""Primary class to connect object stores to the Ranger API Attributes ---------- service_store : dict Mapping of service type to service store objects. Add new service names here if required or unsupported. policy_store: PolicyStore object to create objects associated with policy api's.... | the_stack_v2_python_sparse | govern/data-security/ranger/ranger-tools/src/main/python/ranger_performance_tool/ranger_perf_object_stores/base_object_stores.py | alldatacenter/alldata | train | 774 |
f2236117e4e9c1f865190bc568386c39a03b83b4 | [
"if not root:\n return ''\nstack = [root]\nans = []\nwhile stack:\n node = stack.pop()\n ans.append(str(node.val))\n if node.right:\n stack.append(node.right)\n if node.left:\n stack.append(node.left)\nreturn ','.join(ans)",
"if not data:\n return None\ndata = data.split(',')\nroot... | <|body_start_0|>
if not root:
return ''
stack = [root]
ans = []
while stack:
node = stack.pop()
ans.append(str(node.val))
if node.right:
stack.append(node.right)
if node.left:
stack.append(node.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_002413 | 1,684 | 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:... | 5e09a5d36ac55d782628a888ad57d48e234b61ac | <|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 ''
stack = [root]
ans = []
while stack:
node = stack.pop()
ans.append(str(node.val))
if node.r... | the_stack_v2_python_sparse | 449/449.py | sjzyjc/leetcode | train | 0 | |
e20cc79a39f64264daf119aa31d195a2aa7528df | [
"self.minheap = []\nself.size = k\nfor i in nums:\n self.add(i)",
"if len(self.minheap) < self.size:\n heapq.heappush(self.minheap, val)\nelif self.minheap[0] < val:\n heapq.heappop(self.minheap)\n heapq.heappush(self.minheap, val)\nreturn self.minheap[0]"
] | <|body_start_0|>
self.minheap = []
self.size = k
for i in nums:
self.add(i)
<|end_body_0|>
<|body_start_1|>
if len(self.minheap) < self.size:
heapq.heappush(self.minheap, val)
elif self.minheap[0] < val:
heapq.heappop(self.minheap)
... | KthLargest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
<|body_0|>
def add(self, val):
""":type val: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.minheap = []
self.size = k
for i in n... | stack_v2_sparse_classes_10k_train_002414 | 722 | no_license | [
{
"docstring": ":type k: int :type nums: List[int]",
"name": "__init__",
"signature": "def __init__(self, k, nums)"
},
{
"docstring": ":type val: int :rtype: int",
"name": "add",
"signature": "def add(self, val)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005878 | Implement the Python class `KthLargest` described below.
Class description:
Implement the KthLargest class.
Method signatures and docstrings:
- def __init__(self, k, nums): :type k: int :type nums: List[int]
- def add(self, val): :type val: int :rtype: int | Implement the Python class `KthLargest` described below.
Class description:
Implement the KthLargest class.
Method signatures and docstrings:
- def __init__(self, k, nums): :type k: int :type nums: List[int]
- def add(self, val): :type val: int :rtype: int
<|skeleton|>
class KthLargest:
def __init__(self, k, nu... | 89316f5260996d4cacba0d42182026387add1ef9 | <|skeleton|>
class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
<|body_0|>
def add(self, val):
""":type val: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
self.minheap = []
self.size = k
for i in nums:
self.add(i)
def add(self, val):
""":type val: int :rtype: int"""
if len(self.minheap) < self.size:
heapq... | the_stack_v2_python_sparse | leetcode/KthlargestwithMinHeap.py | changlongG/Algorithms | train | 0 | |
3a267466c38741b0fb948488479f434f9cbdb947 | [
"super().__init__()\nself.fm = FMLayer(dropout_p)\nself.use_bias = use_bias\nif use_bias:\n self.bias = nn.Parameter(torch.zeros((1, 1), names=('B', 'O')))\n nn.init.uniform_(self.bias.data)",
"feat_inputs.names = ('B', 'N', 'E')\nfm_first = feat_inputs.sum(dim='N').rename(E='O')\nfm_second = self.fm(emb_in... | <|body_start_0|>
super().__init__()
self.fm = FMLayer(dropout_p)
self.use_bias = use_bias
if use_bias:
self.bias = nn.Parameter(torch.zeros((1, 1), names=('B', 'O')))
nn.init.uniform_(self.bias.data)
<|end_body_0|>
<|body_start_1|>
feat_inputs.names = ('B... | Model class of Factorization Machine (FM). Factorization Machine is a model to calculate interactions between fields in the following way: :math:`\\^{y}(x) := b_{0} + \\sum_{i=1}^{n} w_{i} x_{i} + \\sum_{i=1}^{n} \\sum_{j=1+1}^{n} <v_{i},v_{j}> x_{i} x_{j}` :Reference: #. `Steffen Rendle, 2010. Factorization Machine <h... | FactorizationMachineModel | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FactorizationMachineModel:
"""Model class of Factorization Machine (FM). Factorization Machine is a model to calculate interactions between fields in the following way: :math:`\\^{y}(x) := b_{0} + \\sum_{i=1}^{n} w_{i} x_{i} + \\sum_{i=1}^{n} \\sum_{j=1+1}^{n} <v_{i},v_{j}> x_{i} x_{j}` :Referenc... | stack_v2_sparse_classes_10k_train_002415 | 2,532 | permissive | [
{
"docstring": "Initialize FactorizationMachineModel Args: use_bias (bool, optional): whether the bias constant is added to the input. Defaults to True dropout_p (float, optional): probability of Dropout in FM. Defaults to None",
"name": "__init__",
"signature": "def __init__(self, use_bias: bool=True, ... | 2 | stack_v2_sparse_classes_30k_train_004746 | Implement the Python class `FactorizationMachineModel` described below.
Class description:
Model class of Factorization Machine (FM). Factorization Machine is a model to calculate interactions between fields in the following way: :math:`\\^{y}(x) := b_{0} + \\sum_{i=1}^{n} w_{i} x_{i} + \\sum_{i=1}^{n} \\sum_{j=1+1}^{... | Implement the Python class `FactorizationMachineModel` described below.
Class description:
Model class of Factorization Machine (FM). Factorization Machine is a model to calculate interactions between fields in the following way: :math:`\\^{y}(x) := b_{0} + \\sum_{i=1}^{n} w_{i} x_{i} + \\sum_{i=1}^{n} \\sum_{j=1+1}^{... | 751a43b9cd35e951d81c0d9cf46507b1777bb7ff | <|skeleton|>
class FactorizationMachineModel:
"""Model class of Factorization Machine (FM). Factorization Machine is a model to calculate interactions between fields in the following way: :math:`\\^{y}(x) := b_{0} + \\sum_{i=1}^{n} w_{i} x_{i} + \\sum_{i=1}^{n} \\sum_{j=1+1}^{n} <v_{i},v_{j}> x_{i} x_{j}` :Referenc... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FactorizationMachineModel:
"""Model class of Factorization Machine (FM). Factorization Machine is a model to calculate interactions between fields in the following way: :math:`\\^{y}(x) := b_{0} + \\sum_{i=1}^{n} w_{i} x_{i} + \\sum_{i=1}^{n} \\sum_{j=1+1}^{n} <v_{i},v_{j}> x_{i} x_{j}` :Reference: #. `Steffe... | the_stack_v2_python_sparse | torecsys/models/ctr/factorization_machine.py | p768lwy3/torecsys | train | 98 |
2514ba3982c9fb20a5a2034be2f3e7b83ccd3bfa | [
"try:\n if None in read_basic_tiff_header(image_file):\n return False\nexcept Exception:\n return False\nreturn True",
"width, height, depth, header, order = read_basic_tiff_header(image_file)\nheader_bytes = FormatTIFF.open_file(image_file, 'rb').read(header)\nreturn (width, height, depth // 8, orde... | <|body_start_0|>
try:
if None in read_basic_tiff_header(image_file):
return False
except Exception:
return False
return True
<|end_body_0|>
<|body_start_1|>
width, height, depth, header, order = read_basic_tiff_header(image_file)
header_by... | An image reading class for TIFF format images i.e. those from Dectris and Rayonix, which start with a standard TIFF header (which is what is handled here) and have their own custom header following, which must be handled by the inheriting subclasses. | FormatTIFF | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FormatTIFF:
"""An image reading class for TIFF format images i.e. those from Dectris and Rayonix, which start with a standard TIFF header (which is what is handled here) and have their own custom header following, which must be handled by the inheriting subclasses."""
def understand(image_fi... | stack_v2_sparse_classes_10k_train_002416 | 2,341 | permissive | [
{
"docstring": "Check to see if this looks like an TIFF format image, i.e. we can make sense of it.",
"name": "understand",
"signature": "def understand(image_file)"
},
{
"docstring": "Pun to get to the image header etc.",
"name": "get_tiff_header",
"signature": "def get_tiff_header(imag... | 4 | null | Implement the Python class `FormatTIFF` described below.
Class description:
An image reading class for TIFF format images i.e. those from Dectris and Rayonix, which start with a standard TIFF header (which is what is handled here) and have their own custom header following, which must be handled by the inheriting subc... | Implement the Python class `FormatTIFF` described below.
Class description:
An image reading class for TIFF format images i.e. those from Dectris and Rayonix, which start with a standard TIFF header (which is what is handled here) and have their own custom header following, which must be handled by the inheriting subc... | 2fc8ffadbf67d0611e2d7affcf50d0f23abfc16f | <|skeleton|>
class FormatTIFF:
"""An image reading class for TIFF format images i.e. those from Dectris and Rayonix, which start with a standard TIFF header (which is what is handled here) and have their own custom header following, which must be handled by the inheriting subclasses."""
def understand(image_fi... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FormatTIFF:
"""An image reading class for TIFF format images i.e. those from Dectris and Rayonix, which start with a standard TIFF header (which is what is handled here) and have their own custom header following, which must be handled by the inheriting subclasses."""
def understand(image_file):
... | the_stack_v2_python_sparse | src/dxtbx/format/FormatTIFF.py | cctbx/dxtbx | train | 2 |
005f3a262959acbc5d028dbf38c3b7335056a283 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')"
] | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | A set of methods for managing Organization users. | UserServiceServicer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserServiceServicer:
"""A set of methods for managing Organization users."""
def ListMembers(self, request, context):
"""List organization active members."""
<|body_0|>
def DeleteMembership(self, request, context):
"""Delete user membership."""
<|body_1|>... | stack_v2_sparse_classes_10k_train_002417 | 4,946 | permissive | [
{
"docstring": "List organization active members.",
"name": "ListMembers",
"signature": "def ListMembers(self, request, context)"
},
{
"docstring": "Delete user membership.",
"name": "DeleteMembership",
"signature": "def DeleteMembership(self, request, context)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003880 | Implement the Python class `UserServiceServicer` described below.
Class description:
A set of methods for managing Organization users.
Method signatures and docstrings:
- def ListMembers(self, request, context): List organization active members.
- def DeleteMembership(self, request, context): Delete user membership. | Implement the Python class `UserServiceServicer` described below.
Class description:
A set of methods for managing Organization users.
Method signatures and docstrings:
- def ListMembers(self, request, context): List organization active members.
- def DeleteMembership(self, request, context): Delete user membership.
... | b906a014dd893e2697864e1e48e814a8d9fbc48c | <|skeleton|>
class UserServiceServicer:
"""A set of methods for managing Organization users."""
def ListMembers(self, request, context):
"""List organization active members."""
<|body_0|>
def DeleteMembership(self, request, context):
"""Delete user membership."""
<|body_1|>... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class UserServiceServicer:
"""A set of methods for managing Organization users."""
def ListMembers(self, request, context):
"""List organization active members."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplemented... | the_stack_v2_python_sparse | yandex/cloud/organizationmanager/v1/user_service_pb2_grpc.py | yandex-cloud/python-sdk | train | 63 |
483be93f8565deca77f31e4507bc0f156594ca94 | [
"Parametre.__init__(self, 'email', 'email')\nself.tronquer = True\nself.schema = '<etat>'\nself.aide_courte = \"active / désactive l'envoi d'e-mails\"\nself.aide_longue = \"Cette commande permet d'activer ou désactiver l'envoi d'e-mails à ce compte en cas de réception d'un UmdMail. Si cette option est active, un e-... | <|body_start_0|>
Parametre.__init__(self, 'email', 'email')
self.tronquer = True
self.schema = '<etat>'
self.aide_courte = "active / désactive l'envoi d'e-mails"
self.aide_longue = "Cette commande permet d'activer ou désactiver l'envoi d'e-mails à ce compte en cas de réception d'... | Commande 'options email'. | PrmEmail | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PrmEmail:
"""Commande 'options email'."""
def __init__(self):
"""Constructeur du paramètre."""
<|body_0|>
def interpreter(self, personnage, dic_masques):
"""Interprétation du paramètre."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
Parametre._... | stack_v2_sparse_classes_10k_train_002418 | 3,177 | permissive | [
{
"docstring": "Constructeur du paramètre.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Interprétation du paramètre.",
"name": "interpreter",
"signature": "def interpreter(self, personnage, dic_masques)"
}
] | 2 | null | Implement the Python class `PrmEmail` described below.
Class description:
Commande 'options email'.
Method signatures and docstrings:
- def __init__(self): Constructeur du paramètre.
- def interpreter(self, personnage, dic_masques): Interprétation du paramètre. | Implement the Python class `PrmEmail` described below.
Class description:
Commande 'options email'.
Method signatures and docstrings:
- def __init__(self): Constructeur du paramètre.
- def interpreter(self, personnage, dic_masques): Interprétation du paramètre.
<|skeleton|>
class PrmEmail:
"""Commande 'options e... | 7e93bff08cdf891352efba587e89c40f3b4a2301 | <|skeleton|>
class PrmEmail:
"""Commande 'options email'."""
def __init__(self):
"""Constructeur du paramètre."""
<|body_0|>
def interpreter(self, personnage, dic_masques):
"""Interprétation du paramètre."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PrmEmail:
"""Commande 'options email'."""
def __init__(self):
"""Constructeur du paramètre."""
Parametre.__init__(self, 'email', 'email')
self.tronquer = True
self.schema = '<etat>'
self.aide_courte = "active / désactive l'envoi d'e-mails"
self.aide_longue ... | the_stack_v2_python_sparse | src/primaires/joueur/commandes/options/email.py | vincent-lg/tsunami | train | 5 |
dbb70166fcf33487978eae15b874743eff75c724 | [
"self.trade_days = trade_days\nself.trade_strategy = trade_strategy\nself.profit_array = []",
"for index, day in enumerate(self.trade_days):\n if self.trade_strategy.keep_stock_day > 0:\n self.profit_array.append(day.change)\n if hasattr(self.trade_strategy, 'buy_strategy'):\n self.trade_strat... | <|body_start_0|>
self.trade_days = trade_days
self.trade_strategy = trade_strategy
self.profit_array = []
<|end_body_0|>
<|body_start_1|>
for index, day in enumerate(self.trade_days):
if self.trade_strategy.keep_stock_day > 0:
self.profit_array.append(day.cha... | 交易回测系统 | TradeLoopBack | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TradeLoopBack:
"""交易回测系统"""
def __init__(self, trade_days, trade_strategy):
"""使用前面封装的StockTradeDays类和TradeStrategy1类 :param trade_days: :param trade_strategy:"""
<|body_0|>
def execute_trade(self):
"""执行交易回测 :return:"""
<|body_1|>
<|end_skeleton|>
<|bo... | stack_v2_sparse_classes_10k_train_002419 | 1,071 | permissive | [
{
"docstring": "使用前面封装的StockTradeDays类和TradeStrategy1类 :param trade_days: :param trade_strategy:",
"name": "__init__",
"signature": "def __init__(self, trade_days, trade_strategy)"
},
{
"docstring": "执行交易回测 :return:",
"name": "execute_trade",
"signature": "def execute_trade(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005958 | Implement the Python class `TradeLoopBack` described below.
Class description:
交易回测系统
Method signatures and docstrings:
- def __init__(self, trade_days, trade_strategy): 使用前面封装的StockTradeDays类和TradeStrategy1类 :param trade_days: :param trade_strategy:
- def execute_trade(self): 执行交易回测 :return: | Implement the Python class `TradeLoopBack` described below.
Class description:
交易回测系统
Method signatures and docstrings:
- def __init__(self, trade_days, trade_strategy): 使用前面封装的StockTradeDays类和TradeStrategy1类 :param trade_days: :param trade_strategy:
- def execute_trade(self): 执行交易回测 :return:
<|skeleton|>
class Trad... | 32b9b21acdf7746081ff8cb39193afacafdb8fdf | <|skeleton|>
class TradeLoopBack:
"""交易回测系统"""
def __init__(self, trade_days, trade_strategy):
"""使用前面封装的StockTradeDays类和TradeStrategy1类 :param trade_days: :param trade_strategy:"""
<|body_0|>
def execute_trade(self):
"""执行交易回测 :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TradeLoopBack:
"""交易回测系统"""
def __init__(self, trade_days, trade_strategy):
"""使用前面封装的StockTradeDays类和TradeStrategy1类 :param trade_days: :param trade_strategy:"""
self.trade_days = trade_days
self.trade_strategy = trade_strategy
self.profit_array = []
def execute_trad... | the_stack_v2_python_sparse | trade1/trade_loop_back.py | Expert68/Expert_quant | train | 2 |
5b158450fde38f3a7b4542d4803c934a4fb7076f | [
"use_ssl = url.scheme == 'https'\nport = url.port or (443 if use_ssl else 80)\nreturn {'host': url.hostname, 'port': port, 'path_prefix': url.path, 'scheme': url.scheme}",
"opts = super()._get_options_from_host_urls(urls)\nbasic_auth = (urls[0].username, urls[0].password)\nif any(((url.username, url.password) != ... | <|body_start_0|>
use_ssl = url.scheme == 'https'
port = url.port or (443 if use_ssl else 80)
return {'host': url.hostname, 'port': port, 'path_prefix': url.path, 'scheme': url.scheme}
<|end_body_0|>
<|body_start_1|>
opts = super()._get_options_from_host_urls(urls)
basic_auth = (... | Elasticsearch8SearchBackend | [
"BSD-3-Clause",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Elasticsearch8SearchBackend:
def _get_host_config_from_url(self, url):
"""Given a parsed URL, return the host configuration to be added to self.hosts"""
<|body_0|>
def _get_options_from_host_urls(self, urls):
"""Given a list of parsed URLs, return a dict of additiona... | stack_v2_sparse_classes_10k_train_002420 | 2,690 | permissive | [
{
"docstring": "Given a parsed URL, return the host configuration to be added to self.hosts",
"name": "_get_host_config_from_url",
"signature": "def _get_host_config_from_url(self, url)"
},
{
"docstring": "Given a list of parsed URLs, return a dict of additional options to be passed into the Ela... | 2 | null | Implement the Python class `Elasticsearch8SearchBackend` described below.
Class description:
Implement the Elasticsearch8SearchBackend class.
Method signatures and docstrings:
- def _get_host_config_from_url(self, url): Given a parsed URL, return the host configuration to be added to self.hosts
- def _get_options_fro... | Implement the Python class `Elasticsearch8SearchBackend` described below.
Class description:
Implement the Elasticsearch8SearchBackend class.
Method signatures and docstrings:
- def _get_host_config_from_url(self, url): Given a parsed URL, return the host configuration to be added to self.hosts
- def _get_options_fro... | 06a7bc6124bf62675c09fbe0a4ed9bbac183e025 | <|skeleton|>
class Elasticsearch8SearchBackend:
def _get_host_config_from_url(self, url):
"""Given a parsed URL, return the host configuration to be added to self.hosts"""
<|body_0|>
def _get_options_from_host_urls(self, urls):
"""Given a list of parsed URLs, return a dict of additiona... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Elasticsearch8SearchBackend:
def _get_host_config_from_url(self, url):
"""Given a parsed URL, return the host configuration to be added to self.hosts"""
use_ssl = url.scheme == 'https'
port = url.port or (443 if use_ssl else 80)
return {'host': url.hostname, 'port': port, 'path... | the_stack_v2_python_sparse | wagtail/search/backends/elasticsearch8.py | wagtail/wagtail | train | 12,974 | |
483694a4fa3d2c44aa8260a9ef5f5787027ff8c6 | [
"from OpenGLContext import tests\nfrom OpenGLContext.tests.resources import test_vrml_set_txt\nbase = os.path.join(os.path.dirname(tests.__file__), 'wrls', '*.wrl')\npaths = glob.glob(base)\nfileMenu = glutCreateMenu(self.OnMenuLoad)\nfor path in paths:\n self.worldPaths.append(path)\n index = len(self.worldP... | <|body_start_0|>
from OpenGLContext import tests
from OpenGLContext.tests.resources import test_vrml_set_txt
base = os.path.join(os.path.dirname(tests.__file__), 'wrls', '*.wrl')
paths = glob.glob(base)
fileMenu = glutCreateMenu(self.OnMenuLoad)
for path in paths:
... | GLUT-specific VRML97-aware Testing Context | VRMLContext | [
"LicenseRef-scancode-warranty-disclaimer",
"GPL-1.0-or-later",
"LicenseRef-scancode-other-copyleft",
"LGPL-2.1-or-later",
"GPL-3.0-only",
"LGPL-2.0-or-later",
"GPL-3.0-or-later",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VRMLContext:
"""GLUT-specific VRML97-aware Testing Context"""
def createMenus(self):
"""Create pop-up menus for the VRML97 context"""
<|body_0|>
def OnMenuLoad(self, item):
"""React to a menu-load event"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_10k_train_002421 | 1,838 | permissive | [
{
"docstring": "Create pop-up menus for the VRML97 context",
"name": "createMenus",
"signature": "def createMenus(self)"
},
{
"docstring": "React to a menu-load event",
"name": "OnMenuLoad",
"signature": "def OnMenuLoad(self, item)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004512 | Implement the Python class `VRMLContext` described below.
Class description:
GLUT-specific VRML97-aware Testing Context
Method signatures and docstrings:
- def createMenus(self): Create pop-up menus for the VRML97 context
- def OnMenuLoad(self, item): React to a menu-load event | Implement the Python class `VRMLContext` described below.
Class description:
GLUT-specific VRML97-aware Testing Context
Method signatures and docstrings:
- def createMenus(self): Create pop-up menus for the VRML97 context
- def OnMenuLoad(self, item): React to a menu-load event
<|skeleton|>
class VRMLContext:
""... | 7f600ad153270feff12aa7aa86d7ed0a49ebc71c | <|skeleton|>
class VRMLContext:
"""GLUT-specific VRML97-aware Testing Context"""
def createMenus(self):
"""Create pop-up menus for the VRML97 context"""
<|body_0|>
def OnMenuLoad(self, item):
"""React to a menu-load event"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class VRMLContext:
"""GLUT-specific VRML97-aware Testing Context"""
def createMenus(self):
"""Create pop-up menus for the VRML97 context"""
from OpenGLContext import tests
from OpenGLContext.tests.resources import test_vrml_set_txt
base = os.path.join(os.path.dirname(tests.__fil... | the_stack_v2_python_sparse | pythonAnimations/pyOpenGLChess/engineDirectory/oglc-env/lib/python2.7/site-packages/OpenGLContext/glutvrmltestingcontext.py | alexus37/AugmentedRealityChess | train | 1 |
685f08f09ed26799f048614ecdbb26060178504a | [
"logger.debug('Start clean data in ResetPasswordForm.')\nemail = self.cleaned_data.get('email')\nself.validator_all(email)\nlogger.debug('Exit clean data in ResetPasswordForm.')\nreturn super(AddPatientForm, self).clean(*args, **kwargs)",
"logger.debug('Start validations in AddPatientForm.')\nvalidator = PatientV... | <|body_start_0|>
logger.debug('Start clean data in ResetPasswordForm.')
email = self.cleaned_data.get('email')
self.validator_all(email)
logger.debug('Exit clean data in ResetPasswordForm.')
return super(AddPatientForm, self).clean(*args, **kwargs)
<|end_body_0|>
<|body_start_1|... | Form to reset password User | AddPatientForm | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AddPatientForm:
"""Form to reset password User"""
def clean(self, *args, **kwargs):
"""Get patient fields."""
<|body_0|>
def validator_all(self, email):
"""Checks validator in all fields."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
logger.de... | stack_v2_sparse_classes_10k_train_002422 | 1,268 | permissive | [
{
"docstring": "Get patient fields.",
"name": "clean",
"signature": "def clean(self, *args, **kwargs)"
},
{
"docstring": "Checks validator in all fields.",
"name": "validator_all",
"signature": "def validator_all(self, email)"
}
] | 2 | stack_v2_sparse_classes_30k_test_000202 | Implement the Python class `AddPatientForm` described below.
Class description:
Form to reset password User
Method signatures and docstrings:
- def clean(self, *args, **kwargs): Get patient fields.
- def validator_all(self, email): Checks validator in all fields. | Implement the Python class `AddPatientForm` described below.
Class description:
Form to reset password User
Method signatures and docstrings:
- def clean(self, *args, **kwargs): Get patient fields.
- def validator_all(self, email): Checks validator in all fields.
<|skeleton|>
class AddPatientForm:
"""Form to res... | 5387eb80dfb354e948abe64f7d8bbe087fc4f136 | <|skeleton|>
class AddPatientForm:
"""Form to reset password User"""
def clean(self, *args, **kwargs):
"""Get patient fields."""
<|body_0|>
def validator_all(self, email):
"""Checks validator in all fields."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AddPatientForm:
"""Form to reset password User"""
def clean(self, *args, **kwargs):
"""Get patient fields."""
logger.debug('Start clean data in ResetPasswordForm.')
email = self.cleaned_data.get('email')
self.validator_all(email)
logger.debug('Exit clean data in Re... | the_stack_v2_python_sparse | medical_prescription/user/forms/addpatientform.py | ristovao/2017.2-Receituario-Medico | train | 0 |
218a54e8059e1d513866433510c2d86d07dddc41 | [
"self.parameters = parameters\nself.storage = storage\nself._instance = None\nreturn",
"if self._instance is None:\n self._instance = Reporter(header=self.parameters.header, filename=self.parameters.filename, storage=self.storage, delimiter=self.parameters.delimiter, missing=self.parameters.missing)\nreturn se... | <|body_start_0|>
self.parameters = parameters
self.storage = storage
self._instance = None
return
<|end_body_0|>
<|body_start_1|>
if self._instance is None:
self._instance = Reporter(header=self.parameters.header, filename=self.parameters.filename, storage=self.stora... | A Report builder builds an instance of a Reporter | ReportBuilder | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReportBuilder:
"""A Report builder builds an instance of a Reporter"""
def __init__(self, parameters, storage):
""":param: - `parameters`: parameters needed to build a reporter - `storage`: a file opener"""
<|body_0|>
def instance(self):
""":return: instance of R... | stack_v2_sparse_classes_10k_train_002423 | 990 | permissive | [
{
"docstring": ":param: - `parameters`: parameters needed to build a reporter - `storage`: a file opener",
"name": "__init__",
"signature": "def __init__(self, parameters, storage)"
},
{
"docstring": ":return: instance of Reporter",
"name": "instance",
"signature": "def instance(self)"
... | 2 | null | Implement the Python class `ReportBuilder` described below.
Class description:
A Report builder builds an instance of a Reporter
Method signatures and docstrings:
- def __init__(self, parameters, storage): :param: - `parameters`: parameters needed to build a reporter - `storage`: a file opener
- def instance(self): :... | Implement the Python class `ReportBuilder` described below.
Class description:
A Report builder builds an instance of a Reporter
Method signatures and docstrings:
- def __init__(self, parameters, storage): :param: - `parameters`: parameters needed to build a reporter - `storage`: a file opener
- def instance(self): :... | b4d1c77e1d611fe2b30768b42bdc7493afb0ea95 | <|skeleton|>
class ReportBuilder:
"""A Report builder builds an instance of a Reporter"""
def __init__(self, parameters, storage):
""":param: - `parameters`: parameters needed to build a reporter - `storage`: a file opener"""
<|body_0|>
def instance(self):
""":return: instance of R... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ReportBuilder:
"""A Report builder builds an instance of a Reporter"""
def __init__(self, parameters, storage):
""":param: - `parameters`: parameters needed to build a reporter - `storage`: a file opener"""
self.parameters = parameters
self.storage = storage
self._instance... | the_stack_v2_python_sparse | apetools/builders/subbuilders/reportbuilder.py | russell-n/oldape | train | 0 |
1464e1d9a6998cf4778e568d0df48bdbe1670d3a | [
"super(GeM, self).__init__()\nself.power = power\nself.eps = 1e-06",
"if axis is None:\n axis = [1, 2]\nreturn gem(x, power=self.power, eps=self.eps, axis=axis)"
] | <|body_start_0|>
super(GeM, self).__init__()
self.power = power
self.eps = 1e-06
<|end_body_0|>
<|body_start_1|>
if axis is None:
axis = [1, 2]
return gem(x, power=self.power, eps=self.eps, axis=axis)
<|end_body_1|>
| Generalized mean pooling (GeM) layer. Generalized Mean Pooling (GeM) computes the generalized mean of each channel in a tensor. See https://arxiv.org/abs/1711.02512 for a reference. | GeM | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GeM:
"""Generalized mean pooling (GeM) layer. Generalized Mean Pooling (GeM) computes the generalized mean of each channel in a tensor. See https://arxiv.org/abs/1711.02512 for a reference."""
def __init__(self, power=3.0):
"""Initialization of the generalized mean pooling (GeM) laye... | stack_v2_sparse_classes_10k_train_002424 | 6,125 | permissive | [
{
"docstring": "Initialization of the generalized mean pooling (GeM) layer. Args: power: Float power > 0 is an inverse exponent parameter, used during the generalized mean pooling computation. Setting this exponent as power > 1 increases the contrast of the pooled feature map and focuses on the salient features... | 2 | null | Implement the Python class `GeM` described below.
Class description:
Generalized mean pooling (GeM) layer. Generalized Mean Pooling (GeM) computes the generalized mean of each channel in a tensor. See https://arxiv.org/abs/1711.02512 for a reference.
Method signatures and docstrings:
- def __init__(self, power=3.0): ... | Implement the Python class `GeM` described below.
Class description:
Generalized mean pooling (GeM) layer. Generalized Mean Pooling (GeM) computes the generalized mean of each channel in a tensor. See https://arxiv.org/abs/1711.02512 for a reference.
Method signatures and docstrings:
- def __init__(self, power=3.0): ... | d3507b550a3ade40cade60a79eb5b8978b56c7ae | <|skeleton|>
class GeM:
"""Generalized mean pooling (GeM) layer. Generalized Mean Pooling (GeM) computes the generalized mean of each channel in a tensor. See https://arxiv.org/abs/1711.02512 for a reference."""
def __init__(self, power=3.0):
"""Initialization of the generalized mean pooling (GeM) laye... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GeM:
"""Generalized mean pooling (GeM) layer. Generalized Mean Pooling (GeM) computes the generalized mean of each channel in a tensor. See https://arxiv.org/abs/1711.02512 for a reference."""
def __init__(self, power=3.0):
"""Initialization of the generalized mean pooling (GeM) layer. Args: powe... | the_stack_v2_python_sparse | research/delf/delf/python/pooling_layers/pooling.py | jianzhnie/models | train | 2 |
19397c86fc47d3b7898c6c19774b885bbc921971 | [
"self.surface = surface\nself.pos = pos\nself.direction = direction\nself.size = size\nself.color = color\nself.gravity = pygame.Vector2(0, 9.81 / FPS)\nself.drag = pygame.Vector2(1.0, 0.999)",
"right = self.surface.get_width() - self.size\nleft = self.size\ntop = self.size\nbottom = self.surface.get_height() - s... | <|body_start_0|>
self.surface = surface
self.pos = pos
self.direction = direction
self.size = size
self.color = color
self.gravity = pygame.Vector2(0, 9.81 / FPS)
self.drag = pygame.Vector2(1.0, 0.999)
<|end_body_0|>
<|body_start_1|>
right = self.surface.... | Paticle in 2D space | Particle | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Particle:
"""Paticle in 2D space"""
def __init__(self, surface: pygame.Surface, pos: pygame.Vector2, direction: pygame.Vector2, size: int, color: tuple):
"""a particle in 2D space :param surface: surface to draw on :param pos: position to set particle, center of particle :param size:... | stack_v2_sparse_classes_10k_train_002425 | 5,061 | no_license | [
{
"docstring": "a particle in 2D space :param surface: surface to draw on :param pos: position to set particle, center of particle :param size: size of particle :param color: color of particle :param direction: initial direction of particle in m/s aka pixel/frame :param gravity: gravity vector 9.81 m/s aka 9.81... | 4 | stack_v2_sparse_classes_30k_val_000045 | Implement the Python class `Particle` described below.
Class description:
Paticle in 2D space
Method signatures and docstrings:
- def __init__(self, surface: pygame.Surface, pos: pygame.Vector2, direction: pygame.Vector2, size: int, color: tuple): a particle in 2D space :param surface: surface to draw on :param pos: ... | Implement the Python class `Particle` described below.
Class description:
Paticle in 2D space
Method signatures and docstrings:
- def __init__(self, surface: pygame.Surface, pos: pygame.Vector2, direction: pygame.Vector2, size: int, color: tuple): a particle in 2D space :param surface: surface to draw on :param pos: ... | 1fd421195a2888c0588a49f5a043a1110eedcdbf | <|skeleton|>
class Particle:
"""Paticle in 2D space"""
def __init__(self, surface: pygame.Surface, pos: pygame.Vector2, direction: pygame.Vector2, size: int, color: tuple):
"""a particle in 2D space :param surface: surface to draw on :param pos: position to set particle, center of particle :param size:... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Particle:
"""Paticle in 2D space"""
def __init__(self, surface: pygame.Surface, pos: pygame.Vector2, direction: pygame.Vector2, size: int, color: tuple):
"""a particle in 2D space :param surface: surface to draw on :param pos: position to set particle, center of particle :param size: size of part... | the_stack_v2_python_sparse | effects/Particle.py | gunny26/pygame | train | 5 |
8e254edc3fe9fe441d9316ae640f7cdc342ba064 | [
"if isinstance(tags, str):\n return tags.split(',')\nreturn list(tags)",
"obj = super().dict(**kwargs)\nif 'tags' in obj:\n obj['tags'] = ','.join(obj['tags'])\nreturn obj"
] | <|body_start_0|>
if isinstance(tags, str):
return tags.split(',')
return list(tags)
<|end_body_0|>
<|body_start_1|>
obj = super().dict(**kwargs)
if 'tags' in obj:
obj['tags'] = ','.join(obj['tags'])
return obj
<|end_body_1|>
| Define a base class for elements and relationships. Attributes: id (str): tags (set of str): properties (dict): perspectives (set of Perspective): | ModelItemIO | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModelItemIO:
"""Define a base class for elements and relationships. Attributes: id (str): tags (set of str): properties (dict): perspectives (set of Perspective):"""
def split_tags(cls, tags: Union[str, Iterable[str]]) -> List[str]:
"""Convert comma-separated tag list into list if ne... | stack_v2_sparse_classes_10k_train_002426 | 3,127 | permissive | [
{
"docstring": "Convert comma-separated tag list into list if needed.",
"name": "split_tags",
"signature": "def split_tags(cls, tags: Union[str, Iterable[str]]) -> List[str]"
},
{
"docstring": "Map this IO into a dictionary suitable for serialisation.",
"name": "dict",
"signature": "def ... | 2 | stack_v2_sparse_classes_30k_train_000766 | Implement the Python class `ModelItemIO` described below.
Class description:
Define a base class for elements and relationships. Attributes: id (str): tags (set of str): properties (dict): perspectives (set of Perspective):
Method signatures and docstrings:
- def split_tags(cls, tags: Union[str, Iterable[str]]) -> Li... | Implement the Python class `ModelItemIO` described below.
Class description:
Define a base class for elements and relationships. Attributes: id (str): tags (set of str): properties (dict): perspectives (set of Perspective):
Method signatures and docstrings:
- def split_tags(cls, tags: Union[str, Iterable[str]]) -> Li... | 31f1dcadb3ff113d8a77ce132657237ea01c307b | <|skeleton|>
class ModelItemIO:
"""Define a base class for elements and relationships. Attributes: id (str): tags (set of str): properties (dict): perspectives (set of Perspective):"""
def split_tags(cls, tags: Union[str, Iterable[str]]) -> List[str]:
"""Convert comma-separated tag list into list if ne... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ModelItemIO:
"""Define a base class for elements and relationships. Attributes: id (str): tags (set of str): properties (dict): perspectives (set of Perspective):"""
def split_tags(cls, tags: Union[str, Iterable[str]]) -> List[str]:
"""Convert comma-separated tag list into list if needed."""
... | the_stack_v2_python_sparse | src/structurizr/model/model_item.py | Midnighter/structurizr-python | train | 61 |
4cf1078293df8c7eed6b10e3e2a8f707ab9c9710 | [
"self.folder_id = folder_id\nself.folder_key = folder_key\nself.is_entire_folder_required = is_entire_folder_required\nself.item_id_vec = item_id_vec",
"if dictionary is None:\n return None\nfolder_id = dictionary.get('folderId')\nfolder_key = dictionary.get('folderKey')\nis_entire_folder_required = dictionary... | <|body_start_0|>
self.folder_id = folder_id
self.folder_key = folder_key
self.is_entire_folder_required = is_entire_folder_required
self.item_id_vec = item_id_vec
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
folder_id = dictionary.get('f... | Implementation of the 'RestoreOutlookParams_Folder' model. This will be set in case of partial mailbox recovery. Attributes: folder_id (string): The Unique ID of the folder. folder_key (long|int): The Unique key of the folder. is_entire_folder_required (bool): Specify if the entire folder is to be restored. item_id_vec... | RestoreOutlookParams_Folder | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RestoreOutlookParams_Folder:
"""Implementation of the 'RestoreOutlookParams_Folder' model. This will be set in case of partial mailbox recovery. Attributes: folder_id (string): The Unique ID of the folder. folder_key (long|int): The Unique key of the folder. is_entire_folder_required (bool): Spec... | stack_v2_sparse_classes_10k_train_002427 | 2,357 | permissive | [
{
"docstring": "Constructor for the RestoreOutlookParams_Folder class",
"name": "__init__",
"signature": "def __init__(self, folder_id=None, folder_key=None, is_entire_folder_required=None, item_id_vec=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary... | 2 | stack_v2_sparse_classes_30k_train_006003 | Implement the Python class `RestoreOutlookParams_Folder` described below.
Class description:
Implementation of the 'RestoreOutlookParams_Folder' model. This will be set in case of partial mailbox recovery. Attributes: folder_id (string): The Unique ID of the folder. folder_key (long|int): The Unique key of the folder.... | Implement the Python class `RestoreOutlookParams_Folder` described below.
Class description:
Implementation of the 'RestoreOutlookParams_Folder' model. This will be set in case of partial mailbox recovery. Attributes: folder_id (string): The Unique ID of the folder. folder_key (long|int): The Unique key of the folder.... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class RestoreOutlookParams_Folder:
"""Implementation of the 'RestoreOutlookParams_Folder' model. This will be set in case of partial mailbox recovery. Attributes: folder_id (string): The Unique ID of the folder. folder_key (long|int): The Unique key of the folder. is_entire_folder_required (bool): Spec... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RestoreOutlookParams_Folder:
"""Implementation of the 'RestoreOutlookParams_Folder' model. This will be set in case of partial mailbox recovery. Attributes: folder_id (string): The Unique ID of the folder. folder_key (long|int): The Unique key of the folder. is_entire_folder_required (bool): Specify if the en... | the_stack_v2_python_sparse | cohesity_management_sdk/models/restore_outlook_params_folder.py | cohesity/management-sdk-python | train | 24 |
09255e18225097649c1c6cb6800f9d04e0940eb5 | [
"super().__init__(CallbackOrder.External)\nself.trial = trial\nself.loader_key = loader_key\nself.metric_key = metric_key\nself.minimize = minimize\nself.is_better = MetricHandler(minimize=minimize, min_delta=min_delta)\nself.best_score = None",
"score = runner.epoch_metrics[self.loader_key][self.metric_key]\nif ... | <|body_start_0|>
super().__init__(CallbackOrder.External)
self.trial = trial
self.loader_key = loader_key
self.metric_key = metric_key
self.minimize = minimize
self.is_better = MetricHandler(minimize=minimize, min_delta=min_delta)
self.best_score = None
<|end_body... | Optuna callback for pruning unpromising runs. This callback can be used for early stopping (pruning) unpromising runs. Args: trial: Optuna.Trial for the experiment. loader_key: loader key for best model selection (based on metric score over the dataset) metric_key: metric key for best model selection (based on metric s... | OptunaPruningCallback | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OptunaPruningCallback:
"""Optuna callback for pruning unpromising runs. This callback can be used for early stopping (pruning) unpromising runs. Args: trial: Optuna.Trial for the experiment. loader_key: loader key for best model selection (based on metric score over the dataset) metric_key: metri... | stack_v2_sparse_classes_10k_train_002428 | 3,003 | permissive | [
{
"docstring": "Init.",
"name": "__init__",
"signature": "def __init__(self, trial: 'optuna.Trial', loader_key: str, metric_key: str, minimize: bool, min_delta: float=1e-06)"
},
{
"docstring": "Considering prune or not to prune current run at the end of the epoch. Args: runner: runner for curren... | 2 | stack_v2_sparse_classes_30k_train_006551 | Implement the Python class `OptunaPruningCallback` described below.
Class description:
Optuna callback for pruning unpromising runs. This callback can be used for early stopping (pruning) unpromising runs. Args: trial: Optuna.Trial for the experiment. loader_key: loader key for best model selection (based on metric sc... | Implement the Python class `OptunaPruningCallback` described below.
Class description:
Optuna callback for pruning unpromising runs. This callback can be used for early stopping (pruning) unpromising runs. Args: trial: Optuna.Trial for the experiment. loader_key: loader key for best model selection (based on metric sc... | e99f90655d0efcf22559a46e928f0f98c9807ebf | <|skeleton|>
class OptunaPruningCallback:
"""Optuna callback for pruning unpromising runs. This callback can be used for early stopping (pruning) unpromising runs. Args: trial: Optuna.Trial for the experiment. loader_key: loader key for best model selection (based on metric score over the dataset) metric_key: metri... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class OptunaPruningCallback:
"""Optuna callback for pruning unpromising runs. This callback can be used for early stopping (pruning) unpromising runs. Args: trial: Optuna.Trial for the experiment. loader_key: loader key for best model selection (based on metric score over the dataset) metric_key: metric key for bes... | the_stack_v2_python_sparse | catalyst/callbacks/optuna.py | catalyst-team/catalyst | train | 3,038 |
3a296923732c90228989255ec5da214cf5a396e2 | [
"self._attacker = attacker\nself._defender = defender\nsuper().__init__(attacker, defender, enemy=enemy)",
"super().update(ticks)\nself._scrolling_background.scroll(dx=-1)\nif self.is_dead():\n self._scrolling_background = FRAMES.reload(self._move_file_name[:-4] + '_background.png', (0, 0))\n return\nbackgr... | <|body_start_0|>
self._attacker = attacker
self._defender = defender
super().__init__(attacker, defender, enemy=enemy)
<|end_body_0|>
<|body_start_1|>
super().update(ticks)
self._scrolling_background.scroll(dx=-1)
if self.is_dead():
self._scrolling_background... | ScrollingMove | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ScrollingMove:
def __init__(self, attacker, defender, enemy=False):
"""This class, which extends MoveBase, is the basis for all moves that have a scrolling background. One can see an example of this in moves like Thunder. This class controls the scrolling of the background."""
<|... | stack_v2_sparse_classes_10k_train_002429 | 1,761 | no_license | [
{
"docstring": "This class, which extends MoveBase, is the basis for all moves that have a scrolling background. One can see an example of this in moves like Thunder. This class controls the scrolling of the background.",
"name": "__init__",
"signature": "def __init__(self, attacker, defender, enemy=Fal... | 2 | stack_v2_sparse_classes_30k_train_001842 | Implement the Python class `ScrollingMove` described below.
Class description:
Implement the ScrollingMove class.
Method signatures and docstrings:
- def __init__(self, attacker, defender, enemy=False): This class, which extends MoveBase, is the basis for all moves that have a scrolling background. One can see an exa... | Implement the Python class `ScrollingMove` described below.
Class description:
Implement the ScrollingMove class.
Method signatures and docstrings:
- def __init__(self, attacker, defender, enemy=False): This class, which extends MoveBase, is the basis for all moves that have a scrolling background. One can see an exa... | 6718fdb6555d87f0b7b331c10d64a604431f8e81 | <|skeleton|>
class ScrollingMove:
def __init__(self, attacker, defender, enemy=False):
"""This class, which extends MoveBase, is the basis for all moves that have a scrolling background. One can see an example of this in moves like Thunder. This class controls the scrolling of the background."""
<|... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ScrollingMove:
def __init__(self, attacker, defender, enemy=False):
"""This class, which extends MoveBase, is the basis for all moves that have a scrolling background. One can see an example of this in moves like Thunder. This class controls the scrolling of the background."""
self._attacker =... | the_stack_v2_python_sparse | pokered/modules/animations/moves/scrolling_move.py | surranc20/pokered | train | 44 | |
06fd9e8576d04e83186079f5b18937b6f6a4c8b0 | [
"is_fit_call = isinstance(node.func, ast.Attribute) and node.func.attr == 'fit'\nif is_fit_call:\n for kw in node.keywords:\n if kw.arg == 'run_tensorboard_locally':\n return True\nreturn False",
"for kw in node.keywords:\n if kw.arg == 'run_tensorboard_locally':\n node.keywords.rem... | <|body_start_0|>
is_fit_call = isinstance(node.func, ast.Attribute) and node.func.attr == 'fit'
if is_fit_call:
for kw in node.keywords:
if kw.arg == 'run_tensorboard_locally':
return True
return False
<|end_body_0|>
<|body_start_1|>
for k... | A class for removing the ``run_tensorboard_locally`` parameter from ``fit()``. | TensorBoardParameterRemover | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TensorBoardParameterRemover:
"""A class for removing the ``run_tensorboard_locally`` parameter from ``fit()``."""
def node_should_be_modified(self, node):
"""Checks ``ast.Call`` node and returns boolean. If the ``ast.Call`` node invokes a function named "fit" and contains a keyword a... | stack_v2_sparse_classes_10k_train_002430 | 8,776 | permissive | [
{
"docstring": "Checks ``ast.Call`` node and returns boolean. If the ``ast.Call`` node invokes a function named \"fit\" and contains a keyword argument named \"run_tensorboard_locally\" returns boolean. Args: node (ast.Call): a node that represents a function call. For more, see https://docs.python.org/3/librar... | 2 | null | Implement the Python class `TensorBoardParameterRemover` described below.
Class description:
A class for removing the ``run_tensorboard_locally`` parameter from ``fit()``.
Method signatures and docstrings:
- def node_should_be_modified(self, node): Checks ``ast.Call`` node and returns boolean. If the ``ast.Call`` nod... | Implement the Python class `TensorBoardParameterRemover` described below.
Class description:
A class for removing the ``run_tensorboard_locally`` parameter from ``fit()``.
Method signatures and docstrings:
- def node_should_be_modified(self, node): Checks ``ast.Call`` node and returns boolean. If the ``ast.Call`` nod... | 8d5d7fd8ae1a917ed3e2b988d5e533bce244fd85 | <|skeleton|>
class TensorBoardParameterRemover:
"""A class for removing the ``run_tensorboard_locally`` parameter from ``fit()``."""
def node_should_be_modified(self, node):
"""Checks ``ast.Call`` node and returns boolean. If the ``ast.Call`` node invokes a function named "fit" and contains a keyword a... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TensorBoardParameterRemover:
"""A class for removing the ``run_tensorboard_locally`` parameter from ``fit()``."""
def node_should_be_modified(self, node):
"""Checks ``ast.Call`` node and returns boolean. If the ``ast.Call`` node invokes a function named "fit" and contains a keyword argument named... | the_stack_v2_python_sparse | src/sagemaker/cli/compatibility/v2/modifiers/tf_legacy_mode.py | aws/sagemaker-python-sdk | train | 2,050 |
3ac7ff60666c3ac3478b1f1ab24da1f07554c38f | [
"if args['only_dermographic']:\n patient_schema = PatientSchema(many=False, exclude=PatientModel.relationship_keys)\nelse:\n patient_schema = PatientSchema(many=False)\npatient = PatientModel.query.filter_by(id=args['patient_uuid']).first()\nreturn (patient_schema.dump(patient), 200)",
"patient_schema = Pat... | <|body_start_0|>
if args['only_dermographic']:
patient_schema = PatientSchema(many=False, exclude=PatientModel.relationship_keys)
else:
patient_schema = PatientSchema(many=False)
patient = PatientModel.query.filter_by(id=args['patient_uuid']).first()
return (patie... | PatientResource | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PatientResource:
def get(self, args, **kwargs):
"""Get patient with the UUID"""
<|body_0|>
def patch(self, patient_uuid):
"""Modify patient with the UUID"""
<|body_1|>
def delete(self, patient_uuid):
"""Delete patient with the UUID"""
<|b... | stack_v2_sparse_classes_10k_train_002431 | 5,115 | no_license | [
{
"docstring": "Get patient with the UUID",
"name": "get",
"signature": "def get(self, args, **kwargs)"
},
{
"docstring": "Modify patient with the UUID",
"name": "patch",
"signature": "def patch(self, patient_uuid)"
},
{
"docstring": "Delete patient with the UUID",
"name": "d... | 3 | stack_v2_sparse_classes_30k_train_004561 | Implement the Python class `PatientResource` described below.
Class description:
Implement the PatientResource class.
Method signatures and docstrings:
- def get(self, args, **kwargs): Get patient with the UUID
- def patch(self, patient_uuid): Modify patient with the UUID
- def delete(self, patient_uuid): Delete pati... | Implement the Python class `PatientResource` described below.
Class description:
Implement the PatientResource class.
Method signatures and docstrings:
- def get(self, args, **kwargs): Get patient with the UUID
- def patch(self, patient_uuid): Modify patient with the UUID
- def delete(self, patient_uuid): Delete pati... | 49fe5e4740736b2d4b34489065e29bc06cb1c0d2 | <|skeleton|>
class PatientResource:
def get(self, args, **kwargs):
"""Get patient with the UUID"""
<|body_0|>
def patch(self, patient_uuid):
"""Modify patient with the UUID"""
<|body_1|>
def delete(self, patient_uuid):
"""Delete patient with the UUID"""
<|b... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PatientResource:
def get(self, args, **kwargs):
"""Get patient with the UUID"""
if args['only_dermographic']:
patient_schema = PatientSchema(many=False, exclude=PatientModel.relationship_keys)
else:
patient_schema = PatientSchema(many=False)
patient = Pa... | the_stack_v2_python_sparse | hivclinic/namespaces/patient/patient_resource.py | LedoKun/28hiv_clinic_backend | train | 0 | |
a8d17d8474c2cd59bb8f179790019c23345cd4e9 | [
"map_table = {}\nfor i in range(len(s)):\n a = s[i]\n b = t[i]\n if not map_table.keys().__contains__(a):\n if map_table.values().__contains__(b):\n return False\n map_table[a] = b\n elif map_table[a] != b:\n return False\nprint(map_table)\nreturn True",
"m1 = [0] * 256... | <|body_start_0|>
map_table = {}
for i in range(len(s)):
a = s[i]
b = t[i]
if not map_table.keys().__contains__(a):
if map_table.values().__contains__(b):
return False
map_table[a] = b
elif map_table[a] !=... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isIsomorphic1(self, s, t):
""":type s: str :type t: str :rtype: bool"""
<|body_0|>
def isIsomorphic(self, s, t):
""":type s: str :type t: str :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
map_table = {}
for i in ... | stack_v2_sparse_classes_10k_train_002432 | 1,064 | no_license | [
{
"docstring": ":type s: str :type t: str :rtype: bool",
"name": "isIsomorphic1",
"signature": "def isIsomorphic1(self, s, t)"
},
{
"docstring": ":type s: str :type t: str :rtype: bool",
"name": "isIsomorphic",
"signature": "def isIsomorphic(self, s, t)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003227 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isIsomorphic1(self, s, t): :type s: str :type t: str :rtype: bool
- def isIsomorphic(self, s, t): :type s: str :type t: str :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isIsomorphic1(self, s, t): :type s: str :type t: str :rtype: bool
- def isIsomorphic(self, s, t): :type s: str :type t: str :rtype: bool
<|skeleton|>
class Solution:
de... | 70bdd75b6af2e1811c1beab22050c01d28d7373e | <|skeleton|>
class Solution:
def isIsomorphic1(self, s, t):
""":type s: str :type t: str :rtype: bool"""
<|body_0|>
def isIsomorphic(self, s, t):
""":type s: str :type t: str :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def isIsomorphic1(self, s, t):
""":type s: str :type t: str :rtype: bool"""
map_table = {}
for i in range(len(s)):
a = s[i]
b = t[i]
if not map_table.keys().__contains__(a):
if map_table.values().__contains__(b):
... | the_stack_v2_python_sparse | python/leetcode/205_Isomorphic_Strings.py | bobcaoge/my-code | train | 0 | |
a552106afb5cc8a71b66d0adfafd9a184894585c | [
"startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('chuci_yfch_yuwan_zhurh', 'chuci_yfch_yuwan_zhurh')\npipline = [{'$group': {'_id': '$CityName', 'population': {'$max': '$PopulationCount'}}}]\nagg_result = repo['chuci_yfch_yuwan_zhurh.health'].aggregate(... | <|body_start_0|>
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('chuci_yfch_yuwan_zhurh', 'chuci_yfch_yuwan_zhurh')
pipline = [{'$group': {'_id': '$CityName', 'population': {'$max': '$PopulationCount'}}}]
agg_re... | health_uber_output | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class health_uber_output:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing every... | stack_v2_sparse_classes_10k_train_002433 | 5,159 | no_license | [
{
"docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).",
"name": "execute",
"signature": "def execute(trial=False)"
},
{
"docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d... | 2 | stack_v2_sparse_classes_30k_train_004671 | Implement the Python class `health_uber_output` described below.
Class description:
Implement the health_uber_output class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity).
- def provenance(doc=prov.model.ProvDocument(), startTi... | Implement the Python class `health_uber_output` described below.
Class description:
Implement the health_uber_output class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity).
- def provenance(doc=prov.model.ProvDocument(), startTi... | 90284cf3debbac36eead07b8d2339cdd191b86cf | <|skeleton|>
class health_uber_output:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing every... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class health_uber_output:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('chuci_yfch_yuwan_zhurh', 'chuci_... | the_stack_v2_python_sparse | chuci_yfch_yuwan_zhurh/health_uber_output.py | maximega/course-2019-spr-proj | train | 2 | |
af788f1b33b24a6c2c3e80cb974c69b73c94106a | [
"try:\n response, status = (OrgService.get_contacts(org_id), http_status.HTTP_200_OK)\nexcept BusinessException as exception:\n response, status = ({'code': exception.code, 'message': exception.message}, exception.status_code)\nreturn (response, status)",
"request_json = request.get_json()\nvalid_format, er... | <|body_start_0|>
try:
response, status = (OrgService.get_contacts(org_id), http_status.HTTP_200_OK)
except BusinessException as exception:
response, status = ({'code': exception.code, 'message': exception.message}, exception.status_code)
return (response, status)
<|end_bo... | Resource for managing org contacts. | OrgContacts | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OrgContacts:
"""Resource for managing org contacts."""
def get(org_id):
"""Retrieve the set of contacts associated with the specified org."""
<|body_0|>
def post(org_id):
"""Create a new contact for the specified org."""
<|body_1|>
def put(org_id):
... | stack_v2_sparse_classes_10k_train_002434 | 30,185 | permissive | [
{
"docstring": "Retrieve the set of contacts associated with the specified org.",
"name": "get",
"signature": "def get(org_id)"
},
{
"docstring": "Create a new contact for the specified org.",
"name": "post",
"signature": "def post(org_id)"
},
{
"docstring": "Update an existing c... | 4 | null | Implement the Python class `OrgContacts` described below.
Class description:
Resource for managing org contacts.
Method signatures and docstrings:
- def get(org_id): Retrieve the set of contacts associated with the specified org.
- def post(org_id): Create a new contact for the specified org.
- def put(org_id): Updat... | Implement the Python class `OrgContacts` described below.
Class description:
Resource for managing org contacts.
Method signatures and docstrings:
- def get(org_id): Retrieve the set of contacts associated with the specified org.
- def post(org_id): Create a new contact for the specified org.
- def put(org_id): Updat... | 923cb8a3ee88dcbaf0fe800ca70022b3c13c1d01 | <|skeleton|>
class OrgContacts:
"""Resource for managing org contacts."""
def get(org_id):
"""Retrieve the set of contacts associated with the specified org."""
<|body_0|>
def post(org_id):
"""Create a new contact for the specified org."""
<|body_1|>
def put(org_id):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class OrgContacts:
"""Resource for managing org contacts."""
def get(org_id):
"""Retrieve the set of contacts associated with the specified org."""
try:
response, status = (OrgService.get_contacts(org_id), http_status.HTTP_200_OK)
except BusinessException as exception:
... | the_stack_v2_python_sparse | auth-api/src/auth_api/resources/org.py | bcgov/sbc-auth | train | 13 |
f218a16813a9351c677fdbc7a6ebe9d0242e2284 | [
"TextAnswerFormRecord._init_map(self)\nFilesAnswerFormRecord._init_map(self)\nsuper(AnswerTextAndFilesMixin, self)._init_map()",
"TextAnswerFormRecord._init_metadata(self)\nFilesAnswerFormRecord._init_metadata(self)\nsuper(AnswerTextAndFilesMixin, self)._init_metadata()"
] | <|body_start_0|>
TextAnswerFormRecord._init_map(self)
FilesAnswerFormRecord._init_map(self)
super(AnswerTextAndFilesMixin, self)._init_map()
<|end_body_0|>
<|body_start_1|>
TextAnswerFormRecord._init_metadata(self)
FilesAnswerFormRecord._init_metadata(self)
super(AnswerT... | Mixin class to make the two classes compatible with super() for _init_map and _init_metadata | AnswerTextAndFilesMixin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AnswerTextAndFilesMixin:
"""Mixin class to make the two classes compatible with super() for _init_map and _init_metadata"""
def _init_map(self):
"""stub"""
<|body_0|>
def _init_metadata(self):
"""stub"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_10k_train_002435 | 22,562 | permissive | [
{
"docstring": "stub",
"name": "_init_map",
"signature": "def _init_map(self)"
},
{
"docstring": "stub",
"name": "_init_metadata",
"signature": "def _init_metadata(self)"
}
] | 2 | null | Implement the Python class `AnswerTextAndFilesMixin` described below.
Class description:
Mixin class to make the two classes compatible with super() for _init_map and _init_metadata
Method signatures and docstrings:
- def _init_map(self): stub
- def _init_metadata(self): stub | Implement the Python class `AnswerTextAndFilesMixin` described below.
Class description:
Mixin class to make the two classes compatible with super() for _init_map and _init_metadata
Method signatures and docstrings:
- def _init_map(self): stub
- def _init_metadata(self): stub
<|skeleton|>
class AnswerTextAndFilesMix... | 445f968a175d61c8d92c0f617a3c17dc1dc7c584 | <|skeleton|>
class AnswerTextAndFilesMixin:
"""Mixin class to make the two classes compatible with super() for _init_map and _init_metadata"""
def _init_map(self):
"""stub"""
<|body_0|>
def _init_metadata(self):
"""stub"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AnswerTextAndFilesMixin:
"""Mixin class to make the two classes compatible with super() for _init_map and _init_metadata"""
def _init_map(self):
"""stub"""
TextAnswerFormRecord._init_map(self)
FilesAnswerFormRecord._init_map(self)
super(AnswerTextAndFilesMixin, self)._init... | the_stack_v2_python_sparse | dlkit/records/assessment/basic/simple_records.py | mitsei/dlkit | train | 2 |
0ae59b6807a7f2391a191fc31b547a271b893f02 | [
"from onegov.gazette.models.notice import GazetteNotice\nnotices = object_session(self).query(GazetteNotice)\nnotices = notices.filter(GazetteNotice._categories.has_key(self.name))\nreturn notices",
"if self.notices().first():\n return True\nreturn False",
"from onegov.gazette.models.notice import GazetteNot... | <|body_start_0|>
from onegov.gazette.models.notice import GazetteNotice
notices = object_session(self).query(GazetteNotice)
notices = notices.filter(GazetteNotice._categories.has_key(self.name))
return notices
<|end_body_0|>
<|body_start_1|>
if self.notices().first():
... | Defines a category for official notices. Although the categories are defined as an adjacency list, we currently use it only as a simple alphabetically ordered key-value list (name-title). | Category | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Category:
"""Defines a category for official notices. Although the categories are defined as an adjacency list, we currently use it only as a simple alphabetically ordered key-value list (name-title)."""
def notices(self):
"""Returns a query to get all notices related to this categor... | stack_v2_sparse_classes_10k_train_002436 | 1,807 | permissive | [
{
"docstring": "Returns a query to get all notices related to this category.",
"name": "notices",
"signature": "def notices(self)"
},
{
"docstring": "True, if the category is used by any notice.",
"name": "in_use",
"signature": "def in_use(self)"
},
{
"docstring": "Changes the ca... | 3 | null | Implement the Python class `Category` described below.
Class description:
Defines a category for official notices. Although the categories are defined as an adjacency list, we currently use it only as a simple alphabetically ordered key-value list (name-title).
Method signatures and docstrings:
- def notices(self): R... | Implement the Python class `Category` described below.
Class description:
Defines a category for official notices. Although the categories are defined as an adjacency list, we currently use it only as a simple alphabetically ordered key-value list (name-title).
Method signatures and docstrings:
- def notices(self): R... | c706b38d5b67692b4146cdf14ef24d971a32c6b8 | <|skeleton|>
class Category:
"""Defines a category for official notices. Although the categories are defined as an adjacency list, we currently use it only as a simple alphabetically ordered key-value list (name-title)."""
def notices(self):
"""Returns a query to get all notices related to this categor... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Category:
"""Defines a category for official notices. Although the categories are defined as an adjacency list, we currently use it only as a simple alphabetically ordered key-value list (name-title)."""
def notices(self):
"""Returns a query to get all notices related to this category."""
... | the_stack_v2_python_sparse | src/onegov/gazette/models/category.py | OneGov/onegov-cloud | train | 17 |
127b536d18395e0b543d55cd05265cf700cf6b83 | [
"ENFORCER.enforce_call(action='identity:check_grant', build_target=functools.partial(_build_enforcement_target_attr, project_id=project_id, user_id=user_id, role_id=role_id))\nPROVIDERS.assignment_api.get_grant(project_id=project_id, user_id=user_id, role_id=role_id, inherited_to_projects=True)\nreturn (None, http_... | <|body_start_0|>
ENFORCER.enforce_call(action='identity:check_grant', build_target=functools.partial(_build_enforcement_target_attr, project_id=project_id, user_id=user_id, role_id=role_id))
PROVIDERS.assignment_api.get_grant(project_id=project_id, user_id=user_id, role_id=role_id, inherited_to_projects... | OSInheritProjectUserResource | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OSInheritProjectUserResource:
def get(self, project_id, user_id, role_id):
"""Check for an inherited grant for a user on a project. GET/HEAD /OS-INHERIT/projects/{project_id}/users/{user_id} /roles/{role_id}/inherited_to_projects"""
<|body_0|>
def put(self, project_id, user_... | stack_v2_sparse_classes_10k_train_002437 | 19,022 | permissive | [
{
"docstring": "Check for an inherited grant for a user on a project. GET/HEAD /OS-INHERIT/projects/{project_id}/users/{user_id} /roles/{role_id}/inherited_to_projects",
"name": "get",
"signature": "def get(self, project_id, user_id, role_id)"
},
{
"docstring": "Create an inherited grant for a u... | 3 | stack_v2_sparse_classes_30k_train_002935 | Implement the Python class `OSInheritProjectUserResource` described below.
Class description:
Implement the OSInheritProjectUserResource class.
Method signatures and docstrings:
- def get(self, project_id, user_id, role_id): Check for an inherited grant for a user on a project. GET/HEAD /OS-INHERIT/projects/{project_... | Implement the Python class `OSInheritProjectUserResource` described below.
Class description:
Implement the OSInheritProjectUserResource class.
Method signatures and docstrings:
- def get(self, project_id, user_id, role_id): Check for an inherited grant for a user on a project. GET/HEAD /OS-INHERIT/projects/{project_... | 03a0a8146a78682ede9eca12a5a7fdacde2035c8 | <|skeleton|>
class OSInheritProjectUserResource:
def get(self, project_id, user_id, role_id):
"""Check for an inherited grant for a user on a project. GET/HEAD /OS-INHERIT/projects/{project_id}/users/{user_id} /roles/{role_id}/inherited_to_projects"""
<|body_0|>
def put(self, project_id, user_... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class OSInheritProjectUserResource:
def get(self, project_id, user_id, role_id):
"""Check for an inherited grant for a user on a project. GET/HEAD /OS-INHERIT/projects/{project_id}/users/{user_id} /roles/{role_id}/inherited_to_projects"""
ENFORCER.enforce_call(action='identity:check_grant', build_ta... | the_stack_v2_python_sparse | keystone/api/os_inherit.py | sapcc/keystone | train | 0 | |
100bf4227863d859549157f6294da31fa184ab24 | [
"self.parameters = parameters\nself._tree = None\nself._paths = None\nreturn",
"if self._tree is None:\n parameters = self.parameters[:]\n leaves = parameters.pop()\n parameters.reverse()\n tree = [TreeNode(Parameters(leaves.name, leaf)) for leaf in leaves.parameters]\n for level in parameters:\n ... | <|body_start_0|>
self.parameters = parameters
self._tree = None
self._paths = None
return
<|end_body_0|>
<|body_start_1|>
if self._tree is None:
parameters = self.parameters[:]
leaves = parameters.pop()
parameters.reverse()
tree = ... | A class to build a tree from iterative parameters The main product is the `paths` attribute which can be iterated over to get the parameters for a test. | ParameterTree | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ParameterTree:
"""A class to build a tree from iterative parameters The main product is the `paths` attribute which can be iterated over to get the parameters for a test."""
def __init__(self, parameters):
""":param: - `parameters`: list of parameter objects with a `name` property"""... | stack_v2_sparse_classes_10k_train_002438 | 3,506 | permissive | [
{
"docstring": ":param: - `parameters`: list of parameter objects with a `name` property",
"name": "__init__",
"signature": "def __init__(self, parameters)"
},
{
"docstring": "builds the tree bottoms-up from the parameters :return: list of trees (highest nodes are parameters[0], leaves are param... | 4 | stack_v2_sparse_classes_30k_train_004194 | Implement the Python class `ParameterTree` described below.
Class description:
A class to build a tree from iterative parameters The main product is the `paths` attribute which can be iterated over to get the parameters for a test.
Method signatures and docstrings:
- def __init__(self, parameters): :param: - `paramet... | Implement the Python class `ParameterTree` described below.
Class description:
A class to build a tree from iterative parameters The main product is the `paths` attribute which can be iterated over to get the parameters for a test.
Method signatures and docstrings:
- def __init__(self, parameters): :param: - `paramet... | b4d1c77e1d611fe2b30768b42bdc7493afb0ea95 | <|skeleton|>
class ParameterTree:
"""A class to build a tree from iterative parameters The main product is the `paths` attribute which can be iterated over to get the parameters for a test."""
def __init__(self, parameters):
""":param: - `parameters`: list of parameter objects with a `name` property"""... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ParameterTree:
"""A class to build a tree from iterative parameters The main product is the `paths` attribute which can be iterated over to get the parameters for a test."""
def __init__(self, parameters):
""":param: - `parameters`: list of parameter objects with a `name` property"""
self... | the_stack_v2_python_sparse | apetools/lexicographers/parametertree.py | russell-n/oldape | train | 0 |
bbab6ed2284f420c0b1e85218b76b3b8863bd97d | [
"NonlinearProblem.__init__(self)\nself.bcs = bcs\nself.state = state\nu = state['u']\nV = u.function_space()\nv = TestFunction(V)\ndu = TrialFunction(V)\nself.residual = derivative(energy, u, v)\nself.jacobian = derivative(self.residual, u, du)",
"assemble(self.residual, tensor=b)\nfor bc in self.bcs:\n bc.app... | <|body_start_0|>
NonlinearProblem.__init__(self)
self.bcs = bcs
self.state = state
u = state['u']
V = u.function_space()
v = TestFunction(V)
du = TrialFunction(V)
self.residual = derivative(energy, u, v)
self.jacobian = derivative(self.residual, u,... | docstring for ElastcitityProblem | ElasticityProblem | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ElasticityProblem:
"""docstring for ElastcitityProblem"""
def __init__(self, energy, state, bcs):
"""Initialises the elasticity problem. Arguments: * energy * state * boundary conditions"""
<|body_0|>
def F(self, b, x):
"""Compute F at current point x. This funct... | stack_v2_sparse_classes_10k_train_002439 | 13,772 | permissive | [
{
"docstring": "Initialises the elasticity problem. Arguments: * energy * state * boundary conditions",
"name": "__init__",
"signature": "def __init__(self, energy, state, bcs)"
},
{
"docstring": "Compute F at current point x. This function is called at each interation of the solver.",
"name... | 3 | stack_v2_sparse_classes_30k_train_000735 | Implement the Python class `ElasticityProblem` described below.
Class description:
docstring for ElastcitityProblem
Method signatures and docstrings:
- def __init__(self, energy, state, bcs): Initialises the elasticity problem. Arguments: * energy * state * boundary conditions
- def F(self, b, x): Compute F at curren... | Implement the Python class `ElasticityProblem` described below.
Class description:
docstring for ElastcitityProblem
Method signatures and docstrings:
- def __init__(self, energy, state, bcs): Initialises the elasticity problem. Arguments: * energy * state * boundary conditions
- def F(self, b, x): Compute F at curren... | 9a82bf40742a9b16122b7a476ad8aec65fe22539 | <|skeleton|>
class ElasticityProblem:
"""docstring for ElastcitityProblem"""
def __init__(self, energy, state, bcs):
"""Initialises the elasticity problem. Arguments: * energy * state * boundary conditions"""
<|body_0|>
def F(self, b, x):
"""Compute F at current point x. This funct... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ElasticityProblem:
"""docstring for ElastcitityProblem"""
def __init__(self, energy, state, bcs):
"""Initialises the elasticity problem. Arguments: * energy * state * boundary conditions"""
NonlinearProblem.__init__(self)
self.bcs = bcs
self.state = state
u = state... | the_stack_v2_python_sparse | src/solvers.py | kumiori/stability-bifurcation | train | 1 |
c3b043cc61a9c2fda9a9b5ca46b24acb7b0f5c26 | [
"g = resizePSF(psf, data_size)\nself.height = data_size[0]\nself.width = data_size[1]\nself.depth = data_size[2]\nself.shape = data_size\nFTshape = [self.shape[0], self.shape[1], self.shape[2] / 2 + 1]\nself.H = fftw3f.create_aligned_array(FTshape, 'complex64')\nself.Ht = fftw3f.create_aligned_array(FTshape, 'compl... | <|body_start_0|>
g = resizePSF(psf, data_size)
self.height = data_size[0]
self.width = data_size[1]
self.depth = data_size[2]
self.shape = data_size
FTshape = [self.shape[0], self.shape[1], self.shape[2] / 2 + 1]
self.H = fftw3f.create_aligned_array(FTshape, 'comp... | Classical deconvolution with a stationary PSF | dec_wiener | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class dec_wiener:
"""Classical deconvolution with a stationary PSF"""
def psf_calc(self, psf, data_size):
"""Precalculate the OTF etc..."""
<|body_0|>
def deconv(self, data, lamb, clip=False):
"""This is what you actually call to do the deconvolution. parameters are: d... | stack_v2_sparse_classes_10k_train_002440 | 4,741 | no_license | [
{
"docstring": "Precalculate the OTF etc...",
"name": "psf_calc",
"signature": "def psf_calc(self, psf, data_size)"
},
{
"docstring": "This is what you actually call to do the deconvolution. parameters are: data - the raw data lamb - the regularisation parameter",
"name": "deconv",
"sign... | 2 | null | Implement the Python class `dec_wiener` described below.
Class description:
Classical deconvolution with a stationary PSF
Method signatures and docstrings:
- def psf_calc(self, psf, data_size): Precalculate the OTF etc...
- def deconv(self, data, lamb, clip=False): This is what you actually call to do the deconvoluti... | Implement the Python class `dec_wiener` described below.
Class description:
Classical deconvolution with a stationary PSF
Method signatures and docstrings:
- def psf_calc(self, psf, data_size): Precalculate the OTF etc...
- def deconv(self, data, lamb, clip=False): This is what you actually call to do the deconvoluti... | 6596167034c727ad7dad0a741dd59e0e48f6852a | <|skeleton|>
class dec_wiener:
"""Classical deconvolution with a stationary PSF"""
def psf_calc(self, psf, data_size):
"""Precalculate the OTF etc..."""
<|body_0|>
def deconv(self, data, lamb, clip=False):
"""This is what you actually call to do the deconvolution. parameters are: d... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class dec_wiener:
"""Classical deconvolution with a stationary PSF"""
def psf_calc(self, psf, data_size):
"""Precalculate the OTF etc..."""
g = resizePSF(psf, data_size)
self.height = data_size[0]
self.width = data_size[1]
self.depth = data_size[2]
self.shape = d... | the_stack_v2_python_sparse | PYME/Deconv/wiener.py | WilliamRo/CLipPYME | train | 3 |
33dc600db7ce92a78687b57bd2c3f663e13e6f8d | [
"handel_credit = public.CreditInquiry()\ninquiry_credit = handel_credit.save_to_mongoDB()\nif inquiry_credit:\n public.log_record('查询征信响应数据:', sys._getframe().f_lineno, inquiry_credit)\n self.assertEqual(str(inquiry_credit['code']), '0', '查询征信')\nelse:\n public.log_record('查询征信失败响应数据:', sys._getframe().f_l... | <|body_start_0|>
handel_credit = public.CreditInquiry()
inquiry_credit = handel_credit.save_to_mongoDB()
if inquiry_credit:
public.log_record('查询征信响应数据:', sys._getframe().f_lineno, inquiry_credit)
self.assertEqual(str(inquiry_credit['code']), '0', '查询征信')
else:
... | 征信查询 | CreditInquiry | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CreditInquiry:
"""征信查询"""
def test_inquiry_credit(self):
"""查询征信报告"""
<|body_0|>
def test_fetch_credit_result(self):
"""查询征信结果"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
handel_credit = public.CreditInquiry()
inquiry_credit = handel... | stack_v2_sparse_classes_10k_train_002441 | 1,468 | permissive | [
{
"docstring": "查询征信报告",
"name": "test_inquiry_credit",
"signature": "def test_inquiry_credit(self)"
},
{
"docstring": "查询征信结果",
"name": "test_fetch_credit_result",
"signature": "def test_fetch_credit_result(self)"
}
] | 2 | null | Implement the Python class `CreditInquiry` described below.
Class description:
征信查询
Method signatures and docstrings:
- def test_inquiry_credit(self): 查询征信报告
- def test_fetch_credit_result(self): 查询征信结果 | Implement the Python class `CreditInquiry` described below.
Class description:
征信查询
Method signatures and docstrings:
- def test_inquiry_credit(self): 查询征信报告
- def test_fetch_credit_result(self): 查询征信结果
<|skeleton|>
class CreditInquiry:
"""征信查询"""
def test_inquiry_credit(self):
"""查询征信报告"""
... | 8ed6723cab1f54f2ff8ea0947c6f982aef7e1b47 | <|skeleton|>
class CreditInquiry:
"""征信查询"""
def test_inquiry_credit(self):
"""查询征信报告"""
<|body_0|>
def test_fetch_credit_result(self):
"""查询征信结果"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CreditInquiry:
"""征信查询"""
def test_inquiry_credit(self):
"""查询征信报告"""
handel_credit = public.CreditInquiry()
inquiry_credit = handel_credit.save_to_mongoDB()
if inquiry_credit:
public.log_record('查询征信响应数据:', sys._getframe().f_lineno, inquiry_credit)
... | the_stack_v2_python_sparse | auto/wpt_interface_test/case_suite/credit_inquiry.py | Strugglingrookie/oldboy2 | train | 1 |
e8836c517f462e1e42f4611bec847e2a60c0d2b4 | [
"super().__init__(lambda_runner.is_debugging(), port=port, host=host)\nself.lambda_runner = lambda_runner\nself.stderr = stderr",
"self._app = Flask(__name__)\nself._app.url_map.converters['function_path'] = FunctionNamePathConverter\npath = '/2015-03-31/functions/<function_path:function_name>/invocations'\nself.... | <|body_start_0|>
super().__init__(lambda_runner.is_debugging(), port=port, host=host)
self.lambda_runner = lambda_runner
self.stderr = stderr
<|end_body_0|>
<|body_start_1|>
self._app = Flask(__name__)
self._app.url_map.converters['function_path'] = FunctionNamePathConverter
... | LocalLambdaInvokeService | [
"Apache-2.0",
"BSD-3-Clause",
"MIT",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LocalLambdaInvokeService:
def __init__(self, lambda_runner, port, host, stderr=None):
"""Creates a Local Lambda Service that will only response to invoking a function Parameters ---------- lambda_runner samcli.commands.local.lib.local_lambda.LocalLambdaRunner The Lambda runner class capa... | stack_v2_sparse_classes_10k_train_002442 | 6,785 | permissive | [
{
"docstring": "Creates a Local Lambda Service that will only response to invoking a function Parameters ---------- lambda_runner samcli.commands.local.lib.local_lambda.LocalLambdaRunner The Lambda runner class capable of invoking the function port int Optional. port for the service to start listening on host s... | 5 | null | Implement the Python class `LocalLambdaInvokeService` described below.
Class description:
Implement the LocalLambdaInvokeService class.
Method signatures and docstrings:
- def __init__(self, lambda_runner, port, host, stderr=None): Creates a Local Lambda Service that will only response to invoking a function Paramete... | Implement the Python class `LocalLambdaInvokeService` described below.
Class description:
Implement the LocalLambdaInvokeService class.
Method signatures and docstrings:
- def __init__(self, lambda_runner, port, host, stderr=None): Creates a Local Lambda Service that will only response to invoking a function Paramete... | b297ff015f2b69d7c74059c2d42ece1c29ea73ee | <|skeleton|>
class LocalLambdaInvokeService:
def __init__(self, lambda_runner, port, host, stderr=None):
"""Creates a Local Lambda Service that will only response to invoking a function Parameters ---------- lambda_runner samcli.commands.local.lib.local_lambda.LocalLambdaRunner The Lambda runner class capa... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class LocalLambdaInvokeService:
def __init__(self, lambda_runner, port, host, stderr=None):
"""Creates a Local Lambda Service that will only response to invoking a function Parameters ---------- lambda_runner samcli.commands.local.lib.local_lambda.LocalLambdaRunner The Lambda runner class capable of invokin... | the_stack_v2_python_sparse | samcli/local/lambda_service/local_lambda_invoke_service.py | aws/aws-sam-cli | train | 1,402 | |
a04e2813ec9aba7bdc30dcac7f7e0b4a050008c4 | [
"if not self.id or viewer.has_perm('bookwyrm.create_invites'):\n return\nraise PermissionDenied()",
"if not self.id and User.objects.filter(email=self.email).exists():\n raise IntegrityError()\nsuper().save(*args, **kwargs)"
] | <|body_start_0|>
if not self.id or viewer.has_perm('bookwyrm.create_invites'):
return
raise PermissionDenied()
<|end_body_0|>
<|body_start_1|>
if not self.id and User.objects.filter(email=self.email).exists():
raise IntegrityError()
super().save(*args, **kwargs)
... | prospective users can request an invite | InviteRequest | [
"LicenseRef-scancode-warranty-disclaimer"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InviteRequest:
"""prospective users can request an invite"""
def raise_not_editable(self, viewer):
"""Only check perms on edit, not create"""
<|body_0|>
def save(self, *args, **kwargs):
"""don't create a request for a registered email"""
<|body_1|>
<|end... | stack_v2_sparse_classes_10k_train_002443 | 8,920 | no_license | [
{
"docstring": "Only check perms on edit, not create",
"name": "raise_not_editable",
"signature": "def raise_not_editable(self, viewer)"
},
{
"docstring": "don't create a request for a registered email",
"name": "save",
"signature": "def save(self, *args, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003829 | Implement the Python class `InviteRequest` described below.
Class description:
prospective users can request an invite
Method signatures and docstrings:
- def raise_not_editable(self, viewer): Only check perms on edit, not create
- def save(self, *args, **kwargs): don't create a request for a registered email | Implement the Python class `InviteRequest` described below.
Class description:
prospective users can request an invite
Method signatures and docstrings:
- def raise_not_editable(self, viewer): Only check perms on edit, not create
- def save(self, *args, **kwargs): don't create a request for a registered email
<|skel... | 0f8da5b738047f3c34d60d93f59bdedd8f797224 | <|skeleton|>
class InviteRequest:
"""prospective users can request an invite"""
def raise_not_editable(self, viewer):
"""Only check perms on edit, not create"""
<|body_0|>
def save(self, *args, **kwargs):
"""don't create a request for a registered email"""
<|body_1|>
<|end... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class InviteRequest:
"""prospective users can request an invite"""
def raise_not_editable(self, viewer):
"""Only check perms on edit, not create"""
if not self.id or viewer.has_perm('bookwyrm.create_invites'):
return
raise PermissionDenied()
def save(self, *args, **kwar... | the_stack_v2_python_sparse | bookwyrm/models/site.py | bookwyrm-social/bookwyrm | train | 1,398 |
8ce06f1f43fae96cdac34c93dcda12e5917e8ad0 | [
"serializer = UserLoginSerializer(data=request.data)\nserializer.is_valid(raise_exception=True)\nuser, token = serializer.save()\ndata = {'user': UserModelSerializer(user).data, 'access_token': token}\nreturn Response(data, status=status.HTTP_201_CREATED)",
"serializer = UserSignUpSerializer(data=request.data)\ns... | <|body_start_0|>
serializer = UserLoginSerializer(data=request.data)
serializer.is_valid(raise_exception=True)
user, token = serializer.save()
data = {'user': UserModelSerializer(user).data, 'access_token': token}
return Response(data, status=status.HTTP_201_CREATED)
<|end_body_0... | UserViewSet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserViewSet:
def login(self, request):
"""User sign in."""
<|body_0|>
def signup(self, request):
"""User sign up."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
serializer = UserLoginSerializer(data=request.data)
serializer.is_valid(raise_e... | stack_v2_sparse_classes_10k_train_002444 | 1,326 | no_license | [
{
"docstring": "User sign in.",
"name": "login",
"signature": "def login(self, request)"
},
{
"docstring": "User sign up.",
"name": "signup",
"signature": "def signup(self, request)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000334 | Implement the Python class `UserViewSet` described below.
Class description:
Implement the UserViewSet class.
Method signatures and docstrings:
- def login(self, request): User sign in.
- def signup(self, request): User sign up. | Implement the Python class `UserViewSet` described below.
Class description:
Implement the UserViewSet class.
Method signatures and docstrings:
- def login(self, request): User sign in.
- def signup(self, request): User sign up.
<|skeleton|>
class UserViewSet:
def login(self, request):
"""User sign in."... | f46be6003e69dc1524d1eae230ba109e3dfeb50f | <|skeleton|>
class UserViewSet:
def login(self, request):
"""User sign in."""
<|body_0|>
def signup(self, request):
"""User sign up."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class UserViewSet:
def login(self, request):
"""User sign in."""
serializer = UserLoginSerializer(data=request.data)
serializer.is_valid(raise_exception=True)
user, token = serializer.save()
data = {'user': UserModelSerializer(user).data, 'access_token': token}
return... | the_stack_v2_python_sparse | mercados_unac/apps/users/views.py | Chaoslecion123/backendMercado | train | 0 | |
a2367671900f7143df73031b193cf75f010b3ade | [
"try:\n user_details = User.objects.get(username=username)\n user_following_data = get_user_following_data(user_details)\n return Response({'message': get_followers_found_message(username), 'following': user_following_data['following'], 'followers': user_following_data['followers'], 'followingCount': user_... | <|body_start_0|>
try:
user_details = User.objects.get(username=username)
user_following_data = get_user_following_data(user_details)
return Response({'message': get_followers_found_message(username), 'following': user_following_data['following'], 'followers': user_following_d... | A view that allows users to follow each other if the user is authenticated and verified. | ProfileFollowUserAPIView | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProfileFollowUserAPIView:
"""A view that allows users to follow each other if the user is authenticated and verified."""
def get(self, request, username):
"""View to return a users following i.e followers and those they are following. Params ------- request: Object with request data ... | stack_v2_sparse_classes_10k_train_002445 | 11,549 | permissive | [
{
"docstring": "View to return a users following i.e followers and those they are following. Params ------- request: Object with request data and functions. username: String providing the user to follow. Returns -------- Response object: { \"message\": \"message body\", \"following\": List, \"followers\": List,... | 3 | stack_v2_sparse_classes_30k_train_002570 | Implement the Python class `ProfileFollowUserAPIView` described below.
Class description:
A view that allows users to follow each other if the user is authenticated and verified.
Method signatures and docstrings:
- def get(self, request, username): View to return a users following i.e followers and those they are fol... | Implement the Python class `ProfileFollowUserAPIView` described below.
Class description:
A view that allows users to follow each other if the user is authenticated and verified.
Method signatures and docstrings:
- def get(self, request, username): View to return a users following i.e followers and those they are fol... | 5a31840856de4b361fe2594dfa7a33d7774d3fe2 | <|skeleton|>
class ProfileFollowUserAPIView:
"""A view that allows users to follow each other if the user is authenticated and verified."""
def get(self, request, username):
"""View to return a users following i.e followers and those they are following. Params ------- request: Object with request data ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ProfileFollowUserAPIView:
"""A view that allows users to follow each other if the user is authenticated and verified."""
def get(self, request, username):
"""View to return a users following i.e followers and those they are following. Params ------- request: Object with request data and functions... | the_stack_v2_python_sparse | authors/apps/profiles/views.py | bl4ck4ndbr0wn/ah-centauri-backend | train | 0 |
cf8dcdce5fa201e390cada3b4aeefb034f093d58 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn Room()",
"from .booking_type import BookingType\nfrom .place import Place\nfrom .booking_type import BookingType\nfrom .place import Place\nfields: Dict[str, Callable[[Any], None]] = {'audioDeviceName': lambda n: setattr(self, 'audio_d... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return Room()
<|end_body_0|>
<|body_start_1|>
from .booking_type import BookingType
from .place import Place
from .booking_type import BookingType
from .place import Place
... | Room | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Room:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Room:
"""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: Room"""
... | stack_v2_sparse_classes_10k_train_002446 | 5,259 | 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: Room",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_value(parse_no... | 3 | stack_v2_sparse_classes_30k_train_005782 | Implement the Python class `Room` described below.
Class description:
Implement the Room class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Room: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The pars... | Implement the Python class `Room` described below.
Class description:
Implement the Room class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Room: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The pars... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class Room:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Room:
"""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: Room"""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Room:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Room:
"""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: Room"""
if not parse_n... | the_stack_v2_python_sparse | msgraph/generated/models/room.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
eaf295d4ae67329376c82f8fc095b4ad682bfa2e | [
"test = \"5\\nIAO'15\\nIAO'2015\\nIAO'1\\nIAO'9\\nIAO'0\"\nd = Olymp(test)\nself.assertEqual(d.n, 5)\nself.assertEqual(d.nums[0:2], ['15', '2015'])\nself.assertEqual(Olymp(test).calculate(), '2015\\n12015\\n1991\\n1989\\n1990')\ntest = \"4\\nIAO'9\\nIAO'99\\nIAO'999\\nIAO'9999\"\nself.assertEqual(Olymp(test).calcul... | <|body_start_0|>
test = "5\nIAO'15\nIAO'2015\nIAO'1\nIAO'9\nIAO'0"
d = Olymp(test)
self.assertEqual(d.n, 5)
self.assertEqual(d.nums[0:2], ['15', '2015'])
self.assertEqual(Olymp(test).calculate(), '2015\n12015\n1991\n1989\n1990')
test = "4\nIAO'9\nIAO'99\nIAO'999\nIAO'9999... | unitTests | [
"Unlicense",
"LicenseRef-scancode-public-domain"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class unitTests:
def test_single_test(self):
"""Olymp class testing"""
<|body_0|>
def time_limit_test(self, nmax):
"""Timelimit testing"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
test = "5\nIAO'15\nIAO'2015\nIAO'1\nIAO'9\nIAO'0"
d = Olymp(tes... | stack_v2_sparse_classes_10k_train_002447 | 3,747 | permissive | [
{
"docstring": "Olymp class testing",
"name": "test_single_test",
"signature": "def test_single_test(self)"
},
{
"docstring": "Timelimit testing",
"name": "time_limit_test",
"signature": "def time_limit_test(self, nmax)"
}
] | 2 | stack_v2_sparse_classes_30k_test_000252 | Implement the Python class `unitTests` described below.
Class description:
Implement the unitTests class.
Method signatures and docstrings:
- def test_single_test(self): Olymp class testing
- def time_limit_test(self, nmax): Timelimit testing | Implement the Python class `unitTests` described below.
Class description:
Implement the unitTests class.
Method signatures and docstrings:
- def test_single_test(self): Olymp class testing
- def time_limit_test(self, nmax): Timelimit testing
<|skeleton|>
class unitTests:
def test_single_test(self):
"""... | ae02ea872ca91ef98630cc172a844b82cc56f621 | <|skeleton|>
class unitTests:
def test_single_test(self):
"""Olymp class testing"""
<|body_0|>
def time_limit_test(self, nmax):
"""Timelimit testing"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class unitTests:
def test_single_test(self):
"""Olymp class testing"""
test = "5\nIAO'15\nIAO'2015\nIAO'1\nIAO'9\nIAO'0"
d = Olymp(test)
self.assertEqual(d.n, 5)
self.assertEqual(d.nums[0:2], ['15', '2015'])
self.assertEqual(Olymp(test).calculate(), '2015\n12015\n1991... | the_stack_v2_python_sparse | codeforces/664C_olymp.py | snsokolov/contests | train | 1 | |
573dc4ca5ea195faee224c90d9bd4ccaaa4e3e93 | [
"is_unprivileged = self.is_unprivileged_query(request, identifier)\nif is_unprivileged:\n if not getattr(settings, 'ALLOW_UNPRIVILEGED_SSO_PROVIDER_QUERY', False):\n return Response(status=status.HTTP_403_FORBIDDEN)\ntry:\n user = User.objects.get(**{identifier.kind: identifier.value})\nexcept User.Doe... | <|body_start_0|>
is_unprivileged = self.is_unprivileged_query(request, identifier)
if is_unprivileged:
if not getattr(settings, 'ALLOW_UNPRIVILEGED_SSO_PROVIDER_QUERY', False):
return Response(status=status.HTTP_403_FORBIDDEN)
try:
user = User.objects.get(... | Common core of UserView and UserViewV2 | BaseUserView | [
"AGPL-3.0-only",
"AGPL-3.0-or-later",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseUserView:
"""Common core of UserView and UserViewV2"""
def do_get(self, request, identifier):
"""Fulfill the request, now that the identifier has been specified."""
<|body_0|>
def get_provider_data(self, assoc, is_unprivileged):
"""Return the data for the spe... | stack_v2_sparse_classes_10k_train_002448 | 16,815 | permissive | [
{
"docstring": "Fulfill the request, now that the identifier has been specified.",
"name": "do_get",
"signature": "def do_get(self, request, identifier)"
},
{
"docstring": "Return the data for the specified provider. If the request is unprivileged, do not return the remote ID of the user.",
... | 3 | null | Implement the Python class `BaseUserView` described below.
Class description:
Common core of UserView and UserViewV2
Method signatures and docstrings:
- def do_get(self, request, identifier): Fulfill the request, now that the identifier has been specified.
- def get_provider_data(self, assoc, is_unprivileged): Return... | Implement the Python class `BaseUserView` described below.
Class description:
Common core of UserView and UserViewV2
Method signatures and docstrings:
- def do_get(self, request, identifier): Fulfill the request, now that the identifier has been specified.
- def get_provider_data(self, assoc, is_unprivileged): Return... | 5809eaca7079a15ee56b0b7fcfea425337046c97 | <|skeleton|>
class BaseUserView:
"""Common core of UserView and UserViewV2"""
def do_get(self, request, identifier):
"""Fulfill the request, now that the identifier has been specified."""
<|body_0|>
def get_provider_data(self, assoc, is_unprivileged):
"""Return the data for the spe... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BaseUserView:
"""Common core of UserView and UserViewV2"""
def do_get(self, request, identifier):
"""Fulfill the request, now that the identifier has been specified."""
is_unprivileged = self.is_unprivileged_query(request, identifier)
if is_unprivileged:
if not getattr... | the_stack_v2_python_sparse | Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/common/djangoapps/third_party_auth/api/views.py | luque/better-ways-of-thinking-about-software | train | 3 |
d5cbcbbe9e3d5bf07c20e2db882169758e3effa3 | [
"super(Receiver, self).__init__()\nself.daemon = False\nself.q_of_samples = multiprocessing.Queue()\nself.server = cb.get_collectd_server(self.q_of_samples)\nself.control = control\nself.pd_dict = pd_dict\nself.collectd_cpu_keys = settings.getValue('COLLECTD_CPU_KEYS')\nself.collectd_processes_keys = settings.getVa... | <|body_start_0|>
super(Receiver, self).__init__()
self.daemon = False
self.q_of_samples = multiprocessing.Queue()
self.server = cb.get_collectd_server(self.q_of_samples)
self.control = control
self.pd_dict = pd_dict
self.collectd_cpu_keys = settings.getValue('COLL... | Wrapper Receiver (of samples) class | Receiver | [
"CC-BY-4.0",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Receiver:
"""Wrapper Receiver (of samples) class"""
def __init__(self, pd_dict, control):
"""Initialize. A queue will be shared with collectd_bucky"""
<|body_0|>
def run(self):
"""Start receiving the samples."""
<|body_1|>
def handle(self, sample):
... | stack_v2_sparse_classes_10k_train_002449 | 10,808 | permissive | [
{
"docstring": "Initialize. A queue will be shared with collectd_bucky",
"name": "__init__",
"signature": "def __init__(self, pd_dict, control)"
},
{
"docstring": "Start receiving the samples.",
"name": "run",
"signature": "def run(self)"
},
{
"docstring": "Store values and names... | 4 | stack_v2_sparse_classes_30k_val_000216 | Implement the Python class `Receiver` described below.
Class description:
Wrapper Receiver (of samples) class
Method signatures and docstrings:
- def __init__(self, pd_dict, control): Initialize. A queue will be shared with collectd_bucky
- def run(self): Start receiving the samples.
- def handle(self, sample): Store... | Implement the Python class `Receiver` described below.
Class description:
Wrapper Receiver (of samples) class
Method signatures and docstrings:
- def __init__(self, pd_dict, control): Initialize. A queue will be shared with collectd_bucky
- def run(self): Start receiving the samples.
- def handle(self, sample): Store... | d5c0a03054f720da2a5ff9eba74feee57fb0296d | <|skeleton|>
class Receiver:
"""Wrapper Receiver (of samples) class"""
def __init__(self, pd_dict, control):
"""Initialize. A queue will be shared with collectd_bucky"""
<|body_0|>
def run(self):
"""Start receiving the samples."""
<|body_1|>
def handle(self, sample):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Receiver:
"""Wrapper Receiver (of samples) class"""
def __init__(self, pd_dict, control):
"""Initialize. A queue will be shared with collectd_bucky"""
super(Receiver, self).__init__()
self.daemon = False
self.q_of_samples = multiprocessing.Queue()
self.server = cb.... | the_stack_v2_python_sparse | tools/collectors/collectd/collectd.py | shreyagupta30/vineperf | train | 0 |
ee7d52d259b4bf74c3a544385ad0251ef980c1f0 | [
"super(Fuzzy, self).__init__()\nif field_name and value:\n self.set_field(field_name, value)",
"if not isinstance(value, str) or not isinstance(field_name, str):\n raise pylastica.exception.InvalidException('field_name and value parameters must be str.')\nreturn self.set_param(field_name, {'value': value})"... | <|body_start_0|>
super(Fuzzy, self).__init__()
if field_name and value:
self.set_field(field_name, value)
<|end_body_0|>
<|body_start_1|>
if not isinstance(value, str) or not isinstance(field_name, str):
raise pylastica.exception.InvalidException('field_name and value pa... | Fuzzy | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Fuzzy:
def __init__(self, field_name=None, value=None):
"""Set either both parameters or neither. @param field_name: field name @type field_name: str @param value: search string @type value: str"""
<|body_0|>
def set_field(self, field_name, value):
"""@param field_na... | stack_v2_sparse_classes_10k_train_002450 | 1,434 | permissive | [
{
"docstring": "Set either both parameters or neither. @param field_name: field name @type field_name: str @param value: search string @type value: str",
"name": "__init__",
"signature": "def __init__(self, field_name=None, value=None)"
},
{
"docstring": "@param field_name: @type field_name: str... | 3 | stack_v2_sparse_classes_30k_train_001903 | Implement the Python class `Fuzzy` described below.
Class description:
Implement the Fuzzy class.
Method signatures and docstrings:
- def __init__(self, field_name=None, value=None): Set either both parameters or neither. @param field_name: field name @type field_name: str @param value: search string @type value: str... | Implement the Python class `Fuzzy` described below.
Class description:
Implement the Fuzzy class.
Method signatures and docstrings:
- def __init__(self, field_name=None, value=None): Set either both parameters or neither. @param field_name: field name @type field_name: str @param value: search string @type value: str... | 0fbf68ed3e17d665e3cdf1913444ebf1f72693dd | <|skeleton|>
class Fuzzy:
def __init__(self, field_name=None, value=None):
"""Set either both parameters or neither. @param field_name: field name @type field_name: str @param value: search string @type value: str"""
<|body_0|>
def set_field(self, field_name, value):
"""@param field_na... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Fuzzy:
def __init__(self, field_name=None, value=None):
"""Set either both parameters or neither. @param field_name: field name @type field_name: str @param value: search string @type value: str"""
super(Fuzzy, self).__init__()
if field_name and value:
self.set_field(field_... | the_stack_v2_python_sparse | pylastica/query/fuzzy.py | jlinn/pylastica | train | 5 | |
80a7114eb32c32748cb4f09dfa82e6eb80c73a3e | [
"self.op = op\nself.e = e\nself.n = 1\nwhile self.n < length:\n self.n *= 2\nself.dat = [e()] * (2 * self.n - 1)",
"assert len(x_list) <= self.n\nfor i, x in enumerate(x_list):\n self.dat[self.n - 1 + i] = x\nfor i in range(self.n - 2, -1, -1):\n self.dat[i] = self.op(self.dat[2 * i + 1], self.dat[2 * i ... | <|body_start_0|>
self.op = op
self.e = e
self.n = 1
while self.n < length:
self.n *= 2
self.dat = [e()] * (2 * self.n - 1)
<|end_body_0|>
<|body_start_1|>
assert len(x_list) <= self.n
for i, x in enumerate(x_list):
self.dat[self.n - 1 + i]... | SegmentTree | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SegmentTree:
def __init__(self, length, op=min, e=lambda: 0):
""":param length: length of initial values :param op: operator, op(x, y) -> z :param e: function that return identity element for op"""
<|body_0|>
def initialize(self, x_list):
"""initialize data :param x_... | stack_v2_sparse_classes_10k_train_002451 | 4,290 | no_license | [
{
"docstring": ":param length: length of initial values :param op: operator, op(x, y) -> z :param e: function that return identity element for op",
"name": "__init__",
"signature": "def __init__(self, length, op=min, e=lambda: 0)"
},
{
"docstring": "initialize data :param x_list: initial values ... | 6 | stack_v2_sparse_classes_30k_train_003445 | Implement the Python class `SegmentTree` described below.
Class description:
Implement the SegmentTree class.
Method signatures and docstrings:
- def __init__(self, length, op=min, e=lambda: 0): :param length: length of initial values :param op: operator, op(x, y) -> z :param e: function that return identity element ... | Implement the Python class `SegmentTree` described below.
Class description:
Implement the SegmentTree class.
Method signatures and docstrings:
- def __init__(self, length, op=min, e=lambda: 0): :param length: length of initial values :param op: operator, op(x, y) -> z :param e: function that return identity element ... | 02b0a6c92a05c6858b87cb22623ce877c1039f8f | <|skeleton|>
class SegmentTree:
def __init__(self, length, op=min, e=lambda: 0):
""":param length: length of initial values :param op: operator, op(x, y) -> z :param e: function that return identity element for op"""
<|body_0|>
def initialize(self, x_list):
"""initialize data :param x_... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SegmentTree:
def __init__(self, length, op=min, e=lambda: 0):
""":param length: length of initial values :param op: operator, op(x, y) -> z :param e: function that return identity element for op"""
self.op = op
self.e = e
self.n = 1
while self.n < length:
se... | the_stack_v2_python_sparse | ABC/ABC201-250/ABC217/D.py | k-harada/AtCoder | train | 9 | |
22c21443c1937c665d36225b929d2e63180b370a | [
"if not os.path.exists('/home/mziaeefard/nas/human-ai-dialog/vilbert/data2/conceptnet/processed/glove.gensim'):\n print(colored('Processing the `GloVe` dataset for the first time...', 'yellow'))\n if not os.path.exists('/home/mziaeefard/nas/human-ai-dialog/vilbert/data2/conceptnet/raw/glove.840B.300d.txt'):\n... | <|body_start_0|>
if not os.path.exists('/home/mziaeefard/nas/human-ai-dialog/vilbert/data2/conceptnet/processed/glove.gensim'):
print(colored('Processing the `GloVe` dataset for the first time...', 'yellow'))
if not os.path.exists('/home/mziaeefard/nas/human-ai-dialog/vilbert/data2/conce... | Class to get the GloVe embeddings of words | GloveConverter | [
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GloveConverter:
"""Class to get the GloVe embeddings of words"""
def __init__(self):
"""Loads the GloVe model"""
<|body_0|>
def convert_word_to_embedding(self, word):
"""Given a word, returns its GloVe embedding"""
<|body_1|>
<|end_skeleton|>
<|body_sta... | stack_v2_sparse_classes_10k_train_002452 | 4,555 | permissive | [
{
"docstring": "Loads the GloVe model",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Given a word, returns its GloVe embedding",
"name": "convert_word_to_embedding",
"signature": "def convert_word_to_embedding(self, word)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002789 | Implement the Python class `GloveConverter` described below.
Class description:
Class to get the GloVe embeddings of words
Method signatures and docstrings:
- def __init__(self): Loads the GloVe model
- def convert_word_to_embedding(self, word): Given a word, returns its GloVe embedding | Implement the Python class `GloveConverter` described below.
Class description:
Class to get the GloVe embeddings of words
Method signatures and docstrings:
- def __init__(self): Loads the GloVe model
- def convert_word_to_embedding(self, word): Given a word, returns its GloVe embedding
<|skeleton|>
class GloveConve... | 0fb558af7df8c61be47bcf278e30cdf10315b572 | <|skeleton|>
class GloveConverter:
"""Class to get the GloVe embeddings of words"""
def __init__(self):
"""Loads the GloVe model"""
<|body_0|>
def convert_word_to_embedding(self, word):
"""Given a word, returns its GloVe embedding"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GloveConverter:
"""Class to get the GloVe embeddings of words"""
def __init__(self):
"""Loads the GloVe model"""
if not os.path.exists('/home/mziaeefard/nas/human-ai-dialog/vilbert/data2/conceptnet/processed/glove.gensim'):
print(colored('Processing the `GloVe` dataset for the... | the_stack_v2_python_sparse | conceptBert/vilbert/knowledge_graph/create_embedding_files.py | liubo12/ConceptBERT | train | 0 |
a459aaa5f210c6c375af119962c81f02506212c4 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\ntry:\n mapping_value = parse_node.get_child_node('@odata.type').get_str_value()\nexcept AttributeError:\n mapping_value = None\nif mapping_value and mapping_value.casefold() == '#microsoft.graph.androidManagedAppProtection'.casefold():\n ... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
try:
mapping_value = parse_node.get_child_node('@odata.type').get_str_value()
except AttributeError:
mapping_value = None
if mapping_value and mapping_value.casefold() ==... | Policy used to configure detailed management settings targeted to specific security groups | TargetedManagedAppProtection | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TargetedManagedAppProtection:
"""Policy used to configure detailed management settings targeted to specific security groups"""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TargetedManagedAppProtection:
"""Creates a new instance of the appropriate class... | stack_v2_sparse_classes_10k_train_002453 | 4,121 | 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: TargetedManagedAppProtection",
"name": "create_from_discriminator_value",
"signature": "def create_from_disc... | 3 | null | Implement the Python class `TargetedManagedAppProtection` described below.
Class description:
Policy used to configure detailed management settings targeted to specific security groups
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TargetedManagedAppPr... | Implement the Python class `TargetedManagedAppProtection` described below.
Class description:
Policy used to configure detailed management settings targeted to specific security groups
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TargetedManagedAppPr... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class TargetedManagedAppProtection:
"""Policy used to configure detailed management settings targeted to specific security groups"""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TargetedManagedAppProtection:
"""Creates a new instance of the appropriate class... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TargetedManagedAppProtection:
"""Policy used to configure detailed management settings targeted to specific security groups"""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TargetedManagedAppProtection:
"""Creates a new instance of the appropriate class based on dis... | the_stack_v2_python_sparse | msgraph/generated/models/targeted_managed_app_protection.py | microsoftgraph/msgraph-sdk-python | train | 135 |
9953623dc4c80ba0a2f2574630a8785f80adf645 | [
"result = []\nfor row in triangle:\n if not result:\n result.append(row)\n continue\n last_row = result[-1]\n new_row = []\n for index, value in enumerate(row):\n small_row = []\n if index != 0:\n small_row.append(value + last_row[index - 1])\n if index != l... | <|body_start_0|>
result = []
for row in triangle:
if not result:
result.append(row)
continue
last_row = result[-1]
new_row = []
for index, value in enumerate(row):
small_row = []
if index != 0... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def _minimumTotal(self, triangle):
""":type triangle: List[List[int]] :rtype: int"""
<|body_0|>
def __minimumTotal(self, triangle):
""":type triangle: List[List[int]] :rtype: int"""
<|body_1|>
def minimumTotal(self, triangle):
""":type ... | stack_v2_sparse_classes_10k_train_002454 | 2,570 | permissive | [
{
"docstring": ":type triangle: List[List[int]] :rtype: int",
"name": "_minimumTotal",
"signature": "def _minimumTotal(self, triangle)"
},
{
"docstring": ":type triangle: List[List[int]] :rtype: int",
"name": "__minimumTotal",
"signature": "def __minimumTotal(self, triangle)"
},
{
... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _minimumTotal(self, triangle): :type triangle: List[List[int]] :rtype: int
- def __minimumTotal(self, triangle): :type triangle: List[List[int]] :rtype: int
- def minimumTota... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _minimumTotal(self, triangle): :type triangle: List[List[int]] :rtype: int
- def __minimumTotal(self, triangle): :type triangle: List[List[int]] :rtype: int
- def minimumTota... | 0dd67edca4e0b0323cb5a7239f02ea46383cd15a | <|skeleton|>
class Solution:
def _minimumTotal(self, triangle):
""":type triangle: List[List[int]] :rtype: int"""
<|body_0|>
def __minimumTotal(self, triangle):
""":type triangle: List[List[int]] :rtype: int"""
<|body_1|>
def minimumTotal(self, triangle):
""":type ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def _minimumTotal(self, triangle):
""":type triangle: List[List[int]] :rtype: int"""
result = []
for row in triangle:
if not result:
result.append(row)
continue
last_row = result[-1]
new_row = []
... | the_stack_v2_python_sparse | 120.triangle.py | windard/leeeeee | train | 0 | |
1459eecb5a295d88bd9bed55bd2d87cf3723ae26 | [
"self.envs = envs\nsuper().__init__()\nself._setup(*args, **kwargs)",
"cursor = dbapi_connection.cursor()\ncursor.execute('PRAGMA synchronous = 0')\ncursor.execute('PRAGMA mmap_size = 268435456')\ncursor.execute('PRAGMA cache_size = 20480')\ncursor.close()",
"try:\n db_settings = settings.get(f'DATABASES.{se... | <|body_start_0|>
self.envs = envs
super().__init__()
self._setup(*args, **kwargs)
<|end_body_0|>
<|body_start_1|>
cursor = dbapi_connection.cursor()
cursor.execute('PRAGMA synchronous = 0')
cursor.execute('PRAGMA mmap_size = 268435456')
cursor.execute('PRAGMA cac... | Менеджер инициатор БД. | DBManager | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DBManager:
"""Менеджер инициатор БД."""
def __init__(self, envs, *args, **kwargs):
"""Инициализация. Args: envs: имя области БД *args: доп. параметры **kwargs: доп. параметры"""
<|body_0|>
def set_sqlite_pragma(dbapi_connection, connection_record=None):
"""Параме... | stack_v2_sparse_classes_10k_train_002455 | 23,603 | permissive | [
{
"docstring": "Инициализация. Args: envs: имя области БД *args: доп. параметры **kwargs: доп. параметры",
"name": "__init__",
"signature": "def __init__(self, envs, *args, **kwargs)"
},
{
"docstring": "Параметры подключения к БД. Пока не знаю как от этого отделаться при других бекэндах Args: db... | 3 | stack_v2_sparse_classes_30k_train_004626 | Implement the Python class `DBManager` described below.
Class description:
Менеджер инициатор БД.
Method signatures and docstrings:
- def __init__(self, envs, *args, **kwargs): Инициализация. Args: envs: имя области БД *args: доп. параметры **kwargs: доп. параметры
- def set_sqlite_pragma(dbapi_connection, connection... | Implement the Python class `DBManager` described below.
Class description:
Менеджер инициатор БД.
Method signatures and docstrings:
- def __init__(self, envs, *args, **kwargs): Инициализация. Args: envs: имя области БД *args: доп. параметры **kwargs: доп. параметры
- def set_sqlite_pragma(dbapi_connection, connection... | d83fe60bc20535adb969d72f52aaca5cf4b00c6b | <|skeleton|>
class DBManager:
"""Менеджер инициатор БД."""
def __init__(self, envs, *args, **kwargs):
"""Инициализация. Args: envs: имя области БД *args: доп. параметры **kwargs: доп. параметры"""
<|body_0|>
def set_sqlite_pragma(dbapi_connection, connection_record=None):
"""Параме... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DBManager:
"""Менеджер инициатор БД."""
def __init__(self, envs, *args, **kwargs):
"""Инициализация. Args: envs: имя области БД *args: доп. параметры **kwargs: доп. параметры"""
self.envs = envs
super().__init__()
self._setup(*args, **kwargs)
def set_sqlite_pragma(dba... | the_stack_v2_python_sparse | talkative_client/talkative_client/db.py | mom1/messager | train | 0 |
c87fe27c1723ac436172bcc6e911e7809e0d8363 | [
"super(Encoder, self).__init__(d_model, d_k, d_v, sequence_length, h, batch_size, num_layer=num_layer)\nself.Q = Q\nself.K_s = K_s\nself.mask = mask\nself.initializer = tf.random_normal_initializer(stddev=0.1)\nself.dropout_keep_prob = dropout_keep_prob\nself.use_residual_conn = use_residual_conn",
"start = time.... | <|body_start_0|>
super(Encoder, self).__init__(d_model, d_k, d_v, sequence_length, h, batch_size, num_layer=num_layer)
self.Q = Q
self.K_s = K_s
self.mask = mask
self.initializer = tf.random_normal_initializer(stddev=0.1)
self.dropout_keep_prob = dropout_keep_prob
... | Encoder | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Encoder:
def __init__(self, d_model, d_k, d_v, sequence_length, h, batch_size, num_layer, Q, K_s, mask=None, dropout_keep_prob=0.9, use_residual_conn=True):
""":param d_model: :param d_k: :param d_v: :param sequence_length: :param h: :param batch_size: :param embedded_words: shape:[batch... | stack_v2_sparse_classes_10k_train_002456 | 6,839 | permissive | [
{
"docstring": ":param d_model: :param d_k: :param d_v: :param sequence_length: :param h: :param batch_size: :param embedded_words: shape:[batch_size*sequence_length,embed_size]",
"name": "__init__",
"signature": "def __init__(self, d_model, d_k, d_v, sequence_length, h, batch_size, num_layer, Q, K_s, m... | 3 | stack_v2_sparse_classes_30k_train_004768 | Implement the Python class `Encoder` described below.
Class description:
Implement the Encoder class.
Method signatures and docstrings:
- def __init__(self, d_model, d_k, d_v, sequence_length, h, batch_size, num_layer, Q, K_s, mask=None, dropout_keep_prob=0.9, use_residual_conn=True): :param d_model: :param d_k: :par... | Implement the Python class `Encoder` described below.
Class description:
Implement the Encoder class.
Method signatures and docstrings:
- def __init__(self, d_model, d_k, d_v, sequence_length, h, batch_size, num_layer, Q, K_s, mask=None, dropout_keep_prob=0.9, use_residual_conn=True): :param d_model: :param d_k: :par... | 480c909e0835a455606e829310ff949c9dd23549 | <|skeleton|>
class Encoder:
def __init__(self, d_model, d_k, d_v, sequence_length, h, batch_size, num_layer, Q, K_s, mask=None, dropout_keep_prob=0.9, use_residual_conn=True):
""":param d_model: :param d_k: :param d_v: :param sequence_length: :param h: :param batch_size: :param embedded_words: shape:[batch... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Encoder:
def __init__(self, d_model, d_k, d_v, sequence_length, h, batch_size, num_layer, Q, K_s, mask=None, dropout_keep_prob=0.9, use_residual_conn=True):
""":param d_model: :param d_k: :param d_v: :param sequence_length: :param h: :param batch_size: :param embedded_words: shape:[batch_size*sequence... | the_stack_v2_python_sparse | bert_language_understanding-master/bert_language_understanding-master/model/encoder.py | yyht/BERT | train | 37 | |
af05e9075da4a9e3f814b237abd52e188265a6d2 | [
"if any((cost.state != 'draft' for cost in self)):\n raise UserError(_('Only draft landed costs can be validated'))\nif any((not cost.valuation_adjustment_lines for cost in self)):\n raise UserError(_('No Cost lines. You should maybe recompute the landed costs.'))\nif not self._check_sum():\n raise UserErr... | <|body_start_0|>
if any((cost.state != 'draft' for cost in self)):
raise UserError(_('Only draft landed costs can be validated'))
if any((not cost.valuation_adjustment_lines for cost in self)):
raise UserError(_('No Cost lines. You should maybe recompute the landed costs.'))
... | stockLandedCost | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class stockLandedCost:
def stock_responible_validate(self):
""":return:"""
<|body_0|>
def button_validate(self):
""":return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if any((cost.state != 'draft' for cost in self)):
raise UserError(_('O... | stack_v2_sparse_classes_10k_train_002457 | 42,016 | no_license | [
{
"docstring": ":return:",
"name": "stock_responible_validate",
"signature": "def stock_responible_validate(self)"
},
{
"docstring": ":return:",
"name": "button_validate",
"signature": "def button_validate(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003076 | Implement the Python class `stockLandedCost` described below.
Class description:
Implement the stockLandedCost class.
Method signatures and docstrings:
- def stock_responible_validate(self): :return:
- def button_validate(self): :return: | Implement the Python class `stockLandedCost` described below.
Class description:
Implement the stockLandedCost class.
Method signatures and docstrings:
- def stock_responible_validate(self): :return:
- def button_validate(self): :return:
<|skeleton|>
class stockLandedCost:
def stock_responible_validate(self):
... | 0b997095c260d58b026440967fea3a202bef7efb | <|skeleton|>
class stockLandedCost:
def stock_responible_validate(self):
""":return:"""
<|body_0|>
def button_validate(self):
""":return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class stockLandedCost:
def stock_responible_validate(self):
""":return:"""
if any((cost.state != 'draft' for cost in self)):
raise UserError(_('Only draft landed costs can be validated'))
if any((not cost.valuation_adjustment_lines for cost in self)):
raise UserError(... | the_stack_v2_python_sparse | v_11/EBS-SVN/branches/ebs/stock_custom/models/models.py | musabahmed/baba | train | 0 | |
981db8e6227436fa28617cab2656a7401f230519 | [
"app = self.get_argument('app', default='')\nstatus = self.get_argument('status', default='')\nauth = self.get_argument('auth', default='')\nself.set_header('content-type', 'application/json')\ntry:\n strategies = StrategyCustDao().list_all_strategies()\n if app:\n strategies = filter(lambda s: s.app =... | <|body_start_0|>
app = self.get_argument('app', default='')
status = self.get_argument('status', default='')
auth = self.get_argument('auth', default='')
self.set_header('content-type', 'application/json')
try:
strategies = StrategyCustDao().list_all_strategies()
... | StrategyListHandler | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StrategyListHandler:
def get(self):
"""list proper strategies @API summary: get proper strategy notes: "get strategies belong to some app or have some specific status" tags: - nebula parameters: - name: app in: query required: false type: string description: the app of the strategies tha... | stack_v2_sparse_classes_10k_train_002458 | 20,036 | permissive | [
{
"docstring": "list proper strategies @API summary: get proper strategy notes: \"get strategies belong to some app or have some specific status\" tags: - nebula parameters: - name: app in: query required: false type: string description: the app of the strategies that belong to - name: status in: query required... | 3 | stack_v2_sparse_classes_30k_train_005941 | Implement the Python class `StrategyListHandler` described below.
Class description:
Implement the StrategyListHandler class.
Method signatures and docstrings:
- def get(self): list proper strategies @API summary: get proper strategy notes: "get strategies belong to some app or have some specific status" tags: - nebu... | Implement the Python class `StrategyListHandler` described below.
Class description:
Implement the StrategyListHandler class.
Method signatures and docstrings:
- def get(self): list proper strategies @API summary: get proper strategy notes: "get strategies belong to some app or have some specific status" tags: - nebu... | 2e32e6e7b225e0bd87ee8c847c22862f12c51bb1 | <|skeleton|>
class StrategyListHandler:
def get(self):
"""list proper strategies @API summary: get proper strategy notes: "get strategies belong to some app or have some specific status" tags: - nebula parameters: - name: app in: query required: false type: string description: the app of the strategies tha... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class StrategyListHandler:
def get(self):
"""list proper strategies @API summary: get proper strategy notes: "get strategies belong to some app or have some specific status" tags: - nebula parameters: - name: app in: query required: false type: string description: the app of the strategies that belong to - ... | the_stack_v2_python_sparse | nebula/views/strategy.py | threathunterX/nebula_web | train | 2 | |
bc8c9e4d8919109ba0a9da677baf5fb179b80045 | [
"if not manufacturer:\n manufacturer = 'Unknown'\nif newProductName:\n productName = newProductName\nprodobj = self.getDmdRoot('Manufacturers').createHardwareProduct(productName, manufacturer, **kwargs)\nself.setProductClass(prodobj)\nif REQUEST:\n messaging.IMessageSender(self).sendToBrowser('Product Set'... | <|body_start_0|>
if not manufacturer:
manufacturer = 'Unknown'
if newProductName:
productName = newProductName
prodobj = self.getDmdRoot('Manufacturers').createHardwareProduct(productName, manufacturer, **kwargs)
self.setProductClass(prodobj)
if REQUEST:
... | Hardware object | Hardware | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Hardware:
"""Hardware object"""
def setProduct(self, productName, manufacturer='Unknown', newProductName='', REQUEST=None, **kwargs):
"""Set the product class of this software."""
<|body_0|>
def setProductKey(self, prodKey, manufacturer=None):
"""Set the product ... | stack_v2_sparse_classes_10k_train_002459 | 2,994 | no_license | [
{
"docstring": "Set the product class of this software.",
"name": "setProduct",
"signature": "def setProduct(self, productName, manufacturer='Unknown', newProductName='', REQUEST=None, **kwargs)"
},
{
"docstring": "Set the product class of this software by its productKey.",
"name": "setProdu... | 2 | null | Implement the Python class `Hardware` described below.
Class description:
Hardware object
Method signatures and docstrings:
- def setProduct(self, productName, manufacturer='Unknown', newProductName='', REQUEST=None, **kwargs): Set the product class of this software.
- def setProductKey(self, prodKey, manufacturer=No... | Implement the Python class `Hardware` described below.
Class description:
Hardware object
Method signatures and docstrings:
- def setProduct(self, productName, manufacturer='Unknown', newProductName='', REQUEST=None, **kwargs): Set the product class of this software.
- def setProductKey(self, prodKey, manufacturer=No... | 1ea508c3d2b51742bc3b448c445cd0a3dba9e798 | <|skeleton|>
class Hardware:
"""Hardware object"""
def setProduct(self, productName, manufacturer='Unknown', newProductName='', REQUEST=None, **kwargs):
"""Set the product class of this software."""
<|body_0|>
def setProductKey(self, prodKey, manufacturer=None):
"""Set the product ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Hardware:
"""Hardware object"""
def setProduct(self, productName, manufacturer='Unknown', newProductName='', REQUEST=None, **kwargs):
"""Set the product class of this software."""
if not manufacturer:
manufacturer = 'Unknown'
if newProductName:
productName ... | the_stack_v2_python_sparse | Products/ZenModel/Hardware.py | zenoss/zenoss-prodbin | train | 27 |
4e5481eb3fc93e65a41731a58f352d68de49604b | [
"config_builder.add(CommonStoreKeys.OP_ID.key, None)\nconfig_builder.add(CommonStoreKeys.EXECUTION_ID.key, None)\nconfig_builder.add(CommonStoreKeys.ATTEMPT_ID.key, None)",
"op_id = context.configuration.get_value(CommonStoreKeys.OP_ID.key)\nexecution_id = context.configuration.get_value(CommonStoreKeys.EXECUTION... | <|body_start_0|>
config_builder.add(CommonStoreKeys.OP_ID.key, None)
config_builder.add(CommonStoreKeys.EXECUTION_ID.key, None)
config_builder.add(CommonStoreKeys.ATTEMPT_ID.key, None)
<|end_body_0|>
<|body_start_1|>
op_id = context.configuration.get_value(CommonStoreKeys.OP_ID.key)
... | Initialize in the StateStore common runtime attributes | RuntimeStateInitializePlugin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RuntimeStateInitializePlugin:
"""Initialize in the StateStore common runtime attributes"""
def vdk_configure(self, config_builder: ConfigurationBuilder) -> None:
"""Some job attributes like op_id can be passed externally as configuration."""
<|body_0|>
def vdk_initialize... | stack_v2_sparse_classes_10k_train_002460 | 4,888 | permissive | [
{
"docstring": "Some job attributes like op_id can be passed externally as configuration.",
"name": "vdk_configure",
"signature": "def vdk_configure(self, config_builder: ConfigurationBuilder) -> None"
},
{
"docstring": "Setup common state attributes of the app (CommonStoreKeys). Configuration c... | 2 | null | Implement the Python class `RuntimeStateInitializePlugin` described below.
Class description:
Initialize in the StateStore common runtime attributes
Method signatures and docstrings:
- def vdk_configure(self, config_builder: ConfigurationBuilder) -> None: Some job attributes like op_id can be passed externally as con... | Implement the Python class `RuntimeStateInitializePlugin` described below.
Class description:
Initialize in the StateStore common runtime attributes
Method signatures and docstrings:
- def vdk_configure(self, config_builder: ConfigurationBuilder) -> None: Some job attributes like op_id can be passed externally as con... | 9ac18145c6a32e0c3ae035b99796e87184a53522 | <|skeleton|>
class RuntimeStateInitializePlugin:
"""Initialize in the StateStore common runtime attributes"""
def vdk_configure(self, config_builder: ConfigurationBuilder) -> None:
"""Some job attributes like op_id can be passed externally as configuration."""
<|body_0|>
def vdk_initialize... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RuntimeStateInitializePlugin:
"""Initialize in the StateStore common runtime attributes"""
def vdk_configure(self, config_builder: ConfigurationBuilder) -> None:
"""Some job attributes like op_id can be passed externally as configuration."""
config_builder.add(CommonStoreKeys.OP_ID.key, N... | the_stack_v2_python_sparse | projects/vdk-core/src/vdk/internal/builtin_plugins/builtin_hook_impl.py | savadev/versatile-data-kit | train | 0 |
40d2d842b3b1cd030ada3b5898bc6ca763b843c2 | [
"reward = torch.ones(2)\nsequence_length = torch.tensor([3, 5])\ndiscounted_reward = rewards.discount_reward(reward, sequence_length, discount=1.0)\ndiscounted_reward_n = rewards.discount_reward(reward, sequence_length, discount=0.1, normalize=True)\ndiscounted_reward_ = rewards.discount_reward(reward, sequence_len... | <|body_start_0|>
reward = torch.ones(2)
sequence_length = torch.tensor([3, 5])
discounted_reward = rewards.discount_reward(reward, sequence_length, discount=1.0)
discounted_reward_n = rewards.discount_reward(reward, sequence_length, discount=0.1, normalize=True)
discounted_reward... | Tests reward related functions. | RewardTest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RewardTest:
"""Tests reward related functions."""
def test_discount_reward(self):
"""Tests :func:`texar.torch.losses.rewards.discount_reward`"""
<|body_0|>
def test_discount_reward_tensor_1d(self):
"""Tests :func:`texar.torch.losses.rewards._discount_reward_tenso... | stack_v2_sparse_classes_10k_train_002461 | 4,889 | permissive | [
{
"docstring": "Tests :func:`texar.torch.losses.rewards.discount_reward`",
"name": "test_discount_reward",
"signature": "def test_discount_reward(self)"
},
{
"docstring": "Tests :func:`texar.torch.losses.rewards._discount_reward_tensor_1d`",
"name": "test_discount_reward_tensor_1d",
"sig... | 3 | stack_v2_sparse_classes_30k_train_002328 | Implement the Python class `RewardTest` described below.
Class description:
Tests reward related functions.
Method signatures and docstrings:
- def test_discount_reward(self): Tests :func:`texar.torch.losses.rewards.discount_reward`
- def test_discount_reward_tensor_1d(self): Tests :func:`texar.torch.losses.rewards._... | Implement the Python class `RewardTest` described below.
Class description:
Tests reward related functions.
Method signatures and docstrings:
- def test_discount_reward(self): Tests :func:`texar.torch.losses.rewards.discount_reward`
- def test_discount_reward_tensor_1d(self): Tests :func:`texar.torch.losses.rewards._... | 931ead9222ca90bfc75c3045dc79fb118de340c9 | <|skeleton|>
class RewardTest:
"""Tests reward related functions."""
def test_discount_reward(self):
"""Tests :func:`texar.torch.losses.rewards.discount_reward`"""
<|body_0|>
def test_discount_reward_tensor_1d(self):
"""Tests :func:`texar.torch.losses.rewards._discount_reward_tenso... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RewardTest:
"""Tests reward related functions."""
def test_discount_reward(self):
"""Tests :func:`texar.torch.losses.rewards.discount_reward`"""
reward = torch.ones(2)
sequence_length = torch.tensor([3, 5])
discounted_reward = rewards.discount_reward(reward, sequence_lengt... | the_stack_v2_python_sparse | texar/torch/losses/rewards_test.py | panaali/texar-pytorch | train | 1 |
5a866f7ed3243b014c36d9fffeec10b9cd2b94f3 | [
"try:\n profile = Profile.objects.get(user=request.user)\nexcept Profile.DoesNotExist:\n if request.user.is_superuser:\n return Rating.objects.all()\nif profile.access == 'teacher':\n return Rating.objects.filter(subject__teacher__profile_id=profile.id)\nif profile.access == 'student':\n return R... | <|body_start_0|>
try:
profile = Profile.objects.get(user=request.user)
except Profile.DoesNotExist:
if request.user.is_superuser:
return Rating.objects.all()
if profile.access == 'teacher':
return Rating.objects.filter(subject__teacher__profile... | RatingAdmin | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RatingAdmin:
def get_queryset(self, request):
"""Get all marks for current profile"""
<|body_0|>
def formfield_for_foreignkey(self, db_field, request, **kwargs):
"""Set default teacher"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
try:
... | stack_v2_sparse_classes_10k_train_002462 | 2,628 | no_license | [
{
"docstring": "Get all marks for current profile",
"name": "get_queryset",
"signature": "def get_queryset(self, request)"
},
{
"docstring": "Set default teacher",
"name": "formfield_for_foreignkey",
"signature": "def formfield_for_foreignkey(self, db_field, request, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003660 | Implement the Python class `RatingAdmin` described below.
Class description:
Implement the RatingAdmin class.
Method signatures and docstrings:
- def get_queryset(self, request): Get all marks for current profile
- def formfield_for_foreignkey(self, db_field, request, **kwargs): Set default teacher | Implement the Python class `RatingAdmin` described below.
Class description:
Implement the RatingAdmin class.
Method signatures and docstrings:
- def get_queryset(self, request): Get all marks for current profile
- def formfield_for_foreignkey(self, db_field, request, **kwargs): Set default teacher
<|skeleton|>
clas... | 76c0df6f07f41f4baf7346acdbbf316b4dd13ee5 | <|skeleton|>
class RatingAdmin:
def get_queryset(self, request):
"""Get all marks for current profile"""
<|body_0|>
def formfield_for_foreignkey(self, db_field, request, **kwargs):
"""Set default teacher"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RatingAdmin:
def get_queryset(self, request):
"""Get all marks for current profile"""
try:
profile = Profile.objects.get(user=request.user)
except Profile.DoesNotExist:
if request.user.is_superuser:
return Rating.objects.all()
if profile.... | the_stack_v2_python_sparse | journal/admin.py | HallrizonX/api_chpk | train | 3 | |
adbf410bd5c87415c82ffabead0805a0846f1089 | [
"d = set()\nfor i in nums:\n if i in d:\n return True\n else:\n d.add(i)\nreturn False",
"if len(nums) == 0:\n return False\nnums.sort()\nfor i in range(0, len(nums) - 1):\n if nums[i] == nums[i + 1]:\n return True\nreturn False"
] | <|body_start_0|>
d = set()
for i in nums:
if i in d:
return True
else:
d.add(i)
return False
<|end_body_0|>
<|body_start_1|>
if len(nums) == 0:
return False
nums.sort()
for i in range(0, len(nums) - 1):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def containsDuplicate(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_0|>
def containsDuplicate2(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
d = set()
for i in num... | stack_v2_sparse_classes_10k_train_002463 | 1,137 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: bool",
"name": "containsDuplicate",
"signature": "def containsDuplicate(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: bool",
"name": "containsDuplicate2",
"signature": "def containsDuplicate2(self, nums)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def containsDuplicate(self, nums): :type nums: List[int] :rtype: bool
- def containsDuplicate2(self, nums): :type nums: List[int] :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def containsDuplicate(self, nums): :type nums: List[int] :rtype: bool
- def containsDuplicate2(self, nums): :type nums: List[int] :rtype: bool
<|skeleton|>
class Solution:
... | 813235789ce422a3bab198317aafc46fbc61625e | <|skeleton|>
class Solution:
def containsDuplicate(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_0|>
def containsDuplicate2(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def containsDuplicate(self, nums):
""":type nums: List[int] :rtype: bool"""
d = set()
for i in nums:
if i in d:
return True
else:
d.add(i)
return False
def containsDuplicate2(self, nums):
""":type nu... | the_stack_v2_python_sparse | 2.SET/e217_contains_duplicate/solution.py | kimmyoo/python_leetcode | train | 1 | |
d912062c54f0c1e8822b288e4fb9c3d4bc4748a2 | [
"value = self.display_iso(date_val)\nyear = self._slash_year(date_val[2], date_val[3])\nif self.format == 0:\n return self.display_iso(date_val)\nelif self.format == 1:\n if date_val[0] == 0:\n if date_val[1] == 0:\n value = year\n else:\n value = '%s m. %s' % (year, self.l... | <|body_start_0|>
value = self.display_iso(date_val)
year = self._slash_year(date_val[2], date_val[3])
if self.format == 0:
return self.display_iso(date_val)
elif self.format == 1:
if date_val[0] == 0:
if date_val[1] == 0:
value ... | Lithuanian language date display class. | DateDisplayLT | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DateDisplayLT:
"""Lithuanian language date display class."""
def _display_gregorian(self, date_val):
"""display gregorian calendar date in different format"""
<|body_0|>
def display(self, date):
"""Return a text string representing the date."""
<|body_1|>... | stack_v2_sparse_classes_10k_train_002464 | 10,035 | no_license | [
{
"docstring": "display gregorian calendar date in different format",
"name": "_display_gregorian",
"signature": "def _display_gregorian(self, date_val)"
},
{
"docstring": "Return a text string representing the date.",
"name": "display",
"signature": "def display(self, date)"
}
] | 2 | null | Implement the Python class `DateDisplayLT` described below.
Class description:
Lithuanian language date display class.
Method signatures and docstrings:
- def _display_gregorian(self, date_val): display gregorian calendar date in different format
- def display(self, date): Return a text string representing the date. | Implement the Python class `DateDisplayLT` described below.
Class description:
Lithuanian language date display class.
Method signatures and docstrings:
- def _display_gregorian(self, date_val): display gregorian calendar date in different format
- def display(self, date): Return a text string representing the date.
... | 0c79561bed7ff42c88714edbc85197fa9235e188 | <|skeleton|>
class DateDisplayLT:
"""Lithuanian language date display class."""
def _display_gregorian(self, date_val):
"""display gregorian calendar date in different format"""
<|body_0|>
def display(self, date):
"""Return a text string representing the date."""
<|body_1|>... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DateDisplayLT:
"""Lithuanian language date display class."""
def _display_gregorian(self, date_val):
"""display gregorian calendar date in different format"""
value = self.display_iso(date_val)
year = self._slash_year(date_val[2], date_val[3])
if self.format == 0:
... | the_stack_v2_python_sparse | gen/datehandler/_date_lt.py | balrok/gramps_addon | train | 2 |
a592506904a136807de4e6ca91df41214353c166 | [
"ans = '#'\nfor i in range(1, 7, 2):\n num = int(color[i:i + 2], 16)\n char = ''\n mind = float('inf')\n for j in range(16):\n dis = abs(j * 16 + j - num)\n if dis < mind:\n mind = dis\n char = j\n ans += str(hex(char))[2:] + str(hex(char))[2:]\nreturn ans",
"M =... | <|body_start_0|>
ans = '#'
for i in range(1, 7, 2):
num = int(color[i:i + 2], 16)
char = ''
mind = float('inf')
for j in range(16):
dis = abs(j * 16 + j - num)
if dis < mind:
mind = dis
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def similarRGB(self, color):
""":type color: str :rtype: str"""
<|body_0|>
def minSwap(self, A, B):
""":type A: List[int] :type B: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
ans = '#'
for i in range(1, 7,... | stack_v2_sparse_classes_10k_train_002465 | 1,198 | no_license | [
{
"docstring": ":type color: str :rtype: str",
"name": "similarRGB",
"signature": "def similarRGB(self, color)"
},
{
"docstring": ":type A: List[int] :type B: List[int] :rtype: int",
"name": "minSwap",
"signature": "def minSwap(self, A, B)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001018 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def similarRGB(self, color): :type color: str :rtype: str
- def minSwap(self, A, B): :type A: List[int] :type B: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def similarRGB(self, color): :type color: str :rtype: str
- def minSwap(self, A, B): :type A: List[int] :type B: List[int] :rtype: int
<|skeleton|>
class Solution:
def simi... | 8790abadd5289024794cd95529187c96111c2bd6 | <|skeleton|>
class Solution:
def similarRGB(self, color):
""":type color: str :rtype: str"""
<|body_0|>
def minSwap(self, A, B):
""":type A: List[int] :type B: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def similarRGB(self, color):
""":type color: str :rtype: str"""
ans = '#'
for i in range(1, 7, 2):
num = int(color[i:i + 2], 16)
char = ''
mind = float('inf')
for j in range(16):
dis = abs(j * 16 + j - num)
... | the_stack_v2_python_sparse | contests/contest76.py | minging234/LeetCode_ming | train | 0 | |
aa017ef900145843d226e8c236c84d1cf765c914 | [
"self._wrapperCheck(value)\nif self.getPropertyType(id) == 'keyedselection':\n value = int(value)\nsetattr(self, id, value)",
"for prop in self._propertyMap():\n name = prop['id']\n if 'w' in prop.get('mode', 'wd'):\n value = REQUEST.get(name, '')\n self._updateProperty(name, value)\nself.i... | <|body_start_0|>
self._wrapperCheck(value)
if self.getPropertyType(id) == 'keyedselection':
value = int(value)
setattr(self, id, value)
<|end_body_0|>
<|body_start_1|>
for prop in self._propertyMap():
name = prop['id']
if 'w' in prop.get('mode', 'wd')... | ConfmonPropManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConfmonPropManager:
def _setPropValue(self, id, value):
"""override from PerpertyManager to handle checks and ip creation"""
<|body_0|>
def manage_editProperties(self, REQUEST):
"""Edit object properties via the web. The purpose of this method is to change all proper... | stack_v2_sparse_classes_10k_train_002466 | 1,954 | no_license | [
{
"docstring": "override from PerpertyManager to handle checks and ip creation",
"name": "_setPropValue",
"signature": "def _setPropValue(self, id, value)"
},
{
"docstring": "Edit object properties via the web. The purpose of this method is to change all property values, even those not listed in... | 2 | null | Implement the Python class `ConfmonPropManager` described below.
Class description:
Implement the ConfmonPropManager class.
Method signatures and docstrings:
- def _setPropValue(self, id, value): override from PerpertyManager to handle checks and ip creation
- def manage_editProperties(self, REQUEST): Edit object pro... | Implement the Python class `ConfmonPropManager` described below.
Class description:
Implement the ConfmonPropManager class.
Method signatures and docstrings:
- def _setPropValue(self, id, value): override from PerpertyManager to handle checks and ip creation
- def manage_editProperties(self, REQUEST): Edit object pro... | 1ea508c3d2b51742bc3b448c445cd0a3dba9e798 | <|skeleton|>
class ConfmonPropManager:
def _setPropValue(self, id, value):
"""override from PerpertyManager to handle checks and ip creation"""
<|body_0|>
def manage_editProperties(self, REQUEST):
"""Edit object properties via the web. The purpose of this method is to change all proper... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ConfmonPropManager:
def _setPropValue(self, id, value):
"""override from PerpertyManager to handle checks and ip creation"""
self._wrapperCheck(value)
if self.getPropertyType(id) == 'keyedselection':
value = int(value)
setattr(self, id, value)
def manage_editPr... | the_stack_v2_python_sparse | Products/ZenModel/ConfmonPropManager.py | zenoss/zenoss-prodbin | train | 27 | |
4ac5df82d902d026ff4d7c73eb49f1d6d4d51d99 | [
"referral = self.context['referral']\nif referral.status != CompanyReferral.Status.OUTSTANDING:\n raise serializers.ValidationError(self.error_messages['invalid_status'])\nreturn super().validate(data)",
"referral = self.context['referral']\nuser = self.context['user']\ninteraction = super().save(created_by=us... | <|body_start_0|>
referral = self.context['referral']
if referral.status != CompanyReferral.Status.OUTSTANDING:
raise serializers.ValidationError(self.error_messages['invalid_status'])
return super().validate(data)
<|end_body_0|>
<|body_start_1|>
referral = self.context['refe... | Serialiser for the complete a referral view. | CompleteCompanyReferralSerializer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CompleteCompanyReferralSerializer:
"""Serialiser for the complete a referral view."""
def validate(self, data):
"""Validate provided data. Checks that the referral has the expected status."""
<|body_0|>
def save(self):
"""Create an interaction and update the refe... | stack_v2_sparse_classes_10k_train_002467 | 2,478 | permissive | [
{
"docstring": "Validate provided data. Checks that the referral has the expected status.",
"name": "validate",
"signature": "def validate(self, data)"
},
{
"docstring": "Create an interaction and update the referral object.",
"name": "save",
"signature": "def save(self)"
}
] | 2 | null | Implement the Python class `CompleteCompanyReferralSerializer` described below.
Class description:
Serialiser for the complete a referral view.
Method signatures and docstrings:
- def validate(self, data): Validate provided data. Checks that the referral has the expected status.
- def save(self): Create an interactio... | Implement the Python class `CompleteCompanyReferralSerializer` described below.
Class description:
Serialiser for the complete a referral view.
Method signatures and docstrings:
- def validate(self, data): Validate provided data. Checks that the referral has the expected status.
- def save(self): Create an interactio... | a92faabf73fb93b5bfd94fd465eafc3e29aa6d8e | <|skeleton|>
class CompleteCompanyReferralSerializer:
"""Serialiser for the complete a referral view."""
def validate(self, data):
"""Validate provided data. Checks that the referral has the expected status."""
<|body_0|>
def save(self):
"""Create an interaction and update the refe... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CompleteCompanyReferralSerializer:
"""Serialiser for the complete a referral view."""
def validate(self, data):
"""Validate provided data. Checks that the referral has the expected status."""
referral = self.context['referral']
if referral.status != CompanyReferral.Status.OUTSTAND... | the_stack_v2_python_sparse | datahub/company_referral/serializers.py | cgsunkel/data-hub-api | train | 0 |
8fd147a88f6df4ee9c477c301c500fae331e8d70 | [
"self.results = {}\nself.calls = 0\nself.arg_names = None",
"if self.arg_names is not None:\n raise AssertionError('Instantiate a new Memoizer for each function')\nself.arg_names = inspect.getfullargspec(func).args\n\n@wraps(func)\ndef wrapper(*args, **kwargs):\n key = ', '.join([\"('{}', {})\".format(arg_n... | <|body_start_0|>
self.results = {}
self.calls = 0
self.arg_names = None
<|end_body_0|>
<|body_start_1|>
if self.arg_names is not None:
raise AssertionError('Instantiate a new Memoizer for each function')
self.arg_names = inspect.getfullargspec(func).args
@wr... | Memoizer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Memoizer:
def __init__(self):
"""Class to store the results of a function given a set of inputs."""
<|body_0|>
def __call__(self, func):
"""Memoize decorator. Any time a function is called that a memoizer has been attached to its results are stored in the results dic... | stack_v2_sparse_classes_10k_train_002468 | 25,943 | permissive | [
{
"docstring": "Class to store the results of a function given a set of inputs.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Memoize decorator. Any time a function is called that a memoizer has been attached to its results are stored in the results dictionary or ret... | 2 | stack_v2_sparse_classes_30k_train_005879 | Implement the Python class `Memoizer` described below.
Class description:
Implement the Memoizer class.
Method signatures and docstrings:
- def __init__(self): Class to store the results of a function given a set of inputs.
- def __call__(self, func): Memoize decorator. Any time a function is called that a memoizer h... | Implement the Python class `Memoizer` described below.
Class description:
Implement the Memoizer class.
Method signatures and docstrings:
- def __init__(self): Class to store the results of a function given a set of inputs.
- def __call__(self, func): Memoize decorator. Any time a function is called that a memoizer h... | c21e8859bdb20737352147b9904797ac99985b73 | <|skeleton|>
class Memoizer:
def __init__(self):
"""Class to store the results of a function given a set of inputs."""
<|body_0|>
def __call__(self, func):
"""Memoize decorator. Any time a function is called that a memoizer has been attached to its results are stored in the results dic... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Memoizer:
def __init__(self):
"""Class to store the results of a function given a set of inputs."""
self.results = {}
self.calls = 0
self.arg_names = None
def __call__(self, func):
"""Memoize decorator. Any time a function is called that a memoizer has been attache... | the_stack_v2_python_sparse | autoarray/structures/arrays/two_d/array_2d_util.py | jonathanfrawley/PyAutoArray_copy | train | 0 | |
ec31171c670921b7098b89c7f4def7138c8db5b4 | [
"from collections import deque\nself.nums = deque()\nself.size = size\nself.sum = 0",
"if len(self.nums) == self.size:\n self.sum -= self.nums.popleft()\nself.nums.append(val)\nself.sum += val\nreturn float(self.sum) / len(self.nums)"
] | <|body_start_0|>
from collections import deque
self.nums = deque()
self.size = size
self.sum = 0
<|end_body_0|>
<|body_start_1|>
if len(self.nums) == self.size:
self.sum -= self.nums.popleft()
self.nums.append(val)
self.sum += val
return float... | MovingAverage | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MovingAverage:
def __init__(self, size):
"""Initialize your data structure here. :type size: int"""
<|body_0|>
def next(self, val):
""":type val: int :rtype: float"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
from collections import deque
... | stack_v2_sparse_classes_10k_train_002469 | 812 | no_license | [
{
"docstring": "Initialize your data structure here. :type size: int",
"name": "__init__",
"signature": "def __init__(self, size)"
},
{
"docstring": ":type val: int :rtype: float",
"name": "next",
"signature": "def next(self, val)"
}
] | 2 | null | Implement the Python class `MovingAverage` described below.
Class description:
Implement the MovingAverage class.
Method signatures and docstrings:
- def __init__(self, size): Initialize your data structure here. :type size: int
- def next(self, val): :type val: int :rtype: float | Implement the Python class `MovingAverage` described below.
Class description:
Implement the MovingAverage class.
Method signatures and docstrings:
- def __init__(self, size): Initialize your data structure here. :type size: int
- def next(self, val): :type val: int :rtype: float
<|skeleton|>
class MovingAverage:
... | fe79161211cc08c269cde9e1fdcfed27de11f2cb | <|skeleton|>
class MovingAverage:
def __init__(self, size):
"""Initialize your data structure here. :type size: int"""
<|body_0|>
def next(self, val):
""":type val: int :rtype: float"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MovingAverage:
def __init__(self, size):
"""Initialize your data structure here. :type size: int"""
from collections import deque
self.nums = deque()
self.size = size
self.sum = 0
def next(self, val):
""":type val: int :rtype: float"""
if len(self.n... | the_stack_v2_python_sparse | MyLeetCode/python/Moving Average from Data Stream.py | ihuei801/leetcode | train | 0 | |
5dc4e213daef57cb10919bb09b98075aeb004d7a | [
"dummy = ListNode(float('-inf'))\nfor i in lists:\n dummy = self.merge_two(dummy, i)\nreturn dummy.next",
"curr = dummy = ListNode('X')\nwhile l1 and l2:\n if l1.val < l2.val:\n curr.next, l1 = (l1, l1.next)\n else:\n curr.next, l2 = (l2, l2.next)\n curr = curr.next\ncurr.next = l1 or l2... | <|body_start_0|>
dummy = ListNode(float('-inf'))
for i in lists:
dummy = self.merge_two(dummy, i)
return dummy.next
<|end_body_0|>
<|body_start_1|>
curr = dummy = ListNode('X')
while l1 and l2:
if l1.val < l2.val:
curr.next, l1 = (l1, l1.n... | SolutionC1 | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SolutionC1:
def mergeKLists(self, lists: List[ListNode]) -> ListNode:
"""use merge two list, then use it multiple times 但是这个合并的方法偏慢, 相当于要流经的重复节点太多次了"""
<|body_0|>
def merge_two(self, l1: ListNode, l2: ListNode) -> ListNode:
"""Helper for Solution C1 and C2 (now set o... | stack_v2_sparse_classes_10k_train_002470 | 4,145 | permissive | [
{
"docstring": "use merge two list, then use it multiple times 但是这个合并的方法偏慢, 相当于要流经的重复节点太多次了",
"name": "mergeKLists",
"signature": "def mergeKLists(self, lists: List[ListNode]) -> ListNode"
},
{
"docstring": "Helper for Solution C1 and C2 (now set out side of the Solution) merge two sorted linked... | 2 | null | Implement the Python class `SolutionC1` described below.
Class description:
Implement the SolutionC1 class.
Method signatures and docstrings:
- def mergeKLists(self, lists: List[ListNode]) -> ListNode: use merge two list, then use it multiple times 但是这个合并的方法偏慢, 相当于要流经的重复节点太多次了
- def merge_two(self, l1: ListNode, l2: ... | Implement the Python class `SolutionC1` described below.
Class description:
Implement the SolutionC1 class.
Method signatures and docstrings:
- def mergeKLists(self, lists: List[ListNode]) -> ListNode: use merge two list, then use it multiple times 但是这个合并的方法偏慢, 相当于要流经的重复节点太多次了
- def merge_two(self, l1: ListNode, l2: ... | 143422321cbc3715ca08f6c3af8f960a55887ced | <|skeleton|>
class SolutionC1:
def mergeKLists(self, lists: List[ListNode]) -> ListNode:
"""use merge two list, then use it multiple times 但是这个合并的方法偏慢, 相当于要流经的重复节点太多次了"""
<|body_0|>
def merge_two(self, l1: ListNode, l2: ListNode) -> ListNode:
"""Helper for Solution C1 and C2 (now set o... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SolutionC1:
def mergeKLists(self, lists: List[ListNode]) -> ListNode:
"""use merge two list, then use it multiple times 但是这个合并的方法偏慢, 相当于要流经的重复节点太多次了"""
dummy = ListNode(float('-inf'))
for i in lists:
dummy = self.merge_two(dummy, i)
return dummy.next
def merge_... | the_stack_v2_python_sparse | LeetCode/LC023_merge_k_sorted_list.py | jxie0755/Learning_Python | train | 0 | |
881b49ebba8baffa4a6e668f02f681078e9beb23 | [
"if size <= 0:\n raise ValueError('Expected positive integer, got %d' % size)\nself.size = size\nself.paulis = PauliMatrices(self.size)\nself.num_params = len(self.paulis)\nself.sigmav = -1j / self.get_dim() * self.paulis.get_numpy()",
"self.check_parameters(params)\nH = dot_product(params, self.sigmav)\neiH =... | <|body_start_0|>
if size <= 0:
raise ValueError('Expected positive integer, got %d' % size)
self.size = size
self.paulis = PauliMatrices(self.size)
self.num_params = len(self.paulis)
self.sigmav = -1j / self.get_dim() * self.paulis.get_numpy()
<|end_body_0|>
<|body_s... | A gate representing an arbitrary rotation. | PauliGate | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PauliGate:
"""A gate representing an arbitrary rotation."""
def __init__(self, size: int) -> None:
"""Create a PauliGate acting on `size` qubits."""
<|body_0|>
def get_unitary(self, params: Sequence[float]=[]) -> UnitaryMatrix:
"""Returns the unitary for this gat... | stack_v2_sparse_classes_10k_train_002471 | 2,425 | permissive | [
{
"docstring": "Create a PauliGate acting on `size` qubits.",
"name": "__init__",
"signature": "def __init__(self, size: int) -> None"
},
{
"docstring": "Returns the unitary for this gate, see Unitary for more info.",
"name": "get_unitary",
"signature": "def get_unitary(self, params: Seq... | 5 | stack_v2_sparse_classes_30k_train_000324 | Implement the Python class `PauliGate` described below.
Class description:
A gate representing an arbitrary rotation.
Method signatures and docstrings:
- def __init__(self, size: int) -> None: Create a PauliGate acting on `size` qubits.
- def get_unitary(self, params: Sequence[float]=[]) -> UnitaryMatrix: Returns the... | Implement the Python class `PauliGate` described below.
Class description:
A gate representing an arbitrary rotation.
Method signatures and docstrings:
- def __init__(self, size: int) -> None: Create a PauliGate acting on `size` qubits.
- def get_unitary(self, params: Sequence[float]=[]) -> UnitaryMatrix: Returns the... | 3083218c2f4e3c3ce4ba027d12caa30c384d7665 | <|skeleton|>
class PauliGate:
"""A gate representing an arbitrary rotation."""
def __init__(self, size: int) -> None:
"""Create a PauliGate acting on `size` qubits."""
<|body_0|>
def get_unitary(self, params: Sequence[float]=[]) -> UnitaryMatrix:
"""Returns the unitary for this gat... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PauliGate:
"""A gate representing an arbitrary rotation."""
def __init__(self, size: int) -> None:
"""Create a PauliGate acting on `size` qubits."""
if size <= 0:
raise ValueError('Expected positive integer, got %d' % size)
self.size = size
self.paulis = PauliM... | the_stack_v2_python_sparse | bqskit/ir/gates/parameterized/pauli.py | mtreinish/bqskit | train | 0 |
85fe12ca643e635b08203cf5bbdad122d2373a8e | [
"if not has_perm(self.request.user, 'core.can_see_history'):\n self.permission_denied(self.request)\ntype = self.request.query_params.get('type')\nvalue = self.request.query_params.get('value')\nif type not in 'element':\n raise ValidationError({'detail': \"Invalid input. Type should be 'element' or 'text'.\"... | <|body_start_0|>
if not has_perm(self.request.user, 'core.can_see_history'):
self.permission_denied(self.request)
type = self.request.query_params.get('type')
value = self.request.query_params.get('value')
if type not in 'element':
raise ValidationError({'detail':... | View to retrieve information about OpenSlides history. Use GET to search history information. The query parameter 'type' determines the type of your search: Examples: /?type=element&value=motions%2Fmotion%3A42 if your search for motion 42 Use DELETE to clear the history. | HistoryInformationView | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HistoryInformationView:
"""View to retrieve information about OpenSlides history. Use GET to search history information. The query parameter 'type' determines the type of your search: Examples: /?type=element&value=motions%2Fmotion%3A42 if your search for motion 42 Use DELETE to clear the history... | stack_v2_sparse_classes_10k_train_002472 | 24,920 | permissive | [
{
"docstring": "Checks permission and parses query parameters.",
"name": "get_context_data",
"signature": "def get_context_data(self, **context)"
},
{
"docstring": "Retrieves history information for element search.",
"name": "get_data_element_search",
"signature": "def get_data_element_s... | 3 | null | Implement the Python class `HistoryInformationView` described below.
Class description:
View to retrieve information about OpenSlides history. Use GET to search history information. The query parameter 'type' determines the type of your search: Examples: /?type=element&value=motions%2Fmotion%3A42 if your search for mo... | Implement the Python class `HistoryInformationView` described below.
Class description:
View to retrieve information about OpenSlides history. Use GET to search history information. The query parameter 'type' determines the type of your search: Examples: /?type=element&value=motions%2Fmotion%3A42 if your search for mo... | 7dc35dce404339b41c7729eb3de29010ca63f9a0 | <|skeleton|>
class HistoryInformationView:
"""View to retrieve information about OpenSlides history. Use GET to search history information. The query parameter 'type' determines the type of your search: Examples: /?type=element&value=motions%2Fmotion%3A42 if your search for motion 42 Use DELETE to clear the history... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class HistoryInformationView:
"""View to retrieve information about OpenSlides history. Use GET to search history information. The query parameter 'type' determines the type of your search: Examples: /?type=element&value=motions%2Fmotion%3A42 if your search for motion 42 Use DELETE to clear the history."""
def... | the_stack_v2_python_sparse | server/openslides/core/views.py | FinnStutzenstein/OpenSlides | train | 0 |
b72494013d0c70a7d2dac223a4b3851734505098 | [
"nonexistent_las = 'nonexistent.las'\nnonexistent_ply = 'nonexistent.ply'\nload(nonexistent_las, nonexistent_ply)\nload_las_mock.assert_called_once_with(nonexistent_las)",
"nonexistent_las = 'nonexistent.las'\nnonexistent_ply = 'nonexistent.ply'\nload(nonexistent_las, nonexistent_ply)\nwrite_ply_mock.assert_calle... | <|body_start_0|>
nonexistent_las = 'nonexistent.las'
nonexistent_ply = 'nonexistent.ply'
load(nonexistent_las, nonexistent_ply)
load_las_mock.assert_called_once_with(nonexistent_las)
<|end_body_0|>
<|body_start_1|>
nonexistent_las = 'nonexistent.las'
nonexistent_ply = 'n... | TestLoad | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestLoad:
def test_load(self, load_las_mock, write_ply_mock):
"""Load module should call load_las to get the file."""
<|body_0|>
def test_write(self, load_las_mock, write_ply_mock):
"""Load module should call write_ply to get the file."""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_10k_train_002473 | 1,251 | permissive | [
{
"docstring": "Load module should call load_las to get the file.",
"name": "test_load",
"signature": "def test_load(self, load_las_mock, write_ply_mock)"
},
{
"docstring": "Load module should call write_ply to get the file.",
"name": "test_write",
"signature": "def test_write(self, load... | 2 | stack_v2_sparse_classes_30k_train_002632 | Implement the Python class `TestLoad` described below.
Class description:
Implement the TestLoad class.
Method signatures and docstrings:
- def test_load(self, load_las_mock, write_ply_mock): Load module should call load_las to get the file.
- def test_write(self, load_las_mock, write_ply_mock): Load module should ca... | Implement the Python class `TestLoad` described below.
Class description:
Implement the TestLoad class.
Method signatures and docstrings:
- def test_load(self, load_las_mock, write_ply_mock): Load module should call load_las to get the file.
- def test_write(self, load_las_mock, write_ply_mock): Load module should ca... | 8053cf6f31a7e62b0c4d1d2586284c37da8f13fb | <|skeleton|>
class TestLoad:
def test_load(self, load_las_mock, write_ply_mock):
"""Load module should call load_las to get the file."""
<|body_0|>
def test_write(self, load_las_mock, write_ply_mock):
"""Load module should call write_ply to get the file."""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestLoad:
def test_load(self, load_las_mock, write_ply_mock):
"""Load module should call load_las to get the file."""
nonexistent_las = 'nonexistent.las'
nonexistent_ply = 'nonexistent.ply'
load(nonexistent_las, nonexistent_ply)
load_las_mock.assert_called_once_with(non... | the_stack_v2_python_sparse | laserchicken/test_load.py | rubenvalpue/laserchicken | train | 0 | |
4d5e8f7bce16534835cb54723402c0442eb632d7 | [
"self.mean = float(mean)\nself.stddev = float(stddev)\nif stddev < 1:\n raise ValueError('stddev must be a positive value')\nif data is not None and (not isinstance(data, list)):\n raise TypeError('data must be a list')\nif isinstance(data, list) and len(data) < 2:\n raise ValueError('data must contain mul... | <|body_start_0|>
self.mean = float(mean)
self.stddev = float(stddev)
if stddev < 1:
raise ValueError('stddev must be a positive value')
if data is not None and (not isinstance(data, list)):
raise TypeError('data must be a list')
if isinstance(data, list) a... | class Normal | Normal | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Normal:
"""class Normal"""
def __init__(self, data=None, mean=0.0, stddev=1.0):
"""data is a list of the data to be used to estimate the distribution mean is the mean of the distribution stddev is the standard deviation of the distribution Sets the instance attributes mean and stddev... | stack_v2_sparse_classes_10k_train_002474 | 2,397 | no_license | [
{
"docstring": "data is a list of the data to be used to estimate the distribution mean is the mean of the distribution stddev is the standard deviation of the distribution Sets the instance attributes mean and stddev",
"name": "__init__",
"signature": "def __init__(self, data=None, mean=0.0, stddev=1.0... | 5 | stack_v2_sparse_classes_30k_train_007198 | Implement the Python class `Normal` described below.
Class description:
class Normal
Method signatures and docstrings:
- def __init__(self, data=None, mean=0.0, stddev=1.0): data is a list of the data to be used to estimate the distribution mean is the mean of the distribution stddev is the standard deviation of the ... | Implement the Python class `Normal` described below.
Class description:
class Normal
Method signatures and docstrings:
- def __init__(self, data=None, mean=0.0, stddev=1.0): data is a list of the data to be used to estimate the distribution mean is the mean of the distribution stddev is the standard deviation of the ... | 4a7a8ff0c4f785656a395d0abf4f182ce1fef5bc | <|skeleton|>
class Normal:
"""class Normal"""
def __init__(self, data=None, mean=0.0, stddev=1.0):
"""data is a list of the data to be used to estimate the distribution mean is the mean of the distribution stddev is the standard deviation of the distribution Sets the instance attributes mean and stddev... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Normal:
"""class Normal"""
def __init__(self, data=None, mean=0.0, stddev=1.0):
"""data is a list of the data to be used to estimate the distribution mean is the mean of the distribution stddev is the standard deviation of the distribution Sets the instance attributes mean and stddev"""
s... | the_stack_v2_python_sparse | math/0x03-probability/normal.py | xica369/holbertonschool-machine_learning | train | 0 |
ee225ac9bf012a3d7824915fa9e698ad0e1aca64 | [
"assert isinstance(gf, callflow.GraphFrame)\nassert 'component_path' in gf.df.columns\npaths = self.callsite_paths(callsites)\nmodule_name_group_df = gf.df.groupby(['module', 'name'])\nfor path in paths:\n component_edges = self.create_source_targets(path['component_path'])\n for idx, edge in enumerate(compon... | <|body_start_0|>
assert isinstance(gf, callflow.GraphFrame)
assert 'component_path' in gf.df.columns
paths = self.callsite_paths(callsites)
module_name_group_df = gf.df.groupby(['module', 'name'])
for path in paths:
component_edges = self.create_source_targets(path['c... | Split a callee if it is a module. | SplitCallee | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SplitCallee:
"""Split a callee if it is a module."""
def __init__(self, gf, callsites):
""":param gf: :param callsites:"""
<|body_0|>
def create_source_targets(self, component_path):
""":param component_path: :return:"""
<|body_1|>
def callsite_paths... | stack_v2_sparse_classes_10k_train_002475 | 4,324 | permissive | [
{
"docstring": ":param gf: :param callsites:",
"name": "__init__",
"signature": "def __init__(self, gf, callsites)"
},
{
"docstring": ":param component_path: :return:",
"name": "create_source_targets",
"signature": "def create_source_targets(self, component_path)"
},
{
"docstring... | 3 | stack_v2_sparse_classes_30k_train_002888 | Implement the Python class `SplitCallee` described below.
Class description:
Split a callee if it is a module.
Method signatures and docstrings:
- def __init__(self, gf, callsites): :param gf: :param callsites:
- def create_source_targets(self, component_path): :param component_path: :return:
- def callsite_paths(sel... | Implement the Python class `SplitCallee` described below.
Class description:
Split a callee if it is a module.
Method signatures and docstrings:
- def __init__(self, gf, callsites): :param gf: :param callsites:
- def create_source_targets(self, component_path): :param component_path: :return:
- def callsite_paths(sel... | 6bbdabe4b71be369e616e3136d7f0120531c9fc8 | <|skeleton|>
class SplitCallee:
"""Split a callee if it is a module."""
def __init__(self, gf, callsites):
""":param gf: :param callsites:"""
<|body_0|>
def create_source_targets(self, component_path):
""":param component_path: :return:"""
<|body_1|>
def callsite_paths... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SplitCallee:
"""Split a callee if it is a module."""
def __init__(self, gf, callsites):
""":param gf: :param callsites:"""
assert isinstance(gf, callflow.GraphFrame)
assert 'component_path' in gf.df.columns
paths = self.callsite_paths(callsites)
module_name_group_d... | the_stack_v2_python_sparse | callflow/operations/split_callee.py | LLNL/CallFlow | train | 32 |
e778ecf5e261d1613886e2203374cef870b1e693 | [
"self.id = id\nself.street = street\nself.number = number\nself.complement = complement\nself.zip_code = zip_code\nself.neighborhood = neighborhood\nself.city = city\nself.state = state\nself.country = country\nself.status = status\nself.created_at = APIHelper.RFC3339DateTime(created_at) if created_at else None\nse... | <|body_start_0|>
self.id = id
self.street = street
self.number = number
self.complement = complement
self.zip_code = zip_code
self.neighborhood = neighborhood
self.city = city
self.state = state
self.country = country
self.status = status
... | Implementation of the 'GetAddressResponse' model. Response object for getting an Address Attributes: id (string): TODO: type description here. street (string): TODO: type description here. number (string): TODO: type description here. complement (string): TODO: type description here. zip_code (string): TODO: type descr... | GetAddressResponse | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GetAddressResponse:
"""Implementation of the 'GetAddressResponse' model. Response object for getting an Address Attributes: id (string): TODO: type description here. street (string): TODO: type description here. number (string): TODO: type description here. complement (string): TODO: type descrip... | stack_v2_sparse_classes_10k_train_002476 | 5,631 | permissive | [
{
"docstring": "Constructor for the GetAddressResponse class",
"name": "__init__",
"signature": "def __init__(self, id=None, street=None, number=None, complement=None, zip_code=None, neighborhood=None, city=None, state=None, country=None, status=None, created_at=None, updated_at=None, metadata=None, lin... | 2 | stack_v2_sparse_classes_30k_train_002149 | Implement the Python class `GetAddressResponse` described below.
Class description:
Implementation of the 'GetAddressResponse' model. Response object for getting an Address Attributes: id (string): TODO: type description here. street (string): TODO: type description here. number (string): TODO: type description here. ... | Implement the Python class `GetAddressResponse` described below.
Class description:
Implementation of the 'GetAddressResponse' model. Response object for getting an Address Attributes: id (string): TODO: type description here. street (string): TODO: type description here. number (string): TODO: type description here. ... | 95c80c35dd57bb2a238faeaf30d1e3b4544d2298 | <|skeleton|>
class GetAddressResponse:
"""Implementation of the 'GetAddressResponse' model. Response object for getting an Address Attributes: id (string): TODO: type description here. street (string): TODO: type description here. number (string): TODO: type description here. complement (string): TODO: type descrip... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GetAddressResponse:
"""Implementation of the 'GetAddressResponse' model. Response object for getting an Address Attributes: id (string): TODO: type description here. street (string): TODO: type description here. number (string): TODO: type description here. complement (string): TODO: type description here. zi... | the_stack_v2_python_sparse | mundiapi/models/get_address_response.py | mundipagg/MundiAPI-PYTHON | train | 10 |
49459c083d2ae2d3ffac6fce816a886077d9b446 | [
"from collections import Counter\nres = 0\nd = dict(Counter(chars))\nfor word in words:\n cnt = dict(Counter(word))\n if all((d.get(k) is not None and d.get(k) >= cnt.get(k) for k in cnt.keys())):\n res += len(word)\nreturn res",
"from collections import Counter\nres = 0\nd = Counter(chars)\nfor word... | <|body_start_0|>
from collections import Counter
res = 0
d = dict(Counter(chars))
for word in words:
cnt = dict(Counter(word))
if all((d.get(k) is not None and d.get(k) >= cnt.get(k) for k in cnt.keys())):
res += len(word)
return res
<|end_... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def countCharacters(self, words, chars):
""":type words: List[str] :type chars: str :rtype: int"""
<|body_0|>
def countCharacters(self, words, chars):
""":type words: List[str] :type chars: str :rtype: int"""
<|body_1|>
def countCharacters(self... | stack_v2_sparse_classes_10k_train_002477 | 1,416 | no_license | [
{
"docstring": ":type words: List[str] :type chars: str :rtype: int",
"name": "countCharacters",
"signature": "def countCharacters(self, words, chars)"
},
{
"docstring": ":type words: List[str] :type chars: str :rtype: int",
"name": "countCharacters",
"signature": "def countCharacters(se... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def countCharacters(self, words, chars): :type words: List[str] :type chars: str :rtype: int
- def countCharacters(self, words, chars): :type words: List[str] :type chars: str :r... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def countCharacters(self, words, chars): :type words: List[str] :type chars: str :rtype: int
- def countCharacters(self, words, chars): :type words: List[str] :type chars: str :r... | a509b383a42f54313970168d9faa11f088f18708 | <|skeleton|>
class Solution:
def countCharacters(self, words, chars):
""":type words: List[str] :type chars: str :rtype: int"""
<|body_0|>
def countCharacters(self, words, chars):
""":type words: List[str] :type chars: str :rtype: int"""
<|body_1|>
def countCharacters(self... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def countCharacters(self, words, chars):
""":type words: List[str] :type chars: str :rtype: int"""
from collections import Counter
res = 0
d = dict(Counter(chars))
for word in words:
cnt = dict(Counter(word))
if all((d.get(k) is not Non... | the_stack_v2_python_sparse | 1160_Find_Words_That_Can Be_Formed_by_Characters.py | bingli8802/leetcode | train | 0 | |
0f3c4d09b7dcc6b293fa1e0701c12a1a6c5fc585 | [
"super().__init__()\nself.d_model = d_model\nself.reverse = reverse\nself.xscale = math.sqrt(self.d_model)\nself.dropout = nn.Dropout(p=dropout_rate)\nself.pe = None\nself.dtype = dtype\nself.extend_pe(paddle.expand(paddle.zeros([1]), (1, max_len)))",
"x_shape = paddle.shape(x)\npe = paddle.zeros([x_shape[1], sel... | <|body_start_0|>
super().__init__()
self.d_model = d_model
self.reverse = reverse
self.xscale = math.sqrt(self.d_model)
self.dropout = nn.Dropout(p=dropout_rate)
self.pe = None
self.dtype = dtype
self.extend_pe(paddle.expand(paddle.zeros([1]), (1, max_len)... | Positional encoding. Args: d_model (int): Embedding dimension. dropout_rate (float): Dropout rate. max_len (int): Maximum input length. reverse (bool): Whether to reverse the input position. type (str): dtype of param | PositionalEncoding | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PositionalEncoding:
"""Positional encoding. Args: d_model (int): Embedding dimension. dropout_rate (float): Dropout rate. max_len (int): Maximum input length. reverse (bool): Whether to reverse the input position. type (str): dtype of param"""
def __init__(self, d_model, dropout_rate, max_le... | stack_v2_sparse_classes_10k_train_002478 | 9,302 | permissive | [
{
"docstring": "Construct an PositionalEncoding object.",
"name": "__init__",
"signature": "def __init__(self, d_model, dropout_rate, max_len=5000, dtype='float32', reverse=False)"
},
{
"docstring": "Reset the positional encodings.",
"name": "extend_pe",
"signature": "def extend_pe(self,... | 3 | null | Implement the Python class `PositionalEncoding` described below.
Class description:
Positional encoding. Args: d_model (int): Embedding dimension. dropout_rate (float): Dropout rate. max_len (int): Maximum input length. reverse (bool): Whether to reverse the input position. type (str): dtype of param
Method signature... | Implement the Python class `PositionalEncoding` described below.
Class description:
Positional encoding. Args: d_model (int): Embedding dimension. dropout_rate (float): Dropout rate. max_len (int): Maximum input length. reverse (bool): Whether to reverse the input position. type (str): dtype of param
Method signature... | 17854a04d43c231eff66bfed9d6aa55e94a29e79 | <|skeleton|>
class PositionalEncoding:
"""Positional encoding. Args: d_model (int): Embedding dimension. dropout_rate (float): Dropout rate. max_len (int): Maximum input length. reverse (bool): Whether to reverse the input position. type (str): dtype of param"""
def __init__(self, d_model, dropout_rate, max_le... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PositionalEncoding:
"""Positional encoding. Args: d_model (int): Embedding dimension. dropout_rate (float): Dropout rate. max_len (int): Maximum input length. reverse (bool): Whether to reverse the input position. type (str): dtype of param"""
def __init__(self, d_model, dropout_rate, max_len=5000, dtype... | the_stack_v2_python_sparse | paddlespeech/t2s/modules/transformer/embedding.py | anniyanvr/DeepSpeech-1 | train | 0 |
3d89ae0613d2494b70d6b527647ffee1113c9d46 | [
"querier = wt_uu.CreateGenericWebTestQuerier()\nwith self.assertRaises(RuntimeError):\n querier._StripPrefixFromTestId('foobar')",
"querier = wt_uu.CreateGenericWebTestQuerier()\ntest_ids = [prefix + 'a' for prefix in queries.KNOWN_TEST_ID_PREFIXES]\nfor t in test_ids:\n stripped = querier._StripPrefixFromT... | <|body_start_0|>
querier = wt_uu.CreateGenericWebTestQuerier()
with self.assertRaises(RuntimeError):
querier._StripPrefixFromTestId('foobar')
<|end_body_0|>
<|body_start_1|>
querier = wt_uu.CreateGenericWebTestQuerier()
test_ids = [prefix + 'a' for prefix in queries.KNOWN_TE... | StripPrefixFromTestIdUnittest | [
"Apache-2.0",
"LGPL-2.0-or-later",
"MIT",
"GPL-1.0-or-later",
"LicenseRef-scancode-warranty-disclaimer",
"LGPL-2.1-only",
"GPL-2.0-only",
"LGPL-2.0-only",
"BSD-2-Clause",
"LicenseRef-scancode-other-copyleft",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StripPrefixFromTestIdUnittest:
def testUnknownPrefix(self):
"""Tests that an error is raised if an unknown prefix is found."""
<|body_0|>
def testKnownPrefixes(self):
"""Tests that all known prefixes are properly stripped."""
<|body_1|>
<|end_skeleton|>
<|b... | stack_v2_sparse_classes_10k_train_002479 | 5,666 | permissive | [
{
"docstring": "Tests that an error is raised if an unknown prefix is found.",
"name": "testUnknownPrefix",
"signature": "def testUnknownPrefix(self)"
},
{
"docstring": "Tests that all known prefixes are properly stripped.",
"name": "testKnownPrefixes",
"signature": "def testKnownPrefixe... | 2 | stack_v2_sparse_classes_30k_train_000635 | Implement the Python class `StripPrefixFromTestIdUnittest` described below.
Class description:
Implement the StripPrefixFromTestIdUnittest class.
Method signatures and docstrings:
- def testUnknownPrefix(self): Tests that an error is raised if an unknown prefix is found.
- def testKnownPrefixes(self): Tests that all ... | Implement the Python class `StripPrefixFromTestIdUnittest` described below.
Class description:
Implement the StripPrefixFromTestIdUnittest class.
Method signatures and docstrings:
- def testUnknownPrefix(self): Tests that an error is raised if an unknown prefix is found.
- def testKnownPrefixes(self): Tests that all ... | fd8a8914ca0183f0add65ae55f04e287543c7d4a | <|skeleton|>
class StripPrefixFromTestIdUnittest:
def testUnknownPrefix(self):
"""Tests that an error is raised if an unknown prefix is found."""
<|body_0|>
def testKnownPrefixes(self):
"""Tests that all known prefixes are properly stripped."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class StripPrefixFromTestIdUnittest:
def testUnknownPrefix(self):
"""Tests that an error is raised if an unknown prefix is found."""
querier = wt_uu.CreateGenericWebTestQuerier()
with self.assertRaises(RuntimeError):
querier._StripPrefixFromTestId('foobar')
def testKnownPref... | the_stack_v2_python_sparse | third_party/blink/tools/blinkpy/web_tests/stale_expectation_removal/queries_unittest.py | SREERAGI18/chromium | train | 1 | |
d67be17c6f8112b45a4c855d2a72f0bc7de8ca1d | [
"super(mod_dump, self).__init__(address=address, **kwds)\nself._basename = cspad_tbx.getOptString(out_basename)\nself._dirname = cspad_tbx.getOptString(out_dirname)\nself._format = cspad_tbx.getOptString(out_format)",
"super(mod_dump, self).event(evt, env)\nif evt.get('skip_event'):\n return\nif self.cspad_img... | <|body_start_0|>
super(mod_dump, self).__init__(address=address, **kwds)
self._basename = cspad_tbx.getOptString(out_basename)
self._dirname = cspad_tbx.getOptString(out_dirname)
self._format = cspad_tbx.getOptString(out_format)
<|end_body_0|>
<|body_start_1|>
super(mod_dump, se... | Class for outputting images to the file system within the pyana analysis framework. XXX This should eventually deprecate the 'write_dict' dispatch from mod_hitfind. | mod_dump | [
"BSD-3-Clause-LBNL",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class mod_dump:
"""Class for outputting images to the file system within the pyana analysis framework. XXX This should eventually deprecate the 'write_dict' dispatch from mod_hitfind."""
def __init__(self, address, out_dirname, out_basename, out_format='pickle', **kwds):
"""The mod_dump cl... | stack_v2_sparse_classes_10k_train_002480 | 3,281 | permissive | [
{
"docstring": "The mod_dump class constructor stores the parameters passed from the pyana configuration file in instance variables. @param address Full data source address of the DAQ device @param out_dirname Directory portion of output image pathname @param out_basename Filename prefix of output image pathnam... | 2 | stack_v2_sparse_classes_30k_train_000918 | Implement the Python class `mod_dump` described below.
Class description:
Class for outputting images to the file system within the pyana analysis framework. XXX This should eventually deprecate the 'write_dict' dispatch from mod_hitfind.
Method signatures and docstrings:
- def __init__(self, address, out_dirname, ou... | Implement the Python class `mod_dump` described below.
Class description:
Class for outputting images to the file system within the pyana analysis framework. XXX This should eventually deprecate the 'write_dict' dispatch from mod_hitfind.
Method signatures and docstrings:
- def __init__(self, address, out_dirname, ou... | 77d66c719b5746f37af51ad593e2941ed6fbba17 | <|skeleton|>
class mod_dump:
"""Class for outputting images to the file system within the pyana analysis framework. XXX This should eventually deprecate the 'write_dict' dispatch from mod_hitfind."""
def __init__(self, address, out_dirname, out_basename, out_format='pickle', **kwds):
"""The mod_dump cl... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class mod_dump:
"""Class for outputting images to the file system within the pyana analysis framework. XXX This should eventually deprecate the 'write_dict' dispatch from mod_hitfind."""
def __init__(self, address, out_dirname, out_basename, out_format='pickle', **kwds):
"""The mod_dump class construct... | the_stack_v2_python_sparse | modules/cctbx_project/xfel/cxi/cspad_ana/mod_dump.py | jorgediazjr/dials-dev20191018 | train | 0 |
3dae9e209e3cc86fc3482ccfe8dae4f9597ae13d | [
"iteration = n / 4\nindex = 0\nfor i in range(iteration + 1):\n buf4 = [''] * 4\n cur = read4(buf4)\n if not cur:\n return index\n for i in range(min(n, cur)):\n buf[index] = buf4[i]\n index += 1\n n -= 1\nreturn index",
"readByte = 0\nwhile readByte < n:\n buf4 = [''] *... | <|body_start_0|>
iteration = n / 4
index = 0
for i in range(iteration + 1):
buf4 = [''] * 4
cur = read4(buf4)
if not cur:
return index
for i in range(min(n, cur)):
buf[index] = buf4[i]
index += 1
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def read(self, buf, n):
""":type buf: Destination buffer (List[str]) :type n: Maximum number of characters to read (int) :rtype: The number of characters read (int)"""
<|body_0|>
def read(self, buf, n):
""":type buf: Destination buffer (List[str]) :type n: ... | stack_v2_sparse_classes_10k_train_002481 | 1,488 | no_license | [
{
"docstring": ":type buf: Destination buffer (List[str]) :type n: Maximum number of characters to read (int) :rtype: The number of characters read (int)",
"name": "read",
"signature": "def read(self, buf, n)"
},
{
"docstring": ":type buf: Destination buffer (List[str]) :type n: Maximum number o... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def read(self, buf, n): :type buf: Destination buffer (List[str]) :type n: Maximum number of characters to read (int) :rtype: The number of characters read (int)
- def read(self,... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def read(self, buf, n): :type buf: Destination buffer (List[str]) :type n: Maximum number of characters to read (int) :rtype: The number of characters read (int)
- def read(self,... | d953abe2c9680f636563e76287d2f907e90ced63 | <|skeleton|>
class Solution:
def read(self, buf, n):
""":type buf: Destination buffer (List[str]) :type n: Maximum number of characters to read (int) :rtype: The number of characters read (int)"""
<|body_0|>
def read(self, buf, n):
""":type buf: Destination buffer (List[str]) :type n: ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def read(self, buf, n):
""":type buf: Destination buffer (List[str]) :type n: Maximum number of characters to read (int) :rtype: The number of characters read (int)"""
iteration = n / 4
index = 0
for i in range(iteration + 1):
buf4 = [''] * 4
c... | the_stack_v2_python_sparse | Python_leetcode/157_read_n_character_given_read4.py | xiangcao/Leetcode | train | 0 | |
9cd5bbf2ed762f3784060d90b86ceaa57f997a37 | [
"custom_classes = env.COMMON_CUSTOM_CLASSES + env.PROJECT_CUSTOM_CLASSES\nfor cc in custom_classes:\n split_cc = cc.split('.')\n custom_cls_name = split_cc[1]\n if cls_name == custom_cls_name:\n return True\nreturn False",
"custom_cls_candidates = env.COMMON_CUSTOM_CLASSES + env.PROJECT_CUSTOM_CLA... | <|body_start_0|>
custom_classes = env.COMMON_CUSTOM_CLASSES + env.PROJECT_CUSTOM_CLASSES
for cc in custom_classes:
split_cc = cc.split('.')
custom_cls_name = split_cc[1]
if cls_name == custom_cls_name:
return True
return False
<|end_body_0|>
<... | ClassUtil | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClassUtil:
def is_custom_cls(self, cls_name):
"""Check if given class is a custom class. Args: cls_name: Class name Return: True: Custom class False: Default class"""
<|body_0|>
def describe_class(self, cls_name):
"""Returns a pair of module path and class name by gi... | stack_v2_sparse_classes_10k_train_002482 | 1,285 | permissive | [
{
"docstring": "Check if given class is a custom class. Args: cls_name: Class name Return: True: Custom class False: Default class",
"name": "is_custom_cls",
"signature": "def is_custom_cls(self, cls_name)"
},
{
"docstring": "Returns a pair of module path and class name by given name. Args: cls_... | 2 | stack_v2_sparse_classes_30k_train_004587 | Implement the Python class `ClassUtil` described below.
Class description:
Implement the ClassUtil class.
Method signatures and docstrings:
- def is_custom_cls(self, cls_name): Check if given class is a custom class. Args: cls_name: Class name Return: True: Custom class False: Default class
- def describe_class(self,... | Implement the Python class `ClassUtil` described below.
Class description:
Implement the ClassUtil class.
Method signatures and docstrings:
- def is_custom_cls(self, cls_name): Check if given class is a custom class. Args: cls_name: Class name Return: True: Custom class False: Default class
- def describe_class(self,... | e523653a9f96f84810c06824133c3a146a053b75 | <|skeleton|>
class ClassUtil:
def is_custom_cls(self, cls_name):
"""Check if given class is a custom class. Args: cls_name: Class name Return: True: Custom class False: Default class"""
<|body_0|>
def describe_class(self, cls_name):
"""Returns a pair of module path and class name by gi... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ClassUtil:
def is_custom_cls(self, cls_name):
"""Check if given class is a custom class. Args: cls_name: Class name Return: True: Custom class False: Default class"""
custom_classes = env.COMMON_CUSTOM_CLASSES + env.PROJECT_CUSTOM_CLASSES
for cc in custom_classes:
split_cc ... | the_stack_v2_python_sparse | cliboa/util/class_util.py | BrainPad/cliboa | train | 27 | |
e6b6cf397c89651c9eac2b5850a9530a654fddd3 | [
"self.links = links\nself.joint_constraints = joint_constraints\nself.effector_dims = effector_dims\nself.distance_from_page = distance_from_page\nself.min_phi = math.radians(min_phi)\nself.max_phi = math.radians(max_phi)\nself.ee_angle = math.atan(effector_dims[1] / effector_dims[0])\nself.base = np.array([1, 0])\... | <|body_start_0|>
self.links = links
self.joint_constraints = joint_constraints
self.effector_dims = effector_dims
self.distance_from_page = distance_from_page
self.min_phi = math.radians(min_phi)
self.max_phi = math.radians(max_phi)
self.ee_angle = math.atan(effec... | IKSolver | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IKSolver:
def __init__(self, links, joint_constraints, effector_dims, distance_from_page, min_phi, max_phi, phi_steps):
"""Keyword arguments: links = The lengths of the robot links (1x3 vector) joint_constraints = The minimal and maximal angle each joint can have (3x2 vector) effector_di... | stack_v2_sparse_classes_10k_train_002483 | 5,986 | no_license | [
{
"docstring": "Keyword arguments: links = The lengths of the robot links (1x3 vector) joint_constraints = The minimal and maximal angle each joint can have (3x2 vector) effector_dims = The size of the end effector ([x, y] vector) distance_from_page = distance between the center of the page and the position of ... | 3 | stack_v2_sparse_classes_30k_test_000112 | Implement the Python class `IKSolver` described below.
Class description:
Implement the IKSolver class.
Method signatures and docstrings:
- def __init__(self, links, joint_constraints, effector_dims, distance_from_page, min_phi, max_phi, phi_steps): Keyword arguments: links = The lengths of the robot links (1x3 vecto... | Implement the Python class `IKSolver` described below.
Class description:
Implement the IKSolver class.
Method signatures and docstrings:
- def __init__(self, links, joint_constraints, effector_dims, distance_from_page, min_phi, max_phi, phi_steps): Keyword arguments: links = The lengths of the robot links (1x3 vecto... | 501f85d25924a1625ce116231d37ecc2baa699ba | <|skeleton|>
class IKSolver:
def __init__(self, links, joint_constraints, effector_dims, distance_from_page, min_phi, max_phi, phi_steps):
"""Keyword arguments: links = The lengths of the robot links (1x3 vector) joint_constraints = The minimal and maximal angle each joint can have (3x2 vector) effector_di... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class IKSolver:
def __init__(self, links, joint_constraints, effector_dims, distance_from_page, min_phi, max_phi, phi_steps):
"""Keyword arguments: links = The lengths of the robot links (1x3 vector) joint_constraints = The minimal and maximal angle each joint can have (3x2 vector) effector_dims = The size ... | the_stack_v2_python_sparse | simulation/InverseKinematics.py | Evelyn-H/robotic-arm | train | 0 | |
b38940cdb61ccb0dbf3376e8a69ac06e3f0c011e | [
"self.sensor = sensor\nself.pump = pump\nself.decider = decider\nself.actions = {'PUMP_IN': pump.PUMP_IN, 'PUMP_OUT': pump.PUMP_OUT, 'PUMP_OFF': pump.PUMP_OFF}",
"current_height = self.sensor.measure()\ncurrent_action = self.pump.get_state()\nnew_state = self.decider.decide(current_height, current_action, self.ac... | <|body_start_0|>
self.sensor = sensor
self.pump = pump
self.decider = decider
self.actions = {'PUMP_IN': pump.PUMP_IN, 'PUMP_OUT': pump.PUMP_OUT, 'PUMP_OFF': pump.PUMP_OFF}
<|end_body_0|>
<|body_start_1|>
current_height = self.sensor.measure()
current_action = self.pump.... | Encapsulates command and coordination for the water-regulation module | Controller | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Controller:
"""Encapsulates command and coordination for the water-regulation module"""
def __init__(self, sensor, pump, decider):
"""Create a new controller :param sensor: Typically an instance of sensor.Sensor :param pump: Typically an instance of pump.Pump :param decider: Typicall... | stack_v2_sparse_classes_10k_train_002484 | 1,208 | no_license | [
{
"docstring": "Create a new controller :param sensor: Typically an instance of sensor.Sensor :param pump: Typically an instance of pump.Pump :param decider: Typically an instance of decider.Decider",
"name": "__init__",
"signature": "def __init__(self, sensor, pump, decider)"
},
{
"docstring": ... | 2 | null | Implement the Python class `Controller` described below.
Class description:
Encapsulates command and coordination for the water-regulation module
Method signatures and docstrings:
- def __init__(self, sensor, pump, decider): Create a new controller :param sensor: Typically an instance of sensor.Sensor :param pump: Ty... | Implement the Python class `Controller` described below.
Class description:
Encapsulates command and coordination for the water-regulation module
Method signatures and docstrings:
- def __init__(self, sensor, pump, decider): Create a new controller :param sensor: Typically an instance of sensor.Sensor :param pump: Ty... | 263685ca90110609bfd05d621516727f8cd0028f | <|skeleton|>
class Controller:
"""Encapsulates command and coordination for the water-regulation module"""
def __init__(self, sensor, pump, decider):
"""Create a new controller :param sensor: Typically an instance of sensor.Sensor :param pump: Typically an instance of pump.Pump :param decider: Typicall... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Controller:
"""Encapsulates command and coordination for the water-regulation module"""
def __init__(self, sensor, pump, decider):
"""Create a new controller :param sensor: Typically an instance of sensor.Sensor :param pump: Typically an instance of pump.Pump :param decider: Typically an instance... | the_stack_v2_python_sparse | students/eric_rosko/lesson-06/waterregulation/controller.py | aurel1212/Sp2018-Online | train | 0 |
69a4f3364c1ad2d09a7ba27c796ecf954358b061 | [
"super().__init__()\nself.parent = parent\nself.sq_gui = sq_gui",
"while True:\n data = self.sq_gui.get()\n self.gotData.emit((data,))\n self.sq_gui.task_done()"
] | <|body_start_0|>
super().__init__()
self.parent = parent
self.sq_gui = sq_gui
<|end_body_0|>
<|body_start_1|>
while True:
data = self.sq_gui.get()
self.gotData.emit((data,))
self.sq_gui.task_done()
<|end_body_1|>
| DataMonitor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataMonitor:
def __init__(self, parent, sq_gui: SelectableQueue):
"""monitor new messages from server backend :param parent: PyQT5 parent :param sq_gui: Queue for monitoring"""
<|body_0|>
def get_data(self):
"""get data from Queue"""
<|body_1|>
<|end_skeleto... | stack_v2_sparse_classes_10k_train_002485 | 4,893 | no_license | [
{
"docstring": "monitor new messages from server backend :param parent: PyQT5 parent :param sq_gui: Queue for monitoring",
"name": "__init__",
"signature": "def __init__(self, parent, sq_gui: SelectableQueue)"
},
{
"docstring": "get data from Queue",
"name": "get_data",
"signature": "def... | 2 | stack_v2_sparse_classes_30k_val_000068 | Implement the Python class `DataMonitor` described below.
Class description:
Implement the DataMonitor class.
Method signatures and docstrings:
- def __init__(self, parent, sq_gui: SelectableQueue): monitor new messages from server backend :param parent: PyQT5 parent :param sq_gui: Queue for monitoring
- def get_data... | Implement the Python class `DataMonitor` described below.
Class description:
Implement the DataMonitor class.
Method signatures and docstrings:
- def __init__(self, parent, sq_gui: SelectableQueue): monitor new messages from server backend :param parent: PyQT5 parent :param sq_gui: Queue for monitoring
- def get_data... | eaa56064aa2260df6448d9144adb99cc75fe27a2 | <|skeleton|>
class DataMonitor:
def __init__(self, parent, sq_gui: SelectableQueue):
"""monitor new messages from server backend :param parent: PyQT5 parent :param sq_gui: Queue for monitoring"""
<|body_0|>
def get_data(self):
"""get data from Queue"""
<|body_1|>
<|end_skeleto... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DataMonitor:
def __init__(self, parent, sq_gui: SelectableQueue):
"""monitor new messages from server backend :param parent: PyQT5 parent :param sq_gui: Queue for monitoring"""
super().__init__()
self.parent = parent
self.sq_gui = sq_gui
def get_data(self):
"""get ... | the_stack_v2_python_sparse | GeekChat/server/server_gui.py | OlegZhdanoff/ClientServerApp | train | 0 | |
ad0260d9cb598dfa772fc678b07a4d77905b965f | [
"StreamBase.__init__(self, default_ns, extra_ns, keepalive, owner)\nStreamTLSMixIn.__init__(self, tls_settings)\nStreamSASLMixIn.__init__(self, sasl_mechanisms)\nself.__logger = logging.getLogger('pyxmpp.Stream')",
"StreamBase._reset(self)\nself._reset_tls()\nself._reset_sasl()",
"features = StreamBase._make_st... | <|body_start_0|>
StreamBase.__init__(self, default_ns, extra_ns, keepalive, owner)
StreamTLSMixIn.__init__(self, tls_settings)
StreamSASLMixIn.__init__(self, sasl_mechanisms)
self.__logger = logging.getLogger('pyxmpp.Stream')
<|end_body_0|>
<|body_start_1|>
StreamBase._reset(sel... | Generic XMPP stream class. Responsible for establishing connection, parsing the stream, StartTLS encryption and SASL authentication negotiation and usage, dispatching received stanzas to apopriate handlers and sending application's stanzas. Whenever we say "stream" here we actually mean two streams (incoming and outgoi... | Stream | [
"Python-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Stream:
"""Generic XMPP stream class. Responsible for establishing connection, parsing the stream, StartTLS encryption and SASL authentication negotiation and usage, dispatching received stanzas to apopriate handlers and sending application's stanzas. Whenever we say "stream" here we actually mea... | stack_v2_sparse_classes_10k_train_002486 | 4,703 | permissive | [
{
"docstring": "Initialize Stream object :Parameters: - `default_ns`: stream's default namespace (\"jabber:client\" for client, \"jabber:server\" for server, etc.) - `extra_ns`: sequence of extra namespace URIs to be defined for the stream. - `sasl_mechanisms`: sequence of SASL mechanisms allowed for authentica... | 5 | null | Implement the Python class `Stream` described below.
Class description:
Generic XMPP stream class. Responsible for establishing connection, parsing the stream, StartTLS encryption and SASL authentication negotiation and usage, dispatching received stanzas to apopriate handlers and sending application's stanzas. Whenev... | Implement the Python class `Stream` described below.
Class description:
Generic XMPP stream class. Responsible for establishing connection, parsing the stream, StartTLS encryption and SASL authentication negotiation and usage, dispatching received stanzas to apopriate handlers and sending application's stanzas. Whenev... | 16a62c7df1018a49eaa8151c0f8b881c7e252949 | <|skeleton|>
class Stream:
"""Generic XMPP stream class. Responsible for establishing connection, parsing the stream, StartTLS encryption and SASL authentication negotiation and usage, dispatching received stanzas to apopriate handlers and sending application's stanzas. Whenever we say "stream" here we actually mea... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Stream:
"""Generic XMPP stream class. Responsible for establishing connection, parsing the stream, StartTLS encryption and SASL authentication negotiation and usage, dispatching received stanzas to apopriate handlers and sending application's stanzas. Whenever we say "stream" here we actually mean two streams... | the_stack_v2_python_sparse | digsby/lib/pyxmpp/stream.py | niterain/digsby | train | 1 |
ad1cb38434939561a99abb8c19bbbfa49001411c | [
"super(SageDisplayFormatter, self).__init__(*args, **kwds)\nfrom sage.repl.rich_output.display_manager import get_display_manager\nself.dm = get_display_manager()\nfrom sage.repl.rich_output.backend_ipython import BackendIPython\nself.dm.check_backend_class(BackendIPython)",
"PLAIN_TEXT = u'text/plain'\nsage_form... | <|body_start_0|>
super(SageDisplayFormatter, self).__init__(*args, **kwds)
from sage.repl.rich_output.display_manager import get_display_manager
self.dm = get_display_manager()
from sage.repl.rich_output.backend_ipython import BackendIPython
self.dm.check_backend_class(BackendIPy... | SageDisplayFormatter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SageDisplayFormatter:
def __init__(self, *args, **kwds):
"""This is where the Sage rich objects are translated to IPython INPUT/OUTPUT: See the IPython documentation. EXAMPLES: This is part of how Sage works with the IPython output system. It cannot be used in doctests:: sage: from sage.... | stack_v2_sparse_classes_10k_train_002487 | 9,448 | no_license | [
{
"docstring": "This is where the Sage rich objects are translated to IPython INPUT/OUTPUT: See the IPython documentation. EXAMPLES: This is part of how Sage works with the IPython output system. It cannot be used in doctests:: sage: from sage.repl.display.formatter import SageDisplayFormatter sage: fmt = SageD... | 2 | null | Implement the Python class `SageDisplayFormatter` described below.
Class description:
Implement the SageDisplayFormatter class.
Method signatures and docstrings:
- def __init__(self, *args, **kwds): This is where the Sage rich objects are translated to IPython INPUT/OUTPUT: See the IPython documentation. EXAMPLES: Th... | Implement the Python class `SageDisplayFormatter` described below.
Class description:
Implement the SageDisplayFormatter class.
Method signatures and docstrings:
- def __init__(self, *args, **kwds): This is where the Sage rich objects are translated to IPython INPUT/OUTPUT: See the IPython documentation. EXAMPLES: Th... | 0d9eacbf74e2acffefde93e39f8bcbec745cdaba | <|skeleton|>
class SageDisplayFormatter:
def __init__(self, *args, **kwds):
"""This is where the Sage rich objects are translated to IPython INPUT/OUTPUT: See the IPython documentation. EXAMPLES: This is part of how Sage works with the IPython output system. It cannot be used in doctests:: sage: from sage.... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SageDisplayFormatter:
def __init__(self, *args, **kwds):
"""This is where the Sage rich objects are translated to IPython INPUT/OUTPUT: See the IPython documentation. EXAMPLES: This is part of how Sage works with the IPython output system. It cannot be used in doctests:: sage: from sage.repl.display.f... | the_stack_v2_python_sparse | sage/src/sage/repl/display/formatter.py | bopopescu/geosci | train | 0 | |
095480442682eb779a5446babc7d689ed39d6e1d | [
"QTreeView.__init__(self, parent_widget)\nself.setAnimated(True)\nself.setMinimumHeight(200)\nself.setExpandsOnDoubleClick(False)",
"index = self.model().index_for_item(item)\nif item.node.get('setexpanded') == 'True':\n self.expand(index)\nfor child_item in item.child_items:\n self._expand_subnodes(child_i... | <|body_start_0|>
QTreeView.__init__(self, parent_widget)
self.setAnimated(True)
self.setMinimumHeight(200)
self.setExpandsOnDoubleClick(False)
<|end_body_0|>
<|body_start_1|>
index = self.model().index_for_item(item)
if item.node.get('setexpanded') == 'True':
... | TreeView for viewing XML data. | XmlView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class XmlView:
"""TreeView for viewing XML data."""
def __init__(self, parent_widget):
"""Tree view for displaying data in a XmlModel @param parent_widget (QWidget): Parent widget"""
<|body_0|>
def _expand_subnodes(self, item):
"""Recursively expands all items under (a... | stack_v2_sparse_classes_10k_train_002488 | 1,602 | no_license | [
{
"docstring": "Tree view for displaying data in a XmlModel @param parent_widget (QWidget): Parent widget",
"name": "__init__",
"signature": "def __init__(self, parent_widget)"
},
{
"docstring": "Recursively expands all items under (and including) a given index. Items are expanded only if \"sete... | 3 | null | Implement the Python class `XmlView` described below.
Class description:
TreeView for viewing XML data.
Method signatures and docstrings:
- def __init__(self, parent_widget): Tree view for displaying data in a XmlModel @param parent_widget (QWidget): Parent widget
- def _expand_subnodes(self, item): Recursively expan... | Implement the Python class `XmlView` described below.
Class description:
TreeView for viewing XML data.
Method signatures and docstrings:
- def __init__(self, parent_widget): Tree view for displaying data in a XmlModel @param parent_widget (QWidget): Parent widget
- def _expand_subnodes(self, item): Recursively expan... | c392d15b35aa1d47bbc185ed76314f8e6dd9f92f | <|skeleton|>
class XmlView:
"""TreeView for viewing XML data."""
def __init__(self, parent_widget):
"""Tree view for displaying data in a XmlModel @param parent_widget (QWidget): Parent widget"""
<|body_0|>
def _expand_subnodes(self, item):
"""Recursively expands all items under (a... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class XmlView:
"""TreeView for viewing XML data."""
def __init__(self, parent_widget):
"""Tree view for displaying data in a XmlModel @param parent_widget (QWidget): Parent widget"""
QTreeView.__init__(self, parent_widget)
self.setAnimated(True)
self.setMinimumHeight(200)
... | the_stack_v2_python_sparse | opus_gui/abstract_manager/views/xml_view.py | psrc/urbansim | train | 4 |
16fd747ee5f16cf98994a4d8e07665d345c83694 | [
"if not matrix:\n return 0\nm, n = (len(matrix), len(matrix[0]))\ncache = [[-1 for _ in range(n)] for _ in range(m)]\nlong = 0\nfor i in range(m):\n for j in range(n):\n long = max(long, self.longest(matrix, cache, m, n, i, j))\nreturn long",
"dirs = ((-1, 0), (1, 0), (0, -1), (0, 1))\nif cache[i][j]... | <|body_start_0|>
if not matrix:
return 0
m, n = (len(matrix), len(matrix[0]))
cache = [[-1 for _ in range(n)] for _ in range(m)]
long = 0
for i in range(m):
for j in range(n):
long = max(long, self.longest(matrix, cache, m, n, i, j))
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def longestIncreasingPath(self, matrix):
""":type matrix: List[List[int]] :rtype: int"""
<|body_0|>
def longest(self, matrix, cache, m, n, i, j):
"""Strictly increasing, thus no need to have a visited matrix"""
<|body_1|>
<|end_skeleton|>
<|body_s... | stack_v2_sparse_classes_10k_train_002489 | 1,691 | no_license | [
{
"docstring": ":type matrix: List[List[int]] :rtype: int",
"name": "longestIncreasingPath",
"signature": "def longestIncreasingPath(self, matrix)"
},
{
"docstring": "Strictly increasing, thus no need to have a visited matrix",
"name": "longest",
"signature": "def longest(self, matrix, c... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestIncreasingPath(self, matrix): :type matrix: List[List[int]] :rtype: int
- def longest(self, matrix, cache, m, n, i, j): Strictly increasing, thus no need to have a vis... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestIncreasingPath(self, matrix): :type matrix: List[List[int]] :rtype: int
- def longest(self, matrix, cache, m, n, i, j): Strictly increasing, thus no need to have a vis... | 810575368ecffa97677bdb51744d1f716140bbb1 | <|skeleton|>
class Solution:
def longestIncreasingPath(self, matrix):
""":type matrix: List[List[int]] :rtype: int"""
<|body_0|>
def longest(self, matrix, cache, m, n, i, j):
"""Strictly increasing, thus no need to have a visited matrix"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def longestIncreasingPath(self, matrix):
""":type matrix: List[List[int]] :rtype: int"""
if not matrix:
return 0
m, n = (len(matrix), len(matrix[0]))
cache = [[-1 for _ in range(n)] for _ in range(m)]
long = 0
for i in range(m):
... | the_stack_v2_python_sparse | L/LongestIncreasingPathinaMatrix.py | bssrdf/pyleet | train | 2 | |
a82b954550123140dc0dab113db482e303d3ecf6 | [
"self.initAlpha = initAlpha\nself.factor = factor\nself.dropEvery = dropEvery\npass",
"exp = np.floor((1 + epoch) / self.dropEvery)\nalpha = initAlpha * self.factor ** exp\nreturn float(alpha)"
] | <|body_start_0|>
self.initAlpha = initAlpha
self.factor = factor
self.dropEvery = dropEvery
pass
<|end_body_0|>
<|body_start_1|>
exp = np.floor((1 + epoch) / self.dropEvery)
alpha = initAlpha * self.factor ** exp
return float(alpha)
<|end_body_1|>
| StepDecay | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StepDecay:
def __init__(self, initAlpha=0.01, factor=0.25, dropEvery=10):
"""- initiate StepDecay class with initial lr, decay factor & decay period"""
<|body_0|>
def __call__(self, epoch):
"""- compute the learning rate for the current epoch using step-based decay f... | stack_v2_sparse_classes_10k_train_002490 | 2,358 | no_license | [
{
"docstring": "- initiate StepDecay class with initial lr, decay factor & decay period",
"name": "__init__",
"signature": "def __init__(self, initAlpha=0.01, factor=0.25, dropEvery=10)"
},
{
"docstring": "- compute the learning rate for the current epoch using step-based decay function - accept... | 2 | stack_v2_sparse_classes_30k_train_002787 | Implement the Python class `StepDecay` described below.
Class description:
Implement the StepDecay class.
Method signatures and docstrings:
- def __init__(self, initAlpha=0.01, factor=0.25, dropEvery=10): - initiate StepDecay class with initial lr, decay factor & decay period
- def __call__(self, epoch): - compute th... | Implement the Python class `StepDecay` described below.
Class description:
Implement the StepDecay class.
Method signatures and docstrings:
- def __init__(self, initAlpha=0.01, factor=0.25, dropEvery=10): - initiate StepDecay class with initial lr, decay factor & decay period
- def __call__(self, epoch): - compute th... | ebf5edb4d71f81dd9d8478c6251e97c097d189c3 | <|skeleton|>
class StepDecay:
def __init__(self, initAlpha=0.01, factor=0.25, dropEvery=10):
"""- initiate StepDecay class with initial lr, decay factor & decay period"""
<|body_0|>
def __call__(self, epoch):
"""- compute the learning rate for the current epoch using step-based decay f... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class StepDecay:
def __init__(self, initAlpha=0.01, factor=0.25, dropEvery=10):
"""- initiate StepDecay class with initial lr, decay factor & decay period"""
self.initAlpha = initAlpha
self.factor = factor
self.dropEvery = dropEvery
pass
def __call__(self, epoch):
... | the_stack_v2_python_sparse | callbacks/learning_rate_scheduler.py | zlyin/Orca | train | 0 | |
09b99e240155f9ca87b9b25afca926fb394e25a9 | [
"cls.user = UserFactory()\ncls.auth = AuthFactory()\ncls.device = TOTPDevice.objects.create(user=cls.user)\ncls.relate = TOTPDevice.challenge.objects.create(device=cls.device, token=cls.auth)\ncls.algorithm = TOTPAlgorithm()",
"for i in (-2, -1, 0, 1, 2):\n description = 'TOTP not verified for `i={0}`'.format(... | <|body_start_0|>
cls.user = UserFactory()
cls.auth = AuthFactory()
cls.device = TOTPDevice.objects.create(user=cls.user)
cls.relate = TOTPDevice.challenge.objects.create(device=cls.device, token=cls.auth)
cls.algorithm = TOTPAlgorithm()
<|end_body_0|>
<|body_start_1|>
fo... | Tests for TOTP verification implementation. | VerificationTests | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VerificationTests:
"""Tests for TOTP verification implementation."""
def setUpTestData(cls):
"""Set up the test data within the test db."""
<|body_0|>
def test_successful_verification(self):
"""Test a all successful scenario's for TOTP validation. Note: when ther... | stack_v2_sparse_classes_10k_train_002491 | 2,012 | permissive | [
{
"docstring": "Set up the test data within the test db.",
"name": "setUpTestData",
"signature": "def setUpTestData(cls)"
},
{
"docstring": "Test a all successful scenario's for TOTP validation. Note: when there is a tolerance of 2 there are actually 5 possibilities 1 and 2 steps before now, now... | 3 | stack_v2_sparse_classes_30k_test_000079 | Implement the Python class `VerificationTests` described below.
Class description:
Tests for TOTP verification implementation.
Method signatures and docstrings:
- def setUpTestData(cls): Set up the test data within the test db.
- def test_successful_verification(self): Test a all successful scenario's for TOTP valida... | Implement the Python class `VerificationTests` described below.
Class description:
Tests for TOTP verification implementation.
Method signatures and docstrings:
- def setUpTestData(cls): Set up the test data within the test db.
- def test_successful_verification(self): Test a all successful scenario's for TOTP valida... | 6342f473a287a546088e868e46be333323fd866c | <|skeleton|>
class VerificationTests:
"""Tests for TOTP verification implementation."""
def setUpTestData(cls):
"""Set up the test data within the test db."""
<|body_0|>
def test_successful_verification(self):
"""Test a all successful scenario's for TOTP validation. Note: when ther... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class VerificationTests:
"""Tests for TOTP verification implementation."""
def setUpTestData(cls):
"""Set up the test data within the test db."""
cls.user = UserFactory()
cls.auth = AuthFactory()
cls.device = TOTPDevice.objects.create(user=cls.user)
cls.relate = TOTPDevi... | the_stack_v2_python_sparse | rest_multi_factor/plugins/totp/tests.py | KENTIVO/rest-multi-factor | train | 0 |
7353c6d9d00e879cdbfdee5e340d9f3b6c4bacda | [
"if self.power == 1 and (not self.is_conjugated()) and self.is_transposed():\n return PowerMatrixGate.T(self, inplace=inplace)\nelse:\n return PowerMatrixGate.conj(self, inplace=inplace)",
"if self.power == 1 and self.is_conjugated() and (not self.is_transposed()):\n return PowerMatrixGate.conj(self, inp... | <|body_start_0|>
if self.power == 1 and (not self.is_conjugated()) and self.is_transposed():
return PowerMatrixGate.T(self, inplace=inplace)
else:
return PowerMatrixGate.conj(self, inplace=inplace)
<|end_body_0|>
<|body_start_1|>
if self.power == 1 and self.is_conjugated... | SelfAdjointUnitaryGate | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SelfAdjointUnitaryGate:
def conj(self, *, inplace: bool=False) -> SelfAdjointUnitaryGate:
"""Apply conjugation to self.matrix()."""
<|body_0|>
def T(self, *, inplace: bool=False) -> SelfAdjointUnitaryGate:
"""Apply transposition to self.matrix()."""
<|body_1|... | stack_v2_sparse_classes_10k_train_002492 | 31,759 | permissive | [
{
"docstring": "Apply conjugation to self.matrix().",
"name": "conj",
"signature": "def conj(self, *, inplace: bool=False) -> SelfAdjointUnitaryGate"
},
{
"docstring": "Apply transposition to self.matrix().",
"name": "T",
"signature": "def T(self, *, inplace: bool=False) -> SelfAdjointUn... | 3 | stack_v2_sparse_classes_30k_val_000084 | Implement the Python class `SelfAdjointUnitaryGate` described below.
Class description:
Implement the SelfAdjointUnitaryGate class.
Method signatures and docstrings:
- def conj(self, *, inplace: bool=False) -> SelfAdjointUnitaryGate: Apply conjugation to self.matrix().
- def T(self, *, inplace: bool=False) -> SelfAdj... | Implement the Python class `SelfAdjointUnitaryGate` described below.
Class description:
Implement the SelfAdjointUnitaryGate class.
Method signatures and docstrings:
- def conj(self, *, inplace: bool=False) -> SelfAdjointUnitaryGate: Apply conjugation to self.matrix().
- def T(self, *, inplace: bool=False) -> SelfAdj... | 42f2998a059e5615dce6ccdbf7ae6dc4954bbce9 | <|skeleton|>
class SelfAdjointUnitaryGate:
def conj(self, *, inplace: bool=False) -> SelfAdjointUnitaryGate:
"""Apply conjugation to self.matrix()."""
<|body_0|>
def T(self, *, inplace: bool=False) -> SelfAdjointUnitaryGate:
"""Apply transposition to self.matrix()."""
<|body_1|... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SelfAdjointUnitaryGate:
def conj(self, *, inplace: bool=False) -> SelfAdjointUnitaryGate:
"""Apply conjugation to self.matrix()."""
if self.power == 1 and (not self.is_conjugated()) and self.is_transposed():
return PowerMatrixGate.T(self, inplace=inplace)
else:
... | the_stack_v2_python_sparse | hybridq/gate/property.py | jsmarsha11/hybridq-nasa | train | 0 | |
6ced01b005d905c3a622fc55d1629cf98e835c1c | [
"super(UnifiedFusion, self).__init__(name=name)\nself._unified_backbone = unified_backbone\nself._unified_model_kwargs = unified_model_kwargs or {}\nself.unified_backbone = uvatt_factory.build_model(backbone=self._unified_backbone, override_params=self._unified_model_kwargs)",
"txt_attn_mask = tf.where(word_ids =... | <|body_start_0|>
super(UnifiedFusion, self).__init__(name=name)
self._unified_backbone = unified_backbone
self._unified_model_kwargs = unified_model_kwargs or {}
self.unified_backbone = uvatt_factory.build_model(backbone=self._unified_backbone, override_params=self._unified_model_kwargs)... | Module to fuse audio, text and video for joint embedding learning. | UnifiedFusion | [
"Apache-2.0",
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UnifiedFusion:
"""Module to fuse audio, text and video for joint embedding learning."""
def __init__(self, unified_backbone='uvatt', unified_model_kwargs=None, name='unified_fusion_model', **kwargs):
"""Initialize the UnifiedFusion class. Args: unified_backbone: The unified shared ba... | stack_v2_sparse_classes_10k_train_002493 | 7,989 | permissive | [
{
"docstring": "Initialize the UnifiedFusion class. Args: unified_backbone: The unified shared backbone for all modalities. unified_model_kwargs: Other specific parameters to pass to the module. name: graph name. **kwargs: additional model args",
"name": "__init__",
"signature": "def __init__(self, unif... | 2 | null | Implement the Python class `UnifiedFusion` described below.
Class description:
Module to fuse audio, text and video for joint embedding learning.
Method signatures and docstrings:
- def __init__(self, unified_backbone='uvatt', unified_model_kwargs=None, name='unified_fusion_model', **kwargs): Initialize the UnifiedFu... | Implement the Python class `UnifiedFusion` described below.
Class description:
Module to fuse audio, text and video for joint embedding learning.
Method signatures and docstrings:
- def __init__(self, unified_backbone='uvatt', unified_model_kwargs=None, name='unified_fusion_model', **kwargs): Initialize the UnifiedFu... | 5573d9c5822f4e866b6692769963ae819cb3f10d | <|skeleton|>
class UnifiedFusion:
"""Module to fuse audio, text and video for joint embedding learning."""
def __init__(self, unified_backbone='uvatt', unified_model_kwargs=None, name='unified_fusion_model', **kwargs):
"""Initialize the UnifiedFusion class. Args: unified_backbone: The unified shared ba... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class UnifiedFusion:
"""Module to fuse audio, text and video for joint embedding learning."""
def __init__(self, unified_backbone='uvatt', unified_model_kwargs=None, name='unified_fusion_model', **kwargs):
"""Initialize the UnifiedFusion class. Args: unified_backbone: The unified shared backbone for al... | the_stack_v2_python_sparse | vatt/modeling/backbones/multimodal.py | Jimmy-INL/google-research | train | 1 |
0db05f26679c1f753d5fcd0e60f5f9349a80bed1 | [
"lhs_bytes = old_contentfile_bytes\npatch_bytes_ex = patch_bytes\nrhs_bytes = file_patch(lhs_bytes, patch_bytes_ex, ver=1)\nnew_contentfile_bytes = rhs_bytes\nreturn new_contentfile_bytes",
"ls = []\nfor patch_idx, imay_parent_idx, user_data_dir_path, contentfile_path, content_binary_ifile in iter_tpl5s:\n wit... | <|body_start_0|>
lhs_bytes = old_contentfile_bytes
patch_bytes_ex = patch_bytes
rhs_bytes = file_patch(lhs_bytes, patch_bytes_ex, ver=1)
new_contentfile_bytes = rhs_bytes
return new_contentfile_bytes
<|end_body_0|>
<|body_start_1|>
ls = []
for patch_idx, imay_par... | IRepositorySetting__using_file_cmp__file_patch_ver1 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IRepositorySetting__using_file_cmp__file_patch_ver1:
def contentfile_patch(sf, old_contentfile_bytes, patch_bytes, /):
"""old_contentfile_bytes -> patch_bytes -> new_contentfile_bytes"""
<|body_0|>
def ___open_patch_idx___(sf, iter_tpl5s, /):
"""Iter (patch_idx, imay... | stack_v2_sparse_classes_10k_train_002494 | 1,796 | no_license | [
{
"docstring": "old_contentfile_bytes -> patch_bytes -> new_contentfile_bytes",
"name": "contentfile_patch",
"signature": "def contentfile_patch(sf, old_contentfile_bytes, patch_bytes, /)"
},
{
"docstring": "Iter (patch_idx, imay_parent_idx, user_data_dir_path, contentfile_path, content_binary_i... | 2 | null | Implement the Python class `IRepositorySetting__using_file_cmp__file_patch_ver1` described below.
Class description:
Implement the IRepositorySetting__using_file_cmp__file_patch_ver1 class.
Method signatures and docstrings:
- def contentfile_patch(sf, old_contentfile_bytes, patch_bytes, /): old_contentfile_bytes -> p... | Implement the Python class `IRepositorySetting__using_file_cmp__file_patch_ver1` described below.
Class description:
Implement the IRepositorySetting__using_file_cmp__file_patch_ver1 class.
Method signatures and docstrings:
- def contentfile_patch(sf, old_contentfile_bytes, patch_bytes, /): old_contentfile_bytes -> p... | 41f3a506feffb5f33d4559e5b69717d9bb6303c9 | <|skeleton|>
class IRepositorySetting__using_file_cmp__file_patch_ver1:
def contentfile_patch(sf, old_contentfile_bytes, patch_bytes, /):
"""old_contentfile_bytes -> patch_bytes -> new_contentfile_bytes"""
<|body_0|>
def ___open_patch_idx___(sf, iter_tpl5s, /):
"""Iter (patch_idx, imay... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class IRepositorySetting__using_file_cmp__file_patch_ver1:
def contentfile_patch(sf, old_contentfile_bytes, patch_bytes, /):
"""old_contentfile_bytes -> patch_bytes -> new_contentfile_bytes"""
lhs_bytes = old_contentfile_bytes
patch_bytes_ex = patch_bytes
rhs_bytes = file_patch(lhs_b... | the_stack_v2_python_sparse | nn_ns/filedir/backup_tools/IRepositorySetting__using_file_cmp__file_patch.py | edt-yxz-zzd/python3_src | train | 2 | |
5d705cfb3d080c018b0b3fa01284b2454494da47 | [
"self._term_doc_matrix = term_doc_matrix\nself._term_doc_matrix_factory = term_doc_matrix_factory\nassert term_doc_matrix_factory._nlp is None\nassert term_doc_matrix_factory.category_text_iter is None\nself._category = category\nself._clf = None\nself._proba = None",
"self._clf = PassiveAggressiveClassifier(n_it... | <|body_start_0|>
self._term_doc_matrix = term_doc_matrix
self._term_doc_matrix_factory = term_doc_matrix_factory
assert term_doc_matrix_factory._nlp is None
assert term_doc_matrix_factory.category_text_iter is None
self._category = category
self._clf = None
self._... | DeployedClassifierFactory | [
"MIT",
"CC-BY-NC-SA-4.0",
"LicenseRef-scancode-proprietary-license",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DeployedClassifierFactory:
def __init__(self, term_doc_matrix, term_doc_matrix_factory, category, nlp=None):
"""This is a class that enables one to train and save a classification model. Parameters ---------- term_doc_matrix : TermDocMatrix term_doc_matrix_factory : TermDocMatrixFactory ... | stack_v2_sparse_classes_10k_train_002495 | 2,832 | permissive | [
{
"docstring": "This is a class that enables one to train and save a classification model. Parameters ---------- term_doc_matrix : TermDocMatrix term_doc_matrix_factory : TermDocMatrixFactory category : str Category name nlp : spacy parser",
"name": "__init__",
"signature": "def __init__(self, term_doc_... | 3 | null | Implement the Python class `DeployedClassifierFactory` described below.
Class description:
Implement the DeployedClassifierFactory class.
Method signatures and docstrings:
- def __init__(self, term_doc_matrix, term_doc_matrix_factory, category, nlp=None): This is a class that enables one to train and save a classific... | Implement the Python class `DeployedClassifierFactory` described below.
Class description:
Implement the DeployedClassifierFactory class.
Method signatures and docstrings:
- def __init__(self, term_doc_matrix, term_doc_matrix_factory, category, nlp=None): This is a class that enables one to train and save a classific... | b41e3a875faf6dd886e49e524345202432db1b21 | <|skeleton|>
class DeployedClassifierFactory:
def __init__(self, term_doc_matrix, term_doc_matrix_factory, category, nlp=None):
"""This is a class that enables one to train and save a classification model. Parameters ---------- term_doc_matrix : TermDocMatrix term_doc_matrix_factory : TermDocMatrixFactory ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DeployedClassifierFactory:
def __init__(self, term_doc_matrix, term_doc_matrix_factory, category, nlp=None):
"""This is a class that enables one to train and save a classification model. Parameters ---------- term_doc_matrix : TermDocMatrix term_doc_matrix_factory : TermDocMatrixFactory category : str... | the_stack_v2_python_sparse | scattertext/DeployedClassifier.py | JasonKessler/scattertext | train | 2,187 | |
00656689e19219415c1e39edc0b716d83de665db | [
"if not hasattr(self, '_D'):\n self.logger.warning('The differential operator G.D is not available, we need to compute it. Explicitly call G.compute_differential_operator() once beforehand to suppress the warning.')\n self.compute_differential_operator()\nreturn self._D",
"v_in, v_out, weights = self.get_ed... | <|body_start_0|>
if not hasattr(self, '_D'):
self.logger.warning('The differential operator G.D is not available, we need to compute it. Explicitly call G.compute_differential_operator() once beforehand to suppress the warning.')
self.compute_differential_operator()
return self._... | GraphDifference | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GraphDifference:
def D(self):
"""Differential operator (for gradient and divergence). Is computed by :func:`compute_differential_operator`."""
<|body_0|>
def compute_differential_operator(self):
"""Compute the graph differential operator (cached). The differential op... | stack_v2_sparse_classes_10k_train_002496 | 4,230 | permissive | [
{
"docstring": "Differential operator (for gradient and divergence). Is computed by :func:`compute_differential_operator`.",
"name": "D",
"signature": "def D(self)"
},
{
"docstring": "Compute the graph differential operator (cached). The differential operator is a matrix such that .. math:: L = ... | 4 | stack_v2_sparse_classes_30k_train_001951 | Implement the Python class `GraphDifference` described below.
Class description:
Implement the GraphDifference class.
Method signatures and docstrings:
- def D(self): Differential operator (for gradient and divergence). Is computed by :func:`compute_differential_operator`.
- def compute_differential_operator(self): C... | Implement the Python class `GraphDifference` described below.
Class description:
Implement the GraphDifference class.
Method signatures and docstrings:
- def D(self): Differential operator (for gradient and divergence). Is computed by :func:`compute_differential_operator`.
- def compute_differential_operator(self): C... | 361f0258a210193f482c6197ea879765a9041e91 | <|skeleton|>
class GraphDifference:
def D(self):
"""Differential operator (for gradient and divergence). Is computed by :func:`compute_differential_operator`."""
<|body_0|>
def compute_differential_operator(self):
"""Compute the graph differential operator (cached). The differential op... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GraphDifference:
def D(self):
"""Differential operator (for gradient and divergence). Is computed by :func:`compute_differential_operator`."""
if not hasattr(self, '_D'):
self.logger.warning('The differential operator G.D is not available, we need to compute it. Explicitly call G.c... | the_stack_v2_python_sparse | pygsp/graphs/difference.py | naspert/pygsp | train | 0 | |
b97c5d03774577aabae46632a1a9428a132df0c7 | [
"books = BookInfo.objects.all()\nbooks_li = []\nfor book in books:\n data = {'id': book.id, 'btitle': book.btitle, 'bpub_date': book.bpub_date, 'bread': book.bread, 'bcomment': book.bcomment, 'image': book.image.url if book.image else ''}\n books_li.append(data)\nreturn JsonResponse(books_li, safe=False)",
... | <|body_start_0|>
books = BookInfo.objects.all()
books_li = []
for book in books:
data = {'id': book.id, 'btitle': book.btitle, 'bpub_date': book.bpub_date, 'bread': book.bread, 'bcomment': book.bcomment, 'image': book.image.url if book.image else ''}
books_li.append(data)... | BookListView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BookListView:
def get(self, request):
"""获取所有图书信息"""
<|body_0|>
def post(self, request):
"""新建一本图书信息"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
books = BookInfo.objects.all()
books_li = []
for book in books:
data = {... | stack_v2_sparse_classes_10k_train_002497 | 4,373 | no_license | [
{
"docstring": "获取所有图书信息",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "新建一本图书信息",
"name": "post",
"signature": "def post(self, request)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005045 | Implement the Python class `BookListView` described below.
Class description:
Implement the BookListView class.
Method signatures and docstrings:
- def get(self, request): 获取所有图书信息
- def post(self, request): 新建一本图书信息 | Implement the Python class `BookListView` described below.
Class description:
Implement the BookListView class.
Method signatures and docstrings:
- def get(self, request): 获取所有图书信息
- def post(self, request): 新建一本图书信息
<|skeleton|>
class BookListView:
def get(self, request):
"""获取所有图书信息"""
<|body_... | f8ec0bec399253e481e16443ba9a3e45e61486f4 | <|skeleton|>
class BookListView:
def get(self, request):
"""获取所有图书信息"""
<|body_0|>
def post(self, request):
"""新建一本图书信息"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BookListView:
def get(self, request):
"""获取所有图书信息"""
books = BookInfo.objects.all()
books_li = []
for book in books:
data = {'id': book.id, 'btitle': book.btitle, 'bpub_date': book.bpub_date, 'bread': book.bread, 'bcomment': book.bcomment, 'image': book.image.url if... | the_stack_v2_python_sparse | drf_demo/booktest/views-01-Django自定义RestAPI接口.py | cz495969281/2019_- | train | 0 | |
8d6a9f254f5f172d59c528d8e8f6dd584e13f435 | [
"tk.Frame.__init__(self, container)\nf = Figure(figsize=(10, 10), dpi=100)\nself.subp_1 = f.add_subplot(211)\nself.subp_2 = f.add_subplot(212)\ngraph_genotype_GUI(genotype, self.subp_2)\nnorm_in = getNormalizedInputs(num_x, num_y)\noutputs = []\nfor ins in norm_in:\n outputs.append(genotype.getOutput(ins)[0])\no... | <|body_start_0|>
tk.Frame.__init__(self, container)
f = Figure(figsize=(10, 10), dpi=100)
self.subp_1 = f.add_subplot(211)
self.subp_2 = f.add_subplot(212)
graph_genotype_GUI(genotype, self.subp_2)
norm_in = getNormalizedInputs(num_x, num_y)
outputs = []
f... | Class containing frame for GUI widget that allows users to move sliders to change weights within the CPPN | SliderPage | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SliderPage:
"""Class containing frame for GUI widget that allows users to move sliders to change weights within the CPPN"""
def __init__(self, container, master, genotype):
"""Constructor for slider frame"""
<|body_0|>
def add_sliders(self):
"""Adds all needed sl... | stack_v2_sparse_classes_10k_train_002498 | 11,786 | no_license | [
{
"docstring": "Constructor for slider frame",
"name": "__init__",
"signature": "def __init__(self, container, master, genotype)"
},
{
"docstring": "Adds all needed slider items to the slider page of the GUI",
"name": "add_sliders",
"signature": "def add_sliders(self)"
},
{
"docs... | 3 | stack_v2_sparse_classes_30k_train_003614 | Implement the Python class `SliderPage` described below.
Class description:
Class containing frame for GUI widget that allows users to move sliders to change weights within the CPPN
Method signatures and docstrings:
- def __init__(self, container, master, genotype): Constructor for slider frame
- def add_sliders(self... | Implement the Python class `SliderPage` described below.
Class description:
Class containing frame for GUI widget that allows users to move sliders to change weights within the CPPN
Method signatures and docstrings:
- def __init__(self, container, master, genotype): Constructor for slider frame
- def add_sliders(self... | 317b615e39df5999f2fd3d5e7dd0af7d54aee6c8 | <|skeleton|>
class SliderPage:
"""Class containing frame for GUI widget that allows users to move sliders to change weights within the CPPN"""
def __init__(self, container, master, genotype):
"""Constructor for slider frame"""
<|body_0|>
def add_sliders(self):
"""Adds all needed sl... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SliderPage:
"""Class containing frame for GUI widget that allows users to move sliders to change weights within the CPPN"""
def __init__(self, container, master, genotype):
"""Constructor for slider frame"""
tk.Frame.__init__(self, container)
f = Figure(figsize=(10, 10), dpi=100)
... | the_stack_v2_python_sparse | FULL_CPPN_playground.py | wolfecameron/CPPN_springopt | train | 4 |
a94570d1a23c3567d5d1ef72e726c30f863b4e82 | [
"url = self._get_base_url()\nresp = self.request('POST', url, request_entity=CreateTenant(tenant_id))\nreturn resp",
"url = '{base}/{tenant_id}'.format(base=self._get_base_url(), tenant_id=tenant_id)\nresp = self.request('GET', url, response_entity_type=Tenant)\nreturn resp",
"url = '{base}/{tenant_id}/token'.f... | <|body_start_0|>
url = self._get_base_url()
resp = self.request('POST', url, request_entity=CreateTenant(tenant_id))
return resp
<|end_body_0|>
<|body_start_1|>
url = '{base}/{tenant_id}'.format(base=self._get_base_url(), tenant_id=tenant_id)
resp = self.request('GET', url, resp... | TenantClient | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TenantClient:
def create_tenant(self, tenant_id):
"""@summary: Creates a tenant with the given id @param tenant_id:"""
<|body_0|>
def get_tenant(self, tenant_id):
"""@summary: Retrieves the version information from the API"""
<|body_1|>
def validate_toke... | stack_v2_sparse_classes_10k_train_002499 | 6,572 | permissive | [
{
"docstring": "@summary: Creates a tenant with the given id @param tenant_id:",
"name": "create_tenant",
"signature": "def create_tenant(self, tenant_id)"
},
{
"docstring": "@summary: Retrieves the version information from the API",
"name": "get_tenant",
"signature": "def get_tenant(sel... | 4 | null | Implement the Python class `TenantClient` described below.
Class description:
Implement the TenantClient class.
Method signatures and docstrings:
- def create_tenant(self, tenant_id): @summary: Creates a tenant with the given id @param tenant_id:
- def get_tenant(self, tenant_id): @summary: Retrieves the version info... | Implement the Python class `TenantClient` described below.
Class description:
Implement the TenantClient class.
Method signatures and docstrings:
- def create_tenant(self, tenant_id): @summary: Creates a tenant with the given id @param tenant_id:
- def get_tenant(self, tenant_id): @summary: Retrieves the version info... | 7d49cf6bfd7e1a6e5b739e7de52f2e18e5ccf924 | <|skeleton|>
class TenantClient:
def create_tenant(self, tenant_id):
"""@summary: Creates a tenant with the given id @param tenant_id:"""
<|body_0|>
def get_tenant(self, tenant_id):
"""@summary: Retrieves the version information from the API"""
<|body_1|>
def validate_toke... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TenantClient:
def create_tenant(self, tenant_id):
"""@summary: Creates a tenant with the given id @param tenant_id:"""
url = self._get_base_url()
resp = self.request('POST', url, request_entity=CreateTenant(tenant_id))
return resp
def get_tenant(self, tenant_id):
"... | the_stack_v2_python_sparse | cloudcafe/meniscus/tenant_api/client.py | kurhula/cloudcafe | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.