blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 7.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 467 8.64k | id stringlengths 40 40 | length_bytes int64 515 49.7k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 160 3.93k | prompted_full_text stringlengths 681 10.7k | revision_id stringlengths 40 40 | skeleton stringlengths 162 4.09k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | solution stringlengths 331 8.3k | source stringclasses 1
value | source_path stringlengths 5 177 | source_repo stringlengths 6 88 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a81f2b42ddac44d444ea2047f7a5d21a97d79602 | [
"self.startMessage = startMessage\nself.message = message\nself.doneMessage = doneMessage",
"self.removePreviousTrap(target)\ntarget.secondaryEffects.append(Trap(user, self.message, self.doneMessage))\nreturn [target.getHeader() + self.startMessage]",
"effect = self.hasThisTrap(pkmn)\nif effect:\n pkmn.secon... | <|body_start_0|>
self.startMessage = startMessage
self.message = message
self.doneMessage = doneMessage
<|end_body_0|>
<|body_start_1|>
self.removePreviousTrap(target)
target.secondaryEffects.append(Trap(user, self.message, self.doneMessage))
return [target.getHeader() +... | Represents an effect that traps the opponent | TrapDelegate | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TrapDelegate:
"""Represents an effect that traps the opponent"""
def __init__(self, startMessage, message, doneMessage):
"""Build the Trap Delegate"""
<|body_0|>
def applyEffect(self, user, target, environment):
"""Apply the trap to the opponent"""
<|body... | stack_v2_sparse_classes_10k_train_003900 | 1,226 | no_license | [
{
"docstring": "Build the Trap Delegate",
"name": "__init__",
"signature": "def __init__(self, startMessage, message, doneMessage)"
},
{
"docstring": "Apply the trap to the opponent",
"name": "applyEffect",
"signature": "def applyEffect(self, user, target, environment)"
},
{
"doc... | 4 | stack_v2_sparse_classes_30k_train_001576 | Implement the Python class `TrapDelegate` described below.
Class description:
Represents an effect that traps the opponent
Method signatures and docstrings:
- def __init__(self, startMessage, message, doneMessage): Build the Trap Delegate
- def applyEffect(self, user, target, environment): Apply the trap to the oppon... | Implement the Python class `TrapDelegate` described below.
Class description:
Represents an effect that traps the opponent
Method signatures and docstrings:
- def __init__(self, startMessage, message, doneMessage): Build the Trap Delegate
- def applyEffect(self, user, target, environment): Apply the trap to the oppon... | 3931eee5fd04e18bb1738a0b27a4c6979dc4db01 | <|skeleton|>
class TrapDelegate:
"""Represents an effect that traps the opponent"""
def __init__(self, startMessage, message, doneMessage):
"""Build the Trap Delegate"""
<|body_0|>
def applyEffect(self, user, target, environment):
"""Apply the trap to the opponent"""
<|body... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TrapDelegate:
"""Represents an effect that traps the opponent"""
def __init__(self, startMessage, message, doneMessage):
"""Build the Trap Delegate"""
self.startMessage = startMessage
self.message = message
self.doneMessage = doneMessage
def applyEffect(self, user, ta... | the_stack_v2_python_sparse | src/Battle/Attack/EffectDelegates/trap_delegate.py | sgtnourry/Pokemon-Project | train | 0 |
e2167a7a9ed7fca76e924eafff1113f689c2db97 | [
"self.num_classes = num_classes\nself.shape = shape\nself.is_infer = is_infer\nself.image_vector_size = shape[0] * shape[1]\nself.__declare_input_layers__()\nself.__build_nn__()",
"self.image = layer.data(name='image', type=paddle.data_type.dense_vector(self.image_vector_size), height=self.shape[0], width=self.sh... | <|body_start_0|>
self.num_classes = num_classes
self.shape = shape
self.is_infer = is_infer
self.image_vector_size = shape[0] * shape[1]
self.__declare_input_layers__()
self.__build_nn__()
<|end_body_0|>
<|body_start_1|>
self.image = layer.data(name='image', type... | Model | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Model:
def __init__(self, num_classes, shape, is_infer=False):
""":param num_classes: The size of the character dict. :type num_classes: int :param shape: The size of the input images. :type shape: tuple of 2 int :param is_infer: The boolean parameter indicating inferring or training. :t... | stack_v2_sparse_classes_10k_train_003901 | 4,286 | permissive | [
{
"docstring": ":param num_classes: The size of the character dict. :type num_classes: int :param shape: The size of the input images. :type shape: tuple of 2 int :param is_infer: The boolean parameter indicating inferring or training. :type shape: bool",
"name": "__init__",
"signature": "def __init__(s... | 4 | null | Implement the Python class `Model` described below.
Class description:
Implement the Model class.
Method signatures and docstrings:
- def __init__(self, num_classes, shape, is_infer=False): :param num_classes: The size of the character dict. :type num_classes: int :param shape: The size of the input images. :type sha... | Implement the Python class `Model` described below.
Class description:
Implement the Model class.
Method signatures and docstrings:
- def __init__(self, num_classes, shape, is_infer=False): :param num_classes: The size of the character dict. :type num_classes: int :param shape: The size of the input images. :type sha... | 420527996b6da60ca401717a734329f126ed0680 | <|skeleton|>
class Model:
def __init__(self, num_classes, shape, is_infer=False):
""":param num_classes: The size of the character dict. :type num_classes: int :param shape: The size of the input images. :type shape: tuple of 2 int :param is_infer: The boolean parameter indicating inferring or training. :t... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Model:
def __init__(self, num_classes, shape, is_infer=False):
""":param num_classes: The size of the character dict. :type num_classes: int :param shape: The size of the input images. :type shape: tuple of 2 int :param is_infer: The boolean parameter indicating inferring or training. :type shape: boo... | the_stack_v2_python_sparse | legacy/scene_text_recognition/network_conf.py | chenbjin/models | train | 3 | |
d45662f4dd4be5a127e11579b8d510877b610a82 | [
"self.step_vector = step\nself.step_time = step_time\nself.ref_timer = None",
"u = np.zeros(shape=dim)\nj = 0\nfor i in range(len(t)):\n if t[i] % self.step_time == 0 and t[i] != 0 and (j + 1 != len(self.step_vector)):\n j += 1\n u[i, :] = self.step_vector[j]\nreturn u"
] | <|body_start_0|>
self.step_vector = step
self.step_time = step_time
self.ref_timer = None
<|end_body_0|>
<|body_start_1|>
u = np.zeros(shape=dim)
j = 0
for i in range(len(t)):
if t[i] % self.step_time == 0 and t[i] != 0 and (j + 1 != len(self.step_vector)):
... | Step | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Step:
def __init__(self, step_time, step=None):
"""Settings for a step sequence Args: step (list): List containing all desired step vales step_time: Time to perform step change"""
<|body_0|>
def out(self, t: any, dim=(None, None)) -> any:
"""Generate a step signal se... | stack_v2_sparse_classes_10k_train_003902 | 8,036 | no_license | [
{
"docstring": "Settings for a step sequence Args: step (list): List containing all desired step vales step_time: Time to perform step change",
"name": "__init__",
"signature": "def __init__(self, step_time, step=None)"
},
{
"docstring": "Generate a step signal sequence Args: dim: Dimension tupl... | 2 | stack_v2_sparse_classes_30k_train_002569 | Implement the Python class `Step` described below.
Class description:
Implement the Step class.
Method signatures and docstrings:
- def __init__(self, step_time, step=None): Settings for a step sequence Args: step (list): List containing all desired step vales step_time: Time to perform step change
- def out(self, t:... | Implement the Python class `Step` described below.
Class description:
Implement the Step class.
Method signatures and docstrings:
- def __init__(self, step_time, step=None): Settings for a step sequence Args: step (list): List containing all desired step vales step_time: Time to perform step change
- def out(self, t:... | cf548475295f25407ba968546c2fc85c26f9343c | <|skeleton|>
class Step:
def __init__(self, step_time, step=None):
"""Settings for a step sequence Args: step (list): List containing all desired step vales step_time: Time to perform step change"""
<|body_0|>
def out(self, t: any, dim=(None, None)) -> any:
"""Generate a step signal se... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Step:
def __init__(self, step_time, step=None):
"""Settings for a step sequence Args: step (list): List containing all desired step vales step_time: Time to perform step change"""
self.step_vector = step
self.step_time = step_time
self.ref_timer = None
def out(self, t: any... | the_stack_v2_python_sparse | SourceCode/simulation/signal.py | martin-bachorik/Master-Thesis-Project | train | 0 | |
446292bcd4ee644a095f96e2316ab92f3862aabd | [
"super(ESRCodec, self).__init__(search_space, **kwargs)\nself.func_type, self.func_prob = self.get_choices()\nself.param_block = self.get_para_block()\nself.flops_block = self.get_flops_block()\nself.func_type_num = len(self.func_type)",
"model_type = self.search_space['modules'][0]\nblock_types = self.search_spa... | <|body_start_0|>
super(ESRCodec, self).__init__(search_space, **kwargs)
self.func_type, self.func_prob = self.get_choices()
self.param_block = self.get_para_block()
self.flops_block = self.get_flops_block()
self.func_type_num = len(self.func_type)
<|end_body_0|>
<|body_start_1|>... | Codec of the MtMSR search space. | ESRCodec | [
"Apache-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ESRCodec:
"""Codec of the MtMSR search space."""
def __init__(self, search_space=None, **kwargs):
"""Construct the SRCodec class. :param codec_name: name of the codec :type codec_name: string :param search_space: search space of the codec :type search_space: dictionary "S_" means tha... | stack_v2_sparse_classes_10k_train_003903 | 5,591 | permissive | [
{
"docstring": "Construct the SRCodec class. :param codec_name: name of the codec :type codec_name: string :param search_space: search space of the codec :type search_space: dictionary \"S_\" means that the shrink RDB (SRDB). \"G_\" means that the group RDB (GRDB). \"C_\" means that the contextual RDB (CRDB). f... | 5 | null | Implement the Python class `ESRCodec` described below.
Class description:
Codec of the MtMSR search space.
Method signatures and docstrings:
- def __init__(self, search_space=None, **kwargs): Construct the SRCodec class. :param codec_name: name of the codec :type codec_name: string :param search_space: search space o... | Implement the Python class `ESRCodec` described below.
Class description:
Codec of the MtMSR search space.
Method signatures and docstrings:
- def __init__(self, search_space=None, **kwargs): Construct the SRCodec class. :param codec_name: name of the codec :type codec_name: string :param search_space: search space o... | df51ed9c1d6dbde1deef63f2a037a369f8554406 | <|skeleton|>
class ESRCodec:
"""Codec of the MtMSR search space."""
def __init__(self, search_space=None, **kwargs):
"""Construct the SRCodec class. :param codec_name: name of the codec :type codec_name: string :param search_space: search space of the codec :type search_space: dictionary "S_" means tha... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ESRCodec:
"""Codec of the MtMSR search space."""
def __init__(self, search_space=None, **kwargs):
"""Construct the SRCodec class. :param codec_name: name of the codec :type codec_name: string :param search_space: search space of the codec :type search_space: dictionary "S_" means that the shrink ... | the_stack_v2_python_sparse | built-in/TensorFlow/Official/cv/image_classification/ResnetVariant_for_TensorFlow/automl/vega/algorithms/nas/esr_ea/esr_ea_codec.py | Huawei-Ascend/modelzoo | train | 1 |
d33f5928e4414fbed5d4a09ae32baa2c6f413c19 | [
"super(Encoder, self).__init__()\nself.input_size = input_size\nself.hidden_size = hidden_size\nself.num_layers = num_layers\nif rnn_type == 'LSTM':\n self.model = nn.LSTM(input_size=self.input_size, hidden_size=self.hidden_size, num_layers=self.num_layers, batch_first=batch_first, dropout=dropout)\nelif rnn_typ... | <|body_start_0|>
super(Encoder, self).__init__()
self.input_size = input_size
self.hidden_size = hidden_size
self.num_layers = num_layers
if rnn_type == 'LSTM':
self.model = nn.LSTM(input_size=self.input_size, hidden_size=self.hidden_size, num_layers=self.num_layers, ... | Encoder Network | Encoder | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Encoder:
"""Encoder Network"""
def __init__(self, input_size: int, hidden_size: int, num_layers: int, dropout: float=0, batch_first: bool=True, rnn_type: str='LSTM'):
"""Create Encoder Args: input_size (int): number of features per time step hidden_size (int): number of hidden nodes ... | stack_v2_sparse_classes_10k_train_003904 | 14,969 | permissive | [
{
"docstring": "Create Encoder Args: input_size (int): number of features per time step hidden_size (int): number of hidden nodes per time step num_layers (int): number of layers dropout (float, optional): percentage of nodes that should switched out at any term. Defaults to 0. batch_first (bool, optional): if ... | 2 | stack_v2_sparse_classes_30k_val_000069 | Implement the Python class `Encoder` described below.
Class description:
Encoder Network
Method signatures and docstrings:
- def __init__(self, input_size: int, hidden_size: int, num_layers: int, dropout: float=0, batch_first: bool=True, rnn_type: str='LSTM'): Create Encoder Args: input_size (int): number of features... | Implement the Python class `Encoder` described below.
Class description:
Encoder Network
Method signatures and docstrings:
- def __init__(self, input_size: int, hidden_size: int, num_layers: int, dropout: float=0, batch_first: bool=True, rnn_type: str='LSTM'): Create Encoder Args: input_size (int): number of features... | 5b4a61b5dd0bc259ffe68223877949ef4ebfa5e3 | <|skeleton|>
class Encoder:
"""Encoder Network"""
def __init__(self, input_size: int, hidden_size: int, num_layers: int, dropout: float=0, batch_first: bool=True, rnn_type: str='LSTM'):
"""Create Encoder Args: input_size (int): number of features per time step hidden_size (int): number of hidden nodes ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Encoder:
"""Encoder Network"""
def __init__(self, input_size: int, hidden_size: int, num_layers: int, dropout: float=0, batch_first: bool=True, rnn_type: str='LSTM'):
"""Create Encoder Args: input_size (int): number of features per time step hidden_size (int): number of hidden nodes per time step... | the_stack_v2_python_sparse | src/models/anomalia/layers.py | maurony/ts-vrae | train | 1 |
5e5f8576e7a302675499af2023afb21453ddaad7 | [
"self.total = num_rows * num_columns\nself.row_names = row_index_names\nif row_index_names:\n data_frame = pd.DataFrame(index=np.arange(num_rows), columns=['index'] + column_names)\n data_frame['index'] = row_index_names\n self.row_index_to_row_name_map = self.map_row_names()\nelse:\n data_frame = pd.Da... | <|body_start_0|>
self.total = num_rows * num_columns
self.row_names = row_index_names
if row_index_names:
data_frame = pd.DataFrame(index=np.arange(num_rows), columns=['index'] + column_names)
data_frame['index'] = row_index_names
self.row_index_to_row_name_ma... | Datatable object synced with a server session that updates on the bokeh server every time update_table is called. | DataTable | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataTable:
"""Datatable object synced with a server session that updates on the bokeh server every time update_table is called."""
def __init__(self, num_rows: int, num_columns: int, column_names: list, bokeh_document: Optional[BokehDocument], row_index_names: list=None):
""":param n... | stack_v2_sparse_classes_10k_train_003905 | 14,891 | permissive | [
{
"docstring": ":param num_rows: number of records in the table :param num_columns: number of columns to create :param column_names: list containing column headers :param bokeh_document: bokeh document to which to add the table if provided :param row_index_names: list containing unique index names for each reco... | 3 | null | Implement the Python class `DataTable` described below.
Class description:
Datatable object synced with a server session that updates on the bokeh server every time update_table is called.
Method signatures and docstrings:
- def __init__(self, num_rows: int, num_columns: int, column_names: list, bokeh_document: Optio... | Implement the Python class `DataTable` described below.
Class description:
Datatable object synced with a server session that updates on the bokeh server every time update_table is called.
Method signatures and docstrings:
- def __init__(self, num_rows: int, num_columns: int, column_names: list, bokeh_document: Optio... | 5a406e657082b6a4f6e4bf48f0e46e085cb1e351 | <|skeleton|>
class DataTable:
"""Datatable object synced with a server session that updates on the bokeh server every time update_table is called."""
def __init__(self, num_rows: int, num_columns: int, column_names: list, bokeh_document: Optional[BokehDocument], row_index_names: list=None):
""":param n... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DataTable:
"""Datatable object synced with a server session that updates on the bokeh server every time update_table is called."""
def __init__(self, num_rows: int, num_columns: int, column_names: list, bokeh_document: Optional[BokehDocument], row_index_names: list=None):
""":param num_rows: numb... | the_stack_v2_python_sparse | TrainingExtensions/common/src/python/aimet_common/bokeh_plots.py | quic/aimet | train | 1,676 |
75e371e38a143a5fced80493ddbed002b991b9be | [
"if ife1 == ife2 or not count:\n return False\nif not ife1.is_structured or not ife2.is_structured:\n return True\ncount = float(count)\nreturn max(count / ife1.internal, count / ife2.internal) >= CUTOFF",
"same = coll.defaultdict(dict)\nrest = coll.defaultdict(dict)\nfor ife1, ife2 in it.product(ifes, repe... | <|body_start_0|>
if ife1 == ife2 or not count:
return False
if not ife1.is_structured or not ife2.is_structured:
return True
count = float(count)
return max(count / ife1.internal, count / ife2.internal) >= CUTOFF
<|end_body_0|>
<|body_start_1|>
same = col... | This is a class to take a list of chains and find all that are structured. The main entry point is to simply call it. Other methods are available but these only do part of the tasks required for creating structured groupings. | Grouper | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Grouper:
"""This is a class to take a list of chains and find all that are structured. The main entry point is to simply call it. Other methods are available but these only do part of the tasks required for creating structured groupings."""
def should_join(self, ife1, ife2, count):
"... | stack_v2_sparse_classes_10k_train_003906 | 6,177 | no_license | [
{
"docstring": "Detect if two ifes should be joined. This will consider the types of interactions and the ratio of internal base pairs to external base pairs. :ife1: The first ife chain. :ife2: The second ife chain. :count: The number of external base pairs between these chains. :returns: True if the chains sho... | 5 | stack_v2_sparse_classes_30k_train_002883 | Implement the Python class `Grouper` described below.
Class description:
This is a class to take a list of chains and find all that are structured. The main entry point is to simply call it. Other methods are available but these only do part of the tasks required for creating structured groupings.
Method signatures a... | Implement the Python class `Grouper` described below.
Class description:
This is a class to take a list of chains and find all that are structured. The main entry point is to simply call it. Other methods are available but these only do part of the tasks required for creating structured groupings.
Method signatures a... | 1982e10a56885e56d79aac69365b9ff78c0e3d92 | <|skeleton|>
class Grouper:
"""This is a class to take a list of chains and find all that are structured. The main entry point is to simply call it. Other methods are available but these only do part of the tasks required for creating structured groupings."""
def should_join(self, ife1, ife2, count):
"... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Grouper:
"""This is a class to take a list of chains and find all that are structured. The main entry point is to simply call it. Other methods are available but these only do part of the tasks required for creating structured groupings."""
def should_join(self, ife1, ife2, count):
"""Detect if t... | the_stack_v2_python_sparse | pymotifs/ife/grouper.py | BGSU-RNA/RNA-3D-Hub-core | train | 3 |
5bb530eae97a1c0fb0e554ddc5ded860c896aa8a | [
"self.local_view_box_id = local_view_box_id\nself.local_view_box_name = local_view_box_name\nself.remote_view_box_id = remote_view_box_id\nself.remote_view_box_name = remote_view_box_name",
"if dictionary is None:\n return None\nlocal_view_box_id = dictionary.get('localViewBoxId')\nlocal_view_box_name = dictio... | <|body_start_0|>
self.local_view_box_id = local_view_box_id
self.local_view_box_name = local_view_box_name
self.remote_view_box_id = remote_view_box_id
self.remote_view_box_name = remote_view_box_name
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None... | Implementation of the 'ViewBoxPairInfo' model. Specifies a pairing between a Storage Domain (View Box) on local Cluster with a Storage Domain (View Box) on a remote Cluster. When replication is configured between a local Cluster and a remote Cluster, the Snapshots are replicated from the specified Storage Domain (View ... | ViewBoxPairInfo | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ViewBoxPairInfo:
"""Implementation of the 'ViewBoxPairInfo' model. Specifies a pairing between a Storage Domain (View Box) on local Cluster with a Storage Domain (View Box) on a remote Cluster. When replication is configured between a local Cluster and a remote Cluster, the Snapshots are replicat... | stack_v2_sparse_classes_10k_train_003907 | 2,996 | permissive | [
{
"docstring": "Constructor for the ViewBoxPairInfo class",
"name": "__init__",
"signature": "def __init__(self, local_view_box_id=None, local_view_box_name=None, remote_view_box_id=None, remote_view_box_name=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dic... | 2 | null | Implement the Python class `ViewBoxPairInfo` described below.
Class description:
Implementation of the 'ViewBoxPairInfo' model. Specifies a pairing between a Storage Domain (View Box) on local Cluster with a Storage Domain (View Box) on a remote Cluster. When replication is configured between a local Cluster and a rem... | Implement the Python class `ViewBoxPairInfo` described below.
Class description:
Implementation of the 'ViewBoxPairInfo' model. Specifies a pairing between a Storage Domain (View Box) on local Cluster with a Storage Domain (View Box) on a remote Cluster. When replication is configured between a local Cluster and a rem... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class ViewBoxPairInfo:
"""Implementation of the 'ViewBoxPairInfo' model. Specifies a pairing between a Storage Domain (View Box) on local Cluster with a Storage Domain (View Box) on a remote Cluster. When replication is configured between a local Cluster and a remote Cluster, the Snapshots are replicat... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ViewBoxPairInfo:
"""Implementation of the 'ViewBoxPairInfo' model. Specifies a pairing between a Storage Domain (View Box) on local Cluster with a Storage Domain (View Box) on a remote Cluster. When replication is configured between a local Cluster and a remote Cluster, the Snapshots are replicated from the s... | the_stack_v2_python_sparse | cohesity_management_sdk/models/view_box_pair_info.py | cohesity/management-sdk-python | train | 24 |
b7a5ac742168bbf987523aa9a53e13370a995bdd | [
"if not object_ids:\n return {}\nobject_params = GetObjectsParameters(include_directory_object_references=True, object_ids=object_ids)\nprincipal_dics = {object_id: DirectoryObject() for object_id in object_ids}\naad_objects = graph_client.objects.get_objects_by_object_ids(object_params)\ntry:\n for aad_objec... | <|body_start_0|>
if not object_ids:
return {}
object_params = GetObjectsParameters(include_directory_object_references=True, object_ids=object_ids)
principal_dics = {object_id: DirectoryObject() for object_id in object_ids}
aad_objects = graph_client.objects.get_objects_by_ob... | GraphHelper | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GraphHelper:
def get_principal_dictionary(graph_client, object_ids, raise_on_graph_call_error=False):
"""Retrieves Azure AD Objects for corresponding object ids passed. :param graph_client: A client for Microsoft Graph. :param object_ids: The object ids to retrieve Azure AD objects for. ... | stack_v2_sparse_classes_10k_train_003908 | 23,452 | permissive | [
{
"docstring": "Retrieves Azure AD Objects for corresponding object ids passed. :param graph_client: A client for Microsoft Graph. :param object_ids: The object ids to retrieve Azure AD objects for. :param raise_on_graph_call_error: A boolean indicate whether an error should be raised if the underlying Microsof... | 2 | null | Implement the Python class `GraphHelper` described below.
Class description:
Implement the GraphHelper class.
Method signatures and docstrings:
- def get_principal_dictionary(graph_client, object_ids, raise_on_graph_call_error=False): Retrieves Azure AD Objects for corresponding object ids passed. :param graph_client... | Implement the Python class `GraphHelper` described below.
Class description:
Implement the GraphHelper class.
Method signatures and docstrings:
- def get_principal_dictionary(graph_client, object_ids, raise_on_graph_call_error=False): Retrieves Azure AD Objects for corresponding object ids passed. :param graph_client... | 27563cf4571040f923124e1acb2463f11e372225 | <|skeleton|>
class GraphHelper:
def get_principal_dictionary(graph_client, object_ids, raise_on_graph_call_error=False):
"""Retrieves Azure AD Objects for corresponding object ids passed. :param graph_client: A client for Microsoft Graph. :param object_ids: The object ids to retrieve Azure AD objects for. ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GraphHelper:
def get_principal_dictionary(graph_client, object_ids, raise_on_graph_call_error=False):
"""Retrieves Azure AD Objects for corresponding object ids passed. :param graph_client: A client for Microsoft Graph. :param object_ids: The object ids to retrieve Azure AD objects for. :param raise_o... | the_stack_v2_python_sparse | tools/c7n_azure/c7n_azure/utils.py | cloud-custodian/cloud-custodian | train | 3,327 | |
bd84700fa22473710204eab2fb0a9af8cadc356f | [
"assert isinstance(path_and_filename, str)\nassert width > 0 and height > 0\nassert output_format in [self.PNG, self.SVG, self.JPG, self.GIF]\nself.path_and_filename = path_and_filename\nself.plot_obj = plot_obj\nself.width = width\nself.height = height\nself.output_format = output_format",
"header = '#!/usr/bin/... | <|body_start_0|>
assert isinstance(path_and_filename, str)
assert width > 0 and height > 0
assert output_format in [self.PNG, self.SVG, self.JPG, self.GIF]
self.path_and_filename = path_and_filename
self.plot_obj = plot_obj
self.width = width
self.height = height
... | The scripts represents a whole gnuplot script. The main intention is to define the format, the file and to run gnuplot to generate the image (like png). | script | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class script:
"""The scripts represents a whole gnuplot script. The main intention is to define the format, the file and to run gnuplot to generate the image (like png)."""
def __init__(self, path_and_filename, plot_obj, width=640, height=480, output_format=PNG):
"""Init script and assert ... | stack_v2_sparse_classes_10k_train_003909 | 3,546 | permissive | [
{
"docstring": "Init script and assert parameters. :param path_and_filename: location to write script and where also to generate image. :param plot_obj: instance of a plot (or a multiplot) :param width: width of the final image (default 640) :param height: height of the final image (default 480) :param output_f... | 3 | stack_v2_sparse_classes_30k_train_001517 | Implement the Python class `script` described below.
Class description:
The scripts represents a whole gnuplot script. The main intention is to define the format, the file and to run gnuplot to generate the image (like png).
Method signatures and docstrings:
- def __init__(self, path_and_filename, plot_obj, width=640... | Implement the Python class `script` described below.
Class description:
The scripts represents a whole gnuplot script. The main intention is to define the format, the file and to run gnuplot to generate the image (like png).
Method signatures and docstrings:
- def __init__(self, path_and_filename, plot_obj, width=640... | 64e1f82de144f959cdf3c6dcf0f692bbc0ceb20f | <|skeleton|>
class script:
"""The scripts represents a whole gnuplot script. The main intention is to define the format, the file and to run gnuplot to generate the image (like png)."""
def __init__(self, path_and_filename, plot_obj, width=640, height=480, output_format=PNG):
"""Init script and assert ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class script:
"""The scripts represents a whole gnuplot script. The main intention is to define the format, the file and to run gnuplot to generate the image (like png)."""
def __init__(self, path_and_filename, plot_obj, width=640, height=480, output_format=PNG):
"""Init script and assert parameters. :... | the_stack_v2_python_sparse | concept/graph/gnuplot/script.py | Nachtfeuer/concept-py | train | 2 |
8acb26eaefec70ccdff227346b3ee29b8ff90f84 | [
"answer = list()\nif root is not None:\n self.__traverse(root, answer)\nreturn answer",
"if node.left is not None:\n self.__traverse(node.left, answer)\nif node.right is not None:\n self.__traverse(node.right, answer)\nanswer.append(node.val)"
] | <|body_start_0|>
answer = list()
if root is not None:
self.__traverse(root, answer)
return answer
<|end_body_0|>
<|body_start_1|>
if node.left is not None:
self.__traverse(node.left, answer)
if node.right is not None:
self.__traverse(node.righ... | Solution | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def postorderTraversal(self, root):
""":type root: TreeNode :rtype: List[int]"""
<|body_0|>
def __traverse(self, node, answer):
""":type node: TreeNode :type answer: List[int] :rtype: None"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
an... | stack_v2_sparse_classes_10k_train_003910 | 1,125 | permissive | [
{
"docstring": ":type root: TreeNode :rtype: List[int]",
"name": "postorderTraversal",
"signature": "def postorderTraversal(self, root)"
},
{
"docstring": ":type node: TreeNode :type answer: List[int] :rtype: None",
"name": "__traverse",
"signature": "def __traverse(self, node, answer)"
... | 2 | stack_v2_sparse_classes_30k_train_003569 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def postorderTraversal(self, root): :type root: TreeNode :rtype: List[int]
- def __traverse(self, node, answer): :type node: TreeNode :type answer: List[int] :rtype: None | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def postorderTraversal(self, root): :type root: TreeNode :rtype: List[int]
- def __traverse(self, node, answer): :type node: TreeNode :type answer: List[int] :rtype: None
<|skel... | c60b332866caa28e1ae5e216cbfc2c6f869a751a | <|skeleton|>
class Solution:
def postorderTraversal(self, root):
""":type root: TreeNode :rtype: List[int]"""
<|body_0|>
def __traverse(self, node, answer):
""":type node: TreeNode :type answer: List[int] :rtype: None"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def postorderTraversal(self, root):
""":type root: TreeNode :rtype: List[int]"""
answer = list()
if root is not None:
self.__traverse(root, answer)
return answer
def __traverse(self, node, answer):
""":type node: TreeNode :type answer: List[in... | the_stack_v2_python_sparse | leetcode/hard/tree/test_binary_tree_postorder_traversal.py | yenbohuang/online-contest-python | train | 0 | |
b35d9af19a45b67c05c09ddae2bfce92e2dd72f0 | [
"self.chol = cholesky_factor\nself.kmf = kmf\nself.nk = len(self.kmf.kpts)\nif naux is None:\n naux = cholesky_factor[0, 0].shape[0]\nself.naux = naux\nself.nao = cholesky_factor[0, 0].shape[-1]\nk_transfer_map = build_momentum_transfer_mapping(self.kmf.cell, self.kmf.kpts)\nself.k_transfer_map = k_transfer_map"... | <|body_start_0|>
self.chol = cholesky_factor
self.kmf = kmf
self.nk = len(self.kmf.kpts)
if naux is None:
naux = cholesky_factor[0, 0].shape[0]
self.naux = naux
self.nao = cholesky_factor[0, 0].shape[-1]
k_transfer_map = build_momentum_transfer_mapping... | SingleFactorization | [
"LicenseRef-scancode-generic-cla",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SingleFactorization:
def __init__(self, cholesky_factor: npt.NDArray, kmf: scf.HF, naux: int=None):
"""Class defining single-factorized ERIs. Args: cholesky_factor: Cholesky factor tensor that is [nkpts, nkpts, naux, nao, nao]. To see how to generate this see cholesky_from_df_ints kmf: p... | stack_v2_sparse_classes_10k_train_003911 | 4,487 | permissive | [
{
"docstring": "Class defining single-factorized ERIs. Args: cholesky_factor: Cholesky factor tensor that is [nkpts, nkpts, naux, nao, nao]. To see how to generate this see cholesky_from_df_ints kmf: pyscf k-object. Currently only used to obtain the number of k-points. Must have an attribute kpts which len(self... | 3 | null | Implement the Python class `SingleFactorization` described below.
Class description:
Implement the SingleFactorization class.
Method signatures and docstrings:
- def __init__(self, cholesky_factor: npt.NDArray, kmf: scf.HF, naux: int=None): Class defining single-factorized ERIs. Args: cholesky_factor: Cholesky factor... | Implement the Python class `SingleFactorization` described below.
Class description:
Implement the SingleFactorization class.
Method signatures and docstrings:
- def __init__(self, cholesky_factor: npt.NDArray, kmf: scf.HF, naux: int=None): Class defining single-factorized ERIs. Args: cholesky_factor: Cholesky factor... | 788481753c798a72c5cb3aa9f2aa9da3ce3190b0 | <|skeleton|>
class SingleFactorization:
def __init__(self, cholesky_factor: npt.NDArray, kmf: scf.HF, naux: int=None):
"""Class defining single-factorized ERIs. Args: cholesky_factor: Cholesky factor tensor that is [nkpts, nkpts, naux, nao, nao]. To see how to generate this see cholesky_from_df_ints kmf: p... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SingleFactorization:
def __init__(self, cholesky_factor: npt.NDArray, kmf: scf.HF, naux: int=None):
"""Class defining single-factorized ERIs. Args: cholesky_factor: Cholesky factor tensor that is [nkpts, nkpts, naux, nao, nao]. To see how to generate this see cholesky_from_df_ints kmf: pyscf k-object.... | the_stack_v2_python_sparse | src/openfermion/resource_estimates/pbc/sf/sf_integrals.py | quantumlib/OpenFermion | train | 1,481 | |
f62224fabb990042d95d91a58703eb28241dda20 | [
"prehead = ListNode(-1)\ncur = prehead\nwhile l1 and l2:\n if l1.val <= l2.val:\n cur.next = l1\n l1 = l1.next\n else:\n cur.next = l2\n l2 = l2.next\n cur = cur.next\ncur.next = l1 or l2\nreturn prehead.next",
"if l1 is None:\n return l2\nelif l2 is None:\n return l1\ni... | <|body_start_0|>
prehead = ListNode(-1)
cur = prehead
while l1 and l2:
if l1.val <= l2.val:
cur.next = l1
l1 = l1.next
else:
cur.next = l2
l2 = l2.next
cur = cur.next
cur.next = l1 or l2
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode:
"""使用遍历的方式进行沟通 :param l1: :param l2: :return:"""
<|body_0|>
def mergeTwoListsrRcursive(self, l1: ListNode, l2: ListNode) -> ListNode:
"""使用递归的方式同步相关的方法 :param l1: :param l2: :return:"""
... | stack_v2_sparse_classes_10k_train_003912 | 1,376 | no_license | [
{
"docstring": "使用遍历的方式进行沟通 :param l1: :param l2: :return:",
"name": "mergeTwoLists",
"signature": "def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode"
},
{
"docstring": "使用递归的方式同步相关的方法 :param l1: :param l2: :return:",
"name": "mergeTwoListsrRcursive",
"signature": "def merg... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: 使用遍历的方式进行沟通 :param l1: :param l2: :return:
- def mergeTwoListsrRcursive(self, l1: ListNode, l2: ListNode) -> List... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: 使用遍历的方式进行沟通 :param l1: :param l2: :return:
- def mergeTwoListsrRcursive(self, l1: ListNode, l2: ListNode) -> List... | af13162360a28a0bcd71918fd8bff77c41ddcc2a | <|skeleton|>
class Solution:
def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode:
"""使用遍历的方式进行沟通 :param l1: :param l2: :return:"""
<|body_0|>
def mergeTwoListsrRcursive(self, l1: ListNode, l2: ListNode) -> ListNode:
"""使用递归的方式同步相关的方法 :param l1: :param l2: :return:"""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode:
"""使用遍历的方式进行沟通 :param l1: :param l2: :return:"""
prehead = ListNode(-1)
cur = prehead
while l1 and l2:
if l1.val <= l2.val:
cur.next = l1
l1 = l1.next
... | the_stack_v2_python_sparse | 算法分析和归类/链表/合并两个有序链表.py | Carmenliukang/leetcode | train | 4 | |
00101883039da528f46212b989e9a65d29ff0dd1 | [
"res = []\ni, j = (1, n)\nwhile i <= j:\n if k > 1:\n if k % 2 > 0:\n res.append(i)\n i += 1\n else:\n res.append(j)\n j -= 1\n k -= 1\n else:\n res.append(i)\n i += 1\nreturn res",
"visited = [0] * (n + 1)\ndistinct = {}\nself.r... | <|body_start_0|>
res = []
i, j = (1, n)
while i <= j:
if k > 1:
if k % 2 > 0:
res.append(i)
i += 1
else:
res.append(j)
j -= 1
k -= 1
else:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def constructArray(self, n, k):
""":type n: int :type k: int :rtype: List[int]"""
<|body_0|>
def constructArrayTLE(self, n, k):
""":type n: int :type k: int :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
res = []
... | stack_v2_sparse_classes_10k_train_003913 | 2,816 | no_license | [
{
"docstring": ":type n: int :type k: int :rtype: List[int]",
"name": "constructArray",
"signature": "def constructArray(self, n, k)"
},
{
"docstring": ":type n: int :type k: int :rtype: List[int]",
"name": "constructArrayTLE",
"signature": "def constructArrayTLE(self, n, k)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004175 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def constructArray(self, n, k): :type n: int :type k: int :rtype: List[int]
- def constructArrayTLE(self, n, k): :type n: int :type k: int :rtype: List[int] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def constructArray(self, n, k): :type n: int :type k: int :rtype: List[int]
- def constructArrayTLE(self, n, k): :type n: int :type k: int :rtype: List[int]
<|skeleton|>
class S... | 810575368ecffa97677bdb51744d1f716140bbb1 | <|skeleton|>
class Solution:
def constructArray(self, n, k):
""":type n: int :type k: int :rtype: List[int]"""
<|body_0|>
def constructArrayTLE(self, n, k):
""":type n: int :type k: int :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def constructArray(self, n, k):
""":type n: int :type k: int :rtype: List[int]"""
res = []
i, j = (1, n)
while i <= j:
if k > 1:
if k % 2 > 0:
res.append(i)
i += 1
else:
... | the_stack_v2_python_sparse | B/BeautifulArrangementII.py | bssrdf/pyleet | train | 2 | |
63486076b78466c6e2ae0a103a628f366a413ab2 | [
"time.sleep(2)\nMsgLoginPage(web_page).login(data['username'], data['code'])\nlogging.info('开始断言')\ntime.sleep(3)\ntry:\n assert MsgLoginPage(web_page).login_success() == data['check']\n logging.info('登录成功')\nexcept:\n print('登录失败')\n common.save_screenShot(web_page, model_name='登录页面')\n raise",
"M... | <|body_start_0|>
time.sleep(2)
MsgLoginPage(web_page).login(data['username'], data['code'])
logging.info('开始断言')
time.sleep(3)
try:
assert MsgLoginPage(web_page).login_success() == data['check']
logging.info('登录成功')
except:
print('登录失败'... | TestMsgLogin | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestMsgLogin:
def test_Msg_login_success(self, data, web_page):
"""成功登录"""
<|body_0|>
def test_Msg_usernotin(self, data, web_page):
"""验证码错误"""
<|body_1|>
def test_Msg_usernotin2(self, data, web_page):
"""手机号码错误"""
<|body_2|>
<|end_skele... | stack_v2_sparse_classes_10k_train_003914 | 2,325 | no_license | [
{
"docstring": "成功登录",
"name": "test_Msg_login_success",
"signature": "def test_Msg_login_success(self, data, web_page)"
},
{
"docstring": "验证码错误",
"name": "test_Msg_usernotin",
"signature": "def test_Msg_usernotin(self, data, web_page)"
},
{
"docstring": "手机号码错误",
"name": "t... | 3 | stack_v2_sparse_classes_30k_train_003926 | Implement the Python class `TestMsgLogin` described below.
Class description:
Implement the TestMsgLogin class.
Method signatures and docstrings:
- def test_Msg_login_success(self, data, web_page): 成功登录
- def test_Msg_usernotin(self, data, web_page): 验证码错误
- def test_Msg_usernotin2(self, data, web_page): 手机号码错误 | Implement the Python class `TestMsgLogin` described below.
Class description:
Implement the TestMsgLogin class.
Method signatures and docstrings:
- def test_Msg_login_success(self, data, web_page): 成功登录
- def test_Msg_usernotin(self, data, web_page): 验证码错误
- def test_Msg_usernotin2(self, data, web_page): 手机号码错误
<|sk... | b262c13e55a6e9eae1d4fa11d50b71814028261c | <|skeleton|>
class TestMsgLogin:
def test_Msg_login_success(self, data, web_page):
"""成功登录"""
<|body_0|>
def test_Msg_usernotin(self, data, web_page):
"""验证码错误"""
<|body_1|>
def test_Msg_usernotin2(self, data, web_page):
"""手机号码错误"""
<|body_2|>
<|end_skele... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestMsgLogin:
def test_Msg_login_success(self, data, web_page):
"""成功登录"""
time.sleep(2)
MsgLoginPage(web_page).login(data['username'], data['code'])
logging.info('开始断言')
time.sleep(3)
try:
assert MsgLoginPage(web_page).login_success() == data['check... | the_stack_v2_python_sparse | TestCase/test_C_web/test_login_msg.py | xjx985426946/Test_UI | train | 0 | |
5bf3a626ae092b2fe0d1c2d8623b2609f9d3e34d | [
"if not head:\n return None\nself.head = None\nself.reverse_recur(head)\nreturn self.head",
"if not node:\n return\nhead = ListNode(node.val)\nhead.next = self.head\nself.head = head\nself.reverse_recur(node.next)"
] | <|body_start_0|>
if not head:
return None
self.head = None
self.reverse_recur(head)
return self.head
<|end_body_0|>
<|body_start_1|>
if not node:
return
head = ListNode(node.val)
head.next = self.head
self.head = head
self.... | Solution2 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution2:
def reverseList(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_0|>
def reverse_recur(self, node):
""":type node: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not head:
return No... | stack_v2_sparse_classes_10k_train_003915 | 1,997 | no_license | [
{
"docstring": ":type head: ListNode :rtype: ListNode",
"name": "reverseList",
"signature": "def reverseList(self, head)"
},
{
"docstring": ":type node: ListNode :rtype: ListNode",
"name": "reverse_recur",
"signature": "def reverse_recur(self, node)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006045 | Implement the Python class `Solution2` described below.
Class description:
Implement the Solution2 class.
Method signatures and docstrings:
- def reverseList(self, head): :type head: ListNode :rtype: ListNode
- def reverse_recur(self, node): :type node: ListNode :rtype: ListNode | Implement the Python class `Solution2` described below.
Class description:
Implement the Solution2 class.
Method signatures and docstrings:
- def reverseList(self, head): :type head: ListNode :rtype: ListNode
- def reverse_recur(self, node): :type node: ListNode :rtype: ListNode
<|skeleton|>
class Solution2:
de... | f832227c4d0e0b1c0cc326561187004ef24e2a68 | <|skeleton|>
class Solution2:
def reverseList(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_0|>
def reverse_recur(self, node):
""":type node: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution2:
def reverseList(self, head):
""":type head: ListNode :rtype: ListNode"""
if not head:
return None
self.head = None
self.reverse_recur(head)
return self.head
def reverse_recur(self, node):
""":type node: ListNode :rtype: ListNode"""
... | the_stack_v2_python_sparse | 206.py | Gackle/leetcode_practice | train | 0 | |
2d0a694ebbca739474979d7b314d7748d2cde069 | [
"budget_pool = self.pool.get('account.budget')\nbudget_line_pool = self.pool.get('account.budget.lines')\nfor r in self.browse(cr, uid, ids, context=context):\n if r.type == 'transfer' and (not r.line_ids):\n raise osv.except_osv(_('Error!'), _('You cannot complete Transfer Operations without any Budget l... | <|body_start_0|>
budget_pool = self.pool.get('account.budget')
budget_line_pool = self.pool.get('account.budget.lines')
for r in self.browse(cr, uid, ids, context=context):
if r.type == 'transfer' and (not r.line_ids):
raise osv.except_osv(_('Error!'), _('You cannot c... | Account Budget Operation. Allow accountant to transfer special amount from multiple budget lines to another for cash/plan budgets, Beside budget increase operation. | account_budget_operation | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class account_budget_operation:
"""Account Budget Operation. Allow accountant to transfer special amount from multiple budget lines to another for cash/plan budgets, Beside budget increase operation."""
def complete(self, cr, uid, ids, context={}):
"""Workflow function change state to comp... | stack_v2_sparse_classes_10k_train_003916 | 5,063 | no_license | [
{
"docstring": "Workflow function change state to complete and compute amount value & set operation number @return: True",
"name": "complete",
"signature": "def complete(self, cr, uid, ids, context={})"
},
{
"docstring": "Execute the operation by calling transfer function in budget line and chan... | 2 | stack_v2_sparse_classes_30k_train_000567 | Implement the Python class `account_budget_operation` described below.
Class description:
Account Budget Operation. Allow accountant to transfer special amount from multiple budget lines to another for cash/plan budgets, Beside budget increase operation.
Method signatures and docstrings:
- def complete(self, cr, uid,... | Implement the Python class `account_budget_operation` described below.
Class description:
Account Budget Operation. Allow accountant to transfer special amount from multiple budget lines to another for cash/plan budgets, Beside budget increase operation.
Method signatures and docstrings:
- def complete(self, cr, uid,... | 0b997095c260d58b026440967fea3a202bef7efb | <|skeleton|>
class account_budget_operation:
"""Account Budget Operation. Allow accountant to transfer special amount from multiple budget lines to another for cash/plan budgets, Beside budget increase operation."""
def complete(self, cr, uid, ids, context={}):
"""Workflow function change state to comp... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class account_budget_operation:
"""Account Budget Operation. Allow accountant to transfer special amount from multiple budget lines to another for cash/plan budgets, Beside budget increase operation."""
def complete(self, cr, uid, ids, context={}):
"""Workflow function change state to complete and comp... | the_stack_v2_python_sparse | v_7/GDS/common_shamil_v3/account_budget_cash/account_budget_operation.py | musabahmed/baba | train | 0 |
4726374eb30794637207177dd5bf595c18523db9 | [
"self.capacity = capacity\nself.dict = {}\nself.cache = []",
"if key in self.cache:\n self.cache.remove(key)\n self.cache.append(key)\nreturn self.dict.get(key) if self.dict.get(key) else -1",
"if key not in self.cache:\n if len(self.cache) >= self.capacity:\n pop_key = self.cache.pop(0)\n ... | <|body_start_0|>
self.capacity = capacity
self.dict = {}
self.cache = []
<|end_body_0|>
<|body_start_1|>
if key in self.cache:
self.cache.remove(key)
self.cache.append(key)
return self.dict.get(key) if self.dict.get(key) else -1
<|end_body_1|>
<|body_sta... | LRUCache | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LRUCache:
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_10k_train_003917 | 1,231 | 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 | stack_v2_sparse_classes_30k_train_006589 | Implement the Python class `LRUCache` described below.
Class description:
Implement the LRUCache 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 `LRUCache` described below.
Class description:
Implement the LRUCache 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... | 47911c354145d9867774aeb3358de20e55cf89ad | <|skeleton|>
class LRUCache:
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_10k | data/stack_v2_sparse_classes_30k | class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
self.capacity = capacity
self.dict = {}
self.cache = []
def get(self, key):
""":type key: int :rtype: int"""
if key in self.cache:
self.cache.remove(key)
self.cache.ap... | the_stack_v2_python_sparse | rsc/ByteDance/146_LRUCache.py | VincentGaoHJ/Sword-For-Offer | train | 1 | |
563d9bedf699301391bf3ecffa8b7cfb0bf4194b | [
"if not tf.__internal__.tf2.enabled():\n self.skipTest('pickle model only available in v2 when tf format is used.')\nmodel = test_utils.get_small_mlp(num_hidden=1, num_classes=2, input_dim=3)\nmodel.compile(optimizer='sgd', loss='sparse_categorical_crossentropy')\nx = np.random.random(size=(10, 3))\ny = np.rando... | <|body_start_0|>
if not tf.__internal__.tf2.enabled():
self.skipTest('pickle model only available in v2 when tf format is used.')
model = test_utils.get_small_mlp(num_hidden=1, num_classes=2, input_dim=3)
model.compile(optimizer='sgd', loss='sparse_categorical_crossentropy')
... | Tests pickle protocol support. | TestPickleProtocol | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestPickleProtocol:
"""Tests pickle protocol support."""
def test_built_models(self, serializer):
"""Built models should be copyable and pickleable for all model types."""
<|body_0|>
def test_unbuilt_models(self, serializer):
"""Unbuilt models should be copyable ... | stack_v2_sparse_classes_10k_train_003918 | 3,574 | permissive | [
{
"docstring": "Built models should be copyable and pickleable for all model types.",
"name": "test_built_models",
"signature": "def test_built_models(self, serializer)"
},
{
"docstring": "Unbuilt models should be copyable & deepcopyable for all model types.",
"name": "test_unbuilt_models",
... | 2 | null | Implement the Python class `TestPickleProtocol` described below.
Class description:
Tests pickle protocol support.
Method signatures and docstrings:
- def test_built_models(self, serializer): Built models should be copyable and pickleable for all model types.
- def test_unbuilt_models(self, serializer): Unbuilt model... | Implement the Python class `TestPickleProtocol` described below.
Class description:
Tests pickle protocol support.
Method signatures and docstrings:
- def test_built_models(self, serializer): Built models should be copyable and pickleable for all model types.
- def test_unbuilt_models(self, serializer): Unbuilt model... | 8d5e9b2163ec9b7d9f70920d1c7992b6df6820ec | <|skeleton|>
class TestPickleProtocol:
"""Tests pickle protocol support."""
def test_built_models(self, serializer):
"""Built models should be copyable and pickleable for all model types."""
<|body_0|>
def test_unbuilt_models(self, serializer):
"""Unbuilt models should be copyable ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestPickleProtocol:
"""Tests pickle protocol support."""
def test_built_models(self, serializer):
"""Built models should be copyable and pickleable for all model types."""
if not tf.__internal__.tf2.enabled():
self.skipTest('pickle model only available in v2 when tf format is ... | the_stack_v2_python_sparse | keras/saving/pickle_utils_test.py | xiaoheilong3112/keras | train | 1 |
d3dfc731a62bcb7b8d1a35807286cdde242f7057 | [
"Frame.__init__(self, master)\nself.grid()\nself.create_widgets()",
"Label(self, text='Choose your favorite movie type').grid(row=0, column=0, sticky=W)\nLabel(self, text='Select all that apply:').grid(row=1, column=0, sticky=W)\nself.comedy = BooleanVar()\nCheckbutton(self, text='Comedy', variable=self.comedy, c... | <|body_start_0|>
Frame.__init__(self, master)
self.grid()
self.create_widgets()
<|end_body_0|>
<|body_start_1|>
Label(self, text='Choose your favorite movie type').grid(row=0, column=0, sticky=W)
Label(self, text='Select all that apply:').grid(row=1, column=0, sticky=W)
... | Application | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Application:
def __init__(self, master):
"""initialize the Frame"""
<|body_0|>
def create_widgets(self):
"""create widgets for movie type choice"""
<|body_1|>
def update_text(self):
"""update text widget and display favorite movie types"""
... | stack_v2_sparse_classes_10k_train_003919 | 1,854 | no_license | [
{
"docstring": "initialize the Frame",
"name": "__init__",
"signature": "def __init__(self, master)"
},
{
"docstring": "create widgets for movie type choice",
"name": "create_widgets",
"signature": "def create_widgets(self)"
},
{
"docstring": "update text widget and display favor... | 3 | stack_v2_sparse_classes_30k_train_004044 | Implement the Python class `Application` described below.
Class description:
Implement the Application class.
Method signatures and docstrings:
- def __init__(self, master): initialize the Frame
- def create_widgets(self): create widgets for movie type choice
- def update_text(self): update text widget and display fa... | Implement the Python class `Application` described below.
Class description:
Implement the Application class.
Method signatures and docstrings:
- def __init__(self, master): initialize the Frame
- def create_widgets(self): create widgets for movie type choice
- def update_text(self): update text widget and display fa... | 728a8614fa50e3de0541efa87f71ec047326d66a | <|skeleton|>
class Application:
def __init__(self, master):
"""initialize the Frame"""
<|body_0|>
def create_widgets(self):
"""create widgets for movie type choice"""
<|body_1|>
def update_text(self):
"""update text widget and display favorite movie types"""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Application:
def __init__(self, master):
"""initialize the Frame"""
Frame.__init__(self, master)
self.grid()
self.create_widgets()
def create_widgets(self):
"""create widgets for movie type choice"""
Label(self, text='Choose your favorite movie type').grid(... | the_stack_v2_python_sparse | src/Ex14/check_box.py | lil-val/she-codes | train | 0 | |
4215c5a4c071d593a57161b0c0d4abb4a615ec80 | [
"left, right, area = (0, len(height) - 1, 0)\nwhile left < right:\n area = max(area, min(height[left], height[right]) * (right - left))\n if height[left] < height[right]:\n left += 1\n else:\n right -= 1\nreturn area",
"left, right, area = (0, len(height) - 1, 0)\nwhile left < right:\n m... | <|body_start_0|>
left, right, area = (0, len(height) - 1, 0)
while left < right:
area = max(area, min(height[left], height[right]) * (right - left))
if height[left] < height[right]:
left += 1
else:
right -= 1
return area
<|end_b... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxArea(self, height):
""":type height: List[int] :rtype: int"""
<|body_0|>
def maxArea1(self, height):
""":type height: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
left, right, area = (0, len(height) - 1, 0)
... | stack_v2_sparse_classes_10k_train_003920 | 955 | no_license | [
{
"docstring": ":type height: List[int] :rtype: int",
"name": "maxArea",
"signature": "def maxArea(self, height)"
},
{
"docstring": ":type height: List[int] :rtype: int",
"name": "maxArea1",
"signature": "def maxArea1(self, height)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000099 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxArea(self, height): :type height: List[int] :rtype: int
- def maxArea1(self, height): :type height: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxArea(self, height): :type height: List[int] :rtype: int
- def maxArea1(self, height): :type height: List[int] :rtype: int
<|skeleton|>
class Solution:
def maxArea(se... | b8ec1350e904665f1375c29a53f443ecf262d723 | <|skeleton|>
class Solution:
def maxArea(self, height):
""":type height: List[int] :rtype: int"""
<|body_0|>
def maxArea1(self, height):
""":type height: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def maxArea(self, height):
""":type height: List[int] :rtype: int"""
left, right, area = (0, len(height) - 1, 0)
while left < right:
area = max(area, min(height[left], height[right]) * (right - left))
if height[left] < height[right]:
le... | the_stack_v2_python_sparse | leetcode/011盛最多水的容器.py | ShawDa/Coding | train | 0 | |
9b6a98d96b52a2a80e2eeda2d43d5bd68ed7af93 | [
"dict_s, dict_t = ({}, {})\nfor i in s:\n if i not in dict_s:\n dict_s[i] = 1\n else:\n dict_s[i] += 1\nfor i in t:\n if i not in dict_t:\n dict_t[i] = 1\n else:\n dict_t[i] += 1\nreturn True if dict_s == dict_t else False",
"dict_str = {}\nif len(s) != len(t):\n return ... | <|body_start_0|>
dict_s, dict_t = ({}, {})
for i in s:
if i not in dict_s:
dict_s[i] = 1
else:
dict_s[i] += 1
for i in t:
if i not in dict_t:
dict_t[i] = 1
else:
dict_t[i] += 1
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isAnagram1(self, s: str, t: str) -> bool:
"""通过dict形式"""
<|body_0|>
def isAnagram2(self, s: str, t: str) -> bool:
"""通过dict形式,优化只需要一个dict"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
dict_s, dict_t = ({}, {})
for i in s:
... | stack_v2_sparse_classes_10k_train_003921 | 1,363 | no_license | [
{
"docstring": "通过dict形式",
"name": "isAnagram1",
"signature": "def isAnagram1(self, s: str, t: str) -> bool"
},
{
"docstring": "通过dict形式,优化只需要一个dict",
"name": "isAnagram2",
"signature": "def isAnagram2(self, s: str, t: str) -> bool"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isAnagram1(self, s: str, t: str) -> bool: 通过dict形式
- def isAnagram2(self, s: str, t: str) -> bool: 通过dict形式,优化只需要一个dict | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isAnagram1(self, s: str, t: str) -> bool: 通过dict形式
- def isAnagram2(self, s: str, t: str) -> bool: 通过dict形式,优化只需要一个dict
<|skeleton|>
class Solution:
def isAnagram1(self... | d265eb981a7586d46d0ced3accc2ea186dc7691c | <|skeleton|>
class Solution:
def isAnagram1(self, s: str, t: str) -> bool:
"""通过dict形式"""
<|body_0|>
def isAnagram2(self, s: str, t: str) -> bool:
"""通过dict形式,优化只需要一个dict"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def isAnagram1(self, s: str, t: str) -> bool:
"""通过dict形式"""
dict_s, dict_t = ({}, {})
for i in s:
if i not in dict_s:
dict_s[i] = 1
else:
dict_s[i] += 1
for i in t:
if i not in dict_t:
... | the_stack_v2_python_sparse | pythonCode/No241-250/no242.py | odinfor/leetcode | train | 0 | |
3e67135375e8e9ffc5c02e10c0562c42049e6251 | [
"if 'username' in request.COOKIES:\n username = request.COOKIES.get('username')\n checked = 'checked'\nelse:\n username = ''\n checked = ''\nreturn render(request, 'login.html', {'username': username, 'checked': checked})",
"username = request.POST.get('username')\npassword = request.POST.get('pwd')\n... | <|body_start_0|>
if 'username' in request.COOKIES:
username = request.COOKIES.get('username')
checked = 'checked'
else:
username = ''
checked = ''
return render(request, 'login.html', {'username': username, 'checked': checked})
<|end_body_0|>
<|bo... | 登录 | LoginView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoginView:
"""登录"""
def get(self, request):
"""显示登陆页面"""
<|body_0|>
def post(self, request):
"""登录校验"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if 'username' in request.COOKIES:
username = request.COOKIES.get('username')
... | stack_v2_sparse_classes_10k_train_003922 | 11,775 | no_license | [
{
"docstring": "显示登陆页面",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "登录校验",
"name": "post",
"signature": "def post(self, request)"
}
] | 2 | null | Implement the Python class `LoginView` described below.
Class description:
登录
Method signatures and docstrings:
- def get(self, request): 显示登陆页面
- def post(self, request): 登录校验 | Implement the Python class `LoginView` described below.
Class description:
登录
Method signatures and docstrings:
- def get(self, request): 显示登陆页面
- def post(self, request): 登录校验
<|skeleton|>
class LoginView:
"""登录"""
def get(self, request):
"""显示登陆页面"""
<|body_0|>
def post(self, request)... | 91293b05eb28697f5dec7f99a0f608904f6a0b1f | <|skeleton|>
class LoginView:
"""登录"""
def get(self, request):
"""显示登陆页面"""
<|body_0|>
def post(self, request):
"""登录校验"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class LoginView:
"""登录"""
def get(self, request):
"""显示登陆页面"""
if 'username' in request.COOKIES:
username = request.COOKIES.get('username')
checked = 'checked'
else:
username = ''
checked = ''
return render(request, 'login.html', {... | the_stack_v2_python_sparse | dailyfresh/apps/user/views.py | IronmanJay/Python_Project | train | 15 |
6c518816ee557ceb7ca1b9b9d8394e9f60ffe162 | [
"self.has_archival_copy = has_archival_copy\nself.has_local_copy = has_local_copy\nself.has_remote_copy = has_remote_copy\nself.modified_time_usecs = modified_time_usecs\nself.replica_info_list = replica_info_list\nself.size_bytes = size_bytes\nself.snapshot = snapshot",
"if dictionary is None:\n return None\n... | <|body_start_0|>
self.has_archival_copy = has_archival_copy
self.has_local_copy = has_local_copy
self.has_remote_copy = has_remote_copy
self.modified_time_usecs = modified_time_usecs
self.replica_info_list = replica_info_list
self.size_bytes = size_bytes
self.snap... | Implementation of the 'FileSnapshotInformation' model. Specifies the information about the snapshot that contains the file or folder. In addition, information about the file or folder is provided. Attributes: has_archival_copy (bool): If true, this snapshot is located on an archival target (such as a tape or AWS). has_... | FileSnapshotInformation | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FileSnapshotInformation:
"""Implementation of the 'FileSnapshotInformation' model. Specifies the information about the snapshot that contains the file or folder. In addition, information about the file or folder is provided. Attributes: has_archival_copy (bool): If true, this snapshot is located ... | stack_v2_sparse_classes_10k_train_003923 | 4,043 | permissive | [
{
"docstring": "Constructor for the FileSnapshotInformation class",
"name": "__init__",
"signature": "def __init__(self, has_archival_copy=None, has_local_copy=None, has_remote_copy=None, modified_time_usecs=None, replica_info_list=None, size_bytes=None, snapshot=None)"
},
{
"docstring": "Create... | 2 | stack_v2_sparse_classes_30k_train_002336 | Implement the Python class `FileSnapshotInformation` described below.
Class description:
Implementation of the 'FileSnapshotInformation' model. Specifies the information about the snapshot that contains the file or folder. In addition, information about the file or folder is provided. Attributes: has_archival_copy (bo... | Implement the Python class `FileSnapshotInformation` described below.
Class description:
Implementation of the 'FileSnapshotInformation' model. Specifies the information about the snapshot that contains the file or folder. In addition, information about the file or folder is provided. Attributes: has_archival_copy (bo... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class FileSnapshotInformation:
"""Implementation of the 'FileSnapshotInformation' model. Specifies the information about the snapshot that contains the file or folder. In addition, information about the file or folder is provided. Attributes: has_archival_copy (bool): If true, this snapshot is located ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FileSnapshotInformation:
"""Implementation of the 'FileSnapshotInformation' model. Specifies the information about the snapshot that contains the file or folder. In addition, information about the file or folder is provided. Attributes: has_archival_copy (bool): If true, this snapshot is located on an archiva... | the_stack_v2_python_sparse | cohesity_management_sdk/models/file_snapshot_information.py | cohesity/management-sdk-python | train | 24 |
2917d4d981ea280b119b4d23c1d564f9870db7f4 | [
"key = self.request.get('key')\nif not self.assert_xsrf_token_or_fail(self.request, QUESTIONNAIRE_XSRF_TOKEN_NAME, {}):\n return\nuser = self.get_user()\nif user is None:\n return\nstudent = models.Student.get_enrolled_student_by_user(user)\nif student is None:\n return\nentity = StudentFormEntity.load_or_... | <|body_start_0|>
key = self.request.get('key')
if not self.assert_xsrf_token_or_fail(self.request, QUESTIONNAIRE_XSRF_TOKEN_NAME, {}):
return
user = self.get_user()
if user is None:
return
student = models.Student.get_enrolled_student_by_user(user)
... | The REST Handler provides GET and PUT methods for the form data. | QuestionnaireHandler | [
"Apache-2.0",
"CC-BY-3.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QuestionnaireHandler:
"""The REST Handler provides GET and PUT methods for the form data."""
def get(self):
"""GET method is called when the page with the questionnaire loads."""
<|body_0|>
def post(self):
"""POST method called when the student submits answers.""... | stack_v2_sparse_classes_10k_train_003924 | 11,898 | permissive | [
{
"docstring": "GET method is called when the page with the questionnaire loads.",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "POST method called when the student submits answers.",
"name": "post",
"signature": "def post(self)"
}
] | 2 | null | Implement the Python class `QuestionnaireHandler` described below.
Class description:
The REST Handler provides GET and PUT methods for the form data.
Method signatures and docstrings:
- def get(self): GET method is called when the page with the questionnaire loads.
- def post(self): POST method called when the stude... | Implement the Python class `QuestionnaireHandler` described below.
Class description:
The REST Handler provides GET and PUT methods for the form data.
Method signatures and docstrings:
- def get(self): GET method is called when the page with the questionnaire loads.
- def post(self): POST method called when the stude... | 64f5ea13a8d85b9ef057dddae888a427b1396df6 | <|skeleton|>
class QuestionnaireHandler:
"""The REST Handler provides GET and PUT methods for the form data."""
def get(self):
"""GET method is called when the page with the questionnaire loads."""
<|body_0|>
def post(self):
"""POST method called when the student submits answers.""... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class QuestionnaireHandler:
"""The REST Handler provides GET and PUT methods for the form data."""
def get(self):
"""GET method is called when the page with the questionnaire loads."""
key = self.request.get('key')
if not self.assert_xsrf_token_or_fail(self.request, QUESTIONNAIRE_XSRF_T... | the_stack_v2_python_sparse | coursebuilder/modules/questionnaire/questionnaire.py | ram8647/gcb-clone-v111 | train | 1 |
976a57487acd724d1d05916f81826fe8d3f65d92 | [
"if map_kwargs is None:\n map_kwargs = {}\nsuper(MappedDataset, self).__init__(*args, **kwargs)\nself.map_function = map_function\nself.map_kwargs = map_kwargs\nself.transpose = transpose\nself.force2d = force2d",
"if self.transpose or self.force2d:\n array_buf = numpy.zeros(shape=self.shape, dtype=self.dty... | <|body_start_0|>
if map_kwargs is None:
map_kwargs = {}
super(MappedDataset, self).__init__(*args, **kwargs)
self.map_function = map_function
self.map_kwargs = map_kwargs
self.transpose = transpose
self.force2d = force2d
<|end_body_0|>
<|body_start_1|>
... | h5py.Dataset that applies a function to the results of __getitem__ before returning the data. Intended to dynamically generate certain datasets that are simple derivatives of others. | MappedDataset | [
"BSD-3-Clause-LBNL",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MappedDataset:
"""h5py.Dataset that applies a function to the results of __getitem__ before returning the data. Intended to dynamically generate certain datasets that are simple derivatives of others."""
def __init__(self, map_function=None, map_kwargs=None, transpose=False, force2d=False, *... | stack_v2_sparse_classes_10k_train_003925 | 10,579 | permissive | [
{
"docstring": "Configure a MappedDatset Attach a map function to a h5py.Dataset (or derivative) and store the arguments to be fed into that map function whenever this object gets sliced. Args: map_function (function): function to be called on the value returned when parent class is sliced map_kwargs (dict): kw... | 2 | stack_v2_sparse_classes_30k_train_001881 | Implement the Python class `MappedDataset` described below.
Class description:
h5py.Dataset that applies a function to the results of __getitem__ before returning the data. Intended to dynamically generate certain datasets that are simple derivatives of others.
Method signatures and docstrings:
- def __init__(self, m... | Implement the Python class `MappedDataset` described below.
Class description:
h5py.Dataset that applies a function to the results of __getitem__ before returning the data. Intended to dynamically generate certain datasets that are simple derivatives of others.
Method signatures and docstrings:
- def __init__(self, m... | 9e2f2f08742281c4550bf03d70fc96d8f02ea92b | <|skeleton|>
class MappedDataset:
"""h5py.Dataset that applies a function to the results of __getitem__ before returning the data. Intended to dynamically generate certain datasets that are simple derivatives of others."""
def __init__(self, map_function=None, map_kwargs=None, transpose=False, force2d=False, *... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MappedDataset:
"""h5py.Dataset that applies a function to the results of __getitem__ before returning the data. Intended to dynamically generate certain datasets that are simple derivatives of others."""
def __init__(self, map_function=None, map_kwargs=None, transpose=False, force2d=False, *args, **kwarg... | the_stack_v2_python_sparse | tokio/connectors/_hdf5.py | NERSC/pytokio | train | 25 |
b666e393d1d52b6aea8278e3b93420ccdf6edb0d | [
"step = 0\nfor i, num in enumerate(nums):\n if num == 0:\n step += 1\n elif step > 0:\n nums[i - step] = num\nif step > 0:\n nums[-step:] = [0] * step",
"last_nonzero_index = 0\nfor cur in range(len(nums)):\n if nums[cur] != 0:\n nums[last_nonzero_index], nums[cur] = (nums[cur], n... | <|body_start_0|>
step = 0
for i, num in enumerate(nums):
if num == 0:
step += 1
elif step > 0:
nums[i - step] = num
if step > 0:
nums[-step:] = [0] * step
<|end_body_0|>
<|body_start_1|>
last_nonzero_index = 0
f... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def moveZeroes1(self, nums: 'List[int]') -> 'None':
"""Do not return anything, modify nums in-place instead."""
<|body_0|>
def moveZeroes(self, nums: 'List[int]') -> 'None':
"""Do not return anything, modify nums in-place instead."""
<|body_1|>
<|e... | stack_v2_sparse_classes_10k_train_003926 | 1,301 | no_license | [
{
"docstring": "Do not return anything, modify nums in-place instead.",
"name": "moveZeroes1",
"signature": "def moveZeroes1(self, nums: 'List[int]') -> 'None'"
},
{
"docstring": "Do not return anything, modify nums in-place instead.",
"name": "moveZeroes",
"signature": "def moveZeroes(s... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def moveZeroes1(self, nums: 'List[int]') -> 'None': Do not return anything, modify nums in-place instead.
- def moveZeroes(self, nums: 'List[int]') -> 'None': Do not return anyth... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def moveZeroes1(self, nums: 'List[int]') -> 'None': Do not return anything, modify nums in-place instead.
- def moveZeroes(self, nums: 'List[int]') -> 'None': Do not return anyth... | 4a1747b6497305f3821612d9c358a6795b1690da | <|skeleton|>
class Solution:
def moveZeroes1(self, nums: 'List[int]') -> 'None':
"""Do not return anything, modify nums in-place instead."""
<|body_0|>
def moveZeroes(self, nums: 'List[int]') -> 'None':
"""Do not return anything, modify nums in-place instead."""
<|body_1|>
<|e... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def moveZeroes1(self, nums: 'List[int]') -> 'None':
"""Do not return anything, modify nums in-place instead."""
step = 0
for i, num in enumerate(nums):
if num == 0:
step += 1
elif step > 0:
nums[i - step] = num
i... | the_stack_v2_python_sparse | Array/q283_move_zeroes.py | sevenhe716/LeetCode | train | 0 | |
24c91ec11dd69fd6b36d2253ceaeabeaf9123db4 | [
"self.db_UF = db_UF\nself.db_OF = db_OF\nself.k_UF = k_UF\nself.k_OF = k_OF\nself.P_avl = P_avl\nself.P_min = P_min\nself.P_pre = P_pre",
"if f < 60 - self.db_UF:\n P = min(self.P_pre + (60 - self.db_UF - f) / (60 * self.k_UF), self.P_avl)\nelif f > 60 + self.db_OF:\n P = max(self.P_pre - (f - (60 + self.db... | <|body_start_0|>
self.db_UF = db_UF
self.db_OF = db_OF
self.k_UF = k_UF
self.k_OF = k_OF
self.P_avl = P_avl
self.P_min = P_min
self.P_pre = P_pre
<|end_body_0|>
<|body_start_1|>
if f < 60 - self.db_UF:
P = min(self.P_pre + (60 - self.db_UF - f... | This class describes Frequency-Droop operation of device fleet | FrequencyDroop | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FrequencyDroop:
"""This class describes Frequency-Droop operation of device fleet"""
def __init__(self, db_UF, db_OF, k_UF, k_OF, P_avl, P_min, P_pre):
"""initiating variables to evaluate the Frequency-Droop function parameters defining curve: db_UF,db_OF,k_UF,k_OF State variable: P_... | stack_v2_sparse_classes_10k_train_003927 | 2,094 | permissive | [
{
"docstring": "initiating variables to evaluate the Frequency-Droop function parameters defining curve: db_UF,db_OF,k_UF,k_OF State variable: P_avl,P_min,P_pre State variables will be updated by the fleet whenever the state of the fleet changes parameters will be updated by the high level controller whenever a... | 2 | stack_v2_sparse_classes_30k_train_007297 | Implement the Python class `FrequencyDroop` described below.
Class description:
This class describes Frequency-Droop operation of device fleet
Method signatures and docstrings:
- def __init__(self, db_UF, db_OF, k_UF, k_OF, P_avl, P_min, P_pre): initiating variables to evaluate the Frequency-Droop function parameters... | Implement the Python class `FrequencyDroop` described below.
Class description:
This class describes Frequency-Droop operation of device fleet
Method signatures and docstrings:
- def __init__(self, db_UF, db_OF, k_UF, k_OF, P_avl, P_min, P_pre): initiating variables to evaluate the Frequency-Droop function parameters... | 07ff5c6505aa6ab0a7c0ee144da20303c60baad4 | <|skeleton|>
class FrequencyDroop:
"""This class describes Frequency-Droop operation of device fleet"""
def __init__(self, db_UF, db_OF, k_UF, k_OF, P_avl, P_min, P_pre):
"""initiating variables to evaluate the Frequency-Droop function parameters defining curve: db_UF,db_OF,k_UF,k_OF State variable: P_... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FrequencyDroop:
"""This class describes Frequency-Droop operation of device fleet"""
def __init__(self, db_UF, db_OF, k_UF, k_OF, P_avl, P_min, P_pre):
"""initiating variables to evaluate the Frequency-Droop function parameters defining curve: db_UF,db_OF,k_UF,k_OF State variable: P_avl,P_min,P_p... | the_stack_v2_python_sparse | src/frequency_droop.py | GMLC-1-4-2/battery_interface | train | 2 |
139f5b5db448db070ce0d67f60eaf5204aa9b04a | [
"super(Session, self).__init__()\nself.aborted = False\nself.analysis_reports_counter = collections.Counter()\nself.artifact_filters = None\nself.command_line_arguments = None\nself.completion_time = None\nself.debug_mode = False\nself.enabled_parser_names = None\nself.event_labels_counter = collections.Counter()\n... | <|body_start_0|>
super(Session, self).__init__()
self.aborted = False
self.analysis_reports_counter = collections.Counter()
self.artifact_filters = None
self.command_line_arguments = None
self.completion_time = None
self.debug_mode = False
self.enabled_par... | Session attribute container. Attributes: aborted (bool): True if the session was aborted. analysis_reports_counter (collections.Counter): number of analysis reports per analysis plugin. artifact_filters (list[str]): Names of artifact definitions that are used for filtering file system and Windows Registry key paths. co... | Session | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Session:
"""Session attribute container. Attributes: aborted (bool): True if the session was aborted. analysis_reports_counter (collections.Counter): number of analysis reports per analysis plugin. artifact_filters (list[str]): Names of artifact definitions that are used for filtering file system... | stack_v2_sparse_classes_10k_train_003928 | 9,343 | permissive | [
{
"docstring": "Initializes a session attribute container.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Copies attributes from a session completion. Args: session_completion (SessionCompletion): session completion attribute container. Raises: ValueError: if the iden... | 5 | stack_v2_sparse_classes_30k_train_006400 | Implement the Python class `Session` described below.
Class description:
Session attribute container. Attributes: aborted (bool): True if the session was aborted. analysis_reports_counter (collections.Counter): number of analysis reports per analysis plugin. artifact_filters (list[str]): Names of artifact definitions ... | Implement the Python class `Session` described below.
Class description:
Session attribute container. Attributes: aborted (bool): True if the session was aborted. analysis_reports_counter (collections.Counter): number of analysis reports per analysis plugin. artifact_filters (list[str]): Names of artifact definitions ... | 9f8e05f21fa23793bfdade6af1d617e9dd092531 | <|skeleton|>
class Session:
"""Session attribute container. Attributes: aborted (bool): True if the session was aborted. analysis_reports_counter (collections.Counter): number of analysis reports per analysis plugin. artifact_filters (list[str]): Names of artifact definitions that are used for filtering file system... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Session:
"""Session attribute container. Attributes: aborted (bool): True if the session was aborted. analysis_reports_counter (collections.Counter): number of analysis reports per analysis plugin. artifact_filters (list[str]): Names of artifact definitions that are used for filtering file system and Windows ... | the_stack_v2_python_sparse | plaso/containers/sessions.py | joshlemon/plaso | train | 1 |
c3e25d6de7004c1e54a71c389548d12663e6dece | [
"self.cond_operator = cond_operator\nself.condition_key_values_map = condition_key_values_map\nself.for_all_values = for_all_values\nself.for_any_value = for_any_value\nself.if_exists = if_exists",
"if dictionary is None:\n return None\ncond_operator = dictionary.get('condOperator')\ncondition_key_values_map =... | <|body_start_0|>
self.cond_operator = cond_operator
self.condition_key_values_map = condition_key_values_map
self.for_all_values = for_all_values
self.for_any_value = for_any_value
self.if_exists = if_exists
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
... | Implementation of the 'Condition' model. TODO: type description here. Attributes: cond_operator (int): This field describes the operator to use to perform the condition checks. condition_key_values_map (list of Condition_ConditionKeyValuesMapEntry): This field describes the condition keys and the values specified for t... | Condition | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Condition:
"""Implementation of the 'Condition' model. TODO: type description here. Attributes: cond_operator (int): This field describes the operator to use to perform the condition checks. condition_key_values_map (list of Condition_ConditionKeyValuesMapEntry): This field describes the conditio... | stack_v2_sparse_classes_10k_train_003929 | 3,628 | permissive | [
{
"docstring": "Constructor for the Condition class",
"name": "__init__",
"signature": "def __init__(self, cond_operator=None, condition_key_values_map=None, for_all_values=None, for_any_value=None, if_exists=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dic... | 2 | null | Implement the Python class `Condition` described below.
Class description:
Implementation of the 'Condition' model. TODO: type description here. Attributes: cond_operator (int): This field describes the operator to use to perform the condition checks. condition_key_values_map (list of Condition_ConditionKeyValuesMapEn... | Implement the Python class `Condition` described below.
Class description:
Implementation of the 'Condition' model. TODO: type description here. Attributes: cond_operator (int): This field describes the operator to use to perform the condition checks. condition_key_values_map (list of Condition_ConditionKeyValuesMapEn... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class Condition:
"""Implementation of the 'Condition' model. TODO: type description here. Attributes: cond_operator (int): This field describes the operator to use to perform the condition checks. condition_key_values_map (list of Condition_ConditionKeyValuesMapEntry): This field describes the conditio... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Condition:
"""Implementation of the 'Condition' model. TODO: type description here. Attributes: cond_operator (int): This field describes the operator to use to perform the condition checks. condition_key_values_map (list of Condition_ConditionKeyValuesMapEntry): This field describes the condition keys and th... | the_stack_v2_python_sparse | cohesity_management_sdk/models/condition.py | cohesity/management-sdk-python | train | 24 |
d0ab132b3cb579e5158664726323eb7c121cab1d | [
"self.graph = Graph('http://IP//:7474', username='neo4j', password='xxxxx')\nself.links = []\nself.nodes = []",
"select_name = '南京审计大学'\nnodes_data_all = self.graph.run('MATCH (n) RETURN n').data()\nnodes_list = []\nfor node in nodes_data_all:\n nodes_list.append(node['n']['name'])\nif select_name in nodes_lis... | <|body_start_0|>
self.graph = Graph('http://IP//:7474', username='neo4j', password='xxxxx')
self.links = []
self.nodes = []
<|end_body_0|>
<|body_start_1|>
select_name = '南京审计大学'
nodes_data_all = self.graph.run('MATCH (n) RETURN n').data()
nodes_list = []
for nod... | 知识图谱数据接口 | Neo4jToJson | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Neo4jToJson:
"""知识图谱数据接口"""
def __init__(self):
"""初始化数据"""
<|body_0|>
def post(self):
"""与前端交互"""
<|body_1|>
def get_links(self, links_data):
"""知识图谱关系数据获取"""
<|body_2|>
def get_select_nodes(self, nodes_data):
"""获取知识图谱中... | stack_v2_sparse_classes_10k_train_003930 | 3,850 | permissive | [
{
"docstring": "初始化数据",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "与前端交互",
"name": "post",
"signature": "def post(self)"
},
{
"docstring": "知识图谱关系数据获取",
"name": "get_links",
"signature": "def get_links(self, links_data)"
},
{
"docstri... | 5 | null | Implement the Python class `Neo4jToJson` described below.
Class description:
知识图谱数据接口
Method signatures and docstrings:
- def __init__(self): 初始化数据
- def post(self): 与前端交互
- def get_links(self, links_data): 知识图谱关系数据获取
- def get_select_nodes(self, nodes_data): 获取知识图谱中所选择的节点数据
- def get_all_nodes(self, nodes_data): 获取知... | Implement the Python class `Neo4jToJson` described below.
Class description:
知识图谱数据接口
Method signatures and docstrings:
- def __init__(self): 初始化数据
- def post(self): 与前端交互
- def get_links(self, links_data): 知识图谱关系数据获取
- def get_select_nodes(self, nodes_data): 获取知识图谱中所选择的节点数据
- def get_all_nodes(self, nodes_data): 获取知... | be120ce2bb94a8e8395630218985f5e51ae087d9 | <|skeleton|>
class Neo4jToJson:
"""知识图谱数据接口"""
def __init__(self):
"""初始化数据"""
<|body_0|>
def post(self):
"""与前端交互"""
<|body_1|>
def get_links(self, links_data):
"""知识图谱关系数据获取"""
<|body_2|>
def get_select_nodes(self, nodes_data):
"""获取知识图谱中... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Neo4jToJson:
"""知识图谱数据接口"""
def __init__(self):
"""初始化数据"""
self.graph = Graph('http://IP//:7474', username='neo4j', password='xxxxx')
self.links = []
self.nodes = []
def post(self):
"""与前端交互"""
select_name = '南京审计大学'
nodes_data_all = self.grap... | the_stack_v2_python_sparse | KnowledgeMapping/spark/connNeo4j/read_neo4j.py | nickliqian/keep_learning | train | 8 |
119f5eea3ac45ebb4bf557b1d9a637a810a459c9 | [
"parameters = list(inspect.signature(udf).parameters.keys())\ninput_parameters = self._get_input_params(udf)\nif len(input_parameters) < 1:\n raise ValueError('feature_processor expects at least 1 input parameter.')\nnum_data_sources = len(fp_config.inputs)\nif len(input_parameters) != num_data_sources:\n rai... | <|body_start_0|>
parameters = list(inspect.signature(udf).parameters.keys())
input_parameters = self._get_input_params(udf)
if len(input_parameters) < 1:
raise ValueError('feature_processor expects at least 1 input parameter.')
num_data_sources = len(fp_config.inputs)
... | A validator for PySpark UDF signatures. | SparkUDFSignatureValidator | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SparkUDFSignatureValidator:
"""A validator for PySpark UDF signatures."""
def validate(self, udf: Callable[..., Any], fp_config: FeatureProcessorConfig) -> None:
"""Validate the signature of the UDF based on the configurations provided to the decorator. Args: udf (Callable[..., T]): ... | stack_v2_sparse_classes_10k_train_003931 | 7,056 | permissive | [
{
"docstring": "Validate the signature of the UDF based on the configurations provided to the decorator. Args: udf (Callable[..., T]): The feature_processor wrapped user function. fp_config (FeatureProcessorConfig): The configuration for the feature_processor. Raises (ValueError): raises ValueError when any of ... | 2 | stack_v2_sparse_classes_30k_train_000065 | Implement the Python class `SparkUDFSignatureValidator` described below.
Class description:
A validator for PySpark UDF signatures.
Method signatures and docstrings:
- def validate(self, udf: Callable[..., Any], fp_config: FeatureProcessorConfig) -> None: Validate the signature of the UDF based on the configurations ... | Implement the Python class `SparkUDFSignatureValidator` described below.
Class description:
A validator for PySpark UDF signatures.
Method signatures and docstrings:
- def validate(self, udf: Callable[..., Any], fp_config: FeatureProcessorConfig) -> None: Validate the signature of the UDF based on the configurations ... | 8d5d7fd8ae1a917ed3e2b988d5e533bce244fd85 | <|skeleton|>
class SparkUDFSignatureValidator:
"""A validator for PySpark UDF signatures."""
def validate(self, udf: Callable[..., Any], fp_config: FeatureProcessorConfig) -> None:
"""Validate the signature of the UDF based on the configurations provided to the decorator. Args: udf (Callable[..., T]): ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SparkUDFSignatureValidator:
"""A validator for PySpark UDF signatures."""
def validate(self, udf: Callable[..., Any], fp_config: FeatureProcessorConfig) -> None:
"""Validate the signature of the UDF based on the configurations provided to the decorator. Args: udf (Callable[..., T]): The feature_p... | the_stack_v2_python_sparse | src/sagemaker/feature_store/feature_processor/_validation.py | aws/sagemaker-python-sdk | train | 2,050 |
f87525aaeca11f5761675fd9838c7df9242938f3 | [
"f_count = len(filter_seq)\nevent_seq_tuple = itertools.tee(aevent_seq, f_count + 1)\nfor filter_desc, event_seq in zip(filter_seq, event_seq_tuple[1:]):\n offset = filter_desc.get('offset', 0)\n new_event_seq = filter_desc.get('filter').filter_objects(event_seq)\n for event in new_event_seq:\n filt... | <|body_start_0|>
f_count = len(filter_seq)
event_seq_tuple = itertools.tee(aevent_seq, f_count + 1)
for filter_desc, event_seq in zip(filter_seq, event_seq_tuple[1:]):
offset = filter_desc.get('offset', 0)
new_event_seq = filter_desc.get('filter').filter_objects(event_seq... | ... | BaseEventSelector | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseEventSelector:
"""..."""
def plot(self, aevent_seq, chart, filter_seq):
""":param aevent_seq: :param chart: :param filter_seq:"""
<|body_0|>
def filter_events(self, event_seq, **_):
"""Should be implemented :param event_seq: :param _: :return:"""
<|bo... | stack_v2_sparse_classes_10k_train_003932 | 2,158 | permissive | [
{
"docstring": ":param aevent_seq: :param chart: :param filter_seq:",
"name": "plot",
"signature": "def plot(self, aevent_seq, chart, filter_seq)"
},
{
"docstring": "Should be implemented :param event_seq: :param _: :return:",
"name": "filter_events",
"signature": "def filter_events(self... | 2 | stack_v2_sparse_classes_30k_train_000371 | Implement the Python class `BaseEventSelector` described below.
Class description:
...
Method signatures and docstrings:
- def plot(self, aevent_seq, chart, filter_seq): :param aevent_seq: :param chart: :param filter_seq:
- def filter_events(self, event_seq, **_): Should be implemented :param event_seq: :param _: :re... | Implement the Python class `BaseEventSelector` described below.
Class description:
...
Method signatures and docstrings:
- def plot(self, aevent_seq, chart, filter_seq): :param aevent_seq: :param chart: :param filter_seq:
- def filter_events(self, event_seq, **_): Should be implemented :param event_seq: :param _: :re... | 617ff45c9c3c96bbd9a975aef15f1b2697282b9c | <|skeleton|>
class BaseEventSelector:
"""..."""
def plot(self, aevent_seq, chart, filter_seq):
""":param aevent_seq: :param chart: :param filter_seq:"""
<|body_0|>
def filter_events(self, event_seq, **_):
"""Should be implemented :param event_seq: :param _: :return:"""
<|bo... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BaseEventSelector:
"""..."""
def plot(self, aevent_seq, chart, filter_seq):
""":param aevent_seq: :param chart: :param filter_seq:"""
f_count = len(filter_seq)
event_seq_tuple = itertools.tee(aevent_seq, f_count + 1)
for filter_desc, event_seq in zip(filter_seq, event_seq_... | the_stack_v2_python_sparse | shot_detector/selectors/event/base_event_selector.py | w495/python-video-shot-detector | train | 20 |
b024ce790f1a0c6ce1cc0e1f34202313fcedc8a0 | [
"super().__init__()\nself.graph, self.session = parse_tf_model_bytes(model_bytes, device, session_config)\nself.label_map = parse_dataset_metadata_bytes(metadata_bytes)\nself.input_image = self.graph.get_tensor_by_name('input')\nself.segmented_tensor = self.graph.get_tensor_by_name('output_prediction')",
"feed = ... | <|body_start_0|>
super().__init__()
self.graph, self.session = parse_tf_model_bytes(model_bytes, device, session_config)
self.label_map = parse_dataset_metadata_bytes(metadata_bytes)
self.input_image = self.graph.get_tensor_by_name('input')
self.segmented_tensor = self.graph.get_... | Loads a model and uses it to run image segmentation, meaning that it takes an image as input and returns a matrix the size of the input image where the value of each 'pixel' corresponds to an image segment type. Does not support batch prediction TODO: Is this true? | Segmenter | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Segmenter:
"""Loads a model and uses it to run image segmentation, meaning that it takes an image as input and returns a matrix the size of the input image where the value of each 'pixel' corresponds to an image segment type. Does not support batch prediction TODO: Is this true?"""
def __ini... | stack_v2_sparse_classes_10k_train_003933 | 2,521 | permissive | [
{
"docstring": ":param model_bytes: Model file data, likely a loaded *.pb file :param metadata_bytes: The dataset metadata file data, likely named \"dataset_metadata.json\" :param device: The device to run the model on :param session_config: Model configuration options",
"name": "__init__",
"signature":... | 2 | stack_v2_sparse_classes_30k_train_002652 | Implement the Python class `Segmenter` described below.
Class description:
Loads a model and uses it to run image segmentation, meaning that it takes an image as input and returns a matrix the size of the input image where the value of each 'pixel' corresponds to an image segment type. Does not support batch predictio... | Implement the Python class `Segmenter` described below.
Class description:
Loads a model and uses it to run image segmentation, meaning that it takes an image as input and returns a matrix the size of the input image where the value of each 'pixel' corresponds to an image segment type. Does not support batch predictio... | 7412902fed8f91c9c82bd42b0180e07673c38bf1 | <|skeleton|>
class Segmenter:
"""Loads a model and uses it to run image segmentation, meaning that it takes an image as input and returns a matrix the size of the input image where the value of each 'pixel' corresponds to an image segment type. Does not support batch prediction TODO: Is this true?"""
def __ini... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Segmenter:
"""Loads a model and uses it to run image segmentation, meaning that it takes an image as input and returns a matrix the size of the input image where the value of each 'pixel' corresponds to an image segment type. Does not support batch prediction TODO: Is this true?"""
def __init__(self, mod... | the_stack_v2_python_sparse | vcap_utils/vcap_utils/backends/segmentation.py | opencv/open_vision_capsules | train | 124 |
a8b23a9281af45585b521befb87576a4090b7b6c | [
"if not message:\n raise ValueError('Message can not be empty.')\nif not phone_number:\n raise ValueError('Phone number can not be empty.')\ntry:\n parsed_number = phonenumbers.parse(phone_number)\n parsed_number = phonenumbers.format_number(parsed_number, phonenumbers.PhoneNumberFormat.E164)\nexcept ph... | <|body_start_0|>
if not message:
raise ValueError('Message can not be empty.')
if not phone_number:
raise ValueError('Phone number can not be empty.')
try:
parsed_number = phonenumbers.parse(phone_number)
parsed_number = phonenumbers.format_number(... | Customers doesn't like to receive notifications in middle of the night, but almost all processing of the customer's data will be done at night. So this queue is used to collect users sms notifications and to sent them in acceptable time interval of the day. | SendQueue | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SendQueue:
"""Customers doesn't like to receive notifications in middle of the night, but almost all processing of the customer's data will be done at night. So this queue is used to collect users sms notifications and to sent them in acceptable time interval of the day."""
def enqueue(cls, ... | stack_v2_sparse_classes_10k_train_003934 | 1,997 | no_license | [
{
"docstring": "Adds message to the queue. :param message: body of the SMS. :param phone_number: number which should receive notification. :param date_queued: date when notification should be sent.",
"name": "enqueue",
"signature": "def enqueue(cls, message, phone_number, date_queued)"
},
{
"doc... | 2 | stack_v2_sparse_classes_30k_train_000979 | Implement the Python class `SendQueue` described below.
Class description:
Customers doesn't like to receive notifications in middle of the night, but almost all processing of the customer's data will be done at night. So this queue is used to collect users sms notifications and to sent them in acceptable time interva... | Implement the Python class `SendQueue` described below.
Class description:
Customers doesn't like to receive notifications in middle of the night, but almost all processing of the customer's data will be done at night. So this queue is used to collect users sms notifications and to sent them in acceptable time interva... | c060941b16c36d258989206f9c2143b5179b4acd | <|skeleton|>
class SendQueue:
"""Customers doesn't like to receive notifications in middle of the night, but almost all processing of the customer's data will be done at night. So this queue is used to collect users sms notifications and to sent them in acceptable time interval of the day."""
def enqueue(cls, ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SendQueue:
"""Customers doesn't like to receive notifications in middle of the night, but almost all processing of the customer's data will be done at night. So this queue is used to collect users sms notifications and to sent them in acceptable time interval of the day."""
def enqueue(cls, message, phon... | the_stack_v2_python_sparse | core/users/notifications/sms_dispatcher/models.py | HaySayCheese/mappino | train | 0 |
ce999115e2a20719a8a68a1b8221a9815fa4ff99 | [
"pairs = []\nfor i in range(len(nums1)):\n for j in range(len(nums2)):\n pairs.append([nums1[i], nums2[j]])\npairs.sort(key=lambda x: x[0] + x[1])\nres = pairs[:k]\nreturn res",
"if not nums1 or not nums2:\n return []\nn, res, cnt, heap = (len(nums2), [], 0, [(nums1[i] + nums2[0], i, 0) for i in rang... | <|body_start_0|>
pairs = []
for i in range(len(nums1)):
for j in range(len(nums2)):
pairs.append([nums1[i], nums2[j]])
pairs.sort(key=lambda x: x[0] + x[1])
res = pairs[:k]
return res
<|end_body_0|>
<|body_start_1|>
if not nums1 or not nums2:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def kSmallestPairs(self, nums1, nums2, k):
""":type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[List[int]]"""
<|body_0|>
def kSmallestPairs3(self, nums1, nums2, k):
""":type nums1: List[int] :type nums2: List[int] :type k: int :rtype: ... | stack_v2_sparse_classes_10k_train_003935 | 1,712 | no_license | [
{
"docstring": ":type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[List[int]]",
"name": "kSmallestPairs",
"signature": "def kSmallestPairs(self, nums1, nums2, k)"
},
{
"docstring": ":type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[List[int]]",
"nam... | 2 | stack_v2_sparse_classes_30k_val_000315 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def kSmallestPairs(self, nums1, nums2, k): :type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[List[int]]
- def kSmallestPairs3(self, nums1, nums2, k): :type ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def kSmallestPairs(self, nums1, nums2, k): :type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[List[int]]
- def kSmallestPairs3(self, nums1, nums2, k): :type ... | 0fc4c7af59246e3064db41989a45d9db413a624b | <|skeleton|>
class Solution:
def kSmallestPairs(self, nums1, nums2, k):
""":type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[List[int]]"""
<|body_0|>
def kSmallestPairs3(self, nums1, nums2, k):
""":type nums1: List[int] :type nums2: List[int] :type k: int :rtype: ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def kSmallestPairs(self, nums1, nums2, k):
""":type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[List[int]]"""
pairs = []
for i in range(len(nums1)):
for j in range(len(nums2)):
pairs.append([nums1[i], nums2[j]])
pairs.... | the_stack_v2_python_sparse | 373. Find K Pairs with Smallest Sums/kpairs.py | Macielyoung/LeetCode | train | 1 | |
acb197df35875cc73efc720d7e9664fd000c32c9 | [
"res = super(PayslipOverTime, self).get_inputs(contracts, date_to, date_from)\novertime_type = self.env.ref('ohrms_overtime.hr_salary_rule_overtime')\ncontract = self.contract_id\novertime_id_sub = self.env['hr.overtime.line'].search([('employee_id', '=', self.employee_id.id), ('overtime_id.state', '=', 'approve'),... | <|body_start_0|>
res = super(PayslipOverTime, self).get_inputs(contracts, date_to, date_from)
overtime_type = self.env.ref('ohrms_overtime.hr_salary_rule_overtime')
contract = self.contract_id
overtime_id_sub = self.env['hr.overtime.line'].search([('employee_id', '=', self.employee_id.id... | PayslipOverTime | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PayslipOverTime:
def get_inputs(self, contracts, date_from, date_to):
"""function used for writing overtime record in payslip input tree."""
<|body_0|>
def action_payslip_done(self):
"""function used for marking paid overtime request."""
<|body_1|>
<|end_ske... | stack_v2_sparse_classes_10k_train_003936 | 1,571 | no_license | [
{
"docstring": "function used for writing overtime record in payslip input tree.",
"name": "get_inputs",
"signature": "def get_inputs(self, contracts, date_from, date_to)"
},
{
"docstring": "function used for marking paid overtime request.",
"name": "action_payslip_done",
"signature": "d... | 2 | stack_v2_sparse_classes_30k_train_005880 | Implement the Python class `PayslipOverTime` described below.
Class description:
Implement the PayslipOverTime class.
Method signatures and docstrings:
- def get_inputs(self, contracts, date_from, date_to): function used for writing overtime record in payslip input tree.
- def action_payslip_done(self): function used... | Implement the Python class `PayslipOverTime` described below.
Class description:
Implement the PayslipOverTime class.
Method signatures and docstrings:
- def get_inputs(self, contracts, date_from, date_to): function used for writing overtime record in payslip input tree.
- def action_payslip_done(self): function used... | 4fe19ca76523cf274a3a85c8bcad653100ff556f | <|skeleton|>
class PayslipOverTime:
def get_inputs(self, contracts, date_from, date_to):
"""function used for writing overtime record in payslip input tree."""
<|body_0|>
def action_payslip_done(self):
"""function used for marking paid overtime request."""
<|body_1|>
<|end_ske... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PayslipOverTime:
def get_inputs(self, contracts, date_from, date_to):
"""function used for writing overtime record in payslip input tree."""
res = super(PayslipOverTime, self).get_inputs(contracts, date_to, date_from)
overtime_type = self.env.ref('ohrms_overtime.hr_salary_rule_overtime... | the_stack_v2_python_sparse | sub/community/ohrms_overtime/models/hr_payslip.py | ahmed-amine-ellouze/personal | train | 0 | |
473ebf02b088a30017df06bee6a95232ada766bf | [
"url = reverse('api_mdt')\nresponse = self.client.get(url, {'docrule_id': '10000'})\nself.assertEqual(response.status_code, 401)",
"url = reverse('api_mdt')\nresponse = self.client.get(url, {'docrule_id': '10000'})\nself.assertEqual(response.status_code, 401)",
"mdt = json.dumps(template)\nurl = reverse('api_md... | <|body_start_0|>
url = reverse('api_mdt')
response = self.client.get(url, {'docrule_id': '10000'})
self.assertEqual(response.status_code, 401)
<|end_body_0|>
<|body_start_1|>
url = reverse('api_mdt')
response = self.client.get(url, {'docrule_id': '10000'})
self.assertEqu... | MetadataTemplateExternalUser | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MetadataTemplateExternalUser:
def test_mdt_remove_not_logged_in(self):
"""Deleting all test MDT's (with docrule 10000). NOTE: Name of test should be in the end not to fail other tests..."""
<|body_0|>
def test_mdt_getting_not_logged_in(self):
"""Fetches Example MDT's... | stack_v2_sparse_classes_10k_train_003937 | 7,429 | permissive | [
{
"docstring": "Deleting all test MDT's (with docrule 10000). NOTE: Name of test should be in the end not to fail other tests...",
"name": "test_mdt_remove_not_logged_in",
"signature": "def test_mdt_remove_not_logged_in(self)"
},
{
"docstring": "Fetches Example MDT's from CouchDB through API Tes... | 3 | stack_v2_sparse_classes_30k_train_000543 | Implement the Python class `MetadataTemplateExternalUser` described below.
Class description:
Implement the MetadataTemplateExternalUser class.
Method signatures and docstrings:
- def test_mdt_remove_not_logged_in(self): Deleting all test MDT's (with docrule 10000). NOTE: Name of test should be in the end not to fail... | Implement the Python class `MetadataTemplateExternalUser` described below.
Class description:
Implement the MetadataTemplateExternalUser class.
Method signatures and docstrings:
- def test_mdt_remove_not_logged_in(self): Deleting all test MDT's (with docrule 10000). NOTE: Name of test should be in the end not to fail... | 96ce41b5699e2ea58e3ca560d46d481e954f17a4 | <|skeleton|>
class MetadataTemplateExternalUser:
def test_mdt_remove_not_logged_in(self):
"""Deleting all test MDT's (with docrule 10000). NOTE: Name of test should be in the end not to fail other tests..."""
<|body_0|>
def test_mdt_getting_not_logged_in(self):
"""Fetches Example MDT's... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MetadataTemplateExternalUser:
def test_mdt_remove_not_logged_in(self):
"""Deleting all test MDT's (with docrule 10000). NOTE: Name of test should be in the end not to fail other tests..."""
url = reverse('api_mdt')
response = self.client.get(url, {'docrule_id': '10000'})
self.a... | the_stack_v2_python_sparse | adlibre_dms/couchapps/mdtcouch/tests.py | adlibre/Adlibre-DMS | train | 59 | |
f13274bc7778bf414529c89b961352e3c9f15c75 | [
"query = models.InteractiveSession.query\nif 'pipeline_uuid' in request.args and 'project_uuid' in request.args:\n query = query.filter_by(pipeline_uuid=request.args.get('pipeline_uuid')).filter_by(project_uuid=request.args.get('project_uuid'))\nelif 'project_uuid' in request.args:\n query = query.filter_by(p... | <|body_start_0|>
query = models.InteractiveSession.query
if 'pipeline_uuid' in request.args and 'project_uuid' in request.args:
query = query.filter_by(pipeline_uuid=request.args.get('pipeline_uuid')).filter_by(project_uuid=request.args.get('project_uuid'))
elif 'project_uuid' in req... | SessionList | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SessionList:
def get(self):
"""Fetches all sessions."""
<|body_0|>
def post(self):
"""Launches an interactive session."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
query = models.InteractiveSession.query
if 'pipeline_uuid' in request.args... | stack_v2_sparse_classes_10k_train_003938 | 6,248 | permissive | [
{
"docstring": "Fetches all sessions.",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "Launches an interactive session.",
"name": "post",
"signature": "def post(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004845 | Implement the Python class `SessionList` described below.
Class description:
Implement the SessionList class.
Method signatures and docstrings:
- def get(self): Fetches all sessions.
- def post(self): Launches an interactive session. | Implement the Python class `SessionList` described below.
Class description:
Implement the SessionList class.
Method signatures and docstrings:
- def get(self): Fetches all sessions.
- def post(self): Launches an interactive session.
<|skeleton|>
class SessionList:
def get(self):
"""Fetches all sessions... | 0d78bf21e6da84754bd8ba8ebe4ff0d6631a92f9 | <|skeleton|>
class SessionList:
def get(self):
"""Fetches all sessions."""
<|body_0|>
def post(self):
"""Launches an interactive session."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SessionList:
def get(self):
"""Fetches all sessions."""
query = models.InteractiveSession.query
if 'pipeline_uuid' in request.args and 'project_uuid' in request.args:
query = query.filter_by(pipeline_uuid=request.args.get('pipeline_uuid')).filter_by(project_uuid=request.arg... | the_stack_v2_python_sparse | data/codefile/orchest@orchest__6b629d0__services$orchest-api$app$app$apis$namespace_sessions.py.target.py | ualberta-smr/PyMigBench | train | 1 | |
5c6d1ecab9c2806da2262d58ed9ffa15499e9708 | [
"super().__init__()\nself.args = quant_arc_interface.args\nself.q_params = nn.Parameter(self.args.q_delta * torch.randn(self.args.q_depth * quant_arc_interface.second_qubits))\nself.qai = quant_arc_interface",
"q_in = torch.tanh(input_features) * np.pi / 2.0\nq_in = q_in.to(self.args.device)\nq_out = torch.Tensor... | <|body_start_0|>
super().__init__()
self.args = quant_arc_interface.args
self.q_params = nn.Parameter(self.args.q_delta * torch.randn(self.args.q_depth * quant_arc_interface.second_qubits))
self.qai = quant_arc_interface
<|end_body_0|>
<|body_start_1|>
q_in = torch.tanh(input_fe... | Torch module implementing the *dressed* quantum net. | QNet_2 | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QNet_2:
"""Torch module implementing the *dressed* quantum net."""
def __init__(self, quant_arc_interface):
"""Definition of the *dressed* layout."""
<|body_0|>
def forward(self, input_features):
"""Defining how tensors are supposed to move through the *dressed* ... | stack_v2_sparse_classes_10k_train_003939 | 2,951 | permissive | [
{
"docstring": "Definition of the *dressed* layout.",
"name": "__init__",
"signature": "def __init__(self, quant_arc_interface)"
},
{
"docstring": "Defining how tensors are supposed to move through the *dressed* quantum net.",
"name": "forward",
"signature": "def forward(self, input_feat... | 2 | stack_v2_sparse_classes_30k_train_006816 | Implement the Python class `QNet_2` described below.
Class description:
Torch module implementing the *dressed* quantum net.
Method signatures and docstrings:
- def __init__(self, quant_arc_interface): Definition of the *dressed* layout.
- def forward(self, input_features): Defining how tensors are supposed to move t... | Implement the Python class `QNet_2` described below.
Class description:
Torch module implementing the *dressed* quantum net.
Method signatures and docstrings:
- def __init__(self, quant_arc_interface): Definition of the *dressed* layout.
- def forward(self, input_features): Defining how tensors are supposed to move t... | 8126691b43bddc2b1a96f73ab35d04d1af200d7a | <|skeleton|>
class QNet_2:
"""Torch module implementing the *dressed* quantum net."""
def __init__(self, quant_arc_interface):
"""Definition of the *dressed* layout."""
<|body_0|>
def forward(self, input_features):
"""Defining how tensors are supposed to move through the *dressed* ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class QNet_2:
"""Torch module implementing the *dressed* quantum net."""
def __init__(self, quant_arc_interface):
"""Definition of the *dressed* layout."""
super().__init__()
self.args = quant_arc_interface.args
self.q_params = nn.Parameter(self.args.q_delta * torch.randn(self.a... | the_stack_v2_python_sparse | model/dvqc_layers.py | zzh237/quanthmc | train | 0 |
bd46ffc6d823f2679cfefcdf03638ff274353b2c | [
"start = 0\nend = len(arr) - 1\nwhile end >= start:\n mid = (start + end) // 2\n if arr[mid] < value:\n start = mid + 1\n elif arr[mid] > value:\n end = mid - 1\n else:\n return mid\nreturn -1",
"left = self.binarySearch(arr, value)\nif left == -1:\n return -1\nelse:\n i = l... | <|body_start_0|>
start = 0
end = len(arr) - 1
while end >= start:
mid = (start + end) // 2
if arr[mid] < value:
start = mid + 1
elif arr[mid] > value:
end = mid - 1
else:
return mid
return -1
... | SolutionSearchRange | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SolutionSearchRange:
def binarySearch(self, arr, value):
"""Returns the index position of the target element if found Returns -1 if target is not in array"""
<|body_0|>
def leftIndex(self, arr, value):
"""Returns the index(left) of the first occurence of the element"... | stack_v2_sparse_classes_10k_train_003940 | 2,036 | no_license | [
{
"docstring": "Returns the index position of the target element if found Returns -1 if target is not in array",
"name": "binarySearch",
"signature": "def binarySearch(self, arr, value)"
},
{
"docstring": "Returns the index(left) of the first occurence of the element",
"name": "leftIndex",
... | 4 | stack_v2_sparse_classes_30k_train_001665 | Implement the Python class `SolutionSearchRange` described below.
Class description:
Implement the SolutionSearchRange class.
Method signatures and docstrings:
- def binarySearch(self, arr, value): Returns the index position of the target element if found Returns -1 if target is not in array
- def leftIndex(self, arr... | Implement the Python class `SolutionSearchRange` described below.
Class description:
Implement the SolutionSearchRange class.
Method signatures and docstrings:
- def binarySearch(self, arr, value): Returns the index position of the target element if found Returns -1 if target is not in array
- def leftIndex(self, arr... | f7c7fcf27751f740c232a87b234d6a74e5ac30bb | <|skeleton|>
class SolutionSearchRange:
def binarySearch(self, arr, value):
"""Returns the index position of the target element if found Returns -1 if target is not in array"""
<|body_0|>
def leftIndex(self, arr, value):
"""Returns the index(left) of the first occurence of the element"... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SolutionSearchRange:
def binarySearch(self, arr, value):
"""Returns the index position of the target element if found Returns -1 if target is not in array"""
start = 0
end = len(arr) - 1
while end >= start:
mid = (start + end) // 2
if arr[mid] < value:
... | the_stack_v2_python_sparse | Algorithms Python/searchRange.py | wittywatz/Algorithms | train | 0 | |
bb71e87b760f753c42a94c827740976d42b9be58 | [
"if not numRows:\n return []\noutput = [[1]]\nfor i in range(1, numRows):\n row = []\n for j in range(i + 1):\n if j == 0:\n row.append(output[i - 1][0])\n elif j == i:\n row.append(output[i - 1][-1])\n else:\n row.append(output[i - 1][j - 1] + output[i... | <|body_start_0|>
if not numRows:
return []
output = [[1]]
for i in range(1, numRows):
row = []
for j in range(i + 1):
if j == 0:
row.append(output[i - 1][0])
elif j == i:
row.append(output... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def generate(self, numRows):
""":type numRows: int :rtype: List[List[int]]"""
<|body_0|>
def generate_terse(self, numRows):
""":type numRows: int :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not numRows:
... | stack_v2_sparse_classes_10k_train_003941 | 1,574 | no_license | [
{
"docstring": ":type numRows: int :rtype: List[List[int]]",
"name": "generate",
"signature": "def generate(self, numRows)"
},
{
"docstring": ":type numRows: int :rtype: List[List[int]]",
"name": "generate_terse",
"signature": "def generate_terse(self, numRows)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005823 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def generate(self, numRows): :type numRows: int :rtype: List[List[int]]
- def generate_terse(self, numRows): :type numRows: int :rtype: List[List[int]] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def generate(self, numRows): :type numRows: int :rtype: List[List[int]]
- def generate_terse(self, numRows): :type numRows: int :rtype: List[List[int]]
<|skeleton|>
class Soluti... | e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59 | <|skeleton|>
class Solution:
def generate(self, numRows):
""":type numRows: int :rtype: List[List[int]]"""
<|body_0|>
def generate_terse(self, numRows):
""":type numRows: int :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def generate(self, numRows):
""":type numRows: int :rtype: List[List[int]]"""
if not numRows:
return []
output = [[1]]
for i in range(1, numRows):
row = []
for j in range(i + 1):
if j == 0:
row.ap... | the_stack_v2_python_sparse | src/lt_118.py | oxhead/CodingYourWay | train | 0 | |
c17c6eb7b26c320fa772c98cfe42b53e8fb9f776 | [
"super(Attention, self).__init__()\nself.encoder_att = nn.Linear(encoder_dim, attention_dim)\nself.decoder_att = nn.Linear(decoder_dim, attention_dim)\nself.full_att = nn.Linear(attention_dim, 1)\nself.relu = nn.ReLU()\nself.softmax = nn.Softmax(dim=1)",
"att1 = self.encoder_att(encoder_out)\natt2 = self.decoder_... | <|body_start_0|>
super(Attention, self).__init__()
self.encoder_att = nn.Linear(encoder_dim, attention_dim)
self.decoder_att = nn.Linear(decoder_dim, attention_dim)
self.full_att = nn.Linear(attention_dim, 1)
self.relu = nn.ReLU()
self.softmax = nn.Softmax(dim=1)
<|end_bo... | Attention Network. | Attention | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Attention:
"""Attention Network."""
def __init__(self, encoder_dim, decoder_dim, attention_dim):
""":param encoder_dim: feature size of encoded images :param decoder_dim: size of decoder's RNN :param attention_dim: size of the attention network"""
<|body_0|>
def forward(... | stack_v2_sparse_classes_10k_train_003942 | 11,050 | permissive | [
{
"docstring": ":param encoder_dim: feature size of encoded images :param decoder_dim: size of decoder's RNN :param attention_dim: size of the attention network",
"name": "__init__",
"signature": "def __init__(self, encoder_dim, decoder_dim, attention_dim)"
},
{
"docstring": "Forward propagation... | 2 | stack_v2_sparse_classes_30k_train_002839 | Implement the Python class `Attention` described below.
Class description:
Attention Network.
Method signatures and docstrings:
- def __init__(self, encoder_dim, decoder_dim, attention_dim): :param encoder_dim: feature size of encoded images :param decoder_dim: size of decoder's RNN :param attention_dim: size of the ... | Implement the Python class `Attention` described below.
Class description:
Attention Network.
Method signatures and docstrings:
- def __init__(self, encoder_dim, decoder_dim, attention_dim): :param encoder_dim: feature size of encoded images :param decoder_dim: size of decoder's RNN :param attention_dim: size of the ... | 8ee91f56cba66f8d66d47f995ea74ff192956cb7 | <|skeleton|>
class Attention:
"""Attention Network."""
def __init__(self, encoder_dim, decoder_dim, attention_dim):
""":param encoder_dim: feature size of encoded images :param decoder_dim: size of decoder's RNN :param attention_dim: size of the attention network"""
<|body_0|>
def forward(... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Attention:
"""Attention Network."""
def __init__(self, encoder_dim, decoder_dim, attention_dim):
""":param encoder_dim: feature size of encoded images :param decoder_dim: size of decoder's RNN :param attention_dim: size of the attention network"""
super(Attention, self).__init__()
... | the_stack_v2_python_sparse | gan/models/ocr/densenet.py | TIBHannover/formula_gan | train | 14 |
3f960fe2a344613289f1446834292f255a190827 | [
"if specprod_dir is None:\n specprod_dir = specprod_root()\nself.specprod_dir = specprod_dir\nQA_MultiExp.__init__(self, specprod_dir=specprod_dir, **kwargs)\nnights = get_nights(specprod_dir=self.specprod_dir)\nfor night in nights:\n self.mexp_dict[night] = {}\n for exposure in get_exposures(night, specpr... | <|body_start_0|>
if specprod_dir is None:
specprod_dir = specprod_root()
self.specprod_dir = specprod_dir
QA_MultiExp.__init__(self, specprod_dir=specprod_dir, **kwargs)
nights = get_nights(specprod_dir=self.specprod_dir)
for night in nights:
self.mexp_dic... | QA_Prod | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QA_Prod:
def __init__(self, specprod_dir=None, **kwargs):
"""Class to organize and execute QA for a DESI production Args: specprod_dir(str): Path containing the exposures/ directory to use. If the value is None, then the value of :func:`specprod_root` is used instead. Notes: Attributes: ... | stack_v2_sparse_classes_10k_train_003943 | 4,122 | permissive | [
{
"docstring": "Class to organize and execute QA for a DESI production Args: specprod_dir(str): Path containing the exposures/ directory to use. If the value is None, then the value of :func:`specprod_root` is used instead. Notes: Attributes: qa_exps : list List of QA_Exposure classes, one per exposure in produ... | 4 | stack_v2_sparse_classes_30k_train_004767 | Implement the Python class `QA_Prod` described below.
Class description:
Implement the QA_Prod class.
Method signatures and docstrings:
- def __init__(self, specprod_dir=None, **kwargs): Class to organize and execute QA for a DESI production Args: specprod_dir(str): Path containing the exposures/ directory to use. If... | Implement the Python class `QA_Prod` described below.
Class description:
Implement the QA_Prod class.
Method signatures and docstrings:
- def __init__(self, specprod_dir=None, **kwargs): Class to organize and execute QA for a DESI production Args: specprod_dir(str): Path containing the exposures/ directory to use. If... | d75d0540cd07df1bf46130338a33c2ced51fbead | <|skeleton|>
class QA_Prod:
def __init__(self, specprod_dir=None, **kwargs):
"""Class to organize and execute QA for a DESI production Args: specprod_dir(str): Path containing the exposures/ directory to use. If the value is None, then the value of :func:`specprod_root` is used instead. Notes: Attributes: ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class QA_Prod:
def __init__(self, specprod_dir=None, **kwargs):
"""Class to organize and execute QA for a DESI production Args: specprod_dir(str): Path containing the exposures/ directory to use. If the value is None, then the value of :func:`specprod_root` is used instead. Notes: Attributes: qa_exps : list... | the_stack_v2_python_sparse | py/desispec/qa/qa_prod.py | desihub/desispec | train | 33 | |
6c0da7cc92518ad56850358757ac147348052b6a | [
"self.pause_backup = pause_backup\nself.protected_source_uid = protected_source_uid\nself.rpo_policy_id = rpo_policy_id\nself.source_parameters = source_parameters",
"if dictionary is None:\n return None\npause_backup = dictionary.get('pauseBackup')\nprotected_source_uid = cohesity_management_sdk.models.univer... | <|body_start_0|>
self.pause_backup = pause_backup
self.protected_source_uid = protected_source_uid
self.rpo_policy_id = rpo_policy_id
self.source_parameters = source_parameters
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
pause_backup = ... | Implementation of the 'UpdateProtectionObjectParameters' model. Specifies the parameters to update a Protection Object. Attributes: pause_backup (bool): Specifies if the protection for the Protection Object is to be paused. protected_source_uid (UniversalId, required): Specifies the unique id of the Protected Source to... | UpdateProtectionObjectParameters | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UpdateProtectionObjectParameters:
"""Implementation of the 'UpdateProtectionObjectParameters' model. Specifies the parameters to update a Protection Object. Attributes: pause_backup (bool): Specifies if the protection for the Protection Object is to be paused. protected_source_uid (UniversalId, r... | stack_v2_sparse_classes_10k_train_003944 | 3,048 | permissive | [
{
"docstring": "Constructor for the UpdateProtectionObjectParameters class",
"name": "__init__",
"signature": "def __init__(self, pause_backup=None, protected_source_uid=None, rpo_policy_id=None, source_parameters=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args... | 2 | null | Implement the Python class `UpdateProtectionObjectParameters` described below.
Class description:
Implementation of the 'UpdateProtectionObjectParameters' model. Specifies the parameters to update a Protection Object. Attributes: pause_backup (bool): Specifies if the protection for the Protection Object is to be pause... | Implement the Python class `UpdateProtectionObjectParameters` described below.
Class description:
Implementation of the 'UpdateProtectionObjectParameters' model. Specifies the parameters to update a Protection Object. Attributes: pause_backup (bool): Specifies if the protection for the Protection Object is to be pause... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class UpdateProtectionObjectParameters:
"""Implementation of the 'UpdateProtectionObjectParameters' model. Specifies the parameters to update a Protection Object. Attributes: pause_backup (bool): Specifies if the protection for the Protection Object is to be paused. protected_source_uid (UniversalId, r... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class UpdateProtectionObjectParameters:
"""Implementation of the 'UpdateProtectionObjectParameters' model. Specifies the parameters to update a Protection Object. Attributes: pause_backup (bool): Specifies if the protection for the Protection Object is to be paused. protected_source_uid (UniversalId, required): Spe... | the_stack_v2_python_sparse | cohesity_management_sdk/models/update_protection_object_parameters.py | cohesity/management-sdk-python | train | 24 |
6fdcdc1ff81c0c895250a396ba3aa74a5059abae | [
"self.name = name\nself.ip = ip\nself.mac = mac",
"if dictionary is None:\n return None\nip = dictionary.get('ip')\nmac = dictionary.get('mac')\nname = dictionary.get('name')\nreturn cls(ip, mac, name)"
] | <|body_start_0|>
self.name = name
self.ip = ip
self.mac = mac
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
ip = dictionary.get('ip')
mac = dictionary.get('mac')
name = dictionary.get('name')
return cls(ip, mac, name)
<|en... | Implementation of the 'FixedIpAssignment' model. TODO: type model description here. Attributes: name (string): A descriptive name of the assignment ip (string): The IP address you want to assign to a specific server or device mac (string): The MAC address of the server or device that hosts the internal resource that yo... | FixedIpAssignmentModel | [
"MIT",
"Python-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FixedIpAssignmentModel:
"""Implementation of the 'FixedIpAssignment' model. TODO: type model description here. Attributes: name (string): A descriptive name of the assignment ip (string): The IP address you want to assign to a specific server or device mac (string): The MAC address of the server ... | stack_v2_sparse_classes_10k_train_003945 | 1,946 | permissive | [
{
"docstring": "Constructor for the FixedIpAssignmentModel class",
"name": "__init__",
"signature": "def __init__(self, ip=None, mac=None, name=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation of the object a... | 2 | null | Implement the Python class `FixedIpAssignmentModel` described below.
Class description:
Implementation of the 'FixedIpAssignment' model. TODO: type model description here. Attributes: name (string): A descriptive name of the assignment ip (string): The IP address you want to assign to a specific server or device mac (... | Implement the Python class `FixedIpAssignmentModel` described below.
Class description:
Implementation of the 'FixedIpAssignment' model. TODO: type model description here. Attributes: name (string): A descriptive name of the assignment ip (string): The IP address you want to assign to a specific server or device mac (... | 9894089eb013318243ae48869cc5130eb37f80c0 | <|skeleton|>
class FixedIpAssignmentModel:
"""Implementation of the 'FixedIpAssignment' model. TODO: type model description here. Attributes: name (string): A descriptive name of the assignment ip (string): The IP address you want to assign to a specific server or device mac (string): The MAC address of the server ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FixedIpAssignmentModel:
"""Implementation of the 'FixedIpAssignment' model. TODO: type model description here. Attributes: name (string): A descriptive name of the assignment ip (string): The IP address you want to assign to a specific server or device mac (string): The MAC address of the server or device tha... | the_stack_v2_python_sparse | meraki_sdk/models/fixed_ip_assignment_model.py | RaulCatalano/meraki-python-sdk | train | 1 |
99fab39e856b6fabb354cf7329d606cb571f2d42 | [
"cases = ('string', 1.5)\nfor b in cases:\n with self.subTest(x=b):\n self.assertRaises(TypeError, factorize, b)",
"cases = (-1, -10, -100)\nfor b in cases:\n with self.subTest(x=b):\n self.assertRaises(ValueError, factorize, b)",
"cases = ((0, (0,)), (1, (1,)))\nfor b, a in cases:\n with... | <|body_start_0|>
cases = ('string', 1.5)
for b in cases:
with self.subTest(x=b):
self.assertRaises(TypeError, factorize, b)
<|end_body_0|>
<|body_start_1|>
cases = (-1, -10, -100)
for b in cases:
with self.subTest(x=b):
self.assert... | TestFactorize | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestFactorize:
def test_wrong_types_raise_exception(self):
"""типы float и str (значения 'string', 1.5) вызывают исключение TypeError"""
<|body_0|>
def test_negative(self):
"""для отрицательных чисел -1, -10 и -100 вызывается исключение ValueError"""
<|body_1... | stack_v2_sparse_classes_10k_train_003946 | 2,337 | no_license | [
{
"docstring": "типы float и str (значения 'string', 1.5) вызывают исключение TypeError",
"name": "test_wrong_types_raise_exception",
"signature": "def test_wrong_types_raise_exception(self)"
},
{
"docstring": "для отрицательных чисел -1, -10 и -100 вызывается исключение ValueError",
"name":... | 6 | stack_v2_sparse_classes_30k_train_000340 | Implement the Python class `TestFactorize` described below.
Class description:
Implement the TestFactorize class.
Method signatures and docstrings:
- def test_wrong_types_raise_exception(self): типы float и str (значения 'string', 1.5) вызывают исключение TypeError
- def test_negative(self): для отрицательных чисел -... | Implement the Python class `TestFactorize` described below.
Class description:
Implement the TestFactorize class.
Method signatures and docstrings:
- def test_wrong_types_raise_exception(self): типы float и str (значения 'string', 1.5) вызывают исключение TypeError
- def test_negative(self): для отрицательных чисел -... | 0ead3cf3f2fd7ec9a0234092a951328b98da899f | <|skeleton|>
class TestFactorize:
def test_wrong_types_raise_exception(self):
"""типы float и str (значения 'string', 1.5) вызывают исключение TypeError"""
<|body_0|>
def test_negative(self):
"""для отрицательных чисел -1, -10 и -100 вызывается исключение ValueError"""
<|body_1... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestFactorize:
def test_wrong_types_raise_exception(self):
"""типы float и str (значения 'string', 1.5) вызывают исключение TypeError"""
cases = ('string', 1.5)
for b in cases:
with self.subTest(x=b):
self.assertRaises(TypeError, factorize, b)
def test_... | the_stack_v2_python_sparse | course2/week1/test_factorize.py | shereshevskiy/coursera_python_specialization | train | 2 | |
d3f216b51814d2fe337175ea3686b86e4daa4dcd | [
"expected_topic = 'Web Server'\nexpected_message = 'Web Server (server1.example.com) is DOWN (Host Is Unreachable).'\nself.check_webhook('uptimerobot_monitor_down', expected_topic, expected_message)",
"expected_topic = 'Mail Server'\nexpected_message = '\\nMail Server (server2.example.com) is back UP (Host Is Rea... | <|body_start_0|>
expected_topic = 'Web Server'
expected_message = 'Web Server (server1.example.com) is DOWN (Host Is Unreachable).'
self.check_webhook('uptimerobot_monitor_down', expected_topic, expected_message)
<|end_body_0|>
<|body_start_1|>
expected_topic = 'Mail Server'
exp... | UptimeRobotHookTests | [
"Apache-2.0",
"LicenseRef-scancode-free-unknown"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UptimeRobotHookTests:
def test_uptimerobot_monitor_down(self) -> None:
"""Tests if uptimerobot monitor down is handled correctly"""
<|body_0|>
def test_uptimerobot_monitor_up(self) -> None:
"""Tests if uptimerobot monitor up is handled correctly"""
<|body_1|>... | stack_v2_sparse_classes_10k_train_003947 | 1,971 | permissive | [
{
"docstring": "Tests if uptimerobot monitor down is handled correctly",
"name": "test_uptimerobot_monitor_down",
"signature": "def test_uptimerobot_monitor_down(self) -> None"
},
{
"docstring": "Tests if uptimerobot monitor up is handled correctly",
"name": "test_uptimerobot_monitor_up",
... | 3 | stack_v2_sparse_classes_30k_val_000332 | Implement the Python class `UptimeRobotHookTests` described below.
Class description:
Implement the UptimeRobotHookTests class.
Method signatures and docstrings:
- def test_uptimerobot_monitor_down(self) -> None: Tests if uptimerobot monitor down is handled correctly
- def test_uptimerobot_monitor_up(self) -> None: T... | Implement the Python class `UptimeRobotHookTests` described below.
Class description:
Implement the UptimeRobotHookTests class.
Method signatures and docstrings:
- def test_uptimerobot_monitor_down(self) -> None: Tests if uptimerobot monitor down is handled correctly
- def test_uptimerobot_monitor_up(self) -> None: T... | 965a25d91b6ee2db54038f5df855215fa25146b0 | <|skeleton|>
class UptimeRobotHookTests:
def test_uptimerobot_monitor_down(self) -> None:
"""Tests if uptimerobot monitor down is handled correctly"""
<|body_0|>
def test_uptimerobot_monitor_up(self) -> None:
"""Tests if uptimerobot monitor up is handled correctly"""
<|body_1|>... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class UptimeRobotHookTests:
def test_uptimerobot_monitor_down(self) -> None:
"""Tests if uptimerobot monitor down is handled correctly"""
expected_topic = 'Web Server'
expected_message = 'Web Server (server1.example.com) is DOWN (Host Is Unreachable).'
self.check_webhook('uptimerobot... | the_stack_v2_python_sparse | zerver/webhooks/uptimerobot/tests.py | zulip/zulip | train | 20,239 | |
742da9a67f06192b7f0716ea788b6498591a8de7 | [
"B = A[::-1]\nfor i in range(1, len(A)):\n A[i] *= A[i - 1] or 1\n B[i] *= B[i - 1] or 1\nreturn max(A + B)",
"dp = [None] * len(nums)\ndp[0] = nums[0]\nfor i in range(1, len(nums)):\n dp[i] = max(dp[i - 1] + nums[i], nums[i])\nprint(dp)\nreturn max(dp)",
"dp = nums.copy()\nfor i in range(2, len(nums))... | <|body_start_0|>
B = A[::-1]
for i in range(1, len(A)):
A[i] *= A[i - 1] or 1
B[i] *= B[i - 1] or 1
return max(A + B)
<|end_body_0|>
<|body_start_1|>
dp = [None] * len(nums)
dp[0] = nums[0]
for i in range(1, len(nums)):
dp[i] = max(dp[... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxProduct(self, A):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def maxSubArray(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
def rob(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_2|>
... | stack_v2_sparse_classes_10k_train_003948 | 1,014 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "maxProduct",
"signature": "def maxProduct(self, A)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "maxSubArray",
"signature": "def maxSubArray(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtyp... | 3 | stack_v2_sparse_classes_30k_train_002028 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProduct(self, A): :type nums: List[int] :rtype: int
- def maxSubArray(self, nums): :type nums: List[int] :rtype: int
- def rob(self, nums): :type nums: List[int] :rtype: i... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProduct(self, A): :type nums: List[int] :rtype: int
- def maxSubArray(self, nums): :type nums: List[int] :rtype: int
- def rob(self, nums): :type nums: List[int] :rtype: i... | 7bcba42556475f56fad995b97a37b98f4981da8c | <|skeleton|>
class Solution:
def maxProduct(self, A):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def maxSubArray(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
def rob(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_2|>
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def maxProduct(self, A):
""":type nums: List[int] :rtype: int"""
B = A[::-1]
for i in range(1, len(A)):
A[i] *= A[i - 1] or 1
B[i] *= B[i - 1] or 1
return max(A + B)
def maxSubArray(self, nums):
""":type nums: List[int] :rtype: int... | the_stack_v2_python_sparse | Problems/152. Maximum Product Subarray.py | chendingyan/My-Leetcode | train | 0 | |
ef8ffcb70fec1be02ec0bf8fec73184c44584a30 | [
"if n == 0:\n return []\nreturn self.dfs(1, n)",
"ans = []\nif begin > end:\n ans.append(None)\n return ans\nif begin == end:\n t = TreeNode(begin)\n ans.append(t)\n return ans\nif begin + 1 == end:\n t1 = TreeNode(begin)\n t1.right = TreeNode(end)\n ans.append(t1)\n t2 = TreeNode(en... | <|body_start_0|>
if n == 0:
return []
return self.dfs(1, n)
<|end_body_0|>
<|body_start_1|>
ans = []
if begin > end:
ans.append(None)
return ans
if begin == end:
t = TreeNode(begin)
ans.append(t)
return ans
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def generateTrees(self, n):
""":type n: int :rtype: List[TreeNode]"""
<|body_0|>
def dfs(self, begin, end):
"""从begin到end,生成BST :param begin:int :param end: int :return: List[TreeNode]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if n =... | stack_v2_sparse_classes_10k_train_003949 | 1,392 | no_license | [
{
"docstring": ":type n: int :rtype: List[TreeNode]",
"name": "generateTrees",
"signature": "def generateTrees(self, n)"
},
{
"docstring": "从begin到end,生成BST :param begin:int :param end: int :return: List[TreeNode]",
"name": "dfs",
"signature": "def dfs(self, begin, end)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006061 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def generateTrees(self, n): :type n: int :rtype: List[TreeNode]
- def dfs(self, begin, end): 从begin到end,生成BST :param begin:int :param end: int :return: List[TreeNode] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def generateTrees(self, n): :type n: int :rtype: List[TreeNode]
- def dfs(self, begin, end): 从begin到end,生成BST :param begin:int :param end: int :return: List[TreeNode]
<|skeleton... | 96adb6c04c344e792e35dc70dc45eb76b5402008 | <|skeleton|>
class Solution:
def generateTrees(self, n):
""":type n: int :rtype: List[TreeNode]"""
<|body_0|>
def dfs(self, begin, end):
"""从begin到end,生成BST :param begin:int :param end: int :return: List[TreeNode]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def generateTrees(self, n):
""":type n: int :rtype: List[TreeNode]"""
if n == 0:
return []
return self.dfs(1, n)
def dfs(self, begin, end):
"""从begin到end,生成BST :param begin:int :param end: int :return: List[TreeNode]"""
ans = []
if beg... | the_stack_v2_python_sparse | JiQiang/leetcode_py/tree/UniqueBinarySearchTrees96.py | Hearen/AlgorithmHackers | train | 10 | |
c4de9cfe75f7fe7582a91c2661746e12d8d3a967 | [
"c = Counter()\nfor ch in s:\n c[ch] = c[ch] + 1\na = sorted(c.items(), key=lambda item: item[1], reverse=True)\nindex_dict = {k[0]: i for i, k in enumerate(a)}\nB_ordered = sorted(s, key=lambda x: index_dict[x])\nreturn ''.join(B_ordered)",
"count = dict()\nresult = ''\nsort = dict()\nfor c in s:\n if c no... | <|body_start_0|>
c = Counter()
for ch in s:
c[ch] = c[ch] + 1
a = sorted(c.items(), key=lambda item: item[1], reverse=True)
index_dict = {k[0]: i for i, k in enumerate(a)}
B_ordered = sorted(s, key=lambda x: index_dict[x])
return ''.join(B_ordered)
<|end_body_... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def frequencySort(self, s):
""":type s: str :rtype: str 175ms"""
<|body_0|>
def frequencySort_1(self, s):
""":type s: str :rtype: str 62ms"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
c = Counter()
for ch in s:
c[ch]... | stack_v2_sparse_classes_10k_train_003950 | 2,079 | no_license | [
{
"docstring": ":type s: str :rtype: str 175ms",
"name": "frequencySort",
"signature": "def frequencySort(self, s)"
},
{
"docstring": ":type s: str :rtype: str 62ms",
"name": "frequencySort_1",
"signature": "def frequencySort_1(self, s)"
}
] | 2 | stack_v2_sparse_classes_30k_test_000140 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def frequencySort(self, s): :type s: str :rtype: str 175ms
- def frequencySort_1(self, s): :type s: str :rtype: str 62ms | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def frequencySort(self, s): :type s: str :rtype: str 175ms
- def frequencySort_1(self, s): :type s: str :rtype: str 62ms
<|skeleton|>
class Solution:
def frequencySort(self... | 679a2b246b8b6bb7fc55ed1c8096d3047d6d4461 | <|skeleton|>
class Solution:
def frequencySort(self, s):
""":type s: str :rtype: str 175ms"""
<|body_0|>
def frequencySort_1(self, s):
""":type s: str :rtype: str 62ms"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def frequencySort(self, s):
""":type s: str :rtype: str 175ms"""
c = Counter()
for ch in s:
c[ch] = c[ch] + 1
a = sorted(c.items(), key=lambda item: item[1], reverse=True)
index_dict = {k[0]: i for i, k in enumerate(a)}
B_ordered = sorted(s... | the_stack_v2_python_sparse | SortCharactersByFrequency_MID_451.py | 953250587/leetcode-python | train | 2 | |
b8b2d0cbe5efbb5ed9f8fc3a2ddfc55a96237ce1 | [
"LOG.info(f'{self.stats_api.binary} --database {self.stats_api.db_uri}add --machine X -u Unaligned {flow_cell_path.as_posix()}')\nif self.dry_run:\n LOG.info('Dry run will not add flow cell stats')\n return\ncgstats_add_parameters = ['--database', self.stats_api.db_uri, 'add', '--machine', 'X', '-u', 'Unalign... | <|body_start_0|>
LOG.info(f'{self.stats_api.binary} --database {self.stats_api.db_uri}add --machine X -u Unaligned {flow_cell_path.as_posix()}')
if self.dry_run:
LOG.info('Dry run will not add flow cell stats')
return
cgstats_add_parameters = ['--database', self.stats_api... | Post demultiplexing API class for Hiseq X flow cell. | DemuxPostProcessingHiseqXAPI | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DemuxPostProcessingHiseqXAPI:
"""Post demultiplexing API class for Hiseq X flow cell."""
def add_to_cgstats(self, flow_cell_path: Path) -> None:
"""Add flow cell to cgstats."""
<|body_0|>
def cgstats_select_project(self, flow_cell_id: str, flow_cell_path: Path) -> None:
... | stack_v2_sparse_classes_10k_train_003951 | 20,731 | no_license | [
{
"docstring": "Add flow cell to cgstats.",
"name": "add_to_cgstats",
"signature": "def add_to_cgstats(self, flow_cell_path: Path) -> None"
},
{
"docstring": "Process selected project using cgstats.",
"name": "cgstats_select_project",
"signature": "def cgstats_select_project(self, flow_c... | 6 | stack_v2_sparse_classes_30k_train_003364 | Implement the Python class `DemuxPostProcessingHiseqXAPI` described below.
Class description:
Post demultiplexing API class for Hiseq X flow cell.
Method signatures and docstrings:
- def add_to_cgstats(self, flow_cell_path: Path) -> None: Add flow cell to cgstats.
- def cgstats_select_project(self, flow_cell_id: str,... | Implement the Python class `DemuxPostProcessingHiseqXAPI` described below.
Class description:
Post demultiplexing API class for Hiseq X flow cell.
Method signatures and docstrings:
- def add_to_cgstats(self, flow_cell_path: Path) -> None: Add flow cell to cgstats.
- def cgstats_select_project(self, flow_cell_id: str,... | d2ec6d25b577dd6938bbf92317aeff1d6b3c5b08 | <|skeleton|>
class DemuxPostProcessingHiseqXAPI:
"""Post demultiplexing API class for Hiseq X flow cell."""
def add_to_cgstats(self, flow_cell_path: Path) -> None:
"""Add flow cell to cgstats."""
<|body_0|>
def cgstats_select_project(self, flow_cell_id: str, flow_cell_path: Path) -> None:
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DemuxPostProcessingHiseqXAPI:
"""Post demultiplexing API class for Hiseq X flow cell."""
def add_to_cgstats(self, flow_cell_path: Path) -> None:
"""Add flow cell to cgstats."""
LOG.info(f'{self.stats_api.binary} --database {self.stats_api.db_uri}add --machine X -u Unaligned {flow_cell_pat... | the_stack_v2_python_sparse | cg/meta/demultiplex/demux_post_processing.py | Clinical-Genomics/cg | train | 19 |
9bcfc6ff45a499fa854aea7edd01b64ad718e20b | [
"super(ListLaunchConfigTest, cls).setUpClass()\ncls.lc_disk_config = 'AUTO'\ncls.lc_personality = [{'path': '/root/.ssh/authorized_keys', 'contents': 'DQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBp'}]\ncls.lc_metadata = {'lc_meta_key_1': 'lc_meta_value_1', 'lc_meta_key_2': 'lc_meta_value_2'}\ncls.lc_networks = [{'uuid': ... | <|body_start_0|>
super(ListLaunchConfigTest, cls).setUpClass()
cls.lc_disk_config = 'AUTO'
cls.lc_personality = [{'path': '/root/.ssh/authorized_keys', 'contents': 'DQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBp'}]
cls.lc_metadata = {'lc_meta_key_1': 'lc_meta_value_1', 'lc_meta_key_2': 'lc_met... | Verify launch config. | ListLaunchConfigTest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ListLaunchConfigTest:
"""Verify launch config."""
def setUpClass(cls):
"""Creates a scaling group."""
<|body_0|>
def test_list_launch_config_response(self):
"""Verify the list config call for response code, headers and data."""
<|body_1|>
<|end_skeleton|... | stack_v2_sparse_classes_10k_train_003952 | 4,090 | permissive | [
{
"docstring": "Creates a scaling group.",
"name": "setUpClass",
"signature": "def setUpClass(cls)"
},
{
"docstring": "Verify the list config call for response code, headers and data.",
"name": "test_list_launch_config_response",
"signature": "def test_list_launch_config_response(self)"
... | 2 | stack_v2_sparse_classes_30k_train_005173 | Implement the Python class `ListLaunchConfigTest` described below.
Class description:
Verify launch config.
Method signatures and docstrings:
- def setUpClass(cls): Creates a scaling group.
- def test_list_launch_config_response(self): Verify the list config call for response code, headers and data. | Implement the Python class `ListLaunchConfigTest` described below.
Class description:
Verify launch config.
Method signatures and docstrings:
- def setUpClass(cls): Creates a scaling group.
- def test_list_launch_config_response(self): Verify the list config call for response code, headers and data.
<|skeleton|>
cla... | 7199cdd67255fe116dbcbedea660c13453671134 | <|skeleton|>
class ListLaunchConfigTest:
"""Verify launch config."""
def setUpClass(cls):
"""Creates a scaling group."""
<|body_0|>
def test_list_launch_config_response(self):
"""Verify the list config call for response code, headers and data."""
<|body_1|>
<|end_skeleton|... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ListLaunchConfigTest:
"""Verify launch config."""
def setUpClass(cls):
"""Creates a scaling group."""
super(ListLaunchConfigTest, cls).setUpClass()
cls.lc_disk_config = 'AUTO'
cls.lc_personality = [{'path': '/root/.ssh/authorized_keys', 'contents': 'DQoiQSBjbG91ZCBkb2VzIG5... | the_stack_v2_python_sparse | autoscale_cloudroast/test_repo/autoscale/functional/launch_config/test_list_launch_config.py | rackerlabs/otter | train | 20 |
17d15c857e00a1805908ba740de6a4464bab3be4 | [
"count = 0\nprev_cum_sums = {0: 1}\ncum_sum = 0\nfor num in nums:\n cum_sum = (cum_sum + num % k + k) % k\n count += prev_cum_sums.get(cum_sum, 0)\n prev_cum_sums[cum_sum] = prev_cum_sums.get(cum_sum, 0) + 1\nreturn count",
"count = 0\nprev_cum_sums = [1] + [0] * (k - 1)\ncum_sum = 0\nfor num in nums:\n ... | <|body_start_0|>
count = 0
prev_cum_sums = {0: 1}
cum_sum = 0
for num in nums:
cum_sum = (cum_sum + num % k + k) % k
count += prev_cum_sums.get(cum_sum, 0)
prev_cum_sums[cum_sum] = prev_cum_sums.get(cum_sum, 0) + 1
return count
<|end_body_0|>
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def subarraysDivByK(self, nums: List[int], k: int) -> int:
"""Similar to sub-array sums equal to K, but with modulo. The principle: - Move through the array, keeping a cumulative sum modulo K from the start - Additionally, at each step: - Store the cumulative sum modulo K in an... | stack_v2_sparse_classes_10k_train_003953 | 2,530 | no_license | [
{
"docstring": "Similar to sub-array sums equal to K, but with modulo. The principle: - Move through the array, keeping a cumulative sum modulo K from the start - Additionally, at each step: - Store the cumulative sum modulo K in an hash-map - Look for the complement of the cumulative sum modulo K in the hash-m... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def subarraysDivByK(self, nums: List[int], k: int) -> int: Similar to sub-array sums equal to K, but with modulo. The principle: - Move through the array, keeping a cumulative su... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def subarraysDivByK(self, nums: List[int], k: int) -> int: Similar to sub-array sums equal to K, but with modulo. The principle: - Move through the array, keeping a cumulative su... | 3ffcfee5cedf421d5de6d0dec4ba53b0eecbbff8 | <|skeleton|>
class Solution:
def subarraysDivByK(self, nums: List[int], k: int) -> int:
"""Similar to sub-array sums equal to K, but with modulo. The principle: - Move through the array, keeping a cumulative sum modulo K from the start - Additionally, at each step: - Store the cumulative sum modulo K in an... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def subarraysDivByK(self, nums: List[int], k: int) -> int:
"""Similar to sub-array sums equal to K, but with modulo. The principle: - Move through the array, keeping a cumulative sum modulo K from the start - Additionally, at each step: - Store the cumulative sum modulo K in an hash-map - Lo... | the_stack_v2_python_sparse | arrays/SubArraySumDivisibleByK.py | QuentinDuval/PythonExperiments | train | 3 | |
2cfa9d4c3428b074a35633f6ec0091d10e29f8a9 | [
"self.freqList = []\nself.maxPrecent = maxPercentage\nself.minPrecent = minPercentage\nself.bandwidth = bandwidth\nself.windowSize = windowSize\nfor i in range(int(windowSize)):\n self.freqList.append([])",
"print('Listening for RabbitMQ messages')\nconnection = pika.BlockingConnection(pika.ConnectionParameter... | <|body_start_0|>
self.freqList = []
self.maxPrecent = maxPercentage
self.minPrecent = minPercentage
self.bandwidth = bandwidth
self.windowSize = windowSize
for i in range(int(windowSize)):
self.freqList.append([])
<|end_body_0|>
<|body_start_1|>
print... | Detector | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Detector:
def __init__(self, windowSize, maxPercentage, minPercentage, bandwidth):
"""Simple init method Args: windowSize (int): How many cycles to look through maxPercentage (float): min precentage needed to be considered a digital signal minPercentage ([type]): max precentage needed to... | stack_v2_sparse_classes_10k_train_003954 | 6,020 | no_license | [
{
"docstring": "Simple init method Args: windowSize (int): How many cycles to look through maxPercentage (float): min precentage needed to be considered a digital signal minPercentage ([type]): max precentage needed to be considered a digital signal bandwidth (int): How close do detects need to be in MHz to mer... | 5 | stack_v2_sparse_classes_30k_train_004972 | Implement the Python class `Detector` described below.
Class description:
Implement the Detector class.
Method signatures and docstrings:
- def __init__(self, windowSize, maxPercentage, minPercentage, bandwidth): Simple init method Args: windowSize (int): How many cycles to look through maxPercentage (float): min pre... | Implement the Python class `Detector` described below.
Class description:
Implement the Detector class.
Method signatures and docstrings:
- def __init__(self, windowSize, maxPercentage, minPercentage, bandwidth): Simple init method Args: windowSize (int): How many cycles to look through maxPercentage (float): min pre... | 30d4783e1102a6ff1de7ee14862ee40426e099ba | <|skeleton|>
class Detector:
def __init__(self, windowSize, maxPercentage, minPercentage, bandwidth):
"""Simple init method Args: windowSize (int): How many cycles to look through maxPercentage (float): min precentage needed to be considered a digital signal minPercentage ([type]): max precentage needed to... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Detector:
def __init__(self, windowSize, maxPercentage, minPercentage, bandwidth):
"""Simple init method Args: windowSize (int): How many cycles to look through maxPercentage (float): min precentage needed to be considered a digital signal minPercentage ([type]): max precentage needed to be considered... | the_stack_v2_python_sparse | dev/digitalDetector/digitalDetector.py | ANARCYPHER/porglet | train | 0 | |
7c9075be0612ac805de36f0c5bef5cb542047334 | [
"self.trie = Trie()\nfor w, wo in enumerate(words):\n wo += '#'\n for i in range(len(wo)):\n cur = self.trie\n cur[WEIGHT] = w\n for j in range(i, 2 * len(wo) - 1):\n cur = cur[wo[j % len(wo)]]\n cur[WEIGHT] = w",
"cur = self.trie\nfor le in suffix + '#' + prefix:\... | <|body_start_0|>
self.trie = Trie()
for w, wo in enumerate(words):
wo += '#'
for i in range(len(wo)):
cur = self.trie
cur[WEIGHT] = w
for j in range(i, 2 * len(wo) - 1):
cur = cur[wo[j % len(wo)]]
... | WordFilter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WordFilter:
def __init__(self, words):
""":type words: List[str]"""
<|body_0|>
def f(self, prefix, suffix):
""":type prefix: str :type suffix: str :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.trie = Trie()
for w, wo in en... | stack_v2_sparse_classes_10k_train_003955 | 962 | no_license | [
{
"docstring": ":type words: List[str]",
"name": "__init__",
"signature": "def __init__(self, words)"
},
{
"docstring": ":type prefix: str :type suffix: str :rtype: int",
"name": "f",
"signature": "def f(self, prefix, suffix)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001963 | Implement the Python class `WordFilter` described below.
Class description:
Implement the WordFilter class.
Method signatures and docstrings:
- def __init__(self, words): :type words: List[str]
- def f(self, prefix, suffix): :type prefix: str :type suffix: str :rtype: int | Implement the Python class `WordFilter` described below.
Class description:
Implement the WordFilter class.
Method signatures and docstrings:
- def __init__(self, words): :type words: List[str]
- def f(self, prefix, suffix): :type prefix: str :type suffix: str :rtype: int
<|skeleton|>
class WordFilter:
def __in... | 20623defecf65cbc35b194d8b60d8b211816ee4f | <|skeleton|>
class WordFilter:
def __init__(self, words):
""":type words: List[str]"""
<|body_0|>
def f(self, prefix, suffix):
""":type prefix: str :type suffix: str :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class WordFilter:
def __init__(self, words):
""":type words: List[str]"""
self.trie = Trie()
for w, wo in enumerate(words):
wo += '#'
for i in range(len(wo)):
cur = self.trie
cur[WEIGHT] = w
for j in range(i, 2 * len(wo)... | the_stack_v2_python_sparse | in_Python_v2/0745 Prefix and Suffix Search.py | YangLiyli131/Leetcode2020 | train | 0 | |
36738bced1a1d1114b719a334c33dd3e8ff5a1d0 | [
"with patch('customer_db_schema.Customers.get_or_create') as handle_get:\n handle_get.return_value = [MockCustomer]\n customer = Customers().get_or_create('test')[0]\n self.assertEqual(customer.customer_id, '123')\n self.assertEqual(customer.first_name, 'Amelia')\n self.assertEqual(customer.last_name... | <|body_start_0|>
with patch('customer_db_schema.Customers.get_or_create') as handle_get:
handle_get.return_value = [MockCustomer]
customer = Customers().get_or_create('test')[0]
self.assertEqual(customer.customer_id, '123')
self.assertEqual(customer.first_name, 'A... | Tests the Customer DB Schema | TestCustomerDBSchema | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestCustomerDBSchema:
"""Tests the Customer DB Schema"""
def test_customer_schema_fields(self):
"""Validates the fileds in the customer schema"""
<|body_0|>
def test_customer_schema_save(self):
"""Validates saving the customer schema"""
<|body_1|>
de... | stack_v2_sparse_classes_10k_train_003956 | 19,162 | no_license | [
{
"docstring": "Validates the fileds in the customer schema",
"name": "test_customer_schema_fields",
"signature": "def test_customer_schema_fields(self)"
},
{
"docstring": "Validates saving the customer schema",
"name": "test_customer_schema_save",
"signature": "def test_customer_schema_... | 4 | null | Implement the Python class `TestCustomerDBSchema` described below.
Class description:
Tests the Customer DB Schema
Method signatures and docstrings:
- def test_customer_schema_fields(self): Validates the fileds in the customer schema
- def test_customer_schema_save(self): Validates saving the customer schema
- def te... | Implement the Python class `TestCustomerDBSchema` described below.
Class description:
Tests the Customer DB Schema
Method signatures and docstrings:
- def test_customer_schema_fields(self): Validates the fileds in the customer schema
- def test_customer_schema_save(self): Validates saving the customer schema
- def te... | 5dac60f39e3909ff05b26721d602ed20f14d6be3 | <|skeleton|>
class TestCustomerDBSchema:
"""Tests the Customer DB Schema"""
def test_customer_schema_fields(self):
"""Validates the fileds in the customer schema"""
<|body_0|>
def test_customer_schema_save(self):
"""Validates saving the customer schema"""
<|body_1|>
de... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestCustomerDBSchema:
"""Tests the Customer DB Schema"""
def test_customer_schema_fields(self):
"""Validates the fileds in the customer schema"""
with patch('customer_db_schema.Customers.get_or_create') as handle_get:
handle_get.return_value = [MockCustomer]
custom... | the_stack_v2_python_sparse | students/anthony_mckeever/lesson_3/assignment_1/test_unit.py | JavaRod/SP_Python220B_2019 | train | 1 |
1a1f93f5eaf5336fd21f3d4f0efe3789cab1eed0 | [
"super().__init__(data, files, auto_id, prefix, initial, error_class, label_suffix, empty_permitted, instance, use_required_attribute, renderer)\nif instance is not None:\n self.fields['IsAHJOfficialOf'].initial = AHJUserMaintains.objects.filter(UserID=instance, MaintainerStatus=True).values_list('AHJPK', flat=T... | <|body_start_0|>
super().__init__(data, files, auto_id, prefix, initial, error_class, label_suffix, empty_permitted, instance, use_required_attribute, renderer)
if instance is not None:
self.fields['IsAHJOfficialOf'].initial = AHJUserMaintains.objects.filter(UserID=instance, MaintainerStatus... | Django User model admin change form with the 'IsAHJOfficialOf' field added. | UserChangeForm | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserChangeForm:
"""Django User model admin change form with the 'IsAHJOfficialOf' field added."""
def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None,... | stack_v2_sparse_classes_10k_train_003957 | 5,760 | permissive | [
{
"docstring": "Overridden to populate the 'IsAHJOfficialOf' field values.",
"name": "__init__",
"signature": "def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None... | 2 | stack_v2_sparse_classes_30k_train_002175 | Implement the Python class `UserChangeForm` described below.
Class description:
Django User model admin change form with the 'IsAHJOfficialOf' field added.
Method signatures and docstrings:
- def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList, label_suffix=None... | Implement the Python class `UserChangeForm` described below.
Class description:
Django User model admin change form with the 'IsAHJOfficialOf' field added.
Method signatures and docstrings:
- def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList, label_suffix=None... | d4498bccfe114b19acca4f931d29f30fbc65a803 | <|skeleton|>
class UserChangeForm:
"""Django User model admin change form with the 'IsAHJOfficialOf' field added."""
def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None,... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class UserChangeForm:
"""Django User model admin change form with the 'IsAHJOfficialOf' field added."""
def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=Non... | the_stack_v2_python_sparse | server/ahj_app/admin/form.py | reepoi/ahj-registry | train | 0 |
fa6949e1b87fd23c469e0ab92f31e23fc0f6bf43 | [
"layer_db = LayerDatabase(model)\nuse_cuda = False\npruner = SpatialSvdPruner()\ncost_calculator = SpatialSvdCostCalculator()\ncomp_ratio_rounding_algo = RankRounder(params.multiplicity, cost_calculator)\nif params.mode == SpatialSvdParameters.Mode.auto:\n greedy_params = params.mode_params.greedy_params\n co... | <|body_start_0|>
layer_db = LayerDatabase(model)
use_cuda = False
pruner = SpatialSvdPruner()
cost_calculator = SpatialSvdCostCalculator()
comp_ratio_rounding_algo = RankRounder(params.multiplicity, cost_calculator)
if params.mode == SpatialSvdParameters.Mode.auto:
... | Factory to construct various aimet model compression classes based on a scheme | CompressionFactory | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CompressionFactory:
"""Factory to construct various aimet model compression classes based on a scheme"""
def create_spatial_svd_algo(cls, model: tf.keras.Model, eval_callback: EvalFunction, eval_iterations: int, cost_metric: CostMetric, params: SpatialSvdParameters, bokeh_session: BokehServe... | stack_v2_sparse_classes_10k_train_003958 | 7,032 | permissive | [
{
"docstring": "Factory method to construct SpatialSvdCompressionAlgo :param model: Keras model to compress :param eval_callback: Evaluation callback for the model :param eval_iterations: Evaluation iterations :param cost_metric: Cost metric (mac or memory) :param params: Spatial SVD compression parameters :par... | 2 | null | Implement the Python class `CompressionFactory` described below.
Class description:
Factory to construct various aimet model compression classes based on a scheme
Method signatures and docstrings:
- def create_spatial_svd_algo(cls, model: tf.keras.Model, eval_callback: EvalFunction, eval_iterations: int, cost_metric:... | Implement the Python class `CompressionFactory` described below.
Class description:
Factory to construct various aimet model compression classes based on a scheme
Method signatures and docstrings:
- def create_spatial_svd_algo(cls, model: tf.keras.Model, eval_callback: EvalFunction, eval_iterations: int, cost_metric:... | 5a406e657082b6a4f6e4bf48f0e46e085cb1e351 | <|skeleton|>
class CompressionFactory:
"""Factory to construct various aimet model compression classes based on a scheme"""
def create_spatial_svd_algo(cls, model: tf.keras.Model, eval_callback: EvalFunction, eval_iterations: int, cost_metric: CostMetric, params: SpatialSvdParameters, bokeh_session: BokehServe... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CompressionFactory:
"""Factory to construct various aimet model compression classes based on a scheme"""
def create_spatial_svd_algo(cls, model: tf.keras.Model, eval_callback: EvalFunction, eval_iterations: int, cost_metric: CostMetric, params: SpatialSvdParameters, bokeh_session: BokehServerSession=None... | the_stack_v2_python_sparse | TrainingExtensions/tensorflow/src/python/aimet_tensorflow/keras/compression_factory.py | quic/aimet | train | 1,676 |
4bc4453d2fe97b44145676ea5811d538a6d710a2 | [
"if not value:\n return None\nreturn value.isoformat()",
"if not value:\n return None\nreturn parse(value)"
] | <|body_start_0|>
if not value:
return None
return value.isoformat()
<|end_body_0|>
<|body_start_1|>
if not value:
return None
return parse(value)
<|end_body_1|>
| FuzzyDate | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FuzzyDate:
def _serialize(self, value, attr, obj):
"""Convert a Python object into an outside-world object"""
<|body_0|>
def _deserialize(self, value, attr, obj):
"""Convert a outside-world value into a Python object"""
<|body_1|>
<|end_skeleton|>
<|body_st... | stack_v2_sparse_classes_10k_train_003959 | 2,881 | permissive | [
{
"docstring": "Convert a Python object into an outside-world object",
"name": "_serialize",
"signature": "def _serialize(self, value, attr, obj)"
},
{
"docstring": "Convert a outside-world value into a Python object",
"name": "_deserialize",
"signature": "def _deserialize(self, value, a... | 2 | stack_v2_sparse_classes_30k_train_000137 | Implement the Python class `FuzzyDate` described below.
Class description:
Implement the FuzzyDate class.
Method signatures and docstrings:
- def _serialize(self, value, attr, obj): Convert a Python object into an outside-world object
- def _deserialize(self, value, attr, obj): Convert a outside-world value into a Py... | Implement the Python class `FuzzyDate` described below.
Class description:
Implement the FuzzyDate class.
Method signatures and docstrings:
- def _serialize(self, value, attr, obj): Convert a Python object into an outside-world object
- def _deserialize(self, value, attr, obj): Convert a outside-world value into a Py... | 87c211fa6cf9708bdf3fc4b736f3cca450c0a290 | <|skeleton|>
class FuzzyDate:
def _serialize(self, value, attr, obj):
"""Convert a Python object into an outside-world object"""
<|body_0|>
def _deserialize(self, value, attr, obj):
"""Convert a outside-world value into a Python object"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FuzzyDate:
def _serialize(self, value, attr, obj):
"""Convert a Python object into an outside-world object"""
if not value:
return None
return value.isoformat()
def _deserialize(self, value, attr, obj):
"""Convert a outside-world value into a Python object"""
... | the_stack_v2_python_sparse | powonline/schema.py | exhuma/powonline | train | 0 | |
c32d095a167e07f80dab1d517246515fb238d896 | [
"action = self.request.get('action')\nif action == 'save_plan':\n self.createEditPlan(None)\nif action == 'edit_plan':\n self.createEditPlan(self.request.get('k'))\nif action == 'delete_plan':\n self.deletePlan(self.request.get('k'))\nif action == 'check_code':\n self.checkCode(self.request.get('k'), se... | <|body_start_0|>
action = self.request.get('action')
if action == 'save_plan':
self.createEditPlan(None)
if action == 'edit_plan':
self.createEditPlan(self.request.get('k'))
if action == 'delete_plan':
self.deletePlan(self.request.get('k'))
if ... | Controller | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Controller:
def post(self):
"""Handles POST requests"""
<|body_0|>
def createEditPlan(self, plan_key):
"""Calls the function to save the plan into the datastore and responses the Ajax request. @param plan_key: it refers to the Plan that is going to be edited. If 'Non... | stack_v2_sparse_classes_10k_train_003960 | 5,552 | no_license | [
{
"docstring": "Handles POST requests",
"name": "post",
"signature": "def post(self)"
},
{
"docstring": "Calls the function to save the plan into the datastore and responses the Ajax request. @param plan_key: it refers to the Plan that is going to be edited. If 'None', a new Plan will be created... | 6 | stack_v2_sparse_classes_30k_train_002065 | Implement the Python class `Controller` described below.
Class description:
Implement the Controller class.
Method signatures and docstrings:
- def post(self): Handles POST requests
- def createEditPlan(self, plan_key): Calls the function to save the plan into the datastore and responses the Ajax request. @param plan... | Implement the Python class `Controller` described below.
Class description:
Implement the Controller class.
Method signatures and docstrings:
- def post(self): Handles POST requests
- def createEditPlan(self, plan_key): Calls the function to save the plan into the datastore and responses the Ajax request. @param plan... | 95cc24e41590853cf0d2d35e6bf2ba1bd0701d48 | <|skeleton|>
class Controller:
def post(self):
"""Handles POST requests"""
<|body_0|>
def createEditPlan(self, plan_key):
"""Calls the function to save the plan into the datastore and responses the Ajax request. @param plan_key: it refers to the Plan that is going to be edited. If 'Non... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Controller:
def post(self):
"""Handles POST requests"""
action = self.request.get('action')
if action == 'save_plan':
self.createEditPlan(None)
if action == 'edit_plan':
self.createEditPlan(self.request.get('k'))
if action == 'delete_plan':
... | the_stack_v2_python_sparse | python/src/plan.py | cjlallana/gae-course-application | train | 0 | |
2e68e8dd9650c809d53efe221558e256f49dafbb | [
"minStack = []\nnum3 = -INF\nfor num1 in reversed(nums):\n if num1 < num3:\n return True\n while minStack and minStack[-1] < num1:\n num3 = minStack.pop()\n minStack.append(num1)\nreturn False",
"n = len(nums)\nleftMin = INF\nright = SortedList(nums)\nfor i2 in range(n):\n leftMin = min(... | <|body_start_0|>
minStack = []
num3 = -INF
for num1 in reversed(nums):
if num1 < num3:
return True
while minStack and minStack[-1] < num1:
num3 = minStack.pop()
minStack.append(num1)
return False
<|end_body_0|>
<|body_s... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def find132pattern1(self, nums: List[int]) -> bool:
"""枚举1 单调栈O(n) !从后往前遍历,维护一个单减的栈 可以找到一对(j,k)使得nums[j]>nums[k] 记录这个被pop出的nums[k] 如果之后遇到一个元素比nums[k]小 那么就找到了132模式"""
<|body_0|>
def find132pattern3(self, nums: List[int]) -> bool:
"""枚举3(中间的数) O(nlogn) 对1:维护左... | stack_v2_sparse_classes_10k_train_003961 | 1,743 | no_license | [
{
"docstring": "枚举1 单调栈O(n) !从后往前遍历,维护一个单减的栈 可以找到一对(j,k)使得nums[j]>nums[k] 记录这个被pop出的nums[k] 如果之后遇到一个元素比nums[k]小 那么就找到了132模式",
"name": "find132pattern1",
"signature": "def find132pattern1(self, nums: List[int]) -> bool"
},
{
"docstring": "枚举3(中间的数) O(nlogn) 对1:维护左侧最小值 对2:维护右侧有序集合,找到第一个比左侧最小值大的数,检... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def find132pattern1(self, nums: List[int]) -> bool: 枚举1 单调栈O(n) !从后往前遍历,维护一个单减的栈 可以找到一对(j,k)使得nums[j]>nums[k] 记录这个被pop出的nums[k] 如果之后遇到一个元素比nums[k]小 那么就找到了132模式
- def find132patte... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def find132pattern1(self, nums: List[int]) -> bool: 枚举1 单调栈O(n) !从后往前遍历,维护一个单减的栈 可以找到一对(j,k)使得nums[j]>nums[k] 记录这个被pop出的nums[k] 如果之后遇到一个元素比nums[k]小 那么就找到了132模式
- def find132patte... | 7e79e26bb8f641868561b186e34c1127ed63c9e0 | <|skeleton|>
class Solution:
def find132pattern1(self, nums: List[int]) -> bool:
"""枚举1 单调栈O(n) !从后往前遍历,维护一个单减的栈 可以找到一对(j,k)使得nums[j]>nums[k] 记录这个被pop出的nums[k] 如果之后遇到一个元素比nums[k]小 那么就找到了132模式"""
<|body_0|>
def find132pattern3(self, nums: List[int]) -> bool:
"""枚举3(中间的数) O(nlogn) 对1:维护左... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def find132pattern1(self, nums: List[int]) -> bool:
"""枚举1 单调栈O(n) !从后往前遍历,维护一个单减的栈 可以找到一对(j,k)使得nums[j]>nums[k] 记录这个被pop出的nums[k] 如果之后遇到一个元素比nums[k]小 那么就找到了132模式"""
minStack = []
num3 = -INF
for num1 in reversed(nums):
if num1 < num3:
retu... | the_stack_v2_python_sparse | 1_stack/单调栈/倒序遍历/456. 132 模式.py | 981377660LMT/algorithm-study | train | 225 | |
e591eff69ae2a6836363b9eff0d7df0042d08128 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')"
] | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | Proto file describing the Ad Parameter service. Service to manage ad parameters. | AdParameterServiceServicer | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AdParameterServiceServicer:
"""Proto file describing the Ad Parameter service. Service to manage ad parameters."""
def GetAdParameter(self, request, context):
"""Returns the requested ad parameter in full detail."""
<|body_0|>
def MutateAdParameters(self, request, contex... | stack_v2_sparse_classes_10k_train_003962 | 3,370 | permissive | [
{
"docstring": "Returns the requested ad parameter in full detail.",
"name": "GetAdParameter",
"signature": "def GetAdParameter(self, request, context)"
},
{
"docstring": "Creates, updates, or removes ad parameters. Operation statuses are returned.",
"name": "MutateAdParameters",
"signat... | 2 | stack_v2_sparse_classes_30k_train_003004 | Implement the Python class `AdParameterServiceServicer` described below.
Class description:
Proto file describing the Ad Parameter service. Service to manage ad parameters.
Method signatures and docstrings:
- def GetAdParameter(self, request, context): Returns the requested ad parameter in full detail.
- def MutateAd... | Implement the Python class `AdParameterServiceServicer` described below.
Class description:
Proto file describing the Ad Parameter service. Service to manage ad parameters.
Method signatures and docstrings:
- def GetAdParameter(self, request, context): Returns the requested ad parameter in full detail.
- def MutateAd... | 0fc8a7dbf31d9e8e2a4364df93bec5f6b7edd50a | <|skeleton|>
class AdParameterServiceServicer:
"""Proto file describing the Ad Parameter service. Service to manage ad parameters."""
def GetAdParameter(self, request, context):
"""Returns the requested ad parameter in full detail."""
<|body_0|>
def MutateAdParameters(self, request, contex... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AdParameterServiceServicer:
"""Proto file describing the Ad Parameter service. Service to manage ad parameters."""
def GetAdParameter(self, request, context):
"""Returns the requested ad parameter in full detail."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_detai... | the_stack_v2_python_sparse | google/ads/google_ads/v2/proto/services/ad_parameter_service_pb2_grpc.py | juanmacugat/google-ads-python | train | 1 |
1104711a6ca608c8abb473799a3b9b50f368ba11 | [
"self.data = dict()\nself.total = 0\nself.rand = random.Random()",
"if val in self.data:\n return False\nself.data[val] = None\nself.total += 1\nreturn True",
"if val in self.data:\n self.data.pop(val)\n self.total -= 1\n return True\nreturn False",
"datas = list(self.data.keys())\npos = self.rand... | <|body_start_0|>
self.data = dict()
self.total = 0
self.rand = random.Random()
<|end_body_0|>
<|body_start_1|>
if val in self.data:
return False
self.data[val] = None
self.total += 1
return True
<|end_body_1|>
<|body_start_2|>
if val in self.... | RandomizedSet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandomizedSet:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def insert(self, val: int) -> bool:
"""Inserts a value to the set. Returns true if the set did not already contain the specified element."""
<|body_1|>
def remove(se... | stack_v2_sparse_classes_10k_train_003963 | 1,584 | no_license | [
{
"docstring": "Initialize your data structure here.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Inserts a value to the set. Returns true if the set did not already contain the specified element.",
"name": "insert",
"signature": "def insert(self, val: int) ... | 4 | stack_v2_sparse_classes_30k_train_006884 | Implement the Python class `RandomizedSet` described below.
Class description:
Implement the RandomizedSet class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def insert(self, val: int) -> bool: Inserts a value to the set. Returns true if the set did not already conta... | Implement the Python class `RandomizedSet` described below.
Class description:
Implement the RandomizedSet class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def insert(self, val: int) -> bool: Inserts a value to the set. Returns true if the set did not already conta... | 976090d52c77fc95ed7eb2eae3c60abc2a7f7106 | <|skeleton|>
class RandomizedSet:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def insert(self, val: int) -> bool:
"""Inserts a value to the set. Returns true if the set did not already contain the specified element."""
<|body_1|>
def remove(se... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RandomizedSet:
def __init__(self):
"""Initialize your data structure here."""
self.data = dict()
self.total = 0
self.rand = random.Random()
def insert(self, val: int) -> bool:
"""Inserts a value to the set. Returns true if the set did not already contain the specif... | the_stack_v2_python_sparse | src/desgin/RandomizedSet.py | fanwucoder/leecode | train | 0 | |
9dd439a6460486272b6c8148cee620a926b5507a | [
"for i in xrange(1, len(nums)):\n if i % 2 == 0 and nums[i] > nums[i - 1] or (i % 2 == 1 and nums[i] < nums[i - 1]):\n nums[i], nums[i - 1] = (nums[i - 1], nums[i])",
"nums.sort()\nfor i in xrange((len(nums) - 1) / 2):\n nums[2 * i + 1], nums[2 * i + 2] = (nums[2 * i + 2], nums[2 * i + 1])"
] | <|body_start_0|>
for i in xrange(1, len(nums)):
if i % 2 == 0 and nums[i] > nums[i - 1] or (i % 2 == 1 and nums[i] < nums[i - 1]):
nums[i], nums[i - 1] = (nums[i - 1], nums[i])
<|end_body_0|>
<|body_start_1|>
nums.sort()
for i in xrange((len(nums) - 1) / 2):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def wiggleSort(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead."""
<|body_0|>
def wiggleSort_nlogn(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instea... | stack_v2_sparse_classes_10k_train_003964 | 718 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.",
"name": "wiggleSort",
"signature": "def wiggleSort(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.",
"name": "wi... | 2 | stack_v2_sparse_classes_30k_val_000111 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def wiggleSort(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.
- def wiggleSort_nlogn(self, nums): :type nums: List[int] :rt... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def wiggleSort(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.
- def wiggleSort_nlogn(self, nums): :type nums: List[int] :rt... | ed15eb27936b39980d4cb5fb61cd937ec7ddcb6a | <|skeleton|>
class Solution:
def wiggleSort(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead."""
<|body_0|>
def wiggleSort_nlogn(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instea... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def wiggleSort(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead."""
for i in xrange(1, len(nums)):
if i % 2 == 0 and nums[i] > nums[i - 1] or (i % 2 == 1 and nums[i] < nums[i - 1]):
nums[i], nums[i - 1... | the_stack_v2_python_sparse | alice/LC280.py | AliceTTXu/LeetCode | train | 0 | |
5079ccef8a72c023b2c4532e3dd82694b33fadd0 | [
"self.config = config_pb2.Config()\nself.config.error_code_matcher.output_column_name = 'ERROR_CODE'\nself.config.clusterer.output_column_name = 'CLUSTER_CODE'\nself.config.summarizer.n_messages = 5\nself.config.summarizer.n_class_lines_to_show = 5\nself.simple_dataframe = pd.read_json('testdata/summarizer/simple_d... | <|body_start_0|>
self.config = config_pb2.Config()
self.config.error_code_matcher.output_column_name = 'ERROR_CODE'
self.config.clusterer.output_column_name = 'CLUSTER_CODE'
self.config.summarizer.n_messages = 5
self.config.summarizer.n_class_lines_to_show = 5
self.simple... | Unit test case suite for our Summarizer class. | SummarizerTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SummarizerTest:
"""Unit test case suite for our Summarizer class."""
def setUp(self):
"""General setup for configuration files and pandas dataframes."""
<|body_0|>
def test_generate_summary(self):
"""Various test cases for summarizer.generate_summary."""
... | stack_v2_sparse_classes_10k_train_003965 | 2,584 | no_license | [
{
"docstring": "General setup for configuration files and pandas dataframes.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Various test cases for summarizer.generate_summary.",
"name": "test_generate_summary",
"signature": "def test_generate_summary(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005757 | Implement the Python class `SummarizerTest` described below.
Class description:
Unit test case suite for our Summarizer class.
Method signatures and docstrings:
- def setUp(self): General setup for configuration files and pandas dataframes.
- def test_generate_summary(self): Various test cases for summarizer.generate... | Implement the Python class `SummarizerTest` described below.
Class description:
Unit test case suite for our Summarizer class.
Method signatures and docstrings:
- def setUp(self): General setup for configuration files and pandas dataframes.
- def test_generate_summary(self): Various test cases for summarizer.generate... | 538bd1d109a8f53f2a756ebb65ba2f20703e5d32 | <|skeleton|>
class SummarizerTest:
"""Unit test case suite for our Summarizer class."""
def setUp(self):
"""General setup for configuration files and pandas dataframes."""
<|body_0|>
def test_generate_summary(self):
"""Various test cases for summarizer.generate_summary."""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SummarizerTest:
"""Unit test case suite for our Summarizer class."""
def setUp(self):
"""General setup for configuration files and pandas dataframes."""
self.config = config_pb2.Config()
self.config.error_code_matcher.output_column_name = 'ERROR_CODE'
self.config.clusterer... | the_stack_v2_python_sparse | python/summarizer_test.py | googleinterns/stack-trace-classifier | train | 0 |
4d3407e399f277451b0f08880eb9c75e5689f085 | [
"super(TrainableInitialState, self).__init__(name=name)\nwarnings.simplefilter('always', DeprecationWarning)\nwarnings.warn('Use the trainable flag in initial_state instead.', DeprecationWarning, stacklevel=2)\nif mask is not None:\n flat_mask = nest.flatten(mask)\n if not all([isinstance(m, bool) for m in fl... | <|body_start_0|>
super(TrainableInitialState, self).__init__(name=name)
warnings.simplefilter('always', DeprecationWarning)
warnings.warn('Use the trainable flag in initial_state instead.', DeprecationWarning, stacklevel=2)
if mask is not None:
flat_mask = nest.flatten(mask)
... | Helper Module that creates a learnable initial state for an RNNCore. This class receives an example (possibly nested) initial state of an RNNCore, and returns a state that has the same shape, structure, and values, but is trainable. Additionally, the user may specify a boolean mask that indicates which parts of the ini... | TrainableInitialState | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TrainableInitialState:
"""Helper Module that creates a learnable initial state for an RNNCore. This class receives an example (possibly nested) initial state of an RNNCore, and returns a state that has the same shape, structure, and values, but is trainable. Additionally, the user may specify a b... | stack_v2_sparse_classes_10k_train_003966 | 14,770 | permissive | [
{
"docstring": "Constructs the Module that introduces a trainable state in the graph. It receives an initial state that will be used as the initial values for the trainable variables that the module contains, and optionally a mask that indicates the parts of the initial state that should be learnable. Args: ini... | 2 | stack_v2_sparse_classes_30k_train_001711 | Implement the Python class `TrainableInitialState` described below.
Class description:
Helper Module that creates a learnable initial state for an RNNCore. This class receives an example (possibly nested) initial state of an RNNCore, and returns a state that has the same shape, structure, and values, but is trainable.... | Implement the Python class `TrainableInitialState` described below.
Class description:
Helper Module that creates a learnable initial state for an RNNCore. This class receives an example (possibly nested) initial state of an RNNCore, and returns a state that has the same shape, structure, and values, but is trainable.... | 4e28fdf2ffd0eaefc0d23049106609421c9290b0 | <|skeleton|>
class TrainableInitialState:
"""Helper Module that creates a learnable initial state for an RNNCore. This class receives an example (possibly nested) initial state of an RNNCore, and returns a state that has the same shape, structure, and values, but is trainable. Additionally, the user may specify a b... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TrainableInitialState:
"""Helper Module that creates a learnable initial state for an RNNCore. This class receives an example (possibly nested) initial state of an RNNCore, and returns a state that has the same shape, structure, and values, but is trainable. Additionally, the user may specify a boolean mask t... | the_stack_v2_python_sparse | sunset/sunset/python/modules/rnn_core.py | SynthAI/SynthAI | train | 3 |
e09396c2dc74aae9fe58864b3456d8411454ca82 | [
"self.feedback_type = feedback\nif const.FEEDBACK_PV in self.feedback_type:\n self.detector = detector\n feedback_pvs = utils.get_feedback_pvs(quality_checks)\n for fb_pv in feedback_pvs:\n caput(self.detector + ':data_' + fb_pv + '_ctr', 0)\nif const.FEEDBACK_LOG in self.feedback_type:\n self.lo... | <|body_start_0|>
self.feedback_type = feedback
if const.FEEDBACK_PV in self.feedback_type:
self.detector = detector
feedback_pvs = utils.get_feedback_pvs(quality_checks)
for fb_pv in feedback_pvs:
caput(self.detector + ':data_' + fb_pv + '_ctr', 0)
... | This class is a container of real-time feedback related information. | Feedback | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Feedback:
"""This class is a container of real-time feedback related information."""
def __init__(self, feedback, detector, quality_checks, logger):
"""Constructor Parameters ---------- feedback_type : list a list of configured feedbac types. Possible options: console, log, and pv"""... | stack_v2_sparse_classes_10k_train_003967 | 2,461 | no_license | [
{
"docstring": "Constructor Parameters ---------- feedback_type : list a list of configured feedbac types. Possible options: console, log, and pv",
"name": "__init__",
"signature": "def __init__(self, feedback, detector, quality_checks, logger)"
},
{
"docstring": "This function provides feedback... | 2 | stack_v2_sparse_classes_30k_train_000020 | Implement the Python class `Feedback` described below.
Class description:
This class is a container of real-time feedback related information.
Method signatures and docstrings:
- def __init__(self, feedback, detector, quality_checks, logger): Constructor Parameters ---------- feedback_type : list a list of configured... | Implement the Python class `Feedback` described below.
Class description:
This class is a container of real-time feedback related information.
Method signatures and docstrings:
- def __init__(self, feedback, detector, quality_checks, logger): Constructor Parameters ---------- feedback_type : list a list of configured... | c8e9ef7c9cba497479faf60136f6810c41d8bd3c | <|skeleton|>
class Feedback:
"""This class is a container of real-time feedback related information."""
def __init__(self, feedback, detector, quality_checks, logger):
"""Constructor Parameters ---------- feedback_type : list a list of configured feedbac types. Possible options: console, log, and pv"""... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Feedback:
"""This class is a container of real-time feedback related information."""
def __init__(self, feedback, detector, quality_checks, logger):
"""Constructor Parameters ---------- feedback_type : list a list of configured feedbac types. Possible options: console, log, and pv"""
self... | the_stack_v2_python_sparse | dquality/clients/fb_client/simple_feedback.py | AdvancedPhotonSource/data-quality | train | 2 |
9b724d89b3bcc9be48eb4f6ccefcee798916df85 | [
"lo = sl.bisect_left(rate)\nhi = len(sl) - lo\nreturn (lo, hi)",
"teams = 0\nleft = SortedList()\nright = SortedList(rating)\nfor rate in rating:\n right.remove(rate)\n loL, hiL = self.get_high_low(left, rate)\n loR, hiR = self.get_high_low(right, rate)\n teams += loL * hiR + loR * hiL\n left.add(r... | <|body_start_0|>
lo = sl.bisect_left(rate)
hi = len(sl) - lo
return (lo, hi)
<|end_body_0|>
<|body_start_1|>
teams = 0
left = SortedList()
right = SortedList(rating)
for rate in rating:
right.remove(rate)
loL, hiL = self.get_high_low(left,... | Soldiers | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Soldiers:
def get_high_low(self, sl, rate):
""":param ls: :param s: :return:"""
<|body_0|>
def team_numbers_(self, rating: List[int]) -> int:
"""Approach: Using SortedList Time Complexity: O(N) Space Complexity: O(N) :param rating: :return:"""
<|body_1|>
... | stack_v2_sparse_classes_10k_train_003968 | 1,814 | no_license | [
{
"docstring": ":param ls: :param s: :return:",
"name": "get_high_low",
"signature": "def get_high_low(self, sl, rate)"
},
{
"docstring": "Approach: Using SortedList Time Complexity: O(N) Space Complexity: O(N) :param rating: :return:",
"name": "team_numbers_",
"signature": "def team_num... | 3 | null | Implement the Python class `Soldiers` described below.
Class description:
Implement the Soldiers class.
Method signatures and docstrings:
- def get_high_low(self, sl, rate): :param ls: :param s: :return:
- def team_numbers_(self, rating: List[int]) -> int: Approach: Using SortedList Time Complexity: O(N) Space Comple... | Implement the Python class `Soldiers` described below.
Class description:
Implement the Soldiers class.
Method signatures and docstrings:
- def get_high_low(self, sl, rate): :param ls: :param s: :return:
- def team_numbers_(self, rating: List[int]) -> int: Approach: Using SortedList Time Complexity: O(N) Space Comple... | 65cc78b5afa0db064f9fe8f06597e3e120f7363d | <|skeleton|>
class Soldiers:
def get_high_low(self, sl, rate):
""":param ls: :param s: :return:"""
<|body_0|>
def team_numbers_(self, rating: List[int]) -> int:
"""Approach: Using SortedList Time Complexity: O(N) Space Complexity: O(N) :param rating: :return:"""
<|body_1|>
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Soldiers:
def get_high_low(self, sl, rate):
""":param ls: :param s: :return:"""
lo = sl.bisect_left(rate)
hi = len(sl) - lo
return (lo, hi)
def team_numbers_(self, rating: List[int]) -> int:
"""Approach: Using SortedList Time Complexity: O(N) Space Complexity: O(N)... | the_stack_v2_python_sparse | revisited_2021/arrays/count_number_of_teams.py | Shiv2157k/leet_code | train | 1 | |
c1523587f90bc9a42b5173aea128d555c4bb7912 | [
"super().__init__(**kwargs)\nself.probability_transformation = probability_transformation\nself.max_angle = max_angle\nself.max_x_shift = max_x_shift\nself.max_y_shift = max_y_shift\nself.max_constrast = max_contrast\nself.min_constrast = min_constrast\nself.min_brightness = min_brightness\nself.max_brightness = ma... | <|body_start_0|>
super().__init__(**kwargs)
self.probability_transformation = probability_transformation
self.max_angle = max_angle
self.max_x_shift = max_x_shift
self.max_y_shift = max_y_shift
self.max_constrast = max_contrast
self.min_constrast = min_constrast
... | Class to apply a random set of 2D affine transformations to all slices of a 3D volume separately along the z-dimension. | RandomSliceTransformation | [
"MIT",
"LicenseRef-scancode-generic-cla"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandomSliceTransformation:
"""Class to apply a random set of 2D affine transformations to all slices of a 3D volume separately along the z-dimension."""
def __init__(self, probability_transformation: float=0.8, max_angle: int=10, max_x_shift: float=0.05, max_y_shift: float=0.1, max_contrast:... | stack_v2_sparse_classes_10k_train_003969 | 19,979 | permissive | [
{
"docstring": ":param probability_transformation: probability of applying the transformation pipeline. :param max_angle: maximum allowed angle for rotation. For each transformation the angle is drawn uniformly between -max_angle and max_angle. :param min_constrast: Minimum contrast factor to apply. 1 means no ... | 2 | stack_v2_sparse_classes_30k_train_004413 | Implement the Python class `RandomSliceTransformation` described below.
Class description:
Class to apply a random set of 2D affine transformations to all slices of a 3D volume separately along the z-dimension.
Method signatures and docstrings:
- def __init__(self, probability_transformation: float=0.8, max_angle: in... | Implement the Python class `RandomSliceTransformation` described below.
Class description:
Class to apply a random set of 2D affine transformations to all slices of a 3D volume separately along the z-dimension.
Method signatures and docstrings:
- def __init__(self, probability_transformation: float=0.8, max_angle: in... | 12b496093097ef48d5ac8880985c04918d7f76fe | <|skeleton|>
class RandomSliceTransformation:
"""Class to apply a random set of 2D affine transformations to all slices of a 3D volume separately along the z-dimension."""
def __init__(self, probability_transformation: float=0.8, max_angle: int=10, max_x_shift: float=0.05, max_y_shift: float=0.1, max_contrast:... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RandomSliceTransformation:
"""Class to apply a random set of 2D affine transformations to all slices of a 3D volume separately along the z-dimension."""
def __init__(self, probability_transformation: float=0.8, max_angle: int=10, max_x_shift: float=0.05, max_y_shift: float=0.1, max_contrast: float=2, min... | the_stack_v2_python_sparse | InnerEye/ML/utils/augmentation.py | MaxCodeXTC/InnerEye-DeepLearning | train | 1 |
d45662f4dd4be5a127e11579b8d510877b610a82 | [
"self.ss = ss\nself.n_step = n_step\nself.interval = step_interval\nself.step_time = step_time",
"lB = self.interval[0]\nuB = self.interval[1]\nstep_vector = [round(uniform(lB, uB), 1) for _ in range(self.n_step)]\nu = np.zeros(shape=dim)\nj = 0\nfor i in range(len(t)):\n if t[i] % self.step_time == 0 and t[i]... | <|body_start_0|>
self.ss = ss
self.n_step = n_step
self.interval = step_interval
self.step_time = step_time
<|end_body_0|>
<|body_start_1|>
lB = self.interval[0]
uB = self.interval[1]
step_vector = [round(uniform(lB, uB), 1) for _ in range(self.n_step)]
u... | RandStep | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandStep:
def __init__(self, step_time, step_interval=None, n_step=None, ss=None):
"""Settings for a random step sequence Args: step_interval (list): Probability interval <a, b> step_time: Time to perform step change n_step (int): Number of steps"""
<|body_0|>
def out(self, ... | stack_v2_sparse_classes_10k_train_003970 | 8,036 | no_license | [
{
"docstring": "Settings for a random step sequence Args: step_interval (list): Probability interval <a, b> step_time: Time to perform step change n_step (int): Number of steps",
"name": "__init__",
"signature": "def __init__(self, step_time, step_interval=None, n_step=None, ss=None)"
},
{
"docs... | 2 | stack_v2_sparse_classes_30k_train_005052 | Implement the Python class `RandStep` described below.
Class description:
Implement the RandStep class.
Method signatures and docstrings:
- def __init__(self, step_time, step_interval=None, n_step=None, ss=None): Settings for a random step sequence Args: step_interval (list): Probability interval <a, b> step_time: Ti... | Implement the Python class `RandStep` described below.
Class description:
Implement the RandStep class.
Method signatures and docstrings:
- def __init__(self, step_time, step_interval=None, n_step=None, ss=None): Settings for a random step sequence Args: step_interval (list): Probability interval <a, b> step_time: Ti... | cf548475295f25407ba968546c2fc85c26f9343c | <|skeleton|>
class RandStep:
def __init__(self, step_time, step_interval=None, n_step=None, ss=None):
"""Settings for a random step sequence Args: step_interval (list): Probability interval <a, b> step_time: Time to perform step change n_step (int): Number of steps"""
<|body_0|>
def out(self, ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RandStep:
def __init__(self, step_time, step_interval=None, n_step=None, ss=None):
"""Settings for a random step sequence Args: step_interval (list): Probability interval <a, b> step_time: Time to perform step change n_step (int): Number of steps"""
self.ss = ss
self.n_step = n_step
... | the_stack_v2_python_sparse | SourceCode/simulation/signal.py | martin-bachorik/Master-Thesis-Project | train | 0 | |
3f8e53009ab8311f53c1ccba9ed00800535a2dd7 | [
"if not nums:\n return 0\nlis = [1] * len(nums)\nfor i, n in enumerate(nums):\n for j, m in enumerate(nums[:i]):\n if m < n:\n lis[i] = max(lis[i], lis[j] + 1)\nprint(lis)\nreturn max(lis)",
"if not nums:\n return 0\n\ndef bisearch(arr, n):\n left, right = (0, len(arr) - 1)\n whil... | <|body_start_0|>
if not nums:
return 0
lis = [1] * len(nums)
for i, n in enumerate(nums):
for j, m in enumerate(nums[:i]):
if m < n:
lis[i] = max(lis[i], lis[j] + 1)
print(lis)
return max(lis)
<|end_body_0|>
<|body_star... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lengthOfLIS(self, nums: List[int]) -> int:
"""11/05/2019 01:36"""
<|body_0|>
def lengthOfLIS(self, nums: List[int]) -> int:
"""11/05/2019 02:28"""
<|body_1|>
def lengthOfLIS(self, nums: List[int]) -> int:
"""DP Time complexity: O(n^... | stack_v2_sparse_classes_10k_train_003971 | 3,572 | no_license | [
{
"docstring": "11/05/2019 01:36",
"name": "lengthOfLIS",
"signature": "def lengthOfLIS(self, nums: List[int]) -> int"
},
{
"docstring": "11/05/2019 02:28",
"name": "lengthOfLIS",
"signature": "def lengthOfLIS(self, nums: List[int]) -> int"
},
{
"docstring": "DP Time complexity: ... | 5 | stack_v2_sparse_classes_30k_train_006674 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLIS(self, nums: List[int]) -> int: 11/05/2019 01:36
- def lengthOfLIS(self, nums: List[int]) -> int: 11/05/2019 02:28
- def lengthOfLIS(self, nums: List[int]) -> int:... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLIS(self, nums: List[int]) -> int: 11/05/2019 01:36
- def lengthOfLIS(self, nums: List[int]) -> int: 11/05/2019 02:28
- def lengthOfLIS(self, nums: List[int]) -> int:... | 1389a009a02e90e8700a7a00e0b7f797c129cdf4 | <|skeleton|>
class Solution:
def lengthOfLIS(self, nums: List[int]) -> int:
"""11/05/2019 01:36"""
<|body_0|>
def lengthOfLIS(self, nums: List[int]) -> int:
"""11/05/2019 02:28"""
<|body_1|>
def lengthOfLIS(self, nums: List[int]) -> int:
"""DP Time complexity: O(n^... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def lengthOfLIS(self, nums: List[int]) -> int:
"""11/05/2019 01:36"""
if not nums:
return 0
lis = [1] * len(nums)
for i, n in enumerate(nums):
for j, m in enumerate(nums[:i]):
if m < n:
lis[i] = max(lis[i], l... | the_stack_v2_python_sparse | leetcode/solved/300_Longest_Increasing_Subsequence/solution.py | sungminoh/algorithms | train | 0 | |
bd4e48a6645caebeb4d0090abb2ea414ad91babf | [
"if not self.stage_id or not self.stage_id.notify:\n return False\nif self.stage_id in self.notified_stage_ids:\n if not self.stage_id.notify_multiple:\n return False\nif not self.stage_id.notify_template_id:\n raise except_orm(_(u'Warning !'), _(u\"No email template selected in the '%s' stage of th... | <|body_start_0|>
if not self.stage_id or not self.stage_id.notify:
return False
if self.stage_id in self.notified_stage_ids:
if not self.stage_id.notify_multiple:
return False
if not self.stage_id.notify_template_id:
raise except_orm(_(u'Warnin... | Add notification feature | Ticket | [
"CC-BY-2.5"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Ticket:
"""Add notification feature"""
def check_notify(self):
"""Return True only if we should notify"""
<|body_0|>
def create(self, values):
"""Notify on create"""
<|body_1|>
def write(self, values):
"""Notify on write"""
<|body_2|>... | stack_v2_sparse_classes_10k_train_003972 | 3,123 | permissive | [
{
"docstring": "Return True only if we should notify",
"name": "check_notify",
"signature": "def check_notify(self)"
},
{
"docstring": "Notify on create",
"name": "create",
"signature": "def create(self, values)"
},
{
"docstring": "Notify on write",
"name": "write",
"sign... | 3 | stack_v2_sparse_classes_30k_train_006905 | Implement the Python class `Ticket` described below.
Class description:
Add notification feature
Method signatures and docstrings:
- def check_notify(self): Return True only if we should notify
- def create(self, values): Notify on create
- def write(self, values): Notify on write | Implement the Python class `Ticket` described below.
Class description:
Add notification feature
Method signatures and docstrings:
- def check_notify(self): Return True only if we should notify
- def create(self, values): Notify on create
- def write(self, values): Notify on write
<|skeleton|>
class Ticket:
"""A... | 50c4c1aa6c04f89a2e11cf2bae13e97ae0877819 | <|skeleton|>
class Ticket:
"""Add notification feature"""
def check_notify(self):
"""Return True only if we should notify"""
<|body_0|>
def create(self, values):
"""Notify on create"""
<|body_1|>
def write(self, values):
"""Notify on write"""
<|body_2|>... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Ticket:
"""Add notification feature"""
def check_notify(self):
"""Return True only if we should notify"""
if not self.stage_id or not self.stage_id.notify:
return False
if self.stage_id in self.notified_stage_ids:
if not self.stage_id.notify_multiple:
... | the_stack_v2_python_sparse | anytracker/notify/notify.py | anybox/anytracker | train | 1 |
ed8b75b3e476686fb67f679cf349d1477648ee01 | [
"self.rects = rects\nareas = [(x[2] - x[0] + 1) * (x[3] - x[1] + 1) for x in rects]\nfor i in range(1, len(areas)):\n areas[i] += areas[i - 1]\nself.areas = areas",
"p = random.randint(1, self.areas[-1])\narea_idx = bisect.bisect_left(self.areas, p)\nrect = self.rects[area_idx]\npoint_idx = p - (self.areas[are... | <|body_start_0|>
self.rects = rects
areas = [(x[2] - x[0] + 1) * (x[3] - x[1] + 1) for x in rects]
for i in range(1, len(areas)):
areas[i] += areas[i - 1]
self.areas = areas
<|end_body_0|>
<|body_start_1|>
p = random.randint(1, self.areas[-1])
area_idx = bise... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def __init__(self, rects):
""":type rects: List[List[int]]"""
<|body_0|>
def pick(self):
""":rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.rects = rects
areas = [(x[2] - x[0] + 1) * (x[3] - x[1] + 1) for x i... | stack_v2_sparse_classes_10k_train_003973 | 940 | no_license | [
{
"docstring": ":type rects: List[List[int]]",
"name": "__init__",
"signature": "def __init__(self, rects)"
},
{
"docstring": ":rtype: List[int]",
"name": "pick",
"signature": "def pick(self)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, rects): :type rects: List[List[int]]
- def pick(self): :rtype: List[int] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, rects): :type rects: List[List[int]]
- def pick(self): :rtype: List[int]
<|skeleton|>
class Solution:
def __init__(self, rects):
""":type rects: ... | c026f2969c784827fac702b34b07a9268b70b62a | <|skeleton|>
class Solution:
def __init__(self, rects):
""":type rects: List[List[int]]"""
<|body_0|>
def pick(self):
""":rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def __init__(self, rects):
""":type rects: List[List[int]]"""
self.rects = rects
areas = [(x[2] - x[0] + 1) * (x[3] - x[1] + 1) for x in rects]
for i in range(1, len(areas)):
areas[i] += areas[i - 1]
self.areas = areas
def pick(self):
... | the_stack_v2_python_sparse | codes/contest/leetcode/random-point-in-non-overlapping-rectangles.py | jiluhu/dirtysalt.github.io | train | 0 | |
fe2f6bbbb5de2553be60baf82acc8dea631af6be | [
"self.boundary = boundary\nself.droplet = Droplet(boundary)\nself.w = w\nself.k = k\nredblue = np.array([780.0, 380.0])\nself.dvr = self.droplet.deviation_angle(redblue, k)\nself.dv = self.droplet.deviation_angle(w, k)",
"d = self.dvr\ndmin = d.min() + window[0] * deg\ndmax = d.max() + window[1] * deg\nreturn np.... | <|body_start_0|>
self.boundary = boundary
self.droplet = Droplet(boundary)
self.w = w
self.k = k
redblue = np.array([780.0, 380.0])
self.dvr = self.droplet.deviation_angle(redblue, k)
self.dv = self.droplet.deviation_angle(w, k)
<|end_body_0|>
<|body_start_1|>
... | XRainbow | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class XRainbow:
def __init__(self, w, boundary, k=1):
""":param w: wavelength array :param boundary: instance :param k: 1.. rainbow index, -1 direct reflection Attributes: i incident angle of minimum deviation d total deviation angle at minimum deviation n refractive indices corresponding to w... | stack_v2_sparse_classes_10k_train_003974 | 7,408 | permissive | [
{
"docstring": ":param w: wavelength array :param boundary: instance :param k: 1.. rainbow index, -1 direct reflection Attributes: i incident angle of minimum deviation d total deviation angle at minimum deviation n refractive indices corresponding to wavelength array There is symmetry about the ray at normal i... | 3 | stack_v2_sparse_classes_30k_train_006474 | Implement the Python class `XRainbow` described below.
Class description:
Implement the XRainbow class.
Method signatures and docstrings:
- def __init__(self, w, boundary, k=1): :param w: wavelength array :param boundary: instance :param k: 1.. rainbow index, -1 direct reflection Attributes: i incident angle of minim... | Implement the Python class `XRainbow` described below.
Class description:
Implement the XRainbow class.
Method signatures and docstrings:
- def __init__(self, w, boundary, k=1): :param w: wavelength array :param boundary: instance :param k: 1.. rainbow index, -1 direct reflection Attributes: i incident angle of minim... | 523387f7593676bab58de22d22049e650de3f5c3 | <|skeleton|>
class XRainbow:
def __init__(self, w, boundary, k=1):
""":param w: wavelength array :param boundary: instance :param k: 1.. rainbow index, -1 direct reflection Attributes: i incident angle of minimum deviation d total deviation angle at minimum deviation n refractive indices corresponding to w... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class XRainbow:
def __init__(self, w, boundary, k=1):
""":param w: wavelength array :param boundary: instance :param k: 1.. rainbow index, -1 direct reflection Attributes: i incident angle of minimum deviation d total deviation angle at minimum deviation n refractive indices corresponding to wavelength arra... | the_stack_v2_python_sparse | ana/xrainbow.py | recepkandemir/opticks | train | 0 | |
f0c44e3007ba2317060e986275d026abcf4eba97 | [
"if len(grid) == 0 or (len(grid) == 0 and len(grid[0]) == 0):\n return 0\nacross_length = len(grid[0])\nvertical_length = len(grid)\nisland_nums = 0\nfor i in range(vertical_length):\n for j in range(across_length):\n if grid[i][j] == '1':\n grid[i][j] = '0'\n island_nums += 1\n ... | <|body_start_0|>
if len(grid) == 0 or (len(grid) == 0 and len(grid[0]) == 0):
return 0
across_length = len(grid[0])
vertical_length = len(grid)
island_nums = 0
for i in range(vertical_length):
for j in range(across_length):
if grid[i][j] ==... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def numIslands(self, grid: [[int]]) -> int:
"""get islands from arrays :param grid: :type: [[str]] example: [ ["1", "1", "0", "0", "0"], ["1", "1", "0", "0", "0"], ["0", "0", "1", "0", "0"], ["0", "0", "0", "1", "1"] ] :return: :rtype: int"""
<|body_0|>
def __get_i... | stack_v2_sparse_classes_10k_train_003975 | 3,570 | no_license | [
{
"docstring": "get islands from arrays :param grid: :type: [[str]] example: [ [\"1\", \"1\", \"0\", \"0\", \"0\"], [\"1\", \"1\", \"0\", \"0\", \"0\"], [\"0\", \"0\", \"1\", \"0\", \"0\"], [\"0\", \"0\", \"0\", \"1\", \"1\"] ] :return: :rtype: int",
"name": "numIslands",
"signature": "def numIslands(se... | 2 | stack_v2_sparse_classes_30k_train_005512 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numIslands(self, grid: [[int]]) -> int: get islands from arrays :param grid: :type: [[str]] example: [ ["1", "1", "0", "0", "0"], ["1", "1", "0", "0", "0"], ["0", "0", "1", "... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numIslands(self, grid: [[int]]) -> int: get islands from arrays :param grid: :type: [[str]] example: [ ["1", "1", "0", "0", "0"], ["1", "1", "0", "0", "0"], ["0", "0", "1", "... | 37710292b2cfc6060098363c8d5f8881a4c22b26 | <|skeleton|>
class Solution:
def numIslands(self, grid: [[int]]) -> int:
"""get islands from arrays :param grid: :type: [[str]] example: [ ["1", "1", "0", "0", "0"], ["1", "1", "0", "0", "0"], ["0", "0", "1", "0", "0"], ["0", "0", "0", "1", "1"] ] :return: :rtype: int"""
<|body_0|>
def __get_i... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def numIslands(self, grid: [[int]]) -> int:
"""get islands from arrays :param grid: :type: [[str]] example: [ ["1", "1", "0", "0", "0"], ["1", "1", "0", "0", "0"], ["0", "0", "1", "0", "0"], ["0", "0", "0", "1", "1"] ] :return: :rtype: int"""
if len(grid) == 0 or (len(grid) == 0 and ... | the_stack_v2_python_sparse | python/pyleetcode/queue_and_stack/numIslands.py | yudongnan23/algorithmRoad | train | 0 | |
ea32cb1d053c5690dd9270b1d86c815d056c4336 | [
"self.instance = instance\nfor name, field in self.hidden_fields.items():\n self.hidden_fields[name] = getattr(self.instance, name)",
"grouping = collections.defaultdict(list)\nfor name, field in self.fields.items():\n group = getattr(field, 'group', '0. ')\n grouping[group].append((field.verbose_name, g... | <|body_start_0|>
self.instance = instance
for name, field in self.hidden_fields.items():
self.hidden_fields[name] = getattr(self.instance, name)
<|end_body_0|>
<|body_start_1|>
grouping = collections.defaultdict(list)
for name, field in self.fields.items():
group... | A base class that constructs the readonly template for a given model. This uses the same notion that Django's forms APIs use to generate forms for given models. The idea is completely inspired from Django's ModelForm APIs and tries to mimic the same names that is used there in order to provide consistency. In addition,... | ModelReadOnlyTemplate | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModelReadOnlyTemplate:
"""A base class that constructs the readonly template for a given model. This uses the same notion that Django's forms APIs use to generate forms for given models. The idea is completely inspired from Django's ModelForm APIs and tries to mimic the same names that is used th... | stack_v2_sparse_classes_10k_train_003976 | 9,668 | permissive | [
{
"docstring": "Constructor to initialize the model instance. The readonly template will be rendered for the data in this model instance.",
"name": "__init__",
"signature": "def __init__(self, instance=None)"
},
{
"docstring": "Iterator yielding groups of model instance's properties to be render... | 3 | stack_v2_sparse_classes_30k_train_000910 | Implement the Python class `ModelReadOnlyTemplate` described below.
Class description:
A base class that constructs the readonly template for a given model. This uses the same notion that Django's forms APIs use to generate forms for given models. The idea is completely inspired from Django's ModelForm APIs and tries ... | Implement the Python class `ModelReadOnlyTemplate` described below.
Class description:
A base class that constructs the readonly template for a given model. This uses the same notion that Django's forms APIs use to generate forms for given models. The idea is completely inspired from Django's ModelForm APIs and tries ... | f581989f168189fa3a58c028eff327a16c03e438 | <|skeleton|>
class ModelReadOnlyTemplate:
"""A base class that constructs the readonly template for a given model. This uses the same notion that Django's forms APIs use to generate forms for given models. The idea is completely inspired from Django's ModelForm APIs and tries to mimic the same names that is used th... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ModelReadOnlyTemplate:
"""A base class that constructs the readonly template for a given model. This uses the same notion that Django's forms APIs use to generate forms for given models. The idea is completely inspired from Django's ModelForm APIs and tries to mimic the same names that is used there in order ... | the_stack_v2_python_sparse | app/soc/views/readonly_template.py | sambitgaan/nupic.son | train | 0 |
c652428851eb81eab8ea3fa740d3fb1f52b51bfc | [
"super(topic_embedding, self).__init__()\nassert n_topics < embedding_dim\ntopic_vectors = ortho_group.rvs(embedding_dim)\ntopic_vectors = topic_vectors[0:n_topics]\ntopic_vectors = torch.FloatTensor(topic_vectors)\nself.topic_vectors = nn.Parameter(topic_vectors)\nself.n_topics = n_topics",
"doc_probs = F.softma... | <|body_start_0|>
super(topic_embedding, self).__init__()
assert n_topics < embedding_dim
topic_vectors = ortho_group.rvs(embedding_dim)
topic_vectors = topic_vectors[0:n_topics]
topic_vectors = torch.FloatTensor(topic_vectors)
self.topic_vectors = nn.Parameter(topic_vecto... | topic_embedding | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class topic_embedding:
def __init__(self, n_topics, embedding_dim):
"""Arguments: embedding_dim: An integer. n_topics: An integer."""
<|body_0|>
def forward(self, doc_weights):
"""Embed a batch of documents. Arguments: doc_weights: A float tensor of shape [batch_size, n_to... | stack_v2_sparse_classes_10k_train_003977 | 29,814 | no_license | [
{
"docstring": "Arguments: embedding_dim: An integer. n_topics: An integer.",
"name": "__init__",
"signature": "def __init__(self, n_topics, embedding_dim)"
},
{
"docstring": "Embed a batch of documents. Arguments: doc_weights: A float tensor of shape [batch_size, n_topics], document distributio... | 2 | null | Implement the Python class `topic_embedding` described below.
Class description:
Implement the topic_embedding class.
Method signatures and docstrings:
- def __init__(self, n_topics, embedding_dim): Arguments: embedding_dim: An integer. n_topics: An integer.
- def forward(self, doc_weights): Embed a batch of document... | Implement the Python class `topic_embedding` described below.
Class description:
Implement the topic_embedding class.
Method signatures and docstrings:
- def __init__(self, n_topics, embedding_dim): Arguments: embedding_dim: An integer. n_topics: An integer.
- def forward(self, doc_weights): Embed a batch of document... | 82d3e9808073f2145b039ccf464c526cb85274e3 | <|skeleton|>
class topic_embedding:
def __init__(self, n_topics, embedding_dim):
"""Arguments: embedding_dim: An integer. n_topics: An integer."""
<|body_0|>
def forward(self, doc_weights):
"""Embed a batch of documents. Arguments: doc_weights: A float tensor of shape [batch_size, n_to... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class topic_embedding:
def __init__(self, n_topics, embedding_dim):
"""Arguments: embedding_dim: An integer. n_topics: An integer."""
super(topic_embedding, self).__init__()
assert n_topics < embedding_dim
topic_vectors = ortho_group.rvs(embedding_dim)
topic_vectors = topic_v... | the_stack_v2_python_sparse | business/p201908/3507_750/lda2vec_model.py | Alvin2580du/alvin_py | train | 12 | |
5e7b52ecb441c4972fd4855ac4edcc1747d8f79f | [
"super(U_Net, self).__init__()\nself.layer_0 = UNet_Encoder_Particular(in_channels, 64)\nself.layer_1 = UNet_Encoder(64, 128)\nself.layer_2 = UNet_Encoder(128, 256)\nself.layer_3 = UNet_Encoder(256, 512)\nself.layer_4 = UNet_Encoder(512, 512)\nself.layer_7 = UNet_Decoder(1024, 256)\nself.layer_8 = UNet_Decoder(512,... | <|body_start_0|>
super(U_Net, self).__init__()
self.layer_0 = UNet_Encoder_Particular(in_channels, 64)
self.layer_1 = UNet_Encoder(64, 128)
self.layer_2 = UNet_Encoder(128, 256)
self.layer_3 = UNet_Encoder(256, 512)
self.layer_4 = UNet_Encoder(512, 512)
self.layer... | Derived Class to define a UNet Architecture of NN Attributes ---------- in_channels : int The input size of the network. n_classes : int The output size of the network. References ---------- U-Net: Convolutional Networks for Biomedical Image Segmentation | U_Net | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class U_Net:
"""Derived Class to define a UNet Architecture of NN Attributes ---------- in_channels : int The input size of the network. n_classes : int The output size of the network. References ---------- U-Net: Convolutional Networks for Biomedical Image Segmentation"""
def __init__(self, in_ch... | stack_v2_sparse_classes_10k_train_003978 | 20,094 | no_license | [
{
"docstring": "Sequential Instanciation of the different Layers",
"name": "__init__",
"signature": "def __init__(self, in_channels=3, n_classes=21)"
},
{
"docstring": "Sequential Computation, see nn.Module.forward methods PyTorch",
"name": "forward",
"signature": "def forward(self, inpu... | 2 | stack_v2_sparse_classes_30k_train_001778 | Implement the Python class `U_Net` described below.
Class description:
Derived Class to define a UNet Architecture of NN Attributes ---------- in_channels : int The input size of the network. n_classes : int The output size of the network. References ---------- U-Net: Convolutional Networks for Biomedical Image Segmen... | Implement the Python class `U_Net` described below.
Class description:
Derived Class to define a UNet Architecture of NN Attributes ---------- in_channels : int The input size of the network. n_classes : int The output size of the network. References ---------- U-Net: Convolutional Networks for Biomedical Image Segmen... | 3b63f360e67013d5962082e57fb36ebfb37d8920 | <|skeleton|>
class U_Net:
"""Derived Class to define a UNet Architecture of NN Attributes ---------- in_channels : int The input size of the network. n_classes : int The output size of the network. References ---------- U-Net: Convolutional Networks for Biomedical Image Segmentation"""
def __init__(self, in_ch... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class U_Net:
"""Derived Class to define a UNet Architecture of NN Attributes ---------- in_channels : int The input size of the network. n_classes : int The output size of the network. References ---------- U-Net: Convolutional Networks for Biomedical Image Segmentation"""
def __init__(self, in_channels=3, n_c... | the_stack_v2_python_sparse | segmentation/models/nn.py | Kivo0/vibotorch | train | 0 |
10269eff47ad40ae0f8d15ab2eb017361c460984 | [
"self.id = None\nself.name = name\nself.header = Header().get_header_auth_admin()",
"self.get_user_id()\npayload_block_user = {'id': self.id}\nprint('***********', payload_block_user)\nresponse = requests.post(URL_USERS['url_block_user'], data=json.dumps(payload_block_user), headers=self.header)\nprint(f'User {se... | <|body_start_0|>
self.id = None
self.name = name
self.header = Header().get_header_auth_admin()
<|end_body_0|>
<|body_start_1|>
self.get_user_id()
payload_block_user = {'id': self.id}
print('***********', payload_block_user)
response = requests.post(URL_USERS['ur... | Class to test User API | EditUserByAdmin | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EditUserByAdmin:
"""Class to test User API"""
def __init__(self, name):
"""Init new user data"""
<|body_0|>
def block(self):
"""Block user by name :param: username :type: str :param: header :type: instance of Header() :return: instance of response object"""
... | stack_v2_sparse_classes_10k_train_003979 | 10,445 | no_license | [
{
"docstring": "Init new user data",
"name": "__init__",
"signature": "def __init__(self, name)"
},
{
"docstring": "Block user by name :param: username :type: str :param: header :type: instance of Header() :return: instance of response object",
"name": "block",
"signature": "def block(se... | 5 | stack_v2_sparse_classes_30k_train_001340 | Implement the Python class `EditUserByAdmin` described below.
Class description:
Class to test User API
Method signatures and docstrings:
- def __init__(self, name): Init new user data
- def block(self): Block user by name :param: username :type: str :param: header :type: instance of Header() :return: instance of res... | Implement the Python class `EditUserByAdmin` described below.
Class description:
Class to test User API
Method signatures and docstrings:
- def __init__(self, name): Init new user data
- def block(self): Block user by name :param: username :type: str :param: header :type: instance of Header() :return: instance of res... | 14e7d28cb692e30df945b88841dfd0b3d24ed450 | <|skeleton|>
class EditUserByAdmin:
"""Class to test User API"""
def __init__(self, name):
"""Init new user data"""
<|body_0|>
def block(self):
"""Block user by name :param: username :type: str :param: header :type: instance of Header() :return: instance of response object"""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class EditUserByAdmin:
"""Class to test User API"""
def __init__(self, name):
"""Init new user data"""
self.id = None
self.name = name
self.header = Header().get_header_auth_admin()
def block(self):
"""Block user by name :param: username :type: str :param: header :t... | the_stack_v2_python_sparse | tests_api/testHelper.py | mehalyna/CH_096_TAQC | train | 1 |
aef305f631e46db5d8fbd4806647767151e789d7 | [
"if model._meta.app_label == 'syncwerk_server_models':\n return 'syncwerk-server'\nreturn None",
"if model._meta.app_label == 'syncwerk_server_models':\n return 'syncwerk-server'\nreturn None",
"if obj1._meta.app_label == 'syncwerk_server_models' or obj2._meta.app_label == 'syncwerk_server_models':\n r... | <|body_start_0|>
if model._meta.app_label == 'syncwerk_server_models':
return 'syncwerk-server'
return None
<|end_body_0|>
<|body_start_1|>
if model._meta.app_label == 'syncwerk_server_models':
return 'syncwerk-server'
return None
<|end_body_1|>
<|body_start_2|>... | A router to control all database operations on models related to syncwerk-server | SyncwerkServerModelsRouter | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SyncwerkServerModelsRouter:
"""A router to control all database operations on models related to syncwerk-server"""
def db_for_read(self, model, **hints):
"""Point all operations which has app_label='syncwerk_server_models' models to 'syncwerk-server'"""
<|body_0|>
def db... | stack_v2_sparse_classes_10k_train_003980 | 1,598 | permissive | [
{
"docstring": "Point all operations which has app_label='syncwerk_server_models' models to 'syncwerk-server'",
"name": "db_for_read",
"signature": "def db_for_read(self, model, **hints)"
},
{
"docstring": "Point all operations on syncwerk_server_models models to 'syncwerk-server'",
"name": ... | 4 | stack_v2_sparse_classes_30k_train_001015 | Implement the Python class `SyncwerkServerModelsRouter` described below.
Class description:
A router to control all database operations on models related to syncwerk-server
Method signatures and docstrings:
- def db_for_read(self, model, **hints): Point all operations which has app_label='syncwerk_server_models' mode... | Implement the Python class `SyncwerkServerModelsRouter` described below.
Class description:
A router to control all database operations on models related to syncwerk-server
Method signatures and docstrings:
- def db_for_read(self, model, **hints): Point all operations which has app_label='syncwerk_server_models' mode... | 13b3ed26a04248211ef91ca70dccc617be27a3c3 | <|skeleton|>
class SyncwerkServerModelsRouter:
"""A router to control all database operations on models related to syncwerk-server"""
def db_for_read(self, model, **hints):
"""Point all operations which has app_label='syncwerk_server_models' models to 'syncwerk-server'"""
<|body_0|>
def db... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SyncwerkServerModelsRouter:
"""A router to control all database operations on models related to syncwerk-server"""
def db_for_read(self, model, **hints):
"""Point all operations which has app_label='syncwerk_server_models' models to 'syncwerk-server'"""
if model._meta.app_label == 'syncwe... | the_stack_v2_python_sparse | fhs/usr/share/python/syncwerk/restapi/restapi/syncwerk_server_models/routers.py | syncwerk/syncwerk-server-restapi | train | 0 |
beaf1d281f37daf7409f336c2ff27968fc0f0e64 | [
"if x + y <= z or x + z <= y or y + z <= x:\n raise TriangleError('The triangle inequality failed.')\nself.sides = (x, y, z)",
"if self.sides[0] == self.sides[1] == self.sides[2]:\n return 'equilateral'\nelif self.sides[0] == self.sides[1] or self.sides[0] == self.sides[2] or self.sides[1] == self.sides[2]:... | <|body_start_0|>
if x + y <= z or x + z <= y or y + z <= x:
raise TriangleError('The triangle inequality failed.')
self.sides = (x, y, z)
<|end_body_0|>
<|body_start_1|>
if self.sides[0] == self.sides[1] == self.sides[2]:
return 'equilateral'
elif self.sides[0] =... | A triangle. | Triangle | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Triangle:
"""A triangle."""
def __init__(self, x, y, z):
"""Create a triangle. Args: x: The length of a side of a triangle. y: The length of a side of a triangle. z: The length of a side of a triangle. Raises: TriangleError: The triangle inequality failed."""
<|body_0|>
... | stack_v2_sparse_classes_10k_train_003981 | 1,095 | no_license | [
{
"docstring": "Create a triangle. Args: x: The length of a side of a triangle. y: The length of a side of a triangle. z: The length of a side of a triangle. Raises: TriangleError: The triangle inequality failed.",
"name": "__init__",
"signature": "def __init__(self, x, y, z)"
},
{
"docstring": ... | 2 | null | Implement the Python class `Triangle` described below.
Class description:
A triangle.
Method signatures and docstrings:
- def __init__(self, x, y, z): Create a triangle. Args: x: The length of a side of a triangle. y: The length of a side of a triangle. z: The length of a side of a triangle. Raises: TriangleError: Th... | Implement the Python class `Triangle` described below.
Class description:
A triangle.
Method signatures and docstrings:
- def __init__(self, x, y, z): Create a triangle. Args: x: The length of a side of a triangle. y: The length of a side of a triangle. z: The length of a side of a triangle. Raises: TriangleError: Th... | be0e2f635a7558f56c61bc0b36c6146b01d1e6e6 | <|skeleton|>
class Triangle:
"""A triangle."""
def __init__(self, x, y, z):
"""Create a triangle. Args: x: The length of a side of a triangle. y: The length of a side of a triangle. z: The length of a side of a triangle. Raises: TriangleError: The triangle inequality failed."""
<|body_0|>
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Triangle:
"""A triangle."""
def __init__(self, x, y, z):
"""Create a triangle. Args: x: The length of a side of a triangle. y: The length of a side of a triangle. z: The length of a side of a triangle. Raises: TriangleError: The triangle inequality failed."""
if x + y <= z or x + z <= y o... | the_stack_v2_python_sparse | all_data/exercism_data/python/triangle/638401889cd4482babbebb5553bd5b24.py | itsolutionscorp/AutoStyle-Clustering | train | 4 |
c94193bc12627234ed22ac1750e11ddc49b05da0 | [
"stats = self._generate_stats(host_state, filter_properties)\nLOG.debug(\"Driver Filter: Checking host '%s'\", stats['host_stats']['host'])\nresult = self._check_filter_function(stats)\nLOG.debug('Result: %s', result)\nLOG.debug(\"Done checking host '%s'\", stats['host_stats']['host'])\nreturn result",
"if stats[... | <|body_start_0|>
stats = self._generate_stats(host_state, filter_properties)
LOG.debug("Driver Filter: Checking host '%s'", stats['host_stats']['host'])
result = self._check_filter_function(stats)
LOG.debug('Result: %s', result)
LOG.debug("Done checking host '%s'", stats['host_st... | DriverFilter filters hosts based on a 'filter function' and metrics. DriverFilter filters based on share host's provided 'filter function' and metrics. | DriverFilter | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DriverFilter:
"""DriverFilter filters hosts based on a 'filter function' and metrics. DriverFilter filters based on share host's provided 'filter function' and metrics."""
def host_passes(self, host_state, filter_properties):
"""Determines whether a host has a passing filter_function... | stack_v2_sparse_classes_10k_train_003982 | 3,736 | permissive | [
{
"docstring": "Determines whether a host has a passing filter_function or not.",
"name": "host_passes",
"signature": "def host_passes(self, host_state, filter_properties)"
},
{
"docstring": "Checks if a share passes a host's filter function. Returns a tuple in the format (filter_passing, filter... | 4 | stack_v2_sparse_classes_30k_train_003574 | Implement the Python class `DriverFilter` described below.
Class description:
DriverFilter filters hosts based on a 'filter function' and metrics. DriverFilter filters based on share host's provided 'filter function' and metrics.
Method signatures and docstrings:
- def host_passes(self, host_state, filter_properties)... | Implement the Python class `DriverFilter` described below.
Class description:
DriverFilter filters hosts based on a 'filter function' and metrics. DriverFilter filters based on share host's provided 'filter function' and metrics.
Method signatures and docstrings:
- def host_passes(self, host_state, filter_properties)... | a93a844398a11a8a85f204782fb9456f7caccdbe | <|skeleton|>
class DriverFilter:
"""DriverFilter filters hosts based on a 'filter function' and metrics. DriverFilter filters based on share host's provided 'filter function' and metrics."""
def host_passes(self, host_state, filter_properties):
"""Determines whether a host has a passing filter_function... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DriverFilter:
"""DriverFilter filters hosts based on a 'filter function' and metrics. DriverFilter filters based on share host's provided 'filter function' and metrics."""
def host_passes(self, host_state, filter_properties):
"""Determines whether a host has a passing filter_function or not."""
... | the_stack_v2_python_sparse | manila/scheduler/filters/driver.py | openstack/manila | train | 178 |
774a2a03ed0ab64fc7423695c9375c0210c5c73b | [
"s = list(str(num))\nlastIndexes = {c: i for i, c in enumerate(s)}\nfor i, c in enumerate(s):\n for swap in range(9, int(c), -1):\n swapIdx = lastIndexes.get(str(swap), -1)\n if swapIdx > i:\n s[i], s[swapIdx] = (s[swapIdx], s[i])\n return int(''.join(s))\nreturn num",
"s = ... | <|body_start_0|>
s = list(str(num))
lastIndexes = {c: i for i, c in enumerate(s)}
for i, c in enumerate(s):
for swap in range(9, int(c), -1):
swapIdx = lastIndexes.get(str(swap), -1)
if swapIdx > i:
s[i], s[swapIdx] = (s[swapIdx], s... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maximumSwap(self, num: int) -> int:
"""1. Store each number's last occurred position to the lastIndexes list. 2. Scan the number from left to right. When the current digit has a larger digit in the remaining part, swap them."""
<|body_0|>
def maximumSwap2(self,... | stack_v2_sparse_classes_10k_train_003983 | 1,509 | no_license | [
{
"docstring": "1. Store each number's last occurred position to the lastIndexes list. 2. Scan the number from left to right. When the current digit has a larger digit in the remaining part, swap them.",
"name": "maximumSwap",
"signature": "def maximumSwap(self, num: int) -> int"
},
{
"docstring... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maximumSwap(self, num: int) -> int: 1. Store each number's last occurred position to the lastIndexes list. 2. Scan the number from left to right. When the current digit has a... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maximumSwap(self, num: int) -> int: 1. Store each number's last occurred position to the lastIndexes list. 2. Scan the number from left to right. When the current digit has a... | edb870f83f0c4568cce0cacec04ee70cf6b545bf | <|skeleton|>
class Solution:
def maximumSwap(self, num: int) -> int:
"""1. Store each number's last occurred position to the lastIndexes list. 2. Scan the number from left to right. When the current digit has a larger digit in the remaining part, swap them."""
<|body_0|>
def maximumSwap2(self,... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def maximumSwap(self, num: int) -> int:
"""1. Store each number's last occurred position to the lastIndexes list. 2. Scan the number from left to right. When the current digit has a larger digit in the remaining part, swap them."""
s = list(str(num))
lastIndexes = {c: i for i... | the_stack_v2_python_sparse | 2020/maximum_swap.py | eronekogin/leetcode | train | 0 | |
f54ec085be5c729407250033b3875df55ba4db9f | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn WorkbookRangeView()",
"from .entity import Entity\nfrom .json import Json\nfrom .entity import Entity\nfrom .json import Json\nfields: Dict[str, Callable[[Any], None]] = {'cellAddresses': lambda n: setattr(self, 'cell_addresses', n.get... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return WorkbookRangeView()
<|end_body_0|>
<|body_start_1|>
from .entity import Entity
from .json import Json
from .entity import Entity
from .json import Json
fields: Di... | WorkbookRangeView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WorkbookRangeView:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookRangeView:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object... | stack_v2_sparse_classes_10k_train_003984 | 5,332 | permissive | [
{
"docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: WorkbookRangeView",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_v... | 3 | null | Implement the Python class `WorkbookRangeView` described below.
Class description:
Implement the WorkbookRangeView class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookRangeView: Creates a new instance of the appropriate class based on discrim... | Implement the Python class `WorkbookRangeView` described below.
Class description:
Implement the WorkbookRangeView class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookRangeView: Creates a new instance of the appropriate class based on discrim... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class WorkbookRangeView:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookRangeView:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class WorkbookRangeView:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookRangeView:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Work... | the_stack_v2_python_sparse | msgraph/generated/models/workbook_range_view.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
13a255bc4b33d9542506d49d00c577abeb81950c | [
"self.wan_enabled = wan_enabled\nself.using_static_ip = using_static_ip\nself.static_ip = static_ip\nself.static_gateway_ip = static_gateway_ip\nself.static_subnet_mask = static_subnet_mask\nself.static_dns = static_dns\nself.vlan = vlan",
"if dictionary is None:\n return None\nwan_enabled = dictionary.get('wa... | <|body_start_0|>
self.wan_enabled = wan_enabled
self.using_static_ip = using_static_ip
self.static_ip = static_ip
self.static_gateway_ip = static_gateway_ip
self.static_subnet_mask = static_subnet_mask
self.static_dns = static_dns
self.vlan = vlan
<|end_body_0|>
... | Implementation of the 'Wan2' model. WAN 2 settings (only for MX devices) Attributes: wan_enabled (WanEnabledEnum): Enable or disable the interface (only for MX devices). Valid values are 'enabled', 'disabled', and 'not configured'. using_static_ip (bool): Configue the interface to have static IP settings or use DHCP. s... | Wan2Model | [
"MIT",
"Python-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Wan2Model:
"""Implementation of the 'Wan2' model. WAN 2 settings (only for MX devices) Attributes: wan_enabled (WanEnabledEnum): Enable or disable the interface (only for MX devices). Valid values are 'enabled', 'disabled', and 'not configured'. using_static_ip (bool): Configue the interface to h... | stack_v2_sparse_classes_10k_train_003985 | 3,300 | permissive | [
{
"docstring": "Constructor for the Wan2Model class",
"name": "__init__",
"signature": "def __init__(self, wan_enabled=None, using_static_ip=None, static_ip=None, static_gateway_ip=None, static_subnet_mask=None, static_dns=None, vlan=None)"
},
{
"docstring": "Creates an instance of this model fr... | 2 | stack_v2_sparse_classes_30k_train_005815 | Implement the Python class `Wan2Model` described below.
Class description:
Implementation of the 'Wan2' model. WAN 2 settings (only for MX devices) Attributes: wan_enabled (WanEnabledEnum): Enable or disable the interface (only for MX devices). Valid values are 'enabled', 'disabled', and 'not configured'. using_static... | Implement the Python class `Wan2Model` described below.
Class description:
Implementation of the 'Wan2' model. WAN 2 settings (only for MX devices) Attributes: wan_enabled (WanEnabledEnum): Enable or disable the interface (only for MX devices). Valid values are 'enabled', 'disabled', and 'not configured'. using_static... | 9894089eb013318243ae48869cc5130eb37f80c0 | <|skeleton|>
class Wan2Model:
"""Implementation of the 'Wan2' model. WAN 2 settings (only for MX devices) Attributes: wan_enabled (WanEnabledEnum): Enable or disable the interface (only for MX devices). Valid values are 'enabled', 'disabled', and 'not configured'. using_static_ip (bool): Configue the interface to h... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Wan2Model:
"""Implementation of the 'Wan2' model. WAN 2 settings (only for MX devices) Attributes: wan_enabled (WanEnabledEnum): Enable or disable the interface (only for MX devices). Valid values are 'enabled', 'disabled', and 'not configured'. using_static_ip (bool): Configue the interface to have static IP... | the_stack_v2_python_sparse | meraki_sdk/models/wan_2_model.py | RaulCatalano/meraki-python-sdk | train | 1 |
fd47fbcb6f96bb2e6802a7c970908086b90a8a4e | [
"dt_str = request.GET.get(get_dict_key)\ndt_parsed = None\nif dt_str:\n dt_parsed = parse_to_dt(dt_str, tzinfo_=get_current_timezone())\n if not dt_parsed:\n msg_parse_failed = msg_parse_failed or _('Failed to parse the timestamp. ({})')\n messages.warning(request, msg_parse_failed.format(dt_str... | <|body_start_0|>
dt_str = request.GET.get(get_dict_key)
dt_parsed = None
if dt_str:
dt_parsed = parse_to_dt(dt_str, tzinfo_=get_current_timezone())
if not dt_parsed:
msg_parse_failed = msg_parse_failed or _('Failed to parse the timestamp. ({})')
... | View to see the channel message stats. | ChannelMessageStatsView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChannelMessageStatsView:
"""View to see the channel message stats."""
def get_timestamp(request, get_dict_key, *, msg_parse_failed=None, msg_out_of_range=None) -> datetime:
"""Get the timestamp string in URL GET params of key ``get_dict_key`` and parse it to :class:`datetime`. :param... | stack_v2_sparse_classes_10k_train_003986 | 9,531 | permissive | [
{
"docstring": "Get the timestamp string in URL GET params of key ``get_dict_key`` and parse it to :class:`datetime`. :param request: web request to get URL param :param get_dict_key: key of the param :param msg_parse_failed: message to be displayed if failed to parse :param msg_out_of_range: message to be disp... | 2 | null | Implement the Python class `ChannelMessageStatsView` described below.
Class description:
View to see the channel message stats.
Method signatures and docstrings:
- def get_timestamp(request, get_dict_key, *, msg_parse_failed=None, msg_out_of_range=None) -> datetime: Get the timestamp string in URL GET params of key `... | Implement the Python class `ChannelMessageStatsView` described below.
Class description:
View to see the channel message stats.
Method signatures and docstrings:
- def get_timestamp(request, get_dict_key, *, msg_parse_failed=None, msg_out_of_range=None) -> datetime: Get the timestamp string in URL GET params of key `... | c7da1e91783dce3a2b71b955b3a22b68db9056cf | <|skeleton|>
class ChannelMessageStatsView:
"""View to see the channel message stats."""
def get_timestamp(request, get_dict_key, *, msg_parse_failed=None, msg_out_of_range=None) -> datetime:
"""Get the timestamp string in URL GET params of key ``get_dict_key`` and parse it to :class:`datetime`. :param... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ChannelMessageStatsView:
"""View to see the channel message stats."""
def get_timestamp(request, get_dict_key, *, msg_parse_failed=None, msg_out_of_range=None) -> datetime:
"""Get the timestamp string in URL GET params of key ``get_dict_key`` and parse it to :class:`datetime`. :param request: web... | the_stack_v2_python_sparse | JellyBot/views/info/msgstats.py | RxJellyBot/Jelly-Bot | train | 5 |
c6bc26e4b89f188750933739a534712cad0b282c | [
"result = get_coverage._get_oss_fuzz_latest_cov_report_info(self.PROJECT)\nself.assertEqual(result, {'coverage': 1})\nmock_error.assert_not_called()\nmock_get_json_from_url.assert_called_with(self.LATEST_REPORT_INFO_URL)",
"result = get_coverage._get_oss_fuzz_latest_cov_report_info('project')\nself.assertIsNone(r... | <|body_start_0|>
result = get_coverage._get_oss_fuzz_latest_cov_report_info(self.PROJECT)
self.assertEqual(result, {'coverage': 1})
mock_error.assert_not_called()
mock_get_json_from_url.assert_called_with(self.LATEST_REPORT_INFO_URL)
<|end_body_0|>
<|body_start_1|>
result = get_... | Tests that _get_oss_fuzz_latest_cov_report_info works as intended. | GetOssFuzzLatestCovReportInfo | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GetOssFuzzLatestCovReportInfo:
"""Tests that _get_oss_fuzz_latest_cov_report_info works as intended."""
def test_get_oss_fuzz_latest_cov_report_info(self, mock_get_json_from_url, mock_error):
"""Tests that _get_oss_fuzz_latest_cov_report_info works as intended."""
<|body_0|>
... | stack_v2_sparse_classes_10k_train_003987 | 9,610 | permissive | [
{
"docstring": "Tests that _get_oss_fuzz_latest_cov_report_info works as intended.",
"name": "test_get_oss_fuzz_latest_cov_report_info",
"signature": "def test_get_oss_fuzz_latest_cov_report_info(self, mock_get_json_from_url, mock_error)"
},
{
"docstring": "Tests that _get_oss_fuzz_latest_cov_re... | 2 | null | Implement the Python class `GetOssFuzzLatestCovReportInfo` described below.
Class description:
Tests that _get_oss_fuzz_latest_cov_report_info works as intended.
Method signatures and docstrings:
- def test_get_oss_fuzz_latest_cov_report_info(self, mock_get_json_from_url, mock_error): Tests that _get_oss_fuzz_latest_... | Implement the Python class `GetOssFuzzLatestCovReportInfo` described below.
Class description:
Tests that _get_oss_fuzz_latest_cov_report_info works as intended.
Method signatures and docstrings:
- def test_get_oss_fuzz_latest_cov_report_info(self, mock_get_json_from_url, mock_error): Tests that _get_oss_fuzz_latest_... | f0275421f84b8f80ee767fb9230134ac97cb687b | <|skeleton|>
class GetOssFuzzLatestCovReportInfo:
"""Tests that _get_oss_fuzz_latest_cov_report_info works as intended."""
def test_get_oss_fuzz_latest_cov_report_info(self, mock_get_json_from_url, mock_error):
"""Tests that _get_oss_fuzz_latest_cov_report_info works as intended."""
<|body_0|>
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GetOssFuzzLatestCovReportInfo:
"""Tests that _get_oss_fuzz_latest_cov_report_info works as intended."""
def test_get_oss_fuzz_latest_cov_report_info(self, mock_get_json_from_url, mock_error):
"""Tests that _get_oss_fuzz_latest_cov_report_info works as intended."""
result = get_coverage._g... | the_stack_v2_python_sparse | infra/cifuzz/get_coverage_test.py | google/oss-fuzz | train | 9,438 |
e348c5bffd35f16bbd71d083a51ddfe8b2dd4b60 | [
"match = DATA_MATCHER.match(self.raw_data)\nif not match:\n raise SampleException('Issmcnsm_flortdParserDataParticle: No regex match of parsed sample data [%s]', self.raw_data)\ntry:\n date_match = DATA_TIME_MATCHER.match(match.group(1))\n if not date_match:\n raise... | <|body_start_0|>
match = DATA_MATCHER.match(self.raw_data)
if not match:
raise SampleException('Issmcnsm_flortdParserDataParticle: No regex match of parsed sample data [%s]', self.raw_data)
try:
date_match = DATA_TIME_MATCHER.match(match.... | Class for parsing data from the issmcnsm_flort instrument | Issmcnsm_flortdParserDataParticle | [
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Issmcnsm_flortdParserDataParticle:
"""Class for parsing data from the issmcnsm_flort instrument"""
def _build_parsed_values(self):
"""Take something in the data format and turn it into a particle with the appropriate tag. @throws SampleException If there is a problem with sample crea... | stack_v2_sparse_classes_10k_train_003988 | 12,527 | permissive | [
{
"docstring": "Take something in the data format and turn it into a particle with the appropriate tag. @throws SampleException If there is a problem with sample creation",
"name": "_build_parsed_values",
"signature": "def _build_parsed_values(self)"
},
{
"docstring": "Quick equality check for t... | 2 | stack_v2_sparse_classes_30k_train_001895 | Implement the Python class `Issmcnsm_flortdParserDataParticle` described below.
Class description:
Class for parsing data from the issmcnsm_flort instrument
Method signatures and docstrings:
- def _build_parsed_values(self): Take something in the data format and turn it into a particle with the appropriate tag. @thro... | Implement the Python class `Issmcnsm_flortdParserDataParticle` described below.
Class description:
Class for parsing data from the issmcnsm_flort instrument
Method signatures and docstrings:
- def _build_parsed_values(self): Take something in the data format and turn it into a particle with the appropriate tag. @thro... | a1f2fa611b773cb2ae309fce7b9df2dec6d739d6 | <|skeleton|>
class Issmcnsm_flortdParserDataParticle:
"""Class for parsing data from the issmcnsm_flort instrument"""
def _build_parsed_values(self):
"""Take something in the data format and turn it into a particle with the appropriate tag. @throws SampleException If there is a problem with sample crea... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Issmcnsm_flortdParserDataParticle:
"""Class for parsing data from the issmcnsm_flort instrument"""
def _build_parsed_values(self):
"""Take something in the data format and turn it into a particle with the appropriate tag. @throws SampleException If there is a problem with sample creation"""
... | the_stack_v2_python_sparse | mi/dataset/parser/issmcnsm_flortd.py | AYCS/marine-integrations | train | 0 |
72ab859c207597c3d39c91a52bb33f152d60ac3b | [
"self.email = email\nself.password = password\nchrome_options = Options()\nself.bot = webdriver.Chrome(executable_path=os.path.join(os.getcwd(), 'chromedriver'), options=chrome_options)",
"bot = self.bot\nbot.get('https://twitter.com/login')\ntime.sleep(3)\nemail = bot.find_element_by_xpath('//*[@id =\"react-root... | <|body_start_0|>
self.email = email
self.password = password
chrome_options = Options()
self.bot = webdriver.Chrome(executable_path=os.path.join(os.getcwd(), 'chromedriver'), options=chrome_options)
<|end_body_0|>
<|body_start_1|>
bot = self.bot
bot.get('https://twitter.... | Twitterbot | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Twitterbot:
def __init__(self, email, password):
"""Constructor Arguments: email {string} -- registered twitter email password {string} -- password for the twitter account"""
<|body_0|>
def login(self):
"""Method for signing in the user with the provided email and pa... | stack_v2_sparse_classes_10k_train_003989 | 3,457 | no_license | [
{
"docstring": "Constructor Arguments: email {string} -- registered twitter email password {string} -- password for the twitter account",
"name": "__init__",
"signature": "def __init__(self, email, password)"
},
{
"docstring": "Method for signing in the user with the provided email and password.... | 3 | stack_v2_sparse_classes_30k_val_000020 | Implement the Python class `Twitterbot` described below.
Class description:
Implement the Twitterbot class.
Method signatures and docstrings:
- def __init__(self, email, password): Constructor Arguments: email {string} -- registered twitter email password {string} -- password for the twitter account
- def login(self)... | Implement the Python class `Twitterbot` described below.
Class description:
Implement the Twitterbot class.
Method signatures and docstrings:
- def __init__(self, email, password): Constructor Arguments: email {string} -- registered twitter email password {string} -- password for the twitter account
- def login(self)... | 4ebb168072ed4246aa1dde642e448b0a974a6603 | <|skeleton|>
class Twitterbot:
def __init__(self, email, password):
"""Constructor Arguments: email {string} -- registered twitter email password {string} -- password for the twitter account"""
<|body_0|>
def login(self):
"""Method for signing in the user with the provided email and pa... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Twitterbot:
def __init__(self, email, password):
"""Constructor Arguments: email {string} -- registered twitter email password {string} -- password for the twitter account"""
self.email = email
self.password = password
chrome_options = Options()
self.bot = webdriver.Chr... | the_stack_v2_python_sparse | twitterBot.py | FuckBrains/NewsPython | train | 0 | |
070ce3c336e3c96c0725cc26100d280c1a46dbf7 | [
"self.hash_set = defaultdict(list)\nfor i, w in enumerate(words):\n self.hash_set[w].append(i)",
"min_dis = float('Inf')\nfor idx in self.hash_set[word2]:\n insert_idx = bisect.bisect(self.hash_set[word1], idx)\n if insert_idx == 0:\n min_dis = min(min_dis, abs(idx - self.hash_set[word1][0]))\n ... | <|body_start_0|>
self.hash_set = defaultdict(list)
for i, w in enumerate(words):
self.hash_set[w].append(i)
<|end_body_0|>
<|body_start_1|>
min_dis = float('Inf')
for idx in self.hash_set[word2]:
insert_idx = bisect.bisect(self.hash_set[word1], idx)
i... | WordDistance | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WordDistance:
def __init__(self, words):
""":type words: List[str]"""
<|body_0|>
def shortest(self, word1, word2):
""":type word1: str :type word2: str :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.hash_set = defaultdict(list)
... | stack_v2_sparse_classes_10k_train_003990 | 1,113 | no_license | [
{
"docstring": ":type words: List[str]",
"name": "__init__",
"signature": "def __init__(self, words)"
},
{
"docstring": ":type word1: str :type word2: str :rtype: int",
"name": "shortest",
"signature": "def shortest(self, word1, word2)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004461 | Implement the Python class `WordDistance` described below.
Class description:
Implement the WordDistance class.
Method signatures and docstrings:
- def __init__(self, words): :type words: List[str]
- def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int | Implement the Python class `WordDistance` described below.
Class description:
Implement the WordDistance class.
Method signatures and docstrings:
- def __init__(self, words): :type words: List[str]
- def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int
<|skeleton|>
class WordDistance:
... | e42ec45d98f990d446bbf4f1a568b70855af5380 | <|skeleton|>
class WordDistance:
def __init__(self, words):
""":type words: List[str]"""
<|body_0|>
def shortest(self, word1, word2):
""":type word1: str :type word2: str :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class WordDistance:
def __init__(self, words):
""":type words: List[str]"""
self.hash_set = defaultdict(list)
for i, w in enumerate(words):
self.hash_set[w].append(i)
def shortest(self, word1, word2):
""":type word1: str :type word2: str :rtype: int"""
min_di... | the_stack_v2_python_sparse | wordDistance.py | LYoung-Hub/Algorithm-Data-Structure | train | 0 | |
f32b567fbb5784421eae8e19fe51d260b3c9010f | [
"self.capacity = capacity\nself.key_node = {}\nself.count_node = {}\nself.minV = None",
"if not key in self.key_node:\n return -1\nnode = self.key_node[key]\ndel self.count_node[node.count][key]\nif not self.count_node[node.count]:\n del self.count_node[node.count]\nnode.count += 1\nif not node.count in sel... | <|body_start_0|>
self.capacity = capacity
self.key_node = {}
self.count_node = {}
self.minV = None
<|end_body_0|>
<|body_start_1|>
if not key in self.key_node:
return -1
node = self.key_node[key]
del self.count_node[node.count][key]
if not sel... | 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: void"""
<|body_2|>
<|end_s... | stack_v2_sparse_classes_10k_train_003991 | 2,045 | 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: void",
"name": "pu... | 3 | stack_v2_sparse_classes_30k_train_002423 | 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: void | 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: void
<|sk... | 08b3d9cab3c1806c37d36587372b1e8fb1683f64 | <|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: void"""
<|body_2|>
<|end_s... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class LFUCache:
def __init__(self, capacity):
""":type capacity: int"""
self.capacity = capacity
self.key_node = {}
self.count_node = {}
self.minV = None
def get(self, key):
""":type key: int :rtype: int"""
if not key in self.key_node:
return ... | the_stack_v2_python_sparse | history/460.py | HonniLin/leetcode | train | 0 | |
f46989d4ad19be0294b5e48975f596d4f111f3b6 | [
"if not process.is_active:\n raise serializers.ValidationError('Process {} is not active.'.format(process))\nreturn process",
"if self.instance and self.instance.collection != collection:\n self.instance.validate_change_collection(collection)\nreturn collection",
"update_collection = 'collection' in valid... | <|body_start_0|>
if not process.is_active:
raise serializers.ValidationError('Process {} is not active.'.format(process))
return process
<|end_body_0|>
<|body_start_1|>
if self.instance and self.instance.collection != collection:
self.instance.validate_change_collection(... | Serializer for Data objects. | DataSerializer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataSerializer:
"""Serializer for Data objects."""
def validate_process(self, process):
"""Check that process is active."""
<|body_0|>
def validate_collection(self, collection):
"""Verify that changing collection is done in the right place."""
<|body_1|>
... | stack_v2_sparse_classes_10k_train_003992 | 3,632 | permissive | [
{
"docstring": "Check that process is active.",
"name": "validate_process",
"signature": "def validate_process(self, process)"
},
{
"docstring": "Verify that changing collection is done in the right place.",
"name": "validate_collection",
"signature": "def validate_collection(self, colle... | 3 | stack_v2_sparse_classes_30k_train_000886 | Implement the Python class `DataSerializer` described below.
Class description:
Serializer for Data objects.
Method signatures and docstrings:
- def validate_process(self, process): Check that process is active.
- def validate_collection(self, collection): Verify that changing collection is done in the right place.
-... | Implement the Python class `DataSerializer` described below.
Class description:
Serializer for Data objects.
Method signatures and docstrings:
- def validate_process(self, process): Check that process is active.
- def validate_collection(self, collection): Verify that changing collection is done in the right place.
-... | 25c0c45235ef37beb45c1af4c917fbbae6282016 | <|skeleton|>
class DataSerializer:
"""Serializer for Data objects."""
def validate_process(self, process):
"""Check that process is active."""
<|body_0|>
def validate_collection(self, collection):
"""Verify that changing collection is done in the right place."""
<|body_1|>
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DataSerializer:
"""Serializer for Data objects."""
def validate_process(self, process):
"""Check that process is active."""
if not process.is_active:
raise serializers.ValidationError('Process {} is not active.'.format(process))
return process
def validate_collect... | the_stack_v2_python_sparse | resolwe/flow/serializers/data.py | genialis/resolwe | train | 35 |
aa2c75bb2e83a0bfb4e2e58f3dc2a96af5e910a6 | [
"if len(s) <= 1:\n return s\n\ndef isPalindrome(sub):\n if sub == sub[::-1]:\n return True\nfor l in range(len(s), -1, -1):\n for head in range(len(s) - l):\n tail = head + l + 1\n if isPalindrome(s[head:tail]):\n return s[head:tail]",
"max_palindrome = ''\nfor i in range(... | <|body_start_0|>
if len(s) <= 1:
return s
def isPalindrome(sub):
if sub == sub[::-1]:
return True
for l in range(len(s), -1, -1):
for head in range(len(s) - l):
tail = head + l + 1
if isPalindrome(s[head:tail]):... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def longestPalindrome(self, s):
""":type s: str :rtype: str"""
<|body_0|>
def longestPalindrome(self, s: str) -> str:
"""This solution is similar to O(n^3) bruteforce, but uses approach that we doesn't need to check substrings shorter than current max_palin... | stack_v2_sparse_classes_10k_train_003993 | 2,296 | no_license | [
{
"docstring": ":type s: str :rtype: str",
"name": "longestPalindrome",
"signature": "def longestPalindrome(self, s)"
},
{
"docstring": "This solution is similar to O(n^3) bruteforce, but uses approach that we doesn't need to check substrings shorter than current max_palindrom. On each iteration... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestPalindrome(self, s): :type s: str :rtype: str
- def longestPalindrome(self, s: str) -> str: This solution is similar to O(n^3) bruteforce, but uses approach that we do... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestPalindrome(self, s): :type s: str :rtype: str
- def longestPalindrome(self, s: str) -> str: This solution is similar to O(n^3) bruteforce, but uses approach that we do... | 92b4b7c6b69d39bf79a9e20a9fc947304c2a1de5 | <|skeleton|>
class Solution:
def longestPalindrome(self, s):
""":type s: str :rtype: str"""
<|body_0|>
def longestPalindrome(self, s: str) -> str:
"""This solution is similar to O(n^3) bruteforce, but uses approach that we doesn't need to check substrings shorter than current max_palin... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def longestPalindrome(self, s):
""":type s: str :rtype: str"""
if len(s) <= 1:
return s
def isPalindrome(sub):
if sub == sub[::-1]:
return True
for l in range(len(s), -1, -1):
for head in range(len(s) - l):
... | the_stack_v2_python_sparse | leet_0005_longest_palindromic_substring.py | kkaixiao/pythonalgo2 | train | 2 | |
59b0a26114af22dbfaee93ff23ee86ca39e2fdf5 | [
"probabilities = []\nlist_theoretical_amplitude = []\nbest_algorithms = []\nconfigurations = []\nlist_number_calls_made = []\nimprovements = []\nfor eta_group in self._eta_groups:\n self._global_eta_group = eta_group\n result = self._compute_theoretical_best_configuration()\n best_algorithms.append(result[... | <|body_start_0|>
probabilities = []
list_theoretical_amplitude = []
best_algorithms = []
configurations = []
list_number_calls_made = []
improvements = []
for eta_group in self._eta_groups:
self._global_eta_group = eta_group
result = self._... | Representation of the theoretical One Shot Optimization | TheoreticalOneShotEntangledOptimization | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TheoreticalOneShotEntangledOptimization:
"""Representation of the theoretical One Shot Optimization"""
def compute_theoretical_optimal_results(self) -> TheoreticalOneShotEntangledOptimalConfigurations:
"""Finds out the theoretical optimal entangled configuration for each pair of atte... | stack_v2_sparse_classes_10k_train_003994 | 3,912 | permissive | [
{
"docstring": "Finds out the theoretical optimal entangled configuration for each pair of attenuation levels",
"name": "compute_theoretical_optimal_results",
"signature": "def compute_theoretical_optimal_results(self) -> TheoreticalOneShotEntangledOptimalConfigurations"
},
{
"docstring": "Find ... | 2 | stack_v2_sparse_classes_30k_train_002003 | Implement the Python class `TheoreticalOneShotEntangledOptimization` described below.
Class description:
Representation of the theoretical One Shot Optimization
Method signatures and docstrings:
- def compute_theoretical_optimal_results(self) -> TheoreticalOneShotEntangledOptimalConfigurations: Finds out the theoreti... | Implement the Python class `TheoreticalOneShotEntangledOptimization` described below.
Class description:
Representation of the theoretical One Shot Optimization
Method signatures and docstrings:
- def compute_theoretical_optimal_results(self) -> TheoreticalOneShotEntangledOptimalConfigurations: Finds out the theoreti... | ea37fca21fc4c8cf7ac6a39b3a6666e8a4fe5a19 | <|skeleton|>
class TheoreticalOneShotEntangledOptimization:
"""Representation of the theoretical One Shot Optimization"""
def compute_theoretical_optimal_results(self) -> TheoreticalOneShotEntangledOptimalConfigurations:
"""Finds out the theoretical optimal entangled configuration for each pair of atte... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TheoreticalOneShotEntangledOptimization:
"""Representation of the theoretical One Shot Optimization"""
def compute_theoretical_optimal_results(self) -> TheoreticalOneShotEntangledOptimalConfigurations:
"""Finds out the theoretical optimal entangled configuration for each pair of attenuation level... | the_stack_v2_python_sparse | qcd/optimizations/theoreticaloneshotentangledoptimization.py | iamtxena/quantum-channel-discrimination | train | 0 |
1036498147f14bccdfa76f5b24674eddbedbc46d | [
"super().__init__()\nself._v_c = nn.Parameter(torch.Tensor(context_dim))\nself._v_s = nn.Parameter(torch.Tensor(state_dim))\nself._v_i = nn.Parameter(torch.Tensor(input_dim))\ninit.uniform_(self._v_c, -INIT, INIT)\ninit.uniform_(self._v_s, -INIT, INIT)\ninit.uniform_(self._v_i, -INIT, INIT)\nif bias:\n self._b =... | <|body_start_0|>
super().__init__()
self._v_c = nn.Parameter(torch.Tensor(context_dim))
self._v_s = nn.Parameter(torch.Tensor(state_dim))
self._v_i = nn.Parameter(torch.Tensor(input_dim))
init.uniform_(self._v_c, -INIT, INIT)
init.uniform_(self._v_s, -INIT, INIT)
... | _CopyLinear | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _CopyLinear:
def __init__(self, context_dim, state_dim, input_dim, bias=True):
"""Pgen生成 :param context_dim: N 256 :param state_dim: N 256 :param input_dim: N 256 :param bias:"""
<|body_0|>
def forward(self, context, state, input_):
"""copy概率计算 :param context: [B,N] ... | stack_v2_sparse_classes_10k_train_003995 | 14,365 | permissive | [
{
"docstring": "Pgen生成 :param context_dim: N 256 :param state_dim: N 256 :param input_dim: N 256 :param bias:",
"name": "__init__",
"signature": "def __init__(self, context_dim, state_dim, input_dim, bias=True)"
},
{
"docstring": "copy概率计算 :param context: [B,N] 由注意力和解码器输出生成context :param state: ... | 2 | stack_v2_sparse_classes_30k_train_002137 | Implement the Python class `_CopyLinear` described below.
Class description:
Implement the _CopyLinear class.
Method signatures and docstrings:
- def __init__(self, context_dim, state_dim, input_dim, bias=True): Pgen生成 :param context_dim: N 256 :param state_dim: N 256 :param input_dim: N 256 :param bias:
- def forwar... | Implement the Python class `_CopyLinear` described below.
Class description:
Implement the _CopyLinear class.
Method signatures and docstrings:
- def __init__(self, context_dim, state_dim, input_dim, bias=True): Pgen生成 :param context_dim: N 256 :param state_dim: N 256 :param input_dim: N 256 :param bias:
- def forwar... | 527f32d49887f06eee357c83bb6a9a21edc69bc5 | <|skeleton|>
class _CopyLinear:
def __init__(self, context_dim, state_dim, input_dim, bias=True):
"""Pgen生成 :param context_dim: N 256 :param state_dim: N 256 :param input_dim: N 256 :param bias:"""
<|body_0|>
def forward(self, context, state, input_):
"""copy概率计算 :param context: [B,N] ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class _CopyLinear:
def __init__(self, context_dim, state_dim, input_dim, bias=True):
"""Pgen生成 :param context_dim: N 256 :param state_dim: N 256 :param input_dim: N 256 :param bias:"""
super().__init__()
self._v_c = nn.Parameter(torch.Tensor(context_dim))
self._v_s = nn.Parameter(tor... | the_stack_v2_python_sparse | src/library/text/modules/copynet.py | inessus/ai-skills | train | 5 | |
3a3d1453b12d0be1b5d685b03262dd44f4176f80 | [
"self.d = defaultdict(lambda: 0)\nfor i in range(len(sentences)):\n self.d[sentences[i]] = times[i]\nself.c = ''",
"if c == '#':\n self.d[self.c] += 1\n self.c = ''\n return []\nif self.c == '':\n self.x = self.d.items()\nself.c += c\ntmp = []\ndd = [False] * len(self.x)\nfor i in range(len(self.x)... | <|body_start_0|>
self.d = defaultdict(lambda: 0)
for i in range(len(sentences)):
self.d[sentences[i]] = times[i]
self.c = ''
<|end_body_0|>
<|body_start_1|>
if c == '#':
self.d[self.c] += 1
self.c = ''
return []
if self.c == '':
... | AutocompleteSystem | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AutocompleteSystem:
def __init__(self, sentences, times):
""":type sentences: List[str] :type times: List[int]"""
<|body_0|>
def input(self, c):
""":type c: str :rtype: List[str]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.d = defaultdict(l... | stack_v2_sparse_classes_10k_train_003996 | 1,121 | no_license | [
{
"docstring": ":type sentences: List[str] :type times: List[int]",
"name": "__init__",
"signature": "def __init__(self, sentences, times)"
},
{
"docstring": ":type c: str :rtype: List[str]",
"name": "input",
"signature": "def input(self, c)"
}
] | 2 | null | Implement the Python class `AutocompleteSystem` described below.
Class description:
Implement the AutocompleteSystem class.
Method signatures and docstrings:
- def __init__(self, sentences, times): :type sentences: List[str] :type times: List[int]
- def input(self, c): :type c: str :rtype: List[str] | Implement the Python class `AutocompleteSystem` described below.
Class description:
Implement the AutocompleteSystem class.
Method signatures and docstrings:
- def __init__(self, sentences, times): :type sentences: List[str] :type times: List[int]
- def input(self, c): :type c: str :rtype: List[str]
<|skeleton|>
cla... | db64a67869aae4f0e55e78b65a7e04f5bc2e671c | <|skeleton|>
class AutocompleteSystem:
def __init__(self, sentences, times):
""":type sentences: List[str] :type times: List[int]"""
<|body_0|>
def input(self, c):
""":type c: str :rtype: List[str]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AutocompleteSystem:
def __init__(self, sentences, times):
""":type sentences: List[str] :type times: List[int]"""
self.d = defaultdict(lambda: 0)
for i in range(len(sentences)):
self.d[sentences[i]] = times[i]
self.c = ''
def input(self, c):
""":type c:... | the_stack_v2_python_sparse | Questiondir/642.design-search-autocomplete-system/642.design-search-autocomplete-system_109800155.py | cczhong11/Leetcode-contest-code-downloader | train | 0 | |
b8a7284ede1736ed8b7dad09018242b411d9b883 | [
"integration_id = request.GET.get('integrationId')\nqueryset = RepositoryProjectPathConfig.objects.all()\nif integration_id:\n org_integration = self.get_organization_integration(organization, integration_id)\n queryset = queryset.filter(organization_integration=org_integration)\nelse:\n projects = self.ge... | <|body_start_0|>
integration_id = request.GET.get('integrationId')
queryset = RepositoryProjectPathConfig.objects.all()
if integration_id:
org_integration = self.get_organization_integration(organization, integration_id)
queryset = queryset.filter(organization_integration... | OrganizationCodeMappingsEndpoint | [
"Apache-2.0",
"BUSL-1.1"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OrganizationCodeMappingsEndpoint:
def get(self, request: Request, organization) -> Response:
"""Get the list of repository project path configs :pparam string organization_slug: the slug of the organization the team should be created for. :qparam int integrationId: the optional integrati... | stack_v2_sparse_classes_10k_train_003997 | 7,699 | permissive | [
{
"docstring": "Get the list of repository project path configs :pparam string organization_slug: the slug of the organization the team should be created for. :qparam int integrationId: the optional integration id. :qparam int project: Optional. Pass \"-1\" to filter to 'all projects user has access to'. Omit t... | 2 | stack_v2_sparse_classes_30k_train_001686 | Implement the Python class `OrganizationCodeMappingsEndpoint` described below.
Class description:
Implement the OrganizationCodeMappingsEndpoint class.
Method signatures and docstrings:
- def get(self, request: Request, organization) -> Response: Get the list of repository project path configs :pparam string organiza... | Implement the Python class `OrganizationCodeMappingsEndpoint` described below.
Class description:
Implement the OrganizationCodeMappingsEndpoint class.
Method signatures and docstrings:
- def get(self, request: Request, organization) -> Response: Get the list of repository project path configs :pparam string organiza... | d9dd4f382f96b5c4576b64cbf015db651556c18b | <|skeleton|>
class OrganizationCodeMappingsEndpoint:
def get(self, request: Request, organization) -> Response:
"""Get the list of repository project path configs :pparam string organization_slug: the slug of the organization the team should be created for. :qparam int integrationId: the optional integrati... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class OrganizationCodeMappingsEndpoint:
def get(self, request: Request, organization) -> Response:
"""Get the list of repository project path configs :pparam string organization_slug: the slug of the organization the team should be created for. :qparam int integrationId: the optional integration id. :qparam... | the_stack_v2_python_sparse | src/sentry/api/endpoints/organization_code_mappings.py | nagyist/sentry | train | 0 | |
e457b140a10b558983129b901b5b7bef5594ae9a | [
"encoding = []\nfor s in strs:\n len_s = str(len(s))\n encoding.append(len_s)\n encoding.append('*')\n encoding.append(s)\nreturn ''.join(encoding)",
"decoding = []\ni = 0\nwhile i < len(s):\n j = s.find('*', i)\n len_substring = int(s[i:j])\n decoding.append(s[j + 1:j + 1 + len_substring])\n... | <|body_start_0|>
encoding = []
for s in strs:
len_s = str(len(s))
encoding.append(len_s)
encoding.append('*')
encoding.append(s)
return ''.join(encoding)
<|end_body_0|>
<|body_start_1|>
decoding = []
i = 0
while i < len(s):... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def encode(self, strs):
"""Encodes a list of strings to a single string. :type strs: List[str] :rtype: str"""
<|body_0|>
def decode(self, s):
"""Decodes a single string to a list of strings. :type s: str :rtype: List[str]"""
<|body_1|>
<|end_skeleton|... | stack_v2_sparse_classes_10k_train_003998 | 1,708 | no_license | [
{
"docstring": "Encodes a list of strings to a single string. :type strs: List[str] :rtype: str",
"name": "encode",
"signature": "def encode(self, strs)"
},
{
"docstring": "Decodes a single string to a list of strings. :type s: str :rtype: List[str]",
"name": "decode",
"signature": "def ... | 2 | null | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def encode(self, strs): Encodes a list of strings to a single string. :type strs: List[str] :rtype: str
- def decode(self, s): Decodes a single string to a list of strings. :type s: st... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def encode(self, strs): Encodes a list of strings to a single string. :type strs: List[str] :rtype: str
- def decode(self, s): Decodes a single string to a list of strings. :type s: st... | 05e0beff0047f0ad399d0b46d625bb8d3459814e | <|skeleton|>
class Codec:
def encode(self, strs):
"""Encodes a list of strings to a single string. :type strs: List[str] :rtype: str"""
<|body_0|>
def decode(self, s):
"""Decodes a single string to a list of strings. :type s: str :rtype: List[str]"""
<|body_1|>
<|end_skeleton|... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Codec:
def encode(self, strs):
"""Encodes a list of strings to a single string. :type strs: List[str] :rtype: str"""
encoding = []
for s in strs:
len_s = str(len(s))
encoding.append(len_s)
encoding.append('*')
encoding.append(s)
r... | the_stack_v2_python_sparse | python_1_to_1000/271_Encode_and_Decode_Strings.py | jakehoare/leetcode | train | 58 | |
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_10k_train_003999 | 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_train_000940 | 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_10k | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.