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
8aeff0b9ef4ccbf9a8a6c374cb3566705965f099
[ "self.unit_dim = unit_dim\nself.activation = activation\nself.dropout = dropout\nself.regularizer = regularizer\nself.random_seed = random_seed\nself.trainable = trainable\nself.scope = scope\nself.device_spec = get_device_spec(default_gpu_id, num_gpus)\nwith tf.variable_scope(self.scope, reuse=tf.AUTO_REUSE), tf.d...
<|body_start_0|> self.unit_dim = unit_dim self.activation = activation self.dropout = dropout self.regularizer = regularizer self.random_seed = random_seed self.trainable = trainable self.scope = scope self.device_spec = get_device_spec(default_gpu_id, num...
highway layer
Highway
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Highway: """highway layer""" def __init__(self, unit_dim, activation, dropout, num_gpus=1, default_gpu_id=0, regularizer=None, random_seed=0, trainable=True, scope='highway'): """initialize highway layer""" <|body_0|> def __call__(self, input_data, input_mask): "...
stack_v2_sparse_classes_36k_train_020200
9,944
permissive
[ { "docstring": "initialize highway layer", "name": "__init__", "signature": "def __init__(self, unit_dim, activation, dropout, num_gpus=1, default_gpu_id=0, regularizer=None, random_seed=0, trainable=True, scope='highway')" }, { "docstring": "call highway layer", "name": "__call__", "sig...
2
stack_v2_sparse_classes_30k_train_018460
Implement the Python class `Highway` described below. Class description: highway layer Method signatures and docstrings: - def __init__(self, unit_dim, activation, dropout, num_gpus=1, default_gpu_id=0, regularizer=None, random_seed=0, trainable=True, scope='highway'): initialize highway layer - def __call__(self, in...
Implement the Python class `Highway` described below. Class description: highway layer Method signatures and docstrings: - def __init__(self, unit_dim, activation, dropout, num_gpus=1, default_gpu_id=0, regularizer=None, random_seed=0, trainable=True, scope='highway'): initialize highway layer - def __call__(self, in...
05fcbec15e359e3db86af6c3798c13be8a6c58ee
<|skeleton|> class Highway: """highway layer""" def __init__(self, unit_dim, activation, dropout, num_gpus=1, default_gpu_id=0, regularizer=None, random_seed=0, trainable=True, scope='highway'): """initialize highway layer""" <|body_0|> def __call__(self, input_data, input_mask): "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Highway: """highway layer""" def __init__(self, unit_dim, activation, dropout, num_gpus=1, default_gpu_id=0, regularizer=None, random_seed=0, trainable=True, scope='highway'): """initialize highway layer""" self.unit_dim = unit_dim self.activation = activation self.dropout...
the_stack_v2_python_sparse
sequence_labeling/layer/highway.py
stevezheng23/sequence_labeling_tf
train
18
45dc204e8719c43b7b8b46b64f0c8045d41b1b27
[ "self.origin = asarray(origin)\nself.vectors = asarray(vectors)\nif not colors:\n colors = ('r', 'g', 'b')\nself.colors = colors", "assert_axes_dimension(axes, 3)\no = self.origin\nxyz = self.vectors\naxes.plot([o[0, 0], o[0, 0] + xyz[0, 0]], [o[0, 1], o[0, 1] + xyz[0, 1]], [o[0, 2], o[0, 2] + xyz[0, 2]], '{0}...
<|body_start_0|> self.origin = asarray(origin) self.vectors = asarray(vectors) if not colors: colors = ('r', 'g', 'b') self.colors = colors <|end_body_0|> <|body_start_1|> assert_axes_dimension(axes, 3) o = self.origin xyz = self.vectors axes....
Definition of a 3D Axes object. Parameters ---------- origin : tuple or list X, Y and Z coordinates for the origin. vectors : list The X, Y and Z axes. Attributes ---------- origin : tuple or list X, Y and Z coordinates for the origin. vectors : list The X, Y and Z axes.
Axes3D
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Axes3D: """Definition of a 3D Axes object. Parameters ---------- origin : tuple or list X, Y and Z coordinates for the origin. vectors : list The X, Y and Z axes. Attributes ---------- origin : tuple or list X, Y and Z coordinates for the origin. vectors : list The X, Y and Z axes.""" def __...
stack_v2_sparse_classes_36k_train_020201
5,340
permissive
[ { "docstring": "Initializes the Axes3D object", "name": "__init__", "signature": "def __init__(self, origin, vectors, colors=None)" }, { "docstring": "Plots the axes object Parameters ---------- axes : object The matplotlib axes object.", "name": "plot", "signature": "def plot(self, axes...
2
stack_v2_sparse_classes_30k_train_018614
Implement the Python class `Axes3D` described below. Class description: Definition of a 3D Axes object. Parameters ---------- origin : tuple or list X, Y and Z coordinates for the origin. vectors : list The X, Y and Z axes. Attributes ---------- origin : tuple or list X, Y and Z coordinates for the origin. vectors : l...
Implement the Python class `Axes3D` described below. Class description: Definition of a 3D Axes object. Parameters ---------- origin : tuple or list X, Y and Z coordinates for the origin. vectors : list The X, Y and Z axes. Attributes ---------- origin : tuple or list X, Y and Z coordinates for the origin. vectors : l...
486e2e9332553240bcbd80e100d26bff58071709
<|skeleton|> class Axes3D: """Definition of a 3D Axes object. Parameters ---------- origin : tuple or list X, Y and Z coordinates for the origin. vectors : list The X, Y and Z axes. Attributes ---------- origin : tuple or list X, Y and Z coordinates for the origin. vectors : list The X, Y and Z axes.""" def __...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Axes3D: """Definition of a 3D Axes object. Parameters ---------- origin : tuple or list X, Y and Z coordinates for the origin. vectors : list The X, Y and Z axes. Attributes ---------- origin : tuple or list X, Y and Z coordinates for the origin. vectors : list The X, Y and Z axes.""" def __init__(self, ...
the_stack_v2_python_sparse
src/compas_plotters/core/helpers.py
compas-dev/compas
train
286
722557dd6ab5378f6c055ba21ed8dc7ac2f008e8
[ "super()._init_buffers(v, n, _)\nself.vbos.append(gl.glGenBuffers(1))\ngl.glBindBuffer(gl.GL_ARRAY_BUFFER, self.vbos[3])\nloc = self.get_attribute_location('carried')\ngl.glEnableVertexAttribArray(loc)\ngl.glVertexAttribPointer(loc, 1, gl.GL_FLOAT, gl.GL_FALSE, 0, ctypes.c_void_p(0))\ngl.glVertexAttribDivisor(loc, ...
<|body_start_0|> super()._init_buffers(v, n, _) self.vbos.append(gl.glGenBuffers(1)) gl.glBindBuffer(gl.GL_ARRAY_BUFFER, self.vbos[3]) loc = self.get_attribute_location('carried') gl.glEnableVertexAttribArray(loc) gl.glVertexAttribPointer(loc, 1, gl.GL_FLOAT, gl.GL_FALSE,...
extended version of OffsetColorProgram. Has a carry flag and changes the position and alpha when flag is 1.0
OffsetColorCarryProgram
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OffsetColorCarryProgram: """extended version of OffsetColorProgram. Has a carry flag and changes the position and alpha when flag is 1.0""" def _init_buffers(self, v, n, _): """extends the init_buffer of OffsetColorProgram class by creating the additional carry flag VBO :param v: the...
stack_v2_sparse_classes_36k_train_020202
1,614
no_license
[ { "docstring": "extends the init_buffer of OffsetColorProgram class by creating the additional carry flag VBO :param v: the vertex model data (position vectors) :param n: the normal vector model data :return:", "name": "_init_buffers", "signature": "def _init_buffers(self, v, n, _)" }, { "docstr...
2
stack_v2_sparse_classes_30k_test_000588
Implement the Python class `OffsetColorCarryProgram` described below. Class description: extended version of OffsetColorProgram. Has a carry flag and changes the position and alpha when flag is 1.0 Method signatures and docstrings: - def _init_buffers(self, v, n, _): extends the init_buffer of OffsetColorProgram clas...
Implement the Python class `OffsetColorCarryProgram` described below. Class description: extended version of OffsetColorProgram. Has a carry flag and changes the position and alpha when flag is 1.0 Method signatures and docstrings: - def _init_buffers(self, v, n, _): extends the init_buffer of OffsetColorProgram clas...
20f8c9d261a6d235f85c777efb33480a71f5ba61
<|skeleton|> class OffsetColorCarryProgram: """extended version of OffsetColorProgram. Has a carry flag and changes the position and alpha when flag is 1.0""" def _init_buffers(self, v, n, _): """extends the init_buffer of OffsetColorProgram class by creating the additional carry flag VBO :param v: the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OffsetColorCarryProgram: """extended version of OffsetColorProgram. Has a carry flag and changes the position and alpha when flag is 1.0""" def _init_buffers(self, v, n, _): """extends the init_buffer of OffsetColorProgram class by creating the additional carry flag VBO :param v: the vertex model...
the_stack_v2_python_sparse
lib/visualization/programs/offset_color_carry_program.py
archeraghi/swarm-sim
train
0
4840243eacd85fa7b2ebf3578174c243e7ed8ff0
[ "def _default_message_on_done(task):\n return f'{task.completed} steps done in {get_readable_time(seconds=task.finished_time)}'\ncolumns = columns or [SpinnerColumn(), _OnDoneColumn(f'DONE', description, 'progress.description'), BarColumn(complete_style='green', finished_style='yellow'), TimeElapsedColumn(), '[p...
<|body_start_0|> def _default_message_on_done(task): return f'{task.completed} steps done in {get_readable_time(seconds=task.finished_time)}' columns = columns or [SpinnerColumn(), _OnDoneColumn(f'DONE', description, 'progress.description'), BarColumn(complete_style='green', finished_style='...
A progress bar made with rich. Example: .. highlight:: python .. code-block:: python with ProgressBar(100, 'loop') as p_bar: for i in range(100): do_busy() p_bar.update()
ProgressBar
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProgressBar: """A progress bar made with rich. Example: .. highlight:: python .. code-block:: python with ProgressBar(100, 'loop') as p_bar: for i in range(100): do_busy() p_bar.update()""" def __init__(self, description: str='Working...', total_length: Optional[float]=None, message_on_done:...
stack_v2_sparse_classes_36k_train_020203
8,843
permissive
[ { "docstring": "Init a custom progress bar based on rich. This is the default progress bar of jina if you want to customize it you should probably just use a rich `Progress` and add your custom column and task :param description: description of your task ex : 'Working...' :param total_length: the number of step...
2
null
Implement the Python class `ProgressBar` described below. Class description: A progress bar made with rich. Example: .. highlight:: python .. code-block:: python with ProgressBar(100, 'loop') as p_bar: for i in range(100): do_busy() p_bar.update() Method signatures and docstrings: - def __init__(self, description: st...
Implement the Python class `ProgressBar` described below. Class description: A progress bar made with rich. Example: .. highlight:: python .. code-block:: python with ProgressBar(100, 'loop') as p_bar: for i in range(100): do_busy() p_bar.update() Method signatures and docstrings: - def __init__(self, description: st...
23c7b8c78fc4ad67d16d83fc0c9f0eae9e935e71
<|skeleton|> class ProgressBar: """A progress bar made with rich. Example: .. highlight:: python .. code-block:: python with ProgressBar(100, 'loop') as p_bar: for i in range(100): do_busy() p_bar.update()""" def __init__(self, description: str='Working...', total_length: Optional[float]=None, message_on_done:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProgressBar: """A progress bar made with rich. Example: .. highlight:: python .. code-block:: python with ProgressBar(100, 'loop') as p_bar: for i in range(100): do_busy() p_bar.update()""" def __init__(self, description: str='Working...', total_length: Optional[float]=None, message_on_done: Optional[Uni...
the_stack_v2_python_sparse
jina/logging/profile.py
jina-ai/jina
train
20,687
675ad4f30b9e3eade9e5f6fadef41448b785903e
[ "super(RandAugment, self).__init__()\nself.num_layers = num_layers\nself.magnitude = float(magnitude)\nself.cutout_const = float(cutout_const)\nself.translate_const = float(translate_const)\nself.available_ops = ['AutoContrast', 'Equalize', 'Invert', 'Rotate', 'Posterize', 'Solarize', 'Color', 'Contrast', 'Brightne...
<|body_start_0|> super(RandAugment, self).__init__() self.num_layers = num_layers self.magnitude = float(magnitude) self.cutout_const = float(cutout_const) self.translate_const = float(translate_const) self.available_ops = ['AutoContrast', 'Equalize', 'Invert', 'Rotate', ...
Applies the RandAugment policy to images. RandAugment is from the paper https://arxiv.org/abs/1909.13719,
RandAugment
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandAugment: """Applies the RandAugment policy to images. RandAugment is from the paper https://arxiv.org/abs/1909.13719,""" def __init__(self, num_layers: int=2, magnitude: float=10.0, cutout_const: float=40.0, translate_const: float=100.0): """Applies the RandAugment policy to imag...
stack_v2_sparse_classes_36k_train_020204
34,821
permissive
[ { "docstring": "Applies the RandAugment policy to images. Args: num_layers: Integer, the number of augmentation transformations to apply sequentially to an image. Represented as (N) in the paper. Usually best values will be in the range [1, 3]. magnitude: Integer, shared magnitude across all augmentation operat...
2
null
Implement the Python class `RandAugment` described below. Class description: Applies the RandAugment policy to images. RandAugment is from the paper https://arxiv.org/abs/1909.13719, Method signatures and docstrings: - def __init__(self, num_layers: int=2, magnitude: float=10.0, cutout_const: float=40.0, translate_co...
Implement the Python class `RandAugment` described below. Class description: Applies the RandAugment policy to images. RandAugment is from the paper https://arxiv.org/abs/1909.13719, Method signatures and docstrings: - def __init__(self, num_layers: int=2, magnitude: float=10.0, cutout_const: float=40.0, translate_co...
a5388a45f71a949639b35cc5b990bd130d2d8164
<|skeleton|> class RandAugment: """Applies the RandAugment policy to images. RandAugment is from the paper https://arxiv.org/abs/1909.13719,""" def __init__(self, num_layers: int=2, magnitude: float=10.0, cutout_const: float=40.0, translate_const: float=100.0): """Applies the RandAugment policy to imag...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RandAugment: """Applies the RandAugment policy to images. RandAugment is from the paper https://arxiv.org/abs/1909.13719,""" def __init__(self, num_layers: int=2, magnitude: float=10.0, cutout_const: float=40.0, translate_const: float=100.0): """Applies the RandAugment policy to images. Args: num...
the_stack_v2_python_sparse
TensorFlow2/Classification/ConvNets/dataloader/augment.py
NVIDIA/DeepLearningExamples
train
11,838
7d3ee167cc029aed8b190f5d6ae14b07ae6a2449
[ "if not jwt.validate_roles([COLIN_SVC_ROLE]):\n return (jsonify({'message': 'You are not authorized to update the colin id'}), HTTPStatus.UNAUTHORIZED)\nidentifiers = []\nbussinesses_no_taxid = Business.get_all_by_no_tax_id()\nfor business in bussinesses_no_taxid:\n identifiers.append(business.identifier)\nre...
<|body_start_0|> if not jwt.validate_roles([COLIN_SVC_ROLE]): return (jsonify({'message': 'You are not authorized to update the colin id'}), HTTPStatus.UNAUTHORIZED) identifiers = [] bussinesses_no_taxid = Business.get_all_by_no_tax_id() for business in bussinesses_no_taxid: ...
Internal information about businesses.
InternalBusinessResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InternalBusinessResource: """Internal information about businesses.""" def get(): """Return all identifiers with no tax_id set that are supposed to have a tax_id. Excludes COOPS because they do not get a tax id/business number. Excludes SP/GP we don't sync firm to colin and we use en...
stack_v2_sparse_classes_36k_train_020205
3,008
permissive
[ { "docstring": "Return all identifiers with no tax_id set that are supposed to have a tax_id. Excludes COOPS because they do not get a tax id/business number. Excludes SP/GP we don't sync firm to colin and we use entity-bn to get tax id/business number.", "name": "get", "signature": "def get()" }, {...
2
stack_v2_sparse_classes_30k_train_010710
Implement the Python class `InternalBusinessResource` described below. Class description: Internal information about businesses. Method signatures and docstrings: - def get(): Return all identifiers with no tax_id set that are supposed to have a tax_id. Excludes COOPS because they do not get a tax id/business number....
Implement the Python class `InternalBusinessResource` described below. Class description: Internal information about businesses. Method signatures and docstrings: - def get(): Return all identifiers with no tax_id set that are supposed to have a tax_id. Excludes COOPS because they do not get a tax id/business number....
d90f11a7b14411b02c07fe97d2c1fc31cd4a9b32
<|skeleton|> class InternalBusinessResource: """Internal information about businesses.""" def get(): """Return all identifiers with no tax_id set that are supposed to have a tax_id. Excludes COOPS because they do not get a tax id/business number. Excludes SP/GP we don't sync firm to colin and we use en...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InternalBusinessResource: """Internal information about businesses.""" def get(): """Return all identifiers with no tax_id set that are supposed to have a tax_id. Excludes COOPS because they do not get a tax id/business number. Excludes SP/GP we don't sync firm to colin and we use entity-bn to ge...
the_stack_v2_python_sparse
legal-api/src/legal_api/resources/v1/business/internal_services.py
bcgov/lear
train
13
28feb96e7d4d5f465e41ecd6ce200234293caae8
[ "try:\n if not self.plugin.all_required_connections_connected:\n self.plugin.raise_missing_inputs()\n if not self.plugin.initialized:\n self.plugin.initialize_plugin()\n self.plugin.initialized = True\n if not self.plugin.failure_occurred:\n self.plugin.initialize_connection(con...
<|body_start_0|> try: if not self.plugin.all_required_connections_connected: self.plugin.raise_missing_inputs() if not self.plugin.initialized: self.plugin.initialize_plugin() self.plugin.initialized = True if not self.plugin.fa...
Callback strategy for workflow runs.
WorkflowRunConnectionCallbackStrategy
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkflowRunConnectionCallbackStrategy: """Callback strategy for workflow runs.""" def connection_initialized_callback(self, connection: ConnectionInterface, **_: Any) -> None: """Run callback for connection initialization.""" <|body_0|> def record_received_callback(self,...
stack_v2_sparse_classes_36k_train_020206
5,104
permissive
[ { "docstring": "Run callback for connection initialization.", "name": "connection_initialized_callback", "signature": "def connection_initialized_callback(self, connection: ConnectionInterface, **_: Any) -> None" }, { "docstring": "Process single records by batch size.", "name": "record_rece...
3
stack_v2_sparse_classes_30k_test_001064
Implement the Python class `WorkflowRunConnectionCallbackStrategy` described below. Class description: Callback strategy for workflow runs. Method signatures and docstrings: - def connection_initialized_callback(self, connection: ConnectionInterface, **_: Any) -> None: Run callback for connection initialization. - de...
Implement the Python class `WorkflowRunConnectionCallbackStrategy` described below. Class description: Callback strategy for workflow runs. Method signatures and docstrings: - def connection_initialized_callback(self, connection: ConnectionInterface, **_: Any) -> None: Run callback for connection initialization. - de...
16533e22e3cbe36621328d94500a6e58ec0c73ea
<|skeleton|> class WorkflowRunConnectionCallbackStrategy: """Callback strategy for workflow runs.""" def connection_initialized_callback(self, connection: ConnectionInterface, **_: Any) -> None: """Run callback for connection initialization.""" <|body_0|> def record_received_callback(self,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WorkflowRunConnectionCallbackStrategy: """Callback strategy for workflow runs.""" def connection_initialized_callback(self, connection: ConnectionInterface, **_: Any) -> None: """Run callback for connection initialization.""" try: if not self.plugin.all_required_connections_co...
the_stack_v2_python_sparse
ayx_blackbird/core/connection_callback_strategy.py
dme722/ayx-blackbird
train
14
fd94796047c557b42d455180121d18b4c96ee72f
[ "from scoop.content.models.content import Content\nuuid = self.value\nstyle = self.kwargs.get('style', 'link')\ncontents = Content.objects.visible().filter(uuid=uuid)\ncontent = contents[0] if contents.exists() else None\nreturn {'content': content, 'style': style}", "base = super(ContentInline, self).get_templat...
<|body_start_0|> from scoop.content.models.content import Content uuid = self.value style = self.kwargs.get('style', 'link') contents = Content.objects.visible().filter(uuid=uuid) content = contents[0] if contents.exists() else None return {'content': content, 'style': st...
Inline d'insertion de contenus Format : {{content uuid [style=stylename]}} Exemple : {{content identifier style="link"}}
ContentInline
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContentInline: """Inline d'insertion de contenus Format : {{content uuid [style=stylename]}} Exemple : {{content identifier style="link"}}""" def get_context(self): """Renvoyer un contexte pour le rendu de l'inline""" <|body_0|> def get_template_name(self): """Re...
stack_v2_sparse_classes_36k_train_020207
6,816
no_license
[ { "docstring": "Renvoyer un contexte pour le rendu de l'inline", "name": "get_context", "signature": "def get_context(self)" }, { "docstring": "Renvoyer le chemin du template", "name": "get_template_name", "signature": "def get_template_name(self)" } ]
2
stack_v2_sparse_classes_30k_train_000412
Implement the Python class `ContentInline` described below. Class description: Inline d'insertion de contenus Format : {{content uuid [style=stylename]}} Exemple : {{content identifier style="link"}} Method signatures and docstrings: - def get_context(self): Renvoyer un contexte pour le rendu de l'inline - def get_te...
Implement the Python class `ContentInline` described below. Class description: Inline d'insertion de contenus Format : {{content uuid [style=stylename]}} Exemple : {{content identifier style="link"}} Method signatures and docstrings: - def get_context(self): Renvoyer un contexte pour le rendu de l'inline - def get_te...
8cef6f6e89c1990e2b25f83e54e0c3481d83b6d7
<|skeleton|> class ContentInline: """Inline d'insertion de contenus Format : {{content uuid [style=stylename]}} Exemple : {{content identifier style="link"}}""" def get_context(self): """Renvoyer un contexte pour le rendu de l'inline""" <|body_0|> def get_template_name(self): """Re...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ContentInline: """Inline d'insertion de contenus Format : {{content uuid [style=stylename]}} Exemple : {{content identifier style="link"}}""" def get_context(self): """Renvoyer un contexte pour le rendu de l'inline""" from scoop.content.models.content import Content uuid = self.va...
the_stack_v2_python_sparse
scoop/content/util/inlines.py
artscoop/scoop
train
0
cd925eff3cbd9ad5d9a16f17279d7cab57166259
[ "self._attr_name = name\nself._code = code\nself._mode = mode\nself._url = url\nself._alarm = concord232_client.Client(self._url)\nself._alarm.partitions = self._alarm.list_partitions()", "try:\n part = self._alarm.list_partitions()[0]\nexcept requests.exceptions.ConnectionError as ex:\n _LOGGER.error('Unab...
<|body_start_0|> self._attr_name = name self._code = code self._mode = mode self._url = url self._alarm = concord232_client.Client(self._url) self._alarm.partitions = self._alarm.list_partitions() <|end_body_0|> <|body_start_1|> try: part = self._alar...
Representation of the Concord232-based alarm panel.
Concord232Alarm
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Concord232Alarm: """Representation of the Concord232-based alarm panel.""" def __init__(self, url, name, code, mode): """Initialize the Concord232 alarm panel.""" <|body_0|> def update(self) -> None: """Update values from API.""" <|body_1|> def alarm...
stack_v2_sparse_classes_36k_train_020208
4,646
permissive
[ { "docstring": "Initialize the Concord232 alarm panel.", "name": "__init__", "signature": "def __init__(self, url, name, code, mode)" }, { "docstring": "Update values from API.", "name": "update", "signature": "def update(self) -> None" }, { "docstring": "Send disarm command.", ...
6
null
Implement the Python class `Concord232Alarm` described below. Class description: Representation of the Concord232-based alarm panel. Method signatures and docstrings: - def __init__(self, url, name, code, mode): Initialize the Concord232 alarm panel. - def update(self) -> None: Update values from API. - def alarm_dis...
Implement the Python class `Concord232Alarm` described below. Class description: Representation of the Concord232-based alarm panel. Method signatures and docstrings: - def __init__(self, url, name, code, mode): Initialize the Concord232 alarm panel. - def update(self) -> None: Update values from API. - def alarm_dis...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class Concord232Alarm: """Representation of the Concord232-based alarm panel.""" def __init__(self, url, name, code, mode): """Initialize the Concord232 alarm panel.""" <|body_0|> def update(self) -> None: """Update values from API.""" <|body_1|> def alarm...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Concord232Alarm: """Representation of the Concord232-based alarm panel.""" def __init__(self, url, name, code, mode): """Initialize the Concord232 alarm panel.""" self._attr_name = name self._code = code self._mode = mode self._url = url self._alarm = conco...
the_stack_v2_python_sparse
homeassistant/components/concord232/alarm_control_panel.py
home-assistant/core
train
35,501
aa7d5a9ed75cd67ceb0449e7ba15b5592f61ec03
[ "ret = s[-1]\nfor j in range(len(s) - 2, -1, -1):\n if ord(s[j]) < ord(ret[0]):\n pass\n elif ord(s[j]) > ord(ret[0]):\n ret = s[j:]\n else:\n update = False\n for i in range(1, len(ret)):\n if ord(s[j + i]) > ord(ret[i]):\n ret = s[j:]\n ...
<|body_start_0|> ret = s[-1] for j in range(len(s) - 2, -1, -1): if ord(s[j]) < ord(ret[0]): pass elif ord(s[j]) > ord(ret[0]): ret = s[j:] else: update = False for i in range(1, len(ret)): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lastSubstring_timeout(self, s: str) -> str: """Time-out.""" <|body_0|> def lastSubstring_timeout2(self, s: str) -> str: """Time-out.""" <|body_1|> def lastSubstring(self, s: str) -> str: """official solution.""" <|body_2|> ...
stack_v2_sparse_classes_36k_train_020209
2,949
no_license
[ { "docstring": "Time-out.", "name": "lastSubstring_timeout", "signature": "def lastSubstring_timeout(self, s: str) -> str" }, { "docstring": "Time-out.", "name": "lastSubstring_timeout2", "signature": "def lastSubstring_timeout2(self, s: str) -> str" }, { "docstring": "official s...
3
stack_v2_sparse_classes_30k_train_000056
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lastSubstring_timeout(self, s: str) -> str: Time-out. - def lastSubstring_timeout2(self, s: str) -> str: Time-out. - def lastSubstring(self, s: str) -> str: official solution...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lastSubstring_timeout(self, s: str) -> str: Time-out. - def lastSubstring_timeout2(self, s: str) -> str: Time-out. - def lastSubstring(self, s: str) -> str: official solution...
1007197ff0feda35001c0aaf13382af6869869b2
<|skeleton|> class Solution: def lastSubstring_timeout(self, s: str) -> str: """Time-out.""" <|body_0|> def lastSubstring_timeout2(self, s: str) -> str: """Time-out.""" <|body_1|> def lastSubstring(self, s: str) -> str: """official solution.""" <|body_2|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def lastSubstring_timeout(self, s: str) -> str: """Time-out.""" ret = s[-1] for j in range(len(s) - 2, -1, -1): if ord(s[j]) < ord(ret[0]): pass elif ord(s[j]) > ord(ret[0]): ret = s[j:] else: ...
the_stack_v2_python_sparse
No1163. Last Substring in Lexicographical Order.py
chenxy3791/leetcode
train
0
eef931d2963599de3cceb805614f7fc79c9b8a86
[ "i = 0\nfor j in range(1, len(nums)):\n if nums[j] != nums[j - 1]:\n nums[i + 1] = nums[j]\n i += 1\n j += 1\nreturn i + 1", "i = 0\nfor num in nums[1:]:\n if nums[i] != num:\n i += 1\n nums[i] = num\nreturn i + 1" ]
<|body_start_0|> i = 0 for j in range(1, len(nums)): if nums[j] != nums[j - 1]: nums[i + 1] = nums[j] i += 1 j += 1 return i + 1 <|end_body_0|> <|body_start_1|> i = 0 for num in nums[1:]: if nums[i] != num: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeDuplicatesV1(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def removeDuplicates(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> i = 0 for j in range(1, l...
stack_v2_sparse_classes_36k_train_020210
587
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "removeDuplicatesV1", "signature": "def removeDuplicatesV1(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "removeDuplicates", "signature": "def removeDuplicates(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeDuplicatesV1(self, nums): :type nums: List[int] :rtype: int - def removeDuplicates(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeDuplicatesV1(self, nums): :type nums: List[int] :rtype: int - def removeDuplicates(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def...
057ed5c6fe19268f36a1d5051d27b07aae0b63e0
<|skeleton|> class Solution: def removeDuplicatesV1(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def removeDuplicates(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def removeDuplicatesV1(self, nums): """:type nums: List[int] :rtype: int""" i = 0 for j in range(1, len(nums)): if nums[j] != nums[j - 1]: nums[i + 1] = nums[j] i += 1 j += 1 return i + 1 def removeDuplicate...
the_stack_v2_python_sparse
2020/2020-01/23/eugene.py
wavetogether/wave_algorithm_challenge
train
3
288c11ad1b4f875bbeb199bc49397a132f52b121
[ "super().__init__(session_factory)\nself.coin_category = 'BTC'\nself.chain_api = BtcOP(config)", "now = datetime.datetime.now()\naccount_name = '{}_{}_{}_{}'.format(self.coin_category, now.strftime('%Y%m%d'), cnt, now.timestamp())\nret = copy.deepcopy(self._address_template)\nret['account'] = account_name\npub_ad...
<|body_start_0|> super().__init__(session_factory) self.coin_category = 'BTC' self.chain_api = BtcOP(config) <|end_body_0|> <|body_start_1|> now = datetime.datetime.now() account_name = '{}_{}_{}_{}'.format(self.coin_category, now.strftime('%Y%m%d'), cnt, now.timestamp()) ...
BtcManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BtcManager: def __init__(self, session_factory): """:param session_factory: mysql_session_maker""" <|body_0|> def generate_address(self, cnt: int) -> dict: """产生比特币地址账户 :param cnt: 编号 :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> super()....
stack_v2_sparse_classes_36k_train_020211
1,363
no_license
[ { "docstring": ":param session_factory: mysql_session_maker", "name": "__init__", "signature": "def __init__(self, session_factory)" }, { "docstring": "产生比特币地址账户 :param cnt: 编号 :return:", "name": "generate_address", "signature": "def generate_address(self, cnt: int) -> dict" } ]
2
null
Implement the Python class `BtcManager` described below. Class description: Implement the BtcManager class. Method signatures and docstrings: - def __init__(self, session_factory): :param session_factory: mysql_session_maker - def generate_address(self, cnt: int) -> dict: 产生比特币地址账户 :param cnt: 编号 :return:
Implement the Python class `BtcManager` described below. Class description: Implement the BtcManager class. Method signatures and docstrings: - def __init__(self, session_factory): :param session_factory: mysql_session_maker - def generate_address(self, cnt: int) -> dict: 产生比特币地址账户 :param cnt: 编号 :return: <|skeleton...
4ddca9c77c2361a8b9f0a708353809449094137d
<|skeleton|> class BtcManager: def __init__(self, session_factory): """:param session_factory: mysql_session_maker""" <|body_0|> def generate_address(self, cnt: int) -> dict: """产生比特币地址账户 :param cnt: 编号 :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BtcManager: def __init__(self, session_factory): """:param session_factory: mysql_session_maker""" super().__init__(session_factory) self.coin_category = 'BTC' self.chain_api = BtcOP(config) def generate_address(self, cnt: int) -> dict: """产生比特币地址账户 :param cnt: 编号 ...
the_stack_v2_python_sparse
source/common/address_manager/btc.py
buyongji/wallet
train
1
9dec40dadc125caeb3f504abbcc62bbf2645d2c3
[ "vertex = set(range(1, N + 1))\nedge_out = []\nedge_in = []\nfor vo, vi in trust:\n edge_out.append(vo)\n edge_in.append(vi)\nedge_zero_outdegree = vertex.difference(edge_out)\nif len(edge_zero_outdegree) == 1:\n town_judge = edge_zero_outdegree.pop()\nelse:\n return -1\nif edge_in.count(town_judge) == ...
<|body_start_0|> vertex = set(range(1, N + 1)) edge_out = [] edge_in = [] for vo, vi in trust: edge_out.append(vo) edge_in.append(vi) edge_zero_outdegree = vertex.difference(edge_out) if len(edge_zero_outdegree) == 1: town_judge = edge_...
Solution
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findJudge(self, N, trust): """direct modelling a graph""" <|body_0|> def findJudge2(self, N, trust): """calculate deg_diff = in_deg - out_dig""" <|body_1|> def findJudge3(self, N, trust): """calculate indegree firstly by adjacency m...
stack_v2_sparse_classes_36k_train_020212
2,581
permissive
[ { "docstring": "direct modelling a graph", "name": "findJudge", "signature": "def findJudge(self, N, trust)" }, { "docstring": "calculate deg_diff = in_deg - out_dig", "name": "findJudge2", "signature": "def findJudge2(self, N, trust)" }, { "docstring": "calculate indegree firstl...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findJudge(self, N, trust): direct modelling a graph - def findJudge2(self, N, trust): calculate deg_diff = in_deg - out_dig - def findJudge3(self, N, trust): calculate indegr...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findJudge(self, N, trust): direct modelling a graph - def findJudge2(self, N, trust): calculate deg_diff = in_deg - out_dig - def findJudge3(self, N, trust): calculate indegr...
49a0b03c55d8a702785888d473ef96539265ce9c
<|skeleton|> class Solution: def findJudge(self, N, trust): """direct modelling a graph""" <|body_0|> def findJudge2(self, N, trust): """calculate deg_diff = in_deg - out_dig""" <|body_1|> def findJudge3(self, N, trust): """calculate indegree firstly by adjacency m...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findJudge(self, N, trust): """direct modelling a graph""" vertex = set(range(1, N + 1)) edge_out = [] edge_in = [] for vo, vi in trust: edge_out.append(vo) edge_in.append(vi) edge_zero_outdegree = vertex.difference(edge_out)...
the_stack_v2_python_sparse
leetcode/0997_find_the_town_judge.py
chaosWsF/Python-Practice
train
1
25bef5ffaa3f22181dd0a148508b3d2c329959c8
[ "char_indexes = collections.defaultdict(list)\nfor idx, char in enumerate(S):\n char_indexes[char].append(idx)\nans = 0\nN = len(S)\nfor word in words:\n flag = 1\n idx_prev = -1\n for char in word:\n i = bisect.bisect_right(char_indexes[char], idx_prev)\n if i == len(char_indexes[char]):\...
<|body_start_0|> char_indexes = collections.defaultdict(list) for idx, char in enumerate(S): char_indexes[char].append(idx) ans = 0 N = len(S) for word in words: flag = 1 idx_prev = -1 for char in word: i = bisect.bi...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numMatchingSubseq(self, S: str, words: List[str]) -> int: """1. store the indexes of all chars in ascending order 2. given a query word "...xy...", the index that y appears in S should be larger than the index appears in S 3. scan the word char by char, and for the current ...
stack_v2_sparse_classes_36k_train_020213
2,382
no_license
[ { "docstring": "1. store the indexes of all chars in ascending order 2. given a query word \"...xy...\", the index that y appears in S should be larger than the index appears in S 3. scan the word char by char, and for the current char x record the smallest index it appears in S called i_x, for the next char y,...
2
stack_v2_sparse_classes_30k_train_001938
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numMatchingSubseq(self, S: str, words: List[str]) -> int: 1. store the indexes of all chars in ascending order 2. given a query word "...xy...", the index that y appears in S...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numMatchingSubseq(self, S: str, words: List[str]) -> int: 1. store the indexes of all chars in ascending order 2. given a query word "...xy...", the index that y appears in S...
6ff1941ff213a843013100ac7033e2d4f90fbd6a
<|skeleton|> class Solution: def numMatchingSubseq(self, S: str, words: List[str]) -> int: """1. store the indexes of all chars in ascending order 2. given a query word "...xy...", the index that y appears in S should be larger than the index appears in S 3. scan the word char by char, and for the current ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def numMatchingSubseq(self, S: str, words: List[str]) -> int: """1. store the indexes of all chars in ascending order 2. given a query word "...xy...", the index that y appears in S should be larger than the index appears in S 3. scan the word char by char, and for the current char x record ...
the_stack_v2_python_sparse
Leetcode 0792. Number of Matching Subsequences.py
Chaoran-sjsu/leetcode
train
0
0c3c1cd131a9b48e3fb2161f5c4ba03364623892
[ "self.copy_only_backup = copy_only_backup\nself.disable_metadata = disable_metadata\nself.disable_notification = disable_notification\nself.excluded_vss_writers = excluded_vss_writers", "if dictionary is None:\n return None\ncopy_only_backup = dictionary.get('copyOnlyBackup')\ndisable_metadata = dictionary.get...
<|body_start_0|> self.copy_only_backup = copy_only_backup self.disable_metadata = disable_metadata self.disable_notification = disable_notification self.excluded_vss_writers = excluded_vss_writers <|end_body_0|> <|body_start_1|> if dictionary is None: return None ...
Implementation of the 'WindowsHostSnapshotParameters' model. Specifies settings that are meaningful only on Windows hosts. Attributes: copy_only_backup (bool): Specifies whether to backup regardless of the state of each file's backup history. Backup history will not be updated. Refer Microsoft documentation on VSS_BT_C...
WindowsHostSnapshotParameters
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WindowsHostSnapshotParameters: """Implementation of the 'WindowsHostSnapshotParameters' model. Specifies settings that are meaningful only on Windows hosts. Attributes: copy_only_backup (bool): Specifies whether to backup regardless of the state of each file's backup history. Backup history will ...
stack_v2_sparse_classes_36k_train_020214
2,957
permissive
[ { "docstring": "Constructor for the WindowsHostSnapshotParameters class", "name": "__init__", "signature": "def __init__(self, copy_only_backup=None, disable_metadata=None, disable_notification=None, excluded_vss_writers=None)" }, { "docstring": "Creates an instance of this model from a dictiona...
2
stack_v2_sparse_classes_30k_train_018255
Implement the Python class `WindowsHostSnapshotParameters` described below. Class description: Implementation of the 'WindowsHostSnapshotParameters' model. Specifies settings that are meaningful only on Windows hosts. Attributes: copy_only_backup (bool): Specifies whether to backup regardless of the state of each file...
Implement the Python class `WindowsHostSnapshotParameters` described below. Class description: Implementation of the 'WindowsHostSnapshotParameters' model. Specifies settings that are meaningful only on Windows hosts. Attributes: copy_only_backup (bool): Specifies whether to backup regardless of the state of each file...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class WindowsHostSnapshotParameters: """Implementation of the 'WindowsHostSnapshotParameters' model. Specifies settings that are meaningful only on Windows hosts. Attributes: copy_only_backup (bool): Specifies whether to backup regardless of the state of each file's backup history. Backup history will ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WindowsHostSnapshotParameters: """Implementation of the 'WindowsHostSnapshotParameters' model. Specifies settings that are meaningful only on Windows hosts. Attributes: copy_only_backup (bool): Specifies whether to backup regardless of the state of each file's backup history. Backup history will not be update...
the_stack_v2_python_sparse
cohesity_management_sdk/models/windows_host_snapshot_parameters.py
cohesity/management-sdk-python
train
24
334293a772a2a72baeeaaecdc4d7039d8ec914c9
[ "self.name = name\nself.index = index\nself.start = start[0]\nself.end = end[0]\nself.start_sub = start[1] if len(start) > 1 else False\nself.end_sub = end[1] if len(end) > 1 else False\nself.export = export_names.get(self.name, self.name)\nself.is_header = is_header\nself.node = None\nself.overlap_id = None", "i...
<|body_start_0|> self.name = name self.index = index self.start = start[0] self.end = end[0] self.start_sub = start[1] if len(start) > 1 else False self.end_sub = end[1] if len(end) > 1 else False self.export = export_names.get(self.name, self.name) self.i...
Object to store span information.
Span
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Span: """Object to store span information.""" def __init__(self, name, index, start, end, export_names, is_header): """Set attributes.""" <|body_0|> def set_node(self, parent_node=None): """Create an XML node under parent_node.""" <|body_1|> def __re...
stack_v2_sparse_classes_36k_train_020215
32,149
permissive
[ { "docstring": "Set attributes.", "name": "__init__", "signature": "def __init__(self, name, index, start, end, export_names, is_header)" }, { "docstring": "Create an XML node under parent_node.", "name": "set_node", "signature": "def set_node(self, parent_node=None)" }, { "docst...
4
stack_v2_sparse_classes_30k_train_001995
Implement the Python class `Span` described below. Class description: Object to store span information. Method signatures and docstrings: - def __init__(self, name, index, start, end, export_names, is_header): Set attributes. - def set_node(self, parent_node=None): Create an XML node under parent_node. - def __repr__...
Implement the Python class `Span` described below. Class description: Object to store span information. Method signatures and docstrings: - def __init__(self, name, index, start, end, export_names, is_header): Set attributes. - def set_node(self, parent_node=None): Create an XML node under parent_node. - def __repr__...
d3eb0db9de7fca6b6945192dd7f0c9e4bbeebb55
<|skeleton|> class Span: """Object to store span information.""" def __init__(self, name, index, start, end, export_names, is_header): """Set attributes.""" <|body_0|> def set_node(self, parent_node=None): """Create an XML node under parent_node.""" <|body_1|> def __re...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Span: """Object to store span information.""" def __init__(self, name, index, start, end, export_names, is_header): """Set attributes.""" self.name = name self.index = index self.start = start[0] self.end = end[0] self.start_sub = start[1] if len(start) > 1...
the_stack_v2_python_sparse
sparv/api/util/export.py
spraakbanken/sparv-pipeline
train
22
ec5517594e60598716c98dedc1bda0ca3150ead9
[ "mem = {}\nwords = {w for w in wordDict}\n\ndef dfs(s):\n if s in mem:\n return mem[s]\n for i in range(0, len(s)):\n mem[s[0:i]] = dfs(s[0:i])\n if mem[s[0:i]] and s[i:len(s)] in words:\n return True\n return False\nreturn dfs(s)", "words = {w for w in wordDict}\nOK = [Fa...
<|body_start_0|> mem = {} words = {w for w in wordDict} def dfs(s): if s in mem: return mem[s] for i in range(0, len(s)): mem[s[0:i]] = dfs(s[0:i]) if mem[s[0:i]] and s[i:len(s)] in words: return True ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def wordBreak(self, s, wordDict): """:type s: str :type wordDict: List[str] :rtype: bool""" <|body_0|> def wordBreak2(self, s, wordDict): """:type s: str :type wordDict: List[str] :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_020216
1,062
no_license
[ { "docstring": ":type s: str :type wordDict: List[str] :rtype: bool", "name": "wordBreak", "signature": "def wordBreak(self, s, wordDict)" }, { "docstring": ":type s: str :type wordDict: List[str] :rtype: bool", "name": "wordBreak2", "signature": "def wordBreak2(self, s, wordDict)" } ]
2
stack_v2_sparse_classes_30k_val_000931
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wordBreak(self, s, wordDict): :type s: str :type wordDict: List[str] :rtype: bool - def wordBreak2(self, s, wordDict): :type s: str :type wordDict: List[str] :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wordBreak(self, s, wordDict): :type s: str :type wordDict: List[str] :rtype: bool - def wordBreak2(self, s, wordDict): :type s: str :type wordDict: List[str] :rtype: bool <|...
0fc972e5cd2baf1b5ddf8b192962629f40bc3bf4
<|skeleton|> class Solution: def wordBreak(self, s, wordDict): """:type s: str :type wordDict: List[str] :rtype: bool""" <|body_0|> def wordBreak2(self, s, wordDict): """:type s: str :type wordDict: List[str] :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def wordBreak(self, s, wordDict): """:type s: str :type wordDict: List[str] :rtype: bool""" mem = {} words = {w for w in wordDict} def dfs(s): if s in mem: return mem[s] for i in range(0, len(s)): mem[s[0:i]] = ...
the_stack_v2_python_sparse
problems/139. Word Break.py
yukiii-zhong/Leetcode
train
2
71bdc1caf1d9eae962a78a5f1770ec33419b3a3f
[ "self._bulb = bulb\nself._attr_available = False\nself._attr_unique_id = mac\nself._attr_hs_color = (0, 0)\nself._attr_device_info = DeviceInfo(identifiers={(DOMAIN, mac)}, name=name, manufacturer=MANUFACTURER, sw_version=self._bulb.firmware)", "brightness = kwargs.get(ATTR_BRIGHTNESS, 255)\neffect = kwargs.get(A...
<|body_start_0|> self._bulb = bulb self._attr_available = False self._attr_unique_id = mac self._attr_hs_color = (0, 0) self._attr_device_info = DeviceInfo(identifiers={(DOMAIN, mac)}, name=name, manufacturer=MANUFACTURER, sw_version=self._bulb.firmware) <|end_body_0|> <|body_st...
Representation of the myStrom WiFi bulb.
MyStromLight
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyStromLight: """Representation of the myStrom WiFi bulb.""" def __init__(self, bulb, name, mac): """Initialize the light.""" <|body_0|> async def async_turn_on(self, **kwargs: Any) -> None: """Turn on the light.""" <|body_1|> async def async_turn_of...
stack_v2_sparse_classes_36k_train_020217
5,342
permissive
[ { "docstring": "Initialize the light.", "name": "__init__", "signature": "def __init__(self, bulb, name, mac)" }, { "docstring": "Turn on the light.", "name": "async_turn_on", "signature": "async def async_turn_on(self, **kwargs: Any) -> None" }, { "docstring": "Turn off the bulb...
4
null
Implement the Python class `MyStromLight` described below. Class description: Representation of the myStrom WiFi bulb. Method signatures and docstrings: - def __init__(self, bulb, name, mac): Initialize the light. - async def async_turn_on(self, **kwargs: Any) -> None: Turn on the light. - async def async_turn_off(se...
Implement the Python class `MyStromLight` described below. Class description: Representation of the myStrom WiFi bulb. Method signatures and docstrings: - def __init__(self, bulb, name, mac): Initialize the light. - async def async_turn_on(self, **kwargs: Any) -> None: Turn on the light. - async def async_turn_off(se...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class MyStromLight: """Representation of the myStrom WiFi bulb.""" def __init__(self, bulb, name, mac): """Initialize the light.""" <|body_0|> async def async_turn_on(self, **kwargs: Any) -> None: """Turn on the light.""" <|body_1|> async def async_turn_of...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyStromLight: """Representation of the myStrom WiFi bulb.""" def __init__(self, bulb, name, mac): """Initialize the light.""" self._bulb = bulb self._attr_available = False self._attr_unique_id = mac self._attr_hs_color = (0, 0) self._attr_device_info = Dev...
the_stack_v2_python_sparse
homeassistant/components/mystrom/light.py
home-assistant/core
train
35,501
d44bebf2262a95c1571c2393768b4c22004f2fc0
[ "result = empty_result()\nresult['data'] = {'linknets': []}\nwith sqla_session() as session:\n instance = session.query(Linknet).filter(Linknet.id == linknet_id).one_or_none()\n if instance:\n result['data']['linknets'].append(instance.as_dict())\n else:\n return (empty_result('error', 'Linkn...
<|body_start_0|> result = empty_result() result['data'] = {'linknets': []} with sqla_session() as session: instance = session.query(Linknet).filter(Linknet.id == linknet_id).one_or_none() if instance: result['data']['linknets'].append(instance.as_dict()) ...
LinknetByIdApi
[ "BSD-2-Clause-Views", "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinknetByIdApi: def get(self, linknet_id): """Get a single specified linknet""" <|body_0|> def delete(self, linknet_id): """Remove a linknet""" <|body_1|> def put(self, linknet_id): """Update data on existing linknet""" <|body_2|> <|end_...
stack_v2_sparse_classes_36k_train_020218
11,188
permissive
[ { "docstring": "Get a single specified linknet", "name": "get", "signature": "def get(self, linknet_id)" }, { "docstring": "Remove a linknet", "name": "delete", "signature": "def delete(self, linknet_id)" }, { "docstring": "Update data on existing linknet", "name": "put", ...
3
stack_v2_sparse_classes_30k_train_008446
Implement the Python class `LinknetByIdApi` described below. Class description: Implement the LinknetByIdApi class. Method signatures and docstrings: - def get(self, linknet_id): Get a single specified linknet - def delete(self, linknet_id): Remove a linknet - def put(self, linknet_id): Update data on existing linkne...
Implement the Python class `LinknetByIdApi` described below. Class description: Implement the LinknetByIdApi class. Method signatures and docstrings: - def get(self, linknet_id): Get a single specified linknet - def delete(self, linknet_id): Remove a linknet - def put(self, linknet_id): Update data on existing linkne...
d755dfed69bebe0c7bea66ad1802cba2cd89fec8
<|skeleton|> class LinknetByIdApi: def get(self, linknet_id): """Get a single specified linknet""" <|body_0|> def delete(self, linknet_id): """Remove a linknet""" <|body_1|> def put(self, linknet_id): """Update data on existing linknet""" <|body_2|> <|end_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LinknetByIdApi: def get(self, linknet_id): """Get a single specified linknet""" result = empty_result() result['data'] = {'linknets': []} with sqla_session() as session: instance = session.query(Linknet).filter(Linknet.id == linknet_id).one_or_none() if ...
the_stack_v2_python_sparse
src/cnaas_nms/api/linknet.py
SUNET/cnaas-nms
train
67
15297ba52e6b0e0daecf1743890059a7c2088174
[ "assert isinstance(name, str), 'Invalid name %s' % name\nassert isinstance(description, str), 'Invalid description %s' % description\nself.name = name.strip()\nself.description = description.strip()\nself._rights = {}\nself._defaults = []", "if isinstance(names, str):\n names = (names,)\nassert isinstance(name...
<|body_start_0|> assert isinstance(name, str), 'Invalid name %s' % name assert isinstance(description, str), 'Invalid description %s' % description self.name = name.strip() self.description = description.strip() self._rights = {} self._defaults = [] <|end_body_0|> <|body...
The ACL type model.
TypeAcl
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TypeAcl: """The ACL type model.""" def __init__(self, name, description): """Construct the type model. @param name: string The type name. @param description: string The description for the type.""" <|body_0|> def rightsFor(self, names): """Provides the rights for...
stack_v2_sparse_classes_36k_train_020219
5,791
no_license
[ { "docstring": "Construct the type model. @param name: string The type name. @param description: string The description for the type.", "name": "__init__", "signature": "def __init__(self, name, description)" }, { "docstring": "Provides the rights for the provided name(s). @param names: string|I...
4
stack_v2_sparse_classes_30k_train_017166
Implement the Python class `TypeAcl` described below. Class description: The ACL type model. Method signatures and docstrings: - def __init__(self, name, description): Construct the type model. @param name: string The type name. @param description: string The description for the type. - def rightsFor(self, names): Pr...
Implement the Python class `TypeAcl` described below. Class description: The ACL type model. Method signatures and docstrings: - def __init__(self, name, description): Construct the type model. @param name: string The type name. @param description: string The description for the type. - def rightsFor(self, names): Pr...
a10cb774c8cbc5010950eed9342413846734fea7
<|skeleton|> class TypeAcl: """The ACL type model.""" def __init__(self, name, description): """Construct the type model. @param name: string The type name. @param description: string The description for the type.""" <|body_0|> def rightsFor(self, names): """Provides the rights for...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TypeAcl: """The ACL type model.""" def __init__(self, name, description): """Construct the type model. @param name: string The type name. @param description: string The description for the type.""" assert isinstance(name, str), 'Invalid name %s' % name assert isinstance(descriptio...
the_stack_v2_python_sparse
plugins/support-acl/acl/spec.py
bonomali/Ally-Py
train
0
092bdb9a602ae0f2f00413fa5729592b6f90b7ca
[ "query = typeFor(self)\nassert isinstance(query, TypeQuery), 'Invalid query %s' % self\nfor name, value in keyargs.items():\n if name not in query.properties:\n raise ValueError(\"Invalid criteria name '%s' for %s\" % (name, query))\n setattr(self, name, value)", "entry = typeFor(ref)\nif not isinsta...
<|body_start_0|> query = typeFor(self) assert isinstance(query, TypeQuery), 'Invalid query %s' % self for name, value in keyargs.items(): if name not in query.properties: raise ValueError("Invalid criteria name '%s' for %s" % (name, query)) setattr(self, n...
Support class for queries.
Query
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Query: """Support class for queries.""" def __init__(self, **keyargs): """Construct the instance of the query by automatically setting as criterias the values provides as key arguments.""" <|body_0|> def __contains__(self, ref): """Checks if the object contains a...
stack_v2_sparse_classes_36k_train_020220
16,647
no_license
[ { "docstring": "Construct the instance of the query by automatically setting as criterias the values provides as key arguments.", "name": "__init__", "signature": "def __init__(self, **keyargs)" }, { "docstring": "Checks if the object contains a value for the property even if that value is None....
2
stack_v2_sparse_classes_30k_train_003081
Implement the Python class `Query` described below. Class description: Support class for queries. Method signatures and docstrings: - def __init__(self, **keyargs): Construct the instance of the query by automatically setting as criterias the values provides as key arguments. - def __contains__(self, ref): Checks if ...
Implement the Python class `Query` described below. Class description: Support class for queries. Method signatures and docstrings: - def __init__(self, **keyargs): Construct the instance of the query by automatically setting as criterias the values provides as key arguments. - def __contains__(self, ref): Checks if ...
e0b3466b34d31548996d57be4a9dac134d904380
<|skeleton|> class Query: """Support class for queries.""" def __init__(self, **keyargs): """Construct the instance of the query by automatically setting as criterias the values provides as key arguments.""" <|body_0|> def __contains__(self, ref): """Checks if the object contains a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Query: """Support class for queries.""" def __init__(self, **keyargs): """Construct the instance of the query by automatically setting as criterias the values provides as key arguments.""" query = typeFor(self) assert isinstance(query, TypeQuery), 'Invalid query %s' % self ...
the_stack_v2_python_sparse
components/ally-api/ally/api/operator/descriptor.py
cristidomsa/Ally-Py
train
0
77985f2176b47925ee3efd45c7aef1821181b44a
[ "self.capacity = capacity\nself.time = 0\nself.map = {}\nself.freq_time = {}\nself.priority_queue = []\nself.update = set()", "self.time += 1\nif key in self.map:\n freq, _ = self.freq_time[key]\n self.freq_time[key] = (freq + 1, self.time)\n self.update.add(key)\n return self.map[key]\nreturn -1", ...
<|body_start_0|> self.capacity = capacity self.time = 0 self.map = {} self.freq_time = {} self.priority_queue = [] self.update = set() <|end_body_0|> <|body_start_1|> self.time += 1 if key in self.map: freq, _ = self.freq_time[key] ...
LFUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LFUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k_train_020221
2,640
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: None", "name": "pu...
3
null
Implement the Python class `LFUCache` described below. Class description: Implement the LFUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None
Implement the Python class `LFUCache` described below. Class description: Implement the LFUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None <|sk...
90c000c3be70727cde4f7494fbbb1c425bfd3da4
<|skeleton|> class LFUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LFUCache: def __init__(self, capacity): """:type capacity: int""" self.capacity = capacity self.time = 0 self.map = {} self.freq_time = {} self.priority_queue = [] self.update = set() def get(self, key): """:type key: int :rtype: int""" ...
the_stack_v2_python_sparse
categories/design/460.lfu-cache.py
chenjienan/python-leetcode
train
16
1c84273a119cb53f83c6811b624b69c15f2c244f
[ "data = super(ClothingListView, self).get_context_data(**kwargs)\ndata.update({'clothing_choices': Clothing.CATEGORY_CHOICES, 'suppliers': Supplier.objects.all()})\ndata.update(self.request.GET.dict())\nreturn data", "qs = super(ClothingListView, self).get_queryset()\ncategory = self.request.REQUEST.get('category...
<|body_start_0|> data = super(ClothingListView, self).get_context_data(**kwargs) data.update({'clothing_choices': Clothing.CATEGORY_CHOICES, 'suppliers': Supplier.objects.all()}) data.update(self.request.GET.dict()) return data <|end_body_0|> <|body_start_1|> qs = super(Clothing...
Display all the clothings
ClothingListView
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClothingListView: """Display all the clothings""" def get_context_data(self, **kwargs): """Add extra data to context""" <|body_0|> def get_queryset(self): """Filter clothings""" <|body_1|> <|end_skeleton|> <|body_start_0|> data = super(ClothingL...
stack_v2_sparse_classes_36k_train_020222
4,207
permissive
[ { "docstring": "Add extra data to context", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" }, { "docstring": "Filter clothings", "name": "get_queryset", "signature": "def get_queryset(self)" } ]
2
stack_v2_sparse_classes_30k_train_011131
Implement the Python class `ClothingListView` described below. Class description: Display all the clothings Method signatures and docstrings: - def get_context_data(self, **kwargs): Add extra data to context - def get_queryset(self): Filter clothings
Implement the Python class `ClothingListView` described below. Class description: Display all the clothings Method signatures and docstrings: - def get_context_data(self, **kwargs): Add extra data to context - def get_queryset(self): Filter clothings <|skeleton|> class ClothingListView: """Display all the clothi...
0ea016745d92054bd4df8d934c1b67fd61b6f845
<|skeleton|> class ClothingListView: """Display all the clothings""" def get_context_data(self, **kwargs): """Add extra data to context""" <|body_0|> def get_queryset(self): """Filter clothings""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClothingListView: """Display all the clothings""" def get_context_data(self, **kwargs): """Add extra data to context""" data = super(ClothingListView, self).get_context_data(**kwargs) data.update({'clothing_choices': Clothing.CATEGORY_CHOICES, 'suppliers': Supplier.objects.all()})...
the_stack_v2_python_sparse
clothings/views.py
ygrass/handsome
train
0
d04194ac238a7a2440cfd83658deb2ae23d43833
[ "self.hd5_dir = hd5_dir\nself.remaining_files = 0\nself.clean_method = 'neurokit'\nself.r_method = r_method\nself.wave_method = wave_method\nself.tmaps = tmaps", "hd5_files = [os.path.join(self.hd5_dir, hd5_file) for hd5_file in os.listdir(self.hd5_dir) if hd5_file.endswith('.hd5')]\nif os.cpu_count():\n if (n...
<|body_start_0|> self.hd5_dir = hd5_dir self.remaining_files = 0 self.clean_method = 'neurokit' self.r_method = r_method self.wave_method = wave_method self.tmaps = tmaps <|end_body_0|> <|body_start_1|> hd5_files = [os.path.join(self.hd5_dir, hd5_file) for hd5_fi...
Class that calculates the P, Q, R, S and T peaks, P, QRS, T waves onsets and offsets, PR, QT, RR and QRS intervals duration and QRS amplitude from all the ecg signals of each hd5 file inside the specified directory.
ECGFeatureDirExtractor
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ECGFeatureDirExtractor: """Class that calculates the P, Q, R, S and T peaks, P, QRS, T waves onsets and offsets, PR, QT, RR and QRS intervals duration and QRS amplitude from all the ecg signals of each hd5 file inside the specified directory.""" def __init__(self, hd5_dir: str, r_method: str...
stack_v2_sparse_classes_36k_train_020223
29,592
permissive
[ { "docstring": "Init ECG Feature Dir Extractor. :param hd5_dir: <str> Full path of the directory containing the hd5 files to extract the features. :param r_method: <str> The algorithm to be used for R-peak detection. Can be one of neurokit (default), pantompkins1985, hamilton2002, christov2004, gamboa2008, elge...
3
stack_v2_sparse_classes_30k_train_002672
Implement the Python class `ECGFeatureDirExtractor` described below. Class description: Class that calculates the P, Q, R, S and T peaks, P, QRS, T waves onsets and offsets, PR, QT, RR and QRS intervals duration and QRS amplitude from all the ecg signals of each hd5 file inside the specified directory. Method signatu...
Implement the Python class `ECGFeatureDirExtractor` described below. Class description: Class that calculates the P, Q, R, S and T peaks, P, QRS, T waves onsets and offsets, PR, QT, RR and QRS intervals duration and QRS amplitude from all the ecg signals of each hd5 file inside the specified directory. Method signatu...
0e25886083ccefc6cbb6250605c58f018f70a2e9
<|skeleton|> class ECGFeatureDirExtractor: """Class that calculates the P, Q, R, S and T peaks, P, QRS, T waves onsets and offsets, PR, QT, RR and QRS intervals duration and QRS amplitude from all the ecg signals of each hd5 file inside the specified directory.""" def __init__(self, hd5_dir: str, r_method: str...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ECGFeatureDirExtractor: """Class that calculates the P, Q, R, S and T peaks, P, QRS, T waves onsets and offsets, PR, QT, RR and QRS intervals duration and QRS amplitude from all the ecg signals of each hd5 file inside the specified directory.""" def __init__(self, hd5_dir: str, r_method: str='neurokit', ...
the_stack_v2_python_sparse
tensorize/bedmaster/ecg_features_extraction.py
mit-ccrg/ml4c3-mirror
train
0
65b7a1bba22623f4d142ba71962ef1309611f289
[ "def post(node):\n return post(node.left) + post(node.right) + [node.val] if node else []\nreturn ' '.join(map(str, post(root)))", "def helper(data, lower, upper):\n if data or data[-1] < lower or data[-1] > upper:\n return None\n val = data.pop()\n node = Node(val)\n node.right = helper(val...
<|body_start_0|> def post(node): return post(node.left) + post(node.right) + [node.val] if node else [] return ' '.join(map(str, post(root))) <|end_body_0|> <|body_start_1|> def helper(data, lower, upper): if data or data[-1] < lower or data[-1] > upper: ...
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_020224
2,994
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_011508
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:...
2d5c09b63438aee7925252d5c6c4ede872bf52f1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def post(node): return post(node.left) + post(node.right) + [node.val] if node else [] return ' '.join(map(str, post(root))) def deserialize(self, data): ...
the_stack_v2_python_sparse
algorithms/google/SerializeAndDeserializeBST.py
james4388/algorithm-1
train
1
3ee5675385b4ad8e75aad1a6c3df8bf123e393ea
[ "nums.sort(reverse=True)\ncount = 0\nfor i in range(1, len(nums)):\n if nums[i] < nums[i - 1]:\n count += 1\n if count == 2:\n return nums[i]\nreturn nums[0]", "v = [float('-inf'), float('-inf'), float('-inf')]\nfor num in nums:\n if num not in v:\n if num > v[0]:\n v = [n...
<|body_start_0|> nums.sort(reverse=True) count = 0 for i in range(1, len(nums)): if nums[i] < nums[i - 1]: count += 1 if count == 2: return nums[i] return nums[0] <|end_body_0|> <|body_start_1|> v = [float('-inf'), float('-...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def thirdMax(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def thirdMax1(self, nums): """time O(n) space O(1) :type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> nums.sort(reverse=True) ...
stack_v2_sparse_classes_36k_train_020225
1,076
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "thirdMax", "signature": "def thirdMax(self, nums)" }, { "docstring": "time O(n) space O(1) :type nums: List[int] :rtype: int", "name": "thirdMax1", "signature": "def thirdMax1(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_007426
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def thirdMax(self, nums): :type nums: List[int] :rtype: int - def thirdMax1(self, nums): time O(n) space O(1) :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def thirdMax(self, nums): :type nums: List[int] :rtype: int - def thirdMax1(self, nums): time O(n) space O(1) :type nums: List[int] :rtype: int <|skeleton|> class Solution: ...
85f71621c54f6b0029f3a2746f022f89dd7419d9
<|skeleton|> class Solution: def thirdMax(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def thirdMax1(self, nums): """time O(n) space O(1) :type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def thirdMax(self, nums): """:type nums: List[int] :rtype: int""" nums.sort(reverse=True) count = 0 for i in range(1, len(nums)): if nums[i] < nums[i - 1]: count += 1 if count == 2: return nums[i] return ...
the_stack_v2_python_sparse
LeetCode/Array/414_third_maximum_number.py
XyK0907/for_work
train
0
0147b7a9eb20ff160e4be7be7c81e75fe3026f67
[ "super().__init__(base_sprite=base_sprite, sprite_scale=sprite_scale, center_x=parent.center_x + relative_x, center_y=parent.center_y + relative_y, angle=angle, speed=speed, current_health=current_health, max_health=max_health)\nself.parent = parent\nself.relative_x = relative_x\nself.relative_y = relative_y\nself....
<|body_start_0|> super().__init__(base_sprite=base_sprite, sprite_scale=sprite_scale, center_x=parent.center_x + relative_x, center_y=parent.center_y + relative_y, angle=angle, speed=speed, current_health=current_health, max_health=max_health) self.parent = parent self.relative_x = relative_x ...
Defines the child entity which inherits from the Entity class. Methods ------- get_all_parents() Returns list containing all entities higher in the inheritance order. update(time: float, sprites: SpriteContainer) logic to the Entity.update function so that the child can maintain position/angle with respect to the paren...
ChildEntity
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChildEntity: """Defines the child entity which inherits from the Entity class. Methods ------- get_all_parents() Returns list containing all entities higher in the inheritance order. update(time: float, sprites: SpriteContainer) logic to the Entity.update function so that the child can maintain p...
stack_v2_sparse_classes_36k_train_020226
21,268
no_license
[ { "docstring": "Parameters ---------- base_sprite: str The path to the file containing the sprite for this entity. sprite_scale: float The scale to draw the sprite for this entity parent: Entity The entity. relative_x: Union[float, int] The starting x position in the map for this entity. relative_y: Union[float...
3
stack_v2_sparse_classes_30k_train_006573
Implement the Python class `ChildEntity` described below. Class description: Defines the child entity which inherits from the Entity class. Methods ------- get_all_parents() Returns list containing all entities higher in the inheritance order. update(time: float, sprites: SpriteContainer) logic to the Entity.update fu...
Implement the Python class `ChildEntity` described below. Class description: Defines the child entity which inherits from the Entity class. Methods ------- get_all_parents() Returns list containing all entities higher in the inheritance order. update(time: float, sprites: SpriteContainer) logic to the Entity.update fu...
8dcd79013745b3ce1d281063bca1d431bc3bcd84
<|skeleton|> class ChildEntity: """Defines the child entity which inherits from the Entity class. Methods ------- get_all_parents() Returns list containing all entities higher in the inheritance order. update(time: float, sprites: SpriteContainer) logic to the Entity.update function so that the child can maintain p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ChildEntity: """Defines the child entity which inherits from the Entity class. Methods ------- get_all_parents() Returns list containing all entities higher in the inheritance order. update(time: float, sprites: SpriteContainer) logic to the Entity.update function so that the child can maintain position/angle...
the_stack_v2_python_sparse
DrillDungeonGame/entity/entity.py
zacholade/Drill-Dungeon-Game
train
0
ea18b7eee990330df85ed0391fd1dccf40dfe600
[ "submission = cls(submitted_by_type=submitted_by_type, submitted_by_id=submitted_by_id, question_id=question_id, solution_type=solution_type, solution=solution, status=status)\ndb.session.add(submission)\ndb.session.commit()\nreturn submission", "if sol_type == 'text':\n data = Question.get_filtertered_list(na...
<|body_start_0|> submission = cls(submitted_by_type=submitted_by_type, submitted_by_id=submitted_by_id, question_id=question_id, solution_type=solution_type, solution=solution, status=status) db.session.add(submission) db.session.commit() return submission <|end_body_0|> <|body_start_1|...
SolutionSubmission
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SolutionSubmission: def create(cls, submitted_by_type, submitted_by_id, question_id, solution_type, solution, status=None): """Create a new solution submission :param submitted_by_type: the user type who submitted :param submitted_by_id: the user id who submitted :param question_id: the ...
stack_v2_sparse_classes_36k_train_020227
3,167
no_license
[ { "docstring": "Create a new solution submission :param submitted_by_type: the user type who submitted :param submitted_by_id: the user id who submitted :param question_id: the question id this submission corresponds too :param solution_type: text/video :param solution: :param status: :return:", "name": "cr...
2
stack_v2_sparse_classes_30k_train_013153
Implement the Python class `SolutionSubmission` described below. Class description: Implement the SolutionSubmission class. Method signatures and docstrings: - def create(cls, submitted_by_type, submitted_by_id, question_id, solution_type, solution, status=None): Create a new solution submission :param submitted_by_t...
Implement the Python class `SolutionSubmission` described below. Class description: Implement the SolutionSubmission class. Method signatures and docstrings: - def create(cls, submitted_by_type, submitted_by_id, question_id, solution_type, solution, status=None): Create a new solution submission :param submitted_by_t...
c8af233693cd6a97489a2d73a85646b15220389c
<|skeleton|> class SolutionSubmission: def create(cls, submitted_by_type, submitted_by_id, question_id, solution_type, solution, status=None): """Create a new solution submission :param submitted_by_type: the user type who submitted :param submitted_by_id: the user id who submitted :param question_id: the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SolutionSubmission: def create(cls, submitted_by_type, submitted_by_id, question_id, solution_type, solution, status=None): """Create a new solution submission :param submitted_by_type: the user type who submitted :param submitted_by_id: the user id who submitted :param question_id: the question id th...
the_stack_v2_python_sparse
exam_app/models/solution_submission.py
GraphicalDot/testrocketbackend
train
0
6fadbdb7d59da050da98b6ebfaa1449f04b33e5f
[ "result = {'result': 'NG', 'error': ''}\ndata_json = request.get_json(force=True)\nflag, error = CtrlUserGroup().update_manager_group(data_json)\nif flag:\n result['result'] = 'OK'\nelse:\n result['error'] = error\nreturn result", "result = {'result': 'NG', 'error': ''}\nflag, error = CtrlUserGroup().delete...
<|body_start_0|> result = {'result': 'NG', 'error': ''} data_json = request.get_json(force=True) flag, error = CtrlUserGroup().update_manager_group(data_json) if flag: result['result'] = 'OK' else: result['error'] = error return result <|end_body_0...
项目体制组的删除与更新
ApiManagerGroup
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApiManagerGroup: """项目体制组的删除与更新""" def post(self): """更新""" <|body_0|> def delete(self, proj_id, group_id, commit_user): """删除""" <|body_1|> <|end_skeleton|> <|body_start_0|> result = {'result': 'NG', 'error': ''} data_json = request.get...
stack_v2_sparse_classes_36k_train_020228
3,031
no_license
[ { "docstring": "更新", "name": "post", "signature": "def post(self)" }, { "docstring": "删除", "name": "delete", "signature": "def delete(self, proj_id, group_id, commit_user)" } ]
2
stack_v2_sparse_classes_30k_train_008536
Implement the Python class `ApiManagerGroup` described below. Class description: 项目体制组的删除与更新 Method signatures and docstrings: - def post(self): 更新 - def delete(self, proj_id, group_id, commit_user): 删除
Implement the Python class `ApiManagerGroup` described below. Class description: 项目体制组的删除与更新 Method signatures and docstrings: - def post(self): 更新 - def delete(self, proj_id, group_id, commit_user): 删除 <|skeleton|> class ApiManagerGroup: """项目体制组的删除与更新""" def post(self): """更新""" <|body_0|>...
64b31e7bdfcb8a4c95f0a8a607f0bcff576cec11
<|skeleton|> class ApiManagerGroup: """项目体制组的删除与更新""" def post(self): """更新""" <|body_0|> def delete(self, proj_id, group_id, commit_user): """删除""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ApiManagerGroup: """项目体制组的删除与更新""" def post(self): """更新""" result = {'result': 'NG', 'error': ''} data_json = request.get_json(force=True) flag, error = CtrlUserGroup().update_manager_group(data_json) if flag: result['result'] = 'OK' else: ...
the_stack_v2_python_sparse
koala/koala_server/app/api_1_0/api_user_group.py
lsn1183/web_project
train
0
d4f4ffe0ed74f95ba95fef131d3997e8015f46f3
[ "super(MixtureDensityNet, self).__init__()\nself.n_input = n_input\nself.n_output = n_output\nself.n_component = n_component\nself.mu_linear = nn.Linear(n_input, n_output * n_component)\nself.logsigma_linear = nn.Linear(n_input, n_output * n_component)\nself.logpi_linear = nn.Linear(n_input, n_component)", "n_dat...
<|body_start_0|> super(MixtureDensityNet, self).__init__() self.n_input = n_input self.n_output = n_output self.n_component = n_component self.mu_linear = nn.Linear(n_input, n_output * n_component) self.logsigma_linear = nn.Linear(n_input, n_output * n_component) ...
MixtureDensityNet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MixtureDensityNet: def __init__(self, n_input: int, n_output: int, n_component: int): """Parameters ---------- n_input : int the dimension of input feature n_output : the dimension of output space n_component : the number of component of Gauss distribution""" <|body_0|> def ...
stack_v2_sparse_classes_36k_train_020229
1,593
permissive
[ { "docstring": "Parameters ---------- n_input : int the dimension of input feature n_output : the dimension of output space n_component : the number of component of Gauss distribution", "name": "__init__", "signature": "def __init__(self, n_input: int, n_output: int, n_component: int)" }, { "doc...
2
stack_v2_sparse_classes_30k_train_006047
Implement the Python class `MixtureDensityNet` described below. Class description: Implement the MixtureDensityNet class. Method signatures and docstrings: - def __init__(self, n_input: int, n_output: int, n_component: int): Parameters ---------- n_input : int the dimension of input feature n_output : the dimension o...
Implement the Python class `MixtureDensityNet` described below. Class description: Implement the MixtureDensityNet class. Method signatures and docstrings: - def __init__(self, n_input: int, n_output: int, n_component: int): Parameters ---------- n_input : int the dimension of input feature n_output : the dimension o...
54b04e9e9e4c88d4859ea65d34ceb69dd1b58bc2
<|skeleton|> class MixtureDensityNet: def __init__(self, n_input: int, n_output: int, n_component: int): """Parameters ---------- n_input : int the dimension of input feature n_output : the dimension of output space n_component : the number of component of Gauss distribution""" <|body_0|> def ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MixtureDensityNet: def __init__(self, n_input: int, n_output: int, n_component: int): """Parameters ---------- n_input : int the dimension of input feature n_output : the dimension of output space n_component : the number of component of Gauss distribution""" super(MixtureDensityNet, self).__i...
the_stack_v2_python_sparse
src/models/DeepIV/nn_structure/mixture_density_net.py
FFFinale/DeepFeatureIV
train
0
645f9556e6c714b5358f18c54e8724ed5fa2a2e1
[ "try:\n User.objects.get(username__iexact=self.cleaned_data['username'])\nexcept User.DoesNotExist:\n pass\nelse:\n if AccountSignup.objects.filter(user__username__iexact=self.cleaned_data['username']).exclude(activation_key=account_settings.ACCOUNT_ACTIVATED):\n raise forms.ValidationError(_('This ...
<|body_start_0|> try: User.objects.get(username__iexact=self.cleaned_data['username']) except User.DoesNotExist: pass else: if AccountSignup.objects.filter(user__username__iexact=self.cleaned_data['username']).exclude(activation_key=account_settings.ACCOUNT_AC...
Form for creating a new user account. Validates that the requested username and e-mail is not already in use. Also requires the password to be entered twice.
SignupForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SignupForm: """Form for creating a new user account. Validates that the requested username and e-mail is not already in use. Also requires the password to be entered twice.""" def clean_username(self): """Validate that the username is alphanumeric and is not already in use. Also vali...
stack_v2_sparse_classes_36k_train_020230
10,524
no_license
[ { "docstring": "Validate that the username is alphanumeric and is not already in use. Also validates that the username is not listed in ``ACCOUNT_FORBIDDEN_USERNAMES`` list.", "name": "clean_username", "signature": "def clean_username(self)" }, { "docstring": "Validate that the e-mail address is...
4
null
Implement the Python class `SignupForm` described below. Class description: Form for creating a new user account. Validates that the requested username and e-mail is not already in use. Also requires the password to be entered twice. Method signatures and docstrings: - def clean_username(self): Validate that the user...
Implement the Python class `SignupForm` described below. Class description: Form for creating a new user account. Validates that the requested username and e-mail is not already in use. Also requires the password to be entered twice. Method signatures and docstrings: - def clean_username(self): Validate that the user...
47d6691bb1d13ea0084dafae434de6b871d3d1be
<|skeleton|> class SignupForm: """Form for creating a new user account. Validates that the requested username and e-mail is not already in use. Also requires the password to be entered twice.""" def clean_username(self): """Validate that the username is alphanumeric and is not already in use. Also vali...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SignupForm: """Form for creating a new user account. Validates that the requested username and e-mail is not already in use. Also requires the password to be entered twice.""" def clean_username(self): """Validate that the username is alphanumeric and is not already in use. Also validates that th...
the_stack_v2_python_sparse
shopping_project/shopping/accounts/forms.py
yong5219/zayn_couture
train
0
79441e08a0a611e6afad75afe98a931b639e7a9d
[ "self.username = username\nself.password = password\noptions = webdriver.ChromeOptions()\noptions.add_argument('--disable-gpu')\nif not interactive:\n options.add_argument('--headless')\noptions.add_argument(f'--user-data-dir=botdata/{username}/chrome')\nself.driver = webdriver.Chrome(options=options)\nself.auth...
<|body_start_0|> self.username = username self.password = password options = webdriver.ChromeOptions() options.add_argument('--disable-gpu') if not interactive: options.add_argument('--headless') options.add_argument(f'--user-data-dir=botdata/{username}/chrome...
A bot acting like a human on the twitters.
TwitterWebSession
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TwitterWebSession: """A bot acting like a human on the twitters.""" def __init__(self, username, password, interactive=False): """Constructor.""" <|body_0|> def log(self, msg): """Log something.""" <|body_1|> def login(self): """See if we can...
stack_v2_sparse_classes_36k_train_020231
9,591
permissive
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self, username, password, interactive=False)" }, { "docstring": "Log something.", "name": "log", "signature": "def log(self, msg)" }, { "docstring": "See if we can log in!", "name": "login", "si...
6
null
Implement the Python class `TwitterWebSession` described below. Class description: A bot acting like a human on the twitters. Method signatures and docstrings: - def __init__(self, username, password, interactive=False): Constructor. - def log(self, msg): Log something. - def login(self): See if we can log in! - def ...
Implement the Python class `TwitterWebSession` described below. Class description: A bot acting like a human on the twitters. Method signatures and docstrings: - def __init__(self, username, password, interactive=False): Constructor. - def log(self, msg): Log something. - def login(self): See if we can log in! - def ...
3b1ef5841b25365d9b256467e774f35c28866961
<|skeleton|> class TwitterWebSession: """A bot acting like a human on the twitters.""" def __init__(self, username, password, interactive=False): """Constructor.""" <|body_0|> def log(self, msg): """Log something.""" <|body_1|> def login(self): """See if we can...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TwitterWebSession: """A bot acting like a human on the twitters.""" def __init__(self, username, password, interactive=False): """Constructor.""" self.username = username self.password = password options = webdriver.ChromeOptions() options.add_argument('--disable-g...
the_stack_v2_python_sparse
twitter/bot.py
akrherz/DEV
train
2
183cea01d80168545f37ca4b73da4a8e0edbddeb
[ "threading.Thread.__init__(self, group, target, name, args, kwargs or dict())\nself.interaction = interaction\nself.storage = storage\nself.logger = logging.getLogger('bcfg2-report-collector')\nself.semaphore = semaphore", "try:\n try:\n start = time.time()\n self.storage.import_interaction(self....
<|body_start_0|> threading.Thread.__init__(self, group, target, name, args, kwargs or dict()) self.interaction = interaction self.storage = storage self.logger = logging.getLogger('bcfg2-report-collector') self.semaphore = semaphore <|end_body_0|> <|body_start_1|> try: ...
Thread for calling the storage backend
ReportingStoreThread
[ "LicenseRef-scancode-unknown-license-reference", "mpich2", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReportingStoreThread: """Thread for calling the storage backend""" def __init__(self, interaction, storage, group=None, target=None, name=None, semaphore=None, args=(), kwargs=None): """Initialize the thread with a reference to the interaction as well as the storage engine to use""" ...
stack_v2_sparse_classes_36k_train_020232
7,597
permissive
[ { "docstring": "Initialize the thread with a reference to the interaction as well as the storage engine to use", "name": "__init__", "signature": "def __init__(self, interaction, storage, group=None, target=None, name=None, semaphore=None, args=(), kwargs=None)" }, { "docstring": "Call the datab...
2
null
Implement the Python class `ReportingStoreThread` described below. Class description: Thread for calling the storage backend Method signatures and docstrings: - def __init__(self, interaction, storage, group=None, target=None, name=None, semaphore=None, args=(), kwargs=None): Initialize the thread with a reference to...
Implement the Python class `ReportingStoreThread` described below. Class description: Thread for calling the storage backend Method signatures and docstrings: - def __init__(self, interaction, storage, group=None, target=None, name=None, semaphore=None, args=(), kwargs=None): Initialize the thread with a reference to...
8605cd3d0cb4d549cb8b43de945d447f6d82892a
<|skeleton|> class ReportingStoreThread: """Thread for calling the storage backend""" def __init__(self, interaction, storage, group=None, target=None, name=None, semaphore=None, args=(), kwargs=None): """Initialize the thread with a reference to the interaction as well as the storage engine to use""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReportingStoreThread: """Thread for calling the storage backend""" def __init__(self, interaction, storage, group=None, target=None, name=None, semaphore=None, args=(), kwargs=None): """Initialize the thread with a reference to the interaction as well as the storage engine to use""" threa...
the_stack_v2_python_sparse
src/lib/Bcfg2/Reporting/Collector.py
Bcfg2/bcfg2
train
56
d1d526e0b36060e085876fc272c4583255baa99c
[ "if depth is None:\n depth = -1\nfunc = self.get_nodes.__func__\nreturn _traverser(self, func=func, depth=depth, flat=flat, filt=filt, traverse_excluded=traverse_excluded, include_self=True, gen=gen, vertical=True, spawn=spawn)", "if depth is None:\n depth = -1\norigins = [node for node in self.get_all() if...
<|body_start_0|> if depth is None: depth = -1 func = self.get_nodes.__func__ return _traverser(self, func=func, depth=depth, flat=flat, filt=filt, traverse_excluded=traverse_excluded, include_self=True, gen=gen, vertical=True, spawn=spawn) <|end_body_0|> <|body_start_1|> if ...
Global methods of a Diagram.
_Diagram_Global
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _Diagram_Global: """Global methods of a Diagram.""" def get_all(self, depth=None, flat=None, filt=None, traverse_excluded=None, gen=None, spawn=None): """QOL, shortcut for get_nodes() with depth being -1 and include_self being True. Will return/yield all nodes, originating from self....
stack_v2_sparse_classes_36k_train_020233
36,776
permissive
[ { "docstring": "QOL, shortcut for get_nodes() with depth being -1 and include_self being True. Will return/yield all nodes, originating from self. :param TreeDiagram or NetworkDiagram or Any self: :param int or None depth: -1 - Depth of 0 will return/yield single direct layer. Get unlimited with -1. :param bool...
2
stack_v2_sparse_classes_30k_train_014102
Implement the Python class `_Diagram_Global` described below. Class description: Global methods of a Diagram. Method signatures and docstrings: - def get_all(self, depth=None, flat=None, filt=None, traverse_excluded=None, gen=None, spawn=None): QOL, shortcut for get_nodes() with depth being -1 and include_self being ...
Implement the Python class `_Diagram_Global` described below. Class description: Global methods of a Diagram. Method signatures and docstrings: - def get_all(self, depth=None, flat=None, filt=None, traverse_excluded=None, gen=None, spawn=None): QOL, shortcut for get_nodes() with depth being -1 and include_self being ...
c3bef4992c8cafb8fe198a22b68c1903517d5c67
<|skeleton|> class _Diagram_Global: """Global methods of a Diagram.""" def get_all(self, depth=None, flat=None, filt=None, traverse_excluded=None, gen=None, spawn=None): """QOL, shortcut for get_nodes() with depth being -1 and include_self being True. Will return/yield all nodes, originating from self....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _Diagram_Global: """Global methods of a Diagram.""" def get_all(self, depth=None, flat=None, filt=None, traverse_excluded=None, gen=None, spawn=None): """QOL, shortcut for get_nodes() with depth being -1 and include_self being True. Will return/yield all nodes, originating from self. :param TreeD...
the_stack_v2_python_sparse
generallibrary/diagram.py
GaetanDesrues/generallibrary
train
0
5930aa8ae3d8c4e412b4e91ff2223e8a91cb6765
[ "result_next = result = ListNode(0)\nwhile l1 and l2:\n if l1.val <= l2.val:\n result_next.next = ListNode(l1.val)\n l1 = l1.next\n else:\n result_next.next = ListNode(l2.val)\n l2 = l2.next\n result_next = result_next.next\nresult_next.next = l1 or l2\nreturn result.next", "i...
<|body_start_0|> result_next = result = ListNode(0) while l1 and l2: if l1.val <= l2.val: result_next.next = ListNode(l1.val) l1 = l1.next else: result_next.next = ListNode(l2.val) l2 = l2.next result_nex...
Solution
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeTwoLists(self, l1, l2): """direct solution""" <|body_0|> def mergeTwoLists1(self, list1, list2): """recursively""" <|body_1|> def mergeTwoLists2(self, l1, l2): """change into list""" <|body_2|> <|end_skeleton|> <|body...
stack_v2_sparse_classes_36k_train_020234
2,200
permissive
[ { "docstring": "direct solution", "name": "mergeTwoLists", "signature": "def mergeTwoLists(self, l1, l2)" }, { "docstring": "recursively", "name": "mergeTwoLists1", "signature": "def mergeTwoLists1(self, list1, list2)" }, { "docstring": "change into list", "name": "mergeTwoLi...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists(self, l1, l2): direct solution - def mergeTwoLists1(self, list1, list2): recursively - def mergeTwoLists2(self, l1, l2): change into list
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists(self, l1, l2): direct solution - def mergeTwoLists1(self, list1, list2): recursively - def mergeTwoLists2(self, l1, l2): change into list <|skeleton|> class So...
49a0b03c55d8a702785888d473ef96539265ce9c
<|skeleton|> class Solution: def mergeTwoLists(self, l1, l2): """direct solution""" <|body_0|> def mergeTwoLists1(self, list1, list2): """recursively""" <|body_1|> def mergeTwoLists2(self, l1, l2): """change into list""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def mergeTwoLists(self, l1, l2): """direct solution""" result_next = result = ListNode(0) while l1 and l2: if l1.val <= l2.val: result_next.next = ListNode(l1.val) l1 = l1.next else: result_next.next = Li...
the_stack_v2_python_sparse
leetcode/0021_merge_two_sorted_lists.py
chaosWsF/Python-Practice
train
1
d208ca4db22c8cf8466a505e4ff0d86271a9748e
[ "BaseDustNode.__init__(self, xml_node)\nself._value = utils.parse_number(xml_node.text)\nself._columns = [Column(name=col_name, unit=units)]", "base_string = BaseDustNode.__str__(self)\nstring = '[NumberNode: ' + base_string + ', value: ' + str(self._value) + ']'\nreturn string" ]
<|body_start_0|> BaseDustNode.__init__(self, xml_node) self._value = utils.parse_number(xml_node.text) self._columns = [Column(name=col_name, unit=units)] <|end_body_0|> <|body_start_1|> base_string = BaseDustNode.__str__(self) string = '[NumberNode: ' + base_string + ', value: ...
A node that contains a number. Outputs a single column containing the number.
NumberNode
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumberNode: """A node that contains a number. Outputs a single column containing the number.""" def __init__(self, xml_node, col_name, *, units=None): """Parameters ---------- xml_node : `xml.etree.ElementTree` the xml node that provides the raw data for this DustNode col_name : str ...
stack_v2_sparse_classes_36k_train_020235
41,056
permissive
[ { "docstring": "Parameters ---------- xml_node : `xml.etree.ElementTree` the xml node that provides the raw data for this DustNode col_name : str the name of the column associated with this item units : `~astropy.units.Unit` the units associated with this item", "name": "__init__", "signature": "def __i...
2
stack_v2_sparse_classes_30k_val_000246
Implement the Python class `NumberNode` described below. Class description: A node that contains a number. Outputs a single column containing the number. Method signatures and docstrings: - def __init__(self, xml_node, col_name, *, units=None): Parameters ---------- xml_node : `xml.etree.ElementTree` the xml node tha...
Implement the Python class `NumberNode` described below. Class description: A node that contains a number. Outputs a single column containing the number. Method signatures and docstrings: - def __init__(self, xml_node, col_name, *, units=None): Parameters ---------- xml_node : `xml.etree.ElementTree` the xml node tha...
51316d7417d7daf01a8b29d1df99037b9227c2bc
<|skeleton|> class NumberNode: """A node that contains a number. Outputs a single column containing the number.""" def __init__(self, xml_node, col_name, *, units=None): """Parameters ---------- xml_node : `xml.etree.ElementTree` the xml node that provides the raw data for this DustNode col_name : str ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NumberNode: """A node that contains a number. Outputs a single column containing the number.""" def __init__(self, xml_node, col_name, *, units=None): """Parameters ---------- xml_node : `xml.etree.ElementTree` the xml node that provides the raw data for this DustNode col_name : str the name of t...
the_stack_v2_python_sparse
astroquery/ipac/irsa/irsa_dust/core.py
astropy/astroquery
train
636
124f18cdba22adf653aa7964722048d6e13c5840
[ "column = CheckboxColumn(checkbox_name='my_checkbox&', detailed_label='<Select Rows>')\nself.assertHTMLEqual(column.label, '<input class=\"datagrid-header-checkbox\" type=\"checkbox\" data-checkbox-name=\"my_checkbox&amp;\">')\nself.assertHTMLEqual(column.detailed_label_html, '<input type=\"checkbox\"> &lt;Select ...
<|body_start_0|> column = CheckboxColumn(checkbox_name='my_checkbox&', detailed_label='<Select Rows>') self.assertHTMLEqual(column.label, '<input class="datagrid-header-checkbox" type="checkbox" data-checkbox-name="my_checkbox&amp;">') self.assertHTMLEqual(column.detailed_label_html, '<input ty...
Unit tests for djblets.datagrid.grids.CheckboxColumn.
CheckboxColumnTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CheckboxColumnTests: """Unit tests for djblets.datagrid.grids.CheckboxColumn.""" def test_initial_state(self): """Testing CheckboxColumn initial state""" <|body_0|> def test_render_data_with_selected(self): """Testing CheckboxColumn.render_data with selected obje...
stack_v2_sparse_classes_36k_train_020236
16,362
no_license
[ { "docstring": "Testing CheckboxColumn initial state", "name": "test_initial_state", "signature": "def test_initial_state(self)" }, { "docstring": "Testing CheckboxColumn.render_data with selected object", "name": "test_render_data_with_selected", "signature": "def test_render_data_with_...
3
null
Implement the Python class `CheckboxColumnTests` described below. Class description: Unit tests for djblets.datagrid.grids.CheckboxColumn. Method signatures and docstrings: - def test_initial_state(self): Testing CheckboxColumn initial state - def test_render_data_with_selected(self): Testing CheckboxColumn.render_da...
Implement the Python class `CheckboxColumnTests` described below. Class description: Unit tests for djblets.datagrid.grids.CheckboxColumn. Method signatures and docstrings: - def test_initial_state(self): Testing CheckboxColumn initial state - def test_render_data_with_selected(self): Testing CheckboxColumn.render_da...
99ea69d80a3a393b0da4da3152ef26e808dd8487
<|skeleton|> class CheckboxColumnTests: """Unit tests for djblets.datagrid.grids.CheckboxColumn.""" def test_initial_state(self): """Testing CheckboxColumn initial state""" <|body_0|> def test_render_data_with_selected(self): """Testing CheckboxColumn.render_data with selected obje...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CheckboxColumnTests: """Unit tests for djblets.datagrid.grids.CheckboxColumn.""" def test_initial_state(self): """Testing CheckboxColumn initial state""" column = CheckboxColumn(checkbox_name='my_checkbox&', detailed_label='<Select Rows>') self.assertHTMLEqual(column.label, '<inpu...
the_stack_v2_python_sparse
djblets/datagrid/tests.py
chipx86/djblets
train
2
782a2124277560a59af08e11b9ecd97adccbef90
[ "super(RCNLPSwitchingAttractorLanguage, self).__init__()\nself.m_tag_symbol = tag_symbol\nself.m_other_symbols = other_symbols\nself.m_memory_length = memory_length\nself.m_sparsity = sparsity\nself._switch_back_symbol = switch_back_symbol", "lang_inputs = []\nlang_outputs = []\nmem_step = 0.0\ncount = 0\nseen = ...
<|body_start_0|> super(RCNLPSwitchingAttractorLanguage, self).__init__() self.m_tag_symbol = tag_symbol self.m_other_symbols = other_symbols self.m_memory_length = memory_length self.m_sparsity = sparsity self._switch_back_symbol = switch_back_symbol <|end_body_0|> <|bod...
This class create samples of a language where the reservoir must switch attractor and therefore its outputs when a signal is presented to its input.
RCNLPSwitchingAttractorLanguage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RCNLPSwitchingAttractorLanguage: """This class create samples of a language where the reservoir must switch attractor and therefore its outputs when a signal is presented to its input.""" def __init__(self, tag_symbol, other_symbols, switch_back_symbol=None, memory_length=-1, sparsity=0.5): ...
stack_v2_sparse_classes_36k_train_020237
4,960
no_license
[ { "docstring": ":param tag_symbol: The symbol tag to switch attractor :param other_symbols: The other symbol given to the reservoir :param memory_length: The number of step the reservoir must stay in the attractor.", "name": "__init__", "signature": "def __init__(self, tag_symbol, other_symbols, switch_...
3
stack_v2_sparse_classes_30k_train_003141
Implement the Python class `RCNLPSwitchingAttractorLanguage` described below. Class description: This class create samples of a language where the reservoir must switch attractor and therefore its outputs when a signal is presented to its input. Method signatures and docstrings: - def __init__(self, tag_symbol, other...
Implement the Python class `RCNLPSwitchingAttractorLanguage` described below. Class description: This class create samples of a language where the reservoir must switch attractor and therefore its outputs when a signal is presented to its input. Method signatures and docstrings: - def __init__(self, tag_symbol, other...
01d1a6b36895c99f8cd8bab8fd4312c1998e0b82
<|skeleton|> class RCNLPSwitchingAttractorLanguage: """This class create samples of a language where the reservoir must switch attractor and therefore its outputs when a signal is presented to its input.""" def __init__(self, tag_symbol, other_symbols, switch_back_symbol=None, memory_length=-1, sparsity=0.5): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RCNLPSwitchingAttractorLanguage: """This class create samples of a language where the reservoir must switch attractor and therefore its outputs when a signal is presented to its input.""" def __init__(self, tag_symbol, other_symbols, switch_back_symbol=None, memory_length=-1, sparsity=0.5): """:p...
the_stack_v2_python_sparse
core/languages/RCNLPSwitchingAttractorLanguage.py
nschaetti/RCNLP
train
2
555c8a6f8091c7e47c2c87f6762c78fae3129f34
[ "super().__init__()\nout_channels = 2 * in_channels\nself.down_conv = nn.Conv2d(in_channels, out_channels, kernel_size=2, stride=2, bias=bias)\nself.bn1 = nn.BatchNorm2d(out_channels)\nself.act_function1 = act(inplace=True)\nself.act_function2 = act(inplace=True)\nself.ops = _make_nconv(out_channels, convs, act, bi...
<|body_start_0|> super().__init__() out_channels = 2 * in_channels self.down_conv = nn.Conv2d(in_channels, out_channels, kernel_size=2, stride=2, bias=bias) self.bn1 = nn.BatchNorm2d(out_channels) self.act_function1 = act(inplace=True) self.act_function2 = act(inplace=Tru...
Down Transition Block.
DownTransition
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DownTransition: """Down Transition Block.""" def __init__(self, in_channels: int, convs: int, act: nn.Module=nn.ELU, dropout_prob: float=0.0, bias: bool=False): """Parameters ---------- in_channels : int Number of input channels. convs : int Number of LUConv layers. act : nn.Module A...
stack_v2_sparse_classes_36k_train_020238
8,968
permissive
[ { "docstring": "Parameters ---------- in_channels : int Number of input channels. convs : int Number of LUConv layers. act : nn.Module Activation function. dropout_prob : float Dropout probability. bias : bool Whether to use bias.", "name": "__init__", "signature": "def __init__(self, in_channels: int, ...
2
stack_v2_sparse_classes_30k_train_005996
Implement the Python class `DownTransition` described below. Class description: Down Transition Block. Method signatures and docstrings: - def __init__(self, in_channels: int, convs: int, act: nn.Module=nn.ELU, dropout_prob: float=0.0, bias: bool=False): Parameters ---------- in_channels : int Number of input channel...
Implement the Python class `DownTransition` described below. Class description: Down Transition Block. Method signatures and docstrings: - def __init__(self, in_channels: int, convs: int, act: nn.Module=nn.ELU, dropout_prob: float=0.0, bias: bool=False): Parameters ---------- in_channels : int Number of input channel...
6d15dd55ca5ed6fc9fbfd31d8488ee7bab453066
<|skeleton|> class DownTransition: """Down Transition Block.""" def __init__(self, in_channels: int, convs: int, act: nn.Module=nn.ELU, dropout_prob: float=0.0, bias: bool=False): """Parameters ---------- in_channels : int Number of input channels. convs : int Number of LUConv layers. act : nn.Module A...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DownTransition: """Down Transition Block.""" def __init__(self, in_channels: int, convs: int, act: nn.Module=nn.ELU, dropout_prob: float=0.0, bias: bool=False): """Parameters ---------- in_channels : int Number of input channels. convs : int Number of LUConv layers. act : nn.Module Activation fun...
the_stack_v2_python_sparse
mridc/collections/segmentation/models/vnet_base/vnet_block.py
wdika/mridc
train
40
2143fcb503e491f7b96c1318dc669e2900176680
[ "assert isinstance(entityCount, int)\nassert entityCount >= 2\nself.entityCount = entityCount\nassert acceptedEntityTypes is None or isinstance(acceptedEntityTypes, list)\nif acceptedEntityTypes is None:\n self.acceptedEntityTypes = None\nelse:\n for acceptedEntityType in acceptedEntityTypes:\n assert ...
<|body_start_0|> assert isinstance(entityCount, int) assert entityCount >= 2 self.entityCount = entityCount assert acceptedEntityTypes is None or isinstance(acceptedEntityTypes, list) if acceptedEntityTypes is None: self.acceptedEntityTypes = None else: ...
Generates set of all possible relations in corpus. :ivar entityCount: Number of entities in each relation (default=2) :ivar acceptedEntityTypes: Tuples of entities that candidate relations must match. Each entity should be the same length as entityCount. None will match all candidate relations.
CandidateBuilder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CandidateBuilder: """Generates set of all possible relations in corpus. :ivar entityCount: Number of entities in each relation (default=2) :ivar acceptedEntityTypes: Tuples of entities that candidate relations must match. Each entity should be the same length as entityCount. None will match all c...
stack_v2_sparse_classes_36k_train_020239
4,217
permissive
[ { "docstring": "Constructor :param entityCount: Number of entities in each relation (default=2) :param acceptedEntityTypes: Tuples of entities that candidate relations must match. Each entity should be the same length as entityCount. None will match all candidate relations. :type entityCount: int :type accepted...
2
stack_v2_sparse_classes_30k_train_011249
Implement the Python class `CandidateBuilder` described below. Class description: Generates set of all possible relations in corpus. :ivar entityCount: Number of entities in each relation (default=2) :ivar acceptedEntityTypes: Tuples of entities that candidate relations must match. Each entity should be the same lengt...
Implement the Python class `CandidateBuilder` described below. Class description: Generates set of all possible relations in corpus. :ivar entityCount: Number of entities in each relation (default=2) :ivar acceptedEntityTypes: Tuples of entities that candidate relations must match. Each entity should be the same lengt...
5a7f296ae9a9e43727622f48cdcf93095a8ad452
<|skeleton|> class CandidateBuilder: """Generates set of all possible relations in corpus. :ivar entityCount: Number of entities in each relation (default=2) :ivar acceptedEntityTypes: Tuples of entities that candidate relations must match. Each entity should be the same length as entityCount. None will match all c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CandidateBuilder: """Generates set of all possible relations in corpus. :ivar entityCount: Number of entities in each relation (default=2) :ivar acceptedEntityTypes: Tuples of entities that candidate relations must match. Each entity should be the same length as entityCount. None will match all candidate rela...
the_stack_v2_python_sparse
kindred/CandidateBuilder.py
wangmm88/BioNLP-ST-2016_BB3-event
train
1
a6e735f62b949de6a1012b6714cb724a8c07e106
[ "self.serializer_class = PromoteLabelSerializer\nqueryset = PromoteLabel.objects.all().order_by('rank')\nserializer = self.get_serializer(queryset, many=True)\nreturn Response(serializer.data)", "self.serializer_class = PromoteOptionSerializer\nqueryset = PromoteShouts.objects.filter(is_active=True)\nqueryset = s...
<|body_start_0|> self.serializer_class = PromoteLabelSerializer queryset = PromoteLabel.objects.all().order_by('rank') serializer = self.get_serializer(queryset, many=True) return Response(serializer.data) <|end_body_0|> <|body_start_1|> self.serializer_class = PromoteOptionSeri...
PromoteShoutMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PromoteShoutMixin: def promote_labels(self, request, *args, **kwargs): """Retrieve shout Promotion Labels ###Response <pre><code> { "name": "PREMIUM", "description": "Your shout will be highlighted in all searches.", "color": "#FFFFD700", "bg_color": "#26FFD700" } </code></pre> - `color`...
stack_v2_sparse_classes_36k_train_020240
6,777
no_license
[ { "docstring": "Retrieve shout Promotion Labels ###Response <pre><code> { \"name\": \"PREMIUM\", \"description\": \"Your shout will be highlighted in all searches.\", \"color\": \"#FFFFD700\", \"bg_color\": \"#26FFD700\" } </code></pre> - `color` and `bg_color` are in this format `#AARRGGBB` --- omit_serializer...
3
stack_v2_sparse_classes_30k_train_004538
Implement the Python class `PromoteShoutMixin` described below. Class description: Implement the PromoteShoutMixin class. Method signatures and docstrings: - def promote_labels(self, request, *args, **kwargs): Retrieve shout Promotion Labels ###Response <pre><code> { "name": "PREMIUM", "description": "Your shout will...
Implement the Python class `PromoteShoutMixin` described below. Class description: Implement the PromoteShoutMixin class. Method signatures and docstrings: - def promote_labels(self, request, *args, **kwargs): Retrieve shout Promotion Labels ###Response <pre><code> { "name": "PREMIUM", "description": "Your shout will...
f3c95585ac639b45c28521712ed33a178ab36ea4
<|skeleton|> class PromoteShoutMixin: def promote_labels(self, request, *args, **kwargs): """Retrieve shout Promotion Labels ###Response <pre><code> { "name": "PREMIUM", "description": "Your shout will be highlighted in all searches.", "color": "#FFFFD700", "bg_color": "#26FFD700" } </code></pre> - `color`...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PromoteShoutMixin: def promote_labels(self, request, *args, **kwargs): """Retrieve shout Promotion Labels ###Response <pre><code> { "name": "PREMIUM", "description": "Your shout will be highlighted in all searches.", "color": "#FFFFD700", "bg_color": "#26FFD700" } </code></pre> - `color` and `bg_color...
the_stack_v2_python_sparse
src/shoutit_credit/views.py
shoutit/shoutit-api
train
0
875920c3f28531a273e577e564e5f24357fc5a06
[ "if not grid:\n return 0\nnumber_of_islands = 0\nrows, cols = (len(grid), len(grid[0]))\nq = deque()\n\ndef helper(grid, q):\n while q:\n row, col = q.popleft()\n for dr, dc in ((row + 1, col), (row - 1, col), (row, col + 1), (row, col - 1)):\n if 0 <= dr < len(grid) and 0 <= dc < len...
<|body_start_0|> if not grid: return 0 number_of_islands = 0 rows, cols = (len(grid), len(grid[0])) q = deque() def helper(grid, q): while q: row, col = q.popleft() for dr, dc in ((row + 1, col), (row - 1, col), (row, col +...
Islands
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Islands: def total_number_bfs(self, grid: List[List[str]]) -> int: """Approach: BFS Time Complexity: O(MN) Space Complexity: O(min(MN)) :param grid: :return:""" <|body_0|> def total_number_dfs(self, grid: List[List[str]]) -> int: """Approach: DFS Time Complexity: O(M...
stack_v2_sparse_classes_36k_train_020241
2,943
no_license
[ { "docstring": "Approach: BFS Time Complexity: O(MN) Space Complexity: O(min(MN)) :param grid: :return:", "name": "total_number_bfs", "signature": "def total_number_bfs(self, grid: List[List[str]]) -> int" }, { "docstring": "Approach: DFS Time Complexity: O(MN) Space Complexity: O(MN) :param gri...
2
null
Implement the Python class `Islands` described below. Class description: Implement the Islands class. Method signatures and docstrings: - def total_number_bfs(self, grid: List[List[str]]) -> int: Approach: BFS Time Complexity: O(MN) Space Complexity: O(min(MN)) :param grid: :return: - def total_number_dfs(self, grid:...
Implement the Python class `Islands` described below. Class description: Implement the Islands class. Method signatures and docstrings: - def total_number_bfs(self, grid: List[List[str]]) -> int: Approach: BFS Time Complexity: O(MN) Space Complexity: O(min(MN)) :param grid: :return: - def total_number_dfs(self, grid:...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class Islands: def total_number_bfs(self, grid: List[List[str]]) -> int: """Approach: BFS Time Complexity: O(MN) Space Complexity: O(min(MN)) :param grid: :return:""" <|body_0|> def total_number_dfs(self, grid: List[List[str]]) -> int: """Approach: DFS Time Complexity: O(M...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Islands: def total_number_bfs(self, grid: List[List[str]]) -> int: """Approach: BFS Time Complexity: O(MN) Space Complexity: O(min(MN)) :param grid: :return:""" if not grid: return 0 number_of_islands = 0 rows, cols = (len(grid), len(grid[0])) q = deque() ...
the_stack_v2_python_sparse
amazon/dfs_and_bfs/number_of_islands.py
Shiv2157k/leet_code
train
1
578a9eb1e6539c06a365409c2e2a0eb4729536b0
[ "if site.home_page.has_matching_tag('a', {'href': '\\\\.page'}):\n return 1\nelse:\n return 0", "if site.home_page.has_matching_tag('div', {'class': 'iw_component'}):\n return 1\nelse:\n return 0" ]
<|body_start_0|> if site.home_page.has_matching_tag('a', {'href': '\\.page'}): return 1 else: return 0 <|end_body_0|> <|body_start_1|> if site.home_page.has_matching_tag('div', {'class': 'iw_component'}): return 1 else: return 0 <|end_body...
Signature
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Signature: def test_has_dot_page_extension(self, site): """TeamSite sites running LiveSite tend to have URLs that contain a .page extension""" <|body_0|> def test_has_iw_component(sefl, site): """TeamSite's uses the class iw_component to identify LiveSite component d...
stack_v2_sparse_classes_36k_train_020242
1,192
permissive
[ { "docstring": "TeamSite sites running LiveSite tend to have URLs that contain a .page extension", "name": "test_has_dot_page_extension", "signature": "def test_has_dot_page_extension(self, site)" }, { "docstring": "TeamSite's uses the class iw_component to identify LiveSite component divs.", ...
2
stack_v2_sparse_classes_30k_test_000049
Implement the Python class `Signature` described below. Class description: Implement the Signature class. Method signatures and docstrings: - def test_has_dot_page_extension(self, site): TeamSite sites running LiveSite tend to have URLs that contain a .page extension - def test_has_iw_component(sefl, site): TeamSite'...
Implement the Python class `Signature` described below. Class description: Implement the Signature class. Method signatures and docstrings: - def test_has_dot_page_extension(self, site): TeamSite sites running LiveSite tend to have URLs that contain a .page extension - def test_has_iw_component(sefl, site): TeamSite'...
850bac5a1f5de67025bfaed252fbcde0b6ea6846
<|skeleton|> class Signature: def test_has_dot_page_extension(self, site): """TeamSite sites running LiveSite tend to have URLs that contain a .page extension""" <|body_0|> def test_has_iw_component(sefl, site): """TeamSite's uses the class iw_component to identify LiveSite component d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Signature: def test_has_dot_page_extension(self, site): """TeamSite sites running LiveSite tend to have URLs that contain a .page extension""" if site.home_page.has_matching_tag('a', {'href': '\\.page'}): return 1 else: return 0 def test_has_iw_component(se...
the_stack_v2_python_sparse
cmfieldguide/cmsdetector/signatures/livesite.py
kartiktodi/cmfieldguide
train
0
c59fea65c8c99b7806ab52df11c372070879e876
[ "assert len(objList) >= 1\nself.initialCoords = (x, y)\nself.dc = objList[0].dc\ntagList = []\nfor obj in objList:\n tagList.append(obj.tag)\nbbox = self.dc.bbox(*tagList)\nitemHandler = self.dc.create_rectangle(bbox, tags='dragBoxVisualAid', stipple='', width='2.0', outline='firebrick3', fill='')\nself.dragEndB...
<|body_start_0|> assert len(objList) >= 1 self.initialCoords = (x, y) self.dc = objList[0].dc tagList = [] for obj in objList: tagList.append(obj.tag) bbox = self.dc.bbox(*tagList) itemHandler = self.dc.create_rectangle(bbox, tags='dragBoxVisualAid', s...
Drag
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Drag: def __init__(self, objList, x, y): """Creates a new drag object Includes 2 boxes: #1 indicates the initial position of the dragged items #2 indicates the new position of the dragged items Note: Dragged items are not moved at all! Only the indicators (for speed)""" <|body_0|...
stack_v2_sparse_classes_36k_train_020243
9,729
no_license
[ { "docstring": "Creates a new drag object Includes 2 boxes: #1 indicates the initial position of the dragged items #2 indicates the new position of the dragged items Note: Dragged items are not moved at all! Only the indicators (for speed)", "name": "__init__", "signature": "def __init__(self, objList, ...
3
null
Implement the Python class `Drag` described below. Class description: Implement the Drag class. Method signatures and docstrings: - def __init__(self, objList, x, y): Creates a new drag object Includes 2 boxes: #1 indicates the initial position of the dragged items #2 indicates the new position of the dragged items N...
Implement the Python class `Drag` described below. Class description: Implement the Drag class. Method signatures and docstrings: - def __init__(self, objList, x, y): Creates a new drag object Includes 2 boxes: #1 indicates the initial position of the dragged items #2 indicates the new position of the dragged items N...
d900f58f0ddc1891831b298d9b37fbe98193719d
<|skeleton|> class Drag: def __init__(self, objList, x, y): """Creates a new drag object Includes 2 boxes: #1 indicates the initial position of the dragged items #2 indicates the new position of the dragged items Note: Dragged items are not moved at all! Only the indicators (for speed)""" <|body_0|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Drag: def __init__(self, objList, x, y): """Creates a new drag object Includes 2 boxes: #1 indicates the initial position of the dragged items #2 indicates the new position of the dragged items Note: Dragged items are not moved at all! Only the indicators (for speed)""" assert len(objList) >= ...
the_stack_v2_python_sparse
Assignment4/atom3/Kernel/UserInterface/Drag.py
pombreda/comp304
train
1
c11469f6ddfa02e5bf4862cb257e0f1046e9a2a1
[ "super(Encoder, self).__init__()\nself.N = N\nself.dm = dm\nself.embedding = tf.keras.layers.Embedding(input_vocab, dm)\nself.positional_encoding = positional_encoding(max_seq_len, dm)\nself.blocks = [EncoderBlock(dm, h, hidden, drop_rate) for _ in range(N)]\nself.dropout = tf.keras.layers.Dropout(drop_rate)", "s...
<|body_start_0|> super(Encoder, self).__init__() self.N = N self.dm = dm self.embedding = tf.keras.layers.Embedding(input_vocab, dm) self.positional_encoding = positional_encoding(max_seq_len, dm) self.blocks = [EncoderBlock(dm, h, hidden, drop_rate) for _ in range(N)] ...
class that instantiates an Encoder
Encoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Encoder: """class that instantiates an Encoder""" def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): """constructor""" <|body_0|> def call(self, x, training, mask): """function that builds an Encoder""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_36k_train_020244
1,954
no_license
[ { "docstring": "constructor", "name": "__init__", "signature": "def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1)" }, { "docstring": "function that builds an Encoder", "name": "call", "signature": "def call(self, x, training, mask)" } ]
2
stack_v2_sparse_classes_30k_train_012695
Implement the Python class `Encoder` described below. Class description: class that instantiates an Encoder Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): constructor - def call(self, x, training, mask): function that builds an Encoder
Implement the Python class `Encoder` described below. Class description: class that instantiates an Encoder Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): constructor - def call(self, x, training, mask): function that builds an Encoder <|skeleton|> ...
7d3b348aec3b20da25b162b71f150c87c7c28d71
<|skeleton|> class Encoder: """class that instantiates an Encoder""" def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): """constructor""" <|body_0|> def call(self, x, training, mask): """function that builds an Encoder""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Encoder: """class that instantiates an Encoder""" def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): """constructor""" super(Encoder, self).__init__() self.N = N self.dm = dm self.embedding = tf.keras.layers.Embedding(input_vocab, dm) ...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/9-transformer_encoder.py
dacastanogo/holbertonschool-machine_learning
train
0
d540c358e93627be15b289cac6f8345c683de170
[ "super().__init__(hyperparams, protocol_handler, data_handler, fl_model, **kwargs)\nself.name = 'ComparativeElimination'\nif hyperparams.get('initial_weights') is not None:\n if not self.current_model_weights:\n logger.info('Initializing the model using initial weights provided in config file')\n s...
<|body_start_0|> super().__init__(hyperparams, protocol_handler, data_handler, fl_model, **kwargs) self.name = 'ComparativeElimination' if hyperparams.get('initial_weights') is not None: if not self.current_model_weights: logger.info('Initializing the model using init...
Class for Comparative Elimination (CE) Fusion Algorithm. This class implements the CE fusion algorithm presented here: https://arxiv.org/abs/2108.11769 The CE fusion algorithm is a Byzantine-robust fusion algorithm. At high level, the CE fusion algorithm sorts the parties according to their l2-distance from the current...
ComparativeEliminationFusionHandler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ComparativeEliminationFusionHandler: """Class for Comparative Elimination (CE) Fusion Algorithm. This class implements the CE fusion algorithm presented here: https://arxiv.org/abs/2108.11769 The CE fusion algorithm is a Byzantine-robust fusion algorithm. At high level, the CE fusion algorithm so...
stack_v2_sparse_classes_36k_train_020245
8,132
permissive
[ { "docstring": "Initializes a ComparitiveEliminationFusionHandler object with provided information, such as hyperparams, protocol_handler, data_handler, and fl_model. :param hyperparams: Hyperparameters used for training :type hyperparams: `dict` :param protocol_handler: Protocol handler used for handling learn...
3
stack_v2_sparse_classes_30k_train_018808
Implement the Python class `ComparativeEliminationFusionHandler` described below. Class description: Class for Comparative Elimination (CE) Fusion Algorithm. This class implements the CE fusion algorithm presented here: https://arxiv.org/abs/2108.11769 The CE fusion algorithm is a Byzantine-robust fusion algorithm. At...
Implement the Python class `ComparativeEliminationFusionHandler` described below. Class description: Class for Comparative Elimination (CE) Fusion Algorithm. This class implements the CE fusion algorithm presented here: https://arxiv.org/abs/2108.11769 The CE fusion algorithm is a Byzantine-robust fusion algorithm. At...
64ffa2ee2e906b1bd6b3dd6aabcf6fc3de862608
<|skeleton|> class ComparativeEliminationFusionHandler: """Class for Comparative Elimination (CE) Fusion Algorithm. This class implements the CE fusion algorithm presented here: https://arxiv.org/abs/2108.11769 The CE fusion algorithm is a Byzantine-robust fusion algorithm. At high level, the CE fusion algorithm so...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ComparativeEliminationFusionHandler: """Class for Comparative Elimination (CE) Fusion Algorithm. This class implements the CE fusion algorithm presented here: https://arxiv.org/abs/2108.11769 The CE fusion algorithm is a Byzantine-robust fusion algorithm. At high level, the CE fusion algorithm sorts the parti...
the_stack_v2_python_sparse
debugging-constructs/ibmfl/aggregator/fusion/comparative_elimination_fusion_handler.py
SEED-VT/FedDebug
train
8
cc860b29375d98cbbad73336b6919396ffa08e9c
[ "if not check_exist(file):\n assert False, 'Cannot find the KPOINTS file. Check the path: ' + file\nelse:\n self.kpoints = open(file, 'r').readlines()", "plane = self.kpoints[0].split()[-5]\nkrange = np.float64(self.kpoints[0].split()[-4:-2])\nnpoint = np.int64(self.kpoints[0].split()[-2:])\nreturn (plane, ...
<|body_start_0|> if not check_exist(file): assert False, 'Cannot find the KPOINTS file. Check the path: ' + file else: self.kpoints = open(file, 'r').readlines() <|end_body_0|> <|body_start_1|> plane = self.kpoints[0].split()[-5] krange = np.float64(self.kpoints[...
KPOINTS
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KPOINTS: def __init__(self, file='KPOINTS'): """Read KPOINTS TODO: extend it to Selective dynamics""" <|body_0|> def get_spin_kmesh(self): """Read the kmesh header""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not check_exist(file): ...
stack_v2_sparse_classes_36k_train_020246
31,019
permissive
[ { "docstring": "Read KPOINTS TODO: extend it to Selective dynamics", "name": "__init__", "signature": "def __init__(self, file='KPOINTS')" }, { "docstring": "Read the kmesh header", "name": "get_spin_kmesh", "signature": "def get_spin_kmesh(self)" } ]
2
stack_v2_sparse_classes_30k_train_013223
Implement the Python class `KPOINTS` described below. Class description: Implement the KPOINTS class. Method signatures and docstrings: - def __init__(self, file='KPOINTS'): Read KPOINTS TODO: extend it to Selective dynamics - def get_spin_kmesh(self): Read the kmesh header
Implement the Python class `KPOINTS` described below. Class description: Implement the KPOINTS class. Method signatures and docstrings: - def __init__(self, file='KPOINTS'): Read KPOINTS TODO: extend it to Selective dynamics - def get_spin_kmesh(self): Read the kmesh header <|skeleton|> class KPOINTS: def __ini...
42945ee15465caa6fad1983597e23beac78b774d
<|skeleton|> class KPOINTS: def __init__(self, file='KPOINTS'): """Read KPOINTS TODO: extend it to Selective dynamics""" <|body_0|> def get_spin_kmesh(self): """Read the kmesh header""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KPOINTS: def __init__(self, file='KPOINTS'): """Read KPOINTS TODO: extend it to Selective dynamics""" if not check_exist(file): assert False, 'Cannot find the KPOINTS file. Check the path: ' + file else: self.kpoints = open(file, 'r').readlines() def get_sp...
the_stack_v2_python_sparse
mcu/vasp/vasp_io.py
hungpham2017/mcu
train
44
aa76ec9368d08b480e79a877b33e67664c409f22
[ "last_page = 150\nfor i in range(1, last_page + 1):\n if i == 1:\n yield scrapy.Request(url=self.first_url, callback=self.parse)\n else:\n data = {'do': 'getLiveListByPage', 'm': 'LiveList', 'page': i, 'tagAll': '0'}\n axjx_url = self.axjx_url + urlencode(data)\n yield scrapy.Reque...
<|body_start_0|> last_page = 150 for i in range(1, last_page + 1): if i == 1: yield scrapy.Request(url=self.first_url, callback=self.parse) else: data = {'do': 'getLiveListByPage', 'm': 'LiveList', 'page': i, 'tagAll': '0'} axjx_url...
AllhostSpider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AllhostSpider: def start_requests(self): """创建请求方法,访问所有子页面中的房间""" <|body_0|> def parse(self, response): """解析获取房间url,分2步,第一步获取首页,第二步获取ajax页""" <|body_1|> def parse_page(self, response): """解析房间详情信息""" <|body_2|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_020247
3,722
no_license
[ { "docstring": "创建请求方法,访问所有子页面中的房间", "name": "start_requests", "signature": "def start_requests(self)" }, { "docstring": "解析获取房间url,分2步,第一步获取首页,第二步获取ajax页", "name": "parse", "signature": "def parse(self, response)" }, { "docstring": "解析房间详情信息", "name": "parse_page", "sign...
3
stack_v2_sparse_classes_30k_train_003085
Implement the Python class `AllhostSpider` described below. Class description: Implement the AllhostSpider class. Method signatures and docstrings: - def start_requests(self): 创建请求方法,访问所有子页面中的房间 - def parse(self, response): 解析获取房间url,分2步,第一步获取首页,第二步获取ajax页 - def parse_page(self, response): 解析房间详情信息
Implement the Python class `AllhostSpider` described below. Class description: Implement the AllhostSpider class. Method signatures and docstrings: - def start_requests(self): 创建请求方法,访问所有子页面中的房间 - def parse(self, response): 解析获取房间url,分2步,第一步获取首页,第二步获取ajax页 - def parse_page(self, response): 解析房间详情信息 <|skeleton|> clas...
d324fbcb2c37a6a26ea8a7b7b26634b8ef0b9216
<|skeleton|> class AllhostSpider: def start_requests(self): """创建请求方法,访问所有子页面中的房间""" <|body_0|> def parse(self, response): """解析获取房间url,分2步,第一步获取首页,第二步获取ajax页""" <|body_1|> def parse_page(self, response): """解析房间详情信息""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AllhostSpider: def start_requests(self): """创建请求方法,访问所有子页面中的房间""" last_page = 150 for i in range(1, last_page + 1): if i == 1: yield scrapy.Request(url=self.first_url, callback=self.parse) else: data = {'do': 'getLiveListByPage', ...
the_stack_v2_python_sparse
practice/huya/huya/spiders/allhost.py
lldfire/python_spider
train
2
5b2c30fb58f12e1338ee4c4155ec69f2068529ff
[ "s = Search(using=client, index='xfurda00_topics').query('match', subCallId=int(input_topic['subCallId'])).params(request_timeout=30)\nresponse = s.execute()\nif response.success() is True and response.hits.total > 0:\n meta_id = response.hits[0].meta.id\n return cls.get(id=meta_id)\nelse:\n return cls()",...
<|body_start_0|> s = Search(using=client, index='xfurda00_topics').query('match', subCallId=int(input_topic['subCallId'])).params(request_timeout=30) response = s.execute() if response.success() is True and response.hits.total > 0: meta_id = response.hits[0].meta.id retur...
Elasticsearch mapping for Topic document
Topic
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Topic: """Elasticsearch mapping for Topic document""" def findOrCreate(cls, input_topic): """Searches for an existing document of the topics and retrieves it. Creates a new one if wasn't found""" <|body_0|> def fillInfo(self, input_topic): """Fills in topic infor...
stack_v2_sparse_classes_36k_train_020248
8,126
no_license
[ { "docstring": "Searches for an existing document of the topics and retrieves it. Creates a new one if wasn't found", "name": "findOrCreate", "signature": "def findOrCreate(cls, input_topic)" }, { "docstring": "Fills in topic information from parsed JSON file", "name": "fillInfo", "signa...
3
stack_v2_sparse_classes_30k_train_002919
Implement the Python class `Topic` described below. Class description: Elasticsearch mapping for Topic document Method signatures and docstrings: - def findOrCreate(cls, input_topic): Searches for an existing document of the topics and retrieves it. Creates a new one if wasn't found - def fillInfo(self, input_topic):...
Implement the Python class `Topic` described below. Class description: Elasticsearch mapping for Topic document Method signatures and docstrings: - def findOrCreate(cls, input_topic): Searches for an existing document of the topics and retrieves it. Creates a new one if wasn't found - def fillInfo(self, input_topic):...
e1f74157adbfb52629dbce20fb0434f41eeb5111
<|skeleton|> class Topic: """Elasticsearch mapping for Topic document""" def findOrCreate(cls, input_topic): """Searches for an existing document of the topics and retrieves it. Creates a new one if wasn't found""" <|body_0|> def fillInfo(self, input_topic): """Fills in topic infor...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Topic: """Elasticsearch mapping for Topic document""" def findOrCreate(cls, input_topic): """Searches for an existing document of the topics and retrieves it. Creates a new one if wasn't found""" s = Search(using=client, index='xfurda00_topics').query('match', subCallId=int(input_topic['s...
the_stack_v2_python_sparse
src/topics_extractor/topics_extractor.py
JiriFurda/Bachelor-proj-2019
train
0
ecf0ae3302ffbf40b59515682ce2be3a81fed9f7
[ "if not isinstance(delay, datetime.timedelta):\n raise WrongTypeParameter('delay')\nself.delay = delay\nself.type1 = type1\nself.type2 = type2\nself.type1_buff = []\nself.type2_buff = []\nself.pair_ready = []", "second_report = main_buff[0]\ndiff = abs(report.timestamp - second_report.timestamp)\nwhile diff > ...
<|body_start_0|> if not isinstance(delay, datetime.timedelta): raise WrongTypeParameter('delay') self.delay = delay self.type1 = type1 self.type2 = type2 self.type1_buff = [] self.type2_buff = [] self.pair_ready = [] <|end_body_0|> <|body_start_1|> ...
Sync class Class that receive asynchronous data and synchronize them using their timestamp
Sync
[ "BSD-3-Clause", "Python-2.0", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Sync: """Sync class Class that receive asynchronous data and synchronize them using their timestamp""" def __init__(self, type1, type2, delay): """type1 : Report -> bool. Function that return true if the report can be identified as the first type of report type2 : Report -> bool. Fun...
stack_v2_sparse_classes_36k_train_020249
5,043
permissive
[ { "docstring": "type1 : Report -> bool. Function that return true if the report can be identified as the first type of report type2 : Report -> bool. Function that return true if the report can be identified as the second type of report delay : float maximal delay, in second, that is allowed between two report ...
4
stack_v2_sparse_classes_30k_train_010872
Implement the Python class `Sync` described below. Class description: Sync class Class that receive asynchronous data and synchronize them using their timestamp Method signatures and docstrings: - def __init__(self, type1, type2, delay): type1 : Report -> bool. Function that return true if the report can be identifie...
Implement the Python class `Sync` described below. Class description: Sync class Class that receive asynchronous data and synchronize them using their timestamp Method signatures and docstrings: - def __init__(self, type1, type2, delay): type1 : Report -> bool. Function that return true if the report can be identifie...
be3f1852ad38894c2bc487bbb3a30508ed8d6b50
<|skeleton|> class Sync: """Sync class Class that receive asynchronous data and synchronize them using their timestamp""" def __init__(self, type1, type2, delay): """type1 : Report -> bool. Function that return true if the report can be identified as the first type of report type2 : Report -> bool. Fun...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Sync: """Sync class Class that receive asynchronous data and synchronize them using their timestamp""" def __init__(self, type1, type2, delay): """type1 : Report -> bool. Function that return true if the report can be identified as the first type of report type2 : Report -> bool. Function that re...
the_stack_v2_python_sparse
powerapi/utils/sync.py
powerapi-ng/powerapi
train
143
0cb2f3f2c585b665afa1daad007282903caa93a1
[ "tk.Canvas.__init__(self, parent, **kwargs)\nself._color1 = color1\nself._color2 = color2\nself.bind('<Configure>', self._draw_gradient)\nself.config(relief='flat', highlightthickness=0)", "self.delete('gradient')\nwidth = self.winfo_width()\nheight = self.winfo_height()\nlimit = width\nr1, g1, b1 = self.winfo_rg...
<|body_start_0|> tk.Canvas.__init__(self, parent, **kwargs) self._color1 = color1 self._color2 = color2 self.bind('<Configure>', self._draw_gradient) self.config(relief='flat', highlightthickness=0) <|end_body_0|> <|body_start_1|> self.delete('gradient') width = ...
from Bryan Oakley on (https://stackoverflow.com/questions/26178869/ is-it-possible-to-apply-gradient-colours- to-bg-of-tkinter-python-widgets) A gradient frame which uses a canvas to draw the background parent: color11: 渐变颜色1 color22: 渐变颜色2
GradientCanvas
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GradientCanvas: """from Bryan Oakley on (https://stackoverflow.com/questions/26178869/ is-it-possible-to-apply-gradient-colours- to-bg-of-tkinter-python-widgets) A gradient frame which uses a canvas to draw the background parent: color11: 渐变颜色1 color22: 渐变颜色2""" def __init__(self, parent, co...
stack_v2_sparse_classes_36k_train_020250
19,682
no_license
[ { "docstring": "default gradient color: red to black", "name": "__init__", "signature": "def __init__(self, parent, color1='#ffc851', color2='#808000', **kwargs)" }, { "docstring": "Draw the gradient", "name": "_draw_gradient", "signature": "def _draw_gradient(self, event=None)" } ]
2
stack_v2_sparse_classes_30k_train_003915
Implement the Python class `GradientCanvas` described below. Class description: from Bryan Oakley on (https://stackoverflow.com/questions/26178869/ is-it-possible-to-apply-gradient-colours- to-bg-of-tkinter-python-widgets) A gradient frame which uses a canvas to draw the background parent: color11: 渐变颜色1 color22: 渐变颜色...
Implement the Python class `GradientCanvas` described below. Class description: from Bryan Oakley on (https://stackoverflow.com/questions/26178869/ is-it-possible-to-apply-gradient-colours- to-bg-of-tkinter-python-widgets) A gradient frame which uses a canvas to draw the background parent: color11: 渐变颜色1 color22: 渐变颜色...
440d168fd84bd98d2d9f2bc27b34ac9d7816a4e1
<|skeleton|> class GradientCanvas: """from Bryan Oakley on (https://stackoverflow.com/questions/26178869/ is-it-possible-to-apply-gradient-colours- to-bg-of-tkinter-python-widgets) A gradient frame which uses a canvas to draw the background parent: color11: 渐变颜色1 color22: 渐变颜色2""" def __init__(self, parent, co...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GradientCanvas: """from Bryan Oakley on (https://stackoverflow.com/questions/26178869/ is-it-possible-to-apply-gradient-colours- to-bg-of-tkinter-python-widgets) A gradient frame which uses a canvas to draw the background parent: color11: 渐变颜色1 color22: 渐变颜色2""" def __init__(self, parent, color1='#ffc851...
the_stack_v2_python_sparse
Lib/gpconfig/newGUI.py
hygnic/Gispot
train
0
4061472183baafba4c0d96b78631a5ae5c39b39b
[ "names = names or utils.generate_ids()\nsnapshots = []\nfor name in names:\n snapshot = self._client.create(name=name, description=description, volume_id=volume.id)\n snapshots.append(snapshot)\nif check:\n for snapshot in snapshots:\n self.check_snapshot_status(snapshot, [config.STATUS_AVAILABLE], ...
<|body_start_0|> names = names or utils.generate_ids() snapshots = [] for name in names: snapshot = self._client.create(name=name, description=description, volume_id=volume.id) snapshots.append(snapshot) if check: for snapshot in snapshots: ...
Snapshot steps.
SnapshotSteps
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SnapshotSteps: """Snapshot steps.""" def create_snapshots(self, volume, names=None, description=None, check=True): """Step to create snapshots. Args: volume (object): volume of the snapshots names (list): name of created snapshots, if not specified one snapshot name will be generated...
stack_v2_sparse_classes_36k_train_020251
6,612
no_license
[ { "docstring": "Step to create snapshots. Args: volume (object): volume of the snapshots names (list): name of created snapshots, if not specified one snapshot name will be generated description (str): snapshot description check (bool): flag whether to check step or not Returns: list: cinder volume snapshots Ra...
6
null
Implement the Python class `SnapshotSteps` described below. Class description: Snapshot steps. Method signatures and docstrings: - def create_snapshots(self, volume, names=None, description=None, check=True): Step to create snapshots. Args: volume (object): volume of the snapshots names (list): name of created snapsh...
Implement the Python class `SnapshotSteps` described below. Class description: Snapshot steps. Method signatures and docstrings: - def create_snapshots(self, volume, names=None, description=None, check=True): Step to create snapshots. Args: volume (object): volume of the snapshots names (list): name of created snapsh...
e7583444cd24893ec6ae237b47db7c605b99b0c5
<|skeleton|> class SnapshotSteps: """Snapshot steps.""" def create_snapshots(self, volume, names=None, description=None, check=True): """Step to create snapshots. Args: volume (object): volume of the snapshots names (list): name of created snapshots, if not specified one snapshot name will be generated...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SnapshotSteps: """Snapshot steps.""" def create_snapshots(self, volume, names=None, description=None, check=True): """Step to create snapshots. Args: volume (object): volume of the snapshots names (list): name of created snapshots, if not specified one snapshot name will be generated description ...
the_stack_v2_python_sparse
stepler/cinder/steps/snapshots.py
Mirantis/stepler
train
16
48e98fd8b552613dd7e0fa4ec1d9ac6299b32494
[ "if not root:\n return ''\nthe_list = list()\nbfs_queue = deque([root])\nwhile bfs_queue:\n node = bfs_queue.popleft()\n newList = ['-1', '-1', '-1']\n newList[0] = str(node.val)\n if node.left:\n bfs_queue.append(node.left)\n newList[1] = str(node.left.val)\n if node.right:\n ...
<|body_start_0|> if not root: return '' the_list = list() bfs_queue = deque([root]) while bfs_queue: node = bfs_queue.popleft() newList = ['-1', '-1', '-1'] newList[0] = str(node.val) if node.left: bfs_queue.appe...
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|> if not root: ...
stack_v2_sparse_classes_36k_train_020252
1,775
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...
7818b55f22afb178dfd250f26019653faadfee87
<|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.""" if not root: return '' the_list = list() bfs_queue = deque([root]) while bfs_queue: node = bfs_queue.popleft() newList = ['-1', '-1', '-1'] ...
the_stack_v2_python_sparse
LeetcodePython3/q0449.py
YujiaY/leetCodePractice
train
0
56db10d6252188e69f9a7a3b217e43dc785b6f7f
[ "self.rows = []\nself.cols = None\nif type(src) == str:\n utils.csv(src, self.add)\nelse:\n for v in src:\n self.add(v)", "if self.cols:\n if not hasattr(t, 'cells'):\n t = row.ROW(t)\n self.rows.append(t)\n self.cols.add(t)\nelse:\n self.cols = cols.COLS(t)", "data = DATA([self....
<|body_start_0|> self.rows = [] self.cols = None if type(src) == str: utils.csv(src, self.add) else: for v in src: self.add(v) <|end_body_0|> <|body_start_1|> if self.cols: if not hasattr(t, 'cells'): t = row.RO...
Stores rows, summarized into columns.
DATA
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DATA: """Stores rows, summarized into columns.""" def __init__(self, src=[]): """Constructor. Args: src (str/list, optional): Filename or list of data that DATA will be populated with. Defaults to [].""" <|body_0|> def add(self, t): """Adds a new row and updates ...
stack_v2_sparse_classes_36k_train_020253
1,825
permissive
[ { "docstring": "Constructor. Args: src (str/list, optional): Filename or list of data that DATA will be populated with. Defaults to [].", "name": "__init__", "signature": "def __init__(self, src=[])" }, { "docstring": "Adds a new row and updates column headers. Args: t (list): Data that will eit...
4
stack_v2_sparse_classes_30k_train_005938
Implement the Python class `DATA` described below. Class description: Stores rows, summarized into columns. Method signatures and docstrings: - def __init__(self, src=[]): Constructor. Args: src (str/list, optional): Filename or list of data that DATA will be populated with. Defaults to []. - def add(self, t): Adds a...
Implement the Python class `DATA` described below. Class description: Stores rows, summarized into columns. Method signatures and docstrings: - def __init__(self, src=[]): Constructor. Args: src (str/list, optional): Filename or list of data that DATA will be populated with. Defaults to []. - def add(self, t): Adds a...
e945665c701f4bd82dff7ced7bdc0f70add38774
<|skeleton|> class DATA: """Stores rows, summarized into columns.""" def __init__(self, src=[]): """Constructor. Args: src (str/list, optional): Filename or list of data that DATA will be populated with. Defaults to [].""" <|body_0|> def add(self, t): """Adds a new row and updates ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DATA: """Stores rows, summarized into columns.""" def __init__(self, src=[]): """Constructor. Args: src (str/list, optional): Filename or list of data that DATA will be populated with. Defaults to [].""" self.rows = [] self.cols = None if type(src) == str: util...
the_stack_v2_python_sparse
src/Homework2/data.py
SelenaChen123/AutomatedSoftwareEngineering
train
2
0548ffb517685355435c788e71568318e6325441
[ "self._config = config\nself._game_env = importlib.import_module(config['env_path'])\nself._FEATURES = {'board_history': {'size': config['history_step'] * config['planes_per_step'], 'function': self.get_board_history}, 'color': {'size': 1, 'function': lambda state: np.ones((1, state.height, state.width)) * (state.c...
<|body_start_0|> self._config = config self._game_env = importlib.import_module(config['env_path']) self._FEATURES = {'board_history': {'size': config['history_step'] * config['planes_per_step'], 'function': self.get_board_history}, 'color': {'size': 1, 'function': lambda state: np.ones((1, stat...
a class to convert from AlphaGo GameState objects to tensors of one-hot features for NN inputs
StateTensorConverter
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StateTensorConverter: """a class to convert from AlphaGo GameState objects to tensors of one-hot features for NN inputs""" def __init__(self, config, feature_list=None): """create a preprocessor object that will concatenate together the given list of features""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_020254
6,274
permissive
[ { "docstring": "create a preprocessor object that will concatenate together the given list of features", "name": "__init__", "signature": "def __init__(self, config, feature_list=None)" }, { "docstring": "A feature encoding WHITE and BLACK on separate planes of recent history_length states Args:...
3
stack_v2_sparse_classes_30k_train_005876
Implement the Python class `StateTensorConverter` described below. Class description: a class to convert from AlphaGo GameState objects to tensors of one-hot features for NN inputs Method signatures and docstrings: - def __init__(self, config, feature_list=None): create a preprocessor object that will concatenate tog...
Implement the Python class `StateTensorConverter` described below. Class description: a class to convert from AlphaGo GameState objects to tensors of one-hot features for NN inputs Method signatures and docstrings: - def __init__(self, config, feature_list=None): create a preprocessor object that will concatenate tog...
920162071c7a1557cbf45ffdecd840ee2b25b88f
<|skeleton|> class StateTensorConverter: """a class to convert from AlphaGo GameState objects to tensors of one-hot features for NN inputs""" def __init__(self, config, feature_list=None): """create a preprocessor object that will concatenate together the given list of features""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StateTensorConverter: """a class to convert from AlphaGo GameState objects to tensors of one-hot features for NN inputs""" def __init__(self, config, feature_list=None): """create a preprocessor object that will concatenate together the given list of features""" self._config = config ...
the_stack_v2_python_sparse
AlphaZero/processing/state_converter.py
water-vapor/AlphaZero
train
9
e7936574823b3a54b6fb376de1f70baad89dd8b1
[ "self.identifiers = None\nself._real_scalers = None\nself._cat_scalers = None\nself._target_scaler = None\nself._num_classes_per_cat_input = None\nself._time_steps = get_fixed_params()['total_time_steps']\nself._num_encoder_steps = get_fixed_params()['num_encoder_steps']", "print_info('Formatting train-valid-test...
<|body_start_0|> self.identifiers = None self._real_scalers = None self._cat_scalers = None self._target_scaler = None self._num_classes_per_cat_input = None self._time_steps = get_fixed_params()['total_time_steps'] self._num_encoder_steps = get_fixed_params()['nu...
Defines and formats data for the electricity dataset. Note that per-entity z-score normalization is used here, and is implemented across functions. Attributes: column_definition: Defines input and data type of column used in the experiment. identifiers: Entity identifiers used in experiments.
ElectricityFormatter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ElectricityFormatter: """Defines and formats data for the electricity dataset. Note that per-entity z-score normalization is used here, and is implemented across functions. Attributes: column_definition: Defines input and data type of column used in the experiment. identifiers: Entity identifiers...
stack_v2_sparse_classes_36k_train_020255
16,393
permissive
[ { "docstring": "Initialises formatter.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Splits data frame into training-validation-test data frames. This also calibrates scaling object, and transforms data for each split. Args: df: Source data frame to split. valid_boun...
5
stack_v2_sparse_classes_30k_train_019710
Implement the Python class `ElectricityFormatter` described below. Class description: Defines and formats data for the electricity dataset. Note that per-entity z-score normalization is used here, and is implemented across functions. Attributes: column_definition: Defines input and data type of column used in the expe...
Implement the Python class `ElectricityFormatter` described below. Class description: Defines and formats data for the electricity dataset. Note that per-entity z-score normalization is used here, and is implemented across functions. Attributes: column_definition: Defines input and data type of column used in the expe...
7929adbe91e9cfe8dc5dc1daad5ae7392f9719a0
<|skeleton|> class ElectricityFormatter: """Defines and formats data for the electricity dataset. Note that per-entity z-score normalization is used here, and is implemented across functions. Attributes: column_definition: Defines input and data type of column used in the experiment. identifiers: Entity identifiers...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ElectricityFormatter: """Defines and formats data for the electricity dataset. Note that per-entity z-score normalization is used here, and is implemented across functions. Attributes: column_definition: Defines input and data type of column used in the experiment. identifiers: Entity identifiers used in expe...
the_stack_v2_python_sparse
tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/electricity_time_series_forecasting.py
openvinotoolkit/open_model_zoo
train
1,712
dcf928476a8b513aa23d3612769ff87814410418
[ "super().__init__(s3_client)\nself.big_query_instance = big_query_instance or NpmBigQuery()\nself.big_query_content = list()\nself.counter = Counter()\nself.bucket_name = self.s3_client.bucket_name if self.s3_client else 'developer-analytics-audit-report'\nself.filename = '{}/big-query-data/{}'.format(os.getenv('DE...
<|body_start_0|> super().__init__(s3_client) self.big_query_instance = big_query_instance or NpmBigQuery() self.big_query_content = list() self.counter = Counter() self.bucket_name = self.s3_client.bucket_name if self.s3_client else 'developer-analytics-audit-report' self...
Implementation data processing for npm bigquery.
NpmBQDataProcessing
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NpmBQDataProcessing: """Implementation data processing for npm bigquery.""" def __init__(self, big_query_instance=None, s3_client=None, file_name='collated.json'): """Initialize the BigQueryDataProcessing object.""" <|body_0|> def process(self): """Process Npm Bi...
stack_v2_sparse_classes_36k_train_020256
4,542
permissive
[ { "docstring": "Initialize the BigQueryDataProcessing object.", "name": "__init__", "signature": "def __init__(self, big_query_instance=None, s3_client=None, file_name='collated.json')" }, { "docstring": "Process Npm Bigquery response data.", "name": "process", "signature": "def process(...
4
stack_v2_sparse_classes_30k_train_008152
Implement the Python class `NpmBQDataProcessing` described below. Class description: Implementation data processing for npm bigquery. Method signatures and docstrings: - def __init__(self, big_query_instance=None, s3_client=None, file_name='collated.json'): Initialize the BigQueryDataProcessing object. - def process(...
Implement the Python class `NpmBQDataProcessing` described below. Class description: Implementation data processing for npm bigquery. Method signatures and docstrings: - def __init__(self, big_query_instance=None, s3_client=None, file_name='collated.json'): Initialize the BigQueryDataProcessing object. - def process(...
98f5d8f6e402dfed3b9ba9385040eacbb0a12bc3
<|skeleton|> class NpmBQDataProcessing: """Implementation data processing for npm bigquery.""" def __init__(self, big_query_instance=None, s3_client=None, file_name='collated.json'): """Initialize the BigQueryDataProcessing object.""" <|body_0|> def process(self): """Process Npm Bi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NpmBQDataProcessing: """Implementation data processing for npm bigquery.""" def __init__(self, big_query_instance=None, s3_client=None, file_name='collated.json'): """Initialize the BigQueryDataProcessing object.""" super().__init__(s3_client) self.big_query_instance = big_query_i...
the_stack_v2_python_sparse
rudra/data_store/bigquery/npm_bigquery.py
fabric8-analytics/fabric8-analytics-rudra
train
3
671b5ce6e736370771b54b63da500af5dac0c5ec
[ "self.aws_kms = aws_kms\nself.cryptsoft_kms = cryptsoft_kms\nself.id = id\nself.server_name = server_name", "if dictionary is None:\n return None\naws_kms = cohesity_management_sdk.models.aws_kms_update_params.AwsKmsUpdateParams.from_dictionary(dictionary.get('awsKms')) if dictionary.get('awsKms') else None\nc...
<|body_start_0|> self.aws_kms = aws_kms self.cryptsoft_kms = cryptsoft_kms self.id = id self.server_name = server_name <|end_body_0|> <|body_start_1|> if dictionary is None: return None aws_kms = cohesity_management_sdk.models.aws_kms_update_params.AwsKmsUpda...
Implementation of the 'KmsUpdateRequestParameters' model. Request to create a KMS with specified configuration. Attributes: aws_kms (AwsKmsUpdateParams): AWS KMS conifg. cryptsoft_kms (CryptsoftKmsUpdateParams): Cryptsoft KMS config. id (int): The Id of a KMS server. server_name (string): Specifies the name given to th...
KmsUpdateRequestParameters
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KmsUpdateRequestParameters: """Implementation of the 'KmsUpdateRequestParameters' model. Request to create a KMS with specified configuration. Attributes: aws_kms (AwsKmsUpdateParams): AWS KMS conifg. cryptsoft_kms (CryptsoftKmsUpdateParams): Cryptsoft KMS config. id (int): The Id of a KMS server...
stack_v2_sparse_classes_36k_train_020257
2,430
permissive
[ { "docstring": "Constructor for the KmsUpdateRequestParameters class", "name": "__init__", "signature": "def __init__(self, aws_kms=None, cryptsoft_kms=None, id=None, server_name=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictio...
2
stack_v2_sparse_classes_30k_train_006377
Implement the Python class `KmsUpdateRequestParameters` described below. Class description: Implementation of the 'KmsUpdateRequestParameters' model. Request to create a KMS with specified configuration. Attributes: aws_kms (AwsKmsUpdateParams): AWS KMS conifg. cryptsoft_kms (CryptsoftKmsUpdateParams): Cryptsoft KMS c...
Implement the Python class `KmsUpdateRequestParameters` described below. Class description: Implementation of the 'KmsUpdateRequestParameters' model. Request to create a KMS with specified configuration. Attributes: aws_kms (AwsKmsUpdateParams): AWS KMS conifg. cryptsoft_kms (CryptsoftKmsUpdateParams): Cryptsoft KMS c...
0093194d125fc6746f55b8499da1270c64f473fc
<|skeleton|> class KmsUpdateRequestParameters: """Implementation of the 'KmsUpdateRequestParameters' model. Request to create a KMS with specified configuration. Attributes: aws_kms (AwsKmsUpdateParams): AWS KMS conifg. cryptsoft_kms (CryptsoftKmsUpdateParams): Cryptsoft KMS config. id (int): The Id of a KMS server...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KmsUpdateRequestParameters: """Implementation of the 'KmsUpdateRequestParameters' model. Request to create a KMS with specified configuration. Attributes: aws_kms (AwsKmsUpdateParams): AWS KMS conifg. cryptsoft_kms (CryptsoftKmsUpdateParams): Cryptsoft KMS config. id (int): The Id of a KMS server. server_name...
the_stack_v2_python_sparse
cohesity_management_sdk/models/kms_update_request_parameters.py
hsantoyo2/management-sdk-python
train
0
fdfdc9deef7c9eaf453a35317d6cfc378447f169
[ "self.estimation_skipped = estimation_skipped\nself.num_bytes_copied = num_bytes_copied\nself.num_directories_copied = num_directories_copied\nself.num_files_copied = num_files_copied\nself.total_bytes_to_copy = total_bytes_to_copy\nself.total_directories_to_copy = total_directories_to_copy\nself.total_files_to_cop...
<|body_start_0|> self.estimation_skipped = estimation_skipped self.num_bytes_copied = num_bytes_copied self.num_directories_copied = num_directories_copied self.num_files_copied = num_files_copied self.total_bytes_to_copy = total_bytes_to_copy self.total_directories_to_co...
Implementation of the 'RestoreFileCopyStats' model. This message captures the progress information regarding restore of file/directory. Attributes: estimation_skipped (bool): This will be set to true if the estimation step was skipped. NOTE: If estimation is skipped, then progress info will not be available. num_bytes_...
RestoreFileCopyStats
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RestoreFileCopyStats: """Implementation of the 'RestoreFileCopyStats' model. This message captures the progress information regarding restore of file/directory. Attributes: estimation_skipped (bool): This will be set to true if the estimation step was skipped. NOTE: If estimation is skipped, then...
stack_v2_sparse_classes_36k_train_020258
3,731
permissive
[ { "docstring": "Constructor for the RestoreFileCopyStats class", "name": "__init__", "signature": "def __init__(self, estimation_skipped=None, num_bytes_copied=None, num_directories_copied=None, num_files_copied=None, total_bytes_to_copy=None, total_directories_to_copy=None, total_files_to_copy=None)" ...
2
null
Implement the Python class `RestoreFileCopyStats` described below. Class description: Implementation of the 'RestoreFileCopyStats' model. This message captures the progress information regarding restore of file/directory. Attributes: estimation_skipped (bool): This will be set to true if the estimation step was skippe...
Implement the Python class `RestoreFileCopyStats` described below. Class description: Implementation of the 'RestoreFileCopyStats' model. This message captures the progress information regarding restore of file/directory. Attributes: estimation_skipped (bool): This will be set to true if the estimation step was skippe...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class RestoreFileCopyStats: """Implementation of the 'RestoreFileCopyStats' model. This message captures the progress information regarding restore of file/directory. Attributes: estimation_skipped (bool): This will be set to true if the estimation step was skipped. NOTE: If estimation is skipped, then...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RestoreFileCopyStats: """Implementation of the 'RestoreFileCopyStats' model. This message captures the progress information regarding restore of file/directory. Attributes: estimation_skipped (bool): This will be set to true if the estimation step was skipped. NOTE: If estimation is skipped, then progress inf...
the_stack_v2_python_sparse
cohesity_management_sdk/models/restore_file_copy_stats.py
cohesity/management-sdk-python
train
24
174b7c15465ac94860a1591cc032f9dde78c23fc
[ "if data == wtypes.Unset:\n return ''\nif not isinstance(data, bytes):\n data = data.encode('utf-8')\nreturn data", "pyscripts = db_api.get_instance()\nscript_list = []\nscript_uuid_list = pyscripts.list_scripts()\nfor script_uuid in script_uuid_list:\n script_db = pyscripts.get_script(uuid=script_uuid)\...
<|body_start_0|> if data == wtypes.Unset: return '' if not isinstance(data, bytes): data = data.encode('utf-8') return data <|end_body_0|> <|body_start_1|> pyscripts = db_api.get_instance() script_list = [] script_uuid_list = pyscripts.list_script...
Controller responsible of scripts management.
PyScriptsScriptsController
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PyScriptsScriptsController: """Controller responsible of scripts management.""" def normalize_data(self, data): """Translate data to binary format if needed. :param data: Data to convert to binary type.""" <|body_0|> def get_all(self, no_data=False): """Get the s...
stack_v2_sparse_classes_36k_train_020259
4,919
permissive
[ { "docstring": "Translate data to binary format if needed. :param data: Data to convert to binary type.", "name": "normalize_data", "signature": "def normalize_data(self, data)" }, { "docstring": "Get the script list :param no_data: Set to True to remove script data from output. :return: List of...
6
null
Implement the Python class `PyScriptsScriptsController` described below. Class description: Controller responsible of scripts management. Method signatures and docstrings: - def normalize_data(self, data): Translate data to binary format if needed. :param data: Data to convert to binary type. - def get_all(self, no_d...
Implement the Python class `PyScriptsScriptsController` described below. Class description: Controller responsible of scripts management. Method signatures and docstrings: - def normalize_data(self, data): Translate data to binary format if needed. :param data: Data to convert to binary type. - def get_all(self, no_d...
94630b97cd1fb4bdd9a638070ffbbe3625de8aa2
<|skeleton|> class PyScriptsScriptsController: """Controller responsible of scripts management.""" def normalize_data(self, data): """Translate data to binary format if needed. :param data: Data to convert to binary type.""" <|body_0|> def get_all(self, no_data=False): """Get the s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PyScriptsScriptsController: """Controller responsible of scripts management.""" def normalize_data(self, data): """Translate data to binary format if needed. :param data: Data to convert to binary type.""" if data == wtypes.Unset: return '' if not isinstance(data, byte...
the_stack_v2_python_sparse
cloudkitty/rating/pyscripts/controllers/script.py
openstack/cloudkitty
train
103
071f4c03e46ce46c28cbbbd95c7d99f8c65b7268
[ "def thd(engine):\n repo = migrate.versioning.repository.Repository(self.repo_path)\n repo_version = repo.latest\n try:\n schema = migrate.versioning.schema.ControlledSchema(engine, self.repo_path)\n db_version = schema.version\n except migrate.versioning.exceptions.DatabaseNotControlledEr...
<|body_start_0|> def thd(engine): repo = migrate.versioning.repository.Repository(self.repo_path) repo_version = repo.latest try: schema = migrate.versioning.schema.ControlledSchema(engine, self.repo_path) db_version = schema.version ...
DBConnector component to handle the database model; an instance is available at C{master.db.model}. This class has attributes for each defined table, as well as methods to handle schema migration (using sqlalchemy-migrate). View the source to see the table definitions. Note that the Buildbot metadata is never bound to ...
Model
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Model: """DBConnector component to handle the database model; an instance is available at C{master.db.model}. This class has attributes for each defined table, as well as methods to handle schema migration (using sqlalchemy-migrate). View the source to see the table definitions. Note that the Bui...
stack_v2_sparse_classes_36k_train_020260
19,379
no_license
[ { "docstring": "Returns true (via deferred) if the database's version is up to date.", "name": "is_current", "signature": "def is_current(self)" }, { "docstring": "Upgrade the database to the most recent schema version, returning a deferred.", "name": "upgrade", "signature": "def upgrade...
2
null
Implement the Python class `Model` described below. Class description: DBConnector component to handle the database model; an instance is available at C{master.db.model}. This class has attributes for each defined table, as well as methods to handle schema migration (using sqlalchemy-migrate). View the source to see t...
Implement the Python class `Model` described below. Class description: DBConnector component to handle the database model; an instance is available at C{master.db.model}. This class has attributes for each defined table, as well as methods to handle schema migration (using sqlalchemy-migrate). View the source to see t...
8f2806e1b83ff1df5f6f6313089c0d1d1f2fe288
<|skeleton|> class Model: """DBConnector component to handle the database model; an instance is available at C{master.db.model}. This class has attributes for each defined table, as well as methods to handle schema migration (using sqlalchemy-migrate). View the source to see the table definitions. Note that the Bui...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Model: """DBConnector component to handle the database model; an instance is available at C{master.db.model}. This class has attributes for each defined table, as well as methods to handle schema migration (using sqlalchemy-migrate). View the source to see the table definitions. Note that the Buildbot metadat...
the_stack_v2_python_sparse
Lib/site-packages/buildbot/db/model.py
acmiyaguchi/buildbotve
train
0
3174f358a133df37426375e232b458d47dfdd80f
[ "all_actions = [str(a) for a in all_actions]\nself.all_actions = sorted(all_actions)\nself.actionstr_to_idx = {str(a): i for i, a in enumerate(self.all_actions)}\nself.all_obs = {'a': sorted(all_obs, key=lambda x: not has_player_ref(x, 'a')), 'b': sorted(all_obs, key=lambda x: not has_player_ref(x, 'b'))}\nself.obs...
<|body_start_0|> all_actions = [str(a) for a in all_actions] self.all_actions = sorted(all_actions) self.actionstr_to_idx = {str(a): i for i, a in enumerate(self.all_actions)} self.all_obs = {'a': sorted(all_obs, key=lambda x: not has_player_ref(x, 'a')), 'b': sorted(all_obs, key=lambda ...
A class used to encode a game definition and its states and actions into valued vectors using a hot-one encoding
GameEncoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GameEncoder: """A class used to encode a game definition and its states and actions into valued vectors using a hot-one encoding""" def __init__(self, all_actions, all_obs): """Creates a game encoder from a game_def. Args: all_actions (list): A list will all the possible actions all_...
stack_v2_sparse_classes_36k_train_020261
3,930
no_license
[ { "docstring": "Creates a game encoder from a game_def. Args: all_actions (list): A list will all the possible actions all_obs (list): A list with all possible observations (fluents) Automatically computed attributes: actionstr_to_idx (dic): A dictionary that given a string representation of an action will retu...
5
stack_v2_sparse_classes_30k_train_002084
Implement the Python class `GameEncoder` described below. Class description: A class used to encode a game definition and its states and actions into valued vectors using a hot-one encoding Method signatures and docstrings: - def __init__(self, all_actions, all_obs): Creates a game encoder from a game_def. Args: all_...
Implement the Python class `GameEncoder` described below. Class description: A class used to encode a game definition and its states and actions into valued vectors using a hot-one encoding Method signatures and docstrings: - def __init__(self, all_actions, all_obs): Creates a game encoder from a game_def. Args: all_...
d4ef7595c2b9be928ab99eb0c6e18b2ee6b87f67
<|skeleton|> class GameEncoder: """A class used to encode a game definition and its states and actions into valued vectors using a hot-one encoding""" def __init__(self, all_actions, all_obs): """Creates a game encoder from a game_def. Args: all_actions (list): A list will all the possible actions all_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GameEncoder: """A class used to encode a game definition and its states and actions into valued vectors using a hot-one encoding""" def __init__(self, all_actions, all_obs): """Creates a game encoder from a game_def. Args: all_actions (list): A list will all the possible actions all_obs (list): A...
the_stack_v2_python_sparse
src/structures/game_encoder.py
susuhahnml/asp-game-ml-strategies
train
1
a17927e3d2953aeb9956b37e9c1924ff3d06a7a1
[ "median = raw_scores[test_key]\nscore = 0\nif 'hostconn' == test_key:\n if median > 2:\n score = 100\n elif median == 2:\n score = 50\n else:\n score = 0\nelif 'maxconn' == test_key:\n if median > 20:\n score = 100\n elif median >= 10:\n score = 50\n else:\n ...
<|body_start_0|> median = raw_scores[test_key] score = 0 if 'hostconn' == test_key: if median > 2: score = 100 elif median == 2: score = 50 else: score = 0 elif 'maxconn' == test_key: if media...
CookiesTestSet
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CookiesTestSet: def GetTestScoreAndDisplayValue(self, test_key, raw_scores): """Get a normalized score (0 to 100) and a value to output to the display. Args: test_key: a key for a test_set test. raw_scores: a dict of raw_scores indexed by test keys. Returns: score, display_value # score ...
stack_v2_sparse_classes_36k_train_020262
7,631
permissive
[ { "docstring": "Get a normalized score (0 to 100) and a value to output to the display. Args: test_key: a key for a test_set test. raw_scores: a dict of raw_scores indexed by test keys. Returns: score, display_value # score is from 0 to 100. # display_value is the text for the cell.", "name": "GetTestScoreA...
2
stack_v2_sparse_classes_30k_train_020114
Implement the Python class `CookiesTestSet` described below. Class description: Implement the CookiesTestSet class. Method signatures and docstrings: - def GetTestScoreAndDisplayValue(self, test_key, raw_scores): Get a normalized score (0 to 100) and a value to output to the display. Args: test_key: a key for a test_...
Implement the Python class `CookiesTestSet` described below. Class description: Implement the CookiesTestSet class. Method signatures and docstrings: - def GetTestScoreAndDisplayValue(self, test_key, raw_scores): Get a normalized score (0 to 100) and a value to output to the display. Args: test_key: a key for a test_...
f0b3670d4692742d5f2e6cf605bce9b1a4b8ca1b
<|skeleton|> class CookiesTestSet: def GetTestScoreAndDisplayValue(self, test_key, raw_scores): """Get a normalized score (0 to 100) and a value to output to the display. Args: test_key: a key for a test_set test. raw_scores: a dict of raw_scores indexed by test keys. Returns: score, display_value # score ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CookiesTestSet: def GetTestScoreAndDisplayValue(self, test_key, raw_scores): """Get a normalized score (0 to 100) and a value to output to the display. Args: test_key: a key for a test_set test. raw_scores: a dict of raw_scores indexed by test keys. Returns: score, display_value # score is from 0 to 1...
the_stack_v2_python_sparse
categories/cookies/test_set.py
IIKovalenko/browserscope
train
1
c85a64827772d4b4b2c719d37fe796caefaa3245
[ "try:\n login_time = int(time.time())\n lens = len(config.SECRET_KEY)\n lenx = lens - (lens % 4 if lens % 4 else 4)\n secret = base64.decodestring(config.SECRET_KEY[:lenx])\n payload = {'exp': datetime.datetime.utcnow() + datetime.timedelta(days=0, seconds=10), 'userid': user_id, 'sub': user_name, 'a...
<|body_start_0|> try: login_time = int(time.time()) lens = len(config.SECRET_KEY) lenx = lens - (lens % 4 if lens % 4 else 4) secret = base64.decodestring(config.SECRET_KEY[:lenx]) payload = {'exp': datetime.datetime.utcnow() + datetime.timedelta(days=...
Auth
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Auth: def encode_auth_token(user_id, user_name): """生成认证Token :param user_id: int :param login_time: int(timestamp) :return: string""" <|body_0|> def decode_auth_token(auth_token): """验证Token :param auth_token: :return: integer|string""" <|body_1|> def a...
stack_v2_sparse_classes_36k_train_020263
3,926
no_license
[ { "docstring": "生成认证Token :param user_id: int :param login_time: int(timestamp) :return: string", "name": "encode_auth_token", "signature": "def encode_auth_token(user_id, user_name)" }, { "docstring": "验证Token :param auth_token: :return: integer|string", "name": "decode_auth_token", "si...
4
stack_v2_sparse_classes_30k_train_002326
Implement the Python class `Auth` described below. Class description: Implement the Auth class. Method signatures and docstrings: - def encode_auth_token(user_id, user_name): 生成认证Token :param user_id: int :param login_time: int(timestamp) :return: string - def decode_auth_token(auth_token): 验证Token :param auth_token:...
Implement the Python class `Auth` described below. Class description: Implement the Auth class. Method signatures and docstrings: - def encode_auth_token(user_id, user_name): 生成认证Token :param user_id: int :param login_time: int(timestamp) :return: string - def decode_auth_token(auth_token): 验证Token :param auth_token:...
ae330a3698afda59ed3f5e75198b55571fe80030
<|skeleton|> class Auth: def encode_auth_token(user_id, user_name): """生成认证Token :param user_id: int :param login_time: int(timestamp) :return: string""" <|body_0|> def decode_auth_token(auth_token): """验证Token :param auth_token: :return: integer|string""" <|body_1|> def a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Auth: def encode_auth_token(user_id, user_name): """生成认证Token :param user_id: int :param login_time: int(timestamp) :return: string""" try: login_time = int(time.time()) lens = len(config.SECRET_KEY) lenx = lens - (lens % 4 if lens % 4 else 4) se...
the_stack_v2_python_sparse
app/auth/auths.py
jetyang2005/flask_ml
train
1
ef3678afef6f632b26c0e14a6963f72d7063b05f
[ "print('Loaded ' + model_dir + model_name)\nself.nS, self.nU = (16, 2)\nself.maxU, self.minU = (np.array([1.8, 140.0]), np.array([0.57, 75.0]))\nself.x0mu, self.x0sig = (870, 12)\nmodel_cfg = DotMap(model_dir=model_dir, name=model_name, load_model=True)\nself.model = BNN(model_cfg)\nself.model.finalize(tf.train.Ada...
<|body_start_0|> print('Loaded ' + model_dir + model_name) self.nS, self.nU = (16, 2) self.maxU, self.minU = (np.array([1.8, 140.0]), np.array([0.57, 75.0])) self.x0mu, self.x0sig = (870, 12) model_cfg = DotMap(model_dir=model_dir, name=model_name, load_model=True) self.m...
MachineModelEnv
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MachineModelEnv: def __init__(self, model_dir, model_name, ac_cost, state_cost, stochastic=True, randInit=True): """Inputs: model_dir (str), location of files from which to save model model_name (str), name of model (same as that of the saved files) cannot be 'model' (errors raised in MP...
stack_v2_sparse_classes_36k_train_020264
3,199
no_license
[ { "docstring": "Inputs: model_dir (str), location of files from which to save model model_name (str), name of model (same as that of the saved files) cannot be 'model' (errors raised in MPC) ac_cost (func), returns cost associated with a particular action state_cost (func), returns cost associated with a partic...
4
stack_v2_sparse_classes_30k_train_003921
Implement the Python class `MachineModelEnv` described below. Class description: Implement the MachineModelEnv class. Method signatures and docstrings: - def __init__(self, model_dir, model_name, ac_cost, state_cost, stochastic=True, randInit=True): Inputs: model_dir (str), location of files from which to save model ...
Implement the Python class `MachineModelEnv` described below. Class description: Implement the MachineModelEnv class. Method signatures and docstrings: - def __init__(self, model_dir, model_name, ac_cost, state_cost, stochastic=True, randInit=True): Inputs: model_dir (str), location of files from which to save model ...
b3384e8109f73e91925ea70fa100ea881fc9763d
<|skeleton|> class MachineModelEnv: def __init__(self, model_dir, model_name, ac_cost, state_cost, stochastic=True, randInit=True): """Inputs: model_dir (str), location of files from which to save model model_name (str), name of model (same as that of the saved files) cannot be 'model' (errors raised in MP...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MachineModelEnv: def __init__(self, model_dir, model_name, ac_cost, state_cost, stochastic=True, randInit=True): """Inputs: model_dir (str), location of files from which to save model model_name (str), name of model (same as that of the saved files) cannot be 'model' (errors raised in MPC) ac_cost (fu...
the_stack_v2_python_sparse
sim_model/machine_model.py
RicardoDominguez/machine-control
train
0
61fe90763c060ddfb2ad7768456acf1dc3c813d4
[ "self.environment = environment\nself.relative_snapshot_directory = relative_snapshot_directory\nself.root_path = root_path\nself.source_snapshot_create_time_usecs = source_snapshot_create_time_usecs\nself.source_snapshot_name = source_snapshot_name\nself.view_name = view_name", "if dictionary is None:\n retur...
<|body_start_0|> self.environment = environment self.relative_snapshot_directory = relative_snapshot_directory self.root_path = root_path self.source_snapshot_create_time_usecs = source_snapshot_create_time_usecs self.source_snapshot_name = source_snapshot_name self.view_...
Implementation of the 'SnapshotInfo' model. Specifies details about the snapshot task created to backup or copy one source object like a VM. Attributes: environment (EnvironmentSnapshotInfoEnum): Specifies the environment type (such as kVMware or kSQL) that contains the source to backup. Supported environment types suc...
SnapshotInfo
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SnapshotInfo: """Implementation of the 'SnapshotInfo' model. Specifies details about the snapshot task created to backup or copy one source object like a VM. Attributes: environment (EnvironmentSnapshotInfoEnum): Specifies the environment type (such as kVMware or kSQL) that contains the source to...
stack_v2_sparse_classes_36k_train_020265
7,355
permissive
[ { "docstring": "Constructor for the SnapshotInfo class", "name": "__init__", "signature": "def __init__(self, environment=None, relative_snapshot_directory=None, root_path=None, source_snapshot_create_time_usecs=None, source_snapshot_name=None, view_name=None)" }, { "docstring": "Creates an inst...
2
stack_v2_sparse_classes_30k_train_019249
Implement the Python class `SnapshotInfo` described below. Class description: Implementation of the 'SnapshotInfo' model. Specifies details about the snapshot task created to backup or copy one source object like a VM. Attributes: environment (EnvironmentSnapshotInfoEnum): Specifies the environment type (such as kVMwa...
Implement the Python class `SnapshotInfo` described below. Class description: Implementation of the 'SnapshotInfo' model. Specifies details about the snapshot task created to backup or copy one source object like a VM. Attributes: environment (EnvironmentSnapshotInfoEnum): Specifies the environment type (such as kVMwa...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class SnapshotInfo: """Implementation of the 'SnapshotInfo' model. Specifies details about the snapshot task created to backup or copy one source object like a VM. Attributes: environment (EnvironmentSnapshotInfoEnum): Specifies the environment type (such as kVMware or kSQL) that contains the source to...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SnapshotInfo: """Implementation of the 'SnapshotInfo' model. Specifies details about the snapshot task created to backup or copy one source object like a VM. Attributes: environment (EnvironmentSnapshotInfoEnum): Specifies the environment type (such as kVMware or kSQL) that contains the source to backup. Supp...
the_stack_v2_python_sparse
cohesity_management_sdk/models/snapshot_info.py
cohesity/management-sdk-python
train
24
f0ab0569da86f0794dc9af9bcf3226a44e534656
[ "res = super(ResConfigSettings, self).get_values()\nparams = self.env['ir.config_parameter'].sudo().get_param\npos_all_order = params('pos_all_orders.pos_all_order')\nn_days = params('pos_all_orders.n_days')\nres.update(pos_all_order=pos_all_order, n_days=n_days)\nreturn res", "super(ResConfigSettings, self).set_...
<|body_start_0|> res = super(ResConfigSettings, self).get_values() params = self.env['ir.config_parameter'].sudo().get_param pos_all_order = params('pos_all_orders.pos_all_order') n_days = params('pos_all_orders.n_days') res.update(pos_all_order=pos_all_order, n_days=n_days) ...
ResConfigSettings
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResConfigSettings: def get_values(self): """get values from the fields""" <|body_0|> def set_values(self): """Set values in the fields""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = super(ResConfigSettings, self).get_values() params =...
stack_v2_sparse_classes_36k_train_020266
4,742
no_license
[ { "docstring": "get values from the fields", "name": "get_values", "signature": "def get_values(self)" }, { "docstring": "Set values in the fields", "name": "set_values", "signature": "def set_values(self)" } ]
2
stack_v2_sparse_classes_30k_train_011742
Implement the Python class `ResConfigSettings` described below. Class description: Implement the ResConfigSettings class. Method signatures and docstrings: - def get_values(self): get values from the fields - def set_values(self): Set values in the fields
Implement the Python class `ResConfigSettings` described below. Class description: Implement the ResConfigSettings class. Method signatures and docstrings: - def get_values(self): get values from the fields - def set_values(self): Set values in the fields <|skeleton|> class ResConfigSettings: def get_values(sel...
4b1bcb8f17aad44fe9c80a8180eb0128e6bb2c14
<|skeleton|> class ResConfigSettings: def get_values(self): """get values from the fields""" <|body_0|> def set_values(self): """Set values in the fields""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResConfigSettings: def get_values(self): """get values from the fields""" res = super(ResConfigSettings, self).get_values() params = self.env['ir.config_parameter'].sudo().get_param pos_all_order = params('pos_all_orders.pos_all_order') n_days = params('pos_all_orders.n...
the_stack_v2_python_sparse
pos_all_orders/models/pos_session.py
CybroOdoo/CybroAddons
train
209
09b2cc64b876f149e10e7fbef582ea1331c4431c
[ "if prev_buffer is None:\n self.states = []\n self.actions = []\n self.rewards = []\n self.dones = []\n self.exits = []\n self.next_states = []\n self.position = 0\n self.capacity = float(capacity)\nelse:\n fill = min(capacity, prev_buffer.capacity)\n self.states = prev_buffer.states[-...
<|body_start_0|> if prev_buffer is None: self.states = [] self.actions = [] self.rewards = [] self.dones = [] self.exits = [] self.next_states = [] self.position = 0 self.capacity = float(capacity) else: ...
ReplayBuffer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReplayBuffer: def __init__(self, capacity, prev_buffer=None): """This class implements a replay buffer where the relevant information of past experiences is stored and can be sampled from. :param capacity: (int) The desired capacity of the buffer. No more than this number of replay data ...
stack_v2_sparse_classes_36k_train_020267
5,651
no_license
[ { "docstring": "This class implements a replay buffer where the relevant information of past experiences is stored and can be sampled from. :param capacity: (int) The desired capacity of the buffer. No more than this number of replay data will be stored. :param prev_buffer: (ReplayBuffer) A previously collected...
3
stack_v2_sparse_classes_30k_train_001735
Implement the Python class `ReplayBuffer` described below. Class description: Implement the ReplayBuffer class. Method signatures and docstrings: - def __init__(self, capacity, prev_buffer=None): This class implements a replay buffer where the relevant information of past experiences is stored and can be sampled from...
Implement the Python class `ReplayBuffer` described below. Class description: Implement the ReplayBuffer class. Method signatures and docstrings: - def __init__(self, capacity, prev_buffer=None): This class implements a replay buffer where the relevant information of past experiences is stored and can be sampled from...
517a355f174346e0c99320a01bf597095a632341
<|skeleton|> class ReplayBuffer: def __init__(self, capacity, prev_buffer=None): """This class implements a replay buffer where the relevant information of past experiences is stored and can be sampled from. :param capacity: (int) The desired capacity of the buffer. No more than this number of replay data ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReplayBuffer: def __init__(self, capacity, prev_buffer=None): """This class implements a replay buffer where the relevant information of past experiences is stored and can be sampled from. :param capacity: (int) The desired capacity of the buffer. No more than this number of replay data will be stored...
the_stack_v2_python_sparse
utils/replay_buffer.py
nphamilton/rl_library
train
2
dc53df9448c0be28b7793616e9afa47ca9da9db9
[ "self.chassis_serial = chassis_serial\nself.connected_to = connected_to\nself.hostname = hostname\nself.id = id\nself.ip = ip\nself.ipmi_ip = ipmi_ip\nself.ips = ips\nself.node_serial = node_serial\nself.node_ui_slot = node_ui_slot\nself.num_slots_in_chassis = num_slots_in_chassis\nself.product_model = product_mode...
<|body_start_0|> self.chassis_serial = chassis_serial self.connected_to = connected_to self.hostname = hostname self.id = id self.ip = ip self.ipmi_ip = ipmi_ip self.ips = ips self.node_serial = node_serial self.node_ui_slot = node_ui_slot ...
Implementation of the 'FreeNodeInformation' model. Specifies the Metadata of a free Node on the network. Attributes: chassis_serial (string): Specifies the serial number of the Chassis the Node is installed in. connected_to (bool): Specifies whether or not this is the Node that is sending the response. hostname (string...
FreeNodeInformation
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FreeNodeInformation: """Implementation of the 'FreeNodeInformation' model. Specifies the Metadata of a free Node on the network. Attributes: chassis_serial (string): Specifies the serial number of the Chassis the Node is installed in. connected_to (bool): Specifies whether or not this is the Node...
stack_v2_sparse_classes_36k_train_020268
4,722
permissive
[ { "docstring": "Constructor for the FreeNodeInformation class", "name": "__init__", "signature": "def __init__(self, chassis_serial=None, connected_to=None, hostname=None, id=None, ip=None, ipmi_ip=None, ips=None, node_serial=None, node_ui_slot=None, num_slots_in_chassis=None, product_model=None, slot_n...
2
stack_v2_sparse_classes_30k_train_019975
Implement the Python class `FreeNodeInformation` described below. Class description: Implementation of the 'FreeNodeInformation' model. Specifies the Metadata of a free Node on the network. Attributes: chassis_serial (string): Specifies the serial number of the Chassis the Node is installed in. connected_to (bool): Sp...
Implement the Python class `FreeNodeInformation` described below. Class description: Implementation of the 'FreeNodeInformation' model. Specifies the Metadata of a free Node on the network. Attributes: chassis_serial (string): Specifies the serial number of the Chassis the Node is installed in. connected_to (bool): Sp...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class FreeNodeInformation: """Implementation of the 'FreeNodeInformation' model. Specifies the Metadata of a free Node on the network. Attributes: chassis_serial (string): Specifies the serial number of the Chassis the Node is installed in. connected_to (bool): Specifies whether or not this is the Node...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FreeNodeInformation: """Implementation of the 'FreeNodeInformation' model. Specifies the Metadata of a free Node on the network. Attributes: chassis_serial (string): Specifies the serial number of the Chassis the Node is installed in. connected_to (bool): Specifies whether or not this is the Node that is send...
the_stack_v2_python_sparse
cohesity_management_sdk/models/free_node_information.py
cohesity/management-sdk-python
train
24
56f51b3403ad229105b492b082a63caafd4b4099
[ "left = 1\nright = len(nums)\nresult = 0\nwhile left <= right:\n mid = left + (right - left) // 2\n tmp = self.windowex(nums, mid, s)\n if tmp:\n right = mid - 1\n result = mid\n else:\n left = mid + 1\nreturn result", "sumnum = 0\nfor i in range(len(nums)):\n if i >= size:\n ...
<|body_start_0|> left = 1 right = len(nums) result = 0 while left <= right: mid = left + (right - left) // 2 tmp = self.windowex(nums, mid, s) if tmp: right = mid - 1 result = mid else: left =...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minSubArrayLen(self, s: int, nums: [int]) -> int: """二分查找法 o(nlogn) 将原数组分为两部分,0~mid作为一个窗口大小,遍历整个数组, 如果一旦满足,窗口内的和>=s,则将mid-1作为右边界,形成新的mid窗口,进行遍历 如果窗口内 :param s: :param nums: :return:""" <|body_0|> def windowex(self, nums, size, s): """判断在窗口中,是否和>s :param...
stack_v2_sparse_classes_36k_train_020269
2,091
no_license
[ { "docstring": "二分查找法 o(nlogn) 将原数组分为两部分,0~mid作为一个窗口大小,遍历整个数组, 如果一旦满足,窗口内的和>=s,则将mid-1作为右边界,形成新的mid窗口,进行遍历 如果窗口内 :param s: :param nums: :return:", "name": "minSubArrayLen", "signature": "def minSubArrayLen(self, s: int, nums: [int]) -> int" }, { "docstring": "判断在窗口中,是否和>s :param nums: :param siz...
2
stack_v2_sparse_classes_30k_train_000222
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minSubArrayLen(self, s: int, nums: [int]) -> int: 二分查找法 o(nlogn) 将原数组分为两部分,0~mid作为一个窗口大小,遍历整个数组, 如果一旦满足,窗口内的和>=s,则将mid-1作为右边界,形成新的mid窗口,进行遍历 如果窗口内 :param s: :param nums: :ret...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minSubArrayLen(self, s: int, nums: [int]) -> int: 二分查找法 o(nlogn) 将原数组分为两部分,0~mid作为一个窗口大小,遍历整个数组, 如果一旦满足,窗口内的和>=s,则将mid-1作为右边界,形成新的mid窗口,进行遍历 如果窗口内 :param s: :param nums: :ret...
f68e60dd1d8bb010cdae88e6273b3fac4ea48776
<|skeleton|> class Solution: def minSubArrayLen(self, s: int, nums: [int]) -> int: """二分查找法 o(nlogn) 将原数组分为两部分,0~mid作为一个窗口大小,遍历整个数组, 如果一旦满足,窗口内的和>=s,则将mid-1作为右边界,形成新的mid窗口,进行遍历 如果窗口内 :param s: :param nums: :return:""" <|body_0|> def windowex(self, nums, size, s): """判断在窗口中,是否和>s :param...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minSubArrayLen(self, s: int, nums: [int]) -> int: """二分查找法 o(nlogn) 将原数组分为两部分,0~mid作为一个窗口大小,遍历整个数组, 如果一旦满足,窗口内的和>=s,则将mid-1作为右边界,形成新的mid窗口,进行遍历 如果窗口内 :param s: :param nums: :return:""" left = 1 right = len(nums) result = 0 while left <= right: ...
the_stack_v2_python_sparse
string/209_minSubArrayLen.py
liying123456/python_leetcode
train
0
c568ca0b3b343d9f9dde8a578009d3c08b4bc0ba
[ "self.data_governance = data_governance\nself.data_protect = data_protect\nself.ransomware = ransomware\nself.site_continuity = site_continuity", "if dictionary is None:\n return None\ndata_governance = cohesity_management_sdk.models.data_governance_info.DataGovernanceInfo.from_dictionary(dictionary.get('dataG...
<|body_start_0|> self.data_governance = data_governance self.data_protect = data_protect self.ransomware = ransomware self.site_continuity = site_continuity <|end_body_0|> <|body_start_1|> if dictionary is None: return None data_governance = cohesity_manageme...
Implementation of the 'SubscriptionInfo' model. Extends this to have Helios, DRaaS and DSaaS. Attributes: data_governance (DataGovernanceInfo): Specifies whether data governance subscription was/is enabled for account. data_protect (DataProtectInfo): Specifies whether data protect subscription was subscribed for accoun...
SubscriptionInfo
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubscriptionInfo: """Implementation of the 'SubscriptionInfo' model. Extends this to have Helios, DRaaS and DSaaS. Attributes: data_governance (DataGovernanceInfo): Specifies whether data governance subscription was/is enabled for account. data_protect (DataProtectInfo): Specifies whether data pr...
stack_v2_sparse_classes_36k_train_020270
3,159
permissive
[ { "docstring": "Constructor for the SubscriptionInfo class", "name": "__init__", "signature": "def __init__(self, data_governance=None, data_protect=None, ransomware=None, site_continuity=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary):...
2
null
Implement the Python class `SubscriptionInfo` described below. Class description: Implementation of the 'SubscriptionInfo' model. Extends this to have Helios, DRaaS and DSaaS. Attributes: data_governance (DataGovernanceInfo): Specifies whether data governance subscription was/is enabled for account. data_protect (Data...
Implement the Python class `SubscriptionInfo` described below. Class description: Implementation of the 'SubscriptionInfo' model. Extends this to have Helios, DRaaS and DSaaS. Attributes: data_governance (DataGovernanceInfo): Specifies whether data governance subscription was/is enabled for account. data_protect (Data...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class SubscriptionInfo: """Implementation of the 'SubscriptionInfo' model. Extends this to have Helios, DRaaS and DSaaS. Attributes: data_governance (DataGovernanceInfo): Specifies whether data governance subscription was/is enabled for account. data_protect (DataProtectInfo): Specifies whether data pr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SubscriptionInfo: """Implementation of the 'SubscriptionInfo' model. Extends this to have Helios, DRaaS and DSaaS. Attributes: data_governance (DataGovernanceInfo): Specifies whether data governance subscription was/is enabled for account. data_protect (DataProtectInfo): Specifies whether data protect subscri...
the_stack_v2_python_sparse
cohesity_management_sdk/models/subscription_info.py
cohesity/management-sdk-python
train
24
5212b4edf1d4e294e28e79dca7339700f7dd6d3f
[ "self.kwargs = dict()\nif not options:\n options = dict()\nplot_xlabel = options.get('plot_xlabel', 't')\nplot_ylabel = options.get('plot_ylabel', 'L')\nplot_width = options.get('plot_width', 12.0)\nplot_height = options.get('plot_height', 9.0)\nplot_format = options.get('plot_format', 'pdf')\nplot_font_family =...
<|body_start_0|> self.kwargs = dict() if not options: options = dict() plot_xlabel = options.get('plot_xlabel', 't') plot_ylabel = options.get('plot_ylabel', 'L') plot_width = options.get('plot_width', 12.0) plot_height = options.get('plot_height', 9.0) ...
...
BasePlotHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BasePlotHandler: """...""" def __init__(self, options=None): """:param options:""" <|body_0|> def add_data(self, name, key, value, plot_options=None, **kwargs): """:param name: :param key: :param value: :param plot_options: :param kwargs: :return:""" <|bo...
stack_v2_sparse_classes_36k_train_020271
6,182
permissive
[ { "docstring": ":param options:", "name": "__init__", "signature": "def __init__(self, options=None)" }, { "docstring": ":param name: :param key: :param value: :param plot_options: :param kwargs: :return:", "name": "add_data", "signature": "def add_data(self, name, key, value, plot_optio...
6
stack_v2_sparse_classes_30k_test_001144
Implement the Python class `BasePlotHandler` described below. Class description: ... Method signatures and docstrings: - def __init__(self, options=None): :param options: - def add_data(self, name, key, value, plot_options=None, **kwargs): :param name: :param key: :param value: :param plot_options: :param kwargs: :re...
Implement the Python class `BasePlotHandler` described below. Class description: ... Method signatures and docstrings: - def __init__(self, options=None): :param options: - def add_data(self, name, key, value, plot_options=None, **kwargs): :param name: :param key: :param value: :param plot_options: :param kwargs: :re...
617ff45c9c3c96bbd9a975aef15f1b2697282b9c
<|skeleton|> class BasePlotHandler: """...""" def __init__(self, options=None): """:param options:""" <|body_0|> def add_data(self, name, key, value, plot_options=None, **kwargs): """:param name: :param key: :param value: :param plot_options: :param kwargs: :return:""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BasePlotHandler: """...""" def __init__(self, options=None): """:param options:""" self.kwargs = dict() if not options: options = dict() plot_xlabel = options.get('plot_xlabel', 't') plot_ylabel = options.get('plot_ylabel', 'L') plot_width = opt...
the_stack_v2_python_sparse
shot_detector/handlers/base_plot_handler.py
w495/python-video-shot-detector
train
20
84b6b2a1ea4f2cea8197254455505dd8d59756de
[ "self.namespace = namespace\nself.objectList = {}\nmyThread = threading.currentThread()\nif not hasattr(myThread, 'factory'):\n myThread.factory = {}\nmyThread.factory[name] = self", "if getFromCache:\n if classname in self.objectList:\n return self.objectList[classname]\nif self.namespace == '':\n ...
<|body_start_0|> self.namespace = namespace self.objectList = {} myThread = threading.currentThread() if not hasattr(myThread, 'factory'): myThread.factory = {} myThread.factory[name] = self <|end_body_0|> <|body_start_1|> if getFromCache: if clas...
A factory Class that is 'not thread safe' but is intended to work in threads (no sharing). The class dynamically loads objects from files when needed and caches them.
WMFactory
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WMFactory: """A factory Class that is 'not thread safe' but is intended to work in threads (no sharing). The class dynamically loads objects from files when needed and caches them.""" def __init__(self, name, namespace=''): """Initializes the factory, and checks if this thread alread...
stack_v2_sparse_classes_36k_train_020272
2,852
permissive
[ { "docstring": "Initializes the factory, and checks if this thread already has an attribute for storing registries. It uses the reserved 'registries' attribute in the thread.", "name": "__init__", "signature": "def __init__(self, name, namespace='')" }, { "docstring": "Dynamically loads the obje...
2
null
Implement the Python class `WMFactory` described below. Class description: A factory Class that is 'not thread safe' but is intended to work in threads (no sharing). The class dynamically loads objects from files when needed and caches them. Method signatures and docstrings: - def __init__(self, name, namespace=''): ...
Implement the Python class `WMFactory` described below. Class description: A factory Class that is 'not thread safe' but is intended to work in threads (no sharing). The class dynamically loads objects from files when needed and caches them. Method signatures and docstrings: - def __init__(self, name, namespace=''): ...
de110ccf6fc63ef5589b4e871ef4d51d5bce7a25
<|skeleton|> class WMFactory: """A factory Class that is 'not thread safe' but is intended to work in threads (no sharing). The class dynamically loads objects from files when needed and caches them.""" def __init__(self, name, namespace=''): """Initializes the factory, and checks if this thread alread...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WMFactory: """A factory Class that is 'not thread safe' but is intended to work in threads (no sharing). The class dynamically loads objects from files when needed and caches them.""" def __init__(self, name, namespace=''): """Initializes the factory, and checks if this thread already has an attr...
the_stack_v2_python_sparse
src/python/WMCore/WMFactory.py
vkuznet/WMCore
train
0
458090b2507a2a0c3971b26d26739aa775269574
[ "favs = get_favs(request)\nfavs = favs.filter(tour_operator__pk=self.kwargs.get('operator_pk'))\nif favs.exists():\n for fav in favs.all():\n fav.date_deleted = datetime.today()\n fav.save()\nreturn Response({'status': 'ok', 'count': get_favs_count(request), 'count_to': get_to_favs_count(request)})...
<|body_start_0|> favs = get_favs(request) favs = favs.filter(tour_operator__pk=self.kwargs.get('operator_pk')) if favs.exists(): for fav in favs.all(): fav.date_deleted = datetime.today() fav.save() return Response({'status': 'ok', 'count': get...
DeleteOperatorFavAPIView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeleteOperatorFavAPIView: def get(self, request, *args, **kwargs): """Delete a Fav set date_deleted = now""" <|body_0|> def post(self, request, *args, **kwargs): """Delete several Favs at a time set date_deleted = now""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_36k_train_020273
15,319
no_license
[ { "docstring": "Delete a Fav set date_deleted = now", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "Delete several Favs at a time set date_deleted = now", "name": "post", "signature": "def post(self, request, *args, **kwargs)" } ]
2
null
Implement the Python class `DeleteOperatorFavAPIView` described below. Class description: Implement the DeleteOperatorFavAPIView class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Delete a Fav set date_deleted = now - def post(self, request, *args, **kwargs): Delete several Favs at a ...
Implement the Python class `DeleteOperatorFavAPIView` described below. Class description: Implement the DeleteOperatorFavAPIView class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Delete a Fav set date_deleted = now - def post(self, request, *args, **kwargs): Delete several Favs at a ...
8a15fc387d20b12d16c171c2d8928a9b9d4ba5e1
<|skeleton|> class DeleteOperatorFavAPIView: def get(self, request, *args, **kwargs): """Delete a Fav set date_deleted = now""" <|body_0|> def post(self, request, *args, **kwargs): """Delete several Favs at a time set date_deleted = now""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DeleteOperatorFavAPIView: def get(self, request, *args, **kwargs): """Delete a Fav set date_deleted = now""" favs = get_favs(request) favs = favs.filter(tour_operator__pk=self.kwargs.get('operator_pk')) if favs.exists(): for fav in favs.all(): fav.da...
the_stack_v2_python_sparse
users/views.py
montenegrop/djangotravelportal
train
0
9440a22de05cdf99b8b67acd097a981285ac900e
[ "self.save_id = save_id\nself.nickname = nickname\nself.progress = progress\nself.created_at = created_at", "progress = {}\nlevels_completed = self.progress // 100\nprogress['levels_completed'] = levels_completed\nlevel = 1\nwhile level <= levels_completed:\n progress[f'level{level}'] = 100\n progress[f'unl...
<|body_start_0|> self.save_id = save_id self.nickname = nickname self.progress = progress self.created_at = created_at <|end_body_0|> <|body_start_1|> progress = {} levels_completed = self.progress // 100 progress['levels_completed'] = levels_completed le...
A class to represent save object and hold the information. Attributes: save_id: Unique id number. nickname: Name of the save object. progress: Corresponds progress level of the game. created_at: Timestamp when save has been created.
Save
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Save: """A class to represent save object and hold the information. Attributes: save_id: Unique id number. nickname: Name of the save object. progress: Corresponds progress level of the game. created_at: Timestamp when save has been created.""" def __init__(self, save_id, nickname, progress,...
stack_v2_sparse_classes_36k_train_020274
2,358
no_license
[ { "docstring": "Constructs all the necessary attributes for the save object. Args: save_id (int): Unique id number. nickname (str): Name of the save object. progress (int): Corresponds progress level of the game. created_at (date): Timestamp when save has been created.", "name": "__init__", "signature":...
2
stack_v2_sparse_classes_30k_train_013341
Implement the Python class `Save` described below. Class description: A class to represent save object and hold the information. Attributes: save_id: Unique id number. nickname: Name of the save object. progress: Corresponds progress level of the game. created_at: Timestamp when save has been created. Method signatur...
Implement the Python class `Save` described below. Class description: A class to represent save object and hold the information. Attributes: save_id: Unique id number. nickname: Name of the save object. progress: Corresponds progress level of the game. created_at: Timestamp when save has been created. Method signatur...
29cd15dddff620de068a479595a5cb9aba855343
<|skeleton|> class Save: """A class to represent save object and hold the information. Attributes: save_id: Unique id number. nickname: Name of the save object. progress: Corresponds progress level of the game. created_at: Timestamp when save has been created.""" def __init__(self, save_id, nickname, progress,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Save: """A class to represent save object and hold the information. Attributes: save_id: Unique id number. nickname: Name of the save object. progress: Corresponds progress level of the game. created_at: Timestamp when save has been created.""" def __init__(self, save_id, nickname, progress, created_at):...
the_stack_v2_python_sparse
src/entities/save.py
TopiasHarjunpaa/ot-harjoitustyo
train
0
0b390bf01d15876942469efed0ca4821f99d5605
[ "if k < 0 or t < 0:\n return False\nwindow = collections.OrderedDict()\nfor n in nums:\n if len(window) > k:\n window.popitem(last=False)\n bucket = n if t == 0 else n // t\n for m in (window.get(bucket - 1), window.get(bucket), window.get(bucket + 1)):\n if m is not None and abs(n - m) <=...
<|body_start_0|> if k < 0 or t < 0: return False window = collections.OrderedDict() for n in nums: if len(window) > k: window.popitem(last=False) bucket = n if t == 0 else n // t for m in (window.get(bucket - 1), window.get(bucket),...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def containsNearbyAlmostDuplicate(self, nums, k, t): """:type nums: List[int] :type k: int :type t: int :rtype: bool""" <|body_0|> def containsNearbyAlmostDuplicate_sort(self, nums, k, t): """:type nums: List[int] :type k: int :type t: int :rtype: bool""" ...
stack_v2_sparse_classes_36k_train_020275
2,878
no_license
[ { "docstring": ":type nums: List[int] :type k: int :type t: int :rtype: bool", "name": "containsNearbyAlmostDuplicate", "signature": "def containsNearbyAlmostDuplicate(self, nums, k, t)" }, { "docstring": ":type nums: List[int] :type k: int :type t: int :rtype: bool", "name": "containsNearby...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsNearbyAlmostDuplicate(self, nums, k, t): :type nums: List[int] :type k: int :type t: int :rtype: bool - def containsNearbyAlmostDuplicate_sort(self, nums, k, t): :typ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsNearbyAlmostDuplicate(self, nums, k, t): :type nums: List[int] :type k: int :type t: int :rtype: bool - def containsNearbyAlmostDuplicate_sort(self, nums, k, t): :typ...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def containsNearbyAlmostDuplicate(self, nums, k, t): """:type nums: List[int] :type k: int :type t: int :rtype: bool""" <|body_0|> def containsNearbyAlmostDuplicate_sort(self, nums, k, t): """:type nums: List[int] :type k: int :type t: int :rtype: bool""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def containsNearbyAlmostDuplicate(self, nums, k, t): """:type nums: List[int] :type k: int :type t: int :rtype: bool""" if k < 0 or t < 0: return False window = collections.OrderedDict() for n in nums: if len(window) > k: window...
the_stack_v2_python_sparse
src/lt_220.py
oxhead/CodingYourWay
train
0
1d7e8573643a5cbfb328b83a5a3edc8c849da89e
[ "context = {}\ntry:\n context['pending_action'] = PendingAction.objects.get(token=token, category=ActionCategory.RESET_PASSWORD.value)\nexcept PendingAction.DoesNotExist:\n context['pending_action'] = None\nreturn render(request, 'transactions/reset_password.html', context)", "context = {}\ntry:\n pendin...
<|body_start_0|> context = {} try: context['pending_action'] = PendingAction.objects.get(token=token, category=ActionCategory.RESET_PASSWORD.value) except PendingAction.DoesNotExist: context['pending_action'] = None return render(request, 'transactions/reset_passw...
Process a password reset.
ResetPasswordView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResetPasswordView: """Process a password reset.""" def get(self, request, token, **kwargs): """Renders the html template to init password reset.""" <|body_0|> def post(self, request, token, **kwargs): """Processes password reset.""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_36k_train_020276
1,704
permissive
[ { "docstring": "Renders the html template to init password reset.", "name": "get", "signature": "def get(self, request, token, **kwargs)" }, { "docstring": "Processes password reset.", "name": "post", "signature": "def post(self, request, token, **kwargs)" } ]
2
null
Implement the Python class `ResetPasswordView` described below. Class description: Process a password reset. Method signatures and docstrings: - def get(self, request, token, **kwargs): Renders the html template to init password reset. - def post(self, request, token, **kwargs): Processes password reset.
Implement the Python class `ResetPasswordView` described below. Class description: Process a password reset. Method signatures and docstrings: - def get(self, request, token, **kwargs): Renders the html template to init password reset. - def post(self, request, token, **kwargs): Processes password reset. <|skeleton|...
3fdc01eabdff459b31e016f9f6d1cafc19c5a292
<|skeleton|> class ResetPasswordView: """Process a password reset.""" def get(self, request, token, **kwargs): """Renders the html template to init password reset.""" <|body_0|> def post(self, request, token, **kwargs): """Processes password reset.""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResetPasswordView: """Process a password reset.""" def get(self, request, token, **kwargs): """Renders the html template to init password reset.""" context = {} try: context['pending_action'] = PendingAction.objects.get(token=token, category=ActionCategory.RESET_PASSWO...
the_stack_v2_python_sparse
apps/accounts/views/reset_password.py
jimialex/django-wise
train
0
d689e14b149d4c276234bce99693c64493b883dd
[ "video_share_link = cls.get_video_share_link(share_url)\nif not video_share_link:\n return\ncls.insert_share_url(video_share_link)\njiexi_url = cls.get_jiexi_url(video_share_link)\nhtml = requests.get(jiexi_url, headers=headers).text\nbf = BeautifulSoup(html, 'lxml')\nwuma_url = bf.find('textarea').get_text()\nr...
<|body_start_0|> video_share_link = cls.get_video_share_link(share_url) if not video_share_link: return cls.insert_share_url(video_share_link) jiexi_url = cls.get_jiexi_url(video_share_link) html = requests.get(jiexi_url, headers=headers).text bf = BeautifulSo...
JieXiShareLink
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JieXiShareLink: def remove_watermark(cls, share_url): """获得无水印的视频播放地址 share_url: 带水印的视频地址 video_share_link:抖音视频分享链接 jiexi_url:分享链接解析网站请求地址 wuma_url:无水印的视频地址""" <|body_0|> def get_video_share_link(cls, share_url): """生成抖音视频分享链接 :param share_url: :return:""" <|...
stack_v2_sparse_classes_36k_train_020277
3,058
no_license
[ { "docstring": "获得无水印的视频播放地址 share_url: 带水印的视频地址 video_share_link:抖音视频分享链接 jiexi_url:分享链接解析网站请求地址 wuma_url:无水印的视频地址", "name": "remove_watermark", "signature": "def remove_watermark(cls, share_url)" }, { "docstring": "生成抖音视频分享链接 :param share_url: :return:", "name": "get_video_share_link", ...
4
stack_v2_sparse_classes_30k_train_007620
Implement the Python class `JieXiShareLink` described below. Class description: Implement the JieXiShareLink class. Method signatures and docstrings: - def remove_watermark(cls, share_url): 获得无水印的视频播放地址 share_url: 带水印的视频地址 video_share_link:抖音视频分享链接 jiexi_url:分享链接解析网站请求地址 wuma_url:无水印的视频地址 - def get_video_share_link(c...
Implement the Python class `JieXiShareLink` described below. Class description: Implement the JieXiShareLink class. Method signatures and docstrings: - def remove_watermark(cls, share_url): 获得无水印的视频播放地址 share_url: 带水印的视频地址 video_share_link:抖音视频分享链接 jiexi_url:分享链接解析网站请求地址 wuma_url:无水印的视频地址 - def get_video_share_link(c...
288cce19e94bbd31fea6987341e83a20625b8a19
<|skeleton|> class JieXiShareLink: def remove_watermark(cls, share_url): """获得无水印的视频播放地址 share_url: 带水印的视频地址 video_share_link:抖音视频分享链接 jiexi_url:分享链接解析网站请求地址 wuma_url:无水印的视频地址""" <|body_0|> def get_video_share_link(cls, share_url): """生成抖音视频分享链接 :param share_url: :return:""" <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JieXiShareLink: def remove_watermark(cls, share_url): """获得无水印的视频播放地址 share_url: 带水印的视频地址 video_share_link:抖音视频分享链接 jiexi_url:分享链接解析网站请求地址 wuma_url:无水印的视频地址""" video_share_link = cls.get_video_share_link(share_url) if not video_share_link: return cls.insert_share_ur...
the_stack_v2_python_sparse
tiktok/douyin/sharelinkjiexi.py
lsxyq/learn
train
1
fc894753f3e593e7a6d078786f0a784870ee6c93
[ "super(HierarchicalTableView, self).__init__(parent)\nself.setItemDelegate(HierarchicalItemDelegate(self))\nself.verticalHeader().setVisible(False)\nself.horizontalHeader().setVisible(False)", "if self.model() is not None:\n model.modelReset.disconnect(self.__modelReset)\nsuper(HierarchicalTableView, self).set...
<|body_start_0|> super(HierarchicalTableView, self).__init__(parent) self.setItemDelegate(HierarchicalItemDelegate(self)) self.verticalHeader().setVisible(False) self.horizontalHeader().setVisible(False) <|end_body_0|> <|body_start_1|> if self.model() is not None: mo...
A TableView which allow to display a `HierarchicalTableModel`.
HierarchicalTableView
[ "MIT", "LicenseRef-scancode-public-domain-disclaimer", "CC0-1.0", "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HierarchicalTableView: """A TableView which allow to display a `HierarchicalTableModel`.""" def __init__(self, parent=None): """Constructor :param qt.QWidget parent: Parent of the widget""" <|body_0|> def setModel(self, model): """Override the default function to...
stack_v2_sparse_classes_36k_train_020278
6,748
permissive
[ { "docstring": "Constructor :param qt.QWidget parent: Parent of the widget", "name": "__init__", "signature": "def __init__(self, parent=None)" }, { "docstring": "Override the default function to connect the model to update function", "name": "setModel", "signature": "def setModel(self, ...
3
null
Implement the Python class `HierarchicalTableView` described below. Class description: A TableView which allow to display a `HierarchicalTableModel`. Method signatures and docstrings: - def __init__(self, parent=None): Constructor :param qt.QWidget parent: Parent of the widget - def setModel(self, model): Override th...
Implement the Python class `HierarchicalTableView` described below. Class description: A TableView which allow to display a `HierarchicalTableModel`. Method signatures and docstrings: - def __init__(self, parent=None): Constructor :param qt.QWidget parent: Parent of the widget - def setModel(self, model): Override th...
5e33cb69afd2a8b1cfe3183282acdd8b34c1a74f
<|skeleton|> class HierarchicalTableView: """A TableView which allow to display a `HierarchicalTableModel`.""" def __init__(self, parent=None): """Constructor :param qt.QWidget parent: Parent of the widget""" <|body_0|> def setModel(self, model): """Override the default function to...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HierarchicalTableView: """A TableView which allow to display a `HierarchicalTableModel`.""" def __init__(self, parent=None): """Constructor :param qt.QWidget parent: Parent of the widget""" super(HierarchicalTableView, self).__init__(parent) self.setItemDelegate(HierarchicalItemDe...
the_stack_v2_python_sparse
src/silx/gui/widgets/HierarchicalTableView.py
silx-kit/silx
train
120
c81f20de23917627ad29d0d062a6fd876772a9c4
[ "if isinstance(file_object, BufferedReader) or isinstance(file_object, InMemoryUploadedFile) or isinstance(file_object, TemporaryUploadedFile) or isinstance(file_object, ImageFieldFile):\n super(Photo, self).__init__(file_object)\n self.obj = file_object\n self.pillow_image = self.convert()\nelse:\n rai...
<|body_start_0|> if isinstance(file_object, BufferedReader) or isinstance(file_object, InMemoryUploadedFile) or isinstance(file_object, TemporaryUploadedFile) or isinstance(file_object, ImageFieldFile): super(Photo, self).__init__(file_object) self.obj = file_object self.pill...
Class to manipulate image data References https://docs.djangoproject.com/en/1.10/_modules/django/core/files/uploadedfile/#InMemoryUploadedFile http://stackoverflow.com/questions/36417049/how-to-convert-an-inmemoryuploadedfile-in-django-to-a-fomat-for-flickr-api http://stackoverflow.com/questions/24373341/django-image-r...
Photo
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Photo: """Class to manipulate image data References https://docs.djangoproject.com/en/1.10/_modules/django/core/files/uploadedfile/#InMemoryUploadedFile http://stackoverflow.com/questions/36417049/how-to-convert-an-inmemoryuploadedfile-in-django-to-a-fomat-for-flickr-api http://stackoverflow.com/...
stack_v2_sparse_classes_36k_train_020279
7,546
no_license
[ { "docstring": "Constructor :param file_object: object created using Python's open() :return: None", "name": "__init__", "signature": "def __init__(self, file_object)" }, { "docstring": "Return whether or not the image contains an icc_profile for ProPhoto RGB (ROMM) or AdobeRGB (1998) :param ima...
6
null
Implement the Python class `Photo` described below. Class description: Class to manipulate image data References https://docs.djangoproject.com/en/1.10/_modules/django/core/files/uploadedfile/#InMemoryUploadedFile http://stackoverflow.com/questions/36417049/how-to-convert-an-inmemoryuploadedfile-in-django-to-a-fomat-f...
Implement the Python class `Photo` described below. Class description: Class to manipulate image data References https://docs.djangoproject.com/en/1.10/_modules/django/core/files/uploadedfile/#InMemoryUploadedFile http://stackoverflow.com/questions/36417049/how-to-convert-an-inmemoryuploadedfile-in-django-to-a-fomat-f...
38a09ce2fe68312338c8cb597a341853901eeaa3
<|skeleton|> class Photo: """Class to manipulate image data References https://docs.djangoproject.com/en/1.10/_modules/django/core/files/uploadedfile/#InMemoryUploadedFile http://stackoverflow.com/questions/36417049/how-to-convert-an-inmemoryuploadedfile-in-django-to-a-fomat-for-flickr-api http://stackoverflow.com/...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Photo: """Class to manipulate image data References https://docs.djangoproject.com/en/1.10/_modules/django/core/files/uploadedfile/#InMemoryUploadedFile http://stackoverflow.com/questions/36417049/how-to-convert-an-inmemoryuploadedfile-in-django-to-a-fomat-for-flickr-api http://stackoverflow.com/questions/243...
the_stack_v2_python_sparse
apps/photo/photo.py
AOV-Team/aov-py-backend
train
0
43658385d4ec9272ef8fa9bb5378a31dee11271a
[ "self.discovery_info = discovery_info\n_properties = discovery_info.properties\nunique_id = discovery_info.hostname.split('.')[0].split('-')[0]\nif (config_entry := (await self.async_set_unique_id(unique_id))):\n try:\n await validate_gw_input(self.hass, {CONF_HOST: discovery_info.host, CONF_PORT: discove...
<|body_start_0|> self.discovery_info = discovery_info _properties = discovery_info.properties unique_id = discovery_info.hostname.split('.')[0].split('-')[0] if (config_entry := (await self.async_set_unique_id(unique_id))): try: await validate_gw_input(self.ha...
Handle a config flow for Plugwise Smile.
PlugwiseConfigFlow
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlugwiseConfigFlow: """Handle a config flow for Plugwise Smile.""" async def async_step_zeroconf(self, discovery_info: ZeroconfServiceInfo) -> FlowResult: """Prepare configuration for a discovered Plugwise Smile.""" <|body_0|> async def async_step_user(self, user_input: ...
stack_v2_sparse_classes_36k_train_020280
7,173
permissive
[ { "docstring": "Prepare configuration for a discovered Plugwise Smile.", "name": "async_step_zeroconf", "signature": "async def async_step_zeroconf(self, discovery_info: ZeroconfServiceInfo) -> FlowResult" }, { "docstring": "Handle the initial step when using network/gateway setups.", "name"...
2
null
Implement the Python class `PlugwiseConfigFlow` described below. Class description: Handle a config flow for Plugwise Smile. Method signatures and docstrings: - async def async_step_zeroconf(self, discovery_info: ZeroconfServiceInfo) -> FlowResult: Prepare configuration for a discovered Plugwise Smile. - async def as...
Implement the Python class `PlugwiseConfigFlow` described below. Class description: Handle a config flow for Plugwise Smile. Method signatures and docstrings: - async def async_step_zeroconf(self, discovery_info: ZeroconfServiceInfo) -> FlowResult: Prepare configuration for a discovered Plugwise Smile. - async def as...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class PlugwiseConfigFlow: """Handle a config flow for Plugwise Smile.""" async def async_step_zeroconf(self, discovery_info: ZeroconfServiceInfo) -> FlowResult: """Prepare configuration for a discovered Plugwise Smile.""" <|body_0|> async def async_step_user(self, user_input: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PlugwiseConfigFlow: """Handle a config flow for Plugwise Smile.""" async def async_step_zeroconf(self, discovery_info: ZeroconfServiceInfo) -> FlowResult: """Prepare configuration for a discovered Plugwise Smile.""" self.discovery_info = discovery_info _properties = discovery_info...
the_stack_v2_python_sparse
homeassistant/components/plugwise/config_flow.py
home-assistant/core
train
35,501
1d7876589737e43d3f8d6d0a134befd60f1a0164
[ "PHONE_REGEX('+529381124892')\nPHONE_REGEX('9381124892')\nPHONE_REGEX('019283746510294')\nPHONE_REGEX('+019283746510294')\nPHONE_REGEX('938112489')\nPHONE_REGEX('938112489')", "self.assertRaises(ValidationError, PHONE_REGEX, '0987654321123456')\nself.assertRaises(ValidationError, PHONE_REGEX, '+521234567890123456...
<|body_start_0|> PHONE_REGEX('+529381124892') PHONE_REGEX('9381124892') PHONE_REGEX('019283746510294') PHONE_REGEX('+019283746510294') PHONE_REGEX('938112489') PHONE_REGEX('938112489') <|end_body_0|> <|body_start_1|> self.assertRaises(ValidationError, PHONE_REGEX...
Suite to test the validator functions inside validators.py Attributes: ----------- PHONE_REGEX : RegexValidator This validator checks that phone numbers are properly formatted.
ValidatorsTest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ValidatorsTest: """Suite to test the validator functions inside validators.py Attributes: ----------- PHONE_REGEX : RegexValidator This validator checks that phone numbers are properly formatted.""" def test_good_phone_number(self): """Test if the validator accepts a properly formatt...
stack_v2_sparse_classes_36k_train_020281
2,551
permissive
[ { "docstring": "Test if the validator accepts a properly formatted number. In this case we are going to test multiple variations of properly formatted phone numbers. The cases are a full number, a 9 digit number a 15 digit number, a number with country code, and a number without a country code.", "name": "t...
2
stack_v2_sparse_classes_30k_train_010152
Implement the Python class `ValidatorsTest` described below. Class description: Suite to test the validator functions inside validators.py Attributes: ----------- PHONE_REGEX : RegexValidator This validator checks that phone numbers are properly formatted. Method signatures and docstrings: - def test_good_phone_numbe...
Implement the Python class `ValidatorsTest` described below. Class description: Suite to test the validator functions inside validators.py Attributes: ----------- PHONE_REGEX : RegexValidator This validator checks that phone numbers are properly formatted. Method signatures and docstrings: - def test_good_phone_numbe...
0100435c5d5a5fd12133b376b305e8fa79ddb8f0
<|skeleton|> class ValidatorsTest: """Suite to test the validator functions inside validators.py Attributes: ----------- PHONE_REGEX : RegexValidator This validator checks that phone numbers are properly formatted.""" def test_good_phone_number(self): """Test if the validator accepts a properly formatt...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ValidatorsTest: """Suite to test the validator functions inside validators.py Attributes: ----------- PHONE_REGEX : RegexValidator This validator checks that phone numbers are properly formatted.""" def test_good_phone_number(self): """Test if the validator accepts a properly formatted number. In...
the_stack_v2_python_sparse
core/tests.py
Oswaldinho24k/geo-csv
train
0
d4d6e81a1e4182c269cdaac531e29d97b4ce5c53
[ "if len(input_mask_and_length_tuple) < 2:\n return\nassert len(output_mask_and_length_tuple) == 1\nsuper().__init__(input_mask_and_length_tuple, output_mask_and_length_tuple)", "mask_changed = False\nsaved_output_mask = output_mask_list[0]\nnum_in_masks = len(input_mask_list)\nnum_out_masks = len(output_mask_l...
<|body_start_0|> if len(input_mask_and_length_tuple) < 2: return assert len(output_mask_and_length_tuple) == 1 super().__init__(input_mask_and_length_tuple, output_mask_and_length_tuple) <|end_body_0|> <|body_start_1|> mask_changed = False saved_output_mask = output_...
Models ADD internal connectivity for an Op.
AddInternalConnectivity
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AddInternalConnectivity: """Models ADD internal connectivity for an Op.""" def __init__(self, input_mask_and_length_tuple: List[Tuple[List, int]], output_mask_and_length_tuple: List[Tuple[List, int]]): """:param input_mask_and_length_tuple: List of Tuples. Each Tuple contains a list ...
stack_v2_sparse_classes_36k_train_020282
39,659
permissive
[ { "docstring": ":param input_mask_and_length_tuple: List of Tuples. Each Tuple contains a list of input masks and the mask length. :param output_mask_and_length_tuple: List of Tuples. Each Tuple contains a list of output masks and the mask length.", "name": "__init__", "signature": "def __init__(self, i...
3
stack_v2_sparse_classes_30k_test_000363
Implement the Python class `AddInternalConnectivity` described below. Class description: Models ADD internal connectivity for an Op. Method signatures and docstrings: - def __init__(self, input_mask_and_length_tuple: List[Tuple[List, int]], output_mask_and_length_tuple: List[Tuple[List, int]]): :param input_mask_and_...
Implement the Python class `AddInternalConnectivity` described below. Class description: Models ADD internal connectivity for an Op. Method signatures and docstrings: - def __init__(self, input_mask_and_length_tuple: List[Tuple[List, int]], output_mask_and_length_tuple: List[Tuple[List, int]]): :param input_mask_and_...
5a406e657082b6a4f6e4bf48f0e46e085cb1e351
<|skeleton|> class AddInternalConnectivity: """Models ADD internal connectivity for an Op.""" def __init__(self, input_mask_and_length_tuple: List[Tuple[List, int]], output_mask_and_length_tuple: List[Tuple[List, int]]): """:param input_mask_and_length_tuple: List of Tuples. Each Tuple contains a list ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AddInternalConnectivity: """Models ADD internal connectivity for an Op.""" def __init__(self, input_mask_and_length_tuple: List[Tuple[List, int]], output_mask_and_length_tuple: List[Tuple[List, int]]): """:param input_mask_and_length_tuple: List of Tuples. Each Tuple contains a list of input mask...
the_stack_v2_python_sparse
TrainingExtensions/common/src/python/aimet_common/winnow/mask.py
quic/aimet
train
1,676
33f8363ce5b1bafaf6c830e8665c80f834104607
[ "q = quantity.Volume(1.0, 'm^3')\nself.assertAlmostEqual(q.value, 1.0, 6)\nself.assertAlmostEqual(q.value_si, 1.0, delta=1e-06)\nself.assertEqual(q.units, 'm^3')", "q = quantity.Volume(1.0, 'L')\nself.assertAlmostEqual(q.value, 1.0, 6)\nself.assertAlmostEqual(q.value_si, 0.001, delta=1e-09)\nself.assertEqual(q.un...
<|body_start_0|> q = quantity.Volume(1.0, 'm^3') self.assertAlmostEqual(q.value, 1.0, 6) self.assertAlmostEqual(q.value_si, 1.0, delta=1e-06) self.assertEqual(q.units, 'm^3') <|end_body_0|> <|body_start_1|> q = quantity.Volume(1.0, 'L') self.assertAlmostEqual(q.value, 1....
Contains unit tests of the Volume unit type object.
TestVolume
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestVolume: """Contains unit tests of the Volume unit type object.""" def test_m3(self): """Test the creation of an volume quantity with units of m^3.""" <|body_0|> def test_liters(self): """Test the creation of an volume quantity with units of L.""" <|bo...
stack_v2_sparse_classes_36k_train_020283
49,563
permissive
[ { "docstring": "Test the creation of an volume quantity with units of m^3.", "name": "test_m3", "signature": "def test_m3(self)" }, { "docstring": "Test the creation of an volume quantity with units of L.", "name": "test_liters", "signature": "def test_liters(self)" } ]
2
null
Implement the Python class `TestVolume` described below. Class description: Contains unit tests of the Volume unit type object. Method signatures and docstrings: - def test_m3(self): Test the creation of an volume quantity with units of m^3. - def test_liters(self): Test the creation of an volume quantity with units ...
Implement the Python class `TestVolume` described below. Class description: Contains unit tests of the Volume unit type object. Method signatures and docstrings: - def test_m3(self): Test the creation of an volume quantity with units of m^3. - def test_liters(self): Test the creation of an volume quantity with units ...
349a4af759cf8877197772cd7eaca1e51d46eff5
<|skeleton|> class TestVolume: """Contains unit tests of the Volume unit type object.""" def test_m3(self): """Test the creation of an volume quantity with units of m^3.""" <|body_0|> def test_liters(self): """Test the creation of an volume quantity with units of L.""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestVolume: """Contains unit tests of the Volume unit type object.""" def test_m3(self): """Test the creation of an volume quantity with units of m^3.""" q = quantity.Volume(1.0, 'm^3') self.assertAlmostEqual(q.value, 1.0, 6) self.assertAlmostEqual(q.value_si, 1.0, delta=1...
the_stack_v2_python_sparse
rmgpy/quantityTest.py
CanePan-cc/CanePanWorkshop
train
2
38f0c71dcef5d9f1d7ec529cbc9c995e9fc4b45a
[ "super(Application, self).__init__(master)\nself.grid()\nself.create_widgets()", "self.bttn1 = Button(self, text='I do nothing!')\nself.bttn1.grid()\nself.bttn2 = Button(self)\nself.bttn2.grid()\nself.bttn2.configure(text='Me too!')\nself.bttn3 = Button(self)\nself.bttn3.grid()\nself.bttn3['text'] = 'The same thi...
<|body_start_0|> super(Application, self).__init__(master) self.grid() self.create_widgets() <|end_body_0|> <|body_start_1|> self.bttn1 = Button(self, text='I do nothing!') self.bttn1.grid() self.bttn2 = Button(self) self.bttn2.grid() self.bttn2.configure...
Application based on GUI with three buttons.
Application
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Application: """Application based on GUI with three buttons.""" def __init__(self, master): """Initialize frame.""" <|body_0|> def create_widgets(self): """Create three buttons which do nothing.""" <|body_1|> <|end_skeleton|> <|body_start_0|> su...
stack_v2_sparse_classes_36k_train_020284
1,424
no_license
[ { "docstring": "Initialize frame.", "name": "__init__", "signature": "def __init__(self, master)" }, { "docstring": "Create three buttons which do nothing.", "name": "create_widgets", "signature": "def create_widgets(self)" } ]
2
null
Implement the Python class `Application` described below. Class description: Application based on GUI with three buttons. Method signatures and docstrings: - def __init__(self, master): Initialize frame. - def create_widgets(self): Create three buttons which do nothing.
Implement the Python class `Application` described below. Class description: Application based on GUI with three buttons. Method signatures and docstrings: - def __init__(self, master): Initialize frame. - def create_widgets(self): Create three buttons which do nothing. <|skeleton|> class Application: """Applica...
120e2d62468a085424ec71a22effe27d6b38b548
<|skeleton|> class Application: """Application based on GUI with three buttons.""" def __init__(self, master): """Initialize frame.""" <|body_0|> def create_widgets(self): """Create three buttons which do nothing.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Application: """Application based on GUI with three buttons.""" def __init__(self, master): """Initialize frame.""" super(Application, self).__init__(master) self.grid() self.create_widgets() def create_widgets(self): """Create three buttons which do nothing."...
the_stack_v2_python_sparse
Chapter 10/lazy_buttons_2.py
MartaSzuran/Python-for-the-Absolute-Beginner-M.Dawson
train
1
2de5fbc0cc05cd99533f7e28c71a3bf2f9501eec
[ "try:\n workspace_object = workspace_api.get_by_id(pk)\n serializer = WorkspaceSerializer(workspace_object)\n return Response(serializer.data)\nexcept exceptions.DoesNotExist:\n content = {'message': 'Workspace not found.'}\n return Response(content, status=status.HTTP_404_NOT_FOUND)\nexcept Exceptio...
<|body_start_0|> try: workspace_object = workspace_api.get_by_id(pk) serializer = WorkspaceSerializer(workspace_object) return Response(serializer.data) except exceptions.DoesNotExist: content = {'message': 'Workspace not found.'} return Respon...
Workspace Detail
WorkspaceDetail
[ "NIST-Software" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkspaceDetail: """Workspace Detail""" def get(self, request, pk): """Get Workspace from db Args: request: HTTP request pk: ObjectId Returns: Workspace""" <|body_0|> def delete(self, request, pk): """Delete a Workspace Args: request: HTTP request pk: ObjectId Re...
stack_v2_sparse_classes_36k_train_020285
23,285
permissive
[ { "docstring": "Get Workspace from db Args: request: HTTP request pk: ObjectId Returns: Workspace", "name": "get", "signature": "def get(self, request, pk)" }, { "docstring": "Delete a Workspace Args: request: HTTP request pk: ObjectId Returns: - code: 204 content: Deletion succeed - code: 403 c...
2
stack_v2_sparse_classes_30k_train_004369
Implement the Python class `WorkspaceDetail` described below. Class description: Workspace Detail Method signatures and docstrings: - def get(self, request, pk): Get Workspace from db Args: request: HTTP request pk: ObjectId Returns: Workspace - def delete(self, request, pk): Delete a Workspace Args: request: HTTP re...
Implement the Python class `WorkspaceDetail` described below. Class description: Workspace Detail Method signatures and docstrings: - def get(self, request, pk): Get Workspace from db Args: request: HTTP request pk: ObjectId Returns: Workspace - def delete(self, request, pk): Delete a Workspace Args: request: HTTP re...
f032036d95076f92b164389fdbec7415567e7b0f
<|skeleton|> class WorkspaceDetail: """Workspace Detail""" def get(self, request, pk): """Get Workspace from db Args: request: HTTP request pk: ObjectId Returns: Workspace""" <|body_0|> def delete(self, request, pk): """Delete a Workspace Args: request: HTTP request pk: ObjectId Re...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WorkspaceDetail: """Workspace Detail""" def get(self, request, pk): """Get Workspace from db Args: request: HTTP request pk: ObjectId Returns: Workspace""" try: workspace_object = workspace_api.get_by_id(pk) serializer = WorkspaceSerializer(workspace_object) ...
the_stack_v2_python_sparse
core_main_app/rest/workspace/views.py
usnistgov/core_main_app
train
3
8da0d16bb56fef384382aae050836db6a277536e
[ "self.tuples = kargs.pop('tuples', None)\nself.context = kargs.pop('context', None)\nself.form_values = kargs.pop('values', None)\nself.show_key = kargs.pop('show_key', None)\nself.is_empty = True\nsuper().__init__(*args, **kargs)\nif not self.form_values:\n self.form_values = [None] * len(self.tuples)\nfor idx,...
<|body_start_0|> self.tuples = kargs.pop('tuples', None) self.context = kargs.pop('context', None) self.form_values = kargs.pop('values', None) self.show_key = kargs.pop('show_key', None) self.is_empty = True super().__init__(*args, **kargs) if not self.form_value...
Form to enter values in a row.
EnterActionIn
[ "LGPL-2.0-or-later", "BSD-3-Clause", "MIT", "Apache-2.0", "LGPL-2.1-only", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EnterActionIn: """Form to enter values in a row.""" def __init__(self, *args, **kargs): """Store parameters and adjust questions, columns, etc.""" <|body_0|> def get_key_value_pairs(self) -> Tuple[List, List, str, Any]: """Extract key/value pairs and primary key/...
stack_v2_sparse_classes_36k_train_020286
5,848
permissive
[ { "docstring": "Store parameters and adjust questions, columns, etc.", "name": "__init__", "signature": "def __init__(self, *args, **kargs)" }, { "docstring": "Extract key/value pairs and primary key/value. :return: Tuple with List[keys], List[values], where_field, where_value", "name": "get...
2
stack_v2_sparse_classes_30k_train_014117
Implement the Python class `EnterActionIn` described below. Class description: Form to enter values in a row. Method signatures and docstrings: - def __init__(self, *args, **kargs): Store parameters and adjust questions, columns, etc. - def get_key_value_pairs(self) -> Tuple[List, List, str, Any]: Extract key/value p...
Implement the Python class `EnterActionIn` described below. Class description: Form to enter values in a row. Method signatures and docstrings: - def __init__(self, *args, **kargs): Store parameters and adjust questions, columns, etc. - def get_key_value_pairs(self) -> Tuple[List, List, str, Any]: Extract key/value p...
c432745dfff932cbe7397100422d49df78f0a882
<|skeleton|> class EnterActionIn: """Form to enter values in a row.""" def __init__(self, *args, **kargs): """Store parameters and adjust questions, columns, etc.""" <|body_0|> def get_key_value_pairs(self) -> Tuple[List, List, str, Any]: """Extract key/value pairs and primary key/...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EnterActionIn: """Form to enter values in a row.""" def __init__(self, *args, **kargs): """Store parameters and adjust questions, columns, etc.""" self.tuples = kargs.pop('tuples', None) self.context = kargs.pop('context', None) self.form_values = kargs.pop('values', None)...
the_stack_v2_python_sparse
ontask/action/forms/edit.py
abelardopardo/ontask_b
train
43
40e98eaf7bb1295e8fd0f332ef1ac81eb88f63fd
[ "normalizer = None\nif language in ['hi', 'mr', 'sa', 'kK', 'ne', 'sd']:\n normalizer = DevanagariNormalizer(lang=language, **kwargs)\nelif language in ['ur']:\n normalizer = UrduNormalizer(lang=language, **kwargs)\nelif language in ['pa']:\n normalizer = GurmukhiNormalizer(lang=language, **kwargs)\nelif l...
<|body_start_0|> normalizer = None if language in ['hi', 'mr', 'sa', 'kK', 'ne', 'sd']: normalizer = DevanagariNormalizer(lang=language, **kwargs) elif language in ['ur']: normalizer = UrduNormalizer(lang=language, **kwargs) elif language in ['pa']: no...
Factory class to create language specific normalizers.
IndicNormalizerFactory
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IndicNormalizerFactory: """Factory class to create language specific normalizers.""" def get_normalizer(self, language, **kwargs): """Call the get_normalizer function to get the language specific normalizer Paramters: |language: language code |remove_nuktas: boolean, should the norma...
stack_v2_sparse_classes_36k_train_020287
37,295
permissive
[ { "docstring": "Call the get_normalizer function to get the language specific normalizer Paramters: |language: language code |remove_nuktas: boolean, should the normalizer remove nukta characters", "name": "get_normalizer", "signature": "def get_normalizer(self, language, **kwargs)" }, { "docstr...
2
stack_v2_sparse_classes_30k_train_016082
Implement the Python class `IndicNormalizerFactory` described below. Class description: Factory class to create language specific normalizers. Method signatures and docstrings: - def get_normalizer(self, language, **kwargs): Call the get_normalizer function to get the language specific normalizer Paramters: |language...
Implement the Python class `IndicNormalizerFactory` described below. Class description: Factory class to create language specific normalizers. Method signatures and docstrings: - def get_normalizer(self, language, **kwargs): Call the get_normalizer function to get the language specific normalizer Paramters: |language...
50cfc16f99a9a419b46dc35777b67e6d009246ec
<|skeleton|> class IndicNormalizerFactory: """Factory class to create language specific normalizers.""" def get_normalizer(self, language, **kwargs): """Call the get_normalizer function to get the language specific normalizer Paramters: |language: language code |remove_nuktas: boolean, should the norma...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IndicNormalizerFactory: """Factory class to create language specific normalizers.""" def get_normalizer(self, language, **kwargs): """Call the get_normalizer function to get the language specific normalizer Paramters: |language: language code |remove_nuktas: boolean, should the normalizer remove ...
the_stack_v2_python_sparse
indicnlp/normalize/indic_normalize.py
anoopkunchukuttan/indic_nlp_library
train
518
d11f8cf91621855d99ff1b0d2fa7cd1d44c89079
[ "super().__init__()\nself.mainWindow = mainWindow\nself.actionButtons = actionButtonsClass(self.mainWindow)\nself.listboxs = assignmentsListboxClass(self.mainWindow)\nself.assignmentsLayout()", "settings_menu_items = ['Unused', ['&General Settings', '&Change Theme', '&Update Assignments']]\nnavigate_menu_items = ...
<|body_start_0|> super().__init__() self.mainWindow = mainWindow self.actionButtons = actionButtonsClass(self.mainWindow) self.listboxs = assignmentsListboxClass(self.mainWindow) self.assignmentsLayout() <|end_body_0|> <|body_start_1|> settings_menu_items = ['Unused', ['...
A class to use for generating the layout for the assignments window. Parameters ---------- dataHandelerClass : class The data handeler class to inherit from, that will manage the downloading and retriving of saved data. Attributes ---------- mainWindow : object The PySimpleGUI window object that has been opened. action...
assignmentsLayoutClass
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class assignmentsLayoutClass: """A class to use for generating the layout for the assignments window. Parameters ---------- dataHandelerClass : class The data handeler class to inherit from, that will manage the downloading and retriving of saved data. Attributes ---------- mainWindow : object The PySi...
stack_v2_sparse_classes_36k_train_020288
3,819
permissive
[ { "docstring": "The constructor for assignmentsLayoutClass. Parameters ---------- mainWindow : object The PySimpleGUI window object that has been opened.", "name": "__init__", "signature": "def __init__(self, mainWindow)" }, { "docstring": "Generate the problem selection layout for assignments."...
2
stack_v2_sparse_classes_30k_train_019586
Implement the Python class `assignmentsLayoutClass` described below. Class description: A class to use for generating the layout for the assignments window. Parameters ---------- dataHandelerClass : class The data handeler class to inherit from, that will manage the downloading and retriving of saved data. Attributes ...
Implement the Python class `assignmentsLayoutClass` described below. Class description: A class to use for generating the layout for the assignments window. Parameters ---------- dataHandelerClass : class The data handeler class to inherit from, that will manage the downloading and retriving of saved data. Attributes ...
e65f5aa64919649690059da37f7bd608b823ca6a
<|skeleton|> class assignmentsLayoutClass: """A class to use for generating the layout for the assignments window. Parameters ---------- dataHandelerClass : class The data handeler class to inherit from, that will manage the downloading and retriving of saved data. Attributes ---------- mainWindow : object The PySi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class assignmentsLayoutClass: """A class to use for generating the layout for the assignments window. Parameters ---------- dataHandelerClass : class The data handeler class to inherit from, that will manage the downloading and retriving of saved data. Attributes ---------- mainWindow : object The PySimpleGUI windo...
the_stack_v2_python_sparse
assignments/layout/layout.py
GingerNinja2962/wtc-lms-GUI
train
2
2a8d137fc742b347a3918ece17f792b16d96c9e9
[ "headers = {'Content-Type': 'application/json'}\napi_url = 'http://' + target_address + '/swarm/data/download'\ndata_args = {}\ndata_args['hash'] = swarm_hash\nresponse = requests.get(api_url, data=json.dumps(data_args), headers=headers)\njson_results = {}\njson_results['status'] = response.status_code\nif json_res...
<|body_start_0|> headers = {'Content-Type': 'application/json'} api_url = 'http://' + target_address + '/swarm/data/download' data_args = {} data_args['hash'] = swarm_hash response = requests.get(api_url, data=json.dumps(data_args), headers=headers) json_results = {} ...
Swarm RPC class to provide client-based RESTfull APIs
Swarm_RPC
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Swarm_RPC: """Swarm RPC class to provide client-based RESTfull APIs""" def download_data(target_address, swarm_hash): """fetch data from swarm node""" <|body_0|> def upload_data(target_address, tx_json): """save data on swarm node""" <|body_1|> def g...
stack_v2_sparse_classes_36k_train_020289
4,116
no_license
[ { "docstring": "fetch data from swarm node", "name": "download_data", "signature": "def download_data(target_address, swarm_hash)" }, { "docstring": "save data on swarm node", "name": "upload_data", "signature": "def upload_data(target_address, tx_json)" }, { "docstring": "random...
4
null
Implement the Python class `Swarm_RPC` described below. Class description: Swarm RPC class to provide client-based RESTfull APIs Method signatures and docstrings: - def download_data(target_address, swarm_hash): fetch data from swarm node - def upload_data(target_address, tx_json): save data on swarm node - def get_s...
Implement the Python class `Swarm_RPC` described below. Class description: Swarm RPC class to provide client-based RESTfull APIs Method signatures and docstrings: - def download_data(target_address, swarm_hash): fetch data from swarm node - def upload_data(target_address, tx_json): save data on swarm node - def get_s...
03ff57e6fe0114ffd2dd953e79a73a893a6bc0ad
<|skeleton|> class Swarm_RPC: """Swarm RPC class to provide client-based RESTfull APIs""" def download_data(target_address, swarm_hash): """fetch data from swarm node""" <|body_0|> def upload_data(target_address, tx_json): """save data on swarm node""" <|body_1|> def g...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Swarm_RPC: """Swarm RPC class to provide client-based RESTfull APIs""" def download_data(target_address, swarm_hash): """fetch data from swarm node""" headers = {'Content-Type': 'application/json'} api_url = 'http://' + target_address + '/swarm/data/download' data_args = {...
the_stack_v2_python_sparse
Security/py_dev/ENF_chain/utils/Swarm_RPC.py
samuelxu999/Research
train
1
fa786575b9c7c156ee9e2d03d4d477d0db8db939
[ "book = get_object_or_404(models.Edition, id=book_id)\nannotated_links = get_annotated_links(book)\ndata = {'book': book, 'links': annotated_links}\nreturn TemplateResponse(request, 'book/file_links/edit_links.html', data)", "link = get_object_or_404(models.FileLink, id=link_id, book=book_id)\nform = forms.FileLi...
<|body_start_0|> book = get_object_or_404(models.Edition, id=book_id) annotated_links = get_annotated_links(book) data = {'book': book, 'links': annotated_links} return TemplateResponse(request, 'book/file_links/edit_links.html', data) <|end_body_0|> <|body_start_1|> link = get_...
View all links
BookFileLinks
[ "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BookFileLinks: """View all links""" def get(self, request, book_id): """view links""" <|body_0|> def post(self, request, book_id, link_id): """Edit a link""" <|body_1|> <|end_skeleton|> <|body_start_0|> book = get_object_or_404(models.Edition, i...
stack_v2_sparse_classes_36k_train_020290
3,716
no_license
[ { "docstring": "view links", "name": "get", "signature": "def get(self, request, book_id)" }, { "docstring": "Edit a link", "name": "post", "signature": "def post(self, request, book_id, link_id)" } ]
2
stack_v2_sparse_classes_30k_train_008257
Implement the Python class `BookFileLinks` described below. Class description: View all links Method signatures and docstrings: - def get(self, request, book_id): view links - def post(self, request, book_id, link_id): Edit a link
Implement the Python class `BookFileLinks` described below. Class description: View all links Method signatures and docstrings: - def get(self, request, book_id): view links - def post(self, request, book_id, link_id): Edit a link <|skeleton|> class BookFileLinks: """View all links""" def get(self, request,...
0f8da5b738047f3c34d60d93f59bdedd8f797224
<|skeleton|> class BookFileLinks: """View all links""" def get(self, request, book_id): """view links""" <|body_0|> def post(self, request, book_id, link_id): """Edit a link""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BookFileLinks: """View all links""" def get(self, request, book_id): """view links""" book = get_object_or_404(models.Edition, id=book_id) annotated_links = get_annotated_links(book) data = {'book': book, 'links': annotated_links} return TemplateResponse(request, '...
the_stack_v2_python_sparse
bookwyrm/views/books/links.py
bookwyrm-social/bookwyrm
train
1,398
3b6145ab6f3e46d85d39739b07b32f30d4baef7a
[ "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...
Proto file describing the Recommendation service. Service to manage recommendations.
RecommendationServiceServicer
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RecommendationServiceServicer: """Proto file describing the Recommendation service. Service to manage recommendations.""" def GetRecommendation(self, request, context): """Returns the requested recommendation in full detail.""" <|body_0|> def ApplyRecommendation(self, re...
stack_v2_sparse_classes_36k_train_020291
4,622
permissive
[ { "docstring": "Returns the requested recommendation in full detail.", "name": "GetRecommendation", "signature": "def GetRecommendation(self, request, context)" }, { "docstring": "Applies given recommendations with corresponding apply parameters.", "name": "ApplyRecommendation", "signatu...
3
stack_v2_sparse_classes_30k_train_018669
Implement the Python class `RecommendationServiceServicer` described below. Class description: Proto file describing the Recommendation service. Service to manage recommendations. Method signatures and docstrings: - def GetRecommendation(self, request, context): Returns the requested recommendation in full detail. - ...
Implement the Python class `RecommendationServiceServicer` described below. Class description: Proto file describing the Recommendation service. Service to manage recommendations. Method signatures and docstrings: - def GetRecommendation(self, request, context): Returns the requested recommendation in full detail. - ...
0fc8a7dbf31d9e8e2a4364df93bec5f6b7edd50a
<|skeleton|> class RecommendationServiceServicer: """Proto file describing the Recommendation service. Service to manage recommendations.""" def GetRecommendation(self, request, context): """Returns the requested recommendation in full detail.""" <|body_0|> def ApplyRecommendation(self, re...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RecommendationServiceServicer: """Proto file describing the Recommendation service. Service to manage recommendations.""" def GetRecommendation(self, request, context): """Returns the requested recommendation in full detail.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) conte...
the_stack_v2_python_sparse
google/ads/google_ads/v1/proto/services/recommendation_service_pb2_grpc.py
juanmacugat/google-ads-python
train
1
77a2b7d46f092565ee94cd613dcf4c8ebccd75f6
[ "ds, meta = create_dataset()\nds2, meta2 = create_dataset()\nfor split in ds:\n with self.subTest(f'datasets-{split}'):\n pd.testing.assert_frame_equal(ds[split].to_pandas(), ds2[split].to_pandas())\nwith self.subTest('metadata'):\n pd.testing.assert_frame_equal(meta, meta2)", "ds, meta = create_data...
<|body_start_0|> ds, meta = create_dataset() ds2, meta2 = create_dataset() for split in ds: with self.subTest(f'datasets-{split}'): pd.testing.assert_frame_equal(ds[split].to_pandas(), ds2[split].to_pandas()) with self.subTest('metadata'): pd.testi...
Tests create dataset
TestCreateDataset
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCreateDataset: """Tests create dataset""" def test_create_dataset_no_change(self): """Tests creating the dataset is reproducible""" <|body_0|> def test_kmeans_affected_by_seed(self): """tests for kmeans seeding stability""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k_train_020292
1,668
permissive
[ { "docstring": "Tests creating the dataset is reproducible", "name": "test_create_dataset_no_change", "signature": "def test_create_dataset_no_change(self)" }, { "docstring": "tests for kmeans seeding stability", "name": "test_kmeans_affected_by_seed", "signature": "def test_kmeans_affec...
2
stack_v2_sparse_classes_30k_train_009046
Implement the Python class `TestCreateDataset` described below. Class description: Tests create dataset Method signatures and docstrings: - def test_create_dataset_no_change(self): Tests creating the dataset is reproducible - def test_kmeans_affected_by_seed(self): tests for kmeans seeding stability
Implement the Python class `TestCreateDataset` described below. Class description: Tests create dataset Method signatures and docstrings: - def test_create_dataset_no_change(self): Tests creating the dataset is reproducible - def test_kmeans_affected_by_seed(self): tests for kmeans seeding stability <|skeleton|> cla...
581608cfc4d9b485182c6f5f40dd2ab7540cec66
<|skeleton|> class TestCreateDataset: """Tests create dataset""" def test_create_dataset_no_change(self): """Tests creating the dataset is reproducible""" <|body_0|> def test_kmeans_affected_by_seed(self): """tests for kmeans seeding stability""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestCreateDataset: """Tests create dataset""" def test_create_dataset_no_change(self): """Tests creating the dataset is reproducible""" ds, meta = create_dataset() ds2, meta2 = create_dataset() for split in ds: with self.subTest(f'datasets-{split}'): ...
the_stack_v2_python_sparse
projects/coda/probing/dataset/dataset_test.py
nala-cub/coda
train
2
da405edf9a118f9e0e21e90d13bd923d7bcd2890
[ "if root is None:\n return []\nqueue = []\nresult = []\nqueue.append(root)\nwhile len(queue) > 0:\n current_node = queue.pop(0)\n result.append(current_node.val)\n if current_node.left:\n queue.append(current_node.left)\n if current_node.right:\n queue.append(current_node.right)\nreturn...
<|body_start_0|> if root is None: return [] queue = [] result = [] queue.append(root) while len(queue) > 0: current_node = queue.pop(0) result.append(current_node.val) if current_node.left: queue.append(current_node....
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def printFromTopToBottom(self, root): """层次遍历""" <|body_0|> def printFromTopToBottomWithLayer(self, root): """增加两个变量,to_be_printed用于表示当前层中还没有打印的节点数, next_level用于表示下一层节点的数目""" <|body_1|> <|end_skeleton|> <|body_start_0|> if root is None: ...
stack_v2_sparse_classes_36k_train_020293
2,577
no_license
[ { "docstring": "层次遍历", "name": "printFromTopToBottom", "signature": "def printFromTopToBottom(self, root)" }, { "docstring": "增加两个变量,to_be_printed用于表示当前层中还没有打印的节点数, next_level用于表示下一层节点的数目", "name": "printFromTopToBottomWithLayer", "signature": "def printFromTopToBottomWithLayer(self, roo...
2
stack_v2_sparse_classes_30k_train_002143
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def printFromTopToBottom(self, root): 层次遍历 - def printFromTopToBottomWithLayer(self, root): 增加两个变量,to_be_printed用于表示当前层中还没有打印的节点数, next_level用于表示下一层节点的数目
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def printFromTopToBottom(self, root): 层次遍历 - def printFromTopToBottomWithLayer(self, root): 增加两个变量,to_be_printed用于表示当前层中还没有打印的节点数, next_level用于表示下一层节点的数目 <|skeleton|> class Solu...
14fb97af36c5fb1d69439585adb0db0ce9eae45d
<|skeleton|> class Solution: def printFromTopToBottom(self, root): """层次遍历""" <|body_0|> def printFromTopToBottomWithLayer(self, root): """增加两个变量,to_be_printed用于表示当前层中还没有打印的节点数, next_level用于表示下一层节点的数目""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def printFromTopToBottom(self, root): """层次遍历""" if root is None: return [] queue = [] result = [] queue.append(root) while len(queue) > 0: current_node = queue.pop(0) result.append(current_node.val) if c...
the_stack_v2_python_sparse
32从上到下打印二叉树.py
zhanvwei/targetoffer
train
0
0aea387b44f962dbde4f265465abfc9d3944dee6
[ "tiff_path = 'C:\\\\Users\\\\74722\\\\Desktop\\\\del\\\\slope_reclass.tif'\nsave_path = 'C:\\\\Users\\\\74722\\\\Desktop\\\\del\\\\color_tiff.tif'\ncolor_info = {1: {}}\nfor i in [1, 2, 3, 4, 5, 6, 51, 52, 53, 54]:\n color_info[1][i] = ImageUtil.get_rand_color()\nGdalBase.add_color_map_to_dataset(tiff_path, colo...
<|body_start_0|> tiff_path = 'C:\\Users\\74722\\Desktop\\del\\slope_reclass.tif' save_path = 'C:\\Users\\74722\\Desktop\\del\\color_tiff.tif' color_info = {1: {}} for i in [1, 2, 3, 4, 5, 6, 51, 52, 53, 54]: color_info[1][i] = ImageUtil.get_rand_color() GdalBase.add_c...
出各种类型的专题图
ImageMapping
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageMapping: """出各种类型的专题图""" def tiff_to_pic(): """tiff 转图片""" <|body_0|> def tiff_to_image_mat(tiff_path, legend_info): """tiff转为标准格式,设置无值区为白色""" <|body_1|> def tiff_to_image_mat_SM(tiff_path): """tiff转为标准格式,设置无值区为白色""" <|body_2|> ...
stack_v2_sparse_classes_36k_train_020294
33,197
no_license
[ { "docstring": "tiff 转图片", "name": "tiff_to_pic", "signature": "def tiff_to_pic()" }, { "docstring": "tiff转为标准格式,设置无值区为白色", "name": "tiff_to_image_mat", "signature": "def tiff_to_image_mat(tiff_path, legend_info)" }, { "docstring": "tiff转为标准格式,设置无值区为白色", "name": "tiff_to_imag...
4
null
Implement the Python class `ImageMapping` described below. Class description: 出各种类型的专题图 Method signatures and docstrings: - def tiff_to_pic(): tiff 转图片 - def tiff_to_image_mat(tiff_path, legend_info): tiff转为标准格式,设置无值区为白色 - def tiff_to_image_mat_SM(tiff_path): tiff转为标准格式,设置无值区为白色 - def classification(tiff_path, legend...
Implement the Python class `ImageMapping` described below. Class description: 出各种类型的专题图 Method signatures and docstrings: - def tiff_to_pic(): tiff 转图片 - def tiff_to_image_mat(tiff_path, legend_info): tiff转为标准格式,设置无值区为白色 - def tiff_to_image_mat_SM(tiff_path): tiff转为标准格式,设置无值区为白色 - def classification(tiff_path, legend...
32e64be10a6cd2856850f6720d70b4c6e7033f4e
<|skeleton|> class ImageMapping: """出各种类型的专题图""" def tiff_to_pic(): """tiff 转图片""" <|body_0|> def tiff_to_image_mat(tiff_path, legend_info): """tiff转为标准格式,设置无值区为白色""" <|body_1|> def tiff_to_image_mat_SM(tiff_path): """tiff转为标准格式,设置无值区为白色""" <|body_2|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImageMapping: """出各种类型的专题图""" def tiff_to_pic(): """tiff 转图片""" tiff_path = 'C:\\Users\\74722\\Desktop\\del\\slope_reclass.tif' save_path = 'C:\\Users\\74722\\Desktop\\del\\color_tiff.tif' color_info = {1: {}} for i in [1, 2, 3, 4, 5, 6, 51, 52, 53, 54]: ...
the_stack_v2_python_sparse
Z_other/ImgMatTiffUtil/ImageUtil.py
newjokker/PyUtil
train
0
5a8e8464d120b2fcb4a61b693c828f79db7b439c
[ "dim_ob = ob_space.shape[0]\nn_actions = ac_space.n\nexpected_shape = (dim_ob + 1) * n_actions\nif len(theta) != expected_shape:\n raise WrongShapeError('Expected a theta of length {} instead of {}'.format(expected_shape, len(theta)))\nself.W = theta[0:dim_ob * n_actions].reshape(dim_ob, n_actions)\nself.b = the...
<|body_start_0|> dim_ob = ob_space.shape[0] n_actions = ac_space.n expected_shape = (dim_ob + 1) * n_actions if len(theta) != expected_shape: raise WrongShapeError('Expected a theta of length {} instead of {}'.format(expected_shape, len(theta))) self.W = theta[0:dim_o...
Deterministicially select an action from a discrete action space using a linear function.
DeterministicDiscreteActionLinearPolicy
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeterministicDiscreteActionLinearPolicy: """Deterministicially select an action from a discrete action space using a linear function.""" def __init__(self, theta, ob_space, ac_space) -> None: """dim_ob: dimension of observations n_actions: number of actions theta: flat vector of para...
stack_v2_sparse_classes_36k_train_020295
7,807
permissive
[ { "docstring": "dim_ob: dimension of observations n_actions: number of actions theta: flat vector of parameters", "name": "__init__", "signature": "def __init__(self, theta, ob_space, ac_space) -> None" }, { "docstring": "Select the action that got the highest value from the linear function.", ...
2
stack_v2_sparse_classes_30k_train_002089
Implement the Python class `DeterministicDiscreteActionLinearPolicy` described below. Class description: Deterministicially select an action from a discrete action space using a linear function. Method signatures and docstrings: - def __init__(self, theta, ob_space, ac_space) -> None: dim_ob: dimension of observation...
Implement the Python class `DeterministicDiscreteActionLinearPolicy` described below. Class description: Deterministicially select an action from a discrete action space using a linear function. Method signatures and docstrings: - def __init__(self, theta, ob_space, ac_space) -> None: dim_ob: dimension of observation...
d63ea61f8379a7e0a9786e4bb717813ed53bb8f0
<|skeleton|> class DeterministicDiscreteActionLinearPolicy: """Deterministicially select an action from a discrete action space using a linear function.""" def __init__(self, theta, ob_space, ac_space) -> None: """dim_ob: dimension of observations n_actions: number of actions theta: flat vector of para...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DeterministicDiscreteActionLinearPolicy: """Deterministicially select an action from a discrete action space using a linear function.""" def __init__(self, theta, ob_space, ac_space) -> None: """dim_ob: dimension of observations n_actions: number of actions theta: flat vector of parameters""" ...
the_stack_v2_python_sparse
yarll/agents/basic/cem.py
arnomoonens/yarll
train
21
87ff6cd289860501c9322aa03eec90c2cc9c4048
[ "self.hard_constraint = hard_constraint\nself.char_level = char_level\nself.sent_delimiter = sent_delimiter\nself.max_seq_len = max_seq_len\nself.delimiter = delimiter\nsuper().__init__(data, transform, cache, generate_idx)", "f = TimingFileIterator(filepath)\nfor line in f:\n line = line.rstrip('\\n')\n to...
<|body_start_0|> self.hard_constraint = hard_constraint self.char_level = char_level self.sent_delimiter = sent_delimiter self.max_seq_len = max_seq_len self.delimiter = delimiter super().__init__(data, transform, cache, generate_idx) <|end_body_0|> <|body_start_1|> ...
TextTokenizingDataset
[ "Apache-2.0", "CC-BY-NC-SA-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextTokenizingDataset: def __init__(self, data: Union[str, List], transform: Union[Callable, List]=None, cache=None, generate_idx=None, delimiter=None, max_seq_len=None, sent_delimiter=None, char_level=False, hard_constraint=False) -> None: """A dataset for tagging tokenization tasks. Ar...
stack_v2_sparse_classes_36k_train_020296
5,643
permissive
[ { "docstring": "A dataset for tagging tokenization tasks. Args: data: The local or remote path to a dataset, or a list of samples where each sample is a dict. transform: Predefined transform(s). cache: ``True`` to enable caching, so that transforms won't be called twice. generate_idx: Create a :const:`~hanlp_co...
2
null
Implement the Python class `TextTokenizingDataset` described below. Class description: Implement the TextTokenizingDataset class. Method signatures and docstrings: - def __init__(self, data: Union[str, List], transform: Union[Callable, List]=None, cache=None, generate_idx=None, delimiter=None, max_seq_len=None, sent_...
Implement the Python class `TextTokenizingDataset` described below. Class description: Implement the TextTokenizingDataset class. Method signatures and docstrings: - def __init__(self, data: Union[str, List], transform: Union[Callable, List]=None, cache=None, generate_idx=None, delimiter=None, max_seq_len=None, sent_...
be2f04905a12990a527417bd47b79b851874a201
<|skeleton|> class TextTokenizingDataset: def __init__(self, data: Union[str, List], transform: Union[Callable, List]=None, cache=None, generate_idx=None, delimiter=None, max_seq_len=None, sent_delimiter=None, char_level=False, hard_constraint=False) -> None: """A dataset for tagging tokenization tasks. Ar...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TextTokenizingDataset: def __init__(self, data: Union[str, List], transform: Union[Callable, List]=None, cache=None, generate_idx=None, delimiter=None, max_seq_len=None, sent_delimiter=None, char_level=False, hard_constraint=False) -> None: """A dataset for tagging tokenization tasks. Args: data: The ...
the_stack_v2_python_sparse
hanlp/datasets/tokenization/loaders/txt.py
hankcs/HanLP
train
32,454
feef0d345203017f14ce2e2591defb0a94057fc7
[ "self.config_entry = config_entry\nself.meter = meter\nself.discovergy_client = discovergy_client\nsuper().__init__(hass, _LOGGER, name=DOMAIN, update_interval=timedelta(seconds=30))", "try:\n return await self.discovergy_client.meter_last_reading(self.meter.meter_id)\nexcept AccessTokenExpired as err:\n ra...
<|body_start_0|> self.config_entry = config_entry self.meter = meter self.discovergy_client = discovergy_client super().__init__(hass, _LOGGER, name=DOMAIN, update_interval=timedelta(seconds=30)) <|end_body_0|> <|body_start_1|> try: return await self.discovergy_clien...
The Discovergy update coordinator.
DiscovergyUpdateCoordinator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DiscovergyUpdateCoordinator: """The Discovergy update coordinator.""" def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry, meter: Meter, discovergy_client: Discovergy) -> None: """Initialize the Discovergy coordinator.""" <|body_0|> async def _async_update_...
stack_v2_sparse_classes_36k_train_020297
1,859
permissive
[ { "docstring": "Initialize the Discovergy coordinator.", "name": "__init__", "signature": "def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry, meter: Meter, discovergy_client: Discovergy) -> None" }, { "docstring": "Get last reading for meter.", "name": "_async_update_data", ...
2
stack_v2_sparse_classes_30k_train_015618
Implement the Python class `DiscovergyUpdateCoordinator` described below. Class description: The Discovergy update coordinator. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry, meter: Meter, discovergy_client: Discovergy) -> None: Initialize the Discovergy coordin...
Implement the Python class `DiscovergyUpdateCoordinator` described below. Class description: The Discovergy update coordinator. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry, meter: Meter, discovergy_client: Discovergy) -> None: Initialize the Discovergy coordin...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class DiscovergyUpdateCoordinator: """The Discovergy update coordinator.""" def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry, meter: Meter, discovergy_client: Discovergy) -> None: """Initialize the Discovergy coordinator.""" <|body_0|> async def _async_update_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DiscovergyUpdateCoordinator: """The Discovergy update coordinator.""" def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry, meter: Meter, discovergy_client: Discovergy) -> None: """Initialize the Discovergy coordinator.""" self.config_entry = config_entry self.meter =...
the_stack_v2_python_sparse
homeassistant/components/discovergy/coordinator.py
home-assistant/core
train
35,501
cc2e7d5a62eb6343275fbd3b1eb20ed2a2f54c98
[ "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.
AccessGrantApiServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccessGrantApiServicer: """Missing associated documentation comment in .proto file.""" def CreateAccessGrant(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def DeleteAccessGrant(self, request, context): """Missi...
stack_v2_sparse_classes_36k_train_020298
23,031
permissive
[ { "docstring": "Missing associated documentation comment in .proto file.", "name": "CreateAccessGrant", "signature": "def CreateAccessGrant(self, request, context)" }, { "docstring": "Missing associated documentation comment in .proto file.", "name": "DeleteAccessGrant", "signature": "de...
5
stack_v2_sparse_classes_30k_train_020650
Implement the Python class `AccessGrantApiServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def CreateAccessGrant(self, request, context): Missing associated documentation comment in .proto file. - def DeleteAccessGrant(self, req...
Implement the Python class `AccessGrantApiServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def CreateAccessGrant(self, request, context): Missing associated documentation comment in .proto file. - def DeleteAccessGrant(self, req...
039e4a679b554e085f935f8d725f560bdce6b688
<|skeleton|> class AccessGrantApiServicer: """Missing associated documentation comment in .proto file.""" def CreateAccessGrant(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def DeleteAccessGrant(self, request, context): """Missi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AccessGrantApiServicer: """Missing associated documentation comment in .proto file.""" def CreateAccessGrant(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not impl...
the_stack_v2_python_sparse
descarteslabs/common/proto/discover/discover_pb2_grpc.py
stjordanis/descarteslabs-python
train
0
5fd0796eb7d9c272870d5eceedb9458ac91c5ba7
[ "self.bandwidth_bytes_per_second = bandwidth_bytes_per_second\nself.cassandra_backup_job_params = cassandra_backup_job_params\nself.compaction_job_interval_secs = compaction_job_interval_secs\nself.concurrency = concurrency\nself.couchbase_backup_job_params = couchbase_backup_job_params\nself.gc_job_interval_secs =...
<|body_start_0|> self.bandwidth_bytes_per_second = bandwidth_bytes_per_second self.cassandra_backup_job_params = cassandra_backup_job_params self.compaction_job_interval_secs = compaction_job_interval_secs self.concurrency = concurrency self.couchbase_backup_job_params = couchbas...
Implementation of the 'NoSqlBackupJobParams' model. Contains backup params at the job level applicable for nosql environment. Attributes: bandwidth_bytes_per_second (int): Net bandwidth bytes per second. cassandra_backup_job_params (CassandraBackupJobParams): Params specific to cassandra backup job. compaction_job_inte...
NoSqlBackupJobParams
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NoSqlBackupJobParams: """Implementation of the 'NoSqlBackupJobParams' model. Contains backup params at the job level applicable for nosql environment. Attributes: bandwidth_bytes_per_second (int): Net bandwidth bytes per second. cassandra_backup_job_params (CassandraBackupJobParams): Params speci...
stack_v2_sparse_classes_36k_train_020299
7,871
permissive
[ { "docstring": "Constructor for the NoSqlBackupJobParams class", "name": "__init__", "signature": "def __init__(self, bandwidth_bytes_per_second=None, cassandra_backup_job_params=None, compaction_job_interval_secs=None, concurrency=None, couchbase_backup_job_params=None, gc_job_interval_secs=None, gc_re...
2
stack_v2_sparse_classes_30k_train_001885
Implement the Python class `NoSqlBackupJobParams` described below. Class description: Implementation of the 'NoSqlBackupJobParams' model. Contains backup params at the job level applicable for nosql environment. Attributes: bandwidth_bytes_per_second (int): Net bandwidth bytes per second. cassandra_backup_job_params (...
Implement the Python class `NoSqlBackupJobParams` described below. Class description: Implementation of the 'NoSqlBackupJobParams' model. Contains backup params at the job level applicable for nosql environment. Attributes: bandwidth_bytes_per_second (int): Net bandwidth bytes per second. cassandra_backup_job_params (...
0093194d125fc6746f55b8499da1270c64f473fc
<|skeleton|> class NoSqlBackupJobParams: """Implementation of the 'NoSqlBackupJobParams' model. Contains backup params at the job level applicable for nosql environment. Attributes: bandwidth_bytes_per_second (int): Net bandwidth bytes per second. cassandra_backup_job_params (CassandraBackupJobParams): Params speci...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NoSqlBackupJobParams: """Implementation of the 'NoSqlBackupJobParams' model. Contains backup params at the job level applicable for nosql environment. Attributes: bandwidth_bytes_per_second (int): Net bandwidth bytes per second. cassandra_backup_job_params (CassandraBackupJobParams): Params specific to cassan...
the_stack_v2_python_sparse
cohesity_management_sdk/models/no_sql_backup_job_params.py
hsantoyo2/management-sdk-python
train
0