blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 6.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 438 7.52k | id stringlengths 40 40 | length_bytes int64 506 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.25k | prompted_full_text stringlengths 645 10.7k | revision_id stringlengths 40 40 | skeleton stringlengths 162 4.34k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | solution stringlengths 302 7.33k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ef10982b6e273e7456dff909c70456075cd34d19 | [
"logs.log_info('You are using the vgK channel: Kv1.4')\nself.time_unit = 1000.0\nself.vrev = -65\nself.m = 1.0 / (1 + np.exp((V + 21.7) / -16.9))\nself.h = 1.0 / (1 + np.exp((V + 73.6) / 12.8))\nself._mpower = 1\nself._hpower = 1",
"self._mInf = 1.0 / (1 + np.exp((V + 21.7) / -16.9))\nself._mTau = 3.0\nself._hInf... | <|body_start_0|>
logs.log_info('You are using the vgK channel: Kv1.4')
self.time_unit = 1000.0
self.vrev = -65
self.m = 1.0 / (1 + np.exp((V + 21.7) / -16.9))
self.h = 1.0 / (1 + np.exp((V + 73.6) / 12.8))
self._mpower = 1
self._hpower = 1
<|end_body_0|>
<|body_s... | Kv1.4 model from Stuhmer et al 1989. reference: W Stühmer et. al; EMBO J. 1989 Nov | Kv1p4 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Kv1p4:
"""Kv1.4 model from Stuhmer et al 1989. reference: W Stühmer et. al; EMBO J. 1989 Nov"""
def _init_state(self, V):
"""Run initialization calculation for m and h gates of the channel at starting Vmem value."""
<|body_0|>
def _calculate_state(self, V):
"""Up... | stack_v2_sparse_classes_36k_train_028500 | 24,227 | no_license | [
{
"docstring": "Run initialization calculation for m and h gates of the channel at starting Vmem value.",
"name": "_init_state",
"signature": "def _init_state(self, V)"
},
{
"docstring": "Update the state of m and h gates of the channel given their present value and present simulation Vmem.",
... | 2 | null | Implement the Python class `Kv1p4` described below.
Class description:
Kv1.4 model from Stuhmer et al 1989. reference: W Stühmer et. al; EMBO J. 1989 Nov
Method signatures and docstrings:
- def _init_state(self, V): Run initialization calculation for m and h gates of the channel at starting Vmem value.
- def _calcula... | Implement the Python class `Kv1p4` described below.
Class description:
Kv1.4 model from Stuhmer et al 1989. reference: W Stühmer et. al; EMBO J. 1989 Nov
Method signatures and docstrings:
- def _init_state(self, V): Run initialization calculation for m and h gates of the channel at starting Vmem value.
- def _calcula... | dd03ff5e3df3ef48d887a6566a6286fcd168880b | <|skeleton|>
class Kv1p4:
"""Kv1.4 model from Stuhmer et al 1989. reference: W Stühmer et. al; EMBO J. 1989 Nov"""
def _init_state(self, V):
"""Run initialization calculation for m and h gates of the channel at starting Vmem value."""
<|body_0|>
def _calculate_state(self, V):
"""Up... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Kv1p4:
"""Kv1.4 model from Stuhmer et al 1989. reference: W Stühmer et. al; EMBO J. 1989 Nov"""
def _init_state(self, V):
"""Run initialization calculation for m and h gates of the channel at starting Vmem value."""
logs.log_info('You are using the vgK channel: Kv1.4')
self.time_u... | the_stack_v2_python_sparse | betse/science/channels/vg_k.py | R-Stefano/betse-ml | train | 0 |
2ea15cf44b4fd5622fc0e931fe4ed287652c1b6c | [
"super().__init__(task_data)\nself.src_splitter = src_splitter\nself.tgt_splitter = tgt_splitter",
"if batched:\n src_sents = [src for src, tgt in self.task_data]\n chunked_sents = list(chunks(src_sents, batched))\n predictions = [prediction_fn(sents) for sents in tqdm.tqdm(chunked_sents, desc='predictin... | <|body_start_0|>
super().__init__(task_data)
self.src_splitter = src_splitter
self.tgt_splitter = tgt_splitter
<|end_body_0|>
<|body_start_1|>
if batched:
src_sents = [src for src, tgt in self.task_data]
chunked_sents = list(chunks(src_sents, batched))
... | TranslationExperiment | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TranslationExperiment:
def __init__(self, task_data, src_splitter=string_split_v1, tgt_splitter=string_split_v1):
"""task_data: [(str, str)]: this is the expected data format. >>> from src.Experiments import TranslationExperiment >>> translation_experiment = TranslationExperiment(validat... | stack_v2_sparse_classes_36k_train_028501 | 13,210 | no_license | [
{
"docstring": "task_data: [(str, str)]: this is the expected data format. >>> from src.Experiments import TranslationExperiment >>> translation_experiment = TranslationExperiment(validation_pairs) >>> def simple_translate(src): >>> return \"return output\" >>> translation_experiment.evaluate(simple_translate) ... | 2 | stack_v2_sparse_classes_30k_train_016670 | Implement the Python class `TranslationExperiment` described below.
Class description:
Implement the TranslationExperiment class.
Method signatures and docstrings:
- def __init__(self, task_data, src_splitter=string_split_v1, tgt_splitter=string_split_v1): task_data: [(str, str)]: this is the expected data format. >>... | Implement the Python class `TranslationExperiment` described below.
Class description:
Implement the TranslationExperiment class.
Method signatures and docstrings:
- def __init__(self, task_data, src_splitter=string_split_v1, tgt_splitter=string_split_v1): task_data: [(str, str)]: this is the expected data format. >>... | 92dd4d41ad6f2be5b5c4e296e2a355bb14b9a1db | <|skeleton|>
class TranslationExperiment:
def __init__(self, task_data, src_splitter=string_split_v1, tgt_splitter=string_split_v1):
"""task_data: [(str, str)]: this is the expected data format. >>> from src.Experiments import TranslationExperiment >>> translation_experiment = TranslationExperiment(validat... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TranslationExperiment:
def __init__(self, task_data, src_splitter=string_split_v1, tgt_splitter=string_split_v1):
"""task_data: [(str, str)]: this is the expected data format. >>> from src.Experiments import TranslationExperiment >>> translation_experiment = TranslationExperiment(validation_pairs) >>>... | the_stack_v2_python_sparse | notebooks/src/Experiments.py | carlos-gemmell/Glasgow-NLP | train | 0 | |
b0fb5b448f53ff73c83de8dabe78a11fbb1a44b9 | [
"super(MultiProcessPredictWorker, self).__init__()\nself.name = 'MultiProcessPredictWorker-{}'.format(idx)\nself.idx = idx\nself.config = config",
"if self.idx != 0:\n from tensorpack.models.registry import disable_layer_logging\n disable_layer_logging()\nself.predictor = OfflinePredictor(self.config)\nif s... | <|body_start_0|>
super(MultiProcessPredictWorker, self).__init__()
self.name = 'MultiProcessPredictWorker-{}'.format(idx)
self.idx = idx
self.config = config
<|end_body_0|>
<|body_start_1|>
if self.idx != 0:
from tensorpack.models.registry import disable_layer_loggin... | Base class for predict worker that runs offline in multiprocess | MultiProcessPredictWorker | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiProcessPredictWorker:
"""Base class for predict worker that runs offline in multiprocess"""
def __init__(self, idx, config):
"""Args: idx (int): index of the worker. the 0th worker will print log. config (PredictConfig): the config to use."""
<|body_0|>
def _init_ru... | stack_v2_sparse_classes_36k_train_028502 | 6,665 | permissive | [
{
"docstring": "Args: idx (int): index of the worker. the 0th worker will print log. config (PredictConfig): the config to use.",
"name": "__init__",
"signature": "def __init__(self, idx, config)"
},
{
"docstring": "Call _init_runtime under different CUDA_VISIBLE_DEVICES, you'll have workers tha... | 2 | null | Implement the Python class `MultiProcessPredictWorker` described below.
Class description:
Base class for predict worker that runs offline in multiprocess
Method signatures and docstrings:
- def __init__(self, idx, config): Args: idx (int): index of the worker. the 0th worker will print log. config (PredictConfig): t... | Implement the Python class `MultiProcessPredictWorker` described below.
Class description:
Base class for predict worker that runs offline in multiprocess
Method signatures and docstrings:
- def __init__(self, idx, config): Args: idx (int): index of the worker. the 0th worker will print log. config (PredictConfig): t... | 1547a54e8546494614ca31c984a1bfd1d0e24b77 | <|skeleton|>
class MultiProcessPredictWorker:
"""Base class for predict worker that runs offline in multiprocess"""
def __init__(self, idx, config):
"""Args: idx (int): index of the worker. the 0th worker will print log. config (PredictConfig): the config to use."""
<|body_0|>
def _init_ru... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MultiProcessPredictWorker:
"""Base class for predict worker that runs offline in multiprocess"""
def __init__(self, idx, config):
"""Args: idx (int): index of the worker. the 0th worker will print log. config (PredictConfig): the config to use."""
super(MultiProcessPredictWorker, self).__... | the_stack_v2_python_sparse | tensorpack/predict/concurrency.py | tensorpack/tensorpack | train | 4,600 |
9255d3e6c8a5225f3c6444051b220bf9674194dd | [
"for line in self.move_line_ids:\n if line.lot_id:\n stock = self.env['stock.quant'].search([('quantity', '>', 0), ('lot_id', '=', line.lot_id.id)])\n line.lot_id.qty_location = [(5, 0, 0)]\n if len(stock.ids) > 0:\n line.lot_id.qty_location = [(6, 0, stock.location_id.ids)]",
"... | <|body_start_0|>
for line in self.move_line_ids:
if line.lot_id:
stock = self.env['stock.quant'].search([('quantity', '>', 0), ('lot_id', '=', line.lot_id.id)])
line.lot_id.qty_location = [(5, 0, 0)]
if len(stock.ids) > 0:
line.lot_... | class_name: FlspStockPickingFilterSn inherit: stock.picking Purpose: To change the stock.production.lot field qty_location depending on transfer Date: Mar/30th/2021/T Author: Sami Byaruhanga | FlspStockPickingFilterSn | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FlspStockPickingFilterSn:
"""class_name: FlspStockPickingFilterSn inherit: stock.picking Purpose: To change the stock.production.lot field qty_location depending on transfer Date: Mar/30th/2021/T Author: Sami Byaruhanga"""
def change_product_qty_in_lot_table(self):
"""Purpose: To wri... | stack_v2_sparse_classes_36k_train_028503 | 7,672 | no_license | [
{
"docstring": "Purpose: To write the qty_location on stock,production.lot table",
"name": "change_product_qty_in_lot_table",
"signature": "def change_product_qty_in_lot_table(self)"
},
{
"docstring": "Purpose: To call method to change the stock.production table Note: Used method because its sho... | 2 | stack_v2_sparse_classes_30k_train_005514 | Implement the Python class `FlspStockPickingFilterSn` described below.
Class description:
class_name: FlspStockPickingFilterSn inherit: stock.picking Purpose: To change the stock.production.lot field qty_location depending on transfer Date: Mar/30th/2021/T Author: Sami Byaruhanga
Method signatures and docstrings:
- d... | Implement the Python class `FlspStockPickingFilterSn` described below.
Class description:
class_name: FlspStockPickingFilterSn inherit: stock.picking Purpose: To change the stock.production.lot field qty_location depending on transfer Date: Mar/30th/2021/T Author: Sami Byaruhanga
Method signatures and docstrings:
- d... | 4a82cd5cfd1898c6da860cb68dff3a14e037bbad | <|skeleton|>
class FlspStockPickingFilterSn:
"""class_name: FlspStockPickingFilterSn inherit: stock.picking Purpose: To change the stock.production.lot field qty_location depending on transfer Date: Mar/30th/2021/T Author: Sami Byaruhanga"""
def change_product_qty_in_lot_table(self):
"""Purpose: To wri... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FlspStockPickingFilterSn:
"""class_name: FlspStockPickingFilterSn inherit: stock.picking Purpose: To change the stock.production.lot field qty_location depending on transfer Date: Mar/30th/2021/T Author: Sami Byaruhanga"""
def change_product_qty_in_lot_table(self):
"""Purpose: To write the qty_lo... | the_stack_v2_python_sparse | flsp_mrp_filter_sn/models/filter_sn_method.py | odoo-smg/firstlight | train | 3 |
ebf54b7cfbf6e4e047d3ffde56111a592385ccf4 | [
"super(VggNet, self).__init__()\nself.vggname = vggname\nself.num_classes = num_classes\nself.regularizer = tf.contrib.layers.l2_regularizer(scale=wd)\nself.initializer = tf.contrib.layers.xavier_initializer()\nself.variance_initializer = tf.contrib.layers.variance_scaling_initializer(factor=0.1, mode='FAN_IN', uni... | <|body_start_0|>
super(VggNet, self).__init__()
self.vggname = vggname
self.num_classes = num_classes
self.regularizer = tf.contrib.layers.l2_regularizer(scale=wd)
self.initializer = tf.contrib.layers.xavier_initializer()
self.variance_initializer = tf.contrib.layers.vari... | Definition of VGG Networks. | VggNet | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VggNet:
"""Definition of VGG Networks."""
def __init__(self, vggname, neck, keep_prob, wd, feature_dim, num_classes=10):
"""Creates a model for classifying an image using VGG networks. Args: vggname: A string representing the vgg type, such as 'VGG11'. neck: A bool value that decides... | stack_v2_sparse_classes_36k_train_028504 | 5,958 | permissive | [
{
"docstring": "Creates a model for classifying an image using VGG networks. Args: vggname: A string representing the vgg type, such as 'VGG11'. neck: A bool value that decides using the MLP neck or not. keep_prob: The rate of keeping one neuron in Dropout. wd: The co-efficient of weight decay. feature_dim: the... | 5 | null | Implement the Python class `VggNet` described below.
Class description:
Definition of VGG Networks.
Method signatures and docstrings:
- def __init__(self, vggname, neck, keep_prob, wd, feature_dim, num_classes=10): Creates a model for classifying an image using VGG networks. Args: vggname: A string representing the v... | Implement the Python class `VggNet` described below.
Class description:
Definition of VGG Networks.
Method signatures and docstrings:
- def __init__(self, vggname, neck, keep_prob, wd, feature_dim, num_classes=10): Creates a model for classifying an image using VGG networks. Args: vggname: A string representing the v... | dea327aa9e7ef7f7bca5a6c225dbdca1077a06e9 | <|skeleton|>
class VggNet:
"""Definition of VGG Networks."""
def __init__(self, vggname, neck, keep_prob, wd, feature_dim, num_classes=10):
"""Creates a model for classifying an image using VGG networks. Args: vggname: A string representing the vgg type, such as 'VGG11'. neck: A bool value that decides... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VggNet:
"""Definition of VGG Networks."""
def __init__(self, vggname, neck, keep_prob, wd, feature_dim, num_classes=10):
"""Creates a model for classifying an image using VGG networks. Args: vggname: A string representing the vgg type, such as 'VGG11'. neck: A bool value that decides using the ML... | the_stack_v2_python_sparse | dble/vgg.py | Tarkiyah/googleResearch | train | 11 |
6dd2f875f220e3008c6bff830e65360b19e64c55 | [
"sparql_results = self.query('\\n select distinct ?rs ?session ?name ?number ?pid ?sitename\\n where {\\n \\n ?rs rdf:type austalk:RecordedSession .\\n ?rs olac:speaker ?participant .\\n \\n ?participant austalk:id ?pid .\\... | <|body_start_0|>
sparql_results = self.query('\n select distinct ?rs ?session ?name ?number ?pid ?sitename\n where {\n \n ?rs rdf:type austalk:RecordedSession .\n ?rs olac:speaker ?participant .\n \n ?participant austal... | A session is a logical representation of the actual recording session which takes place at a particular location. | SessionManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SessionManager:
"""A session is a logical representation of the actual recording session which takes place at a particular location."""
def all(self):
"""Returns all the session names"""
<|body_0|>
def filter_by_participant(self, participant):
"""Returns all the ... | stack_v2_sparse_classes_36k_train_028505 | 5,176 | no_license | [
{
"docstring": "Returns all the session names",
"name": "all",
"signature": "def all(self)"
},
{
"docstring": "Returns all the session names for a participant",
"name": "filter_by_participant",
"signature": "def filter_by_participant(self, participant)"
},
{
"docstring": "Returns... | 3 | stack_v2_sparse_classes_30k_train_005919 | Implement the Python class `SessionManager` described below.
Class description:
A session is a logical representation of the actual recording session which takes place at a particular location.
Method signatures and docstrings:
- def all(self): Returns all the session names
- def filter_by_participant(self, participa... | Implement the Python class `SessionManager` described below.
Class description:
A session is a logical representation of the actual recording session which takes place at a particular location.
Method signatures and docstrings:
- def all(self): Returns all the session names
- def filter_by_participant(self, participa... | 88000a79f0a18c92de0092814de3dbb2409f5515 | <|skeleton|>
class SessionManager:
"""A session is a logical representation of the actual recording session which takes place at a particular location."""
def all(self):
"""Returns all the session names"""
<|body_0|>
def filter_by_participant(self, participant):
"""Returns all the ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SessionManager:
"""A session is a logical representation of the actual recording session which takes place at a particular location."""
def all(self):
"""Returns all the session names"""
sparql_results = self.query('\n select distinct ?rs ?session ?name ?number ?pid ?sitename\n... | the_stack_v2_python_sparse | browse/modelspackage/sessions.py | Alveo/smallasc | train | 0 |
1738ed8d4580f1107dfbee9373698fe766ade0ac | [
"ENFORCER.enforce_call(action='identity:get_project_tag', build_target=_build_project_target_enforcement)\nPROVIDERS.resource_api.get_project_tag(project_id, value)\nreturn (None, http_client.NO_CONTENT)",
"ENFORCER.enforce_call(action='identity:create_project_tag', build_target=_build_project_target_enforcement)... | <|body_start_0|>
ENFORCER.enforce_call(action='identity:get_project_tag', build_target=_build_project_target_enforcement)
PROVIDERS.resource_api.get_project_tag(project_id, value)
return (None, http_client.NO_CONTENT)
<|end_body_0|>
<|body_start_1|>
ENFORCER.enforce_call(action='identit... | ProjectTagResource | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProjectTagResource:
def get(self, project_id, value):
"""Get information for a single tag associated with a given project. GET /v3/projects/{project_id}/tags/{value}"""
<|body_0|>
def put(self, project_id, value):
"""Add a single tag to a project. PUT /v3/projects/{p... | stack_v2_sparse_classes_36k_train_028506 | 22,149 | permissive | [
{
"docstring": "Get information for a single tag associated with a given project. GET /v3/projects/{project_id}/tags/{value}",
"name": "get",
"signature": "def get(self, project_id, value)"
},
{
"docstring": "Add a single tag to a project. PUT /v3/projects/{project_id}/tags/{value}",
"name":... | 3 | stack_v2_sparse_classes_30k_train_009309 | Implement the Python class `ProjectTagResource` described below.
Class description:
Implement the ProjectTagResource class.
Method signatures and docstrings:
- def get(self, project_id, value): Get information for a single tag associated with a given project. GET /v3/projects/{project_id}/tags/{value}
- def put(self,... | Implement the Python class `ProjectTagResource` described below.
Class description:
Implement the ProjectTagResource class.
Method signatures and docstrings:
- def get(self, project_id, value): Get information for a single tag associated with a given project. GET /v3/projects/{project_id}/tags/{value}
- def put(self,... | 03a0a8146a78682ede9eca12a5a7fdacde2035c8 | <|skeleton|>
class ProjectTagResource:
def get(self, project_id, value):
"""Get information for a single tag associated with a given project. GET /v3/projects/{project_id}/tags/{value}"""
<|body_0|>
def put(self, project_id, value):
"""Add a single tag to a project. PUT /v3/projects/{p... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProjectTagResource:
def get(self, project_id, value):
"""Get information for a single tag associated with a given project. GET /v3/projects/{project_id}/tags/{value}"""
ENFORCER.enforce_call(action='identity:get_project_tag', build_target=_build_project_target_enforcement)
PROVIDERS.re... | the_stack_v2_python_sparse | keystone/api/projects.py | sapcc/keystone | train | 0 | |
f6bef62c27ec34eaa02776887adc2b3c687f3701 | [
"arg = Base.check_string_param(arg)\nctypes.c_char_p(arg.encode('utf-8'))\nreturn self.dss_obj.DSSExecutiveS(0, ctypes.c_char_p(arg.encode('utf-8'))).decode('ascii')",
"arg = Base.check_string_param(arg)\nctypes.c_char_p(arg.encode('utf-8'))\nreturn self.dss_obj.DSSExecutiveS(1, ctypes.c_char_p(arg.encode('utf-8'... | <|body_start_0|>
arg = Base.check_string_param(arg)
ctypes.c_char_p(arg.encode('utf-8'))
return self.dss_obj.DSSExecutiveS(0, ctypes.c_char_p(arg.encode('utf-8'))).decode('ascii')
<|end_body_0|>
<|body_start_1|>
arg = Base.check_string_param(arg)
ctypes.c_char_p(arg.encode('utf-... | This interface can be used to read/write certain properties of the active DSS object. The structure of the interface is as follows: CStr DSSExecutiveS(int32_t Parameter, CStr Argument); This interface returns a string with the result of the query according to the value of the variable Parameter, which can be one of the... | DSSExecutiveS | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DSSExecutiveS:
"""This interface can be used to read/write certain properties of the active DSS object. The structure of the interface is as follows: CStr DSSExecutiveS(int32_t Parameter, CStr Argument); This interface returns a string with the result of the query according to the value of the va... | stack_v2_sparse_classes_36k_train_028507 | 2,145 | permissive | [
{
"docstring": "Gets i-th command (specified in the argument as string).",
"name": "executive_command",
"signature": "def executive_command(self, arg: str) -> str"
},
{
"docstring": "Gets i-th option (specified in the argument as string).",
"name": "executive_option",
"signature": "def e... | 5 | null | Implement the Python class `DSSExecutiveS` described below.
Class description:
This interface can be used to read/write certain properties of the active DSS object. The structure of the interface is as follows: CStr DSSExecutiveS(int32_t Parameter, CStr Argument); This interface returns a string with the result of the... | Implement the Python class `DSSExecutiveS` described below.
Class description:
This interface can be used to read/write certain properties of the active DSS object. The structure of the interface is as follows: CStr DSSExecutiveS(int32_t Parameter, CStr Argument); This interface returns a string with the result of the... | a447c97787aeac962381db88dd622ccb235eef4b | <|skeleton|>
class DSSExecutiveS:
"""This interface can be used to read/write certain properties of the active DSS object. The structure of the interface is as follows: CStr DSSExecutiveS(int32_t Parameter, CStr Argument); This interface returns a string with the result of the query according to the value of the va... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DSSExecutiveS:
"""This interface can be used to read/write certain properties of the active DSS object. The structure of the interface is as follows: CStr DSSExecutiveS(int32_t Parameter, CStr Argument); This interface returns a string with the result of the query according to the value of the variable Parame... | the_stack_v2_python_sparse | src/py_dss_interface/models/DSSExecutive/DSSExecutiveS.py | vmuthuk2/py_dss_interface | train | 0 |
34299128c5f55529f624d67d693a33a74200849c | [
"self.org_name = org_name\nself.org_version = org_version\nself.org_arr = re.split('\\\\s', org_name)\nself.species = '{} {}'.format(self.org_arr[0], self.org_arr[1])\nself.strain = ''\nif len(self.org_arr) > 2:\n self.strain = ' '.join(self.org_arr[2:])",
"org = re.split('\\\\s+', self.org_name)\nif len(org) ... | <|body_start_0|>
self.org_name = org_name
self.org_version = org_version
self.org_arr = re.split('\\s', org_name)
self.species = '{} {}'.format(self.org_arr[0], self.org_arr[1])
self.strain = ''
if len(self.org_arr) > 2:
self.strain = ' '.join(self.org_arr[2:]... | OrganismName | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OrganismName:
def __init__(self, org_name, org_version=1):
"""class constructor for the Organism name parameters ------------- org_name: str Full name of the organism org_version: str Version string"""
<|body_0|>
def prefix(self):
"""Returns the organism prefix Retur... | stack_v2_sparse_classes_36k_train_028508 | 16,717 | permissive | [
{
"docstring": "class constructor for the Organism name parameters ------------- org_name: str Full name of the organism org_version: str Version string",
"name": "__init__",
"signature": "def __init__(self, org_name, org_version=1)"
},
{
"docstring": "Returns the organism prefix Returns -------... | 3 | stack_v2_sparse_classes_30k_train_006675 | Implement the Python class `OrganismName` described below.
Class description:
Implement the OrganismName class.
Method signatures and docstrings:
- def __init__(self, org_name, org_version=1): class constructor for the Organism name parameters ------------- org_name: str Full name of the organism org_version: str Ver... | Implement the Python class `OrganismName` described below.
Class description:
Implement the OrganismName class.
Method signatures and docstrings:
- def __init__(self, org_name, org_version=1): class constructor for the Organism name parameters ------------- org_name: str Full name of the organism org_version: str Ver... | 54181f04cca42b45bef0fa3f1e062e2bc70b6016 | <|skeleton|>
class OrganismName:
def __init__(self, org_name, org_version=1):
"""class constructor for the Organism name parameters ------------- org_name: str Full name of the organism org_version: str Version string"""
<|body_0|>
def prefix(self):
"""Returns the organism prefix Retur... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OrganismName:
def __init__(self, org_name, org_version=1):
"""class constructor for the Organism name parameters ------------- org_name: str Full name of the organism org_version: str Version string"""
self.org_name = org_name
self.org_version = org_version
self.org_arr = re.sp... | the_stack_v2_python_sparse | galEupy/taxomony.py | computational-genomics-lab/GAL | train | 3 | |
2361b9a96d30fbe16752a84561bf8799304d433a | [
"super(MaskedWordPredictions, self).__init__()\nself.transform = BertPredictionHeadTransform(config)\nself.decoder = nn.Linear(in_features=config.hidden_size, out_features=config.vocab_size, bias=False)\nself.bias = nn.Parameter(torch.zeros(config.vocab_size))",
"hidden_states = self.transform(hidden_states)\nhid... | <|body_start_0|>
super(MaskedWordPredictions, self).__init__()
self.transform = BertPredictionHeadTransform(config)
self.decoder = nn.Linear(in_features=config.hidden_size, out_features=config.vocab_size, bias=False)
self.bias = nn.Parameter(torch.zeros(config.vocab_size))
<|end_body_0|>... | MaskedWordPredictions | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MaskedWordPredictions:
def __init__(self, config):
"""事前学習課題:Masked Language Model用のモジュール 元の[2]の実装では、BertLMPredictionHeadという名前です。"""
<|body_0|>
def forward(self, hidden_states):
"""hidden_states:BERTからの出力[batch_size, seq_len, hidden_size]"""
<|body_1|>
<|end... | stack_v2_sparse_classes_36k_train_028509 | 30,882 | permissive | [
{
"docstring": "事前学習課題:Masked Language Model用のモジュール 元の[2]の実装では、BertLMPredictionHeadという名前です。",
"name": "__init__",
"signature": "def __init__(self, config)"
},
{
"docstring": "hidden_states:BERTからの出力[batch_size, seq_len, hidden_size]",
"name": "forward",
"signature": "def forward(self, hi... | 2 | stack_v2_sparse_classes_30k_train_003066 | Implement the Python class `MaskedWordPredictions` described below.
Class description:
Implement the MaskedWordPredictions class.
Method signatures and docstrings:
- def __init__(self, config): 事前学習課題:Masked Language Model用のモジュール 元の[2]の実装では、BertLMPredictionHeadという名前です。
- def forward(self, hidden_states): hidden_state... | Implement the Python class `MaskedWordPredictions` described below.
Class description:
Implement the MaskedWordPredictions class.
Method signatures and docstrings:
- def __init__(self, config): 事前学習課題:Masked Language Model用のモジュール 元の[2]の実装では、BertLMPredictionHeadという名前です。
- def forward(self, hidden_states): hidden_state... | bada8e07bd7503ed6d7a371fafb7a29b52b06d62 | <|skeleton|>
class MaskedWordPredictions:
def __init__(self, config):
"""事前学習課題:Masked Language Model用のモジュール 元の[2]の実装では、BertLMPredictionHeadという名前です。"""
<|body_0|>
def forward(self, hidden_states):
"""hidden_states:BERTからの出力[batch_size, seq_len, hidden_size]"""
<|body_1|>
<|end... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MaskedWordPredictions:
def __init__(self, config):
"""事前学習課題:Masked Language Model用のモジュール 元の[2]の実装では、BertLMPredictionHeadという名前です。"""
super(MaskedWordPredictions, self).__init__()
self.transform = BertPredictionHeadTransform(config)
self.decoder = nn.Linear(in_features=config.hi... | the_stack_v2_python_sparse | 8_nlp_sentiment_bert/utils/bert.py | YutaroOgawa/pytorch_advanced | train | 811 | |
b680d87d62bf48ef595d5e68b5f783393d7ae399 | [
"encoded_string = []\n\ndef build_string(node):\n if not node:\n encoded_string.append('None')\n else:\n encoded_string.append(str(node.val))\n build_string(node.left)\n build_string(node.right)\nbuild_string(root)\nreturn ','.join(encoded_string)",
"if not data or len(data) == 0... | <|body_start_0|>
encoded_string = []
def build_string(node):
if not node:
encoded_string.append('None')
else:
encoded_string.append(str(node.val))
build_string(node.left)
build_string(node.right)
build_strin... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_36k_train_028510 | 2,964 | 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:... | 9d0ff0f8705451947a6605ab5ef92bb3e27a7147 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
encoded_string = []
def build_string(node):
if not node:
encoded_string.append('None')
else:
encoded_string.append(str(no... | the_stack_v2_python_sparse | tree/serialize_and_deserialize_btree.py | rayt579/leetcode | train | 0 | |
8aefaba9b382d84fe30da2e717b8ae922bd23c4f | [
"self.address = address\nself.age = age\nself.birthday = birthday\nself.birthtime = APIHelper.RFC3339DateTime(birthtime) if birthtime else None\nself.name = name\nself.uid = uid\nself.person_type = person_type\nself.additional_properties = additional_properties",
"if dictionary is None:\n return None\ndiscrimi... | <|body_start_0|>
self.address = address
self.age = age
self.birthday = birthday
self.birthtime = APIHelper.RFC3339DateTime(birthtime) if birthtime else None
self.name = name
self.uid = uid
self.person_type = person_type
self.additional_properties = additio... | Implementation of the 'Person' model. TODO: type model description here. Attributes: address (string): TODO: type description here. age (long|int): TODO: type description here. birthday (date): TODO: type description here. birthtime (datetime): TODO: type description here. name (string): TODO: type description here. ui... | Person | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Person:
"""Implementation of the 'Person' model. TODO: type model description here. Attributes: address (string): TODO: type description here. age (long|int): TODO: type description here. birthday (date): TODO: type description here. birthtime (datetime): TODO: type description here. name (string... | stack_v2_sparse_classes_36k_train_028511 | 13,843 | permissive | [
{
"docstring": "Constructor for the Person class",
"name": "__init__",
"signature": "def __init__(self, address=None, age=None, birthday=None, birthtime=None, name=None, uid=None, person_type=None, additional_properties={})"
},
{
"docstring": "Creates an instance of this model from a dictionary ... | 2 | stack_v2_sparse_classes_30k_train_004051 | Implement the Python class `Person` described below.
Class description:
Implementation of the 'Person' model. TODO: type model description here. Attributes: address (string): TODO: type description here. age (long|int): TODO: type description here. birthday (date): TODO: type description here. birthtime (datetime): TO... | Implement the Python class `Person` described below.
Class description:
Implementation of the 'Person' model. TODO: type model description here. Attributes: address (string): TODO: type description here. age (long|int): TODO: type description here. birthday (date): TODO: type description here. birthtime (datetime): TO... | 49acc3d416a1dde7ea43b178d070484baf1b7f2b | <|skeleton|>
class Person:
"""Implementation of the 'Person' model. TODO: type model description here. Attributes: address (string): TODO: type description here. age (long|int): TODO: type description here. birthday (date): TODO: type description here. birthtime (datetime): TODO: type description here. name (string... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Person:
"""Implementation of the 'Person' model. TODO: type model description here. Attributes: address (string): TODO: type description here. age (long|int): TODO: type description here. birthday (date): TODO: type description here. birthtime (datetime): TODO: type description here. name (string): TODO: type... | the_stack_v2_python_sparse | PYTHON_GENERIC_LIB/tester/models/person.py | MaryamAdnan3/Tester1 | train | 0 |
0c7a1a5b96126d09e5945b798b8f16a5c95957cd | [
"super().__init__(parent)\nself.input_q = command_queue\nself.sphere_args = sphere_args\nself.fname = fname\nself.file_lock = file_lock\nself.signal_q = mp.Queue()\nself.command_q = mp.Queue()",
"process = wranglerProcess(self.command_q, self.signal_q, self.sphere_args, self.fname, self.file_lock)\nprocess.start(... | <|body_start_0|>
super().__init__(parent)
self.input_q = command_queue
self.sphere_args = sphere_args
self.fname = fname
self.file_lock = file_lock
self.signal_q = mp.Queue()
self.command_q = mp.Queue()
<|end_body_0|>
<|body_start_1|>
process = wranglerPr... | Base class for wranglerThreads. Used to manage processes including data and command queues. Subclasses should override the run method. attributes: command_q: mp.Queue, queue to send commands to process file_lock: mp.Condition, process safe lock for file access fname: str, path to data file. input_q: mp.Queue, queue for... | wranglerThread | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class wranglerThread:
"""Base class for wranglerThreads. Used to manage processes including data and command queues. Subclasses should override the run method. attributes: command_q: mp.Queue, queue to send commands to process file_lock: mp.Condition, process safe lock for file access fname: str, path ... | stack_v2_sparse_classes_36k_train_028512 | 8,377 | no_license | [
{
"docstring": "command_queue: mp.Queue, queue for commands sent from parent sphere_args: dict, used as **kwargs in sphere initialization. see EwaldSphere. fname: str, path to data file. file_lock: mp.Condition, process safe lock for file access",
"name": "__init__",
"signature": "def __init__(self, com... | 2 | stack_v2_sparse_classes_30k_train_004851 | Implement the Python class `wranglerThread` described below.
Class description:
Base class for wranglerThreads. Used to manage processes including data and command queues. Subclasses should override the run method. attributes: command_q: mp.Queue, queue to send commands to process file_lock: mp.Condition, process safe... | Implement the Python class `wranglerThread` described below.
Class description:
Base class for wranglerThreads. Used to manage processes including data and command queues. Subclasses should override the run method. attributes: command_q: mp.Queue, queue to send commands to process file_lock: mp.Condition, process safe... | f145e757d092d85b5a21dc4c36d99f82d55f7037 | <|skeleton|>
class wranglerThread:
"""Base class for wranglerThreads. Used to manage processes including data and command queues. Subclasses should override the run method. attributes: command_q: mp.Queue, queue to send commands to process file_lock: mp.Condition, process safe lock for file access fname: str, path ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class wranglerThread:
"""Base class for wranglerThreads. Used to manage processes including data and command queues. Subclasses should override the run method. attributes: command_q: mp.Queue, queue to send commands to process file_lock: mp.Condition, process safe lock for file access fname: str, path to data file.... | the_stack_v2_python_sparse | xdart/gui/tabs/static_scan/wranglers/wrangler_widget.py | rwalroth/xdart | train | 2 |
2628fa0c9f34505426440711d9d743c2dc218b38 | [
"m = 300\nctx.save_for_backward(k)\nk = k.double()\nanswer = (m / 2 - 1) * torch.log(k) - torch.log(sc.ive(m / 2 - 1, k)).cuda() - k - m / 2 * np.log(2 * np.pi)\nanswer = answer.float()\nreturn answer",
"k, = ctx.saved_tensors\nm = 300\nk = k.double()\nx = -(scipy.special.ive(m / 2, k) / scipy.special.ive(m / 2 -... | <|body_start_0|>
m = 300
ctx.save_for_backward(k)
k = k.double()
answer = (m / 2 - 1) * torch.log(k) - torch.log(sc.ive(m / 2 - 1, k)).cuda() - k - m / 2 * np.log(2 * np.pi)
answer = answer.float()
return answer
<|end_body_0|>
<|body_start_1|>
k, = ctx.saved_tens... | The exponentially scaled modified Bessel function of the first kind | Logcmk | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Logcmk:
"""The exponentially scaled modified Bessel function of the first kind"""
def forward(ctx, k):
"""In the forward pass we receive a Tensor containing the input and return a Tensor containing the output. ctx is a context object that can be used to stash information for backward... | stack_v2_sparse_classes_36k_train_028513 | 2,692 | permissive | [
{
"docstring": "In the forward pass we receive a Tensor containing the input and return a Tensor containing the output. ctx is a context object that can be used to stash information for backward computation. You can cache arbitrary objects for use in the backward pass using the ctx.save_for_backward method.",
... | 2 | null | Implement the Python class `Logcmk` described below.
Class description:
The exponentially scaled modified Bessel function of the first kind
Method signatures and docstrings:
- def forward(ctx, k): In the forward pass we receive a Tensor containing the input and return a Tensor containing the output. ctx is a context ... | Implement the Python class `Logcmk` described below.
Class description:
The exponentially scaled modified Bessel function of the first kind
Method signatures and docstrings:
- def forward(ctx, k): In the forward pass we receive a Tensor containing the input and return a Tensor containing the output. ctx is a context ... | 99cba1030ed8c012a453bc7715830fc99fb980dc | <|skeleton|>
class Logcmk:
"""The exponentially scaled modified Bessel function of the first kind"""
def forward(ctx, k):
"""In the forward pass we receive a Tensor containing the input and return a Tensor containing the output. ctx is a context object that can be used to stash information for backward... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Logcmk:
"""The exponentially scaled modified Bessel function of the first kind"""
def forward(ctx, k):
"""In the forward pass we receive a Tensor containing the input and return a Tensor containing the output. ctx is a context object that can be used to stash information for backward computation.... | the_stack_v2_python_sparse | models/loss/old_vonmises.py | jamesoneill12/LayerFusion | train | 2 |
55bacf93fa37998822fd952b0d6da90d8220d494 | [
"self._slug = 'couch'\nself.type = 'couch'\nself.server = server.strip()\nself.database = database.strip()\nself.interval = int(interval.strip())\nself.couch_view = view\ntry:\n self._couch = couchdb.Server(self.server)\nexcept Exception as e:\n raise\ntry:\n self._database = self._couch[self.database]\nex... | <|body_start_0|>
self._slug = 'couch'
self.type = 'couch'
self.server = server.strip()
self.database = database.strip()
self.interval = int(interval.strip())
self.couch_view = view
try:
self._couch = couchdb.Server(self.server)
except Exception... | Backend | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Backend:
def configure(self, server='http://localhost:5984', database='rapidsms', interval='1', view=False):
"""set backend variables and create DB connection"""
<|body_0|>
def run(self):
"""retrieves incoming sms from CouchDB and route"""
<|body_1|>
def... | stack_v2_sparse_classes_36k_train_028514 | 5,854 | no_license | [
{
"docstring": "set backend variables and create DB connection",
"name": "configure",
"signature": "def configure(self, server='http://localhost:5984', database='rapidsms', interval='1', view=False)"
},
{
"docstring": "retrieves incoming sms from CouchDB and route",
"name": "run",
"signa... | 5 | stack_v2_sparse_classes_30k_test_000691 | Implement the Python class `Backend` described below.
Class description:
Implement the Backend class.
Method signatures and docstrings:
- def configure(self, server='http://localhost:5984', database='rapidsms', interval='1', view=False): set backend variables and create DB connection
- def run(self): retrieves incomi... | Implement the Python class `Backend` described below.
Class description:
Implement the Backend class.
Method signatures and docstrings:
- def configure(self, server='http://localhost:5984', database='rapidsms', interval='1', view=False): set backend variables and create DB connection
- def run(self): retrieves incomi... | 750135e473cae865fe5ef1d98a28b7e1f764699d | <|skeleton|>
class Backend:
def configure(self, server='http://localhost:5984', database='rapidsms', interval='1', view=False):
"""set backend variables and create DB connection"""
<|body_0|>
def run(self):
"""retrieves incoming sms from CouchDB and route"""
<|body_1|>
def... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Backend:
def configure(self, server='http://localhost:5984', database='rapidsms', interval='1', view=False):
"""set backend variables and create DB connection"""
self._slug = 'couch'
self.type = 'couch'
self.server = server.strip()
self.database = database.strip()
... | the_stack_v2_python_sparse | patches/couch-backend/tiby/couch.py | digideskio/rapidsms-impl | train | 0 | |
92c77ec587f57751aa0ea4d615cf32175578fe70 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')"
] | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | Proto file describing the Ad Group service. Service to manage ad groups. | AdGroupServiceServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AdGroupServiceServicer:
"""Proto file describing the Ad Group service. Service to manage ad groups."""
def GetAdGroup(self, request, context):
"""Returns the requested ad group in full detail."""
<|body_0|>
def MutateAdGroups(self, request, context):
"""Creates, ... | stack_v2_sparse_classes_36k_train_028515 | 5,260 | permissive | [
{
"docstring": "Returns the requested ad group in full detail.",
"name": "GetAdGroup",
"signature": "def GetAdGroup(self, request, context)"
},
{
"docstring": "Creates, updates, or removes ad groups. Operation statuses are returned.",
"name": "MutateAdGroups",
"signature": "def MutateAdG... | 2 | null | Implement the Python class `AdGroupServiceServicer` described below.
Class description:
Proto file describing the Ad Group service. Service to manage ad groups.
Method signatures and docstrings:
- def GetAdGroup(self, request, context): Returns the requested ad group in full detail.
- def MutateAdGroups(self, request... | Implement the Python class `AdGroupServiceServicer` described below.
Class description:
Proto file describing the Ad Group service. Service to manage ad groups.
Method signatures and docstrings:
- def GetAdGroup(self, request, context): Returns the requested ad group in full detail.
- def MutateAdGroups(self, request... | a5b6cede64f4d9912ae6ad26927a54e40448c9fe | <|skeleton|>
class AdGroupServiceServicer:
"""Proto file describing the Ad Group service. Service to manage ad groups."""
def GetAdGroup(self, request, context):
"""Returns the requested ad group in full detail."""
<|body_0|>
def MutateAdGroups(self, request, context):
"""Creates, ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AdGroupServiceServicer:
"""Proto file describing the Ad Group service. Service to manage ad groups."""
def GetAdGroup(self, request, context):
"""Returns the requested ad group in full detail."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not imple... | the_stack_v2_python_sparse | google/ads/google_ads/v5/proto/services/ad_group_service_pb2_grpc.py | fiboknacky/google-ads-python | train | 0 |
af3a15a1d689a07b166ba0a904a6d65e908cb79b | [
"firstid = None\nwhile True:\n q = qry\n if firstid is not None:\n q = qry.filter(pk_attr > firstid)\n rec = None\n for rec in q.order_by(pk_attr).limit(maxrq):\n yield rec\n if rec is None:\n break\n firstid = pk_attr.__get__(rec, pk_attr) if rec else None",
"count_q = q.st... | <|body_start_0|>
firstid = None
while True:
q = qry
if firstid is not None:
q = qry.filter(pk_attr > firstid)
rec = None
for rec in q.order_by(pk_attr).limit(maxrq):
yield rec
if rec is None:
brea... | DbHelper | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DbHelper:
def yield_limit(qry, pk_attr, maxrq=100):
"""specialized windowed query generator (using LIMIT/OFFSET) This recipe is to select through a large number of rows thats too large to fetch at once. The technique depends on the primary key of the FROM clause being an integer value, a... | stack_v2_sparse_classes_36k_train_028516 | 4,676 | permissive | [
{
"docstring": "specialized windowed query generator (using LIMIT/OFFSET) This recipe is to select through a large number of rows thats too large to fetch at once. The technique depends on the primary key of the FROM clause being an integer value, and selects items using LIMIT.",
"name": "yield_limit",
... | 2 | stack_v2_sparse_classes_30k_train_003686 | Implement the Python class `DbHelper` described below.
Class description:
Implement the DbHelper class.
Method signatures and docstrings:
- def yield_limit(qry, pk_attr, maxrq=100): specialized windowed query generator (using LIMIT/OFFSET) This recipe is to select through a large number of rows thats too large to fet... | Implement the Python class `DbHelper` described below.
Class description:
Implement the DbHelper class.
Method signatures and docstrings:
- def yield_limit(qry, pk_attr, maxrq=100): specialized windowed query generator (using LIMIT/OFFSET) This recipe is to select through a large number of rows thats too large to fet... | 40bb31efdde0409f5851200f116e721f77ffc5ba | <|skeleton|>
class DbHelper:
def yield_limit(qry, pk_attr, maxrq=100):
"""specialized windowed query generator (using LIMIT/OFFSET) This recipe is to select through a large number of rows thats too large to fetch at once. The technique depends on the primary key of the FROM clause being an integer value, a... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DbHelper:
def yield_limit(qry, pk_attr, maxrq=100):
"""specialized windowed query generator (using LIMIT/OFFSET) This recipe is to select through a large number of rows thats too large to fetch at once. The technique depends on the primary key of the FROM clause being an integer value, and selects ite... | the_stack_v2_python_sparse | zemanfeed/databaseutils.py | yolosec/zeman-parser | train | 1 | |
dc0908ada34fe75bb87b0a361044639694ec2c2c | [
"self.root = TrieNode()\nfor word in words:\n n = self.root\n word = word[::-1]\n for idx, c in enumerate(word):\n cid = ord(c) - ord('a')\n if n.mapping[cid] is None:\n n.mapping[cid] = TrieNode()\n n = n.mapping[cid]\n if idx == len(word) - 1:\n n.is_word... | <|body_start_0|>
self.root = TrieNode()
for word in words:
n = self.root
word = word[::-1]
for idx, c in enumerate(word):
cid = ord(c) - ord('a')
if n.mapping[cid] is None:
n.mapping[cid] = TrieNode()
... | StreamChecker | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StreamChecker:
def __init__(self, words):
""":type words: List[str]"""
<|body_0|>
def query(self, letter):
""":type letter: str :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.root = TrieNode()
for word in words:
... | stack_v2_sparse_classes_36k_train_028517 | 4,397 | no_license | [
{
"docstring": ":type words: List[str]",
"name": "__init__",
"signature": "def __init__(self, words)"
},
{
"docstring": ":type letter: str :rtype: bool",
"name": "query",
"signature": "def query(self, letter)"
}
] | 2 | stack_v2_sparse_classes_30k_train_016154 | Implement the Python class `StreamChecker` described below.
Class description:
Implement the StreamChecker class.
Method signatures and docstrings:
- def __init__(self, words): :type words: List[str]
- def query(self, letter): :type letter: str :rtype: bool | Implement the Python class `StreamChecker` described below.
Class description:
Implement the StreamChecker class.
Method signatures and docstrings:
- def __init__(self, words): :type words: List[str]
- def query(self, letter): :type letter: str :rtype: bool
<|skeleton|>
class StreamChecker:
def __init__(self, w... | 4d73e4c1f2017828ff2d36058819988146356abe | <|skeleton|>
class StreamChecker:
def __init__(self, words):
""":type words: List[str]"""
<|body_0|>
def query(self, letter):
""":type letter: str :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StreamChecker:
def __init__(self, words):
""":type words: List[str]"""
self.root = TrieNode()
for word in words:
n = self.root
word = word[::-1]
for idx, c in enumerate(word):
cid = ord(c) - ord('a')
if n.mapping[cid] ... | the_stack_v2_python_sparse | python/leetcode/string/1032_stream_of_char.py | zchen0211/topcoder | train | 0 | |
bf013ec8d893a396bb3d1f12c7df59d0f5ea55ee | [
"if not table_name or not column_name or (not parent):\n raise ValueError('Missing table_name, column_name or parent value.')\nif row_condition and (not isinstance(row_condition, tuple) or len(row_condition) != 3):\n raise ValueError('Unsupported row_condition not a tuple in the form: (column_name, operator, ... | <|body_start_0|>
if not table_name or not column_name or (not parent):
raise ValueError('Missing table_name, column_name or parent value.')
if row_condition and (not isinstance(row_condition, tuple) or len(row_condition) != 3):
raise ValueError('Unsupported row_condition not a tu... | SQLite blob file path specification. Attributes: column_name (str): name of the column in which the blob is stored. row_condition (tuple): condition of the row in which the blob is stored. The condition is a tuple in the form: (column_name, operator, value). The condition must yield a single result. row_index (int): in... | SQLiteBlobPathSpec | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SQLiteBlobPathSpec:
"""SQLite blob file path specification. Attributes: column_name (str): name of the column in which the blob is stored. row_condition (tuple): condition of the row in which the blob is stored. The condition is a tuple in the form: (column_name, operator, value). The condition m... | stack_v2_sparse_classes_36k_train_028518 | 2,964 | permissive | [
{
"docstring": "Initializes a path specification. Note that the SQLite blob file path specification must have a parent. Args: column_name (Optional[str]): name of the column in which the blob is stored. parent (Optional[PathSpec]): parent path specification. row_condition (Optional[tuple]): condition of the row... | 2 | null | Implement the Python class `SQLiteBlobPathSpec` described below.
Class description:
SQLite blob file path specification. Attributes: column_name (str): name of the column in which the blob is stored. row_condition (tuple): condition of the row in which the blob is stored. The condition is a tuple in the form: (column_... | Implement the Python class `SQLiteBlobPathSpec` described below.
Class description:
SQLite blob file path specification. Attributes: column_name (str): name of the column in which the blob is stored. row_condition (tuple): condition of the row in which the blob is stored. The condition is a tuple in the form: (column_... | 28756d910e951a22c5f0b2bcf5184f055a19d544 | <|skeleton|>
class SQLiteBlobPathSpec:
"""SQLite blob file path specification. Attributes: column_name (str): name of the column in which the blob is stored. row_condition (tuple): condition of the row in which the blob is stored. The condition is a tuple in the form: (column_name, operator, value). The condition m... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SQLiteBlobPathSpec:
"""SQLite blob file path specification. Attributes: column_name (str): name of the column in which the blob is stored. row_condition (tuple): condition of the row in which the blob is stored. The condition is a tuple in the form: (column_name, operator, value). The condition must yield a s... | the_stack_v2_python_sparse | dfvfs/path/sqlite_blob_path_spec.py | log2timeline/dfvfs | train | 197 |
b597bf9e047f31939535f5babc8efdc681668c97 | [
"self.sources = sources\nself.max_sentence_length = max_sentence_length\nself.limit = limit",
"for source in self.sources:\n try:\n source.seek(0)\n for line in itertools.islice(source, self.limit):\n line = to_unicode(line)\n line = list(line.strip().replace(' ', ''))\n ... | <|body_start_0|>
self.sources = sources
self.max_sentence_length = max_sentence_length
self.limit = limit
<|end_body_0|>
<|body_start_1|>
for source in self.sources:
try:
source.seek(0)
for line in itertools.islice(source, self.limit):
... | Simple format: one sentence = one line; words already preprocessed and separated by whitespace. | MyLineSentence | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyLineSentence:
"""Simple format: one sentence = one line; words already preprocessed and separated by whitespace."""
def __init__(self, sources, max_sentence_length=MAX_WORDS_IN_BATCH, limit=None):
"""`source` can be either a string or a file object. Clip the file to the first `limi... | stack_v2_sparse_classes_36k_train_028519 | 4,034 | no_license | [
{
"docstring": "`source` can be either a string or a file object. Clip the file to the first `limit` lines (or no clipped if limit is None, the default).",
"name": "__init__",
"signature": "def __init__(self, sources, max_sentence_length=MAX_WORDS_IN_BATCH, limit=None)"
},
{
"docstring": "Iterat... | 2 | stack_v2_sparse_classes_30k_train_015899 | Implement the Python class `MyLineSentence` described below.
Class description:
Simple format: one sentence = one line; words already preprocessed and separated by whitespace.
Method signatures and docstrings:
- def __init__(self, sources, max_sentence_length=MAX_WORDS_IN_BATCH, limit=None): `source` can be either a ... | Implement the Python class `MyLineSentence` described below.
Class description:
Simple format: one sentence = one line; words already preprocessed and separated by whitespace.
Method signatures and docstrings:
- def __init__(self, sources, max_sentence_length=MAX_WORDS_IN_BATCH, limit=None): `source` can be either a ... | abadb44b442aba5c579431e8697d11cff84658a6 | <|skeleton|>
class MyLineSentence:
"""Simple format: one sentence = one line; words already preprocessed and separated by whitespace."""
def __init__(self, sources, max_sentence_length=MAX_WORDS_IN_BATCH, limit=None):
"""`source` can be either a string or a file object. Clip the file to the first `limi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MyLineSentence:
"""Simple format: one sentence = one line; words already preprocessed and separated by whitespace."""
def __init__(self, sources, max_sentence_length=MAX_WORDS_IN_BATCH, limit=None):
"""`source` can be either a string or a file object. Clip the file to the first `limit` lines (or ... | the_stack_v2_python_sparse | NLPCCKBQAModels/word2vec/chars2vec.py | JuneTse/NLPCCKBQAProj | train | 1 |
6d277752a793592cc0109d2f19dc55cc28451a60 | [
"self.__chip_dataset = chip_dataset\nself.__chip_key_maker = chip_key_maker\nself.__set_root_dir()\nself.__class_to_index = attributes_to_classes(self.__chip_dataset, self.__chip_key_maker)\nprint(self.__class_to_index)",
"ROOTMAP = {SetType.ALL.value: 'all', SetType.QUERY.value: 'query', SetType.TEST.value: 'tes... | <|body_start_0|>
self.__chip_dataset = chip_dataset
self.__chip_key_maker = chip_key_maker
self.__set_root_dir()
self.__class_to_index = attributes_to_classes(self.__chip_dataset, self.__chip_key_maker)
print(self.__class_to_index)
<|end_body_0|>
<|body_start_1|>
ROOTMAP... | KerasDirectory | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KerasDirectory:
def __init__(self, chip_dataset, chip_key_maker):
"""Takes a ChipDataset and hard links the files to custom defined class directories. Args: chip_dataset: A ChipDataset, or other iterable of Chips chip_key_maker: A callable that takes a chip and returns a string represent... | stack_v2_sparse_classes_36k_train_028520 | 12,062 | permissive | [
{
"docstring": "Takes a ChipDataset and hard links the files to custom defined class directories. Args: chip_dataset: A ChipDataset, or other iterable of Chips chip_key_maker: A callable that takes a chip and returns a string representing the attributes in that chip that you care about. For example, you might w... | 4 | stack_v2_sparse_classes_30k_train_018378 | Implement the Python class `KerasDirectory` described below.
Class description:
Implement the KerasDirectory class.
Method signatures and docstrings:
- def __init__(self, chip_dataset, chip_key_maker): Takes a ChipDataset and hard links the files to custom defined class directories. Args: chip_dataset: A ChipDataset,... | Implement the Python class `KerasDirectory` described below.
Class description:
Implement the KerasDirectory class.
Method signatures and docstrings:
- def __init__(self, chip_dataset, chip_key_maker): Takes a ChipDataset and hard links the files to custom defined class directories. Args: chip_dataset: A ChipDataset,... | c39b91d7f6b8837d77130598c0778c59b5b82669 | <|skeleton|>
class KerasDirectory:
def __init__(self, chip_dataset, chip_key_maker):
"""Takes a ChipDataset and hard links the files to custom defined class directories. Args: chip_dataset: A ChipDataset, or other iterable of Chips chip_key_maker: A callable that takes a chip and returns a string represent... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class KerasDirectory:
def __init__(self, chip_dataset, chip_key_maker):
"""Takes a ChipDataset and hard links the files to custom defined class directories. Args: chip_dataset: A ChipDataset, or other iterable of Chips chip_key_maker: A callable that takes a chip and returns a string representing the attrib... | the_stack_v2_python_sparse | pelops/training/utils.py | d-grossman/pelops | train | 1 | |
dd6fb69a0c1d23d068dec2e74c66a484ccbfbd8f | [
"super(FilterSpinAgent, self).__init__(parent, datatree)\nself.addRequest('spinfield')\nself.requestUpdatedSignal.connect(self.buildSpin)\nself.spin_values = list()\nself.spin_field = ''\nself.spin_selected = -1",
"if len(indexList) > 1:\n indexList = list(indexList[0])\nself.requestAddIndices('spinfield', ind... | <|body_start_0|>
super(FilterSpinAgent, self).__init__(parent, datatree)
self.addRequest('spinfield')
self.requestUpdatedSignal.connect(self.buildSpin)
self.spin_values = list()
self.spin_field = ''
self.spin_selected = -1
<|end_body_0|>
<|body_start_1|>
if len(i... | Agent for all FilterSpin modules, associates filters with modules. The Filter Spin takes a single numeric field and adds a filter setting all data under it to whatever a specific value in that field is. The idea is that using a spin control, the user can move through all the values of the field separately. For example,... | FilterSpinAgent | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FilterSpinAgent:
"""Agent for all FilterSpin modules, associates filters with modules. The Filter Spin takes a single numeric field and adds a filter setting all data under it to whatever a specific value in that field is. The idea is that using a spin control, the user can move through all the v... | stack_v2_sparse_classes_36k_train_028521 | 6,795 | no_license | [
{
"docstring": "Constructor for FilterSpinAgent.",
"name": "__init__",
"signature": "def __init__(self, parent, datatree)"
},
{
"docstring": "This function handles an added list of DataTree indices by associated them with the agent's Request. We only accept a single index in the Filter Spin so w... | 4 | stack_v2_sparse_classes_30k_test_000339 | Implement the Python class `FilterSpinAgent` described below.
Class description:
Agent for all FilterSpin modules, associates filters with modules. The Filter Spin takes a single numeric field and adds a filter setting all data under it to whatever a specific value in that field is. The idea is that using a spin contr... | Implement the Python class `FilterSpinAgent` described below.
Class description:
Agent for all FilterSpin modules, associates filters with modules. The Filter Spin takes a single numeric field and adds a filter setting all data under it to whatever a specific value in that field is. The idea is that using a spin contr... | afa9c9547716909d806a0bd8165bfe896617ca7e | <|skeleton|>
class FilterSpinAgent:
"""Agent for all FilterSpin modules, associates filters with modules. The Filter Spin takes a single numeric field and adds a filter setting all data under it to whatever a specific value in that field is. The idea is that using a spin control, the user can move through all the v... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FilterSpinAgent:
"""Agent for all FilterSpin modules, associates filters with modules. The Filter Spin takes a single numeric field and adds a filter setting all data under it to whatever a specific value in that field is. The idea is that using a spin control, the user can move through all the values of the ... | the_stack_v2_python_sparse | boxfish/FilterSpin.py | LLNL/boxfish | train | 4 |
abaa1cbcfe89f6d1110f07a5c6a5934f4217b42a | [
"model = MPNN(n_tasks=n_tasks, node_out_feats=node_out_feats, edge_hidden_feats=edge_hidden_feats, num_step_message_passing=num_step_message_passing, num_step_set2set=num_step_set2set, num_layer_set2set=num_layer_set2set, mode=mode, number_atom_features=number_atom_features, number_bond_features=number_bond_feature... | <|body_start_0|>
model = MPNN(n_tasks=n_tasks, node_out_feats=node_out_feats, edge_hidden_feats=edge_hidden_feats, num_step_message_passing=num_step_message_passing, num_step_set2set=num_step_set2set, num_layer_set2set=num_layer_set2set, mode=mode, number_atom_features=number_atom_features, number_bond_features... | Model for graph property prediction This model proceeds as follows: * Combine latest node representations and edge features in updating node representations, which involves multiple rounds of message passing * For each graph, compute its representation by combining the representations of all nodes in it, which involves... | MPNNModel | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MPNNModel:
"""Model for graph property prediction This model proceeds as follows: * Combine latest node representations and edge features in updating node representations, which involves multiple rounds of message passing * For each graph, compute its representation by combining the representatio... | stack_v2_sparse_classes_36k_train_028522 | 12,074 | permissive | [
{
"docstring": "Parameters ---------- n_tasks: int Number of tasks. node_out_feats: int The length of the final node representation vectors. Default to 64. edge_hidden_feats: int The length of the hidden edge representation vectors. Default to 128. num_step_message_passing: int The number of rounds of message p... | 2 | stack_v2_sparse_classes_30k_train_011682 | Implement the Python class `MPNNModel` described below.
Class description:
Model for graph property prediction This model proceeds as follows: * Combine latest node representations and edge features in updating node representations, which involves multiple rounds of message passing * For each graph, compute its repres... | Implement the Python class `MPNNModel` described below.
Class description:
Model for graph property prediction This model proceeds as follows: * Combine latest node representations and edge features in updating node representations, which involves multiple rounds of message passing * For each graph, compute its repres... | ee6e67ebcf7bf04259cf13aff6388e2b791fea3d | <|skeleton|>
class MPNNModel:
"""Model for graph property prediction This model proceeds as follows: * Combine latest node representations and edge features in updating node representations, which involves multiple rounds of message passing * For each graph, compute its representation by combining the representatio... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MPNNModel:
"""Model for graph property prediction This model proceeds as follows: * Combine latest node representations and edge features in updating node representations, which involves multiple rounds of message passing * For each graph, compute its representation by combining the representations of all nod... | the_stack_v2_python_sparse | deepchem/models/torch_models/mpnn.py | deepchem/deepchem | train | 4,876 |
54c0c9f0d2d8fc51f617ca6d009ca733fc186fb3 | [
"len_nums = len(nums)\nif len_nums > 1:\n index = -1\n while index > len_nums * -1:\n if nums[index] > nums[index - 1]:\n flag_index = index - 1\n max_index = index\n start_index = len_nums + index\n for i in range(start_index, len_nums):\n if ... | <|body_start_0|>
len_nums = len(nums)
if len_nums > 1:
index = -1
while index > len_nums * -1:
if nums[index] > nums[index - 1]:
flag_index = index - 1
max_index = index
start_index = len_nums + index
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def nextPermutation(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead."""
<|body_0|>
def sort_array(self, array, start_index, length):
""":type array: List[int] :type start_index: int :type length: int :... | stack_v2_sparse_classes_36k_train_028523 | 1,990 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.",
"name": "nextPermutation",
"signature": "def nextPermutation(self, nums)"
},
{
"docstring": ":type array: List[int] :type start_index: int :type length: int :rtype: void",
"name": "sort... | 2 | stack_v2_sparse_classes_30k_train_014467 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def nextPermutation(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.
- def sort_array(self, array, start_index, length): :typ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def nextPermutation(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.
- def sort_array(self, array, start_index, length): :typ... | 45d116d790075b1583af6aecd00f8babfe2c3107 | <|skeleton|>
class Solution:
def nextPermutation(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead."""
<|body_0|>
def sort_array(self, array, start_index, length):
""":type array: List[int] :type start_index: int :type length: int :... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def nextPermutation(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead."""
len_nums = len(nums)
if len_nums > 1:
index = -1
while index > len_nums * -1:
if nums[index] > nums[index - ... | the_stack_v2_python_sparse | leetcode/array/exercise_31.py | YinongLong/Data-Structures-and-Algorithm-Analysis | train | 0 | |
81afd234b7dcb71debd5cf6080a01afe303b46d4 | [
"super().__init__(imageSurf, coord, world_coordinates)\nself.contents = collectable if collectable != None and amount != None else random.choice(list(COLLECTABLES.keys()))\nself.amount = amount if collectable != None and amount != None else random.randint(COLLECTABLES[self.contents][0], COLLECTABLES[self.contents][... | <|body_start_0|>
super().__init__(imageSurf, coord, world_coordinates)
self.contents = collectable if collectable != None and amount != None else random.choice(list(COLLECTABLES.keys()))
self.amount = amount if collectable != None and amount != None else random.randint(COLLECTABLES[self.contents... | PickUp | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PickUp:
def __init__(self, imageSurf, coord, world_coordinates, collectable=None, amount=None):
"""Interactive chest, random amount of random collectable assigned if no values passed for collectable"""
<|body_0|>
def updateMap(self, map):
"""Adds contents of interact... | stack_v2_sparse_classes_36k_train_028524 | 1,324 | no_license | [
{
"docstring": "Interactive chest, random amount of random collectable assigned if no values passed for collectable",
"name": "__init__",
"signature": "def __init__(self, imageSurf, coord, world_coordinates, collectable=None, amount=None)"
},
{
"docstring": "Adds contents of interactive tile to ... | 2 | stack_v2_sparse_classes_30k_train_001336 | Implement the Python class `PickUp` described below.
Class description:
Implement the PickUp class.
Method signatures and docstrings:
- def __init__(self, imageSurf, coord, world_coordinates, collectable=None, amount=None): Interactive chest, random amount of random collectable assigned if no values passed for collec... | Implement the Python class `PickUp` described below.
Class description:
Implement the PickUp class.
Method signatures and docstrings:
- def __init__(self, imageSurf, coord, world_coordinates, collectable=None, amount=None): Interactive chest, random amount of random collectable assigned if no values passed for collec... | 1db75c71912bf054553d50b130eb61f7666d32d8 | <|skeleton|>
class PickUp:
def __init__(self, imageSurf, coord, world_coordinates, collectable=None, amount=None):
"""Interactive chest, random amount of random collectable assigned if no values passed for collectable"""
<|body_0|>
def updateMap(self, map):
"""Adds contents of interact... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PickUp:
def __init__(self, imageSurf, coord, world_coordinates, collectable=None, amount=None):
"""Interactive chest, random amount of random collectable assigned if no values passed for collectable"""
super().__init__(imageSurf, coord, world_coordinates)
self.contents = collectable if... | the_stack_v2_python_sparse | PickUps.py | KratzenbergD/Lab_2 | train | 0 | |
de9cb05357bad389f4a58b3c161ca8dd95a114b9 | [
"len_nums = len(nums)\nif len_nums == 0:\n return -1\nnums, start_index = self.asc_sort(nums)\nleft_index = 0\nmiddle_index = (len_nums - 1) // 2\nright_index = len_nums - 1\nwhile True:\n if left_index + 1 == right_index or left_index == right_index:\n if nums[left_index] == target:\n retur... | <|body_start_0|>
len_nums = len(nums)
if len_nums == 0:
return -1
nums, start_index = self.asc_sort(nums)
left_index = 0
middle_index = (len_nums - 1) // 2
right_index = len_nums - 1
while True:
if left_index + 1 == right_index or left_inde... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def search(self, nums: List[int], target: int) -> int:
"""二分法查找 :param nums: :param target: :return:"""
<|body_0|>
def asc_sort(self, nums):
"""升序排序(二分法) :param nums: :return: 升序数组,旋转点位置"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
len_... | stack_v2_sparse_classes_36k_train_028525 | 4,029 | no_license | [
{
"docstring": "二分法查找 :param nums: :param target: :return:",
"name": "search",
"signature": "def search(self, nums: List[int], target: int) -> int"
},
{
"docstring": "升序排序(二分法) :param nums: :return: 升序数组,旋转点位置",
"name": "asc_sort",
"signature": "def asc_sort(self, nums)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def search(self, nums: List[int], target: int) -> int: 二分法查找 :param nums: :param target: :return:
- def asc_sort(self, nums): 升序排序(二分法) :param nums: :return: 升序数组,旋转点位置 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def search(self, nums: List[int], target: int) -> int: 二分法查找 :param nums: :param target: :return:
- def asc_sort(self, nums): 升序排序(二分法) :param nums: :return: 升序数组,旋转点位置
<|skelet... | bbcb7c3c9aa51141695d73b90bf8f04c794be131 | <|skeleton|>
class Solution:
def search(self, nums: List[int], target: int) -> int:
"""二分法查找 :param nums: :param target: :return:"""
<|body_0|>
def asc_sort(self, nums):
"""升序排序(二分法) :param nums: :return: 升序数组,旋转点位置"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def search(self, nums: List[int], target: int) -> int:
"""二分法查找 :param nums: :param target: :return:"""
len_nums = len(nums)
if len_nums == 0:
return -1
nums, start_index = self.asc_sort(nums)
left_index = 0
middle_index = (len_nums - 1) //... | the_stack_v2_python_sparse | 00001_00100/00033_搜索旋转排序数组.py | xiphodon/leetcode_studio | train | 1 | |
09f552ced8f8c4b7f0afe7ecb03e11d1ffa9e13c | [
"username = validated_data.get('username')\nemail = validated_data.get('email')\npassword = validated_data.get('password')\nuser = User.objects.create_user(username, email, password)\nswift_manager = connect_storage(settings)\nwelcome_file_path = '%s/uploads/welcome.txt' % username\ntry:\n with io.StringIO('Welc... | <|body_start_0|>
username = validated_data.get('username')
email = validated_data.get('email')
password = validated_data.get('password')
user = User.objects.create_user(username, email, password)
swift_manager = connect_storage(settings)
welcome_file_path = '%s/uploads/we... | UserSerializer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserSerializer:
def create(self, validated_data):
"""Overriden to take care of the password hashing and create a welcome file for the user in its personal storage space."""
<|body_0|>
def validate_username(self, username):
"""Overriden to check that the username does... | stack_v2_sparse_classes_36k_train_028526 | 2,723 | permissive | [
{
"docstring": "Overriden to take care of the password hashing and create a welcome file for the user in its personal storage space.",
"name": "create",
"signature": "def create(self, validated_data)"
},
{
"docstring": "Overriden to check that the username does not contain forward slashes and it... | 2 | null | Implement the Python class `UserSerializer` described below.
Class description:
Implement the UserSerializer class.
Method signatures and docstrings:
- def create(self, validated_data): Overriden to take care of the password hashing and create a welcome file for the user in its personal storage space.
- def validate_... | Implement the Python class `UserSerializer` described below.
Class description:
Implement the UserSerializer class.
Method signatures and docstrings:
- def create(self, validated_data): Overriden to take care of the password hashing and create a welcome file for the user in its personal storage space.
- def validate_... | 20d3eedf20610af9182f6cca8db8f0b3546b5336 | <|skeleton|>
class UserSerializer:
def create(self, validated_data):
"""Overriden to take care of the password hashing and create a welcome file for the user in its personal storage space."""
<|body_0|>
def validate_username(self, username):
"""Overriden to check that the username does... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserSerializer:
def create(self, validated_data):
"""Overriden to take care of the password hashing and create a welcome file for the user in its personal storage space."""
username = validated_data.get('username')
email = validated_data.get('email')
password = validated_data.g... | the_stack_v2_python_sparse | chris_backend/users/serializers.py | FNNDSC/ChRIS_ultron_backEnd | train | 36 | |
da709a1c054357d6c6d6994ade331852129e882c | [
"for res in self:\n if res.record_id:\n res.book_id = res.record_id.book_id.id\n res.borrow_number = res.record_id.borrow_number - res.record_id.return_number",
"for res in self:\n if res.borrow_number > res.record_id.borrow_number:\n raise UserError('归还数量不能超过借阅的数量!')\n if res.borrow... | <|body_start_0|>
for res in self:
if res.record_id:
res.book_id = res.record_id.book_id.id
res.borrow_number = res.record_id.borrow_number - res.record_id.return_number
<|end_body_0|>
<|body_start_1|>
for res in self:
if res.borrow_number > res.re... | ReturnBooksTran | [
"GPL-3.0-only",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReturnBooksTran:
def _onchange_record(self):
"""动态获取借阅记录值 :return:"""
<|body_0|>
def commit_return(self):
"""确认借阅 :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
for res in self:
if res.record_id:
res.book_id = r... | stack_v2_sparse_classes_36k_train_028527 | 2,173 | permissive | [
{
"docstring": "动态获取借阅记录值 :return:",
"name": "_onchange_record",
"signature": "def _onchange_record(self)"
},
{
"docstring": "确认借阅 :return:",
"name": "commit_return",
"signature": "def commit_return(self)"
}
] | 2 | null | Implement the Python class `ReturnBooksTran` described below.
Class description:
Implement the ReturnBooksTran class.
Method signatures and docstrings:
- def _onchange_record(self): 动态获取借阅记录值 :return:
- def commit_return(self): 确认借阅 :return: | Implement the Python class `ReturnBooksTran` described below.
Class description:
Implement the ReturnBooksTran class.
Method signatures and docstrings:
- def _onchange_record(self): 动态获取借阅记录值 :return:
- def commit_return(self): 确认借阅 :return:
<|skeleton|>
class ReturnBooksTran:
def _onchange_record(self):
... | 8608aaeae7a8c86d53b68ce26b7b308f779c3dd8 | <|skeleton|>
class ReturnBooksTran:
def _onchange_record(self):
"""动态获取借阅记录值 :return:"""
<|body_0|>
def commit_return(self):
"""确认借阅 :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ReturnBooksTran:
def _onchange_record(self):
"""动态获取借阅记录值 :return:"""
for res in self:
if res.record_id:
res.book_id = res.record_id.book_id.id
res.borrow_number = res.record_id.borrow_number - res.record_id.return_number
def commit_return(self)... | the_stack_v2_python_sparse | odoo_book_lending/wizard/return_books.py | niulinlnc/odooExtModel | train | 4 | |
2cb8b71027f3f5bad9a042acbd68ae0fdd57480c | [
"left = A[p:q + 1]\nright = A[q + 1:r + 1]\ni = 0\nj = 0\nk = p\nassert sorted(left)\nassert sorted(right)\nwhile i < len(left) and j < len(right):\n if left[i] < right[j]:\n A[k] = left[i]\n k += 1\n i += 1\n else:\n A[k] = right[j]\n j += 1\n k += 1\nwhile i < len(l... | <|body_start_0|>
left = A[p:q + 1]
right = A[q + 1:r + 1]
i = 0
j = 0
k = p
assert sorted(left)
assert sorted(right)
while i < len(left) and j < len(right):
if left[i] < right[j]:
A[k] = left[i]
k += 1
... | MergeSort | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MergeSort:
def merge(self, A, p, q, r):
"""Function to Merge and sort the sub arrays"""
<|body_0|>
def sort(self, A, p, r):
"""Function to Divide the input Array into equal sub-arrays"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
left = A[p:q + 1]... | stack_v2_sparse_classes_36k_train_028528 | 1,363 | permissive | [
{
"docstring": "Function to Merge and sort the sub arrays",
"name": "merge",
"signature": "def merge(self, A, p, q, r)"
},
{
"docstring": "Function to Divide the input Array into equal sub-arrays",
"name": "sort",
"signature": "def sort(self, A, p, r)"
}
] | 2 | stack_v2_sparse_classes_30k_train_015307 | Implement the Python class `MergeSort` described below.
Class description:
Implement the MergeSort class.
Method signatures and docstrings:
- def merge(self, A, p, q, r): Function to Merge and sort the sub arrays
- def sort(self, A, p, r): Function to Divide the input Array into equal sub-arrays | Implement the Python class `MergeSort` described below.
Class description:
Implement the MergeSort class.
Method signatures and docstrings:
- def merge(self, A, p, q, r): Function to Merge and sort the sub arrays
- def sort(self, A, p, r): Function to Divide the input Array into equal sub-arrays
<|skeleton|>
class M... | a30008a7fa8ba15ee241bd7fc5df94cd68c80003 | <|skeleton|>
class MergeSort:
def merge(self, A, p, q, r):
"""Function to Merge and sort the sub arrays"""
<|body_0|>
def sort(self, A, p, r):
"""Function to Divide the input Array into equal sub-arrays"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MergeSort:
def merge(self, A, p, q, r):
"""Function to Merge and sort the sub arrays"""
left = A[p:q + 1]
right = A[q + 1:r + 1]
i = 0
j = 0
k = p
assert sorted(left)
assert sorted(right)
while i < len(left) and j < len(right):
... | the_stack_v2_python_sparse | MergeSort.py | vinayakasg18/algorithms | train | 0 | |
86f391950b29bb1345498ed8b89c11eaba63bc10 | [
"self.content_folder = content_folder\nsignature_path = os.path.join(self.content_folder, signature_filename)\nrootCA_cert_path = os.path.join(self.content_folder, root_cert)\nif os.path.exists(signature_path) and os.path.exists(rootCA_cert_path):\n self.signature = json.load(open(signature_path, 'rt'))\n for... | <|body_start_0|>
self.content_folder = content_folder
signature_path = os.path.join(self.content_folder, signature_filename)
rootCA_cert_path = os.path.join(self.content_folder, root_cert)
if os.path.exists(signature_path) and os.path.exists(rootCA_cert_path):
self.signature ... | SecurityContentManager | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SecurityContentManager:
def __init__(self, content_folder, signature_filename='signature.json', root_cert='rootCA.pem'):
"""Content manager used by SecurityContentService to load secure content. Args: content_folder (str): the folder path that includes signature file signature_filename (... | stack_v2_sparse_classes_36k_train_028529 | 5,241 | permissive | [
{
"docstring": "Content manager used by SecurityContentService to load secure content. Args: content_folder (str): the folder path that includes signature file signature_filename (str, optional): the signature file (signed dictionary). Defaults to \"signature.json\". root_cert (str, optional): root CA certifica... | 2 | stack_v2_sparse_classes_30k_test_000238 | Implement the Python class `SecurityContentManager` described below.
Class description:
Implement the SecurityContentManager class.
Method signatures and docstrings:
- def __init__(self, content_folder, signature_filename='signature.json', root_cert='rootCA.pem'): Content manager used by SecurityContentService to loa... | Implement the Python class `SecurityContentManager` described below.
Class description:
Implement the SecurityContentManager class.
Method signatures and docstrings:
- def __init__(self, content_folder, signature_filename='signature.json', root_cert='rootCA.pem'): Content manager used by SecurityContentService to loa... | 1433290c203bd23f34c29e11795ce592bc067888 | <|skeleton|>
class SecurityContentManager:
def __init__(self, content_folder, signature_filename='signature.json', root_cert='rootCA.pem'):
"""Content manager used by SecurityContentService to load secure content. Args: content_folder (str): the folder path that includes signature file signature_filename (... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SecurityContentManager:
def __init__(self, content_folder, signature_filename='signature.json', root_cert='rootCA.pem'):
"""Content manager used by SecurityContentService to load secure content. Args: content_folder (str): the folder path that includes signature file signature_filename (str, optional)... | the_stack_v2_python_sparse | nvflare/fuel/sec/security_content_service.py | NVIDIA/NVFlare | train | 442 | |
2e386da661a0a125c8474181a46b7b10d32d6cb5 | [
"parser.add_argument('-d', '--device', help='Optional, Device to get info, by default all connected devices', type=types.connected_device, default=defaults.connected_device()).completer = completion.all_devices\nparser.add_argument('-p', '--platform', help='Optional, Platform (android or ios) to get info, by defaul... | <|body_start_0|>
parser.add_argument('-d', '--device', help='Optional, Device to get info, by default all connected devices', type=types.connected_device, default=defaults.connected_device()).completer = completion.all_devices
parser.add_argument('-p', '--platform', help='Optional, Platform (android or ... | Action to get info about connected devices. | DeviceInfoAction | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DeviceInfoAction:
"""Action to get info about connected devices."""
def init_parser(parser):
"""Initializes argument parser with own arguments. :param parser: argparse.ArgumentParser, parser instance to initialize it with custom arguments."""
<|body_0|>
def __call__(self... | stack_v2_sparse_classes_36k_train_028530 | 3,978 | permissive | [
{
"docstring": "Initializes argument parser with own arguments. :param parser: argparse.ArgumentParser, parser instance to initialize it with custom arguments.",
"name": "init_parser",
"signature": "def init_parser(parser)"
},
{
"docstring": "Prints info for the given device or for all (if devic... | 2 | stack_v2_sparse_classes_30k_train_005359 | Implement the Python class `DeviceInfoAction` described below.
Class description:
Action to get info about connected devices.
Method signatures and docstrings:
- def init_parser(parser): Initializes argument parser with own arguments. :param parser: argparse.ArgumentParser, parser instance to initialize it with custo... | Implement the Python class `DeviceInfoAction` described below.
Class description:
Action to get info about connected devices.
Method signatures and docstrings:
- def init_parser(parser): Initializes argument parser with own arguments. :param parser: argparse.ArgumentParser, parser instance to initialize it with custo... | 46dcb27b0ee25153b697d19c17801cee35e136ce | <|skeleton|>
class DeviceInfoAction:
"""Action to get info about connected devices."""
def init_parser(parser):
"""Initializes argument parser with own arguments. :param parser: argparse.ArgumentParser, parser instance to initialize it with custom arguments."""
<|body_0|>
def __call__(self... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DeviceInfoAction:
"""Action to get info about connected devices."""
def init_parser(parser):
"""Initializes argument parser with own arguments. :param parser: argparse.ArgumentParser, parser instance to initialize it with custom arguments."""
parser.add_argument('-d', '--device', help='Op... | the_stack_v2_python_sparse | action/DeviceInfoAction.py | maxim-filkov/mobile-test-helper | train | 1 |
2d0b431e0db3e8be3bece77092c1fa7457c8c4eb | [
"self.foldframe = foldframe\nself.fold_axis_rotation = fold_axis_rotation\nself.fold_limb_rotation = fold_limb_rotation\nself.fold_axis = fold_axis\nself.name = name",
"if self.fold_axis_rotation is not None:\n logger.info('Using fold_axis_rotation function')\n dgx = self.foldframe.features[0].evaluate_grad... | <|body_start_0|>
self.foldframe = foldframe
self.fold_axis_rotation = fold_axis_rotation
self.fold_limb_rotation = fold_limb_rotation
self.fold_axis = fold_axis
self.name = name
<|end_body_0|>
<|body_start_1|>
if self.fold_axis_rotation is not None:
logger.in... | FoldEvent | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FoldEvent:
def __init__(self, foldframe, fold_axis_rotation=None, fold_limb_rotation=None, fold_axis=None, name='Fold'):
"""A fold event describes the geometry of the fold using a fold frame and two geometrical descriptors Parameters ---------- foldframe the fold frame object fold_axis_r... | stack_v2_sparse_classes_36k_train_028531 | 5,086 | permissive | [
{
"docstring": "A fold event describes the geometry of the fold using a fold frame and two geometrical descriptors Parameters ---------- foldframe the fold frame object fold_axis_rotation function for the fold axis rotation angle fold_limb_rotation function for the fold limb rotation angle",
"name": "__init... | 4 | null | Implement the Python class `FoldEvent` described below.
Class description:
Implement the FoldEvent class.
Method signatures and docstrings:
- def __init__(self, foldframe, fold_axis_rotation=None, fold_limb_rotation=None, fold_axis=None, name='Fold'): A fold event describes the geometry of the fold using a fold frame... | Implement the Python class `FoldEvent` described below.
Class description:
Implement the FoldEvent class.
Method signatures and docstrings:
- def __init__(self, foldframe, fold_axis_rotation=None, fold_limb_rotation=None, fold_axis=None, name='Fold'): A fold event describes the geometry of the fold using a fold frame... | c6175623450dbc79ed06ed8d8bbff21b63fc8b4c | <|skeleton|>
class FoldEvent:
def __init__(self, foldframe, fold_axis_rotation=None, fold_limb_rotation=None, fold_axis=None, name='Fold'):
"""A fold event describes the geometry of the fold using a fold frame and two geometrical descriptors Parameters ---------- foldframe the fold frame object fold_axis_r... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FoldEvent:
def __init__(self, foldframe, fold_axis_rotation=None, fold_limb_rotation=None, fold_axis=None, name='Fold'):
"""A fold event describes the geometry of the fold using a fold frame and two geometrical descriptors Parameters ---------- foldframe the fold frame object fold_axis_rotation functi... | the_stack_v2_python_sparse | LoopStructural/modelling/features/fold/_fold.py | Loop3D/LoopStructural | train | 123 | |
6d3c93b85ed0c36b6601883d68679eceb36fed26 | [
"if not nums:\n return self.res\nself.holes = [None] * len(nums)\nself.dfs(nums, 0, 0)\nreturn self.res",
"if idx == len(nums):\n self.res.append(self.holes.copy())\n return\nfor i in range(0, len(nums)):\n if not state >> i & 1:\n self.holes[i] = nums[idx]\n self.dfs(nums, idx + 1, stat... | <|body_start_0|>
if not nums:
return self.res
self.holes = [None] * len(nums)
self.dfs(nums, 0, 0)
return self.res
<|end_body_0|>
<|body_start_1|>
if idx == len(nums):
self.res.append(self.holes.copy())
return
for i in range(0, len(num... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def permutation(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_0|>
def dfs(self, nums, idx, state):
""":param nums: 输入的数组 :param idx: idx 表示当前待填入holes中的元素的下标 :param state: 当前holes的状态,换成二进制表示,1表示已有元素,0表示暂无元素 :return:"""
<|bod... | stack_v2_sparse_classes_36k_train_028532 | 1,244 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: List[List[int]]",
"name": "permutation",
"signature": "def permutation(self, nums)"
},
{
"docstring": ":param nums: 输入的数组 :param idx: idx 表示当前待填入holes中的元素的下标 :param state: 当前holes的状态,换成二进制表示,1表示已有元素,0表示暂无元素 :return:",
"name": "dfs",
"signatur... | 2 | stack_v2_sparse_classes_30k_train_015409 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def permutation(self, nums): :type nums: List[int] :rtype: List[List[int]]
- def dfs(self, nums, idx, state): :param nums: 输入的数组 :param idx: idx 表示当前待填入holes中的元素的下标 :param state:... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def permutation(self, nums): :type nums: List[int] :rtype: List[List[int]]
- def dfs(self, nums, idx, state): :param nums: 输入的数组 :param idx: idx 表示当前待填入holes中的元素的下标 :param state:... | 967b0fbb40ae491b552bc3365a481e66324cb6f2 | <|skeleton|>
class Solution:
def permutation(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_0|>
def dfs(self, nums, idx, state):
""":param nums: 输入的数组 :param idx: idx 表示当前待填入holes中的元素的下标 :param state: 当前holes的状态,换成二进制表示,1表示已有元素,0表示暂无元素 :return:"""
<|bod... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def permutation(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
if not nums:
return self.res
self.holes = [None] * len(nums)
self.dfs(nums, 0, 0)
return self.res
def dfs(self, nums, idx, state):
""":param nums: 输入的数组 :... | the_stack_v2_python_sparse | jianzhi_offer/31_数字的全排列_无重复.py | ryanatgz/data_structure_and_algorithm | train | 0 | |
099c3063bfc87406faa3a7789ea2c1d897b83d0f | [
"qualifier = rating_string[-2]\nnumber = int(rating_string[:-2])\nif qualifier == 'M':\n number *= 1000000\nelif qualifier == 'K':\n number *= 1000\nreturn number",
"trends_list = list()\nkeys = ('title', 'avatar', 'description', 'day')\ndate = req_json['date']\ntrends = req_json['trendingSearches']\nfor tr... | <|body_start_0|>
qualifier = rating_string[-2]
number = int(rating_string[:-2])
if qualifier == 'M':
number *= 1000000
elif qualifier == 'K':
number *= 1000
return number
<|end_body_0|>
<|body_start_1|>
trends_list = list()
keys = ('title'... | Subclass of TrendReq, implements it's own logic of parsing daily google trends | RealTrendReq | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RealTrendReq:
"""Subclass of TrendReq, implements it's own logic of parsing daily google trends"""
def rating_to_int(rating_string):
""":param rating_string: number of user requests in string format Convert google search measure of trend from string to integer :returns: trend rating ... | stack_v2_sparse_classes_36k_train_028533 | 2,566 | no_license | [
{
"docstring": ":param rating_string: number of user requests in string format Convert google search measure of trend from string to integer :returns: trend rating as integer",
"name": "rating_to_int",
"signature": "def rating_to_int(rating_string)"
},
{
"docstring": ":param req_json: part of js... | 3 | stack_v2_sparse_classes_30k_train_001175 | Implement the Python class `RealTrendReq` described below.
Class description:
Subclass of TrendReq, implements it's own logic of parsing daily google trends
Method signatures and docstrings:
- def rating_to_int(rating_string): :param rating_string: number of user requests in string format Convert google search measur... | Implement the Python class `RealTrendReq` described below.
Class description:
Subclass of TrendReq, implements it's own logic of parsing daily google trends
Method signatures and docstrings:
- def rating_to_int(rating_string): :param rating_string: number of user requests in string format Convert google search measur... | 39ef586228e02553be17bac79915d3de52d15b4b | <|skeleton|>
class RealTrendReq:
"""Subclass of TrendReq, implements it's own logic of parsing daily google trends"""
def rating_to_int(rating_string):
""":param rating_string: number of user requests in string format Convert google search measure of trend from string to integer :returns: trend rating ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RealTrendReq:
"""Subclass of TrendReq, implements it's own logic of parsing daily google trends"""
def rating_to_int(rating_string):
""":param rating_string: number of user requests in string format Convert google search measure of trend from string to integer :returns: trend rating as integer"""... | the_stack_v2_python_sparse | backend/trends/trends/clients/prefs.py | Darhild/trends | train | 0 |
039bbe909fd4e15984002568dc5398b733bdb3bd | [
"logger.debug('call __set__')\ndriver = obj.driver\nWebDriverWait(driver, 100).until(lambda driver: driver.find_element(*self.locator))\ndriver.find_element(*self.locator).send_keys(Keys.CONTROL, 'a')\ndriver.find_element(*self.locator).send_keys(value)",
"logger.debug('call __get__')\ndriver = obj.driver\nWebDri... | <|body_start_0|>
logger.debug('call __set__')
driver = obj.driver
WebDriverWait(driver, 100).until(lambda driver: driver.find_element(*self.locator))
driver.find_element(*self.locator).send_keys(Keys.CONTROL, 'a')
driver.find_element(*self.locator).send_keys(value)
<|end_body_0|>... | Base page class that is initialized on every page object class. | BaseHTMLPageElement | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseHTMLPageElement:
"""Base page class that is initialized on every page object class."""
def __set__(self, obj, value):
"""Sets the text to the value supplied"""
<|body_0|>
def __get__(self, obj, owner):
"""Gets the text of the specified object"""
<|bod... | stack_v2_sparse_classes_36k_train_028534 | 3,363 | no_license | [
{
"docstring": "Sets the text to the value supplied",
"name": "__set__",
"signature": "def __set__(self, obj, value)"
},
{
"docstring": "Gets the text of the specified object",
"name": "__get__",
"signature": "def __get__(self, obj, owner)"
},
{
"docstring": "Gets the text of the... | 6 | stack_v2_sparse_classes_30k_train_006001 | Implement the Python class `BaseHTMLPageElement` described below.
Class description:
Base page class that is initialized on every page object class.
Method signatures and docstrings:
- def __set__(self, obj, value): Sets the text to the value supplied
- def __get__(self, obj, owner): Gets the text of the specified ob... | Implement the Python class `BaseHTMLPageElement` described below.
Class description:
Base page class that is initialized on every page object class.
Method signatures and docstrings:
- def __set__(self, obj, value): Sets the text to the value supplied
- def __get__(self, obj, owner): Gets the text of the specified ob... | 2b08d3cc153f0ebdd6272a17962e1601390391c5 | <|skeleton|>
class BaseHTMLPageElement:
"""Base page class that is initialized on every page object class."""
def __set__(self, obj, value):
"""Sets the text to the value supplied"""
<|body_0|>
def __get__(self, obj, owner):
"""Gets the text of the specified object"""
<|bod... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BaseHTMLPageElement:
"""Base page class that is initialized on every page object class."""
def __set__(self, obj, value):
"""Sets the text to the value supplied"""
logger.debug('call __set__')
driver = obj.driver
WebDriverWait(driver, 100).until(lambda driver: driver.find_... | the_stack_v2_python_sparse | sbt/selenium/pages/element.py | jinnymus/Python | train | 0 |
c5b8604ae9055f603494c1f984ff3a943eae1c98 | [
"self._header = ProgressiveHeader(request_event.request.request_id)\nself._api_endpoint = request_event.context.system.api_endpoint + '/v1/directives'\nself._api_access_token = request_event.context.system.api_access_token",
"directive = ProgressiveDirective(speech)\nresponse = ProgressiveResponse(self._header, d... | <|body_start_0|>
self._header = ProgressiveHeader(request_event.request.request_id)
self._api_endpoint = request_event.context.system.api_endpoint + '/v1/directives'
self._api_access_token = request_event.context.system.api_access_token
<|end_body_0|>
<|body_start_1|>
directive = Progre... | This class provides a simple way to create and send a progressive response to Alexa while your skill processes the complete response. | ProgressiveResponseBuilder | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProgressiveResponseBuilder:
"""This class provides a simple way to create and send a progressive response to Alexa while your skill processes the complete response."""
def __init__(self, request_event):
"""Create a progressive response builder. You only need to create one of these pe... | stack_v2_sparse_classes_36k_train_028535 | 3,057 | permissive | [
{
"docstring": "Create a progressive response builder. You only need to create one of these per each request and simply call the send speech each time you need to send a response. Initialize with the request event object.",
"name": "__init__",
"signature": "def __init__(self, request_event)"
},
{
... | 2 | stack_v2_sparse_classes_30k_train_007532 | Implement the Python class `ProgressiveResponseBuilder` described below.
Class description:
This class provides a simple way to create and send a progressive response to Alexa while your skill processes the complete response.
Method signatures and docstrings:
- def __init__(self, request_event): Create a progressive ... | Implement the Python class `ProgressiveResponseBuilder` described below.
Class description:
This class provides a simple way to create and send a progressive response to Alexa while your skill processes the complete response.
Method signatures and docstrings:
- def __init__(self, request_event): Create a progressive ... | aac9d8aa4d6d5d2e9dcd079e0ac516b06c8a94ba | <|skeleton|>
class ProgressiveResponseBuilder:
"""This class provides a simple way to create and send a progressive response to Alexa while your skill processes the complete response."""
def __init__(self, request_event):
"""Create a progressive response builder. You only need to create one of these pe... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProgressiveResponseBuilder:
"""This class provides a simple way to create and send a progressive response to Alexa while your skill processes the complete response."""
def __init__(self, request_event):
"""Create a progressive response builder. You only need to create one of these per each reques... | the_stack_v2_python_sparse | askalexa/response/progressive.py | scottenglert/AskAlexa | train | 2 |
5762670367f244e10d629fb069613e4f3f127dea | [
"firstgame = 1\nlastgame = 7\nwhile True:\n gameNumber = input('Pick the game you want to solve for (1, 2, 3,... , {}): '.format(lastgame))\n try:\n gameNumber = int(gameNumber)\n except:\n print('Please pick an existing game.\\n')\n if isinstance(gameNumber, int):\n if not firstgam... | <|body_start_0|>
firstgame = 1
lastgame = 7
while True:
gameNumber = input('Pick the game you want to solve for (1, 2, 3,... , {}): '.format(lastgame))
try:
gameNumber = int(gameNumber)
except:
print('Please pick an existing gam... | Contains all functions asking for input. | Pick | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Pick:
"""Contains all functions asking for input."""
def pickGame(self):
"""Checks if the input is a game that exists. If the input is not feasible, asks for a new input. Return: gameNumber (int): If the game exists, returns the number of the game."""
<|body_0|>
def pick... | stack_v2_sparse_classes_36k_train_028536 | 2,423 | no_license | [
{
"docstring": "Checks if the input is a game that exists. If the input is not feasible, asks for a new input. Return: gameNumber (int): If the game exists, returns the number of the game.",
"name": "pickGame",
"signature": "def pickGame(self)"
},
{
"docstring": "Checks if the input is an intege... | 3 | stack_v2_sparse_classes_30k_train_001788 | Implement the Python class `Pick` described below.
Class description:
Contains all functions asking for input.
Method signatures and docstrings:
- def pickGame(self): Checks if the input is a game that exists. If the input is not feasible, asks for a new input. Return: gameNumber (int): If the game exists, returns th... | Implement the Python class `Pick` described below.
Class description:
Contains all functions asking for input.
Method signatures and docstrings:
- def pickGame(self): Checks if the input is a game that exists. If the input is not feasible, asks for a new input. Return: gameNumber (int): If the game exists, returns th... | 4d1eb8a94e38e256699c964b0c7147364ece099a | <|skeleton|>
class Pick:
"""Contains all functions asking for input."""
def pickGame(self):
"""Checks if the input is a game that exists. If the input is not feasible, asks for a new input. Return: gameNumber (int): If the game exists, returns the number of the game."""
<|body_0|>
def pick... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Pick:
"""Contains all functions asking for input."""
def pickGame(self):
"""Checks if the input is a game that exists. If the input is not feasible, asks for a new input. Return: gameNumber (int): If the game exists, returns the number of the game."""
firstgame = 1
lastgame = 7
... | the_stack_v2_python_sparse | src/classes/Pick.py | KevinVuongly/ProgrAmsterdam | train | 0 |
9d709fd7c9cccc88055e0040de85edc9e82cc2fe | [
"scoreFrame = Frame(main_game_frame, bg='black', borderwidth=3, relief=RIDGE)\nscoreFrame.grid(row=0, column=4, columnspan=4, rowspan=1, sticky=N + S + E + W)\nscoreFrame.grid_propagate(False)\nroot = scoreFrame\nroot.rowconfigure(0, weight=1)\nroot.rowconfigure(1, weight=1)\ni = 0\nwhile i < 4:\n root.columncon... | <|body_start_0|>
scoreFrame = Frame(main_game_frame, bg='black', borderwidth=3, relief=RIDGE)
scoreFrame.grid(row=0, column=4, columnspan=4, rowspan=1, sticky=N + S + E + W)
scoreFrame.grid_propagate(False)
root = scoreFrame
root.rowconfigure(0, weight=1)
root.rowconfigur... | ScoreFrame class. This class contains the initialization and configuration of the score frame in the gameplay consisting of the current username, the current game score and the most recent high score. It is of the tkinter library and inherits an instance of Frame. | ScoreFrame | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ScoreFrame:
"""ScoreFrame class. This class contains the initialization and configuration of the score frame in the gameplay consisting of the current username, the current game score and the most recent high score. It is of the tkinter library and inherits an instance of Frame."""
def __ini... | stack_v2_sparse_classes_36k_train_028537 | 22,054 | no_license | [
{
"docstring": "Initialization. Initializes the score frame, configures its size and defines its components. @param main_game_frame: Instance of the MGameFrame.",
"name": "__init__",
"signature": "def __init__(self, main_game_frame)"
},
{
"docstring": "Update the score shown in the score frame. ... | 2 | stack_v2_sparse_classes_30k_train_004870 | Implement the Python class `ScoreFrame` described below.
Class description:
ScoreFrame class. This class contains the initialization and configuration of the score frame in the gameplay consisting of the current username, the current game score and the most recent high score. It is of the tkinter library and inherits ... | Implement the Python class `ScoreFrame` described below.
Class description:
ScoreFrame class. This class contains the initialization and configuration of the score frame in the gameplay consisting of the current username, the current game score and the most recent high score. It is of the tkinter library and inherits ... | 4cb86bb4bc6fc0aaac5037cf076145781dc532b7 | <|skeleton|>
class ScoreFrame:
"""ScoreFrame class. This class contains the initialization and configuration of the score frame in the gameplay consisting of the current username, the current game score and the most recent high score. It is of the tkinter library and inherits an instance of Frame."""
def __ini... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ScoreFrame:
"""ScoreFrame class. This class contains the initialization and configuration of the score frame in the gameplay consisting of the current username, the current game score and the most recent high score. It is of the tkinter library and inherits an instance of Frame."""
def __init__(self, mai... | the_stack_v2_python_sparse | src/org/display/GameFrame.py | sasithra/ISE-Pacman-Final-Submission | train | 0 |
5088b2127080b5b8bec304a92c88e945cb058640 | [
"conn, cursor = get_db_cursor()\nbuild = 'toy_build'\ndatabase = 'scratch/toy.db'\ntalon.get_counters(database)\nedge_dict = init_refs.make_edge_dict(cursor)\nrun_info = talon.init_run_info(database, build)\nconn.close()\nchrom = 'chr1'\nvertex_IDs = [1, 2, 3, 4, 5, 6]\nstrand = '+'\nedge_IDs, novelty = talon.match... | <|body_start_0|>
conn, cursor = get_db_cursor()
build = 'toy_build'
database = 'scratch/toy.db'
talon.get_counters(database)
edge_dict = init_refs.make_edge_dict(cursor)
run_info = talon.init_run_info(database, build)
conn.close()
chrom = 'chr1'
ve... | TestMatchAllEdges | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestMatchAllEdges:
def test_all_known_edges(self):
"""Example where the toy transcript database contains matches for all vertices."""
<|body_0|>
def test_antisense(self):
"""Example where all of the vertices are in the database, but the edges are not, because they ar... | stack_v2_sparse_classes_36k_train_028538 | 1,910 | permissive | [
{
"docstring": "Example where the toy transcript database contains matches for all vertices.",
"name": "test_all_known_edges",
"signature": "def test_all_known_edges(self)"
},
{
"docstring": "Example where all of the vertices are in the database, but the edges are not, because they are antisense... | 2 | stack_v2_sparse_classes_30k_train_006190 | Implement the Python class `TestMatchAllEdges` described below.
Class description:
Implement the TestMatchAllEdges class.
Method signatures and docstrings:
- def test_all_known_edges(self): Example where the toy transcript database contains matches for all vertices.
- def test_antisense(self): Example where all of th... | Implement the Python class `TestMatchAllEdges` described below.
Class description:
Implement the TestMatchAllEdges class.
Method signatures and docstrings:
- def test_all_known_edges(self): Example where the toy transcript database contains matches for all vertices.
- def test_antisense(self): Example where all of th... | 8014faed5f982e5e106ec05239e47d65878e76c3 | <|skeleton|>
class TestMatchAllEdges:
def test_all_known_edges(self):
"""Example where the toy transcript database contains matches for all vertices."""
<|body_0|>
def test_antisense(self):
"""Example where all of the vertices are in the database, but the edges are not, because they ar... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestMatchAllEdges:
def test_all_known_edges(self):
"""Example where the toy transcript database contains matches for all vertices."""
conn, cursor = get_db_cursor()
build = 'toy_build'
database = 'scratch/toy.db'
talon.get_counters(database)
edge_dict = init_ref... | the_stack_v2_python_sparse | testing_suite/test_match_all_transcript_edges.py | kopardev/TALON | train | 0 | |
9591dbcf659188b0ac6a3d826ec5202e6382be19 | [
"super().__init__()\nself.nr_points = 5500\nself.acq_rate = 'FAcq'\nself.timeout_bpms = 10\nself.ch_kick = 5\nself.cv_kick = 5\nself.rf_kick = 5\nself.delay_corrs = 0.05\nself.delay_rf = 0.2\nself.exc_duration = 5\nself.exc_rf = 4\nfreqs = self.find_primes(16, start=120)\nself.ch_freqs = freqs[1::2][:6]\nself.cv_fr... | <|body_start_0|>
super().__init__()
self.nr_points = 5500
self.acq_rate = 'FAcq'
self.timeout_bpms = 10
self.ch_kick = 5
self.cv_kick = 5
self.rf_kick = 5
self.delay_corrs = 0.05
self.delay_rf = 0.2
self.exc_duration = 5
self.exc_rf... | . | ACORMParams | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ACORMParams:
"""."""
def __init__(self):
"""."""
<|body_0|>
def __str__(self):
"""."""
<|body_1|>
def find_primes(n_primes, start=3):
"""."""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
super().__init__()
self.nr_po... | stack_v2_sparse_classes_36k_train_028539 | 38,752 | permissive | [
{
"docstring": ".",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": ".",
"name": "__str__",
"signature": "def __str__(self)"
},
{
"docstring": ".",
"name": "find_primes",
"signature": "def find_primes(n_primes, start=3)"
}
] | 3 | stack_v2_sparse_classes_30k_train_001743 | Implement the Python class `ACORMParams` described below.
Class description:
.
Method signatures and docstrings:
- def __init__(self): .
- def __str__(self): .
- def find_primes(n_primes, start=3): . | Implement the Python class `ACORMParams` described below.
Class description:
.
Method signatures and docstrings:
- def __init__(self): .
- def __str__(self): .
- def find_primes(n_primes, start=3): .
<|skeleton|>
class ACORMParams:
"""."""
def __init__(self):
"""."""
<|body_0|>
def __st... | 39644161d98964a3a3d80d63269201f0a1712e82 | <|skeleton|>
class ACORMParams:
"""."""
def __init__(self):
"""."""
<|body_0|>
def __str__(self):
"""."""
<|body_1|>
def find_primes(n_primes, start=3):
"""."""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ACORMParams:
"""."""
def __init__(self):
"""."""
super().__init__()
self.nr_points = 5500
self.acq_rate = 'FAcq'
self.timeout_bpms = 10
self.ch_kick = 5
self.cv_kick = 5
self.rf_kick = 5
self.delay_corrs = 0.05
self.delay_rf ... | the_stack_v2_python_sparse | apsuite/commisslib/meas_ac_orm.py | lnls-fac/apsuite | train | 1 |
04ce9d34da08b152aaafb946d65d7ec8005e2b55 | [
"super().__init__()\nself.conv_residual = None\nif in_ch != out_ch:\n self.conv_residual = nn.utils.weight_norm(Conv2D(in_channels=in_ch, out_channels=out_ch, kernel_size=(1, 1)), name='weight', dim=0)\n self.dropout_residual = nn.Dropout(p=dropout)\nself.pad_left = nn.Pad2d((0, 0, kernel_size - 1, 0), 0)\nla... | <|body_start_0|>
super().__init__()
self.conv_residual = None
if in_ch != out_ch:
self.conv_residual = nn.utils.weight_norm(Conv2D(in_channels=in_ch, out_channels=out_ch, kernel_size=(1, 1)), name='weight', dim=0)
self.dropout_residual = nn.Dropout(p=dropout)
self... | ConvGLUBlock | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConvGLUBlock:
def __init__(self, kernel_size, in_ch, out_ch, bottlececk_dim=0, dropout=0.0):
"""A convolutional Gated Linear Units (GLU) block. Args: kernel_size (int): kernel size in_ch (int): number of input channels out_ch (int): number of output channels bottlececk_dim (int): dimensi... | stack_v2_sparse_classes_36k_train_028540 | 5,476 | permissive | [
{
"docstring": "A convolutional Gated Linear Units (GLU) block. Args: kernel_size (int): kernel size in_ch (int): number of input channels out_ch (int): number of output channels bottlececk_dim (int): dimension of the bottleneck layers for computational efficiency. Defaults to 0. dropout (float): dropout probab... | 2 | stack_v2_sparse_classes_30k_train_014417 | Implement the Python class `ConvGLUBlock` described below.
Class description:
Implement the ConvGLUBlock class.
Method signatures and docstrings:
- def __init__(self, kernel_size, in_ch, out_ch, bottlececk_dim=0, dropout=0.0): A convolutional Gated Linear Units (GLU) block. Args: kernel_size (int): kernel size in_ch ... | Implement the Python class `ConvGLUBlock` described below.
Class description:
Implement the ConvGLUBlock class.
Method signatures and docstrings:
- def __init__(self, kernel_size, in_ch, out_ch, bottlececk_dim=0, dropout=0.0): A convolutional Gated Linear Units (GLU) block. Args: kernel_size (int): kernel size in_ch ... | 17854a04d43c231eff66bfed9d6aa55e94a29e79 | <|skeleton|>
class ConvGLUBlock:
def __init__(self, kernel_size, in_ch, out_ch, bottlececk_dim=0, dropout=0.0):
"""A convolutional Gated Linear Units (GLU) block. Args: kernel_size (int): kernel size in_ch (int): number of input channels out_ch (int): number of output channels bottlececk_dim (int): dimensi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ConvGLUBlock:
def __init__(self, kernel_size, in_ch, out_ch, bottlececk_dim=0, dropout=0.0):
"""A convolutional Gated Linear Units (GLU) block. Args: kernel_size (int): kernel size in_ch (int): number of input channels out_ch (int): number of output channels bottlececk_dim (int): dimension of the bott... | the_stack_v2_python_sparse | paddlespeech/s2t/modules/activation.py | anniyanvr/DeepSpeech-1 | train | 0 | |
99a6742b6e158c89d0d84b799f8187795b2123c4 | [
"klassen = CompetitieIndivKlasse.objects.select_related('competitie').filter(competitie=comp).prefetch_related('regiocompetitiesporterboog_set').order_by('volgorde')\nfor obj in klassen:\n if obj.min_ag > AG_NUL:\n ag_str = '%5.3f' % obj.min_ag\n obj.min_ag_str = ag_str.replace('.', ',')\n if to... | <|body_start_0|>
klassen = CompetitieIndivKlasse.objects.select_related('competitie').filter(competitie=comp).prefetch_related('regiocompetitiesporterboog_set').order_by('volgorde')
for obj in klassen:
if obj.min_ag > AG_NUL:
ag_str = '%5.3f' % obj.min_ag
obj.... | deze view laat de vastgestelde aanvangsgemiddelden voor de volgende competitie zien | KlassengrenzenTonenView | [
"BSD-3-Clause-Clear"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KlassengrenzenTonenView:
"""deze view laat de vastgestelde aanvangsgemiddelden voor de volgende competitie zien"""
def _get_indiv_klassen(comp, toon_aantal):
"""geef een lijst van individuele competitie wedstrijdklassen terug met het AG geformatteerd voor presentatie."""
<|bo... | stack_v2_sparse_classes_36k_train_028541 | 4,879 | permissive | [
{
"docstring": "geef een lijst van individuele competitie wedstrijdklassen terug met het AG geformatteerd voor presentatie.",
"name": "_get_indiv_klassen",
"signature": "def _get_indiv_klassen(comp, toon_aantal)"
},
{
"docstring": "geef een lijst van team competitie wedstrijdklassen terug met he... | 3 | null | Implement the Python class `KlassengrenzenTonenView` described below.
Class description:
deze view laat de vastgestelde aanvangsgemiddelden voor de volgende competitie zien
Method signatures and docstrings:
- def _get_indiv_klassen(comp, toon_aantal): geef een lijst van individuele competitie wedstrijdklassen terug m... | Implement the Python class `KlassengrenzenTonenView` described below.
Class description:
deze view laat de vastgestelde aanvangsgemiddelden voor de volgende competitie zien
Method signatures and docstrings:
- def _get_indiv_klassen(comp, toon_aantal): geef een lijst van individuele competitie wedstrijdklassen terug m... | 5ed38165a231f0caa56f67e8faf2dd074916e500 | <|skeleton|>
class KlassengrenzenTonenView:
"""deze view laat de vastgestelde aanvangsgemiddelden voor de volgende competitie zien"""
def _get_indiv_klassen(comp, toon_aantal):
"""geef een lijst van individuele competitie wedstrijdklassen terug met het AG geformatteerd voor presentatie."""
<|bo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class KlassengrenzenTonenView:
"""deze view laat de vastgestelde aanvangsgemiddelden voor de volgende competitie zien"""
def _get_indiv_klassen(comp, toon_aantal):
"""geef een lijst van individuele competitie wedstrijdklassen terug met het AG geformatteerd voor presentatie."""
klassen = Competi... | the_stack_v2_python_sparse | Competitie/views_klassengrenzen.py | RamonvdW/nhb-apps | train | 2 |
ee813d5978dcb68139f389fe049b37814792b4b6 | [
"cur, prev = (root, None)\nres = []\nwhile cur:\n if not cur.left:\n res.append(cur.val)\n cur = cur.right\n else:\n prev = cur.left\n while prev.right and prev.right != cur:\n prev = prev.right\n if not prev.right:\n prev.right = cur\n cur =... | <|body_start_0|>
cur, prev = (root, None)
res = []
while cur:
if not cur.left:
res.append(cur.val)
cur = cur.right
else:
prev = cur.left
while prev.right and prev.right != cur:
prev = prev... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def inorderTraversal(self, root):
""":type root: TreeNode :rtype: List[int]"""
<|body_0|>
def inorderTraversal_on(self, root):
""":type root: TreeNode :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
cur, prev = (root, Non... | stack_v2_sparse_classes_36k_train_028542 | 1,687 | permissive | [
{
"docstring": ":type root: TreeNode :rtype: List[int]",
"name": "inorderTraversal",
"signature": "def inorderTraversal(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: List[int]",
"name": "inorderTraversal_on",
"signature": "def inorderTraversal_on(self, root)"
}
] | 2 | stack_v2_sparse_classes_30k_train_020861 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def inorderTraversal(self, root): :type root: TreeNode :rtype: List[int]
- def inorderTraversal_on(self, root): :type root: TreeNode :rtype: List[int] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def inorderTraversal(self, root): :type root: TreeNode :rtype: List[int]
- def inorderTraversal_on(self, root): :type root: TreeNode :rtype: List[int]
<|skeleton|>
class Solutio... | 86f1cb98de801f58c39d9a48ce9de12df7303d20 | <|skeleton|>
class Solution:
def inorderTraversal(self, root):
""":type root: TreeNode :rtype: List[int]"""
<|body_0|>
def inorderTraversal_on(self, root):
""":type root: TreeNode :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def inorderTraversal(self, root):
""":type root: TreeNode :rtype: List[int]"""
cur, prev = (root, None)
res = []
while cur:
if not cur.left:
res.append(cur.val)
cur = cur.right
else:
prev = cur.le... | the_stack_v2_python_sparse | 94-Binary-Tree-Inorder-Traversal/solution.py | Tanych/CodeTracking | train | 0 | |
0945be01dac8c9409f060e5f84787fa668df3001 | [
"self.episode_rewards = []\nfor _ in range(n_envs):\n self.episode_rewards.append([])\nself.len_buffer = deque(maxlen=40)\nself.rewbuffer = deque(maxlen=40)\nself.n_steps = n_steps\nself.n_envs = n_envs",
"rewards = np.reshape(rewards, [self.n_envs, self.n_steps])\nmasks = np.reshape(masks, [self.n_envs, self.... | <|body_start_0|>
self.episode_rewards = []
for _ in range(n_envs):
self.episode_rewards.append([])
self.len_buffer = deque(maxlen=40)
self.rewbuffer = deque(maxlen=40)
self.n_steps = n_steps
self.n_envs = n_envs
<|end_body_0|>
<|body_start_1|>
rewards... | EpisodeStats | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EpisodeStats:
def __init__(self, n_steps, n_envs):
"""Calculates the episode statistics :param n_steps: (int) The number of steps to run for each environment :param n_envs: (int) The number of environments"""
<|body_0|>
def feed(self, rewards, masks):
"""Update the l... | stack_v2_sparse_classes_36k_train_028543 | 39,128 | permissive | [
{
"docstring": "Calculates the episode statistics :param n_steps: (int) The number of steps to run for each environment :param n_envs: (int) The number of environments",
"name": "__init__",
"signature": "def __init__(self, n_steps, n_envs)"
},
{
"docstring": "Update the latest reward and mask :p... | 4 | null | Implement the Python class `EpisodeStats` described below.
Class description:
Implement the EpisodeStats class.
Method signatures and docstrings:
- def __init__(self, n_steps, n_envs): Calculates the episode statistics :param n_steps: (int) The number of steps to run for each environment :param n_envs: (int) The numb... | Implement the Python class `EpisodeStats` described below.
Class description:
Implement the EpisodeStats class.
Method signatures and docstrings:
- def __init__(self, n_steps, n_envs): Calculates the episode statistics :param n_steps: (int) The number of steps to run for each environment :param n_envs: (int) The numb... | 550db0d667533b9e94672fbbe6d391227f3d08e2 | <|skeleton|>
class EpisodeStats:
def __init__(self, n_steps, n_envs):
"""Calculates the episode statistics :param n_steps: (int) The number of steps to run for each environment :param n_envs: (int) The number of environments"""
<|body_0|>
def feed(self, rewards, masks):
"""Update the l... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EpisodeStats:
def __init__(self, n_steps, n_envs):
"""Calculates the episode statistics :param n_steps: (int) The number of steps to run for each environment :param n_envs: (int) The number of environments"""
self.episode_rewards = []
for _ in range(n_envs):
self.episode_re... | the_stack_v2_python_sparse | stable_baselines/acer/acer_simple.py | Stable-Baselines-Team/stable-baselines | train | 296 | |
f38885de8f80316c19ea19c280e0f44c4239aeaa | [
"self.tag = ''\nself.attributes = Attributes()\nself.content = ''\nself.elements = []",
"output = []\nfor e in self.elements:\n if e.tag == tag:\n output.append(e)\nreturn output",
"elem = Data()\nelem.tag = tag\nself.elements.append(elem)\nreturn elem",
"result = Data()\nif 'tag' in data:\n resu... | <|body_start_0|>
self.tag = ''
self.attributes = Attributes()
self.content = ''
self.elements = []
<|end_body_0|>
<|body_start_1|>
output = []
for e in self.elements:
if e.tag == tag:
output.append(e)
return output
<|end_body_1|>
<|bo... | This the XML data class used in SUAVE. Assumptions: None Source: N/A | Data | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Data:
"""This the XML data class used in SUAVE. Assumptions: None Source: N/A"""
def __defaults__(self):
"""Defaults for the data class. Assumptions: None Source: N/A Inputs: None Outputs: None Properties Used: N/A"""
<|body_0|>
def get_elements(self, tag):
"""Ge... | stack_v2_sparse_classes_36k_train_028544 | 4,826 | no_license | [
{
"docstring": "Defaults for the data class. Assumptions: None Source: N/A Inputs: None Outputs: None Properties Used: N/A",
"name": "__defaults__",
"signature": "def __defaults__(self)"
},
{
"docstring": "Gets elements with a given tag. Assumptions: None Source: N/A Inputs: tag - used to check ... | 5 | null | Implement the Python class `Data` described below.
Class description:
This the XML data class used in SUAVE. Assumptions: None Source: N/A
Method signatures and docstrings:
- def __defaults__(self): Defaults for the data class. Assumptions: None Source: N/A Inputs: None Outputs: None Properties Used: N/A
- def get_el... | Implement the Python class `Data` described below.
Class description:
This the XML data class used in SUAVE. Assumptions: None Source: N/A
Method signatures and docstrings:
- def __defaults__(self): Defaults for the data class. Assumptions: None Source: N/A Inputs: None Outputs: None Properties Used: N/A
- def get_el... | 0ef6f56a373cedc0cfb2ba30e6f6901da6cbe861 | <|skeleton|>
class Data:
"""This the XML data class used in SUAVE. Assumptions: None Source: N/A"""
def __defaults__(self):
"""Defaults for the data class. Assumptions: None Source: N/A Inputs: None Outputs: None Properties Used: N/A"""
<|body_0|>
def get_elements(self, tag):
"""Ge... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Data:
"""This the XML data class used in SUAVE. Assumptions: None Source: N/A"""
def __defaults__(self):
"""Defaults for the data class. Assumptions: None Source: N/A Inputs: None Outputs: None Properties Used: N/A"""
self.tag = ''
self.attributes = Attributes()
self.conte... | the_stack_v2_python_sparse | A22DSE/Models/SUAVE/SUAVE/Input_Output/XML/Data.py | dsegroup22/A22CERES | train | 1 |
8792199b07fbcf3a6f5666b565ff21b1d7784294 | [
"startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('aquan_erj826', 'aquan_erj826')\nurl = 'https://data.somervillema.gov/resource/jpgd-3f23.json'\nresponse = urllib.request.urlopen(url).read().decode('utf-8')\nr = json.loads(response)\ns = json.dumps(r, s... | <|body_start_0|>
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('aquan_erj826', 'aquan_erj826')
url = 'https://data.somervillema.gov/resource/jpgd-3f23.json'
response = urllib.request.urlopen(url).read().decode(... | getCarCitations | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class getCarCitations:
def execute(trial=False):
"""Retrieve motor vehicle citation information from Somerville."""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing everything happening in ... | stack_v2_sparse_classes_36k_train_028545 | 4,093 | no_license | [
{
"docstring": "Retrieve motor vehicle citation information from Somerville.",
"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 document describi... | 2 | stack_v2_sparse_classes_30k_train_018208 | Implement the Python class `getCarCitations` described below.
Class description:
Implement the getCarCitations class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve motor vehicle citation information from Somerville.
- def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None)... | Implement the Python class `getCarCitations` described below.
Class description:
Implement the getCarCitations class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve motor vehicle citation information from Somerville.
- def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None)... | 97e72731ffadbeae57d7a332decd58706e7c08de | <|skeleton|>
class getCarCitations:
def execute(trial=False):
"""Retrieve motor vehicle citation information from Somerville."""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing everything happening in ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class getCarCitations:
def execute(trial=False):
"""Retrieve motor vehicle citation information from Somerville."""
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('aquan_erj826', 'aquan_erj826')
url = 'https... | the_stack_v2_python_sparse | aquan_erj826/getCarCitations.py | ROODAY/course-2017-fal-proj | train | 3 | |
af9c5d93d664488664c15ee68ef6574f2126d5ca | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn Parameter()",
"from .value_type import ValueType\nfrom .value_type import ValueType\nfields: Dict[str, Callable[[Any], None]] = {'name': lambda n: setattr(self, 'name', n.get_str_value()), '@odata.type': lambda n: setattr(self, 'odata_... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return Parameter()
<|end_body_0|>
<|body_start_1|>
from .value_type import ValueType
from .value_type import ValueType
fields: Dict[str, Callable[[Any], None]] = {'name': lambda n: seta... | Parameter | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Parameter:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Parameter:
"""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: Parame... | stack_v2_sparse_classes_36k_train_028546 | 3,021 | 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: Parameter",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_value(par... | 3 | stack_v2_sparse_classes_30k_train_004956 | Implement the Python class `Parameter` described below.
Class description:
Implement the Parameter class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Parameter: Creates a new instance of the appropriate class based on discriminator value Args: parse... | Implement the Python class `Parameter` described below.
Class description:
Implement the Parameter class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Parameter: Creates a new instance of the appropriate class based on discriminator value Args: parse... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class Parameter:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Parameter:
"""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: Parame... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Parameter:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Parameter:
"""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: Parameter"""
... | the_stack_v2_python_sparse | msgraph/generated/models/identity_governance/parameter.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
0f712b96ba8c6b625c63fd2b5d0c5c8df48228bb | [
"super(LinearSampling, self).__init__()\nstvd = 1.0 / np.sqrt(dims)\nself.dropout = dropout\nwith self.init_scope():\n self.linear = L.Linear(idim, dims, initialW=initialW(scale=stvd), initial_bias=initial_bias(scale=stvd))\n self.pe = PositionalEncoding(dims, dropout)",
"logging.info(xs.shape)\nxs = self.l... | <|body_start_0|>
super(LinearSampling, self).__init__()
stvd = 1.0 / np.sqrt(dims)
self.dropout = dropout
with self.init_scope():
self.linear = L.Linear(idim, dims, initialW=initialW(scale=stvd), initial_bias=initial_bias(scale=stvd))
self.pe = PositionalEncoding(... | Linear 1D subsampling. :param int idim: input dim :param int odim: output dim :param flaot dropout_rate: dropout rate | LinearSampling | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LinearSampling:
"""Linear 1D subsampling. :param int idim: input dim :param int odim: output dim :param flaot dropout_rate: dropout rate"""
def __init__(self, idim, dims, dropout=0.1, initialW=None, initial_bias=None):
"""Initialize LinearSampling."""
<|body_0|>
def forw... | stack_v2_sparse_classes_36k_train_028547 | 3,464 | permissive | [
{
"docstring": "Initialize LinearSampling.",
"name": "__init__",
"signature": "def __init__(self, idim, dims, dropout=0.1, initialW=None, initial_bias=None)"
},
{
"docstring": "Subsample x. :param chainer.Variable x: input tensor :return: subsampled x and mask",
"name": "forward",
"signa... | 2 | null | Implement the Python class `LinearSampling` described below.
Class description:
Linear 1D subsampling. :param int idim: input dim :param int odim: output dim :param flaot dropout_rate: dropout rate
Method signatures and docstrings:
- def __init__(self, idim, dims, dropout=0.1, initialW=None, initial_bias=None): Initi... | Implement the Python class `LinearSampling` described below.
Class description:
Linear 1D subsampling. :param int idim: input dim :param int odim: output dim :param flaot dropout_rate: dropout rate
Method signatures and docstrings:
- def __init__(self, idim, dims, dropout=0.1, initialW=None, initial_bias=None): Initi... | bcd20948db7846ee523443ef9fd78c7a1248c95e | <|skeleton|>
class LinearSampling:
"""Linear 1D subsampling. :param int idim: input dim :param int odim: output dim :param flaot dropout_rate: dropout rate"""
def __init__(self, idim, dims, dropout=0.1, initialW=None, initial_bias=None):
"""Initialize LinearSampling."""
<|body_0|>
def forw... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LinearSampling:
"""Linear 1D subsampling. :param int idim: input dim :param int odim: output dim :param flaot dropout_rate: dropout rate"""
def __init__(self, idim, dims, dropout=0.1, initialW=None, initial_bias=None):
"""Initialize LinearSampling."""
super(LinearSampling, self).__init__(... | the_stack_v2_python_sparse | espnet/nets/chainer_backend/transformer/subsampling.py | espnet/espnet | train | 7,242 |
5884c9d06bb9947a11e2247472b18c5c2f5c5815 | [
"next = pcs.Field('next_header', 8)\nlen = pcs.Field('length', 8)\ntype = pcs.Field('type', 8)\nsegments_left = pcs.Field('segments_left', 8)\npcs.Packet.__init__(self, [next, len, type, segments_left], bytes)",
"reserved = pcs.Field('reserved', 32, default=0)\nheader = [reserved]\nfor i in range(seg):\n heade... | <|body_start_0|>
next = pcs.Field('next_header', 8)
len = pcs.Field('length', 8)
type = pcs.Field('type', 8)
segments_left = pcs.Field('segments_left', 8)
pcs.Packet.__init__(self, [next, len, type, segments_left], bytes)
<|end_body_0|>
<|body_start_1|>
reserved = pcs.Fi... | A class that contains the IPv6 routing extension-headers. | rthdr | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class rthdr:
"""A class that contains the IPv6 routing extension-headers."""
def __init__(self, bytes=None):
"""IPv6 routing extension header from RFC 2460"""
<|body_0|>
def rthdr0(self, seg=1, bytes=None):
"""IPv6 routing extension header type 0"""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_028548 | 7,919 | no_license | [
{
"docstring": "IPv6 routing extension header from RFC 2460",
"name": "__init__",
"signature": "def __init__(self, bytes=None)"
},
{
"docstring": "IPv6 routing extension header type 0",
"name": "rthdr0",
"signature": "def rthdr0(self, seg=1, bytes=None)"
}
] | 2 | stack_v2_sparse_classes_30k_train_016098 | Implement the Python class `rthdr` described below.
Class description:
A class that contains the IPv6 routing extension-headers.
Method signatures and docstrings:
- def __init__(self, bytes=None): IPv6 routing extension header from RFC 2460
- def rthdr0(self, seg=1, bytes=None): IPv6 routing extension header type 0 | Implement the Python class `rthdr` described below.
Class description:
A class that contains the IPv6 routing extension-headers.
Method signatures and docstrings:
- def __init__(self, bytes=None): IPv6 routing extension header from RFC 2460
- def rthdr0(self, seg=1, bytes=None): IPv6 routing extension header type 0
... | a070a39586b582fbeea72abf12bbfd812955ad81 | <|skeleton|>
class rthdr:
"""A class that contains the IPv6 routing extension-headers."""
def __init__(self, bytes=None):
"""IPv6 routing extension header from RFC 2460"""
<|body_0|>
def rthdr0(self, seg=1, bytes=None):
"""IPv6 routing extension header type 0"""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class rthdr:
"""A class that contains the IPv6 routing extension-headers."""
def __init__(self, bytes=None):
"""IPv6 routing extension header from RFC 2460"""
next = pcs.Field('next_header', 8)
len = pcs.Field('length', 8)
type = pcs.Field('type', 8)
segments_left = pcs.... | the_stack_v2_python_sparse | src/pcs/packets/ipv6.py | bilouro/tcptest | train | 0 |
c120acd5af964ec3df331bad4fdbd6ba6a8889a2 | [
"super(BertEmbeddings, self).__init__()\nself.word_embeddings = nn.Embedding(config.vocab_size, config.hidden_size, padding_idx=0)\nself.position_embeddings = nn.Embedding(config.max_position_embeddings, config.hidden_size)\nself.token_type_embeddings = nn.Embedding(config.type_vocab_size, config.hidden_size)\nself... | <|body_start_0|>
super(BertEmbeddings, self).__init__()
self.word_embeddings = nn.Embedding(config.vocab_size, config.hidden_size, padding_idx=0)
self.position_embeddings = nn.Embedding(config.max_position_embeddings, config.hidden_size)
self.token_type_embeddings = nn.Embedding(config.t... | Construct the embeddings from word, position and token_type embeddings. | BertEmbeddings | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BertEmbeddings:
"""Construct the embeddings from word, position and token_type embeddings."""
def __init__(self, config):
"""init fun"""
<|body_0|>
def construct(self, input_ids, token_type_ids):
"""construct fun"""
<|body_1|>
<|end_skeleton|>
<|body_st... | stack_v2_sparse_classes_36k_train_028549 | 16,172 | permissive | [
{
"docstring": "init fun",
"name": "__init__",
"signature": "def __init__(self, config)"
},
{
"docstring": "construct fun",
"name": "construct",
"signature": "def construct(self, input_ids, token_type_ids)"
}
] | 2 | null | Implement the Python class `BertEmbeddings` described below.
Class description:
Construct the embeddings from word, position and token_type embeddings.
Method signatures and docstrings:
- def __init__(self, config): init fun
- def construct(self, input_ids, token_type_ids): construct fun | Implement the Python class `BertEmbeddings` described below.
Class description:
Construct the embeddings from word, position and token_type embeddings.
Method signatures and docstrings:
- def __init__(self, config): init fun
- def construct(self, input_ids, token_type_ids): construct fun
<|skeleton|>
class BertEmbed... | eab643f51336dbf7d711f02d27e6516e5affee59 | <|skeleton|>
class BertEmbeddings:
"""Construct the embeddings from word, position and token_type embeddings."""
def __init__(self, config):
"""init fun"""
<|body_0|>
def construct(self, input_ids, token_type_ids):
"""construct fun"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BertEmbeddings:
"""Construct the embeddings from word, position and token_type embeddings."""
def __init__(self, config):
"""init fun"""
super(BertEmbeddings, self).__init__()
self.word_embeddings = nn.Embedding(config.vocab_size, config.hidden_size, padding_idx=0)
self.po... | the_stack_v2_python_sparse | research/nlp/luke/src/luke/robert.py | mindspore-ai/models | train | 301 |
89598ca59ead92a985ea2b1d0971ed965d3cc341 | [
"super().__init__(parent=parent)\nself.setLabel('bottom', 'Train ID')\nself.setLabel('left', 'FOM (arb. u.)')\nself.setTitle('FOM correlation')\nself._plot = self.plotScatter()",
"pp = self._data['processed'].corr.pp\nx, y = (pp.x, pp.y)\nself._plot.setData(x, y)"
] | <|body_start_0|>
super().__init__(parent=parent)
self.setLabel('bottom', 'Train ID')
self.setLabel('left', 'FOM (arb. u.)')
self.setTitle('FOM correlation')
self._plot = self.plotScatter()
<|end_body_0|>
<|body_start_1|>
pp = self._data['processed'].corr.pp
x, y ... | PumpProbeFomPlot class. Widget for displaying the evolution of FOM in pump-probe analysis. | PumpProbeFomPlot | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PumpProbeFomPlot:
"""PumpProbeFomPlot class. Widget for displaying the evolution of FOM in pump-probe analysis."""
def __init__(self, *, parent=None):
"""Initialization."""
<|body_0|>
def refresh(self):
"""Override."""
<|body_1|>
<|end_skeleton|>
<|body... | stack_v2_sparse_classes_36k_train_028550 | 4,377 | permissive | [
{
"docstring": "Initialization.",
"name": "__init__",
"signature": "def __init__(self, *, parent=None)"
},
{
"docstring": "Override.",
"name": "refresh",
"signature": "def refresh(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_010339 | Implement the Python class `PumpProbeFomPlot` described below.
Class description:
PumpProbeFomPlot class. Widget for displaying the evolution of FOM in pump-probe analysis.
Method signatures and docstrings:
- def __init__(self, *, parent=None): Initialization.
- def refresh(self): Override. | Implement the Python class `PumpProbeFomPlot` described below.
Class description:
PumpProbeFomPlot class. Widget for displaying the evolution of FOM in pump-probe analysis.
Method signatures and docstrings:
- def __init__(self, *, parent=None): Initialization.
- def refresh(self): Override.
<|skeleton|>
class PumpPr... | a6ee28040b15ae8d110570bd9f3c37e5a3e70fc0 | <|skeleton|>
class PumpProbeFomPlot:
"""PumpProbeFomPlot class. Widget for displaying the evolution of FOM in pump-probe analysis."""
def __init__(self, *, parent=None):
"""Initialization."""
<|body_0|>
def refresh(self):
"""Override."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PumpProbeFomPlot:
"""PumpProbeFomPlot class. Widget for displaying the evolution of FOM in pump-probe analysis."""
def __init__(self, *, parent=None):
"""Initialization."""
super().__init__(parent=parent)
self.setLabel('bottom', 'Train ID')
self.setLabel('left', 'FOM (arb.... | the_stack_v2_python_sparse | extra_foam/gui/windows/pump_probe_w.py | European-XFEL/EXtra-foam | train | 8 |
f3011cd729ef73e504ea6cc26978c97c26795a35 | [
"updated_skill_model = skill_services.populate_skill_model_fields(skill_model, migrated_skill)\ncommit_message = 'Update skill content schema version to %d and skill misconceptions schema version to %d and skill rubrics schema version to %d.' % (feconf.CURRENT_SKILL_CONTENTS_SCHEMA_VERSION, feconf.CURRENT_MISCONCEP... | <|body_start_0|>
updated_skill_model = skill_services.populate_skill_model_fields(skill_model, migrated_skill)
commit_message = 'Update skill content schema version to %d and skill misconceptions schema version to %d and skill rubrics schema version to %d.' % (feconf.CURRENT_SKILL_CONTENTS_SCHEMA_VERSIO... | Job that migrates skill models. | MigrateSkillJob | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MigrateSkillJob:
"""Job that migrates skill models."""
def _update_skill(skill_model: skill_models.SkillModel, migrated_skill: skill_domain.Skill, skill_changes: Sequence[skill_domain.SkillChange]) -> Sequence[base_models.BaseModel]:
"""Generates newly updated skill models. Args: ski... | stack_v2_sparse_classes_36k_train_028551 | 14,669 | permissive | [
{
"docstring": "Generates newly updated skill models. Args: skill_model: SkillModel. The skill which should be updated. migrated_skill: Skill. The migrated skill domain object. skill_changes: sequence(SkillChange). The skill changes to apply. Returns: sequence(BaseModel). Sequence of models which should be put ... | 3 | null | Implement the Python class `MigrateSkillJob` described below.
Class description:
Job that migrates skill models.
Method signatures and docstrings:
- def _update_skill(skill_model: skill_models.SkillModel, migrated_skill: skill_domain.Skill, skill_changes: Sequence[skill_domain.SkillChange]) -> Sequence[base_models.Ba... | Implement the Python class `MigrateSkillJob` described below.
Class description:
Job that migrates skill models.
Method signatures and docstrings:
- def _update_skill(skill_model: skill_models.SkillModel, migrated_skill: skill_domain.Skill, skill_changes: Sequence[skill_domain.SkillChange]) -> Sequence[base_models.Ba... | d16fdf23d790eafd63812bd7239532256e30a21d | <|skeleton|>
class MigrateSkillJob:
"""Job that migrates skill models."""
def _update_skill(skill_model: skill_models.SkillModel, migrated_skill: skill_domain.Skill, skill_changes: Sequence[skill_domain.SkillChange]) -> Sequence[base_models.BaseModel]:
"""Generates newly updated skill models. Args: ski... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MigrateSkillJob:
"""Job that migrates skill models."""
def _update_skill(skill_model: skill_models.SkillModel, migrated_skill: skill_domain.Skill, skill_changes: Sequence[skill_domain.SkillChange]) -> Sequence[base_models.BaseModel]:
"""Generates newly updated skill models. Args: skill_model: Ski... | the_stack_v2_python_sparse | core/jobs/batch_jobs/skill_migration_jobs.py | oppia/oppia | train | 6,172 |
709b7a281bac1f3d1f7541e5bddaa9a7e7cf4786 | [
"super(NieFineCoattention, self).__init__()\nwith self.init_scope():\n self.energy_layer = links.Bilinear(hidden_dim, hidden_dim, 1)\n self.attention_layer_1 = GraphLinear(head, 1, nobias=True)\n self.attention_layer_2 = GraphLinear(head, 1, nobias=True)\n self.lt_layer_1 = GraphLinear(hidden_dim, head,... | <|body_start_0|>
super(NieFineCoattention, self).__init__()
with self.init_scope():
self.energy_layer = links.Bilinear(hidden_dim, hidden_dim, 1)
self.attention_layer_1 = GraphLinear(head, 1, nobias=True)
self.attention_layer_2 = GraphLinear(head, 1, nobias=True)
... | TODO | NieFineCoattention | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NieFineCoattention:
"""TODO"""
def __init__(self, hidden_dim, out_dim, head, activation=functions.identity):
""":param hidden_dim: dimension of atom representation :param out_dim: dimension of molecular representation :param head: number of heads in attention mechanism"""
<|b... | stack_v2_sparse_classes_36k_train_028552 | 25,561 | permissive | [
{
"docstring": ":param hidden_dim: dimension of atom representation :param out_dim: dimension of molecular representation :param head: number of heads in attention mechanism",
"name": "__init__",
"signature": "def __init__(self, hidden_dim, out_dim, head, activation=functions.identity)"
},
{
"do... | 3 | stack_v2_sparse_classes_30k_train_014279 | Implement the Python class `NieFineCoattention` described below.
Class description:
TODO
Method signatures and docstrings:
- def __init__(self, hidden_dim, out_dim, head, activation=functions.identity): :param hidden_dim: dimension of atom representation :param out_dim: dimension of molecular representation :param he... | Implement the Python class `NieFineCoattention` described below.
Class description:
TODO
Method signatures and docstrings:
- def __init__(self, hidden_dim, out_dim, head, activation=functions.identity): :param hidden_dim: dimension of atom representation :param out_dim: dimension of molecular representation :param he... | 21b64a3c8cc9bc33718ae09c65aa917e575132eb | <|skeleton|>
class NieFineCoattention:
"""TODO"""
def __init__(self, hidden_dim, out_dim, head, activation=functions.identity):
""":param hidden_dim: dimension of atom representation :param out_dim: dimension of molecular representation :param head: number of heads in attention mechanism"""
<|b... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NieFineCoattention:
"""TODO"""
def __init__(self, hidden_dim, out_dim, head, activation=functions.identity):
""":param hidden_dim: dimension of atom representation :param out_dim: dimension of molecular representation :param head: number of heads in attention mechanism"""
super(NieFineCoa... | the_stack_v2_python_sparse | models/coattention/nie_coattention.py | Minys233/GCN-BMP | train | 1 |
40807440b4d7967388768f4bcfe406339d3994b0 | [
"self._n = n\nif estimator is None:\n if n > 1:\n probdist_factory = lambda fdist, bins, n_train, n_0: NeyProbDist(fdist, bins, n_train, n_0, factor, NeyProbDist.ABSOLUTE)\n else:\n probdist_factory = lambda fdist, bins, *args: LaplaceProbDist(fdist, bins)\nelse:\n probdist_factory = estimato... | <|body_start_0|>
self._n = n
if estimator is None:
if n > 1:
probdist_factory = lambda fdist, bins, n_train, n_0: NeyProbDist(fdist, bins, n_train, n_0, factor, NeyProbDist.ABSOLUTE)
else:
probdist_factory = lambda fdist, bins, *args: LaplaceProbDi... | NgramModel with Simple Linear Interpolation | SLINgramModel | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SLINgramModel:
"""NgramModel with Simple Linear Interpolation"""
def __init__(self, n, train, estimator=None, factor=0.77):
"""Creates an ngram language model to capture patterns in n consecutive words of training text. An estimator smooths the probabilities derived from the text and... | stack_v2_sparse_classes_36k_train_028553 | 5,493 | no_license | [
{
"docstring": "Creates an ngram language model to capture patterns in n consecutive words of training text. An estimator smooths the probabilities derived from the text and may allow generation of ngrams not seen during training. @param n: the order of the language model (ngram size) @type n: C{int} @param tra... | 2 | stack_v2_sparse_classes_30k_train_010256 | Implement the Python class `SLINgramModel` described below.
Class description:
NgramModel with Simple Linear Interpolation
Method signatures and docstrings:
- def __init__(self, n, train, estimator=None, factor=0.77): Creates an ngram language model to capture patterns in n consecutive words of training text. An esti... | Implement the Python class `SLINgramModel` described below.
Class description:
NgramModel with Simple Linear Interpolation
Method signatures and docstrings:
- def __init__(self, n, train, estimator=None, factor=0.77): Creates an ngram language model to capture patterns in n consecutive words of training text. An esti... | ae5e54713648e32d5a8498fc3e7f6e94cddb1b6d | <|skeleton|>
class SLINgramModel:
"""NgramModel with Simple Linear Interpolation"""
def __init__(self, n, train, estimator=None, factor=0.77):
"""Creates an ngram language model to capture patterns in n consecutive words of training text. An estimator smooths the probabilities derived from the text and... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SLINgramModel:
"""NgramModel with Simple Linear Interpolation"""
def __init__(self, n, train, estimator=None, factor=0.77):
"""Creates an ngram language model to capture patterns in n consecutive words of training text. An estimator smooths the probabilities derived from the text and may allow ge... | the_stack_v2_python_sparse | NLP/20ng/src/model.py | tehf0x/gabe-and-joh | train | 0 |
0ac317a273dc2bb25504bcec41eff8011345f41e | [
"self.length = [0]\nfor i in range(len(strs)):\n self.length.append(self.length[-1] + len(strs[i]))\nreturn ''.join(strs)",
"result = []\nfor i in range(len(self.length) - 1):\n result.append(s[self.length[i]:self.length[i + 1]])\nreturn result"
] | <|body_start_0|>
self.length = [0]
for i in range(len(strs)):
self.length.append(self.length[-1] + len(strs[i]))
return ''.join(strs)
<|end_body_0|>
<|body_start_1|>
result = []
for i in range(len(self.length) - 1):
result.append(s[self.length[i]:self.len... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def encode(self, strs):
"""Encodes a list of strings to a single string. :type strs: List[str] :rtype: str"""
<|body_0|>
def decode(self, s):
"""Decodes a single string to a list of strings. :type s: str :rtype: List[str]"""
<|body_1|>
<|end_skeleton|... | stack_v2_sparse_classes_36k_train_028554 | 747 | no_license | [
{
"docstring": "Encodes a list of strings to a single string. :type strs: List[str] :rtype: str",
"name": "encode",
"signature": "def encode(self, strs)"
},
{
"docstring": "Decodes a single string to a list of strings. :type s: str :rtype: List[str]",
"name": "decode",
"signature": "def ... | 2 | null | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def encode(self, strs): Encodes a list of strings to a single string. :type strs: List[str] :rtype: str
- def decode(self, s): Decodes a single string to a list of strings. :type s: st... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def encode(self, strs): Encodes a list of strings to a single string. :type strs: List[str] :rtype: str
- def decode(self, s): Decodes a single string to a list of strings. :type s: st... | 08500c39e14f3bf140db82a3dd2df4ca18705845 | <|skeleton|>
class Codec:
def encode(self, strs):
"""Encodes a list of strings to a single string. :type strs: List[str] :rtype: str"""
<|body_0|>
def decode(self, s):
"""Decodes a single string to a list of strings. :type s: str :rtype: List[str]"""
<|body_1|>
<|end_skeleton|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def encode(self, strs):
"""Encodes a list of strings to a single string. :type strs: List[str] :rtype: str"""
self.length = [0]
for i in range(len(strs)):
self.length.append(self.length[-1] + len(strs[i]))
return ''.join(strs)
def decode(self, s):
... | the_stack_v2_python_sparse | python/271_encode-and-decode-strings/encodeAndDecodeStrings.py | kfrancischen/leetcode | train | 2 | |
d604848131b2af6ede5f2104a48d17311a5235ff | [
"if model._meta.app_label == 'subdata':\n return 'subdata_db'\nreturn None",
"if model._meta.app_label == 'subdata':\n return 'subdata_db'\nreturn None",
"if obj1._meta.app_label == 'subdata' or obj2._meta.app_label == 'subdata':\n return True\nreturn None",
"if app_label == 'subdata':\n return db... | <|body_start_0|>
if model._meta.app_label == 'subdata':
return 'subdata_db'
return None
<|end_body_0|>
<|body_start_1|>
if model._meta.app_label == 'subdata':
return 'subdata_db'
return None
<|end_body_1|>
<|body_start_2|>
if obj1._meta.app_label == 'sub... | A router to control all database operations on models_class in the subdataset application. | SubdatasetRouter | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SubdatasetRouter:
"""A router to control all database operations on models_class in the subdataset application."""
def db_for_read(self, model, **hints):
"""Attempts to read subdataset models_class go to db.subdata."""
<|body_0|>
def db_for_write(self, model, **hints):
... | stack_v2_sparse_classes_36k_train_028555 | 1,166 | permissive | [
{
"docstring": "Attempts to read subdataset models_class go to db.subdata.",
"name": "db_for_read",
"signature": "def db_for_read(self, model, **hints)"
},
{
"docstring": "Attempts to write subdataset models_class go to db.subdata.",
"name": "db_for_write",
"signature": "def db_for_write... | 4 | stack_v2_sparse_classes_30k_train_008642 | Implement the Python class `SubdatasetRouter` described below.
Class description:
A router to control all database operations on models_class in the subdataset application.
Method signatures and docstrings:
- def db_for_read(self, model, **hints): Attempts to read subdataset models_class go to db.subdata.
- def db_fo... | Implement the Python class `SubdatasetRouter` described below.
Class description:
A router to control all database operations on models_class in the subdataset application.
Method signatures and docstrings:
- def db_for_read(self, model, **hints): Attempts to read subdataset models_class go to db.subdata.
- def db_fo... | 6afe0b6cc1d2791b94255668757ff920224fed0a | <|skeleton|>
class SubdatasetRouter:
"""A router to control all database operations on models_class in the subdataset application."""
def db_for_read(self, model, **hints):
"""Attempts to read subdataset models_class go to db.subdata."""
<|body_0|>
def db_for_write(self, model, **hints):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SubdatasetRouter:
"""A router to control all database operations on models_class in the subdataset application."""
def db_for_read(self, model, **hints):
"""Attempts to read subdataset models_class go to db.subdata."""
if model._meta.app_label == 'subdata':
return 'subdata_db'... | the_stack_v2_python_sparse | Backend manage datasets/MachineLearningApp/db_routes/subdataset_db.py | KamilJerzyWojcik/Machine_learning_App | train | 0 |
c1e6258a524dcf1a9db3201d237c61ec4e77ee6f | [
"if root == None:\n return '#'\ncurr_level = [root]\nresult = []\nwhile curr_level:\n tmp, next_level = ([], [])\n for i in xrange(len(curr_level)):\n if curr_level[i] == '#':\n tmp.append('#')\n else:\n tmp.append(str(curr_level[i].val))\n if curr_level[i].le... | <|body_start_0|>
if root == None:
return '#'
curr_level = [root]
result = []
while curr_level:
tmp, next_level = ([], [])
for i in xrange(len(curr_level)):
if curr_level[i] == '#':
tmp.append('#')
els... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_36k_train_028556 | 2,600 | 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:... | ee79d3437cf47b26a4bca0ec798dc54d7b623453 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
if root == None:
return '#'
curr_level = [root]
result = []
while curr_level:
tmp, next_level = ([], [])
for i in xrange(len(c... | the_stack_v2_python_sparse | Algorithm/Python/297. Serialize and Deserialize Binary Tree.py | WuLC/LeetCode | train | 29 | |
7e62e6c49f8f2778fee55552069eed9614fe3032 | [
"preorder = []\n\ndef helper(node):\n if node:\n preorder.append(str(node.val))\n helper(node.left)\n helper(node.right)\nhelper(root)\nreturn '|'.join(preorder)",
"if not data:\n return None\npreorder = list(map(int, data.split('|')))\ni = 0\n\ndef helper(lo=float('-inf'), hi=float('in... | <|body_start_0|>
preorder = []
def helper(node):
if node:
preorder.append(str(node.val))
helper(node.left)
helper(node.right)
helper(root)
return '|'.join(preorder)
<|end_body_0|>
<|body_start_1|>
if not data:
... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root: TreeNode) -> str:
"""Encodes a tree to a single string."""
<|body_0|>
def deserialize(self, data: str) -> TreeNode:
"""Decodes your encoded data to tree."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
preorder = []
... | stack_v2_sparse_classes_36k_train_028557 | 4,762 | no_license | [
{
"docstring": "Encodes a tree to a single string.",
"name": "serialize",
"signature": "def serialize(self, root: TreeNode) -> str"
},
{
"docstring": "Decodes your encoded data to tree.",
"name": "deserialize",
"signature": "def deserialize(self, data: str) -> TreeNode"
}
] | 2 | null | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string.
- def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string.
- def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree.
<|skeleton|>
class Co... | 59f70dc4466e15df591ba285317e4a1fe808ed60 | <|skeleton|>
class Codec:
def serialize(self, root: TreeNode) -> str:
"""Encodes a tree to a single string."""
<|body_0|>
def deserialize(self, data: str) -> TreeNode:
"""Decodes your encoded data to tree."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root: TreeNode) -> str:
"""Encodes a tree to a single string."""
preorder = []
def helper(node):
if node:
preorder.append(str(node.val))
helper(node.left)
helper(node.right)
helper(root)
... | the_stack_v2_python_sparse | leet/amazon/trees_and_graphs/449_serialize_and_deserialize_BST.py | arsamigullin/problem_solving_python | train | 0 | |
c652428851eb81eab8ea3fa740d3fb1f52b51bfc | [
"super(negative_sampling_loss, self).__init__()\nvocab_size, embedding_dim = word_vectors.size()\nself.embedding = nn.Embedding(vocab_size, embedding_dim)\nself.embedding.weight.data = word_vectors\nself.multinomial = AliasMultinomial(word_distribution)\nself.num_sampled = num_sampled\nself.embedding_dim = embeddin... | <|body_start_0|>
super(negative_sampling_loss, self).__init__()
vocab_size, embedding_dim = word_vectors.size()
self.embedding = nn.Embedding(vocab_size, embedding_dim)
self.embedding.weight.data = word_vectors
self.multinomial = AliasMultinomial(word_distribution)
self.n... | negative_sampling_loss | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class negative_sampling_loss:
def __init__(self, word_vectors, word_distribution, num_sampled=10):
"""Arguments: word_vectors: A float tensor of shape [vocab_size, embedding_dim]. A word representation like, for example, word2vec or GloVe. word_distribution: A float tensor of shape [vocab_size... | stack_v2_sparse_classes_36k_train_028558 | 29,814 | no_license | [
{
"docstring": "Arguments: word_vectors: A float tensor of shape [vocab_size, embedding_dim]. A word representation like, for example, word2vec or GloVe. word_distribution: A float tensor of shape [vocab_size]. A distribution from which to sample negative words. num_sampled: An integer, number of negative words... | 2 | stack_v2_sparse_classes_30k_train_020084 | Implement the Python class `negative_sampling_loss` described below.
Class description:
Implement the negative_sampling_loss class.
Method signatures and docstrings:
- def __init__(self, word_vectors, word_distribution, num_sampled=10): Arguments: word_vectors: A float tensor of shape [vocab_size, embedding_dim]. A w... | Implement the Python class `negative_sampling_loss` described below.
Class description:
Implement the negative_sampling_loss class.
Method signatures and docstrings:
- def __init__(self, word_vectors, word_distribution, num_sampled=10): Arguments: word_vectors: A float tensor of shape [vocab_size, embedding_dim]. A w... | 82d3e9808073f2145b039ccf464c526cb85274e3 | <|skeleton|>
class negative_sampling_loss:
def __init__(self, word_vectors, word_distribution, num_sampled=10):
"""Arguments: word_vectors: A float tensor of shape [vocab_size, embedding_dim]. A word representation like, for example, word2vec or GloVe. word_distribution: A float tensor of shape [vocab_size... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class negative_sampling_loss:
def __init__(self, word_vectors, word_distribution, num_sampled=10):
"""Arguments: word_vectors: A float tensor of shape [vocab_size, embedding_dim]. A word representation like, for example, word2vec or GloVe. word_distribution: A float tensor of shape [vocab_size]. A distribut... | the_stack_v2_python_sparse | business/p201908/3507_750/lda2vec_model.py | Alvin2580du/alvin_py | train | 12 | |
5473d69b00d576216f7ca798c5422fe37fbba348 | [
"expr = create_expression.create_expression_from_prensor(prensor_test_util.create_deep_prensor())\nnew_root = depth_limit.limit_depth(expr, 1)\nself.assertIsNone(new_root.get_descendant(path.Path(['event', 'doc', 'bar'])))\nself.assertIsNone(new_root.get_descendant(path.Path(['event', 'doc', 'keep_me'])))\nself.ass... | <|body_start_0|>
expr = create_expression.create_expression_from_prensor(prensor_test_util.create_deep_prensor())
new_root = depth_limit.limit_depth(expr, 1)
self.assertIsNone(new_root.get_descendant(path.Path(['event', 'doc', 'bar'])))
self.assertIsNone(new_root.get_descendant(path.Path... | DepthLimitTest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DepthLimitTest:
def test_depth_limit_1(self):
"""Tests depth_limit with a limit of 1. Starting with a prensor expression representing: {foo:9, foorepeated:[9], user:[{friends:["a"]}], event:{doc:[{bar:["a"], keep_me:False}]}} {foo:8, foorepeated:[8,7], event:{doc:[{bar:["b","c"], keep_me... | stack_v2_sparse_classes_36k_train_028559 | 4,104 | permissive | [
{
"docstring": "Tests depth_limit with a limit of 1. Starting with a prensor expression representing: {foo:9, foorepeated:[9], user:[{friends:[\"a\"]}], event:{doc:[{bar:[\"a\"], keep_me:False}]}} {foo:8, foorepeated:[8,7], event:{doc:[{bar:[\"b\",\"c\"], keep_me:True},{bar:[\"d\"]}]}, user:[{friends:[\"b\", \"... | 2 | stack_v2_sparse_classes_30k_train_008625 | Implement the Python class `DepthLimitTest` described below.
Class description:
Implement the DepthLimitTest class.
Method signatures and docstrings:
- def test_depth_limit_1(self): Tests depth_limit with a limit of 1. Starting with a prensor expression representing: {foo:9, foorepeated:[9], user:[{friends:["a"]}], e... | Implement the Python class `DepthLimitTest` described below.
Class description:
Implement the DepthLimitTest class.
Method signatures and docstrings:
- def test_depth_limit_1(self): Tests depth_limit with a limit of 1. Starting with a prensor expression representing: {foo:9, foorepeated:[9], user:[{friends:["a"]}], e... | 86d8676ac295697853be8a194460e4d71de3990f | <|skeleton|>
class DepthLimitTest:
def test_depth_limit_1(self):
"""Tests depth_limit with a limit of 1. Starting with a prensor expression representing: {foo:9, foorepeated:[9], user:[{friends:["a"]}], event:{doc:[{bar:["a"], keep_me:False}]}} {foo:8, foorepeated:[8,7], event:{doc:[{bar:["b","c"], keep_me... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DepthLimitTest:
def test_depth_limit_1(self):
"""Tests depth_limit with a limit of 1. Starting with a prensor expression representing: {foo:9, foorepeated:[9], user:[{friends:["a"]}], event:{doc:[{bar:["a"], keep_me:False}]}} {foo:8, foorepeated:[8,7], event:{doc:[{bar:["b","c"], keep_me:True},{bar:["... | the_stack_v2_python_sparse | struct2tensor/expression_impl/depth_limit_test.py | google/struct2tensor | train | 36 | |
79c6fd96ee3fa40e17e393494783294e2869252f | [
"if not any(values.values()):\n values['ferc1_dbf_to_sqlite_settings'] = Ferc1DbfToSqliteSettings()\n values['ferc1_xbrl_to_sqlite_settings'] = Ferc1XbrlToSqliteSettings()\n values['ferc2_dbf_to_sqlite_settings'] = Ferc2DbfToSqliteSettings()\n values['ferc2_xbrl_to_sqlite_settings'] = Ferc2XbrlToSqliteS... | <|body_start_0|>
if not any(values.values()):
values['ferc1_dbf_to_sqlite_settings'] = Ferc1DbfToSqliteSettings()
values['ferc1_xbrl_to_sqlite_settings'] = Ferc1XbrlToSqliteSettings()
values['ferc2_dbf_to_sqlite_settings'] = Ferc2DbfToSqliteSettings()
values['ferc... | An immutable pydantic model to validate FERC XBRL to SQLite settings. Args: ferc1_dbf_to_sqlite_settings: Settings for converting FERC 1 DBF data to SQLite. ferc1_xbrl_to_sqlite_settings: Settings for converting FERC 1 XBRL data to SQLite. other_xbrl_forms: List of non-FERC1 forms to convert from XBRL to SQLite. | FercToSqliteSettings | [
"CC-BY-4.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FercToSqliteSettings:
"""An immutable pydantic model to validate FERC XBRL to SQLite settings. Args: ferc1_dbf_to_sqlite_settings: Settings for converting FERC 1 DBF data to SQLite. ferc1_xbrl_to_sqlite_settings: Settings for converting FERC 1 XBRL data to SQLite. other_xbrl_forms: List of non-FE... | stack_v2_sparse_classes_36k_train_028560 | 24,804 | permissive | [
{
"docstring": "If no datasets are specified default to all. Args: values (Dict[str, BaseModel]): dataset settings. Returns: values (Dict[str, BaseModel]): dataset settings.",
"name": "default_load_all",
"signature": "def default_load_all(cls, values)"
},
{
"docstring": "Return a list with all r... | 2 | stack_v2_sparse_classes_30k_train_009270 | Implement the Python class `FercToSqliteSettings` described below.
Class description:
An immutable pydantic model to validate FERC XBRL to SQLite settings. Args: ferc1_dbf_to_sqlite_settings: Settings for converting FERC 1 DBF data to SQLite. ferc1_xbrl_to_sqlite_settings: Settings for converting FERC 1 XBRL data to S... | Implement the Python class `FercToSqliteSettings` described below.
Class description:
An immutable pydantic model to validate FERC XBRL to SQLite settings. Args: ferc1_dbf_to_sqlite_settings: Settings for converting FERC 1 DBF data to SQLite. ferc1_xbrl_to_sqlite_settings: Settings for converting FERC 1 XBRL data to S... | 6afae8aade053408f23ac4332d5cbb438ab72dc6 | <|skeleton|>
class FercToSqliteSettings:
"""An immutable pydantic model to validate FERC XBRL to SQLite settings. Args: ferc1_dbf_to_sqlite_settings: Settings for converting FERC 1 DBF data to SQLite. ferc1_xbrl_to_sqlite_settings: Settings for converting FERC 1 XBRL data to SQLite. other_xbrl_forms: List of non-FE... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FercToSqliteSettings:
"""An immutable pydantic model to validate FERC XBRL to SQLite settings. Args: ferc1_dbf_to_sqlite_settings: Settings for converting FERC 1 DBF data to SQLite. ferc1_xbrl_to_sqlite_settings: Settings for converting FERC 1 XBRL data to SQLite. other_xbrl_forms: List of non-FERC1 forms to ... | the_stack_v2_python_sparse | src/pudl/settings.py | catalyst-cooperative/pudl | train | 382 |
79ed8238d113f9c2575bb2feb4cd71d47f65e4eb | [
"if not separator:\n separator = '.'\npath = source.split(separator)\nself.path = path[1:]\nsuper().__init__(source=path[0], **kwargs)",
"if not data:\n return (data, None)\nmydata = reduce(operator.getitem, self.path, data)\nreturn (mydata, None)"
] | <|body_start_0|>
if not separator:
separator = '.'
path = source.split(separator)
self.path = path[1:]
super().__init__(source=path[0], **kwargs)
<|end_body_0|>
<|body_start_1|>
if not data:
return (data, None)
mydata = reduce(operator.getitem, se... | # Item Getter Get items from a nested data structure In example, All of the Voyager's systems are down and B'Elana needs to access the `ships` data node. She only has her trusty PADD and She would specify: ```py data = {'ships': {'voyager': {'status': 'Bad Ass'}}} class primary_status = ItemGetter(fields.String(), sour... | ItemGetter | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ItemGetter:
"""# Item Getter Get items from a nested data structure In example, All of the Voyager's systems are down and B'Elana needs to access the `ships` data node. She only has her trusty PADD and She would specify: ```py data = {'ships': {'voyager': {'status': 'Bad Ass'}}} class primary_sta... | stack_v2_sparse_classes_36k_train_028561 | 35,152 | permissive | [
{
"docstring": "# Args - `obj` the object expected to be found at the provided source - `source`, the path to the key you want to tap into - `separator', the separator used to identify segments of the source path - `**kwargs`, to be passed to super",
"name": "__init__",
"signature": "def __init__(self, ... | 2 | stack_v2_sparse_classes_30k_train_014093 | Implement the Python class `ItemGetter` described below.
Class description:
# Item Getter Get items from a nested data structure In example, All of the Voyager's systems are down and B'Elana needs to access the `ships` data node. She only has her trusty PADD and She would specify: ```py data = {'ships': {'voyager': {'... | Implement the Python class `ItemGetter` described below.
Class description:
# Item Getter Get items from a nested data structure In example, All of the Voyager's systems are down and B'Elana needs to access the `ships` data node. She only has her trusty PADD and She would specify: ```py data = {'ships': {'voyager': {'... | 09d88c000e0f3d254f5e1875388ccf87cec4be7c | <|skeleton|>
class ItemGetter:
"""# Item Getter Get items from a nested data structure In example, All of the Voyager's systems are down and B'Elana needs to access the `ships` data node. She only has her trusty PADD and She would specify: ```py data = {'ships': {'voyager': {'status': 'Bad Ass'}}} class primary_sta... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ItemGetter:
"""# Item Getter Get items from a nested data structure In example, All of the Voyager's systems are down and B'Elana needs to access the `ships` data node. She only has her trusty PADD and She would specify: ```py data = {'ships': {'voyager': {'status': 'Bad Ass'}}} class primary_status = ItemGet... | the_stack_v2_python_sparse | appyratus/schema/fields/fields.py | gigaquads/appyratus | train | 1 |
9680a3db51fa62145d5b9823a41ba15568c1e153 | [
"self.masters = []\nfor machine_path in glob.glob(f'{ASSETS_DIR}/openshift/99_openshift-cluster-api_master-machines-*.yaml'):\n with open(machine_path) as f:\n self.masters.append(yaml.load(f, Loader=yaml.FullLoader))\nwith open(f'{ASSETS_DIR}/manifests/cluster-config.yaml') as f:\n cluster_config = ya... | <|body_start_0|>
self.masters = []
for machine_path in glob.glob(f'{ASSETS_DIR}/openshift/99_openshift-cluster-api_master-machines-*.yaml'):
with open(machine_path) as f:
self.masters.append(yaml.load(f, Loader=yaml.FullLoader))
with open(f'{ASSETS_DIR}/manifests/clus... | ConvertMachine | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConvertMachine:
def setUp(self):
"""Parse the Machines into a Python data structure."""
<|body_0|>
def test_flavor(self):
"""Assert that all machines take flavor from computeFlavor."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.masters = []
... | stack_v2_sparse_classes_36k_train_028562 | 2,668 | permissive | [
{
"docstring": "Parse the Machines into a Python data structure.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Assert that all machines take flavor from computeFlavor.",
"name": "test_flavor",
"signature": "def test_flavor(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_011815 | Implement the Python class `ConvertMachine` described below.
Class description:
Implement the ConvertMachine class.
Method signatures and docstrings:
- def setUp(self): Parse the Machines into a Python data structure.
- def test_flavor(self): Assert that all machines take flavor from computeFlavor. | Implement the Python class `ConvertMachine` described below.
Class description:
Implement the ConvertMachine class.
Method signatures and docstrings:
- def setUp(self): Parse the Machines into a Python data structure.
- def test_flavor(self): Assert that all machines take flavor from computeFlavor.
<|skeleton|>
clas... | d7f39ed4836c9f57ada762ec393943ba1b5ce451 | <|skeleton|>
class ConvertMachine:
def setUp(self):
"""Parse the Machines into a Python data structure."""
<|body_0|>
def test_flavor(self):
"""Assert that all machines take flavor from computeFlavor."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ConvertMachine:
def setUp(self):
"""Parse the Machines into a Python data structure."""
self.masters = []
for machine_path in glob.glob(f'{ASSETS_DIR}/openshift/99_openshift-cluster-api_master-machines-*.yaml'):
with open(machine_path) as f:
self.masters.app... | the_stack_v2_python_sparse | scripts/openstack/manifest-tests/convert/test_convert.py | openshift/installer | train | 1,541 | |
ea86b55d774aa45c7c4cfa23e8fb72c90c180625 | [
"sql = 'select * from' + library_name + ';'\nconn = pymysql.connect(host=test_data['host'], user=test_data['user'], password=test_data['password'], port=test_data['port'], db=db_name, charset=test_data['charset'])\ncur = conn.cursor()\ncur.execute(sql)\nresult = cur.fetchall()\nlogging.info(result)\nprint(len(resul... | <|body_start_0|>
sql = 'select * from' + library_name + ';'
conn = pymysql.connect(host=test_data['host'], user=test_data['user'], password=test_data['password'], port=test_data['port'], db=db_name, charset=test_data['charset'])
cur = conn.cursor()
cur.execute(sql)
result = cur.f... | Test_Db | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test_Db:
def _select(self, db_name, library_name):
"""测试环境查询"""
<|body_0|>
def select_room_data(self, report_date, hasLock='1'):
"""测试环境查询 :param report_date: 日期往前减多少天 :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
sql = 'select * from' + ... | stack_v2_sparse_classes_36k_train_028563 | 4,789 | no_license | [
{
"docstring": "测试环境查询",
"name": "_select",
"signature": "def _select(self, db_name, library_name)"
},
{
"docstring": "测试环境查询 :param report_date: 日期往前减多少天 :return:",
"name": "select_room_data",
"signature": "def select_room_data(self, report_date, hasLock='1')"
}
] | 2 | null | Implement the Python class `Test_Db` described below.
Class description:
Implement the Test_Db class.
Method signatures and docstrings:
- def _select(self, db_name, library_name): 测试环境查询
- def select_room_data(self, report_date, hasLock='1'): 测试环境查询 :param report_date: 日期往前减多少天 :return: | Implement the Python class `Test_Db` described below.
Class description:
Implement the Test_Db class.
Method signatures and docstrings:
- def _select(self, db_name, library_name): 测试环境查询
- def select_room_data(self, report_date, hasLock='1'): 测试环境查询 :param report_date: 日期往前减多少天 :return:
<|skeleton|>
class Test_Db:
... | e173d4e535ac22b72b67371b8a2524ee425cdcbf | <|skeleton|>
class Test_Db:
def _select(self, db_name, library_name):
"""测试环境查询"""
<|body_0|>
def select_room_data(self, report_date, hasLock='1'):
"""测试环境查询 :param report_date: 日期往前减多少天 :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Test_Db:
def _select(self, db_name, library_name):
"""测试环境查询"""
sql = 'select * from' + library_name + ';'
conn = pymysql.connect(host=test_data['host'], user=test_data['user'], password=test_data['password'], port=test_data['port'], db=db_name, charset=test_data['charset'])
cu... | the_stack_v2_python_sparse | public/common/data_shuju.py | GSIL-Monitor/mrbao_python | train | 0 | |
b24607c000e916e6f6618946d56e6c255bb15044 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"conte... | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | Missing associated documentation comment in .proto file. | DualToRActiveServicer | [
"LicenseRef-scancode-generic-cla",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DualToRActiveServicer:
"""Missing associated documentation comment in .proto file."""
def QueryAdminForwardingPortState(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def SetAdminForwardingPortState(self, request, conte... | stack_v2_sparse_classes_36k_train_028564 | 12,711 | permissive | [
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "QueryAdminForwardingPortState",
"signature": "def QueryAdminForwardingPortState(self, request, context)"
},
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "SetAdminForwardi... | 6 | stack_v2_sparse_classes_30k_train_009207 | Implement the Python class `DualToRActiveServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def QueryAdminForwardingPortState(self, request, context): Missing associated documentation comment in .proto file.
- def SetAdminForwardi... | Implement the Python class `DualToRActiveServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def QueryAdminForwardingPortState(self, request, context): Missing associated documentation comment in .proto file.
- def SetAdminForwardi... | a86f0e5b1742d01b8d8a28a537f79bf608955695 | <|skeleton|>
class DualToRActiveServicer:
"""Missing associated documentation comment in .proto file."""
def QueryAdminForwardingPortState(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def SetAdminForwardingPortState(self, request, conte... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DualToRActiveServicer:
"""Missing associated documentation comment in .proto file."""
def QueryAdminForwardingPortState(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Meth... | the_stack_v2_python_sparse | ansible/dualtor/nic_simulator/nic_simulator_grpc_service_pb2_grpc.py | ramakristipati/sonic-mgmt | train | 2 |
4da3851e910ee2dc8404374f526979f517b2e85a | [
"self.url = url\nself.secret = secret\nself.delivery_logging = delivery_logging\nself.additional_properties = additional_properties",
"if dictionary is None:\n return None\nurl = dictionary.get('url')\nsecret = dictionary.get('secret')\ndelivery_logging = dictionary.get('deliveryLogging')\nfor key in cls._name... | <|body_start_0|>
self.url = url
self.secret = secret
self.delivery_logging = delivery_logging
self.additional_properties = additional_properties
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
url = dictionary.get('url')
secret = di... | Implementation of the 'WebhookConfig' model. TODO: type model description here. Attributes: url (string): The URL to which the payloads will be delivered. secret (string): Optional secret used to compute a HMAC hex digest of the payload, which is passed with the HTTP request as an ``X-Idfy-Signature`` header. delivery_... | WebhookConfig | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WebhookConfig:
"""Implementation of the 'WebhookConfig' model. TODO: type model description here. Attributes: url (string): The URL to which the payloads will be delivered. secret (string): Optional secret used to compute a HMAC hex digest of the payload, which is passed with the HTTP request as ... | stack_v2_sparse_classes_36k_train_028565 | 2,510 | permissive | [
{
"docstring": "Constructor for the WebhookConfig class",
"name": "__init__",
"signature": "def __init__(self, url=None, secret=None, delivery_logging=None, additional_properties={})"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictiona... | 2 | null | Implement the Python class `WebhookConfig` described below.
Class description:
Implementation of the 'WebhookConfig' model. TODO: type model description here. Attributes: url (string): The URL to which the payloads will be delivered. secret (string): Optional secret used to compute a HMAC hex digest of the payload, wh... | Implement the Python class `WebhookConfig` described below.
Class description:
Implementation of the 'WebhookConfig' model. TODO: type model description here. Attributes: url (string): The URL to which the payloads will be delivered. secret (string): Optional secret used to compute a HMAC hex digest of the payload, wh... | fa3918a6c54ea0eedb9146578645b7eb1755b642 | <|skeleton|>
class WebhookConfig:
"""Implementation of the 'WebhookConfig' model. TODO: type model description here. Attributes: url (string): The URL to which the payloads will be delivered. secret (string): Optional secret used to compute a HMAC hex digest of the payload, which is passed with the HTTP request as ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WebhookConfig:
"""Implementation of the 'WebhookConfig' model. TODO: type model description here. Attributes: url (string): The URL to which the payloads will be delivered. secret (string): Optional secret used to compute a HMAC hex digest of the payload, which is passed with the HTTP request as an ``X-Idfy-S... | the_stack_v2_python_sparse | idfy_rest_client/models/webhook_config.py | dealflowteam/Idfy | train | 0 |
618ec32b5041c08f9926a5395ad165d24a2b52a4 | [
"this_server = TangoServerHelper.get_instance()\nif event.err:\n log_msg = f'{const.ERR_INVOKING_CMD}{event.cmd_name}\\n{event.errors}'\n self.logger.error(log_msg)\n this_server.write_attr('activityMessage', log_msg, False)\nelse:\n log_msg = f'{const.STR_COMMAND}{event.cmd_name}{const.STR_INVOKE_SUCCE... | <|body_start_0|>
this_server = TangoServerHelper.get_instance()
if event.err:
log_msg = f'{const.ERR_INVOKING_CMD}{event.cmd_name}\n{event.errors}'
self.logger.error(log_msg)
this_server.write_attr('activityMessage', log_msg, False)
else:
log_msg =... | A class for CspMasterLeafNode's TelescopeOff() command. TelescopeOff command is inherited from BaseCommand. It Sets the State to Off. | TelescopeOff | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TelescopeOff:
"""A class for CspMasterLeafNode's TelescopeOff() command. TelescopeOff command is inherited from BaseCommand. It Sets the State to Off."""
def telescope_off_cmd_ended_cb(self, event):
"""Callback function immediately executed when the asynchronous invoked command retur... | stack_v2_sparse_classes_36k_train_028566 | 3,422 | permissive | [
{
"docstring": "Callback function immediately executed when the asynchronous invoked command returns. Checks whether the TelescopeOff command has been successfully invoked on SDP Master. :param event: a CmdDoneEvent object. This class is used to pass data to the callback method in asynchronous callback model fo... | 2 | null | Implement the Python class `TelescopeOff` described below.
Class description:
A class for CspMasterLeafNode's TelescopeOff() command. TelescopeOff command is inherited from BaseCommand. It Sets the State to Off.
Method signatures and docstrings:
- def telescope_off_cmd_ended_cb(self, event): Callback function immedia... | Implement the Python class `TelescopeOff` described below.
Class description:
A class for CspMasterLeafNode's TelescopeOff() command. TelescopeOff command is inherited from BaseCommand. It Sets the State to Off.
Method signatures and docstrings:
- def telescope_off_cmd_ended_cb(self, event): Callback function immedia... | 7ee65a9c8dada9b28893144b372a398bd0646195 | <|skeleton|>
class TelescopeOff:
"""A class for CspMasterLeafNode's TelescopeOff() command. TelescopeOff command is inherited from BaseCommand. It Sets the State to Off."""
def telescope_off_cmd_ended_cb(self, event):
"""Callback function immediately executed when the asynchronous invoked command retur... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TelescopeOff:
"""A class for CspMasterLeafNode's TelescopeOff() command. TelescopeOff command is inherited from BaseCommand. It Sets the State to Off."""
def telescope_off_cmd_ended_cb(self, event):
"""Callback function immediately executed when the asynchronous invoked command returns. Checks wh... | the_stack_v2_python_sparse | temp_src/ska_tmc_cspmasterleafnode_mid/telescope_off_command.py | ska-telescope/tmc-prototype | train | 4 |
944b4dae257ba4a43bcf4b8ea855b66cb7077af0 | [
"self.screen_width = 1200\nself.screen_height = 800\nself.bg_color = (230, 230, 230)\nself.ship_limit = 3\nself.bullet_width = 3\nself.bullet_height = 15\nself.bullet_color = (60, 60, 60)\nself.bullets_allowed = 3\nself.fleet_drop_speed = 10\nself.speedup_scale = 1.1\nself.initialize_dynamic_settings()",
"self.sh... | <|body_start_0|>
self.screen_width = 1200
self.screen_height = 800
self.bg_color = (230, 230, 230)
self.ship_limit = 3
self.bullet_width = 3
self.bullet_height = 15
self.bullet_color = (60, 60, 60)
self.bullets_allowed = 3
self.fleet_drop_speed = 1... | 存储《外星人入侵》的所有设置的类 | Settings | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Settings:
"""存储《外星人入侵》的所有设置的类"""
def __init__(self):
"""初始化游戏的静态设置"""
<|body_0|>
def initialize_dynamic_settings(self):
"""初始化随游戏进行而变化的设置"""
<|body_1|>
def increase_speed(self):
"""提高速度设置"""
<|body_2|>
<|end_skeleton|>
<|body_start_... | stack_v2_sparse_classes_36k_train_028567 | 1,010 | no_license | [
{
"docstring": "初始化游戏的静态设置",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "初始化随游戏进行而变化的设置",
"name": "initialize_dynamic_settings",
"signature": "def initialize_dynamic_settings(self)"
},
{
"docstring": "提高速度设置",
"name": "increase_speed",
"signat... | 3 | null | Implement the Python class `Settings` described below.
Class description:
存储《外星人入侵》的所有设置的类
Method signatures and docstrings:
- def __init__(self): 初始化游戏的静态设置
- def initialize_dynamic_settings(self): 初始化随游戏进行而变化的设置
- def increase_speed(self): 提高速度设置 | Implement the Python class `Settings` described below.
Class description:
存储《外星人入侵》的所有设置的类
Method signatures and docstrings:
- def __init__(self): 初始化游戏的静态设置
- def initialize_dynamic_settings(self): 初始化随游戏进行而变化的设置
- def increase_speed(self): 提高速度设置
<|skeleton|>
class Settings:
"""存储《外星人入侵》的所有设置的类"""
def __i... | e30e4316c040d6af4af486b46fccb581bdc83ce9 | <|skeleton|>
class Settings:
"""存储《外星人入侵》的所有设置的类"""
def __init__(self):
"""初始化游戏的静态设置"""
<|body_0|>
def initialize_dynamic_settings(self):
"""初始化随游戏进行而变化的设置"""
<|body_1|>
def increase_speed(self):
"""提高速度设置"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Settings:
"""存储《外星人入侵》的所有设置的类"""
def __init__(self):
"""初始化游戏的静态设置"""
self.screen_width = 1200
self.screen_height = 800
self.bg_color = (230, 230, 230)
self.ship_limit = 3
self.bullet_width = 3
self.bullet_height = 15
self.bullet_color = (60... | the_stack_v2_python_sparse | basic/alien_invasion/settings.py | zhudingsuifeng/python | train | 0 |
e915b63d9cbecf2d79f0eee2cb37c09b9827f927 | [
"self.alert_category = alert_category\nself.alert_code = alert_code\nself.alert_document = alert_document\nself.alert_state = alert_state\nself.alert_type = alert_type\nself.alert_type_bucket = alert_type_bucket\nself.cluster_id = cluster_id\nself.cluster_name = cluster_name\nself.dedup_count = dedup_count\nself.de... | <|body_start_0|>
self.alert_category = alert_category
self.alert_code = alert_code
self.alert_document = alert_document
self.alert_state = alert_state
self.alert_type = alert_type
self.alert_type_bucket = alert_type_bucket
self.cluster_id = cluster_id
self... | Implementation of the 'Alert' model. Specifies information about an Alert such as the type, id assigned by the Cohesity Cluster, number of duplicates, severity, etc. Attributes: alert_category (AlertCategoryEnum): Specifies the category of an Alert. kDisk - Alert associated with the disk. kNode - Alert associated with ... | Alert | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Alert:
"""Implementation of the 'Alert' model. Specifies information about an Alert such as the type, id assigned by the Cohesity Cluster, number of duplicates, severity, etc. Attributes: alert_category (AlertCategoryEnum): Specifies the category of an Alert. kDisk - Alert associated with the dis... | stack_v2_sparse_classes_36k_train_028568 | 12,597 | permissive | [
{
"docstring": "Constructor for the Alert class",
"name": "__init__",
"signature": "def __init__(self, alert_category=None, alert_code=None, alert_document=None, alert_state=None, alert_type=None, alert_type_bucket=None, cluster_id=None, cluster_name=None, dedup_count=None, dedup_timestamps=None, event_... | 2 | stack_v2_sparse_classes_30k_train_004190 | Implement the Python class `Alert` described below.
Class description:
Implementation of the 'Alert' model. Specifies information about an Alert such as the type, id assigned by the Cohesity Cluster, number of duplicates, severity, etc. Attributes: alert_category (AlertCategoryEnum): Specifies the category of an Alert... | Implement the Python class `Alert` described below.
Class description:
Implementation of the 'Alert' model. Specifies information about an Alert such as the type, id assigned by the Cohesity Cluster, number of duplicates, severity, etc. Attributes: alert_category (AlertCategoryEnum): Specifies the category of an Alert... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class Alert:
"""Implementation of the 'Alert' model. Specifies information about an Alert such as the type, id assigned by the Cohesity Cluster, number of duplicates, severity, etc. Attributes: alert_category (AlertCategoryEnum): Specifies the category of an Alert. kDisk - Alert associated with the dis... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Alert:
"""Implementation of the 'Alert' model. Specifies information about an Alert such as the type, id assigned by the Cohesity Cluster, number of duplicates, severity, etc. Attributes: alert_category (AlertCategoryEnum): Specifies the category of an Alert. kDisk - Alert associated with the disk. kNode - Al... | the_stack_v2_python_sparse | cohesity_management_sdk/models/alert.py | cohesity/management-sdk-python | train | 24 |
8fed59678ddeabe8b7060bdccc4745817cd442ab | [
"if random_seed is not None:\n self.random_generator = random.Random(random_seed)\nelse:\n self.random_generator = random.Random()\nsuper().__init__(expression_data=expression_data, calculator=calculator, rm_outliers=rm_outliers)",
"n_genes = self.expression_data.n_points\npairs = self.get_random_pairs(n_pa... | <|body_start_0|>
if random_seed is not None:
self.random_generator = random.Random(random_seed)
else:
self.random_generator = random.Random()
super().__init__(expression_data=expression_data, calculator=calculator, rm_outliers=rm_outliers)
<|end_body_0|>
<|body_start_1|>... | Navigate similarity calculation between random points. | RandomSimilarityCalculatorNavigator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandomSimilarityCalculatorNavigator:
"""Navigate similarity calculation between random points."""
def __init__(self, expression_data: GeneExpression, calculator: SimilarityCalculator, random_seed: int=None, rm_outliers: bool=True):
""":param expression_data: Data for all genes :param... | stack_v2_sparse_classes_36k_train_028569 | 43,977 | no_license | [
{
"docstring": ":param expression_data: Data for all genes :param calculator: SimilarityCalculator used for all calculations :param random_seed: seed to be used for random number generator, used to determine which pairs will be used for distance calculations None sets the default random library seed :param rm_o... | 4 | stack_v2_sparse_classes_30k_train_001447 | Implement the Python class `RandomSimilarityCalculatorNavigator` described below.
Class description:
Navigate similarity calculation between random points.
Method signatures and docstrings:
- def __init__(self, expression_data: GeneExpression, calculator: SimilarityCalculator, random_seed: int=None, rm_outliers: bool... | Implement the Python class `RandomSimilarityCalculatorNavigator` described below.
Class description:
Navigate similarity calculation between random points.
Method signatures and docstrings:
- def __init__(self, expression_data: GeneExpression, calculator: SimilarityCalculator, random_seed: int=None, rm_outliers: bool... | 6d11df5e8ca37e53e048d261ac287f859ba6e9b9 | <|skeleton|>
class RandomSimilarityCalculatorNavigator:
"""Navigate similarity calculation between random points."""
def __init__(self, expression_data: GeneExpression, calculator: SimilarityCalculator, random_seed: int=None, rm_outliers: bool=True):
""":param expression_data: Data for all genes :param... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RandomSimilarityCalculatorNavigator:
"""Navigate similarity calculation between random points."""
def __init__(self, expression_data: GeneExpression, calculator: SimilarityCalculator, random_seed: int=None, rm_outliers: bool=True):
""":param expression_data: Data for all genes :param calculator: ... | the_stack_v2_python_sparse | correlation_enrichment/library_correlation_enrichment.py | biolab/baylor-dicty | train | 0 |
40faa1699441d00aed7ab9a78cfa9dbb6a93cb2b | [
"super().__init__(CashAmount, name)\nself.generator = generator\nif self.generator:\n self.buyin = generator.buyin\n for rank, value in self.generator.get_prize_list():\n self.add(rank, value)",
"if not self.generator:\n return None\nelse:\n return self.generator.get_generator_settings_instance... | <|body_start_0|>
super().__init__(CashAmount, name)
self.generator = generator
if self.generator:
self.buyin = generator.buyin
for rank, value in self.generator.get_prize_list():
self.add(rank, value)
<|end_body_0|>
<|body_start_1|>
if not self.ge... | Used to create a prize structure (with a prize.classes.Generator) for cash. | CashPrizeStructureCreator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CashPrizeStructureCreator:
"""Used to create a prize structure (with a prize.classes.Generator) for cash."""
def __init__(self, generator=None, name=''):
"""Create a cash PrizeStructure given a prize.classes.Generator instance which contains the list of payouts and some seed values f... | stack_v2_sparse_classes_36k_train_028570 | 23,197 | no_license | [
{
"docstring": "Create a cash PrizeStructure given a prize.classes.Generator instance which contains the list of payouts and some seed values from which the list of prizes was created. :param generator: :param name: :return:",
"name": "__init__",
"signature": "def __init__(self, generator=None, name='')... | 5 | null | Implement the Python class `CashPrizeStructureCreator` described below.
Class description:
Used to create a prize structure (with a prize.classes.Generator) for cash.
Method signatures and docstrings:
- def __init__(self, generator=None, name=''): Create a cash PrizeStructure given a prize.classes.Generator instance ... | Implement the Python class `CashPrizeStructureCreator` described below.
Class description:
Used to create a prize structure (with a prize.classes.Generator) for cash.
Method signatures and docstrings:
- def __init__(self, generator=None, name=''): Create a cash PrizeStructure given a prize.classes.Generator instance ... | 4796fa9d88b56f80def011e2b043ce595bfce8c4 | <|skeleton|>
class CashPrizeStructureCreator:
"""Used to create a prize structure (with a prize.classes.Generator) for cash."""
def __init__(self, generator=None, name=''):
"""Create a cash PrizeStructure given a prize.classes.Generator instance which contains the list of payouts and some seed values f... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CashPrizeStructureCreator:
"""Used to create a prize structure (with a prize.classes.Generator) for cash."""
def __init__(self, generator=None, name=''):
"""Create a cash PrizeStructure given a prize.classes.Generator instance which contains the list of payouts and some seed values from which the... | the_stack_v2_python_sparse | prize/classes.py | nakamotohideyoshi/draftboard-web | train | 0 |
200b05aa66d88b8b086c7a08941636dcf167c7c4 | [
"if data and data.content_type not in settings.IMAGE_ALLOWED_MIME_TYPES:\n raise forms.ValidationError(self.error_messages['invalid_image'])\ntry:\n return super(RestrictedImageFormField, self).to_python(data)\nexcept ValidationError:\n test_file = super(sorl.thumbnail.fields.ImageFormField, self).to_pytho... | <|body_start_0|>
if data and data.content_type not in settings.IMAGE_ALLOWED_MIME_TYPES:
raise forms.ValidationError(self.error_messages['invalid_image'])
try:
return super(RestrictedImageFormField, self).to_python(data)
except ValidationError:
test_file = sup... | Actual FormField that does the validation of the mime-types. | RestrictedImageFormField | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RestrictedImageFormField:
"""Actual FormField that does the validation of the mime-types."""
def to_python(self, data):
"""Checks that the file-upload field data contains a valid image (GIF, JPG, PNG, possibly others -- whatever the engine supports). If the item cannot be converted t... | stack_v2_sparse_classes_36k_train_028571 | 6,062 | permissive | [
{
"docstring": "Checks that the file-upload field data contains a valid image (GIF, JPG, PNG, possibly others -- whatever the engine supports). If the item cannot be converted to an image, check if the file is and svg",
"name": "to_python",
"signature": "def to_python(self, data)"
},
{
"docstrin... | 2 | null | Implement the Python class `RestrictedImageFormField` described below.
Class description:
Actual FormField that does the validation of the mime-types.
Method signatures and docstrings:
- def to_python(self, data): Checks that the file-upload field data contains a valid image (GIF, JPG, PNG, possibly others -- whateve... | Implement the Python class `RestrictedImageFormField` described below.
Class description:
Actual FormField that does the validation of the mime-types.
Method signatures and docstrings:
- def to_python(self, data): Checks that the file-upload field data contains a valid image (GIF, JPG, PNG, possibly others -- whateve... | 49d92b5deb289c1539f99122abc20f845577b879 | <|skeleton|>
class RestrictedImageFormField:
"""Actual FormField that does the validation of the mime-types."""
def to_python(self, data):
"""Checks that the file-upload field data contains a valid image (GIF, JPG, PNG, possibly others -- whatever the engine supports). If the item cannot be converted t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RestrictedImageFormField:
"""Actual FormField that does the validation of the mime-types."""
def to_python(self, data):
"""Checks that the file-upload field data contains a valid image (GIF, JPG, PNG, possibly others -- whatever the engine supports). If the item cannot be converted to an image, c... | the_stack_v2_python_sparse | bluebottle/utils/fields.py | raux/bluebottle | train | 0 |
20bfbb8ce46abcacffd5f9d200fe880aa1807102 | [
"if len(s) <= 1:\n return len(s)\nn = len(s)\ns1 = s\ns2 = ''.join(list(s)[::-1])\ndp = [[0 for _ in range(n + 1)] for _ in range(n + 1)]\nfor i in range(1, n + 1):\n for j in range(1, n + 1):\n if s1[i - 1] == s2[j - 1]:\n dp[i][j] = dp[i - 1][j - 1] + 1\n else:\n dp[i][j]... | <|body_start_0|>
if len(s) <= 1:
return len(s)
n = len(s)
s1 = s
s2 = ''.join(list(s)[::-1])
dp = [[0 for _ in range(n + 1)] for _ in range(n + 1)]
for i in range(1, n + 1):
for j in range(1, n + 1):
if s1[i - 1] == s2[j - 1]:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def longestPalindromeSubseq0(self, s):
""":type s: str :rtype: int 解法:求s和s反转后的字符串的最长公共子序列"""
<|body_0|>
def longestPalindromeSubseq(self, s):
""":type s: str :rtype: int 解法:dp, 直接求最长回文子序列的长度,dp[i][j]表示s[i:j]的最长回文子序列的长度"""
<|body_1|>
<|end_skeleton|... | stack_v2_sparse_classes_36k_train_028572 | 1,566 | no_license | [
{
"docstring": ":type s: str :rtype: int 解法:求s和s反转后的字符串的最长公共子序列",
"name": "longestPalindromeSubseq0",
"signature": "def longestPalindromeSubseq0(self, s)"
},
{
"docstring": ":type s: str :rtype: int 解法:dp, 直接求最长回文子序列的长度,dp[i][j]表示s[i:j]的最长回文子序列的长度",
"name": "longestPalindromeSubseq",
"si... | 2 | stack_v2_sparse_classes_30k_train_008532 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestPalindromeSubseq0(self, s): :type s: str :rtype: int 解法:求s和s反转后的字符串的最长公共子序列
- def longestPalindromeSubseq(self, s): :type s: str :rtype: int 解法:dp, 直接求最长回文子序列的长度,dp[i]... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestPalindromeSubseq0(self, s): :type s: str :rtype: int 解法:求s和s反转后的字符串的最长公共子序列
- def longestPalindromeSubseq(self, s): :type s: str :rtype: int 解法:dp, 直接求最长回文子序列的长度,dp[i]... | 6e18c5d257840489cc3fb1079ae3804c743982a4 | <|skeleton|>
class Solution:
def longestPalindromeSubseq0(self, s):
""":type s: str :rtype: int 解法:求s和s反转后的字符串的最长公共子序列"""
<|body_0|>
def longestPalindromeSubseq(self, s):
""":type s: str :rtype: int 解法:dp, 直接求最长回文子序列的长度,dp[i][j]表示s[i:j]的最长回文子序列的长度"""
<|body_1|>
<|end_skeleton|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def longestPalindromeSubseq0(self, s):
""":type s: str :rtype: int 解法:求s和s反转后的字符串的最长公共子序列"""
if len(s) <= 1:
return len(s)
n = len(s)
s1 = s
s2 = ''.join(list(s)[::-1])
dp = [[0 for _ in range(n + 1)] for _ in range(n + 1)]
for i in... | the_stack_v2_python_sparse | 516.最长回文子序列.py | yangyuxiang1996/leetcode | train | 0 | |
12d3e8d3bc847d62d42bea392d6a722bf9834b23 | [
"self.batch_url = batch_url\nself.compute = compute\nself.http = http\nself.project = project\nself.resources = resources\nself.resource_type = None",
"http = context['http']\ncompute_utils.UpdateContextEndpointEntries(context, http)\nbatch_url = context['batch-url']\ncompute = context['compute']\nresources = con... | <|body_start_0|>
self.batch_url = batch_url
self.compute = compute
self.http = http
self.project = project
self.resources = resources
self.resource_type = None
<|end_body_0|>
<|body_start_1|>
http = context['http']
compute_utils.UpdateContextEndpointEntri... | Helper that uses compute component logic to build GceConfiguration. | ConfigurationHelper | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConfigurationHelper:
"""Helper that uses compute component logic to build GceConfiguration."""
def __init__(self, batch_url, compute, http, project, resources):
"""Sets fields expected by ScopePrompter."""
<|body_0|>
def FromContext(cls, context):
"""Updates requ... | stack_v2_sparse_classes_36k_train_028573 | 3,978 | permissive | [
{
"docstring": "Sets fields expected by ScopePrompter.",
"name": "__init__",
"signature": "def __init__(self, batch_url, compute, http, project, resources)"
},
{
"docstring": "Updates required global state and constructs ConfigurationHelper.",
"name": "FromContext",
"signature": "def Fro... | 5 | stack_v2_sparse_classes_30k_train_004646 | Implement the Python class `ConfigurationHelper` described below.
Class description:
Helper that uses compute component logic to build GceConfiguration.
Method signatures and docstrings:
- def __init__(self, batch_url, compute, http, project, resources): Sets fields expected by ScopePrompter.
- def FromContext(cls, c... | Implement the Python class `ConfigurationHelper` described below.
Class description:
Helper that uses compute component logic to build GceConfiguration.
Method signatures and docstrings:
- def __init__(self, batch_url, compute, http, project, resources): Sets fields expected by ScopePrompter.
- def FromContext(cls, c... | 1f9b424c40a87b46656fc9f5e2e9c81895c7e614 | <|skeleton|>
class ConfigurationHelper:
"""Helper that uses compute component logic to build GceConfiguration."""
def __init__(self, batch_url, compute, http, project, resources):
"""Sets fields expected by ScopePrompter."""
<|body_0|>
def FromContext(cls, context):
"""Updates requ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ConfigurationHelper:
"""Helper that uses compute component logic to build GceConfiguration."""
def __init__(self, batch_url, compute, http, project, resources):
"""Sets fields expected by ScopePrompter."""
self.batch_url = batch_url
self.compute = compute
self.http = http
... | the_stack_v2_python_sparse | google-cloud-sdk/lib/googlecloudsdk/dataproc/lib/compute_helpers.py | twistedpair/google-cloud-sdk | train | 58 |
f0bdb5c89ea3cac0fd7c792e4187c8565164e69f | [
"v1, v2 = edge\nif self.has_vertex(v1) and self.has_vertex(v2):\n self.matrix[v1][v2] = weight\nelse:\n raise Exception('Vertices of the edge must be contained in the graph')",
"if self.has_edge(edge):\n v1, v2 = edge\n self.matrix[v1][v2] = None\nelse:\n raise Exception('Edge must be contained in ... | <|body_start_0|>
v1, v2 = edge
if self.has_vertex(v1) and self.has_vertex(v2):
self.matrix[v1][v2] = weight
else:
raise Exception('Vertices of the edge must be contained in the graph')
<|end_body_0|>
<|body_start_1|>
if self.has_edge(edge):
v1, v2 = e... | OrientedIncidenceMatrixGraph | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OrientedIncidenceMatrixGraph:
def insert_edge(self, edge, weight):
"""Add an edge between specified vertices Args: edge (list): list of 2 vertex indices to connect weight (int): Weight of the edge added Raises: Exception: edge contains indices of vertices not present in the graph Example... | stack_v2_sparse_classes_36k_train_028574 | 1,265 | no_license | [
{
"docstring": "Add an edge between specified vertices Args: edge (list): list of 2 vertex indices to connect weight (int): Weight of the edge added Raises: Exception: edge contains indices of vertices not present in the graph Example: graph.insert_edge([0, 3], 5) - connects vertices 0 and 3 with an edge of wei... | 2 | stack_v2_sparse_classes_30k_train_014186 | Implement the Python class `OrientedIncidenceMatrixGraph` described below.
Class description:
Implement the OrientedIncidenceMatrixGraph class.
Method signatures and docstrings:
- def insert_edge(self, edge, weight): Add an edge between specified vertices Args: edge (list): list of 2 vertex indices to connect weight ... | Implement the Python class `OrientedIncidenceMatrixGraph` described below.
Class description:
Implement the OrientedIncidenceMatrixGraph class.
Method signatures and docstrings:
- def insert_edge(self, edge, weight): Add an edge between specified vertices Args: edge (list): list of 2 vertex indices to connect weight ... | 6fdc5b93e9ceca17fc3ad522ed7243e51709d7ec | <|skeleton|>
class OrientedIncidenceMatrixGraph:
def insert_edge(self, edge, weight):
"""Add an edge between specified vertices Args: edge (list): list of 2 vertex indices to connect weight (int): Weight of the edge added Raises: Exception: edge contains indices of vertices not present in the graph Example... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OrientedIncidenceMatrixGraph:
def insert_edge(self, edge, weight):
"""Add an edge between specified vertices Args: edge (list): list of 2 vertex indices to connect weight (int): Weight of the edge added Raises: Exception: edge contains indices of vertices not present in the graph Example: graph.insert... | the_stack_v2_python_sparse | Lab6/graph/oriented_incidence_matrix_graph.py | DenisKruglik/Algorithms | train | 1 | |
384c1e4ab168a99a18f0b085a862290f1c710908 | [
"try:\n detail_html = source.pop('bbd_html', '')\n detail_url = source.get('bbd_url', '')\n self.logger.info('开始解析:{} {}'.format(self.parser_info, detail_url))\n json_data = json.loads(detail_html)\n data_content = json_data['data']['dataContentJson']\n data_func = self.get_value(json_data['data']... | <|body_start_0|>
try:
detail_html = source.pop('bbd_html', '')
detail_url = source.get('bbd_url', '')
self.logger.info('开始解析:{} {}'.format(self.parser_info, detail_url))
json_data = json.loads(detail_html)
data_content = json_data['data']['dataContentJ... | class Parser__qyxg_xzcf__credit_fengjie for 信用奉节-行政处罚 解析 | Parser__qyxg_xzcf__credit_fengjie | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Parser__qyxg_xzcf__credit_fengjie:
"""class Parser__qyxg_xzcf__credit_fengjie for 信用奉节-行政处罚 解析"""
def parse(self, source, *args, **kwargs):
"""parse logic :Keyword Arguments: self -- source -- *args -- **kwargs -- :return: None"""
<|body_0|>
def get_value(self, json_dict... | stack_v2_sparse_classes_36k_train_028575 | 3,592 | no_license | [
{
"docstring": "parse logic :Keyword Arguments: self -- source -- *args -- **kwargs -- :return: None",
"name": "parse",
"signature": "def parse(self, source, *args, **kwargs)"
},
{
"docstring": ":Keyword Arguments: self -- json_dict -- :return: None",
"name": "get_value",
"signature": "d... | 2 | null | Implement the Python class `Parser__qyxg_xzcf__credit_fengjie` described below.
Class description:
class Parser__qyxg_xzcf__credit_fengjie for 信用奉节-行政处罚 解析
Method signatures and docstrings:
- def parse(self, source, *args, **kwargs): parse logic :Keyword Arguments: self -- source -- *args -- **kwargs -- :return: None... | Implement the Python class `Parser__qyxg_xzcf__credit_fengjie` described below.
Class description:
class Parser__qyxg_xzcf__credit_fengjie for 信用奉节-行政处罚 解析
Method signatures and docstrings:
- def parse(self, source, *args, **kwargs): parse logic :Keyword Arguments: self -- source -- *args -- **kwargs -- :return: None... | 991902517a94e26fbe6378610d3cd12ff4a5c1f7 | <|skeleton|>
class Parser__qyxg_xzcf__credit_fengjie:
"""class Parser__qyxg_xzcf__credit_fengjie for 信用奉节-行政处罚 解析"""
def parse(self, source, *args, **kwargs):
"""parse logic :Keyword Arguments: self -- source -- *args -- **kwargs -- :return: None"""
<|body_0|>
def get_value(self, json_dict... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Parser__qyxg_xzcf__credit_fengjie:
"""class Parser__qyxg_xzcf__credit_fengjie for 信用奉节-行政处罚 解析"""
def parse(self, source, *args, **kwargs):
"""parse logic :Keyword Arguments: self -- source -- *args -- **kwargs -- :return: None"""
try:
detail_html = source.pop('bbd_html', '')
... | the_stack_v2_python_sparse | parse/qyxg_xzcf/Parser__qyxg_xzcf__credit_fengjie.py | ZhouForrest/Spider | train | 0 |
96d3925cd398a298c3585a6eae90bd6e490f76bc | [
"super(FunctionComponent, self).__init__(opts)\nself.options = opts.get('fn_hibp', {})\nself.hibp = Hibp(self.options)",
"try:\n yield StatusMessage('starting...')\n result_payload = ResultPayload('hibp', **kwargs)\n log = logging.getLogger(__name__)\n email_address = kwargs.get('email_address')\n ... | <|body_start_0|>
super(FunctionComponent, self).__init__(opts)
self.options = opts.get('fn_hibp', {})
self.hibp = Hibp(self.options)
<|end_body_0|>
<|body_start_1|>
try:
yield StatusMessage('starting...')
result_payload = ResultPayload('hibp', **kwargs)
... | Component that implements Resilient function 'have_i_been_pwned_get_pastes | FunctionComponent | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FunctionComponent:
"""Component that implements Resilient function 'have_i_been_pwned_get_pastes"""
def __init__(self, opts):
"""constructor provides access to the configuration options"""
<|body_0|>
def _have_i_been_pwned_get_pastes_function(self, event, *args, **kwargs... | stack_v2_sparse_classes_36k_train_028576 | 2,077 | permissive | [
{
"docstring": "constructor provides access to the configuration options",
"name": "__init__",
"signature": "def __init__(self, opts)"
},
{
"docstring": "Function: Get all pastes of an email account from Have I Been Pwned.",
"name": "_have_i_been_pwned_get_pastes_function",
"signature": ... | 2 | null | Implement the Python class `FunctionComponent` described below.
Class description:
Component that implements Resilient function 'have_i_been_pwned_get_pastes
Method signatures and docstrings:
- def __init__(self, opts): constructor provides access to the configuration options
- def _have_i_been_pwned_get_pastes_funct... | Implement the Python class `FunctionComponent` described below.
Class description:
Component that implements Resilient function 'have_i_been_pwned_get_pastes
Method signatures and docstrings:
- def __init__(self, opts): constructor provides access to the configuration options
- def _have_i_been_pwned_get_pastes_funct... | 6878c78b94eeca407998a41ce8db2cc00f2b6758 | <|skeleton|>
class FunctionComponent:
"""Component that implements Resilient function 'have_i_been_pwned_get_pastes"""
def __init__(self, opts):
"""constructor provides access to the configuration options"""
<|body_0|>
def _have_i_been_pwned_get_pastes_function(self, event, *args, **kwargs... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FunctionComponent:
"""Component that implements Resilient function 'have_i_been_pwned_get_pastes"""
def __init__(self, opts):
"""constructor provides access to the configuration options"""
super(FunctionComponent, self).__init__(opts)
self.options = opts.get('fn_hibp', {})
... | the_stack_v2_python_sparse | fn_hibp/fn_hibp/components/have_i_been_pwned_get_pastes.py | ibmresilient/resilient-community-apps | train | 81 |
2e9fd050211c7e0d9ffa6160a971028a8cf8baa1 | [
"self.xd = kwargs['xd']\nself.skip_days = 0\nself.factor_name = '{}:{}'.format(self.__class__.__name__, self.xd)\nself.hit_ml = kwargs['hit_ml']",
"ump = self.ump_manger\ndeg_hit_cnt = ump.ump_main_deg.predict_hit_kwargs(**ml_feature_dict)\njump_hit_cnt = ump.ump_main_jump.predict_hit_kwargs(**ml_feature_dict)\nw... | <|body_start_0|>
self.xd = kwargs['xd']
self.skip_days = 0
self.factor_name = '{}:{}'.format(self.__class__.__name__, self.xd)
self.hit_ml = kwargs['hit_ml']
<|end_body_0|>
<|body_start_1|>
ump = self.ump_manger
deg_hit_cnt = ump.ump_main_deg.predict_hit_kwargs(**ml_feat... | 继续继承AbuFactorBuyBreak复写make_ump_block_decision, 区别是使用AbuFactorBuyBreakReocrdHitDemo的学习成果hit_ml 对几个裁判这次交易命中的分类簇个数组成矢量特征进行predict, 拦截预测结果为-1的交易 | AbuFactorBuyBreakHitPredictDemo | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AbuFactorBuyBreakHitPredictDemo:
"""继续继承AbuFactorBuyBreak复写make_ump_block_decision, 区别是使用AbuFactorBuyBreakReocrdHitDemo的学习成果hit_ml 对几个裁判这次交易命中的分类簇个数组成矢量特征进行predict, 拦截预测结果为-1的交易"""
def _init_self(self, **kwargs):
"""与AbuFactorBuyBreak基本相同,唯一区别是关键子参数中添加了通过AbuFactorBuyBreakUmpDemo记录训练好... | stack_v2_sparse_classes_36k_train_028577 | 9,900 | no_license | [
{
"docstring": "与AbuFactorBuyBreak基本相同,唯一区别是关键子参数中添加了通过AbuFactorBuyBreakUmpDemo记录训练好的决策器 self.hit_ml = kwargs['hit_ml']",
"name": "_init_self",
"signature": "def _init_self(self, **kwargs)"
},
{
"docstring": "用回测的数据进行训练后再次反过来指导回测,结果是没有意义的, 这里的示例只是为了容易理解什么叫做:让裁判自己学习怎么配合, 自己做出最正确的判断,更详细完整的示例会在之后的章... | 2 | stack_v2_sparse_classes_30k_train_010397 | Implement the Python class `AbuFactorBuyBreakHitPredictDemo` described below.
Class description:
继续继承AbuFactorBuyBreak复写make_ump_block_decision, 区别是使用AbuFactorBuyBreakReocrdHitDemo的学习成果hit_ml 对几个裁判这次交易命中的分类簇个数组成矢量特征进行predict, 拦截预测结果为-1的交易
Method signatures and docstrings:
- def _init_self(self, **kwargs): 与AbuFactorB... | Implement the Python class `AbuFactorBuyBreakHitPredictDemo` described below.
Class description:
继续继承AbuFactorBuyBreak复写make_ump_block_decision, 区别是使用AbuFactorBuyBreakReocrdHitDemo的学习成果hit_ml 对几个裁判这次交易命中的分类簇个数组成矢量特征进行predict, 拦截预测结果为-1的交易
Method signatures and docstrings:
- def _init_self(self, **kwargs): 与AbuFactorB... | f00a070626407afe87763a50c99241696a38df46 | <|skeleton|>
class AbuFactorBuyBreakHitPredictDemo:
"""继续继承AbuFactorBuyBreak复写make_ump_block_decision, 区别是使用AbuFactorBuyBreakReocrdHitDemo的学习成果hit_ml 对几个裁判这次交易命中的分类簇个数组成矢量特征进行predict, 拦截预测结果为-1的交易"""
def _init_self(self, **kwargs):
"""与AbuFactorBuyBreak基本相同,唯一区别是关键子参数中添加了通过AbuFactorBuyBreakUmpDemo记录训练好... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AbuFactorBuyBreakHitPredictDemo:
"""继续继承AbuFactorBuyBreak复写make_ump_block_decision, 区别是使用AbuFactorBuyBreakReocrdHitDemo的学习成果hit_ml 对几个裁判这次交易命中的分类簇个数组成矢量特征进行predict, 拦截预测结果为-1的交易"""
def _init_self(self, **kwargs):
"""与AbuFactorBuyBreak基本相同,唯一区别是关键子参数中添加了通过AbuFactorBuyBreakUmpDemo记录训练好的决策器 self.hit... | the_stack_v2_python_sparse | abupy/FactorBuyBu/ABuFactorBuyDemo.py | zly111/abu | train | 1 |
5b27f794883ed18b0c95360e6ea778cb50d750a2 | [
"if root is None:\n return ''\nq = deque()\nq.append(root)\nres = []\nwhile len(q) > 0:\n sz = len(q)\n for i in range(sz):\n cur = q.popleft()\n if cur is None:\n res.append('')\n else:\n res.append(str(cur.val))\n q.append(cur.left)\n q.app... | <|body_start_0|>
if root is None:
return ''
q = deque()
q.append(root)
res = []
while len(q) > 0:
sz = len(q)
for i in range(sz):
cur = q.popleft()
if cur is None:
res.append('')
... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_36k_train_028578 | 6,926 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | stack_v2_sparse_classes_30k_train_002937 | 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:... | 0821af55eca60084b503b5f751301048c55e4381 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
if root is None:
return ''
q = deque()
q.append(root)
res = []
while len(q) > 0:
sz = len(q)
for i in range(sz):
... | the_stack_v2_python_sparse | Hard/LC297.py | shuowenwei/LeetCodePython | train | 2 | |
32d3587dc126ae25fc211702f8d941c95f111010 | [
"if not root:\n return []\nq = deque()\nq.append(root)\nans = []\nwhile q:\n cur = q.popleft()\n if not cur:\n ans.append(None)\n continue\n ans.append(cur.val)\n q.append(cur.left)\n q.append(cur.right)\nreturn ans",
"if not data:\n return None\nroot = TreeNode(data.pop(0))\nq ... | <|body_start_0|>
if not root:
return []
q = deque()
q.append(root)
ans = []
while q:
cur = q.popleft()
if not cur:
ans.append(None)
continue
ans.append(cur.val)
q.append(cur.left)
... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_36k_train_028579 | 1,530 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | stack_v2_sparse_classes_30k_train_004322 | 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:... | 0ab632adefa18ba8c5a0ca50738f4cb092e37b92 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
if not root:
return []
q = deque()
q.append(root)
ans = []
while q:
cur = q.popleft()
if not cur:
ans.... | the_stack_v2_python_sparse | offer/37.py | xychen1015/leetcode | train | 0 | |
3152de67d01511cea095b740df9e5f13525c3d80 | [
"d_expected = '2018-03-02 15:19:08'\nd_out = datetime.datetime.strptime(test_structures.example_erratum['errata']['rhba']['created_at'], '%Y-%m-%dT%H:%M:%SZ')\nself.assertEqual(str(d_out), d_expected)",
"with mock.patch('errata.requests.get') as get:\n response = mock.MagicMock(status_code=200)\n response.j... | <|body_start_0|>
d_expected = '2018-03-02 15:19:08'
d_out = datetime.datetime.strptime(test_structures.example_erratum['errata']['rhba']['created_at'], '%Y-%m-%dT%H:%M:%SZ')
self.assertEqual(str(d_out), d_expected)
<|end_body_0|>
<|body_start_1|>
with mock.patch('errata.requests.get') a... | TestBrew | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestBrew:
def test_parse_date(self):
"""Verify we can parse the date string returned from Errata Tool"""
<|body_0|>
def test_get_filtered_list(self):
"""Ensure we can generate an Erratum List"""
<|body_1|>
def test_get_filtered_list_limit(self):
... | stack_v2_sparse_classes_36k_train_028580 | 2,183 | permissive | [
{
"docstring": "Verify we can parse the date string returned from Errata Tool",
"name": "test_parse_date",
"signature": "def test_parse_date(self)"
},
{
"docstring": "Ensure we can generate an Erratum List",
"name": "test_get_filtered_list",
"signature": "def test_get_filtered_list(self)... | 4 | stack_v2_sparse_classes_30k_train_015338 | Implement the Python class `TestBrew` described below.
Class description:
Implement the TestBrew class.
Method signatures and docstrings:
- def test_parse_date(self): Verify we can parse the date string returned from Errata Tool
- def test_get_filtered_list(self): Ensure we can generate an Erratum List
- def test_get... | Implement the Python class `TestBrew` described below.
Class description:
Implement the TestBrew class.
Method signatures and docstrings:
- def test_parse_date(self): Verify we can parse the date string returned from Errata Tool
- def test_get_filtered_list(self): Ensure we can generate an Erratum List
- def test_get... | 4ceffe41c02647651b5f5597b64bbf78d88f6d94 | <|skeleton|>
class TestBrew:
def test_parse_date(self):
"""Verify we can parse the date string returned from Errata Tool"""
<|body_0|>
def test_get_filtered_list(self):
"""Ensure we can generate an Erratum List"""
<|body_1|>
def test_get_filtered_list_limit(self):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestBrew:
def test_parse_date(self):
"""Verify we can parse the date string returned from Errata Tool"""
d_expected = '2018-03-02 15:19:08'
d_out = datetime.datetime.strptime(test_structures.example_erratum['errata']['rhba']['created_at'], '%Y-%m-%dT%H:%M:%SZ')
self.assertEqual... | the_stack_v2_python_sparse | elliottlib/errata_test.py | smunilla/elliott | train | 0 | |
4afd3eb9eb3e1a7bfbade767c2730a80ae85da25 | [
"self._model = model\nself._diversify = diversify\nself._ensemble_size = self._model.ensemble_size\nself._seed = seed\nself._initialized = tf.Variable(False, trainable=False)\nself._batch_size = tf.Variable(0, dtype=tf.int32, trainable=False)\nif self._diversify:\n self._eps = tf.Variable(tf.zeros([0, 0], dtype=... | <|body_start_0|>
self._model = model
self._diversify = diversify
self._ensemble_size = self._model.ensemble_size
self._seed = seed
self._initialized = tf.Variable(False, trainable=False)
self._batch_size = tf.Variable(0, dtype=tf.int32, trainable=False)
if self._d... | Generate an approximate function draw (trajectory) by randomly choosing a batch B of networks from the ensemble and using their predicted means as trajectories. Option `diversify` can be used to increase the diversity in case of optimizing very large batches of trajectories. We use quantiles from the approximate Gaussi... | deep_ensemble_trajectory | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class deep_ensemble_trajectory:
"""Generate an approximate function draw (trajectory) by randomly choosing a batch B of networks from the ensemble and using their predicted means as trajectories. Option `diversify` can be used to increase the diversity in case of optimizing very large batches of trajec... | stack_v2_sparse_classes_36k_train_028581 | 9,679 | permissive | [
{
"docstring": ":param model: The model of the objective function. :param diversify: Whether to use samples from final probabilistic layer as trajectories or mean predictions. :param seed: Optional RNG seed.",
"name": "__init__",
"signature": "def __init__(self, model: DeepEnsembleModel, diversify: bool... | 4 | stack_v2_sparse_classes_30k_train_011114 | Implement the Python class `deep_ensemble_trajectory` described below.
Class description:
Generate an approximate function draw (trajectory) by randomly choosing a batch B of networks from the ensemble and using their predicted means as trajectories. Option `diversify` can be used to increase the diversity in case of ... | Implement the Python class `deep_ensemble_trajectory` described below.
Class description:
Generate an approximate function draw (trajectory) by randomly choosing a batch B of networks from the ensemble and using their predicted means as trajectories. Option `diversify` can be used to increase the diversity in case of ... | 56101c092f28ed87398c4cd63fdece2f16909451 | <|skeleton|>
class deep_ensemble_trajectory:
"""Generate an approximate function draw (trajectory) by randomly choosing a batch B of networks from the ensemble and using their predicted means as trajectories. Option `diversify` can be used to increase the diversity in case of optimizing very large batches of trajec... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class deep_ensemble_trajectory:
"""Generate an approximate function draw (trajectory) by randomly choosing a batch B of networks from the ensemble and using their predicted means as trajectories. Option `diversify` can be used to increase the diversity in case of optimizing very large batches of trajectories. We us... | the_stack_v2_python_sparse | trieste/models/keras/sampler.py | secondmind-labs/trieste | train | 190 |
292f5a957a9579b79672c2bc95ae1e6ddd34a533 | [
"self.x = length\nself.y = width\nself.z = height\nself.GraphList = []",
"graph = nx.grid_graph([self.x, self.y, self.z])\nfor edge in self.GraphList:\n graph.add_edge(edge[0], edge[1])\nif graph_layout == 'spring':\n graph_pos = nx.spring_layout(graph)\nelif graph_layout == 'spectral':\n graph_pos = nx.... | <|body_start_0|>
self.x = length
self.y = width
self.z = height
self.GraphList = []
<|end_body_0|>
<|body_start_1|>
graph = nx.grid_graph([self.x, self.y, self.z])
for edge in self.GraphList:
graph.add_edge(edge[0], edge[1])
if graph_layout == 'spring... | LatticeGraphics | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LatticeGraphics:
def __init__(self, length, width, height):
"""Creates a CayleyTree object in order to create an image of the graph."""
<|body_0|>
def drawLattice(self, labels=None, graph_layout='spring', node_size=1000, node_color='blue', node_alpha=0.3, node_text_size=12, ... | stack_v2_sparse_classes_36k_train_028582 | 3,101 | permissive | [
{
"docstring": "Creates a CayleyTree object in order to create an image of the graph.",
"name": "__init__",
"signature": "def __init__(self, length, width, height)"
},
{
"docstring": "Method that physically draws the lattice graph based on length, width, and height.",
"name": "drawLattice",
... | 2 | stack_v2_sparse_classes_30k_train_016149 | Implement the Python class `LatticeGraphics` described below.
Class description:
Implement the LatticeGraphics class.
Method signatures and docstrings:
- def __init__(self, length, width, height): Creates a CayleyTree object in order to create an image of the graph.
- def drawLattice(self, labels=None, graph_layout='... | Implement the Python class `LatticeGraphics` described below.
Class description:
Implement the LatticeGraphics class.
Method signatures and docstrings:
- def __init__(self, length, width, height): Creates a CayleyTree object in order to create an image of the graph.
- def drawLattice(self, labels=None, graph_layout='... | dbd60c6fa04f00aa995094acc76ef0d06a0346b1 | <|skeleton|>
class LatticeGraphics:
def __init__(self, length, width, height):
"""Creates a CayleyTree object in order to create an image of the graph."""
<|body_0|>
def drawLattice(self, labels=None, graph_layout='spring', node_size=1000, node_color='blue', node_alpha=0.3, node_text_size=12, ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LatticeGraphics:
def __init__(self, length, width, height):
"""Creates a CayleyTree object in order to create an image of the graph."""
self.x = length
self.y = width
self.z = height
self.GraphList = []
def drawLattice(self, labels=None, graph_layout='spring', node... | the_stack_v2_python_sparse | graphics/latticegraphics.py | noe98/Cayley | train | 5 | |
81566d03b343c74dfea384fb5bcdd5eb05be66be | [
"index = 'test_index'\nsketch_id = 1\nanalyzer = SessionizerSketchPlugin(index, sketch_id)\nanalyzer.datastore.client = mock.Mock()\ndatastore = analyzer.datastore\n_create_mock_event(datastore, 0, 3, time_diffs=[3000, 400000000])\nmessage = analyzer.run()\nself.assertEqual(message, 'Sessionizing completed, number ... | <|body_start_0|>
index = 'test_index'
sketch_id = 1
analyzer = SessionizerSketchPlugin(index, sketch_id)
analyzer.datastore.client = mock.Mock()
datastore = analyzer.datastore
_create_mock_event(datastore, 0, 3, time_diffs=[3000, 400000000])
message = analyzer.run... | Tests the functionality of the sessionizing sketch analyzer, focusing on edge cases. | TestSessionizerPlugin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestSessionizerPlugin:
"""Tests the functionality of the sessionizing sketch analyzer, focusing on edge cases."""
def test_multiple_sessions(self):
"""Test multiple events, two of which are in the same session and one in a different session."""
<|body_0|>
def test_zero_t... | stack_v2_sparse_classes_36k_train_028583 | 4,019 | permissive | [
{
"docstring": "Test multiple events, two of which are in the same session and one in a different session.",
"name": "test_multiple_sessions",
"signature": "def test_multiple_sessions(self)"
},
{
"docstring": "Test events with no time difference between them are allocated correctly.",
"name"... | 4 | stack_v2_sparse_classes_30k_train_016506 | Implement the Python class `TestSessionizerPlugin` described below.
Class description:
Tests the functionality of the sessionizing sketch analyzer, focusing on edge cases.
Method signatures and docstrings:
- def test_multiple_sessions(self): Test multiple events, two of which are in the same session and one in a diff... | Implement the Python class `TestSessionizerPlugin` described below.
Class description:
Tests the functionality of the sessionizing sketch analyzer, focusing on edge cases.
Method signatures and docstrings:
- def test_multiple_sessions(self): Test multiple events, two of which are in the same session and one in a diff... | 24f471b58ca4a87cb053961b5f05c07a544ca7b8 | <|skeleton|>
class TestSessionizerPlugin:
"""Tests the functionality of the sessionizing sketch analyzer, focusing on edge cases."""
def test_multiple_sessions(self):
"""Test multiple events, two of which are in the same session and one in a different session."""
<|body_0|>
def test_zero_t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestSessionizerPlugin:
"""Tests the functionality of the sessionizing sketch analyzer, focusing on edge cases."""
def test_multiple_sessions(self):
"""Test multiple events, two of which are in the same session and one in a different session."""
index = 'test_index'
sketch_id = 1
... | the_stack_v2_python_sparse | timesketch/lib/analyzers/sessionizer_test.py | google/timesketch | train | 2,263 |
74fe1211a418eab461beca93dda90c74ade36697 | [
"super(Criterion, self).__init__()\nself.classifier = torch.nn.Linear(opt.network_feature_dim, 4, bias=False).to(opt.device)\nself.lr = opt.lr * 10\nself.name = 'imrot'",
"pred_batch = self.classifier(feature_batch)\nloss = torch.nn.CrossEntropyLoss()(pred_batch, imrot_labels.to(pred_batch.device))\nreturn loss"
... | <|body_start_0|>
super(Criterion, self).__init__()
self.classifier = torch.nn.Linear(opt.network_feature_dim, 4, bias=False).to(opt.device)
self.lr = opt.lr * 10
self.name = 'imrot'
<|end_body_0|>
<|body_start_1|>
pred_batch = self.classifier(feature_batch)
loss = torch.... | Criterion | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Criterion:
def __init__(self, opt):
"""Args: margin: Triplet Margin. nu: Regularisation Parameter for beta values if they are learned. beta: Class-Margin values. n_classes: Number of different classes during training."""
<|body_0|>
def forward(self, feature_batch, imrot_labe... | stack_v2_sparse_classes_36k_train_028584 | 1,471 | permissive | [
{
"docstring": "Args: margin: Triplet Margin. nu: Regularisation Parameter for beta values if they are learned. beta: Class-Margin values. n_classes: Number of different classes during training.",
"name": "__init__",
"signature": "def __init__(self, opt)"
},
{
"docstring": "Args: batch: torch.Te... | 2 | stack_v2_sparse_classes_30k_train_005566 | Implement the Python class `Criterion` described below.
Class description:
Implement the Criterion class.
Method signatures and docstrings:
- def __init__(self, opt): Args: margin: Triplet Margin. nu: Regularisation Parameter for beta values if they are learned. beta: Class-Margin values. n_classes: Number of differe... | Implement the Python class `Criterion` described below.
Class description:
Implement the Criterion class.
Method signatures and docstrings:
- def __init__(self, opt): Args: margin: Triplet Margin. nu: Regularisation Parameter for beta values if they are learned. beta: Class-Margin values. n_classes: Number of differe... | 01a7220bac7ebb1e70416ef663f3ba7cee9e8bf5 | <|skeleton|>
class Criterion:
def __init__(self, opt):
"""Args: margin: Triplet Margin. nu: Regularisation Parameter for beta values if they are learned. beta: Class-Margin values. n_classes: Number of different classes during training."""
<|body_0|>
def forward(self, feature_batch, imrot_labe... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Criterion:
def __init__(self, opt):
"""Args: margin: Triplet Margin. nu: Regularisation Parameter for beta values if they are learned. beta: Class-Margin values. n_classes: Number of different classes during training."""
super(Criterion, self).__init__()
self.classifier = torch.nn.Line... | the_stack_v2_python_sparse | criteria/imrot.py | chenyanlinzhugoushou/DCML | train | 0 | |
d834cc82efc874f4528b3cff0f219f67b7e376a3 | [
"cur = 60 * int(time[:2]) + int(time[3:])\nallowed = {int(x) for x in time if x != ':'}\nwhile True:\n cur = (cur + 1) % (24 * 60)\n if all((digit in allowed for block in divmod(cur, 60) for digit in divmod(block, 10))):\n return '{:02d}:{:02d}'.format(*divmod(cur, 60))",
"ans = start = 60 * int(time... | <|body_start_0|>
cur = 60 * int(time[:2]) + int(time[3:])
allowed = {int(x) for x in time if x != ':'}
while True:
cur = (cur + 1) % (24 * 60)
if all((digit in allowed for block in divmod(cur, 60) for digit in divmod(block, 10))):
return '{:02d}:{:02d}'.fo... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def nextClosestTime(self, time):
"""Approach #1: Simulation [Accepted] Intuition and Algorithm Simulate the clock going forward by one minute. Each time it moves forward, if all the digits are allowed, then return the current time. The natural way to represent the time is as an... | stack_v2_sparse_classes_36k_train_028585 | 3,527 | no_license | [
{
"docstring": "Approach #1: Simulation [Accepted] Intuition and Algorithm Simulate the clock going forward by one minute. Each time it moves forward, if all the digits are allowed, then return the current time. The natural way to represent the time is as an integer t in the range 0 <= t < 24 * 60. Then the hou... | 2 | stack_v2_sparse_classes_30k_train_008529 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def nextClosestTime(self, time): Approach #1: Simulation [Accepted] Intuition and Algorithm Simulate the clock going forward by one minute. Each time it moves forward, if all the... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def nextClosestTime(self, time): Approach #1: Simulation [Accepted] Intuition and Algorithm Simulate the clock going forward by one minute. Each time it moves forward, if all the... | 11d6bf2ba7b50c07e048df37c4e05c8f46b92241 | <|skeleton|>
class Solution:
def nextClosestTime(self, time):
"""Approach #1: Simulation [Accepted] Intuition and Algorithm Simulate the clock going forward by one minute. Each time it moves forward, if all the digits are allowed, then return the current time. The natural way to represent the time is as an... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def nextClosestTime(self, time):
"""Approach #1: Simulation [Accepted] Intuition and Algorithm Simulate the clock going forward by one minute. Each time it moves forward, if all the digits are allowed, then return the current time. The natural way to represent the time is as an integer t in ... | the_stack_v2_python_sparse | LeetCodes/Google/NextClosestTime.py | chutianwen/LeetCodes | train | 0 | |
fa7c14d16e88ca37b378614013319cfe61b5fa58 | [
"super(CapsNet, self).__init__()\nself.opt = opt\nself.Conv1 = nn.Conv2d(in_channels=1, out_channels=256, kernel_size=9)\nself.PrimaryCaps = PrimaryCaps()\nself.DigitCaps = DigitCaps(opt)\nself.Decoder = Decoder(opt)",
"x = F.relu(self.Conv1(x))\nu = self.PrimaryCaps(x)\nv = self.DigitCaps(u)\nreturn v",
"batch... | <|body_start_0|>
super(CapsNet, self).__init__()
self.opt = opt
self.Conv1 = nn.Conv2d(in_channels=1, out_channels=256, kernel_size=9)
self.PrimaryCaps = PrimaryCaps()
self.DigitCaps = DigitCaps(opt)
self.Decoder = Decoder(opt)
<|end_body_0|>
<|body_start_1|>
x =... | CapsNet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CapsNet:
def __init__(self, opt):
"""The CapsNet consists of 3 layers: `Conv1`, `PrimaryCaps`, `DigitCaps`.`Conv1` is an ordinary 2D convolutional layer with 9x9 kernels, stride 2, 256 output channels, and ReLU activations. `PrimaryCaps` and `DigitCaps` are two capsule layers with Dynami... | stack_v2_sparse_classes_36k_train_028586 | 14,893 | no_license | [
{
"docstring": "The CapsNet consists of 3 layers: `Conv1`, `PrimaryCaps`, `DigitCaps`.`Conv1` is an ordinary 2D convolutional layer with 9x9 kernels, stride 2, 256 output channels, and ReLU activations. `PrimaryCaps` and `DigitCaps` are two capsule layers with Dynamic Routing between them. For further details o... | 5 | null | Implement the Python class `CapsNet` described below.
Class description:
Implement the CapsNet class.
Method signatures and docstrings:
- def __init__(self, opt): The CapsNet consists of 3 layers: `Conv1`, `PrimaryCaps`, `DigitCaps`.`Conv1` is an ordinary 2D convolutional layer with 9x9 kernels, stride 2, 256 output ... | Implement the Python class `CapsNet` described below.
Class description:
Implement the CapsNet class.
Method signatures and docstrings:
- def __init__(self, opt): The CapsNet consists of 3 layers: `Conv1`, `PrimaryCaps`, `DigitCaps`.`Conv1` is an ordinary 2D convolutional layer with 9x9 kernels, stride 2, 256 output ... | 7e55a422588c1d1e00f35a3d3a3ff896cce59e18 | <|skeleton|>
class CapsNet:
def __init__(self, opt):
"""The CapsNet consists of 3 layers: `Conv1`, `PrimaryCaps`, `DigitCaps`.`Conv1` is an ordinary 2D convolutional layer with 9x9 kernels, stride 2, 256 output channels, and ReLU activations. `PrimaryCaps` and `DigitCaps` are two capsule layers with Dynami... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CapsNet:
def __init__(self, opt):
"""The CapsNet consists of 3 layers: `Conv1`, `PrimaryCaps`, `DigitCaps`.`Conv1` is an ordinary 2D convolutional layer with 9x9 kernels, stride 2, 256 output channels, and ReLU activations. `PrimaryCaps` and `DigitCaps` are two capsule layers with Dynamic Routing betw... | the_stack_v2_python_sparse | generated/test_laubonghaudoi_CapsNet_guide_PyTorch.py | jansel/pytorch-jit-paritybench | train | 35 | |
13ea48fa18ba96b6908198712b90d09339d5f1bf | [
"couple: Couple = Couple.query.filter(Couple.id == couple_id).first()\nif couple:\n return couple.json()\nreturn abort(404)",
"couple: Couple = Couple.query.filter(Couple.id == couple_id).first()\nif couple:\n couple.lead_id = api.payload['lead_id']\n couple.follow_id = api.payload['follow_id']\n db.s... | <|body_start_0|>
couple: Couple = Couple.query.filter(Couple.id == couple_id).first()
if couple:
return couple.json()
return abort(404)
<|end_body_0|>
<|body_start_1|>
couple: Couple = Couple.query.filter(Couple.id == couple_id).first()
if couple:
couple.... | CoupleSpecific | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CoupleSpecific:
def get(self, couple_id):
"""Get person"""
<|body_0|>
def put(self, couple_id):
"""Update couple"""
<|body_1|>
def delete(self, couple_id):
"""Delete couple"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
couple:... | stack_v2_sparse_classes_36k_train_028587 | 2,281 | no_license | [
{
"docstring": "Get person",
"name": "get",
"signature": "def get(self, couple_id)"
},
{
"docstring": "Update couple",
"name": "put",
"signature": "def put(self, couple_id)"
},
{
"docstring": "Delete couple",
"name": "delete",
"signature": "def delete(self, couple_id)"
... | 3 | stack_v2_sparse_classes_30k_train_019021 | Implement the Python class `CoupleSpecific` described below.
Class description:
Implement the CoupleSpecific class.
Method signatures and docstrings:
- def get(self, couple_id): Get person
- def put(self, couple_id): Update couple
- def delete(self, couple_id): Delete couple | Implement the Python class `CoupleSpecific` described below.
Class description:
Implement the CoupleSpecific class.
Method signatures and docstrings:
- def get(self, couple_id): Get person
- def put(self, couple_id): Update couple
- def delete(self, couple_id): Delete couple
<|skeleton|>
class CoupleSpecific:
d... | 22733b2a9638c4c0a58f28e7b7f933586730ecd4 | <|skeleton|>
class CoupleSpecific:
def get(self, couple_id):
"""Get person"""
<|body_0|>
def put(self, couple_id):
"""Update couple"""
<|body_1|>
def delete(self, couple_id):
"""Delete couple"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CoupleSpecific:
def get(self, couple_id):
"""Get person"""
couple: Couple = Couple.query.filter(Couple.id == couple_id).first()
if couple:
return couple.json()
return abort(404)
def put(self, couple_id):
"""Update couple"""
couple: Couple = Coup... | the_stack_v2_python_sparse | apis/couple/apis.py | AlenAlic/4hf-corona-api | train | 0 | |
01e0f349625578d8179fc04c3624cb23bf02d8de | [
"selected_counselor_email = request.data.get('counselor')\ncounselor = User.objects.get(email=selected_counselor_email)\ncontent = request.data.get('content')\nreview = Review(client=request.user, counselor=counselor, create_date=datetime.now(), content=content)\nserializer = ReviewSerializer(review)\nif serializer... | <|body_start_0|>
selected_counselor_email = request.data.get('counselor')
counselor = User.objects.get(email=selected_counselor_email)
content = request.data.get('content')
review = Review(client=request.user, counselor=counselor, create_date=datetime.now(), content=content)
seri... | Review_upload | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Review_upload:
def post(self, request):
"""리뷰 생성 --- # /reviews/ ## headers - Authorization : Token "key 값" ## body parameter - counselor : 상담사 user - client : 내담자 user - content : 후기 내용"""
<|body_0|>
def put(self, request):
"""리뷰 수정 --- # /reviews/ ## headers - Auth... | stack_v2_sparse_classes_36k_train_028588 | 4,323 | no_license | [
{
"docstring": "리뷰 생성 --- # /reviews/ ## headers - Authorization : Token \"key 값\" ## body parameter - counselor : 상담사 user - client : 내담자 user - content : 후기 내용",
"name": "post",
"signature": "def post(self, request)"
},
{
"docstring": "리뷰 수정 --- # /reviews/ ## headers - Authorization : Token \... | 3 | stack_v2_sparse_classes_30k_train_001347 | Implement the Python class `Review_upload` described below.
Class description:
Implement the Review_upload class.
Method signatures and docstrings:
- def post(self, request): 리뷰 생성 --- # /reviews/ ## headers - Authorization : Token "key 값" ## body parameter - counselor : 상담사 user - client : 내담자 user - content : 후기 내용... | Implement the Python class `Review_upload` described below.
Class description:
Implement the Review_upload class.
Method signatures and docstrings:
- def post(self, request): 리뷰 생성 --- # /reviews/ ## headers - Authorization : Token "key 값" ## body parameter - counselor : 상담사 user - client : 내담자 user - content : 후기 내용... | 751f3a8d7ef139c5d6fa17bcfe59fd05fbe3818c | <|skeleton|>
class Review_upload:
def post(self, request):
"""리뷰 생성 --- # /reviews/ ## headers - Authorization : Token "key 값" ## body parameter - counselor : 상담사 user - client : 내담자 user - content : 후기 내용"""
<|body_0|>
def put(self, request):
"""리뷰 수정 --- # /reviews/ ## headers - Auth... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Review_upload:
def post(self, request):
"""리뷰 생성 --- # /reviews/ ## headers - Authorization : Token "key 값" ## body parameter - counselor : 상담사 user - client : 내담자 user - content : 후기 내용"""
selected_counselor_email = request.data.get('counselor')
counselor = User.objects.get(email=sele... | the_stack_v2_python_sparse | findme/review/views.py | real-kk/findme-backend | train | 4 | |
4d47179d05bb4e5faacace38f41da638b2227e54 | [
"self.p.class1_wt_frac = class1_wt_frac\nself.p.class1_custom_isotopics = class1_custom_isotopics\nself.p.class2_custom_isotopics = class2_custom_isotopics\nif class1_wt_frac:\n self._applyIsotopicsMixFromCustomIsotopicsInput(customIsotopics)",
"class1Isotopics = customIsotopics[self.p.class1_custom_isotopics]... | <|body_start_0|>
self.p.class1_wt_frac = class1_wt_frac
self.p.class1_custom_isotopics = class1_custom_isotopics
self.p.class2_custom_isotopics = class2_custom_isotopics
if class1_wt_frac:
self._applyIsotopicsMixFromCustomIsotopicsInput(customIsotopics)
<|end_body_0|>
<|body... | Material that is considered a nuclear fuel. All this really does is enable the special class 1/class 2 isotopics input option. | FuelMaterial | [
"LicenseRef-scancode-free-unknown",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FuelMaterial:
"""Material that is considered a nuclear fuel. All this really does is enable the special class 1/class 2 isotopics input option."""
def applyInputParams(self, class1_custom_isotopics=None, class2_custom_isotopics=None, class1_wt_frac=None, customIsotopics=None):
"""App... | stack_v2_sparse_classes_36k_train_028589 | 26,954 | permissive | [
{
"docstring": "Apply optional class 1/class 2 custom enrichment input. Notes ----- This is often overridden to insert customized material modification parameters but then this parent should always be called at the end in case users want to use this style of custom input. This is only applied to materials consi... | 2 | null | Implement the Python class `FuelMaterial` described below.
Class description:
Material that is considered a nuclear fuel. All this really does is enable the special class 1/class 2 isotopics input option.
Method signatures and docstrings:
- def applyInputParams(self, class1_custom_isotopics=None, class2_custom_isotop... | Implement the Python class `FuelMaterial` described below.
Class description:
Material that is considered a nuclear fuel. All this really does is enable the special class 1/class 2 isotopics input option.
Method signatures and docstrings:
- def applyInputParams(self, class1_custom_isotopics=None, class2_custom_isotop... | 6c4fea1ca9d256a2599efd52af5e5ebe9860d192 | <|skeleton|>
class FuelMaterial:
"""Material that is considered a nuclear fuel. All this really does is enable the special class 1/class 2 isotopics input option."""
def applyInputParams(self, class1_custom_isotopics=None, class2_custom_isotopics=None, class1_wt_frac=None, customIsotopics=None):
"""App... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FuelMaterial:
"""Material that is considered a nuclear fuel. All this really does is enable the special class 1/class 2 isotopics input option."""
def applyInputParams(self, class1_custom_isotopics=None, class2_custom_isotopics=None, class1_wt_frac=None, customIsotopics=None):
"""Apply optional c... | the_stack_v2_python_sparse | armi/materials/material.py | paulromano/armi | train | 1 |
e0b089fd82815c1cf94829106bbaa11934353e5b | [
"super().__init__(unique_id, zha_device, cluster_handlers, **kwargs)\nself._presets = [PRESET_NONE, self.PRESET_HOLIDAY, PRESET_SCHEDULE, self.PRESET_FROST]\nself._supported_flags |= ClimateEntityFeature.PRESET_MODE",
"if record.attr_name == 'operation_preset':\n if record.value == 0:\n self._preset = P... | <|body_start_0|>
super().__init__(unique_id, zha_device, cluster_handlers, **kwargs)
self._presets = [PRESET_NONE, self.PRESET_HOLIDAY, PRESET_SCHEDULE, self.PRESET_FROST]
self._supported_flags |= ClimateEntityFeature.PRESET_MODE
<|end_body_0|>
<|body_start_1|>
if record.attr_name == 'o... | ZONNSMART Thermostat implementation. Notice that this device uses two holiday presets (2: HolidayMode, 3: HolidayModeTemp), but only one of them can be set. | ZONNSMARTThermostat | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ZONNSMARTThermostat:
"""ZONNSMART Thermostat implementation. Notice that this device uses two holiday presets (2: HolidayMode, 3: HolidayModeTemp), but only one of them can be set."""
def __init__(self, unique_id, zha_device, cluster_handlers, **kwargs):
"""Initialize ZHA Thermostat ... | stack_v2_sparse_classes_36k_train_028590 | 29,216 | permissive | [
{
"docstring": "Initialize ZHA Thermostat instance.",
"name": "__init__",
"signature": "def __init__(self, unique_id, zha_device, cluster_handlers, **kwargs)"
},
{
"docstring": "Handle attribute update from device.",
"name": "async_attribute_updated",
"signature": "async def async_attrib... | 3 | stack_v2_sparse_classes_30k_train_004333 | Implement the Python class `ZONNSMARTThermostat` described below.
Class description:
ZONNSMART Thermostat implementation. Notice that this device uses two holiday presets (2: HolidayMode, 3: HolidayModeTemp), but only one of them can be set.
Method signatures and docstrings:
- def __init__(self, unique_id, zha_device... | Implement the Python class `ZONNSMARTThermostat` described below.
Class description:
ZONNSMART Thermostat implementation. Notice that this device uses two holiday presets (2: HolidayMode, 3: HolidayModeTemp), but only one of them can be set.
Method signatures and docstrings:
- def __init__(self, unique_id, zha_device... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class ZONNSMARTThermostat:
"""ZONNSMART Thermostat implementation. Notice that this device uses two holiday presets (2: HolidayMode, 3: HolidayModeTemp), but only one of them can be set."""
def __init__(self, unique_id, zha_device, cluster_handlers, **kwargs):
"""Initialize ZHA Thermostat ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ZONNSMARTThermostat:
"""ZONNSMART Thermostat implementation. Notice that this device uses two holiday presets (2: HolidayMode, 3: HolidayModeTemp), but only one of them can be set."""
def __init__(self, unique_id, zha_device, cluster_handlers, **kwargs):
"""Initialize ZHA Thermostat instance."""
... | the_stack_v2_python_sparse | homeassistant/components/zha/climate.py | home-assistant/core | train | 35,501 |
232b5cb0d785da7d96b40d9b936e525ebf07a02a | [
"self.normalize = True\npass_args = {}\nself.terms = []\nif kwargs is not None:\n for key, value in kwargs.items():\n k0l = key[0].lower()\n if k0l in ('a', 'b'):\n if k0l == 'a':\n msign = 1\n elif k0l == 'b':\n msign = -1\n if '_' in ... | <|body_start_0|>
self.normalize = True
pass_args = {}
self.terms = []
if kwargs is not None:
for key, value in kwargs.items():
k0l = key[0].lower()
if k0l in ('a', 'b'):
if k0l == 'a':
msign = 1
... | 2-term ANSI Zernike description of an optical pupil. | ANSI2TermZernike | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ANSI2TermZernike:
"""2-term ANSI Zernike description of an optical pupil."""
def __init__(self, *args, **kwargs):
"""Initialize a new Zernike instance."""
<|body_0|>
def build(self):
"""Use the wavefront coefficients stored in this class instance to build a wavef... | stack_v2_sparse_classes_36k_train_028591 | 34,508 | permissive | [
{
"docstring": "Initialize a new Zernike instance.",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docstring": "Use the wavefront coefficients stored in this class instance to build a wavefront model. Returns ------- self : `BaseZernike` this Zernike instance",
... | 2 | stack_v2_sparse_classes_30k_train_012153 | Implement the Python class `ANSI2TermZernike` described below.
Class description:
2-term ANSI Zernike description of an optical pupil.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Initialize a new Zernike instance.
- def build(self): Use the wavefront coefficients stored in this class inst... | Implement the Python class `ANSI2TermZernike` described below.
Class description:
2-term ANSI Zernike description of an optical pupil.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Initialize a new Zernike instance.
- def build(self): Use the wavefront coefficients stored in this class inst... | 01fb5572b7a1ac5e3ee095f89f133166050af719 | <|skeleton|>
class ANSI2TermZernike:
"""2-term ANSI Zernike description of an optical pupil."""
def __init__(self, *args, **kwargs):
"""Initialize a new Zernike instance."""
<|body_0|>
def build(self):
"""Use the wavefront coefficients stored in this class instance to build a wavef... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ANSI2TermZernike:
"""2-term ANSI Zernike description of an optical pupil."""
def __init__(self, *args, **kwargs):
"""Initialize a new Zernike instance."""
self.normalize = True
pass_args = {}
self.terms = []
if kwargs is not None:
for key, value in kwar... | the_stack_v2_python_sparse | prysm/zernike.py | JakobSilbermann/prysm | train | 0 |
d5d848b66adf92824d83f6fb00f26c77dcb0bbac | [
"BaseBNNPrior.__init__(self, bnn_omega, components)\nself.params_to_exclude = []\nself.set_params_list(self.params_to_exclude)\nself.set_comps_qphi_to_e1e2()",
"kwargs = Dict()\nfor comp, param_name in self.params_to_realize:\n hyperparams = getattr(self, comp)[param_name].copy()\n kwargs[comp][param_name] ... | <|body_start_0|>
BaseBNNPrior.__init__(self, bnn_omega, components)
self.params_to_exclude = []
self.set_params_list(self.params_to_exclude)
self.set_comps_qphi_to_e1e2()
<|end_body_0|>
<|body_start_1|>
kwargs = Dict()
for comp, param_name in self.params_to_realize:
... | BNN prior with independent parameters Note ---- This BNNPrior is cosmology-agnostic. For a version that's useful for H0 inference, see `DiagonalCosmoBNNPrior`. | DiagonalBNNPrior | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DiagonalBNNPrior:
"""BNN prior with independent parameters Note ---- This BNNPrior is cosmology-agnostic. For a version that's useful for H0 inference, see `DiagonalCosmoBNNPrior`."""
def __init__(self, bnn_omega, components):
"""Note ---- The dictionary attributes are copies of the ... | stack_v2_sparse_classes_36k_train_028592 | 2,765 | permissive | [
{
"docstring": "Note ---- The dictionary attributes are copies of the config corresponding to each component. The number of attributes depends on the number of components. Attributes ---------- components : list list of components, e.g. `lens_mass` lens_mass : dict profile type and parameters of the lens mass s... | 2 | stack_v2_sparse_classes_30k_val_000306 | Implement the Python class `DiagonalBNNPrior` described below.
Class description:
BNN prior with independent parameters Note ---- This BNNPrior is cosmology-agnostic. For a version that's useful for H0 inference, see `DiagonalCosmoBNNPrior`.
Method signatures and docstrings:
- def __init__(self, bnn_omega, components... | Implement the Python class `DiagonalBNNPrior` described below.
Class description:
BNN prior with independent parameters Note ---- This BNNPrior is cosmology-agnostic. For a version that's useful for H0 inference, see `DiagonalCosmoBNNPrior`.
Method signatures and docstrings:
- def __init__(self, bnn_omega, components... | 2a9a1b3eafbafef925bedab4b3137a3505a9b750 | <|skeleton|>
class DiagonalBNNPrior:
"""BNN prior with independent parameters Note ---- This BNNPrior is cosmology-agnostic. For a version that's useful for H0 inference, see `DiagonalCosmoBNNPrior`."""
def __init__(self, bnn_omega, components):
"""Note ---- The dictionary attributes are copies of the ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DiagonalBNNPrior:
"""BNN prior with independent parameters Note ---- This BNNPrior is cosmology-agnostic. For a version that's useful for H0 inference, see `DiagonalCosmoBNNPrior`."""
def __init__(self, bnn_omega, components):
"""Note ---- The dictionary attributes are copies of the config corres... | the_stack_v2_python_sparse | baobab/bnn_priors/diagonal_bnn_prior.py | jiwoncpark/baobab | train | 9 |
26cdefa93399ba83ec04ea9dd35d814b8f09b7b0 | [
"self._MySQL = mysql_instance\nself.sql_script = sql_script\nself.split_algo = split_algo\nself._prep_statements = prep_statements\nself._dump_fails = dump_fails\nself._execute_iters = 0",
"print('\\tRetrieving commands from', self.sql_script)\nprint('\\tUsing command splitter algorithm {0}'.format(self.split_alg... | <|body_start_0|>
self._MySQL = mysql_instance
self.sql_script = sql_script
self.split_algo = split_algo
self._prep_statements = prep_statements
self._dump_fails = dump_fails
self._execute_iters = 0
<|end_body_0|>
<|body_start_1|>
print('\tRetrieving commands from... | Execute | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Execute:
def __init__(self, sql_script=None, split_algo='sql_split', prep_statements=True, dump_fails=True, mysql_instance=None):
"""Execute a sql file one command at a time."""
<|body_0|>
def commands(self):
"""Fetch individual SQL commands from a SQL commands conta... | stack_v2_sparse_classes_36k_train_028593 | 6,364 | permissive | [
{
"docstring": "Execute a sql file one command at a time.",
"name": "__init__",
"signature": "def __init__(self, sql_script=None, split_algo='sql_split', prep_statements=True, dump_fails=True, mysql_instance=None)"
},
{
"docstring": "Fetch individual SQL commands from a SQL commands containing m... | 6 | stack_v2_sparse_classes_30k_train_012933 | Implement the Python class `Execute` described below.
Class description:
Implement the Execute class.
Method signatures and docstrings:
- def __init__(self, sql_script=None, split_algo='sql_split', prep_statements=True, dump_fails=True, mysql_instance=None): Execute a sql file one command at a time.
- def commands(se... | Implement the Python class `Execute` described below.
Class description:
Implement the Execute class.
Method signatures and docstrings:
- def __init__(self, sql_script=None, split_algo='sql_split', prep_statements=True, dump_fails=True, mysql_instance=None): Execute a sql file one command at a time.
- def commands(se... | 6964f718f4b72eb30f2259adfcfaf3090526c53d | <|skeleton|>
class Execute:
def __init__(self, sql_script=None, split_algo='sql_split', prep_statements=True, dump_fails=True, mysql_instance=None):
"""Execute a sql file one command at a time."""
<|body_0|>
def commands(self):
"""Fetch individual SQL commands from a SQL commands conta... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Execute:
def __init__(self, sql_script=None, split_algo='sql_split', prep_statements=True, dump_fails=True, mysql_instance=None):
"""Execute a sql file one command at a time."""
self._MySQL = mysql_instance
self.sql_script = sql_script
self.split_algo = split_algo
self.... | the_stack_v2_python_sparse | mysql/toolkit/commands/execute.py | sfneal/mysql-toolkit | train | 6 | |
4e9be1ac316aa8ff9cddf07414032e823157420a | [
"if authorization_header is None:\n return None\nif type(authorization_header) is not str:\n return None\nif len(authorization_header) > 6:\n if 'Basic ' in authorization_header[0:6]:\n return authorization_header[6:]\nreturn None",
"if base64_authorization_header is None:\n return None\nif typ... | <|body_start_0|>
if authorization_header is None:
return None
if type(authorization_header) is not str:
return None
if len(authorization_header) > 6:
if 'Basic ' in authorization_header[0:6]:
return authorization_header[6:]
return None
... | BasicAuth class | BasicAuth | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BasicAuth:
"""BasicAuth class"""
def extract_base64_authorization_header(self, authorization_header: str) -> str:
"""returns the Base64 part of the Authorization header for a Basic Authentication:"""
<|body_0|>
def decode_base64_authorization_header(self, base64_authoriz... | stack_v2_sparse_classes_36k_train_028594 | 3,084 | no_license | [
{
"docstring": "returns the Base64 part of the Authorization header for a Basic Authentication:",
"name": "extract_base64_authorization_header",
"signature": "def extract_base64_authorization_header(self, authorization_header: str) -> str"
},
{
"docstring": "returns the decoded value of a Base64... | 5 | stack_v2_sparse_classes_30k_train_009912 | Implement the Python class `BasicAuth` described below.
Class description:
BasicAuth class
Method signatures and docstrings:
- def extract_base64_authorization_header(self, authorization_header: str) -> str: returns the Base64 part of the Authorization header for a Basic Authentication:
- def decode_base64_authorizat... | Implement the Python class `BasicAuth` described below.
Class description:
BasicAuth class
Method signatures and docstrings:
- def extract_base64_authorization_header(self, authorization_header: str) -> str: returns the Base64 part of the Authorization header for a Basic Authentication:
- def decode_base64_authorizat... | a09732a4f270d3dbeaf6ff1eb46c7bc0b71eaf4a | <|skeleton|>
class BasicAuth:
"""BasicAuth class"""
def extract_base64_authorization_header(self, authorization_header: str) -> str:
"""returns the Base64 part of the Authorization header for a Basic Authentication:"""
<|body_0|>
def decode_base64_authorization_header(self, base64_authoriz... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BasicAuth:
"""BasicAuth class"""
def extract_base64_authorization_header(self, authorization_header: str) -> str:
"""returns the Base64 part of the Authorization header for a Basic Authentication:"""
if authorization_header is None:
return None
if type(authorization_he... | the_stack_v2_python_sparse | 0x06-Basic_authentication/api/v1/auth/basic_auth.py | I7RANK/holbertonschool-web_back_end | train | 0 |
dafb1f7aa0db15d840753ed05a1c2566698d1113 | [
"result = []\nroot = {'parent': None, 'state': list(), 'positives': nums, 'negatives': list()}\ntemp_node = root\nwhile temp_node is not None:\n if temp_node['positives']:\n item = temp_node['positives'].pop()\n next_node = {'parent': temp_node, 'state': temp_node['state'] + [item], 'positives': te... | <|body_start_0|>
result = []
root = {'parent': None, 'state': list(), 'positives': nums, 'negatives': list()}
temp_node = root
while temp_node is not None:
if temp_node['positives']:
item = temp_node['positives'].pop()
next_node = {'parent': te... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def permute_backtracking(self, nums):
"""根据题目的提示,可以使用回溯法来生成所有的可能的结果。 :type nums: List[int] :rtype: List[List[int]]"""
<|body_0|>
def permute(self, nums):
"""从我们的第一直觉上来说,permutations很简单,只不过是所有数字的排列而已, 因此总共有len(nums)!种结果。现在的问题是怎么将这么多种结果生成出来。 在这里借用beam search的... | stack_v2_sparse_classes_36k_train_028595 | 2,369 | no_license | [
{
"docstring": "根据题目的提示,可以使用回溯法来生成所有的可能的结果。 :type nums: List[int] :rtype: List[List[int]]",
"name": "permute_backtracking",
"signature": "def permute_backtracking(self, nums)"
},
{
"docstring": "从我们的第一直觉上来说,permutations很简单,只不过是所有数字的排列而已, 因此总共有len(nums)!种结果。现在的问题是怎么将这么多种结果生成出来。 在这里借用beam search的方... | 2 | stack_v2_sparse_classes_30k_train_012482 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def permute_backtracking(self, nums): 根据题目的提示,可以使用回溯法来生成所有的可能的结果。 :type nums: List[int] :rtype: List[List[int]]
- def permute(self, nums): 从我们的第一直觉上来说,permutations很简单,只不过是所有数字的排列... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def permute_backtracking(self, nums): 根据题目的提示,可以使用回溯法来生成所有的可能的结果。 :type nums: List[int] :rtype: List[List[int]]
- def permute(self, nums): 从我们的第一直觉上来说,permutations很简单,只不过是所有数字的排列... | 45d116d790075b1583af6aecd00f8babfe2c3107 | <|skeleton|>
class Solution:
def permute_backtracking(self, nums):
"""根据题目的提示,可以使用回溯法来生成所有的可能的结果。 :type nums: List[int] :rtype: List[List[int]]"""
<|body_0|>
def permute(self, nums):
"""从我们的第一直觉上来说,permutations很简单,只不过是所有数字的排列而已, 因此总共有len(nums)!种结果。现在的问题是怎么将这么多种结果生成出来。 在这里借用beam search的... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def permute_backtracking(self, nums):
"""根据题目的提示,可以使用回溯法来生成所有的可能的结果。 :type nums: List[int] :rtype: List[List[int]]"""
result = []
root = {'parent': None, 'state': list(), 'positives': nums, 'negatives': list()}
temp_node = root
while temp_node is not None:
... | the_stack_v2_python_sparse | leetcode/misc/exercise_46.py | YinongLong/Data-Structures-and-Algorithm-Analysis | train | 0 | |
1abea7b3f0164561422c7c796110264f1979584a | [
"if not root:\n return TreeNode(val)\ncur_node = root\npre_node = root\nwhile cur_node:\n pre_node = cur_node\n if cur_node.val < val:\n cur_node = cur_node.right\n else:\n cur_node = cur_node.left\nnew_node = TreeNode(val)\nif pre_node.val > val:\n pre_node.left = new_node\nelse:\n ... | <|body_start_0|>
if not root:
return TreeNode(val)
cur_node = root
pre_node = root
while cur_node:
pre_node = cur_node
if cur_node.val < val:
cur_node = cur_node.right
else:
cur_node = cur_node.left
n... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def insertIntoBST(self, root: TreeNode, val: int) -> TreeNode:
"""遍历方式,找到合适的叶子节点,插入 :param root: :param val: :return:"""
<|body_0|>
def insertIntoBST1(self, root: TreeNode, val: int) -> TreeNode:
"""递归算法 :param root: :param val: :return:"""
<|body_1... | stack_v2_sparse_classes_36k_train_028596 | 1,691 | no_license | [
{
"docstring": "遍历方式,找到合适的叶子节点,插入 :param root: :param val: :return:",
"name": "insertIntoBST",
"signature": "def insertIntoBST(self, root: TreeNode, val: int) -> TreeNode"
},
{
"docstring": "递归算法 :param root: :param val: :return:",
"name": "insertIntoBST1",
"signature": "def insertIntoBS... | 2 | stack_v2_sparse_classes_30k_train_020304 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def insertIntoBST(self, root: TreeNode, val: int) -> TreeNode: 遍历方式,找到合适的叶子节点,插入 :param root: :param val: :return:
- def insertIntoBST1(self, root: TreeNode, val: int) -> TreeNod... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def insertIntoBST(self, root: TreeNode, val: int) -> TreeNode: 遍历方式,找到合适的叶子节点,插入 :param root: :param val: :return:
- def insertIntoBST1(self, root: TreeNode, val: int) -> TreeNod... | 9acba92695c06406f12f997a720bfe1deb9464a8 | <|skeleton|>
class Solution:
def insertIntoBST(self, root: TreeNode, val: int) -> TreeNode:
"""遍历方式,找到合适的叶子节点,插入 :param root: :param val: :return:"""
<|body_0|>
def insertIntoBST1(self, root: TreeNode, val: int) -> TreeNode:
"""递归算法 :param root: :param val: :return:"""
<|body_1... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def insertIntoBST(self, root: TreeNode, val: int) -> TreeNode:
"""遍历方式,找到合适的叶子节点,插入 :param root: :param val: :return:"""
if not root:
return TreeNode(val)
cur_node = root
pre_node = root
while cur_node:
pre_node = cur_node
i... | the_stack_v2_python_sparse | datastructure/binary_search_tree/InsertIntoBST.py | yinhuax/leet_code | train | 0 | |
0837d39e8aaf81cf74285a1bee7fa5d2cf536119 | [
"if not num_rows:\n return []\nret = [[1]]\nif num_rows == 1:\n return ret\nret.append([1, 1])\nif num_rows == 2:\n return ret\nfor i in range(3, num_rows + 1):\n row = [1]\n last_row = ret[len(ret) - 1]\n for j in range(1, len(last_row)):\n row.append(last_row[j - 1] + last_row[j])\n ro... | <|body_start_0|>
if not num_rows:
return []
ret = [[1]]
if num_rows == 1:
return ret
ret.append([1, 1])
if num_rows == 2:
return ret
for i in range(3, num_rows + 1):
row = [1]
last_row = ret[len(ret) - 1]
... | PascalsTriangle | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PascalsTriangle:
def generate(num_rows):
""":type num_rows: int :rtype: List[List[int]]"""
<|body_0|>
def get_row(row_index):
""":type row_index: int :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not num_rows:
retu... | stack_v2_sparse_classes_36k_train_028597 | 1,130 | permissive | [
{
"docstring": ":type num_rows: int :rtype: List[List[int]]",
"name": "generate",
"signature": "def generate(num_rows)"
},
{
"docstring": ":type row_index: int :rtype: List[int]",
"name": "get_row",
"signature": "def get_row(row_index)"
}
] | 2 | null | Implement the Python class `PascalsTriangle` described below.
Class description:
Implement the PascalsTriangle class.
Method signatures and docstrings:
- def generate(num_rows): :type num_rows: int :rtype: List[List[int]]
- def get_row(row_index): :type row_index: int :rtype: List[int] | Implement the Python class `PascalsTriangle` described below.
Class description:
Implement the PascalsTriangle class.
Method signatures and docstrings:
- def generate(num_rows): :type num_rows: int :rtype: List[List[int]]
- def get_row(row_index): :type row_index: int :rtype: List[int]
<|skeleton|>
class PascalsTria... | 77838c37e3fdae0f2ec628aa7ddc59f4a5949bbe | <|skeleton|>
class PascalsTriangle:
def generate(num_rows):
""":type num_rows: int :rtype: List[List[int]]"""
<|body_0|>
def get_row(row_index):
""":type row_index: int :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PascalsTriangle:
def generate(num_rows):
""":type num_rows: int :rtype: List[List[int]]"""
if not num_rows:
return []
ret = [[1]]
if num_rows == 1:
return ret
ret.append([1, 1])
if num_rows == 2:
return ret
for i in ra... | the_stack_v2_python_sparse | Python/dev/arrays/pascals_triangle.py | faisaldialpad/hellouniverse | train | 0 | |
02fb83eb8172766985d7feabdc65c618c18aa989 | [
"self.turbine_status_id = turbine_status_id\nself.device_id = device_id\nself.timestamp_start = APIHelper.RFC3339DateTime(timestamp_start) if timestamp_start else None\nself.timestamp_end = APIHelper.RFC3339DateTime(timestamp_end) if timestamp_end else None\nself.has_timestamp_end = has_timestamp_end\nself.category... | <|body_start_0|>
self.turbine_status_id = turbine_status_id
self.device_id = device_id
self.timestamp_start = APIHelper.RFC3339DateTime(timestamp_start) if timestamp_start else None
self.timestamp_end = APIHelper.RFC3339DateTime(timestamp_end) if timestamp_end else None
self.has_... | Implementation of the 'StatusItem' model. A status that may contain statuses of the same type as sub-statuses. Note that for sub-statuses the fields `categoryIec`, `categoryContract`, and `subStatus` will always be null. Attributes: turbine_status_id (int): The id of a turbine status. device_id (int): The id of the dev... | StatusItem | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StatusItem:
"""Implementation of the 'StatusItem' model. A status that may contain statuses of the same type as sub-statuses. Note that for sub-statuses the fields `categoryIec`, `categoryContract`, and `subStatus` will always be null. Attributes: turbine_status_id (int): The id of a turbine stat... | stack_v2_sparse_classes_36k_train_028598 | 6,767 | permissive | [
{
"docstring": "Constructor for the StatusItem class",
"name": "__init__",
"signature": "def __init__(self, turbine_status_id=None, device_id=None, timestamp_start=None, timestamp_end=None, has_timestamp_end=None, category=None, code=None, message=None, comment=None, lost_production_signal=None, lost_pr... | 2 | stack_v2_sparse_classes_30k_train_008311 | Implement the Python class `StatusItem` described below.
Class description:
Implementation of the 'StatusItem' model. A status that may contain statuses of the same type as sub-statuses. Note that for sub-statuses the fields `categoryIec`, `categoryContract`, and `subStatus` will always be null. Attributes: turbine_st... | Implement the Python class `StatusItem` described below.
Class description:
Implementation of the 'StatusItem' model. A status that may contain statuses of the same type as sub-statuses. Note that for sub-statuses the fields `categoryIec`, `categoryContract`, and `subStatus` will always be null. Attributes: turbine_st... | 6835ee1f6a667b5c7827c5248391081f06b75513 | <|skeleton|>
class StatusItem:
"""Implementation of the 'StatusItem' model. A status that may contain statuses of the same type as sub-statuses. Note that for sub-statuses the fields `categoryIec`, `categoryContract`, and `subStatus` will always be null. Attributes: turbine_status_id (int): The id of a turbine stat... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StatusItem:
"""Implementation of the 'StatusItem' model. A status that may contain statuses of the same type as sub-statuses. Note that for sub-statuses the fields `categoryIec`, `categoryContract`, and `subStatus` will always be null. Attributes: turbine_status_id (int): The id of a turbine status. device_id... | the_stack_v2_python_sparse | greenbyteapi/models/status_item.py | charlie9578/greenbyte-api-sdk | train | 0 |
c42eef8dfdffe98cbb04ce45ad776abc43fb28c8 | [
"super(CsvUserData, self).__init__(filename, args)\nself.filename = filename\nwith open(self.filename) as input_file:\n reader = csv.DictReader(input_file)\n result = {}\n for row in reader:\n key = int(row['Id'])\n if key in result:\n print('ERROR. Duplicate Id in table: %s\\nrow=... | <|body_start_0|>
super(CsvUserData, self).__init__(filename, args)
self.filename = filename
with open(self.filename) as input_file:
reader = csv.DictReader(input_file)
result = {}
for row in reader:
key = int(row['Id'])
if key i... | Comma Separated Values form of the User base. | CsvUserData | [
"Apache-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CsvUserData:
"""Comma Separated Values form of the User base."""
def __init__(self, filename, args=None):
"""Read the input file into a dictionary."""
<|body_0|>
def write_updated(self):
"""Backup the existing file and write the new one."""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_028599 | 17,781 | permissive | [
{
"docstring": "Read the input file into a dictionary.",
"name": "__init__",
"signature": "def __init__(self, filename, args=None)"
},
{
"docstring": "Backup the existing file and write the new one.",
"name": "write_updated",
"signature": "def write_updated(self)"
},
{
"docstring... | 3 | null | Implement the Python class `CsvUserData` described below.
Class description:
Comma Separated Values form of the User base.
Method signatures and docstrings:
- def __init__(self, filename, args=None): Read the input file into a dictionary.
- def write_updated(self): Backup the existing file and write the new one.
- de... | Implement the Python class `CsvUserData` described below.
Class description:
Comma Separated Values form of the User base.
Method signatures and docstrings:
- def __init__(self, filename, args=None): Read the input file into a dictionary.
- def write_updated(self): Backup the existing file and write the new one.
- de... | 9c60b3489f02592bd9099b8719ca23ae43a9eaa5 | <|skeleton|>
class CsvUserData:
"""Comma Separated Values form of the User base."""
def __init__(self, filename, args=None):
"""Read the input file into a dictionary."""
<|body_0|>
def write_updated(self):
"""Backup the existing file and write the new one."""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CsvUserData:
"""Comma Separated Values form of the User base."""
def __init__(self, filename, args=None):
"""Read the input file into a dictionary."""
super(CsvUserData, self).__init__(filename, args)
self.filename = filename
with open(self.filename) as input_file:
... | the_stack_v2_python_sparse | attic/userdata.py | KSchopmeyer/smipyping | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.