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
d2f3d49bf5f78ff8cb305248996145feb19f8f8a
[ "commission_df = self.capital.commission.commission_df\ncommission_df['commission'] = commission_df.commission.astype(float)\ncommission_df['cumsum'] = commission_df.commission.cumsum()\n'\\n eg:\\n type\\tdate\\tsymbol\\tcommission\\tcumsum\\n 0\\tbuy\\t20141024\\tusAAPL\\t19.0...
<|body_start_0|> commission_df = self.capital.commission.commission_df commission_df['commission'] = commission_df.commission.astype(float) commission_df['cumsum'] = commission_df.commission.cumsum() '\n eg:\n type\tdate\tsymbol\tcommission\tcumsum\n ...
扩展自定义度量类示例 eg: metrics = MetricsDemo(*abu_result_tuple) metrics.fit_metrics() metrics.plot_commission()
MetricsDemo
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MetricsDemo: """扩展自定义度量类示例 eg: metrics = MetricsDemo(*abu_result_tuple) metrics.fit_metrics() metrics.plot_commission()""" def _metrics_extend_stats(self): """子类可扩展的metrics方法,子类在此方法中可定义自己需要度量的值: 本demo示例交易手续费和策略收益之间的度量对比""" <|body_0|> def plot_commission(self): ""...
stack_v2_sparse_classes_10k_train_007800
27,337
permissive
[ { "docstring": "子类可扩展的metrics方法,子类在此方法中可定义自己需要度量的值: 本demo示例交易手续费和策略收益之间的度量对比", "name": "_metrics_extend_stats", "signature": "def _metrics_extend_stats(self)" }, { "docstring": "使用计算好的首先费cumsum序列和策略收益cumsum序列进行可视化对比 可视化收益曲线和手续费曲线之前的关系", "name": "plot_commission", "signature": "def plot_c...
2
null
Implement the Python class `MetricsDemo` described below. Class description: 扩展自定义度量类示例 eg: metrics = MetricsDemo(*abu_result_tuple) metrics.fit_metrics() metrics.plot_commission() Method signatures and docstrings: - def _metrics_extend_stats(self): 子类可扩展的metrics方法,子类在此方法中可定义自己需要度量的值: 本demo示例交易手续费和策略收益之间的度量对比 - def p...
Implement the Python class `MetricsDemo` described below. Class description: 扩展自定义度量类示例 eg: metrics = MetricsDemo(*abu_result_tuple) metrics.fit_metrics() metrics.plot_commission() Method signatures and docstrings: - def _metrics_extend_stats(self): 子类可扩展的metrics方法,子类在此方法中可定义自己需要度量的值: 本demo示例交易手续费和策略收益之间的度量对比 - def p...
2e5ab17f2d20deb3c68c927f6208ea89db7c639d
<|skeleton|> class MetricsDemo: """扩展自定义度量类示例 eg: metrics = MetricsDemo(*abu_result_tuple) metrics.fit_metrics() metrics.plot_commission()""" def _metrics_extend_stats(self): """子类可扩展的metrics方法,子类在此方法中可定义自己需要度量的值: 本demo示例交易手续费和策略收益之间的度量对比""" <|body_0|> def plot_commission(self): ""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MetricsDemo: """扩展自定义度量类示例 eg: metrics = MetricsDemo(*abu_result_tuple) metrics.fit_metrics() metrics.plot_commission()""" def _metrics_extend_stats(self): """子类可扩展的metrics方法,子类在此方法中可定义自己需要度量的值: 本demo示例交易手续费和策略收益之间的度量对比""" commission_df = self.capital.commission.commission_df comm...
the_stack_v2_python_sparse
abupy/MetricsBu/ABuMetricsBase.py
luqin/firefly
train
1
93c94f963dd159afc1f0022f299cde4d76d96c02
[ "base_env = _DiscreteEnvironmentOneReward(action_dtype=np.int64, reward_spec=specs.Array(dtype=np.float32, shape=()))\nwrapped_env = wrappers.DelayedRewardWrapper(base_env, accumulation_period=1)\nbase_episode_reward = _episode_reward(base_env)\nwrapped_episode_reward = _episode_reward(wrapped_env)\nself.assertEqua...
<|body_start_0|> base_env = _DiscreteEnvironmentOneReward(action_dtype=np.int64, reward_spec=specs.Array(dtype=np.float32, shape=())) wrapped_env = wrappers.DelayedRewardWrapper(base_env, accumulation_period=1) base_episode_reward = _episode_reward(base_env) wrapped_episode_reward = _epi...
DelayedRewardTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DelayedRewardTest: def test_noop(self): """Ensure when accumulation_period=1 it does not change anything.""" <|body_0|> def test_noop_composite_reward(self): """No-op test with composite rewards.""" <|body_1|> def test_same_episode_composite_reward(self,...
stack_v2_sparse_classes_10k_train_007801
3,312
permissive
[ { "docstring": "Ensure when accumulation_period=1 it does not change anything.", "name": "test_noop", "signature": "def test_noop(self)" }, { "docstring": "No-op test with composite rewards.", "name": "test_noop_composite_reward", "signature": "def test_noop_composite_reward(self)" }, ...
3
stack_v2_sparse_classes_30k_train_000031
Implement the Python class `DelayedRewardTest` described below. Class description: Implement the DelayedRewardTest class. Method signatures and docstrings: - def test_noop(self): Ensure when accumulation_period=1 it does not change anything. - def test_noop_composite_reward(self): No-op test with composite rewards. -...
Implement the Python class `DelayedRewardTest` described below. Class description: Implement the DelayedRewardTest class. Method signatures and docstrings: - def test_noop(self): Ensure when accumulation_period=1 it does not change anything. - def test_noop_composite_reward(self): No-op test with composite rewards. -...
97c50eaa62c039d8f4b9efa3e80c4d80e6f40c4c
<|skeleton|> class DelayedRewardTest: def test_noop(self): """Ensure when accumulation_period=1 it does not change anything.""" <|body_0|> def test_noop_composite_reward(self): """No-op test with composite rewards.""" <|body_1|> def test_same_episode_composite_reward(self,...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DelayedRewardTest: def test_noop(self): """Ensure when accumulation_period=1 it does not change anything.""" base_env = _DiscreteEnvironmentOneReward(action_dtype=np.int64, reward_spec=specs.Array(dtype=np.float32, shape=())) wrapped_env = wrappers.DelayedRewardWrapper(base_env, accumu...
the_stack_v2_python_sparse
acme/wrappers/delayed_reward_test.py
RaoulDrake/acme
train
0
eb203bc93476b7b993df8e1b31c573a6242be77d
[ "sum_1 = 0\nstack = []\nfor i, h in enumerate(height):\n if not stack and h == 0:\n continue\n elif not stack or stack[-1][-1] > h:\n stack.append([i, h])\n else:\n lists = []\n while stack and stack[-1][-1] <= h:\n lists.append(stack.pop())\n if not stack:\n ...
<|body_start_0|> sum_1 = 0 stack = [] for i, h in enumerate(height): if not stack and h == 0: continue elif not stack or stack[-1][-1] > h: stack.append([i, h]) else: lists = [] while stack and st...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def trap(self, height): """:type height: List[int] :rtype: int 68ms""" <|body_0|> def trap_1(self, height): """:type height: List[int] :rtype: int 59ms""" <|body_1|> def trap_2(self, height): """:type height: List[int] :rtype: int 49ms"...
stack_v2_sparse_classes_10k_train_007802
2,988
no_license
[ { "docstring": ":type height: List[int] :rtype: int 68ms", "name": "trap", "signature": "def trap(self, height)" }, { "docstring": ":type height: List[int] :rtype: int 59ms", "name": "trap_1", "signature": "def trap_1(self, height)" }, { "docstring": ":type height: List[int] :rty...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def trap(self, height): :type height: List[int] :rtype: int 68ms - def trap_1(self, height): :type height: List[int] :rtype: int 59ms - def trap_2(self, height): :type height: Li...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def trap(self, height): :type height: List[int] :rtype: int 68ms - def trap_1(self, height): :type height: List[int] :rtype: int 59ms - def trap_2(self, height): :type height: Li...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def trap(self, height): """:type height: List[int] :rtype: int 68ms""" <|body_0|> def trap_1(self, height): """:type height: List[int] :rtype: int 59ms""" <|body_1|> def trap_2(self, height): """:type height: List[int] :rtype: int 49ms"...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def trap(self, height): """:type height: List[int] :rtype: int 68ms""" sum_1 = 0 stack = [] for i, h in enumerate(height): if not stack and h == 0: continue elif not stack or stack[-1][-1] > h: stack.append([i, h...
the_stack_v2_python_sparse
TrappingRainWater_HARD_42.py
953250587/leetcode-python
train
2
419312cb8dc2220351eab71ae3594c7d722cba4b
[ "n_features = self.n_features\nplaceholder_scope = TensorflowGraph.get_placeholder_scope(graph, name_scopes)\nwith graph.as_default():\n with placeholder_scope:\n self.mol_features = tf.placeholder(tf.float32, shape=[None, n_features], name='mol_features')\n layer_sizes = self.layer_sizes\n weight_i...
<|body_start_0|> n_features = self.n_features placeholder_scope = TensorflowGraph.get_placeholder_scope(graph, name_scopes) with graph.as_default(): with placeholder_scope: self.mol_features = tf.placeholder(tf.float32, shape=[None, n_features], name='mol_features') ...
Implements an icml model as configured in a model_config.proto.
TensorflowMultiTaskRegressor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TensorflowMultiTaskRegressor: """Implements an icml model as configured in a model_config.proto.""" def build(self, graph, name_scopes, training): """Constructs the graph architecture as specified in its config. This method creates the following Placeholders: mol_features: Molecule d...
stack_v2_sparse_classes_10k_train_007803
32,492
permissive
[ { "docstring": "Constructs the graph architecture as specified in its config. This method creates the following Placeholders: mol_features: Molecule descriptor (e.g. fingerprint) tensor with shape batch_size x n_features.", "name": "build", "signature": "def build(self, graph, name_scopes, training)" ...
2
stack_v2_sparse_classes_30k_train_000446
Implement the Python class `TensorflowMultiTaskRegressor` described below. Class description: Implements an icml model as configured in a model_config.proto. Method signatures and docstrings: - def build(self, graph, name_scopes, training): Constructs the graph architecture as specified in its config. This method cre...
Implement the Python class `TensorflowMultiTaskRegressor` described below. Class description: Implements an icml model as configured in a model_config.proto. Method signatures and docstrings: - def build(self, graph, name_scopes, training): Constructs the graph architecture as specified in its config. This method cre...
ee6e67ebcf7bf04259cf13aff6388e2b791fea3d
<|skeleton|> class TensorflowMultiTaskRegressor: """Implements an icml model as configured in a model_config.proto.""" def build(self, graph, name_scopes, training): """Constructs the graph architecture as specified in its config. This method creates the following Placeholders: mol_features: Molecule d...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TensorflowMultiTaskRegressor: """Implements an icml model as configured in a model_config.proto.""" def build(self, graph, name_scopes, training): """Constructs the graph architecture as specified in its config. This method creates the following Placeholders: mol_features: Molecule descriptor (e....
the_stack_v2_python_sparse
contrib/atomicconv/models/legacy.py
deepchem/deepchem
train
4,876
98146c796c1d61f4f9a8de0d548ecabe5c3284b9
[ "super(NeRFNetwork, self).__init__()\nself.device = device\nself.in_dim = in_dim\nself.hidden_dim = hidden_dim\nself.rgb_dim = rgb_dim\nself.style_dim = style_dim\nself.hidden_layers = hidden_layers\nself.name_prefix = name_prefix\nself.style_dim_dict = {}\nself.network = nn.ModuleList()\n_out_dim = in_dim\nfor idx...
<|body_start_0|> super(NeRFNetwork, self).__init__() self.device = device self.in_dim = in_dim self.hidden_dim = hidden_dim self.rgb_dim = rgb_dim self.style_dim = style_dim self.hidden_layers = hidden_layers self.name_prefix = name_prefix self.sty...
Same architecture as TALLSIREN but adds a UniformBoxWarp to map input points to -1, 1
NeRFNetwork_Small
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NeRFNetwork_Small: """Same architecture as TALLSIREN but adds a UniformBoxWarp to map input points to -1, 1""" def __init__(self, in_dim=3, hidden_dim=256, rgb_dim=3, style_dim=512, hidden_layers=2, device=None, name_prefix='nerf', **kwargs): """:param z_dim: :param hidden_dim: :para...
stack_v2_sparse_classes_10k_train_007804
22,624
permissive
[ { "docstring": ":param z_dim: :param hidden_dim: :param rgb_dim: :param device: :param kwargs:", "name": "__init__", "signature": "def __init__(self, in_dim=3, hidden_dim=256, rgb_dim=3, style_dim=512, hidden_layers=2, device=None, name_prefix='nerf', **kwargs)" }, { "docstring": ":param input: ...
2
stack_v2_sparse_classes_30k_train_001258
Implement the Python class `NeRFNetwork_Small` described below. Class description: Same architecture as TALLSIREN but adds a UniformBoxWarp to map input points to -1, 1 Method signatures and docstrings: - def __init__(self, in_dim=3, hidden_dim=256, rgb_dim=3, style_dim=512, hidden_layers=2, device=None, name_prefix=...
Implement the Python class `NeRFNetwork_Small` described below. Class description: Same architecture as TALLSIREN but adds a UniformBoxWarp to map input points to -1, 1 Method signatures and docstrings: - def __init__(self, in_dim=3, hidden_dim=256, rgb_dim=3, style_dim=512, hidden_layers=2, device=None, name_prefix=...
9244193048c73f55270d2df28fb160f42d5953ad
<|skeleton|> class NeRFNetwork_Small: """Same architecture as TALLSIREN but adds a UniformBoxWarp to map input points to -1, 1""" def __init__(self, in_dim=3, hidden_dim=256, rgb_dim=3, style_dim=512, hidden_layers=2, device=None, name_prefix='nerf', **kwargs): """:param z_dim: :param hidden_dim: :para...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NeRFNetwork_Small: """Same architecture as TALLSIREN but adds a UniformBoxWarp to map input points to -1, 1""" def __init__(self, in_dim=3, hidden_dim=256, rgb_dim=3, style_dim=512, hidden_layers=2, device=None, name_prefix='nerf', **kwargs): """:param z_dim: :param hidden_dim: :param rgb_dim: :p...
the_stack_v2_python_sparse
exp/comm/models/nerf_network.py
tonywork/CIPS-3D
train
0
5f5a88a059fd3d6df54ff8a0e4454da822710f3d
[ "super().__init__(self.PARAMS, parameters)\nself.column_order = parameters['column_order']\nself.ignore_missing = parameters['ignore_missing']\nself.keep_others = parameters['keep_others']", "df_new = df.copy()\ncurrent_columns = list(df_new.columns)\nmissing_columns = set(self.column_order).difference(set(df_new...
<|body_start_0|> super().__init__(self.PARAMS, parameters) self.column_order = parameters['column_order'] self.ignore_missing = parameters['ignore_missing'] self.keep_others = parameters['keep_others'] <|end_body_0|> <|body_start_1|> df_new = df.copy() current_columns = ...
Reorder columns in a tabular file. Required parameters: column_order (*list*): The names of the columns to be reordered. ignore_missing (*bool*): If false and a column in column_order is not in df, skip the column keep_others (*bool*): If true, columns not in column_order are placed at end.
ReorderColumnsOp
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReorderColumnsOp: """Reorder columns in a tabular file. Required parameters: column_order (*list*): The names of the columns to be reordered. ignore_missing (*bool*): If false and a column in column_order is not in df, skip the column keep_others (*bool*): If true, columns not in column_order are...
stack_v2_sparse_classes_10k_train_007805
2,847
permissive
[ { "docstring": "Constructor for reorder columns operation. Parameters: parameters (dict): Dictionary with the parameter values for required and optional parameters. :raises KeyError: - If a required parameter is missing. - If an unexpected parameter is provided. :raises TypeError: - If a parameter has the wrong...
2
stack_v2_sparse_classes_30k_train_004021
Implement the Python class `ReorderColumnsOp` described below. Class description: Reorder columns in a tabular file. Required parameters: column_order (*list*): The names of the columns to be reordered. ignore_missing (*bool*): If false and a column in column_order is not in df, skip the column keep_others (*bool*): I...
Implement the Python class `ReorderColumnsOp` described below. Class description: Reorder columns in a tabular file. Required parameters: column_order (*list*): The names of the columns to be reordered. ignore_missing (*bool*): If false and a column in column_order is not in df, skip the column keep_others (*bool*): I...
b871cae44bdf0ee68c688562c3b0af50b93343f5
<|skeleton|> class ReorderColumnsOp: """Reorder columns in a tabular file. Required parameters: column_order (*list*): The names of the columns to be reordered. ignore_missing (*bool*): If false and a column in column_order is not in df, skip the column keep_others (*bool*): If true, columns not in column_order are...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ReorderColumnsOp: """Reorder columns in a tabular file. Required parameters: column_order (*list*): The names of the columns to be reordered. ignore_missing (*bool*): If false and a column in column_order is not in df, skip the column keep_others (*bool*): If true, columns not in column_order are placed at en...
the_stack_v2_python_sparse
hed/tools/remodeling/operations/reorder_columns_op.py
hed-standard/hed-python
train
5
8776a9446a8a462749edef1bf6a99285c3096a2b
[ "for label, item in cls.labels.items():\n if item == cls:\n return label\nraise NotImplementedError(f'Class {cls} is not implemented.')", "def decorator(obj):\n if label in cls.labels:\n print(f\"registering duplicate label '{label}' for {cls.__name__}.\")\n cls.labels[label] = obj\n ret...
<|body_start_0|> for label, item in cls.labels.items(): if item == cls: return label raise NotImplementedError(f'Class {cls} is not implemented.') <|end_body_0|> <|body_start_1|> def decorator(obj): if label in cls.labels: print(f"register...
CustomABC
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomABC: def get_label(cls): """Returns the string label of a class object.""" <|body_0|> def register(cls, label): """Decorator to register new classes.""" <|body_1|> def __class_getitem__(cls, item): """Returns the child.""" <|body_2|...
stack_v2_sparse_classes_10k_train_007806
912
permissive
[ { "docstring": "Returns the string label of a class object.", "name": "get_label", "signature": "def get_label(cls)" }, { "docstring": "Decorator to register new classes.", "name": "register", "signature": "def register(cls, label)" }, { "docstring": "Returns the child.", "na...
3
stack_v2_sparse_classes_30k_train_006880
Implement the Python class `CustomABC` described below. Class description: Implement the CustomABC class. Method signatures and docstrings: - def get_label(cls): Returns the string label of a class object. - def register(cls, label): Decorator to register new classes. - def __class_getitem__(cls, item): Returns the c...
Implement the Python class `CustomABC` described below. Class description: Implement the CustomABC class. Method signatures and docstrings: - def get_label(cls): Returns the string label of a class object. - def register(cls, label): Decorator to register new classes. - def __class_getitem__(cls, item): Returns the c...
29f37740bacc9a77b94daf6fbae769c003ee9349
<|skeleton|> class CustomABC: def get_label(cls): """Returns the string label of a class object.""" <|body_0|> def register(cls, label): """Decorator to register new classes.""" <|body_1|> def __class_getitem__(cls, item): """Returns the child.""" <|body_2|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CustomABC: def get_label(cls): """Returns the string label of a class object.""" for label, item in cls.labels.items(): if item == cls: return label raise NotImplementedError(f'Class {cls} is not implemented.') def register(cls, label): """Decor...
the_stack_v2_python_sparse
profit/util/base_class.py
redmod-team/profit
train
19
df41760ce3fc0766e3850579bba67334c61f428b
[ "stops = set(stopwords.words('english'))\nstops.update(set(punctuation))\nself.stops = stops", "text = text.lower()\ntext = re.sub('\\\\. \\\\. \\\\.', '\\\\.', text)\ntext = re.sub(\"[^A-Za-z0-9(),!?\\\\'\\\\`\\\\.]\", ' ', text)\ntext = re.sub('[0-9]+', '', text)\ntext = re.sub(\"\\\\'s\", \" 's\", text)\ntext ...
<|body_start_0|> stops = set(stopwords.words('english')) stops.update(set(punctuation)) self.stops = stops <|end_body_0|> <|body_start_1|> text = text.lower() text = re.sub('\\. \\. \\.', '\\.', text) text = re.sub("[^A-Za-z0-9(),!?\\'\\`\\.]", ' ', text) text = ...
TextCleaning
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextCleaning: def __init__(self): """Define Your stop word List here""" <|body_0|> def text_cleaning(self, text): """Define your Text Cleaning Rules here""" <|body_1|> <|end_skeleton|> <|body_start_0|> stops = set(stopwords.words('english')) ...
stack_v2_sparse_classes_10k_train_007807
4,058
permissive
[ { "docstring": "Define Your stop word List here", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Define your Text Cleaning Rules here", "name": "text_cleaning", "signature": "def text_cleaning(self, text)" } ]
2
stack_v2_sparse_classes_30k_train_004502
Implement the Python class `TextCleaning` described below. Class description: Implement the TextCleaning class. Method signatures and docstrings: - def __init__(self): Define Your stop word List here - def text_cleaning(self, text): Define your Text Cleaning Rules here
Implement the Python class `TextCleaning` described below. Class description: Implement the TextCleaning class. Method signatures and docstrings: - def __init__(self): Define Your stop word List here - def text_cleaning(self, text): Define your Text Cleaning Rules here <|skeleton|> class TextCleaning: def __ini...
b4883024da899f7e921583bd0b4fb952f53914cb
<|skeleton|> class TextCleaning: def __init__(self): """Define Your stop word List here""" <|body_0|> def text_cleaning(self, text): """Define your Text Cleaning Rules here""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TextCleaning: def __init__(self): """Define Your stop word List here""" stops = set(stopwords.words('english')) stops.update(set(punctuation)) self.stops = stops def text_cleaning(self, text): """Define your Text Cleaning Rules here""" text = text.lower() ...
the_stack_v2_python_sparse
common/utils/utils.py
anishacharya/NLP-CS388-UT
train
2
02487ae040fbe9a689f5ace0bfb461e9690e605b
[ "super(Organization, self).__init__(resource_id=organization_id, resource_type=resource.ResourceType.ORGANIZATION, name=name, display_name=display_name, lifecycle_state=lifecycle_state)\nself.full_name = full_name\nself.data = data", "del parent\norg_dict = json.loads(json_string)\norg_name = org_dict['name']\nor...
<|body_start_0|> super(Organization, self).__init__(resource_id=organization_id, resource_type=resource.ResourceType.ORGANIZATION, name=name, display_name=display_name, lifecycle_state=lifecycle_state) self.full_name = full_name self.data = data <|end_body_0|> <|body_start_1|> del paren...
Organization resource.
Organization
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Organization: """Organization resource.""" def __init__(self, organization_id, full_name=None, data=None, name=None, display_name=None, lifecycle_state=OrgLifecycleState.UNSPECIFIED): """Initialize. Args: organization_id (int): The organization id. full_name (str): The full resource ...
stack_v2_sparse_classes_10k_train_007808
3,000
permissive
[ { "docstring": "Initialize. Args: organization_id (int): The organization id. full_name (str): The full resource name and ancestory. data (str): Resource representation of the organization. name (str): The organization's unique GCP name, with the format \"organizations/{id}\". display_name (str): The organizati...
2
stack_v2_sparse_classes_30k_train_004683
Implement the Python class `Organization` described below. Class description: Organization resource. Method signatures and docstrings: - def __init__(self, organization_id, full_name=None, data=None, name=None, display_name=None, lifecycle_state=OrgLifecycleState.UNSPECIFIED): Initialize. Args: organization_id (int):...
Implement the Python class `Organization` described below. Class description: Organization resource. Method signatures and docstrings: - def __init__(self, organization_id, full_name=None, data=None, name=None, display_name=None, lifecycle_state=OrgLifecycleState.UNSPECIFIED): Initialize. Args: organization_id (int):...
d4421afa50a17ed47cbebe942044ebab3720e0f5
<|skeleton|> class Organization: """Organization resource.""" def __init__(self, organization_id, full_name=None, data=None, name=None, display_name=None, lifecycle_state=OrgLifecycleState.UNSPECIFIED): """Initialize. Args: organization_id (int): The organization id. full_name (str): The full resource ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Organization: """Organization resource.""" def __init__(self, organization_id, full_name=None, data=None, name=None, display_name=None, lifecycle_state=OrgLifecycleState.UNSPECIFIED): """Initialize. Args: organization_id (int): The organization id. full_name (str): The full resource name and ance...
the_stack_v2_python_sparse
google/cloud/forseti/common/gcp_type/organization.py
kevensen/forseti-security
train
1
474494ce13b5e3f8aa507558a741d146df6d4982
[ "urls = super().get_urls()\nnew_urls = [path('upload-csv/', self.upload_csv), path('update_elastic/', ElasticActions.update_elastic), path('export-elastic/', ElasticActions.export_to_elastic)]\nreturn new_urls + urls", "if request.method == 'POST':\n csv_file = request.FILES['importer_un_fichier']\n if not ...
<|body_start_0|> urls = super().get_urls() new_urls = [path('upload-csv/', self.upload_csv), path('update_elastic/', ElasticActions.update_elastic), path('export-elastic/', ElasticActions.export_to_elastic)] return new_urls + urls <|end_body_0|> <|body_start_1|> if request.method == 'PO...
Modèle de l'administration des structures
StructureAdmin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StructureAdmin: """Modèle de l'administration des structures""" def get_urls(self): """Initialise les urls du modèle StructureAdmin""" <|body_0|> def upload_csv(request): """Permet de charger un fichier CSV dans la base de données du modèle Structure""" <...
stack_v2_sparse_classes_10k_train_007809
12,279
no_license
[ { "docstring": "Initialise les urls du modèle StructureAdmin", "name": "get_urls", "signature": "def get_urls(self)" }, { "docstring": "Permet de charger un fichier CSV dans la base de données du modèle Structure", "name": "upload_csv", "signature": "def upload_csv(request)" } ]
2
stack_v2_sparse_classes_30k_train_003218
Implement the Python class `StructureAdmin` described below. Class description: Modèle de l'administration des structures Method signatures and docstrings: - def get_urls(self): Initialise les urls du modèle StructureAdmin - def upload_csv(request): Permet de charger un fichier CSV dans la base de données du modèle S...
Implement the Python class `StructureAdmin` described below. Class description: Modèle de l'administration des structures Method signatures and docstrings: - def get_urls(self): Initialise les urls du modèle StructureAdmin - def upload_csv(request): Permet de charger un fichier CSV dans la base de données du modèle S...
0471d2de17597d97f3209099aff3edc72d615fa2
<|skeleton|> class StructureAdmin: """Modèle de l'administration des structures""" def get_urls(self): """Initialise les urls du modèle StructureAdmin""" <|body_0|> def upload_csv(request): """Permet de charger un fichier CSV dans la base de données du modèle Structure""" <...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class StructureAdmin: """Modèle de l'administration des structures""" def get_urls(self): """Initialise les urls du modèle StructureAdmin""" urls = super().get_urls() new_urls = [path('upload-csv/', self.upload_csv), path('update_elastic/', ElasticActions.update_elastic), path('export-e...
the_stack_v2_python_sparse
elasticHal/admin.py
Patent2net/SoVisu
train
1
0101cb4e170a8d168a24134fee231c0d44274d44
[ "LOG.debug('Plug or unplug networks for amphora id: %s', amphora[constants.ID])\nif not delta:\n LOG.debug('No network deltas for amphora id: %s', amphora[constants.ID])\n return\nfor nic in delta[constants.ADD_NICS]:\n self.network_driver.plug_network(amphora[constants.COMPUTE_ID], nic[constants.NETWORK_I...
<|body_start_0|> LOG.debug('Plug or unplug networks for amphora id: %s', amphora[constants.ID]) if not delta: LOG.debug('No network deltas for amphora id: %s', amphora[constants.ID]) return for nic in delta[constants.ADD_NICS]: self.network_driver.plug_network...
Task to plug the networks. This uses the delta to add all missing networks/nics
PlugNetworks
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlugNetworks: """Task to plug the networks. This uses the delta to add all missing networks/nics""" def execute(self, amphora, delta): """Update the amphora networks for the delta.""" <|body_0|> def revert(self, amphora, delta, *args, **kwargs): """Handle a faile...
stack_v2_sparse_classes_10k_train_007810
44,034
permissive
[ { "docstring": "Update the amphora networks for the delta.", "name": "execute", "signature": "def execute(self, amphora, delta)" }, { "docstring": "Handle a failed network plug by removing all nics added.", "name": "revert", "signature": "def revert(self, amphora, delta, *args, **kwargs)...
2
null
Implement the Python class `PlugNetworks` described below. Class description: Task to plug the networks. This uses the delta to add all missing networks/nics Method signatures and docstrings: - def execute(self, amphora, delta): Update the amphora networks for the delta. - def revert(self, amphora, delta, *args, **kw...
Implement the Python class `PlugNetworks` described below. Class description: Task to plug the networks. This uses the delta to add all missing networks/nics Method signatures and docstrings: - def execute(self, amphora, delta): Update the amphora networks for the delta. - def revert(self, amphora, delta, *args, **kw...
0426285a41464a5015494584f109eed35a0d44db
<|skeleton|> class PlugNetworks: """Task to plug the networks. This uses the delta to add all missing networks/nics""" def execute(self, amphora, delta): """Update the amphora networks for the delta.""" <|body_0|> def revert(self, amphora, delta, *args, **kwargs): """Handle a faile...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PlugNetworks: """Task to plug the networks. This uses the delta to add all missing networks/nics""" def execute(self, amphora, delta): """Update the amphora networks for the delta.""" LOG.debug('Plug or unplug networks for amphora id: %s', amphora[constants.ID]) if not delta: ...
the_stack_v2_python_sparse
octavia/controller/worker/v2/tasks/network_tasks.py
openstack/octavia
train
147
aa6953f701a6695492254eaf213c58ed26689ed6
[ "sexy.IconEntry.__init__(self)\nself.__gobject_init__()\nself._handler_changed = self.connect_after('changed', self._on_changed)\nself.connect('icon-pressed', self._on_icon_pressed)\nimage = gtk.Image()\npixbuf = icon_theme.load_icon(gtk.STOCK_CLEAR, gtk.ICON_SIZE_MENU, 0)\nimage.set_from_pixbuf(pixbuf)\nself.set_i...
<|body_start_0|> sexy.IconEntry.__init__(self) self.__gobject_init__() self._handler_changed = self.connect_after('changed', self._on_changed) self.connect('icon-pressed', self._on_icon_pressed) image = gtk.Image() pixbuf = icon_theme.load_icon(gtk.STOCK_CLEAR, gtk.ICON_S...
SearchEntry
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SearchEntry: def __init__(self, icon_theme): """Creates an enhanced IconEntry that supports a time out when typing and uses a different background colour when the search is active""" <|body_0|> def _on_icon_pressed(self, widget, icon, mouse_button): """Emit the terms...
stack_v2_sparse_classes_10k_train_007811
4,000
no_license
[ { "docstring": "Creates an enhanced IconEntry that supports a time out when typing and uses a different background colour when the search is active", "name": "__init__", "signature": "def __init__(self, icon_theme)" }, { "docstring": "Emit the terms-changed signal without any time out when the c...
4
stack_v2_sparse_classes_30k_train_000785
Implement the Python class `SearchEntry` described below. Class description: Implement the SearchEntry class. Method signatures and docstrings: - def __init__(self, icon_theme): Creates an enhanced IconEntry that supports a time out when typing and uses a different background colour when the search is active - def _o...
Implement the Python class `SearchEntry` described below. Class description: Implement the SearchEntry class. Method signatures and docstrings: - def __init__(self, icon_theme): Creates an enhanced IconEntry that supports a time out when typing and uses a different background colour when the search is active - def _o...
d08f7bf370a82b6970387bb9f165d374a9d9092b
<|skeleton|> class SearchEntry: def __init__(self, icon_theme): """Creates an enhanced IconEntry that supports a time out when typing and uses a different background colour when the search is active""" <|body_0|> def _on_icon_pressed(self, widget, icon, mouse_button): """Emit the terms...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SearchEntry: def __init__(self, icon_theme): """Creates an enhanced IconEntry that supports a time out when typing and uses a different background colour when the search is active""" sexy.IconEntry.__init__(self) self.__gobject_init__() self._handler_changed = self.connect_afte...
the_stack_v2_python_sparse
usr/share/pyshared/AppInstall/widgets/SearchEntry.py
haniokasai/netwalker-rootfs
train
2
59b7ed8442af60c91213b2cc65e3be37dcd03031
[ "if len(matrix) == 0 or len(matrix[0]) == 0:\n return\nlength = len(matrix)\nwidth = len(matrix[0])\nself.cache = [[0] * (width + 1) for i in range(length)]\nfor i in range(length):\n for j in range(width):\n self.cache[i][j + 1] = self.cache[i][j] + matrix[i][j]", "res = 0\nfor i in range(row1, row2...
<|body_start_0|> if len(matrix) == 0 or len(matrix[0]) == 0: return length = len(matrix) width = len(matrix[0]) self.cache = [[0] * (width + 1) for i in range(length)] for i in range(length): for j in range(width): self.cache[i][j + 1] = se...
NumMatrix
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """:type row1: int :type col1: int :type row2: int :type col2: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_10k_train_007812
929
no_license
[ { "docstring": ":type matrix: List[List[int]]", "name": "__init__", "signature": "def __init__(self, matrix)" }, { "docstring": ":type row1: int :type col1: int :type row2: int :type col2: int :rtype: int", "name": "sumRegion", "signature": "def sumRegion(self, row1, col1, row2, col2)" ...
2
stack_v2_sparse_classes_30k_train_001945
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:...
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:...
48196dedf60076bbc3769e067f1ecbaa36ca0b5f
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """:type row1: int :type col1: int :type row2: int :type col2: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" if len(matrix) == 0 or len(matrix[0]) == 0: return length = len(matrix) width = len(matrix[0]) self.cache = [[0] * (width + 1) for i in range(length)] for i in range(length): ...
the_stack_v2_python_sparse
Range Sum Query 2D - Immutable.py
xukaiyuan/leetcode-medium
train
0
91241417e91b8a06b56036d2f108d1473c1acd95
[ "super().__init__(fmc, **kwargs)\nlogging.debug('In __init__() for DNSServerGroups class.')\nself.parse_kwargs(**kwargs)\nself.type = 'DNSServerGroupObject'", "logging.debug('In servers() for DNSServerGroups class.')\nif action == 'add':\n for name_server in name_servers:\n if 'dnsservers' in self.__dic...
<|body_start_0|> super().__init__(fmc, **kwargs) logging.debug('In __init__() for DNSServerGroups class.') self.parse_kwargs(**kwargs) self.type = 'DNSServerGroupObject' <|end_body_0|> <|body_start_1|> logging.debug('In servers() for DNSServerGroups class.') if action ==...
The DNSServerGroups Object in the FMC.
DNSServerGroups
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DNSServerGroups: """The DNSServerGroups Object in the FMC.""" def __init__(self, fmc, **kwargs): """Initialize DNSServerGroups object. Set self.type to "DNSServerGroupObject" and parse the kwargs. :param fmc: (object) FMC object :param kwargs: Any other values passed during instantia...
stack_v2_sparse_classes_10k_train_007813
2,479
permissive
[ { "docstring": "Initialize DNSServerGroups object. Set self.type to \"DNSServerGroupObject\" and parse the kwargs. :param fmc: (object) FMC object :param kwargs: Any other values passed during instantiation. :return: None", "name": "__init__", "signature": "def __init__(self, fmc, **kwargs)" }, { ...
2
stack_v2_sparse_classes_30k_train_002436
Implement the Python class `DNSServerGroups` described below. Class description: The DNSServerGroups Object in the FMC. Method signatures and docstrings: - def __init__(self, fmc, **kwargs): Initialize DNSServerGroups object. Set self.type to "DNSServerGroupObject" and parse the kwargs. :param fmc: (object) FMC objec...
Implement the Python class `DNSServerGroups` described below. Class description: The DNSServerGroups Object in the FMC. Method signatures and docstrings: - def __init__(self, fmc, **kwargs): Initialize DNSServerGroups object. Set self.type to "DNSServerGroupObject" and parse the kwargs. :param fmc: (object) FMC objec...
fd924de96e200ca8e0d5088b27a5abaf6f915bc6
<|skeleton|> class DNSServerGroups: """The DNSServerGroups Object in the FMC.""" def __init__(self, fmc, **kwargs): """Initialize DNSServerGroups object. Set self.type to "DNSServerGroupObject" and parse the kwargs. :param fmc: (object) FMC object :param kwargs: Any other values passed during instantia...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DNSServerGroups: """The DNSServerGroups Object in the FMC.""" def __init__(self, fmc, **kwargs): """Initialize DNSServerGroups object. Set self.type to "DNSServerGroupObject" and parse the kwargs. :param fmc: (object) FMC object :param kwargs: Any other values passed during instantiation. :return...
the_stack_v2_python_sparse
fmcapi/api_objects/object_services/dnsservergroups.py
banzigaga/fmcapi
train
1
5516452a231a947d42ced06ffa7d69be4605bd97
[ "if len(nums) == 0:\n return 0\nmax_length = 1\nfor i in range(len(nums)):\n count = 1\n cur = nums[i]\n pre = None\n for j in range(i + 1, len(nums)):\n if cur < nums[j]:\n count += 1\n pre = cur\n cur = nums[j]\n elif cur > nums[j]:\n if pre...
<|body_start_0|> if len(nums) == 0: return 0 max_length = 1 for i in range(len(nums)): count = 1 cur = nums[i] pre = None for j in range(i + 1, len(nums)): if cur < nums[j]: count += 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lengthOfLIS(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def lengthOfLIS(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(nums) == 0: return 0 ...
stack_v2_sparse_classes_10k_train_007814
1,182
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "lengthOfLIS", "signature": "def lengthOfLIS(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "lengthOfLIS", "signature": "def lengthOfLIS(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLIS(self, nums): :type nums: List[int] :rtype: int - def lengthOfLIS(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLIS(self, nums): :type nums: List[int] :rtype: int - def lengthOfLIS(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def lengthOfLIS...
d8ed762d1005975f0de4f07760c9671195621c88
<|skeleton|> class Solution: def lengthOfLIS(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def lengthOfLIS(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def lengthOfLIS(self, nums): """:type nums: List[int] :rtype: int""" if len(nums) == 0: return 0 max_length = 1 for i in range(len(nums)): count = 1 cur = nums[i] pre = None for j in range(i + 1, len(nums)): ...
the_stack_v2_python_sparse
longest-increasing-subsequence/solution.py
uxlsl/leetcode_practice
train
0
5517b21befbc475c798db26286b46a79e8f7b66b
[ "self.n = ZZ(n)\nself.m = m\nself.__i = 0\nself.K = IntegerModRing(q)\nself.FM = FreeModule(self.K, n)\nself.D = D\nself.secret_dist = secret_dist\nif secret_dist == 'uniform':\n self.__s = random_vector(self.K, self.n)\nelif secret_dist == 'noise':\n self.__s = vector(self.K, self.n, [self.D() for _ in range...
<|body_start_0|> self.n = ZZ(n) self.m = m self.__i = 0 self.K = IntegerModRing(q) self.FM = FreeModule(self.K, n) self.D = D self.secret_dist = secret_dist if secret_dist == 'uniform': self.__s = random_vector(self.K, self.n) elif secr...
Learning with Errors (LWE) oracle. .. automethod:: __init__ .. automethod:: __call__
LWE
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LWE: """Learning with Errors (LWE) oracle. .. automethod:: __init__ .. automethod:: __call__""" def __init__(self, n, q, D, secret_dist='uniform', m=None): """Construct an LWE oracle in dimension ``n`` over a ring of order ``q`` with noise distribution ``D``. INPUT: - ``n`` - dimensi...
stack_v2_sparse_classes_10k_train_007815
31,769
no_license
[ { "docstring": "Construct an LWE oracle in dimension ``n`` over a ring of order ``q`` with noise distribution ``D``. INPUT: - ``n`` - dimension (integer > 0) - ``q`` - modulus typically > n (integer > 0) - ``D`` - an error distribution such as an instance of :class:`DiscreteGaussianDistributionIntegerSampler` o...
3
null
Implement the Python class `LWE` described below. Class description: Learning with Errors (LWE) oracle. .. automethod:: __init__ .. automethod:: __call__ Method signatures and docstrings: - def __init__(self, n, q, D, secret_dist='uniform', m=None): Construct an LWE oracle in dimension ``n`` over a ring of order ``q`...
Implement the Python class `LWE` described below. Class description: Learning with Errors (LWE) oracle. .. automethod:: __init__ .. automethod:: __call__ Method signatures and docstrings: - def __init__(self, n, q, D, secret_dist='uniform', m=None): Construct an LWE oracle in dimension ``n`` over a ring of order ``q`...
0d9eacbf74e2acffefde93e39f8bcbec745cdaba
<|skeleton|> class LWE: """Learning with Errors (LWE) oracle. .. automethod:: __init__ .. automethod:: __call__""" def __init__(self, n, q, D, secret_dist='uniform', m=None): """Construct an LWE oracle in dimension ``n`` over a ring of order ``q`` with noise distribution ``D``. INPUT: - ``n`` - dimensi...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LWE: """Learning with Errors (LWE) oracle. .. automethod:: __init__ .. automethod:: __call__""" def __init__(self, n, q, D, secret_dist='uniform', m=None): """Construct an LWE oracle in dimension ``n`` over a ring of order ``q`` with noise distribution ``D``. INPUT: - ``n`` - dimension (integer >...
the_stack_v2_python_sparse
sage/src/sage/crypto/lwe.py
bopopescu/geosci
train
0
052a09159bd663e80b96e8d6a2d98efed53b1ae7
[ "lowest = float('inf')\nmaxc = 0\nfor i in xrange(1, len(prices)):\n lowest = min(lowest, prices[i - 1])\n maxc = max(maxc, prices[i] - lowest)\nreturn maxc", "local_max = 0\nmmax = 0\nfor i in xrange(1, len(prices)):\n local_max += prices[i] - prices[i - 1]\n local_max = max(0, local_max)\n mmax =...
<|body_start_0|> lowest = float('inf') maxc = 0 for i in xrange(1, len(prices)): lowest = min(lowest, prices[i - 1]) maxc = max(maxc, prices[i] - lowest) return maxc <|end_body_0|> <|body_start_1|> local_max = 0 mmax = 0 for i in xrange(1,...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfit_2(self, prices): """:type prices: List[int] :rtype: int kadane algorithm 利用差具有累加性的特性.""" <|body_1|> def rewrite(self, prices): """:type pric...
stack_v2_sparse_classes_10k_train_007816
2,506
no_license
[ { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfit", "signature": "def maxProfit(self, prices)" }, { "docstring": ":type prices: List[int] :rtype: int kadane algorithm 利用差具有累加性的特性.", "name": "maxProfit_2", "signature": "def maxProfit_2(self, prices)" }, { "d...
3
stack_v2_sparse_classes_30k_train_002173
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices): :type prices: List[int] :rtype: int - def maxProfit_2(self, prices): :type prices: List[int] :rtype: int kadane algorithm 利用差具有累加性的特性. - def rewrite(...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices): :type prices: List[int] :rtype: int - def maxProfit_2(self, prices): :type prices: List[int] :rtype: int kadane algorithm 利用差具有累加性的特性. - def rewrite(...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfit_2(self, prices): """:type prices: List[int] :rtype: int kadane algorithm 利用差具有累加性的特性.""" <|body_1|> def rewrite(self, prices): """:type pric...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" lowest = float('inf') maxc = 0 for i in xrange(1, len(prices)): lowest = min(lowest, prices[i - 1]) maxc = max(maxc, prices[i] - lowest) return maxc def maxProf...
the_stack_v2_python_sparse
co_fb/121_Best_Time_to_Buy_and_Sell_Stock.py
vsdrun/lc_public
train
6
97d7075e8c0b4ca6e0fdaf532815263357586f56
[ "Win._load()\nbufferSize = (len(text) + 1) * 2\nhGlobalMem = Win.GlobalAlloc(ctypes.c_int(GHND), ctypes.c_int(bufferSize))\nlpGlobalMem = Win.GlobalLock(ctypes.c_int(hGlobalMem))\nWin.memcpy(lpGlobalMem, ctypes.c_wchar_p(text), ctypes.c_int(bufferSize))\nWin.GlobalUnlock(ctypes.c_int(hGlobalMem))\nif Win.OpenClipbo...
<|body_start_0|> Win._load() bufferSize = (len(text) + 1) * 2 hGlobalMem = Win.GlobalAlloc(ctypes.c_int(GHND), ctypes.c_int(bufferSize)) lpGlobalMem = Win.GlobalLock(ctypes.c_int(hGlobalMem)) Win.memcpy(lpGlobalMem, ctypes.c_wchar_p(text), ctypes.c_int(bufferSize)) Win.Gl...
Exports
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Exports: def clipboard_copy(text): """クリップボードにテキストをコピーする""" <|body_0|> def clipboard_paste(): """クリップボードからテキストをはり付ける""" <|body_1|> <|end_skeleton|> <|body_start_0|> Win._load() bufferSize = (len(text) + 1) * 2 hGlobalMem = Win.Global...
stack_v2_sparse_classes_10k_train_007817
2,348
permissive
[ { "docstring": "クリップボードにテキストをコピーする", "name": "clipboard_copy", "signature": "def clipboard_copy(text)" }, { "docstring": "クリップボードからテキストをはり付ける", "name": "clipboard_paste", "signature": "def clipboard_paste()" } ]
2
stack_v2_sparse_classes_30k_train_004424
Implement the Python class `Exports` described below. Class description: Implement the Exports class. Method signatures and docstrings: - def clipboard_copy(text): クリップボードにテキストをコピーする - def clipboard_paste(): クリップボードからテキストをはり付ける
Implement the Python class `Exports` described below. Class description: Implement the Exports class. Method signatures and docstrings: - def clipboard_copy(text): クリップボードにテキストをコピーする - def clipboard_paste(): クリップボードからテキストをはり付ける <|skeleton|> class Exports: def clipboard_copy(text): """クリップボードにテキストをコピーする"...
f3d89b4449b04e5e587915f3b3623dfbe5ba01d8
<|skeleton|> class Exports: def clipboard_copy(text): """クリップボードにテキストをコピーする""" <|body_0|> def clipboard_paste(): """クリップボードからテキストをはり付ける""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Exports: def clipboard_copy(text): """クリップボードにテキストをコピーする""" Win._load() bufferSize = (len(text) + 1) * 2 hGlobalMem = Win.GlobalAlloc(ctypes.c_int(GHND), ctypes.c_int(bufferSize)) lpGlobalMem = Win.GlobalLock(ctypes.c_int(hGlobalMem)) Win.memcpy(lpGlobalMem, cty...
the_stack_v2_python_sparse
machaon/platforms/windows/clipboard.py
betasewer/machaon
train
4
cd9b5f8dcd286dfd43ee4a0d73d79bbb7fd15e1d
[ "QDialog.__init__(self, parent)\nself.setupUi(self)\nself.method = method\nif method == 0:\n self.label_4.setText(u'默认模型')\nelif method == 1:\n self.label_4.setText(u'CNN')\nelse:\n pass\nself.imgPath = None\nself.resultPath = None", "self.imgPath = QtGui.QFileDialog.getOpenFileName(self, u'选择图片', '/', u...
<|body_start_0|> QDialog.__init__(self, parent) self.setupUi(self) self.method = method if method == 0: self.label_4.setText(u'默认模型') elif method == 1: self.label_4.setText(u'CNN') else: pass self.imgPath = None self.res...
Class documentation goes here.
FaceDetectDialog
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FaceDetectDialog: """Class documentation goes here.""" def __init__(self, method=0, parent=None): """Constructor""" <|body_0|> def on_pushButton_clicked(self): """打开图片""" <|body_1|> def on_pushButton_2_clicked(self): """人脸检测""" <|body...
stack_v2_sparse_classes_10k_train_007818
3,210
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, method=0, parent=None)" }, { "docstring": "打开图片", "name": "on_pushButton_clicked", "signature": "def on_pushButton_clicked(self)" }, { "docstring": "人脸检测", "name": "on_pushButton_2_clicked", ...
3
stack_v2_sparse_classes_30k_train_005979
Implement the Python class `FaceDetectDialog` described below. Class description: Class documentation goes here. Method signatures and docstrings: - def __init__(self, method=0, parent=None): Constructor - def on_pushButton_clicked(self): 打开图片 - def on_pushButton_2_clicked(self): 人脸检测
Implement the Python class `FaceDetectDialog` described below. Class description: Class documentation goes here. Method signatures and docstrings: - def __init__(self, method=0, parent=None): Constructor - def on_pushButton_clicked(self): 打开图片 - def on_pushButton_2_clicked(self): 人脸检测 <|skeleton|> class FaceDetectDi...
c3cb07f83642873a3460ffe489c82505923c3c1a
<|skeleton|> class FaceDetectDialog: """Class documentation goes here.""" def __init__(self, method=0, parent=None): """Constructor""" <|body_0|> def on_pushButton_clicked(self): """打开图片""" <|body_1|> def on_pushButton_2_clicked(self): """人脸检测""" <|body...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FaceDetectDialog: """Class documentation goes here.""" def __init__(self, method=0, parent=None): """Constructor""" QDialog.__init__(self, parent) self.setupUi(self) self.method = method if method == 0: self.label_4.setText(u'默认模型') elif method ...
the_stack_v2_python_sparse
dlib_face_detection/gui/FaceDetectGui.py
rickding/HelloPython
train
2
8301df83c054ad3e6341b3c5da1b8d9c9f5c7868
[ "self.drone_connection.disconnect()\nif self.groundcam is not None:\n self.groundcam._close()", "if self.use_wifi:\n return False\ncommand_tuple, enum_tuple = self.command_parser.get_command_tuple_with_enum('minidrone', 'UsbAccessory', 'GunControl', 'FIRE')\nreturn self.drone_connection.send_enum_command_pa...
<|body_start_0|> self.drone_connection.disconnect() if self.groundcam is not None: self.groundcam._close() <|end_body_0|> <|body_start_1|> if self.use_wifi: return False command_tuple, enum_tuple = self.command_parser.get_command_tuple_with_enum('minidrone', 'Usb...
Mambo
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Mambo: def disconnect(self): """Disconnect the BLE connection. Always call this at the end of your programs to cleanly disconnect. :return: void""" <|body_0|> def fire_gun(self): """Fire the gun (assumes it is attached) - note not supposed under wifi since the camera...
stack_v2_sparse_classes_10k_train_007819
31,062
permissive
[ { "docstring": "Disconnect the BLE connection. Always call this at the end of your programs to cleanly disconnect. :return: void", "name": "disconnect", "signature": "def disconnect(self)" }, { "docstring": "Fire the gun (assumes it is attached) - note not supposed under wifi since the camera ta...
2
stack_v2_sparse_classes_30k_val_000208
Implement the Python class `Mambo` described below. Class description: Implement the Mambo class. Method signatures and docstrings: - def disconnect(self): Disconnect the BLE connection. Always call this at the end of your programs to cleanly disconnect. :return: void - def fire_gun(self): Fire the gun (assumes it is...
Implement the Python class `Mambo` described below. Class description: Implement the Mambo class. Method signatures and docstrings: - def disconnect(self): Disconnect the BLE connection. Always call this at the end of your programs to cleanly disconnect. :return: void - def fire_gun(self): Fire the gun (assumes it is...
99ab19f7896bc30cf059244962a7da318d4672bf
<|skeleton|> class Mambo: def disconnect(self): """Disconnect the BLE connection. Always call this at the end of your programs to cleanly disconnect. :return: void""" <|body_0|> def fire_gun(self): """Fire the gun (assumes it is attached) - note not supposed under wifi since the camera...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Mambo: def disconnect(self): """Disconnect the BLE connection. Always call this at the end of your programs to cleanly disconnect. :return: void""" self.drone_connection.disconnect() if self.groundcam is not None: self.groundcam._close() def fire_gun(self): """...
the_stack_v2_python_sparse
Madrid/July2022/ProfessorX-BCI/src/drone/vendor/Minidrone.py
SaturdaysAI/Projects
train
35
6b1bd643f5b63c2aeaf1fbae0d86b98e6914dead
[ "result = []\nleft, right = (0, 0)\n\ndef backtracking(partial, left, right, n):\n if left >= right >= 0:\n if len(partial) == n * 2:\n result.append(partial)\n if left < n:\n backtracking(partial + '(', left + 1, right, n)\n if right < left:\n backtracking(p...
<|body_start_0|> result = [] left, right = (0, 0) def backtracking(partial, left, right, n): if left >= right >= 0: if len(partial) == n * 2: result.append(partial) if left < n: backtracking(partial + '(', left ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def generateParenthesis_add_1(self, n): """:type n: int :rtype: List[str]""" <|body_0|> def generateParenthesis_minus_1(self, n): """:type n: int :rtype: List[str]""" <|body_1|> def generateParenthesis_refer(self, n): """:type n: int :r...
stack_v2_sparse_classes_10k_train_007820
3,026
no_license
[ { "docstring": ":type n: int :rtype: List[str]", "name": "generateParenthesis_add_1", "signature": "def generateParenthesis_add_1(self, n)" }, { "docstring": ":type n: int :rtype: List[str]", "name": "generateParenthesis_minus_1", "signature": "def generateParenthesis_minus_1(self, n)" ...
3
stack_v2_sparse_classes_30k_train_005914
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def generateParenthesis_add_1(self, n): :type n: int :rtype: List[str] - def generateParenthesis_minus_1(self, n): :type n: int :rtype: List[str] - def generateParenthesis_refer(...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def generateParenthesis_add_1(self, n): :type n: int :rtype: List[str] - def generateParenthesis_minus_1(self, n): :type n: int :rtype: List[str] - def generateParenthesis_refer(...
f3fc71f344cd758cfce77f16ab72992c99ab288e
<|skeleton|> class Solution: def generateParenthesis_add_1(self, n): """:type n: int :rtype: List[str]""" <|body_0|> def generateParenthesis_minus_1(self, n): """:type n: int :rtype: List[str]""" <|body_1|> def generateParenthesis_refer(self, n): """:type n: int :r...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def generateParenthesis_add_1(self, n): """:type n: int :rtype: List[str]""" result = [] left, right = (0, 0) def backtracking(partial, left, right, n): if left >= right >= 0: if len(partial) == n * 2: result.append(par...
the_stack_v2_python_sparse
22_generateParenthesis.py
jennyChing/leetCode
train
2
bf52cdb366bf2827c2168f9a33a80c59443be497
[ "super().__init__()\nself._use_condition = use_condition\nself._model = self._get_coupling_layers(num_layers=5, hidden_size=1024)", "mask = tf.range(784, dtype=tf.float32)\nmask = tf.expand_dims(mask, axis=0)\nmask = mask % 2\nlayers = []\nfor _ in range(num_layers):\n layers.append(ClassConditionedAffineCoupl...
<|body_start_0|> super().__init__() self._use_condition = use_condition self._model = self._get_coupling_layers(num_layers=5, hidden_size=1024) <|end_body_0|> <|body_start_1|> mask = tf.range(784, dtype=tf.float32) mask = tf.expand_dims(mask, axis=0) mask = mask % 2 ...
Class conditioned flow model. Attributes: _use_condition: _model:
ClassConditionedFlow
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClassConditionedFlow: """Class conditioned flow model. Attributes: _use_condition: _model:""" def __init__(self, use_condition): """Initializes the object. Args: use_condition:""" <|body_0|> def _get_coupling_layers(self, num_layers, hidden_size): """Returns a li...
stack_v2_sparse_classes_10k_train_007821
12,897
no_license
[ { "docstring": "Initializes the object. Args: use_condition:", "name": "__init__", "signature": "def __init__(self, use_condition)" }, { "docstring": "Returns a list of convolutional affine coupling layers. Args: num_layers: hidden_size: Returns:", "name": "_get_coupling_layers", "signat...
3
stack_v2_sparse_classes_30k_train_004539
Implement the Python class `ClassConditionedFlow` described below. Class description: Class conditioned flow model. Attributes: _use_condition: _model: Method signatures and docstrings: - def __init__(self, use_condition): Initializes the object. Args: use_condition: - def _get_coupling_layers(self, num_layers, hidde...
Implement the Python class `ClassConditionedFlow` described below. Class description: Class conditioned flow model. Attributes: _use_condition: _model: Method signatures and docstrings: - def __init__(self, use_condition): Initializes the object. Args: use_condition: - def _get_coupling_layers(self, num_layers, hidde...
6d04861ef87ba2ba2a4182ad36f3b322fcf47cfa
<|skeleton|> class ClassConditionedFlow: """Class conditioned flow model. Attributes: _use_condition: _model:""" def __init__(self, use_condition): """Initializes the object. Args: use_condition:""" <|body_0|> def _get_coupling_layers(self, num_layers, hidden_size): """Returns a li...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ClassConditionedFlow: """Class conditioned flow model. Attributes: _use_condition: _model:""" def __init__(self, use_condition): """Initializes the object. Args: use_condition:""" super().__init__() self._use_condition = use_condition self._model = self._get_coupling_layer...
the_stack_v2_python_sparse
flow.py
gaotianxiang/text-to-image-synthesis
train
0
eab8d70075f45def13faec0ba3fbb2c7ebb199dd
[ "mod_obj = self.pool.get('ir.model.data')\npicking_type = context.get('picking_type')\nlocation_id = False\nif context is None:\n context = {}\nif 'default_maintenance' in context and context['default_maintenance'] == True:\n return False\nelse:\n return super(stock_move, self)._default_location_destinatio...
<|body_start_0|> mod_obj = self.pool.get('ir.model.data') picking_type = context.get('picking_type') location_id = False if context is None: context = {} if 'default_maintenance' in context and context['default_maintenance'] == True: return False e...
stock_move
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class stock_move: def _default_location_destination(self, cr, uid, context=None): """Gets default address of partner for destination location @return: Address id or False""" <|body_0|> def _default_location_source(self, cr, uid, context=None): """Gets default address of pa...
stack_v2_sparse_classes_10k_train_007822
36,987
no_license
[ { "docstring": "Gets default address of partner for destination location @return: Address id or False", "name": "_default_location_destination", "signature": "def _default_location_destination(self, cr, uid, context=None)" }, { "docstring": "Gets default address of partner for source location @r...
2
null
Implement the Python class `stock_move` described below. Class description: Implement the stock_move class. Method signatures and docstrings: - def _default_location_destination(self, cr, uid, context=None): Gets default address of partner for destination location @return: Address id or False - def _default_location_...
Implement the Python class `stock_move` described below. Class description: Implement the stock_move class. Method signatures and docstrings: - def _default_location_destination(self, cr, uid, context=None): Gets default address of partner for destination location @return: Address id or False - def _default_location_...
0b997095c260d58b026440967fea3a202bef7efb
<|skeleton|> class stock_move: def _default_location_destination(self, cr, uid, context=None): """Gets default address of partner for destination location @return: Address id or False""" <|body_0|> def _default_location_source(self, cr, uid, context=None): """Gets default address of pa...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class stock_move: def _default_location_destination(self, cr, uid, context=None): """Gets default address of partner for destination location @return: Address id or False""" mod_obj = self.pool.get('ir.model.data') picking_type = context.get('picking_type') location_id = False ...
the_stack_v2_python_sparse
v_7/NISS/shamil_v3/vehicles_maintenance/models/stock_exchange.py
musabahmed/baba
train
0
e8aaf07a3952cb7f728fe5a5270a84a05bb0bce0
[ "self.device = config['device']\nloss_scales = config['losses_and_scales']\nif 'fvd' in loss_scales.keys() and config['img_c'] not in [2, 3]:\n warnings.warn(\"'FVD' measure won't be used since image channels needs to be in [2, 3]\")\n loss_scales.pop('fvd')\nself.losses = {k: (LOSS_CLASSES[k](device=self.dev...
<|body_start_0|> self.device = config['device'] loss_scales = config['losses_and_scales'] if 'fvd' in loss_scales.keys() and config['img_c'] not in [2, 3]: warnings.warn("'FVD' measure won't be used since image channels needs to be in [2, 3]") loss_scales.pop('fvd') ...
This class provides bundled access to multiple losses. With this class's :meth:`get_losses()` method, all specified loss values are calculated on the same input prediction and target tensor. Attributes: device (str): A string specifying whether to use the GPU for calculations (`cuda`) or the CPU (`cpu`). losses (dict):...
PredictionLossProvider
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PredictionLossProvider: """This class provides bundled access to multiple losses. With this class's :meth:`get_losses()` method, all specified loss values are calculated on the same input prediction and target tensor. Attributes: device (str): A string specifying whether to use the GPU for calcul...
stack_v2_sparse_classes_10k_train_007823
2,547
permissive
[ { "docstring": "Initializes the provider by extracting device and loss IDs from the provided config dict and instantiating the losses that shall be used. Args: config (dict): A dictionary containing the devices and losses to use. The provided losses come with the scales that should be multiplied by the respecti...
2
stack_v2_sparse_classes_30k_train_003352
Implement the Python class `PredictionLossProvider` described below. Class description: This class provides bundled access to multiple losses. With this class's :meth:`get_losses()` method, all specified loss values are calculated on the same input prediction and target tensor. Attributes: device (str): A string speci...
Implement the Python class `PredictionLossProvider` described below. Class description: This class provides bundled access to multiple losses. With this class's :meth:`get_losses()` method, all specified loss values are calculated on the same input prediction and target tensor. Attributes: device (str): A string speci...
391570121b5bd9e3fd23aca9a0945a63c4173a24
<|skeleton|> class PredictionLossProvider: """This class provides bundled access to multiple losses. With this class's :meth:`get_losses()` method, all specified loss values are calculated on the same input prediction and target tensor. Attributes: device (str): A string specifying whether to use the GPU for calcul...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PredictionLossProvider: """This class provides bundled access to multiple losses. With this class's :meth:`get_losses()` method, all specified loss values are calculated on the same input prediction and target tensor. Attributes: device (str): A string specifying whether to use the GPU for calculations (`cuda...
the_stack_v2_python_sparse
vp_suite/measure/loss_provider.py
AIS-Bonn/vp-suite
train
18
5cca1ac2fe7164c920ed2acad40200bc8ac45e37
[ "super(EncoderDecoder, self).__init__(conf, output_dim, name)\nself.encoder = encoder_factory.factory(conf)\nself.decoder = asr_decoder_factory.factory(conf, self.output_dim)", "std_input_noise = float(self.conf['std_input_noise'])\nif is_training and std_input_noise > 0:\n noisy_inputs = inputs + tf.random_no...
<|body_start_0|> super(EncoderDecoder, self).__init__(conf, output_dim, name) self.encoder = encoder_factory.factory(conf) self.decoder = asr_decoder_factory.factory(conf, self.output_dim) <|end_body_0|> <|body_start_1|> std_input_noise = float(self.conf['std_input_noise']) if i...
a general class for an encoder decoder system
EncoderDecoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncoderDecoder: """a general class for an encoder decoder system""" def __init__(self, conf, output_dim, name=None): """LAS constructor Args: conf: The classifier configuration output_dim: the classifier output dimension name: the classifier name""" <|body_0|> def _get_o...
stack_v2_sparse_classes_10k_train_007824
3,642
permissive
[ { "docstring": "LAS constructor Args: conf: The classifier configuration output_dim: the classifier output dimension name: the classifier name", "name": "__init__", "signature": "def __init__(self, conf, output_dim, name=None)" }, { "docstring": "Add the neural net variables and operations to th...
2
stack_v2_sparse_classes_30k_train_001556
Implement the Python class `EncoderDecoder` described below. Class description: a general class for an encoder decoder system Method signatures and docstrings: - def __init__(self, conf, output_dim, name=None): LAS constructor Args: conf: The classifier configuration output_dim: the classifier output dimension name: ...
Implement the Python class `EncoderDecoder` described below. Class description: a general class for an encoder decoder system Method signatures and docstrings: - def __init__(self, conf, output_dim, name=None): LAS constructor Args: conf: The classifier configuration output_dim: the classifier output dimension name: ...
09586e57bf4c6d29a6679e9bb3a488e09451f08e
<|skeleton|> class EncoderDecoder: """a general class for an encoder decoder system""" def __init__(self, conf, output_dim, name=None): """LAS constructor Args: conf: The classifier configuration output_dim: the classifier output dimension name: the classifier name""" <|body_0|> def _get_o...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EncoderDecoder: """a general class for an encoder decoder system""" def __init__(self, conf, output_dim, name=None): """LAS constructor Args: conf: The classifier configuration output_dim: the classifier output dimension name: the classifier name""" super(EncoderDecoder, self).__init__(co...
the_stack_v2_python_sparse
nabu/neuralnetworks/classifiers/asr/encoder_decoder.py
chenxinglili/nabu
train
0
a001bc8ff039637f1c41cf1d0d4b1381fc1f5945
[ "self.__detailed_help = kwargs.pop('detailed_help', None)\nself.__args = args\nself.__kwargs = kwargs", "name = self.__args[0]\nfor flag in parser.flag_args:\n if name in flag.option_strings:\n return flag\nreturn None", "arg = parser.add_argument(*self.__args, **self.__kwargs)\nif self.__detailed_hel...
<|body_start_0|> self.__detailed_help = kwargs.pop('detailed_help', None) self.__args = args self.__kwargs = kwargs <|end_body_0|> <|body_start_1|> name = self.__args[0] for flag in parser.flag_args: if name in flag.option_strings: return flag ...
A class that allows you to save an argument configuration for reuse.
Argument
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Argument: """A class that allows you to save an argument configuration for reuse.""" def __init__(self, *args, **kwargs): """Creates the argument. Args: *args: The positional args to parser.add_argument. **kwargs: The keyword args to parser.add_argument.""" <|body_0|> de...
stack_v2_sparse_classes_10k_train_007825
25,896
permissive
[ { "docstring": "Creates the argument. Args: *args: The positional args to parser.add_argument. **kwargs: The keyword args to parser.add_argument.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Returns the flag object in parser.", "name": "__GetFla...
5
stack_v2_sparse_classes_30k_train_001683
Implement the Python class `Argument` described below. Class description: A class that allows you to save an argument configuration for reuse. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Creates the argument. Args: *args: The positional args to parser.add_argument. **kwargs: The keyword a...
Implement the Python class `Argument` described below. Class description: A class that allows you to save an argument configuration for reuse. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Creates the argument. Args: *args: The positional args to parser.add_argument. **kwargs: The keyword a...
c98b58aeb0994e011df960163541e9379ae7ea06
<|skeleton|> class Argument: """A class that allows you to save an argument configuration for reuse.""" def __init__(self, *args, **kwargs): """Creates the argument. Args: *args: The positional args to parser.add_argument. **kwargs: The keyword args to parser.add_argument.""" <|body_0|> de...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Argument: """A class that allows you to save an argument configuration for reuse.""" def __init__(self, *args, **kwargs): """Creates the argument. Args: *args: The positional args to parser.add_argument. **kwargs: The keyword args to parser.add_argument.""" self.__detailed_help = kwargs.p...
the_stack_v2_python_sparse
google-cloud-sdk/.install/.backup/lib/googlecloudsdk/calliope/base.py
KaranToor/MA450
train
1
05cbeb00c30676f18d007c89255d8e39011280e3
[ "self.request = None\nif isinstance(page, bytes):\n self.src = page\nelif _os.path.exists(page):\n with open(page, 'rb') as fp:\n self.src = fp.read()\nelse:\n better_headers = headers if headers else HEADERS.copy()\n self.request = _requests.get(page, headers=better_headers)\n if not self.req...
<|body_start_0|> self.request = None if isinstance(page, bytes): self.src = page elif _os.path.exists(page): with open(page, 'rb') as fp: self.src = fp.read() else: better_headers = headers if headers else HEADERS.copy() sel...
Class TagFinder can be used to find and store elements from a given web page or markup
TagFinder
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TagFinder: """Class TagFinder can be used to find and store elements from a given web page or markup""" def __init__(self, page, headers=None): """Initializes this tag finder""" <|body_0|> def find(self, tag, method='find_all'): """Returns a list of found tags fo...
stack_v2_sparse_classes_10k_train_007826
31,809
permissive
[ { "docstring": "Initializes this tag finder", "name": "__init__", "signature": "def __init__(self, page, headers=None)" }, { "docstring": "Returns a list of found tags for the given search method", "name": "find", "signature": "def find(self, tag, method='find_all')" }, { "docstr...
5
stack_v2_sparse_classes_30k_test_000138
Implement the Python class `TagFinder` described below. Class description: Class TagFinder can be used to find and store elements from a given web page or markup Method signatures and docstrings: - def __init__(self, page, headers=None): Initializes this tag finder - def find(self, tag, method='find_all'): Returns a ...
Implement the Python class `TagFinder` described below. Class description: Class TagFinder can be used to find and store elements from a given web page or markup Method signatures and docstrings: - def __init__(self, page, headers=None): Initializes this tag finder - def find(self, tag, method='find_all'): Returns a ...
f8773b630cc1f81b85a7fd385e4b91c29573d84d
<|skeleton|> class TagFinder: """Class TagFinder can be used to find and store elements from a given web page or markup""" def __init__(self, page, headers=None): """Initializes this tag finder""" <|body_0|> def find(self, tag, method='find_all'): """Returns a list of found tags fo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TagFinder: """Class TagFinder can be used to find and store elements from a given web page or markup""" def __init__(self, page, headers=None): """Initializes this tag finder""" self.request = None if isinstance(page, bytes): self.src = page elif _os.path.exist...
the_stack_v2_python_sparse
net/core.py
claywahlstrom/clay
train
2
8a51f3dc2d318d2df430b3033bc3b90db581a878
[ "progbar = training_utils.get_progbar(model, 'samples' if use_samples else 'steps')\nprogbar.params = callbacks.params\nprogbar.params['verbose'] = verbose\ncallbacks.model.stop_training = False\ncallbacks._call_begin_hook(mode)\nprogbar.on_train_begin()\nself.callbacks = callbacks\nself.progbar = progbar\ntry:\n ...
<|body_start_0|> progbar = training_utils.get_progbar(model, 'samples' if use_samples else 'steps') progbar.params = callbacks.params progbar.params['verbose'] = verbose callbacks.model.stop_training = False callbacks._call_begin_hook(mode) progbar.on_train_begin() ...
Utility object that wrap around callbacks and progress bars.
TrainingContext
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrainingContext: """Utility object that wrap around callbacks and progress bars.""" def on_start(self, model, callbacks=None, use_samples=False, verbose=0, mode=ModeKeys.TRAIN): """Provide a scope for the whole training process.""" <|body_0|> def on_epoch(self, epoch=0, ...
stack_v2_sparse_classes_10k_train_007827
28,479
permissive
[ { "docstring": "Provide a scope for the whole training process.", "name": "on_start", "signature": "def on_start(self, model, callbacks=None, use_samples=False, verbose=0, mode=ModeKeys.TRAIN)" }, { "docstring": "Provide a scope for running one epoch.", "name": "on_epoch", "signature": "...
3
null
Implement the Python class `TrainingContext` described below. Class description: Utility object that wrap around callbacks and progress bars. Method signatures and docstrings: - def on_start(self, model, callbacks=None, use_samples=False, verbose=0, mode=ModeKeys.TRAIN): Provide a scope for the whole training process...
Implement the Python class `TrainingContext` described below. Class description: Utility object that wrap around callbacks and progress bars. Method signatures and docstrings: - def on_start(self, model, callbacks=None, use_samples=False, verbose=0, mode=ModeKeys.TRAIN): Provide a scope for the whole training process...
7cbba04a2ee16d21309eefad5be6585183a2d5a9
<|skeleton|> class TrainingContext: """Utility object that wrap around callbacks and progress bars.""" def on_start(self, model, callbacks=None, use_samples=False, verbose=0, mode=ModeKeys.TRAIN): """Provide a scope for the whole training process.""" <|body_0|> def on_epoch(self, epoch=0, ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TrainingContext: """Utility object that wrap around callbacks and progress bars.""" def on_start(self, model, callbacks=None, use_samples=False, verbose=0, mode=ModeKeys.TRAIN): """Provide a scope for the whole training process.""" progbar = training_utils.get_progbar(model, 'samples' if ...
the_stack_v2_python_sparse
tensorflow/python/keras/engine/training_v2.py
NVIDIA/tensorflow
train
763
c7ebeb7082d5ebac1e4aca2f8b739b0b030e0694
[ "try:\n payload = jwt.decode(data, settings.SECRET_KEY, algorithm=['HS256'])\nexcept jwt.ExpiredSignatureError:\n raise serializers.ValidationError('Verificacion link has expired')\nexcept jwt.PyJWTError:\n raise serializers.ValidationError('Invalid token')\nif payload['type'] != 'email_confirmation':\n ...
<|body_start_0|> try: payload = jwt.decode(data, settings.SECRET_KEY, algorithm=['HS256']) except jwt.ExpiredSignatureError: raise serializers.ValidationError('Verificacion link has expired') except jwt.PyJWTError: raise serializers.ValidationError('Invalid to...
Account verification serializer
AccountVerificationSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccountVerificationSerializer: """Account verification serializer""" def validate_token(self, data): """Verify token is valid""" <|body_0|> def save(self): """Update users verified status""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: ...
stack_v2_sparse_classes_10k_train_007828
5,109
no_license
[ { "docstring": "Verify token is valid", "name": "validate_token", "signature": "def validate_token(self, data)" }, { "docstring": "Update users verified status", "name": "save", "signature": "def save(self)" } ]
2
stack_v2_sparse_classes_30k_train_000438
Implement the Python class `AccountVerificationSerializer` described below. Class description: Account verification serializer Method signatures and docstrings: - def validate_token(self, data): Verify token is valid - def save(self): Update users verified status
Implement the Python class `AccountVerificationSerializer` described below. Class description: Account verification serializer Method signatures and docstrings: - def validate_token(self, data): Verify token is valid - def save(self): Update users verified status <|skeleton|> class AccountVerificationSerializer: ...
0cede53169041667bd40bbce3c4774af84ffc2fa
<|skeleton|> class AccountVerificationSerializer: """Account verification serializer""" def validate_token(self, data): """Verify token is valid""" <|body_0|> def save(self): """Update users verified status""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AccountVerificationSerializer: """Account verification serializer""" def validate_token(self, data): """Verify token is valid""" try: payload = jwt.decode(data, settings.SECRET_KEY, algorithm=['HS256']) except jwt.ExpiredSignatureError: raise serializers.Va...
the_stack_v2_python_sparse
users/serializers/users.py
KrystellCR/DjangoRF
train
0
df8a70864db222d8fddd04e3ab2491a2a178eb39
[ "res = 0\ns = []\nfor i in range(len(height)):\n while s and height[i] > height[s[-1]]:\n top = s.pop()\n if s:\n w = i - s[-1] - 1\n l = min(height[s[-1]], height[i]) - height[top]\n res += w * l\n s.append(i)\nreturn res", "res = 0\nn = len(height)\nfor i in ...
<|body_start_0|> res = 0 s = [] for i in range(len(height)): while s and height[i] > height[s[-1]]: top = s.pop() if s: w = i - s[-1] - 1 l = min(height[s[-1]], height[i]) - height[top] res +=...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def trap(self, height): """:type height: List[int] :rtype: int using stack""" <|body_0|> def trap1(self, height): """:type height: List[int] :rtype: int brute forth""" <|body_1|> def trap2(self, height): """:type height: List[int] :rtyp...
stack_v2_sparse_classes_10k_train_007829
3,225
no_license
[ { "docstring": ":type height: List[int] :rtype: int using stack", "name": "trap", "signature": "def trap(self, height)" }, { "docstring": ":type height: List[int] :rtype: int brute forth", "name": "trap1", "signature": "def trap1(self, height)" }, { "docstring": ":type height: Li...
5
stack_v2_sparse_classes_30k_train_001286
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def trap(self, height): :type height: List[int] :rtype: int using stack - def trap1(self, height): :type height: List[int] :rtype: int brute forth - def trap2(self, height): :typ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def trap(self, height): :type height: List[int] :rtype: int using stack - def trap1(self, height): :type height: List[int] :rtype: int brute forth - def trap2(self, height): :typ...
9e49b2c6003b957276737005d4aaac276b44d251
<|skeleton|> class Solution: def trap(self, height): """:type height: List[int] :rtype: int using stack""" <|body_0|> def trap1(self, height): """:type height: List[int] :rtype: int brute forth""" <|body_1|> def trap2(self, height): """:type height: List[int] :rtyp...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def trap(self, height): """:type height: List[int] :rtype: int using stack""" res = 0 s = [] for i in range(len(height)): while s and height[i] > height[s[-1]]: top = s.pop() if s: w = i - s[-1] - 1 ...
the_stack_v2_python_sparse
PythonCode/src/0042_Trapping_Rain_Water.py
oneyuan/CodeforFun
train
0
e0515a9bbb57efc7f7b8542f1e56849e20c2a45f
[ "if not root:\n return ''\nque = deque()\nque.append(root)\nres = []\nwhile que:\n node = que.popleft()\n if not node:\n res.append('')\n continue\n res.append(str(node.val))\n que.append(node.left)\n que.append(node.right)\nlasti = len(res)\nfor i in range(len(res) - 1, -1, -1):\n ...
<|body_start_0|> if not root: return '' que = deque() que.append(root) res = [] while que: node = que.popleft() if not node: res.append('') continue res.append(str(node.val)) que.append(no...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_10k_train_007830
2,396
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_003556
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
2a29426be1d690b6f90bc45b437900deee46d832
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return '' que = deque() que.append(root) res = [] while que: node = que.popleft() if not node: ...
the_stack_v2_python_sparse
src/leet/449-Serialize and Deserialize BST.py
sevenseablue/leetcode
train
0
eae7869fdc8163dce9c31051a4e39b7f98cc0330
[ "self.main_window = QtGui.QWidget()\nself.gui = Gui()\nself.gui.setupUi(self.main_window)\nself.gui.drawing_widget.mousePressEvent = self.mouse_press\nself.gui.drawing_widget.paintEvent = self.paint_event\nself.ttt = TicTacToeModel()", "w = self.gui.drawing_widget.width() // 3\nh = self.gui.drawing_widget.height(...
<|body_start_0|> self.main_window = QtGui.QWidget() self.gui = Gui() self.gui.setupUi(self.main_window) self.gui.drawing_widget.mousePressEvent = self.mouse_press self.gui.drawing_widget.paintEvent = self.paint_event self.ttt = TicTacToeModel() <|end_body_0|> <|body_star...
Application class to create and control the gui. This version implements the Tic Tac Toe game using a drawing widget.
App
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class App: """Application class to create and control the gui. This version implements the Tic Tac Toe game using a drawing widget.""" def __init__(self): """Initialize the gui.""" <|body_0|> def mouse_press(self, event): """Called automatically whenever the drawing wi...
stack_v2_sparse_classes_10k_train_007831
4,727
no_license
[ { "docstring": "Initialize the gui.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Called automatically whenever the drawing widget is clicked. :param PyQt.QtGui.QMouseEvent event: The event object from PyQt. :return: None", "name": "mouse_press", "signature":...
3
stack_v2_sparse_classes_30k_train_007288
Implement the Python class `App` described below. Class description: Application class to create and control the gui. This version implements the Tic Tac Toe game using a drawing widget. Method signatures and docstrings: - def __init__(self): Initialize the gui. - def mouse_press(self, event): Called automatically wh...
Implement the Python class `App` described below. Class description: Application class to create and control the gui. This version implements the Tic Tac Toe game using a drawing widget. Method signatures and docstrings: - def __init__(self): Initialize the gui. - def mouse_press(self, event): Called automatically wh...
0e3470085083012f893adb22aa46d46039016965
<|skeleton|> class App: """Application class to create and control the gui. This version implements the Tic Tac Toe game using a drawing widget.""" def __init__(self): """Initialize the gui.""" <|body_0|> def mouse_press(self, event): """Called automatically whenever the drawing wi...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class App: """Application class to create and control the gui. This version implements the Tic Tac Toe game using a drawing widget.""" def __init__(self): """Initialize the gui.""" self.main_window = QtGui.QWidget() self.gui = Gui() self.gui.setupUi(self.main_window) sel...
the_stack_v2_python_sparse
CS_210 (Introduction to Programming)/TicTacToe/DrawApp.py
JacobOrner/USAFA
train
0
4e42e313b4e8f4517cca59865a67badc6b525b39
[ "n = len(grid)\np = [[(i, j) for j in range(n)] for i in range(n)]\nh = sorted([[grid[i][j], i, j] for j in range(n) for i in range(n)])\n\ndef f(a, b):\n if (a, b) != p[a][b]:\n p[a][b] = f(*p[a][b])\n return p[a][b]\nk = 0\nfor t in range(max(grid[0][0], grid[-1][-1]), h[-1][0]):\n while h[k][0] <...
<|body_start_0|> n = len(grid) p = [[(i, j) for j in range(n)] for i in range(n)] h = sorted([[grid[i][j], i, j] for j in range(n) for i in range(n)]) def f(a, b): if (a, b) != p[a][b]: p[a][b] = f(*p[a][b]) return p[a][b] k = 0 fo...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def swim_in_water(grid: List[List[int]]) -> int: """并查集 @param grid: @return:""" <|body_0|> def swim_in_water_v2(grid: List[List[int]]) -> int: """BFS @param grid: @return:""" <|body_1|> def swim_in_water_v3(grid: List[List[int]]) -> int: ...
stack_v2_sparse_classes_10k_train_007832
6,600
no_license
[ { "docstring": "并查集 @param grid: @return:", "name": "swim_in_water", "signature": "def swim_in_water(grid: List[List[int]]) -> int" }, { "docstring": "BFS @param grid: @return:", "name": "swim_in_water_v2", "signature": "def swim_in_water_v2(grid: List[List[int]]) -> int" }, { "d...
4
stack_v2_sparse_classes_30k_train_004975
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def swim_in_water(grid: List[List[int]]) -> int: 并查集 @param grid: @return: - def swim_in_water_v2(grid: List[List[int]]) -> int: BFS @param grid: @return: - def swim_in_water_v3(...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def swim_in_water(grid: List[List[int]]) -> int: 并查集 @param grid: @return: - def swim_in_water_v2(grid: List[List[int]]) -> int: BFS @param grid: @return: - def swim_in_water_v3(...
1d1876620a55ff88af7bc390cf1a4fd4350d8d16
<|skeleton|> class Solution: def swim_in_water(grid: List[List[int]]) -> int: """并查集 @param grid: @return:""" <|body_0|> def swim_in_water_v2(grid: List[List[int]]) -> int: """BFS @param grid: @return:""" <|body_1|> def swim_in_water_v3(grid: List[List[int]]) -> int: ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def swim_in_water(grid: List[List[int]]) -> int: """并查集 @param grid: @return:""" n = len(grid) p = [[(i, j) for j in range(n)] for i in range(n)] h = sorted([[grid[i][j], i, j] for j in range(n) for i in range(n)]) def f(a, b): if (a, b) != p[a][b...
the_stack_v2_python_sparse
02-算法思想/广度优先搜索/778.水位上升的泳池中游泳(H).py
jh-lau/leetcode_in_python
train
0
5109d6ebed0e8b17a1640b293a7dd4b9a065b036
[ "datafile_empty = self.get_file('empty.csv')\nschema_empty = [('col_A', int), ('col_B', int), ('col_C', str), ('col_D', float), ('col_E', float), ('col_F', str)]\nframe = self.context.frame.import_csv(datafile_empty, schema=schema_empty)\nself.assertEqual(frame.count(), 0)\nnull2 = frame.copy()\nself.assertEqual(nu...
<|body_start_0|> datafile_empty = self.get_file('empty.csv') schema_empty = [('col_A', int), ('col_B', int), ('col_C', str), ('col_D', float), ('col_E', float), ('col_F', str)] frame = self.context.frame.import_csv(datafile_empty, schema=schema_empty) self.assertEqual(frame.count(), 0) ...
FileLoadTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileLoadTest: def test_import_empty(self): """Import an empty file.""" <|body_0|> def test_import_whitespace(self): """Build frame with complex quoting and whitespace""" <|body_1|> <|end_skeleton|> <|body_start_0|> datafile_empty = self.get_file('em...
stack_v2_sparse_classes_10k_train_007833
2,116
permissive
[ { "docstring": "Import an empty file.", "name": "test_import_empty", "signature": "def test_import_empty(self)" }, { "docstring": "Build frame with complex quoting and whitespace", "name": "test_import_whitespace", "signature": "def test_import_whitespace(self)" } ]
2
stack_v2_sparse_classes_30k_train_001351
Implement the Python class `FileLoadTest` described below. Class description: Implement the FileLoadTest class. Method signatures and docstrings: - def test_import_empty(self): Import an empty file. - def test_import_whitespace(self): Build frame with complex quoting and whitespace
Implement the Python class `FileLoadTest` described below. Class description: Implement the FileLoadTest class. Method signatures and docstrings: - def test_import_empty(self): Import an empty file. - def test_import_whitespace(self): Build frame with complex quoting and whitespace <|skeleton|> class FileLoadTest: ...
5548fc925b5c278263cbdebbd9e8c7593320c2f4
<|skeleton|> class FileLoadTest: def test_import_empty(self): """Import an empty file.""" <|body_0|> def test_import_whitespace(self): """Build frame with complex quoting and whitespace""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FileLoadTest: def test_import_empty(self): """Import an empty file.""" datafile_empty = self.get_file('empty.csv') schema_empty = [('col_A', int), ('col_B', int), ('col_C', str), ('col_D', float), ('col_E', float), ('col_F', str)] frame = self.context.frame.import_csv(datafile_...
the_stack_v2_python_sparse
regression-tests/sparktkregtests/testcases/frames/file_load_test.py
trustedanalytics/spark-tk
train
35
d53123f8286514231614dc17e6d3e1e9956f4de2
[ "print(validated_data)\nquiz = Quiz.objects.create(**validated_data)\nreturn quiz\n'\\n answers_data = validated_data.pop(\"answers\")\\n question = Question.objects.create(**validated_data)\\n for answer in answers_data:\\n answer = Answer.objects.create(question=question, **answer...
<|body_start_0|> print(validated_data) quiz = Quiz.objects.create(**validated_data) return quiz '\n answers_data = validated_data.pop("answers")\n question = Question.objects.create(**validated_data)\n for answer in answers_data:\n answer = Answer.objects...
QuizSerializer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuizSerializer: def create(self, validated_data, *args, **kwargs): """we can override the create method""" <|body_0|> def update(self, instance, validated_data): """update or put the exsiting value""" <|body_1|> <|end_skeleton|> <|body_start_0|> pri...
stack_v2_sparse_classes_10k_train_007834
2,460
permissive
[ { "docstring": "we can override the create method", "name": "create", "signature": "def create(self, validated_data, *args, **kwargs)" }, { "docstring": "update or put the exsiting value", "name": "update", "signature": "def update(self, instance, validated_data)" } ]
2
stack_v2_sparse_classes_30k_train_005354
Implement the Python class `QuizSerializer` described below. Class description: Implement the QuizSerializer class. Method signatures and docstrings: - def create(self, validated_data, *args, **kwargs): we can override the create method - def update(self, instance, validated_data): update or put the exsiting value
Implement the Python class `QuizSerializer` described below. Class description: Implement the QuizSerializer class. Method signatures and docstrings: - def create(self, validated_data, *args, **kwargs): we can override the create method - def update(self, instance, validated_data): update or put the exsiting value <...
bebeff8d055ea769773cd1c749f42408aa83f5b9
<|skeleton|> class QuizSerializer: def create(self, validated_data, *args, **kwargs): """we can override the create method""" <|body_0|> def update(self, instance, validated_data): """update or put the exsiting value""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class QuizSerializer: def create(self, validated_data, *args, **kwargs): """we can override the create method""" print(validated_data) quiz = Quiz.objects.create(**validated_data) return quiz '\n answers_data = validated_data.pop("answers")\n question = Questio...
the_stack_v2_python_sparse
backend/quiz/api/serializers/quizes.py
mahmoud-batman/quizz-app
train
0
d5892a599f3213e345f0cc6bc337f4ef00140653
[ "if user_id is None or type(user_id) is not str:\n return None\nsession_id = str(uuid.uuid4())\nuser_session = UserSession()\nuser_session.user_id = user_id\nuser_session.session_id = session_id\nuser_session.save()\nreturn session_id", "if type(session_id) is not str:\n return None\ntry:\n users_session...
<|body_start_0|> if user_id is None or type(user_id) is not str: return None session_id = str(uuid.uuid4()) user_session = UserSession() user_session.user_id = user_id user_session.session_id = session_id user_session.save() return session_id <|end_bod...
SessionAuth
SessionDBAuth
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SessionDBAuth: """SessionAuth""" def create_session(self, user_id=None): """Create a session""" <|body_0|> def user_id_for_session_id(self, session_id=None): """returns the User ID by requesting UserSession in the database based on session_id""" <|body_1|...
stack_v2_sparse_classes_10k_train_007835
2,106
no_license
[ { "docstring": "Create a session", "name": "create_session", "signature": "def create_session(self, user_id=None)" }, { "docstring": "returns the User ID by requesting UserSession in the database based on session_id", "name": "user_id_for_session_id", "signature": "def user_id_for_sessio...
3
stack_v2_sparse_classes_30k_val_000346
Implement the Python class `SessionDBAuth` described below. Class description: SessionAuth Method signatures and docstrings: - def create_session(self, user_id=None): Create a session - def user_id_for_session_id(self, session_id=None): returns the User ID by requesting UserSession in the database based on session_id...
Implement the Python class `SessionDBAuth` described below. Class description: SessionAuth Method signatures and docstrings: - def create_session(self, user_id=None): Create a session - def user_id_for_session_id(self, session_id=None): returns the User ID by requesting UserSession in the database based on session_id...
ef832164444a3c134851251655a408abd6369a11
<|skeleton|> class SessionDBAuth: """SessionAuth""" def create_session(self, user_id=None): """Create a session""" <|body_0|> def user_id_for_session_id(self, session_id=None): """returns the User ID by requesting UserSession in the database based on session_id""" <|body_1|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SessionDBAuth: """SessionAuth""" def create_session(self, user_id=None): """Create a session""" if user_id is None or type(user_id) is not str: return None session_id = str(uuid.uuid4()) user_session = UserSession() user_session.user_id = user_id ...
the_stack_v2_python_sparse
0x07-Session_authentication/api/v1/auth/session_db_auth.py
DiegoOrejuela/holbertonschool-web_back_end
train
0
2118b8a15c3323094bff2c346d735801031ad7ef
[ "diff = [float('inf')]\n\ndef dfs(root):\n \"\"\"\n :ret: min, max\n \"\"\"\n if not root:\n return\n lsmall = llarge = rsmall = rlarge = None\n if root.left:\n lsmall, llarge = dfs(root.left)\n diff[0] = min(diff[0], root.val - llarge.val)\n if root.right:\...
<|body_start_0|> diff = [float('inf')] def dfs(root): """ :ret: min, max """ if not root: return lsmall = llarge = rsmall = rlarge = None if root.left: lsmall, llarge = dfs(root.left)...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minDiffInBST(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def rewrite(self, root): """:type root: TreeNode :rtype: int using yield, inorder to trigger it, use for loop""" <|body_1|> <|end_skeleton|> <|body_start_0|> d...
stack_v2_sparse_classes_10k_train_007836
2,714
no_license
[ { "docstring": ":type root: TreeNode :rtype: int", "name": "minDiffInBST", "signature": "def minDiffInBST(self, root)" }, { "docstring": ":type root: TreeNode :rtype: int using yield, inorder to trigger it, use for loop", "name": "rewrite", "signature": "def rewrite(self, root)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minDiffInBST(self, root): :type root: TreeNode :rtype: int - def rewrite(self, root): :type root: TreeNode :rtype: int using yield, inorder to trigger it, use for loop
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minDiffInBST(self, root): :type root: TreeNode :rtype: int - def rewrite(self, root): :type root: TreeNode :rtype: int using yield, inorder to trigger it, use for loop <|ske...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def minDiffInBST(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def rewrite(self, root): """:type root: TreeNode :rtype: int using yield, inorder to trigger it, use for loop""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def minDiffInBST(self, root): """:type root: TreeNode :rtype: int""" diff = [float('inf')] def dfs(root): """ :ret: min, max """ if not root: return lsmall = llarge = rsmall = rlarge ...
the_stack_v2_python_sparse
co_google/783_Minimum_Distance_Between_BST_Nodes.py
vsdrun/lc_public
train
6
4b32221dfa2b66dee5fc2d2a8c86501d22d7ed04
[ "if sociallogin.is_existing:\n return\nif 'email' not in sociallogin.account.extra_data:\n return\ntry:\n email = sociallogin.account.extra_data['email'].lower()\n email_address = EmailAddress.objects.get(email__iexact=email)\nexcept EmailAddress.DoesNotExist:\n return\nuser = email_address.user\nsoc...
<|body_start_0|> if sociallogin.is_existing: return if 'email' not in sociallogin.account.extra_data: return try: email = sociallogin.account.extra_data['email'].lower() email_address = EmailAddress.objects.get(email__iexact=email) except E...
SocialAccountAdapter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SocialAccountAdapter: def pre_social_login(self, request, sociallogin): """Invoked just after a user successfully authenticates via a social provider, but before the login is actually processed (and before the pre_social_login signal is emitted). We're trying to solve different use cases...
stack_v2_sparse_classes_10k_train_007837
2,719
permissive
[ { "docstring": "Invoked just after a user successfully authenticates via a social provider, but before the login is actually processed (and before the pre_social_login signal is emitted). We're trying to solve different use cases: - social account already exists, just go on - social account has no email or emai...
2
stack_v2_sparse_classes_30k_train_000253
Implement the Python class `SocialAccountAdapter` described below. Class description: Implement the SocialAccountAdapter class. Method signatures and docstrings: - def pre_social_login(self, request, sociallogin): Invoked just after a user successfully authenticates via a social provider, but before the login is actu...
Implement the Python class `SocialAccountAdapter` described below. Class description: Implement the SocialAccountAdapter class. Method signatures and docstrings: - def pre_social_login(self, request, sociallogin): Invoked just after a user successfully authenticates via a social provider, but before the login is actu...
bfb335d70733130eaecb026d38e23a5ac01e50ea
<|skeleton|> class SocialAccountAdapter: def pre_social_login(self, request, sociallogin): """Invoked just after a user successfully authenticates via a social provider, but before the login is actually processed (and before the pre_social_login signal is emitted). We're trying to solve different use cases...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SocialAccountAdapter: def pre_social_login(self, request, sociallogin): """Invoked just after a user successfully authenticates via a social provider, but before the login is actually processed (and before the pre_social_login signal is emitted). We're trying to solve different use cases: - social acc...
the_stack_v2_python_sparse
server/comidaimigrante/account/adapter.py
LabHackerSP/comidaimigrante
train
1
25ef1810a8467e40ce9d8392172d9eec9d5db51c
[ "super(SDPOSMenu, self).__init__(location, use_cache)\nself._location = location\nself.items = []\nself.categories = swagger_pos_menu\nself._item_name_dict = {}\nself._item_id_dict = {}\nself._category_name_dict = {}\nself._category_id_dict = {}\nfor category in swagger_pos_menu:\n for index, item in enumerate(c...
<|body_start_0|> super(SDPOSMenu, self).__init__(location, use_cache) self._location = location self.items = [] self.categories = swagger_pos_menu self._item_name_dict = {} self._item_id_dict = {} self._category_name_dict = {} self._category_id_dict = {} ...
SDPOSMenu
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SDPOSMenu: def __init__(self, location, swagger_pos_menu, use_cache=True): """:param location: :param swagger_menu: :param use_cache:""" <|body_0|> def get_category(self, category_id=None, category_name=None): """:param category_id: :param category_name: :return:""" ...
stack_v2_sparse_classes_10k_train_007838
2,292
permissive
[ { "docstring": ":param location: :param swagger_menu: :param use_cache:", "name": "__init__", "signature": "def __init__(self, location, swagger_pos_menu, use_cache=True)" }, { "docstring": ":param category_id: :param category_name: :return:", "name": "get_category", "signature": "def ge...
3
stack_v2_sparse_classes_30k_test_000206
Implement the Python class `SDPOSMenu` described below. Class description: Implement the SDPOSMenu class. Method signatures and docstrings: - def __init__(self, location, swagger_pos_menu, use_cache=True): :param location: :param swagger_menu: :param use_cache: - def get_category(self, category_id=None, category_name...
Implement the Python class `SDPOSMenu` described below. Class description: Implement the SDPOSMenu class. Method signatures and docstrings: - def __init__(self, location, swagger_pos_menu, use_cache=True): :param location: :param swagger_menu: :param use_cache: - def get_category(self, category_id=None, category_name...
7c24492dcc06b66aea3fd040c82152d2c3fdf719
<|skeleton|> class SDPOSMenu: def __init__(self, location, swagger_pos_menu, use_cache=True): """:param location: :param swagger_menu: :param use_cache:""" <|body_0|> def get_category(self, category_id=None, category_name=None): """:param category_id: :param category_name: :return:""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SDPOSMenu: def __init__(self, location, swagger_pos_menu, use_cache=True): """:param location: :param swagger_menu: :param use_cache:""" super(SDPOSMenu, self).__init__(location, use_cache) self._location = location self.items = [] self.categories = swagger_pos_menu ...
the_stack_v2_python_sparse
subtledata/sd_pos_menu.py
jakeharding/subtledata_python
train
0
b1d88b1b73c3eac45e4a80b8428c5aeaec4aae90
[ "has_cycle = False\none_step = head\ntwo_step = head\nwhile two_step and two_step.next:\n one_step = one_step.next\n two_step = two_step.next.next\n if one_step == two_step:\n has_cycle = True\n break\nif not has_cycle:\n return None\np = head\nstart = one_step.next\nwhile start:\n if s...
<|body_start_0|> has_cycle = False one_step = head two_step = head while two_step and two_step.next: one_step = one_step.next two_step = two_step.next.next if one_step == two_step: has_cycle = True break if not h...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def detectCycle1(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def detectCycle(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> has_cycle = False one_step =...
stack_v2_sparse_classes_10k_train_007839
1,566
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode", "name": "detectCycle1", "signature": "def detectCycle1(self, head)" }, { "docstring": ":type head: ListNode :rtype: ListNode", "name": "detectCycle", "signature": "def detectCycle(self, head)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def detectCycle1(self, head): :type head: ListNode :rtype: ListNode - def detectCycle(self, head): :type head: ListNode :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def detectCycle1(self, head): :type head: ListNode :rtype: ListNode - def detectCycle(self, head): :type head: ListNode :rtype: ListNode <|skeleton|> class Solution: def de...
e5b018493bbd12edcdcd0434f35d9c358106d391
<|skeleton|> class Solution: def detectCycle1(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def detectCycle(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def detectCycle1(self, head): """:type head: ListNode :rtype: ListNode""" has_cycle = False one_step = head two_step = head while two_step and two_step.next: one_step = one_step.next two_step = two_step.next.next if one_step...
the_stack_v2_python_sparse
py/leetcode/142.py
wfeng1991/learnpy
train
0
dd505beeab289a88129187e103c67ad510c5a85f
[ "if path is None:\n outpath = os.path.dirname(os.path.abspath(configfile))\nelse:\n outpath = path\nself.config = Configuration(configfile, outpath=path)\nself.pixel = pixel\nself.nside = nside", "if not self.config.galfile_pixelized:\n raise ValueError('Code only runs with pixelized galfile.')\nself.con...
<|body_start_0|> if path is None: outpath = os.path.dirname(os.path.abspath(configfile)) else: outpath = path self.config = Configuration(configfile, outpath=path) self.pixel = pixel self.nside = nside <|end_body_0|> <|body_start_1|> if not self.c...
Class to run richness computation (runcat) on a single healpix pixel, for distributed runs.
RuncatPixelTask
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RuncatPixelTask: """Class to run richness computation (runcat) on a single healpix pixel, for distributed runs.""" def __init__(self, configfile, pixel, nside, path=None): """Instantiate a RuncatPixelTask. Parameters ---------- configfile: `str` Configuration yaml filename. pixel: `i...
stack_v2_sparse_classes_10k_train_007840
10,033
permissive
[ { "docstring": "Instantiate a RuncatPixelTask. Parameters ---------- configfile: `str` Configuration yaml filename. pixel: `int` Healpix pixel to run on. nside: `int` Healpix nside associated with pixel. path: `str`, optional Output path. Default is None, use same absolute path as configfile. percolation_maskin...
2
stack_v2_sparse_classes_30k_train_007317
Implement the Python class `RuncatPixelTask` described below. Class description: Class to run richness computation (runcat) on a single healpix pixel, for distributed runs. Method signatures and docstrings: - def __init__(self, configfile, pixel, nside, path=None): Instantiate a RuncatPixelTask. Parameters ----------...
Implement the Python class `RuncatPixelTask` described below. Class description: Class to run richness computation (runcat) on a single healpix pixel, for distributed runs. Method signatures and docstrings: - def __init__(self, configfile, pixel, nside, path=None): Instantiate a RuncatPixelTask. Parameters ----------...
d3a8b432c2f3a20aa518a7781c0f2aa315624855
<|skeleton|> class RuncatPixelTask: """Class to run richness computation (runcat) on a single healpix pixel, for distributed runs.""" def __init__(self, configfile, pixel, nside, path=None): """Instantiate a RuncatPixelTask. Parameters ---------- configfile: `str` Configuration yaml filename. pixel: `i...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RuncatPixelTask: """Class to run richness computation (runcat) on a single healpix pixel, for distributed runs.""" def __init__(self, configfile, pixel, nside, path=None): """Instantiate a RuncatPixelTask. Parameters ---------- configfile: `str` Configuration yaml filename. pixel: `int` Healpix p...
the_stack_v2_python_sparse
redmapper/pipeline/redmappertask.py
erykoff/redmapper
train
20
3be1e5861745c2424fd1a24a0940da6c1211a46e
[ "base.LIMIT_FLAG.AddToParser(parser)\nf = parser.add_argument('--where', default='', type=str, help='A filter spec for what operations to display.')\nf.detailed_help = ' A string for filtering operations. The following filter fields are\\n supported:\\n\\n createTime - The time this job was...
<|body_start_0|> base.LIMIT_FLAG.AddToParser(parser) f = parser.add_argument('--where', default='', type=str, help='A filter spec for what operations to display.') f.detailed_help = ' A string for filtering operations. The following filter fields are\n supported:\n\n cre...
List Genomics operations in a project. Prints a table with summary information on operations in the project.
List
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class List: """List Genomics operations in a project. Prints a table with summary information on operations in the project.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on...
stack_v2_sparse_classes_10k_train_007841
3,324
permissive
[ { "docstring": "Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positional arguments are allowed.", "name": "Args", "signature": "def Args(parser)" }, { "docstring"...
2
null
Implement the Python class `List` described below. Class description: List Genomics operations in a project. Prints a table with summary information on operations in the project. Method signatures and docstrings: - def Args(parser): Args is called by calliope to gather arguments for this command. Args: parser: An arg...
Implement the Python class `List` described below. Class description: List Genomics operations in a project. Prints a table with summary information on operations in the project. Method signatures and docstrings: - def Args(parser): Args is called by calliope to gather arguments for this command. Args: parser: An arg...
c98b58aeb0994e011df960163541e9379ae7ea06
<|skeleton|> class List: """List Genomics operations in a project. Prints a table with summary information on operations in the project.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class List: """List Genomics operations in a project. Prints a table with summary information on operations in the project.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command ...
the_stack_v2_python_sparse
google-cloud-sdk/.install/.backup/lib/surface/genomics/operations/list.py
KaranToor/MA450
train
1
9649de1fa39eeba6ff22ee66fe7f8285b650c110
[ "self._K_P = K_P\nself._K_D = K_D\nself._K_I = K_I\nself.error = 0.0\nself.error_integral = 0.0\nself.error_derivative = 0.0", "previous_error = self.error\nself.error = target_speed - current_speed\nself.error_integral = np.clip(self.error_integral + self.error, -40.0, 40.0)\nself.error_derivative = self.error -...
<|body_start_0|> self._K_P = K_P self._K_D = K_D self._K_I = K_I self.error = 0.0 self.error_integral = 0.0 self.error_derivative = 0.0 <|end_body_0|> <|body_start_1|> previous_error = self.error self.error = target_speed - current_speed self.erro...
PIDLongitudinalController implements longitudinal control using a PID.
PIDLongitudinalController
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PIDLongitudinalController: """PIDLongitudinalController implements longitudinal control using a PID.""" def __init__(self, K_P=1.0, K_D=0.0, K_I=0.0): """:param vehicle: actor to apply to local planner logic onto :param K_P: Proportional term :param K_D: Differential term :param K_I:...
stack_v2_sparse_classes_10k_train_007842
6,324
permissive
[ { "docstring": ":param vehicle: actor to apply to local planner logic onto :param K_P: Proportional term :param K_D: Differential term :param K_I: Integral term", "name": "__init__", "signature": "def __init__(self, K_P=1.0, K_D=0.0, K_I=0.0)" }, { "docstring": "Estimate the throttle of the vehi...
2
stack_v2_sparse_classes_30k_train_004866
Implement the Python class `PIDLongitudinalController` described below. Class description: PIDLongitudinalController implements longitudinal control using a PID. Method signatures and docstrings: - def __init__(self, K_P=1.0, K_D=0.0, K_I=0.0): :param vehicle: actor to apply to local planner logic onto :param K_P: Pr...
Implement the Python class `PIDLongitudinalController` described below. Class description: PIDLongitudinalController implements longitudinal control using a PID. Method signatures and docstrings: - def __init__(self, K_P=1.0, K_D=0.0, K_I=0.0): :param vehicle: actor to apply to local planner logic onto :param K_P: Pr...
e9063d97ff5a724f76adbb1b852dc71da1dcfeec
<|skeleton|> class PIDLongitudinalController: """PIDLongitudinalController implements longitudinal control using a PID.""" def __init__(self, K_P=1.0, K_D=0.0, K_I=0.0): """:param vehicle: actor to apply to local planner logic onto :param K_P: Proportional term :param K_D: Differential term :param K_I:...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PIDLongitudinalController: """PIDLongitudinalController implements longitudinal control using a PID.""" def __init__(self, K_P=1.0, K_D=0.0, K_I=0.0): """:param vehicle: actor to apply to local planner logic onto :param K_P: Proportional term :param K_D: Differential term :param K_I: Integral ter...
the_stack_v2_python_sparse
carla_ad_agent/src/carla_ad_agent/vehicle_pid_controller.py
carla-simulator/ros-bridge
train
448
22b892923124f6f7b7432370b83ad91b0c545419
[ "super(MaskNet, self).__init__()\nself.prep_block_1 = nn.Sequential(nn.Conv2d(in_channels=in_channels, out_channels=32, kernel_size=3, padding=1), nn.ReLU(), nn.BatchNorm2d(32), nn.Dropout(dropout_rate))\nself.prep_block_2 = nn.Sequential(nn.Conv2d(in_channels=in_channels, out_channels=32, kernel_size=3, padding=1)...
<|body_start_0|> super(MaskNet, self).__init__() self.prep_block_1 = nn.Sequential(nn.Conv2d(in_channels=in_channels, out_channels=32, kernel_size=3, padding=1), nn.ReLU(), nn.BatchNorm2d(32), nn.Dropout(dropout_rate)) self.prep_block_2 = nn.Sequential(nn.Conv2d(in_channels=in_channels, out_chan...
MaskNet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MaskNet: def __init__(self, dropout_rate=0.0, in_channels=3): """This function instantiates all the model layers.""" <|body_0|> def forward(self, x): """This function defines the forward pass of the model. Args: x: Input. Returns: Model output.""" <|body_1|> ...
stack_v2_sparse_classes_10k_train_007843
1,855
permissive
[ { "docstring": "This function instantiates all the model layers.", "name": "__init__", "signature": "def __init__(self, dropout_rate=0.0, in_channels=3)" }, { "docstring": "This function defines the forward pass of the model. Args: x: Input. Returns: Model output.", "name": "forward", "s...
2
stack_v2_sparse_classes_30k_train_002768
Implement the Python class `MaskNet` described below. Class description: Implement the MaskNet class. Method signatures and docstrings: - def __init__(self, dropout_rate=0.0, in_channels=3): This function instantiates all the model layers. - def forward(self, x): This function defines the forward pass of the model. A...
Implement the Python class `MaskNet` described below. Class description: Implement the MaskNet class. Method signatures and docstrings: - def __init__(self, dropout_rate=0.0, in_channels=3): This function instantiates all the model layers. - def forward(self, x): This function defines the forward pass of the model. A...
2eea883c96bf106774ea94464fc16c6baea86a95
<|skeleton|> class MaskNet: def __init__(self, dropout_rate=0.0, in_channels=3): """This function instantiates all the model layers.""" <|body_0|> def forward(self, x): """This function defines the forward pass of the model. Args: x: Input. Returns: Model output.""" <|body_1|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MaskNet: def __init__(self, dropout_rate=0.0, in_channels=3): """This function instantiates all the model layers.""" super(MaskNet, self).__init__() self.prep_block_1 = nn.Sequential(nn.Conv2d(in_channels=in_channels, out_channels=32, kernel_size=3, padding=1), nn.ReLU(), nn.BatchNorm2...
the_stack_v2_python_sparse
tensornet/model/masknet.py
shan18/Depth-Estimation-Segmentation
train
7
a63fcd94ca0865893d29f0e633366c85e521b29c
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn ScheduleInformation()", "from .free_busy_error import FreeBusyError\nfrom .schedule_item import ScheduleItem\nfrom .working_hours import WorkingHours\nfrom .free_busy_error import FreeBusyError\nfrom .schedule_item import ScheduleItem\...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return ScheduleInformation() <|end_body_0|> <|body_start_1|> from .free_busy_error import FreeBusyError from .schedule_item import ScheduleItem from .working_hours import WorkingHours ...
ScheduleInformation
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScheduleInformation: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ScheduleInformation: """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 ob...
stack_v2_sparse_classes_10k_train_007844
4,465
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: ScheduleInformation", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator...
3
null
Implement the Python class `ScheduleInformation` described below. Class description: Implement the ScheduleInformation class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ScheduleInformation: Creates a new instance of the appropriate class based on d...
Implement the Python class `ScheduleInformation` described below. Class description: Implement the ScheduleInformation class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ScheduleInformation: Creates a new instance of the appropriate class based on d...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class ScheduleInformation: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ScheduleInformation: """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 ob...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ScheduleInformation: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ScheduleInformation: """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: ...
the_stack_v2_python_sparse
msgraph/generated/models/schedule_information.py
microsoftgraph/msgraph-sdk-python
train
135
e71e7cac4c12355acd936e4d145765c87fe6ec08
[ "torch.nn.Module.__init__(self)\nself._is_all = is_all\nif self._is_all:\n self.features = torchvision.models.vgg16(pretrained=True).features\n self.features = torch.nn.Sequential(*list(self.features.children())[:-2])\nself.relu5_3 = torch.nn.ReLU(inplace=False)\nself.fc = torch.nn.Linear(in_features=512 * 51...
<|body_start_0|> torch.nn.Module.__init__(self) self._is_all = is_all if self._is_all: self.features = torchvision.models.vgg16(pretrained=True).features self.features = torch.nn.Sequential(*list(self.features.children())[:-2]) self.relu5_3 = torch.nn.ReLU(inplace...
Mean field B-CNN model. The B-CNN model is illustrated as follows. conv1^2 (64) -> pool1 -> conv2^2 (128) -> pool2 -> conv3^3 (256) -> pool3 -> conv4^3 (512) -> pool4 -> conv5^3 (512) -> mean field bilinear pooling -> fc. The network accepts a 3*448*448 input, and the relu5-3 activation has shape 512*28*28 since we dow...
BCNN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BCNN: """Mean field B-CNN model. The B-CNN model is illustrated as follows. conv1^2 (64) -> pool1 -> conv2^2 (128) -> pool2 -> conv3^3 (256) -> pool3 -> conv4^3 (512) -> pool4 -> conv5^3 (512) -> mean field bilinear pooling -> fc. The network accepts a 3*448*448 input, and the relu5-3 activation ...
stack_v2_sparse_classes_10k_train_007845
3,951
no_license
[ { "docstring": "Declare all needed layers. Args: num_classes, int. is_all, bool: In the all/fc phase.", "name": "__init__", "signature": "def __init__(self, num_classes, is_all)" }, { "docstring": "Initialize the weight and bias for each module. Args: module, torch.nn.Module.", "name": "_ini...
3
null
Implement the Python class `BCNN` described below. Class description: Mean field B-CNN model. The B-CNN model is illustrated as follows. conv1^2 (64) -> pool1 -> conv2^2 (128) -> pool2 -> conv3^3 (256) -> pool3 -> conv4^3 (512) -> pool4 -> conv5^3 (512) -> mean field bilinear pooling -> fc. The network accepts a 3*448...
Implement the Python class `BCNN` described below. Class description: Mean field B-CNN model. The B-CNN model is illustrated as follows. conv1^2 (64) -> pool1 -> conv2^2 (128) -> pool2 -> conv3^3 (256) -> pool3 -> conv4^3 (512) -> pool4 -> conv5^3 (512) -> mean field bilinear pooling -> fc. The network accepts a 3*448...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class BCNN: """Mean field B-CNN model. The B-CNN model is illustrated as follows. conv1^2 (64) -> pool1 -> conv2^2 (128) -> pool2 -> conv3^3 (256) -> pool3 -> conv4^3 (512) -> pool4 -> conv5^3 (512) -> mean field bilinear pooling -> fc. The network accepts a 3*448*448 input, and the relu5-3 activation ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BCNN: """Mean field B-CNN model. The B-CNN model is illustrated as follows. conv1^2 (64) -> pool1 -> conv2^2 (128) -> pool2 -> conv3^3 (256) -> pool3 -> conv4^3 (512) -> pool4 -> conv5^3 (512) -> mean field bilinear pooling -> fc. The network accepts a 3*448*448 input, and the relu5-3 activation has shape 512...
the_stack_v2_python_sparse
generated/test_HaoMood_blinear_cnn_faster.py
jansel/pytorch-jit-paritybench
train
35
b32b0a4215af658ed83ab312436444e2f3ed0602
[ "n = [x * x for x in nums]\nn.sort()\nreturn n", "res = [0 for _ in range(len(nums))]\nl, r = (0, len(nums) - 1)\nfor idx in reversed(range(len(nums))):\n l_v = nums[l]\n r_v = nums[r]\n if abs(l_v) >= abs(r_v):\n res[idx] = l_v * l_v\n l += 1\n else:\n res[idx] = r_v * r_v\n ...
<|body_start_0|> n = [x * x for x in nums] n.sort() return n <|end_body_0|> <|body_start_1|> res = [0 for _ in range(len(nums))] l, r = (0, len(nums) - 1) for idx in reversed(range(len(nums))): l_v = nums[l] r_v = nums[r] if abs(l_v) >...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def sortedSquares(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def sortedSquares_1(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = [x * x for x in nums] ...
stack_v2_sparse_classes_10k_train_007846
931
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "sortedSquares", "signature": "def sortedSquares(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "sortedSquares_1", "signature": "def sortedSquares_1(self, nums)" } ]
2
stack_v2_sparse_classes_30k_val_000341
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortedSquares(self, nums): :type nums: List[int] :rtype: List[int] - def sortedSquares_1(self, nums): :type nums: List[int] :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortedSquares(self, nums): :type nums: List[int] :rtype: List[int] - def sortedSquares_1(self, nums): :type nums: List[int] :rtype: List[int] <|skeleton|> class Solution: ...
8cdb97bc7588b96b91b1c550afd84e976c1926e0
<|skeleton|> class Solution: def sortedSquares(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def sortedSquares_1(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def sortedSquares(self, nums): """:type nums: List[int] :rtype: List[int]""" n = [x * x for x in nums] n.sort() return n def sortedSquares_1(self, nums): """:type nums: List[int] :rtype: List[int]""" res = [0 for _ in range(len(nums))] l, ...
the_stack_v2_python_sparse
Array/977_SquaresofSortedArray.py
ZhengLiangliang1996/Leetcode_ML_Daily
train
1
f90c0ea36d3fa13212380b15cadb34035cd80dc5
[ "wave = numpy.convolve(one.waveform, two.waveform, mode)\nwave.resize(len(one.waveform))\nsuper().__init__(name, one.times, wave)\nself.one = one\nself.two = two", "if key in ('', 'both', 'whole', 'self', 0, 3):\n return self\nif key in ('one', 1, self.one.name):\n return self.one\nif key in ('two', 2, self...
<|body_start_0|> wave = numpy.convolve(one.waveform, two.waveform, mode) wave.resize(len(one.waveform)) super().__init__(name, one.times, wave) self.one = one self.two = two <|end_body_0|> <|body_start_1|> if key in ('', 'both', 'whole', 'self', 0, 3): return...
A signal formed from the convolution of two signals.
Convolution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Convolution: """A signal formed from the convolution of two signals.""" def __init__(self, name, one, two, mode='full'): """Create measure from two signals.""" <|body_0|> def component(self, key): """Return component by identifying key.""" <|body_1|> <|e...
stack_v2_sparse_classes_10k_train_007847
25,189
no_license
[ { "docstring": "Create measure from two signals.", "name": "__init__", "signature": "def __init__(self, name, one, two, mode='full')" }, { "docstring": "Return component by identifying key.", "name": "component", "signature": "def component(self, key)" } ]
2
stack_v2_sparse_classes_30k_train_004481
Implement the Python class `Convolution` described below. Class description: A signal formed from the convolution of two signals. Method signatures and docstrings: - def __init__(self, name, one, two, mode='full'): Create measure from two signals. - def component(self, key): Return component by identifying key.
Implement the Python class `Convolution` described below. Class description: A signal formed from the convolution of two signals. Method signatures and docstrings: - def __init__(self, name, one, two, mode='full'): Create measure from two signals. - def component(self, key): Return component by identifying key. <|sk...
bfaea8464a9f777e5b59216b265fd68fb22564ae
<|skeleton|> class Convolution: """A signal formed from the convolution of two signals.""" def __init__(self, name, one, two, mode='full'): """Create measure from two signals.""" <|body_0|> def component(self, key): """Return component by identifying key.""" <|body_1|> <|e...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Convolution: """A signal formed from the convolution of two signals.""" def __init__(self, name, one, two, mode='full'): """Create measure from two signals.""" wave = numpy.convolve(one.waveform, two.waveform, mode) wave.resize(len(one.waveform)) super().__init__(name, one...
the_stack_v2_python_sparse
wirecell/sigproc/fwd.py
WireCell/wire-cell-python
train
0
0610dc5dbcbf1f512f6285bdb1beff7f96cdd032
[ "self.db = db\nself.verbose = verbose\nself.notification_type = notification_type\nself.notification_origin = notification_origin\nself.process_id = process_id", "type_id = self.db.grep_id_from_lookup_table(id_field_name='NotificationTypeID', table_name='notification_types', where_field_name='Type', where_value=s...
<|body_start_0|> self.db = db self.verbose = verbose self.notification_type = notification_type self.notification_origin = notification_origin self.process_id = process_id <|end_body_0|> <|body_start_1|> type_id = self.db.grep_id_from_lookup_table(id_field_name='Notifica...
Notification
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Notification: def __init__(self, db, verbose, notification_type, notification_origin, process_id): """Constructor method for the Notification class. :param db : Database class object :type db : object :param verbose : whether to be verbose :type verbose : bool :param notification_type : ...
stack_v2_sparse_classes_10k_train_007848
2,669
no_license
[ { "docstring": "Constructor method for the Notification class. :param db : Database class object :type db : object :param verbose : whether to be verbose :type verbose : bool :param notification_type : notification type to use for the notification_spool table :type notification_type : str :param notification_or...
2
stack_v2_sparse_classes_30k_train_000614
Implement the Python class `Notification` described below. Class description: Implement the Notification class. Method signatures and docstrings: - def __init__(self, db, verbose, notification_type, notification_origin, process_id): Constructor method for the Notification class. :param db : Database class object :typ...
Implement the Python class `Notification` described below. Class description: Implement the Notification class. Method signatures and docstrings: - def __init__(self, db, verbose, notification_type, notification_origin, process_id): Constructor method for the Notification class. :param db : Database class object :typ...
f9df1b78cd96882009264d7fba122b294c7c6329
<|skeleton|> class Notification: def __init__(self, db, verbose, notification_type, notification_origin, process_id): """Constructor method for the Notification class. :param db : Database class object :type db : object :param verbose : whether to be verbose :type verbose : bool :param notification_type : ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Notification: def __init__(self, db, verbose, notification_type, notification_origin, process_id): """Constructor method for the Notification class. :param db : Database class object :type db : object :param verbose : whether to be verbose :type verbose : bool :param notification_type : notification t...
the_stack_v2_python_sparse
python/lib/database_lib/notification.py
gdevenyi/Loris-MRI
train
0
d9f34536eca44349f6a7c0bf12d4855b55c7f585
[ "self.describer_model = _load_model(name)\nif level is None:\n n_layers = sum((i.startswith(('meg_net', 'megnet')) for i in self.describer_model.valid_names)) // 3\n level = n_layers\nself.name = name\nself.level = level\nself.mode = mode\nif stats is None:\n stats = ['min', 'max', 'range', 'mean', 'mean_a...
<|body_start_0|> self.describer_model = _load_model(name) if level is None: n_layers = sum((i.startswith(('meg_net', 'megnet')) for i in self.describer_model.valid_names)) // 3 level = n_layers self.name = name self.level = level self.mode = mode i...
Use megnet pre-trained models as featurizer to get structural features. There are two methods to get structural descriptors from megnet models. mode: 'site_stats': Calculate the site features, and then use maml.utils.stats to compute the feature-wise statistics. This requires the specification of level 'site_readout': ...
MEGNetStructure
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MEGNetStructure: """Use megnet pre-trained models as featurizer to get structural features. There are two methods to get structural descriptors from megnet models. mode: 'site_stats': Calculate the site features, and then use maml.utils.stats to compute the feature-wise statistics. This requires ...
stack_v2_sparse_classes_10k_train_007849
7,639
permissive
[ { "docstring": "Args:s name (str or megnet.models.GraphModel): models name keys, megnet models path or a MEGNet GraphModel, if no name is provided, the models will be Eform_MP_2019. mode (str): choose one from ['site_stats', 'site_readout', 'final']. 'site_stats': Calculate the site features, and then use maml....
4
stack_v2_sparse_classes_30k_train_005996
Implement the Python class `MEGNetStructure` described below. Class description: Use megnet pre-trained models as featurizer to get structural features. There are two methods to get structural descriptors from megnet models. mode: 'site_stats': Calculate the site features, and then use maml.utils.stats to compute the ...
Implement the Python class `MEGNetStructure` described below. Class description: Use megnet pre-trained models as featurizer to get structural features. There are two methods to get structural descriptors from megnet models. mode: 'site_stats': Calculate the site features, and then use maml.utils.stats to compute the ...
6ae3c7029b939e1183684358a3ae2fef41053be5
<|skeleton|> class MEGNetStructure: """Use megnet pre-trained models as featurizer to get structural features. There are two methods to get structural descriptors from megnet models. mode: 'site_stats': Calculate the site features, and then use maml.utils.stats to compute the feature-wise statistics. This requires ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MEGNetStructure: """Use megnet pre-trained models as featurizer to get structural features. There are two methods to get structural descriptors from megnet models. mode: 'site_stats': Calculate the site features, and then use maml.utils.stats to compute the feature-wise statistics. This requires the specifica...
the_stack_v2_python_sparse
maml/describers/_megnet.py
materialsvirtuallab/maml
train
266
1a443b76c13e15eed4842416b38f2faae4813523
[ "while True:\n logger.info('extracting movies from postgres')\n df = (yield)\n if not df.empty:\n genres_ids = id_list(df['id'])\n query = f'\\n SELECT movie_id, array_agg(name) as genre\\n FROM genre\\n JOIN (SELECT * FROM ...
<|body_start_0|> while True: logger.info('extracting movies from postgres') df = (yield) if not df.empty: genres_ids = id_list(df['id']) query = f'\n SELECT movie_id, array_agg(name) as genre\n FROM...
Class for etl process, which moves data from postgres DB to elasticsearch
GenreETL
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GenreETL: """Class for etl process, which moves data from postgres DB to elasticsearch""" def extract_first_level_connections(self, data): """Coroutine that queries postgres to get genres based on the movies ids gotten in the previous step :param data: :return: dataframe with genres ...
stack_v2_sparse_classes_10k_train_007850
2,866
no_license
[ { "docstring": "Coroutine that queries postgres to get genres based on the movies ids gotten in the previous step :param data: :return: dataframe with genres data + movies", "name": "extract_first_level_connections", "signature": "def extract_first_level_connections(self, data)" }, { "docstring"...
2
stack_v2_sparse_classes_30k_train_001318
Implement the Python class `GenreETL` described below. Class description: Class for etl process, which moves data from postgres DB to elasticsearch Method signatures and docstrings: - def extract_first_level_connections(self, data): Coroutine that queries postgres to get genres based on the movies ids gotten in the p...
Implement the Python class `GenreETL` described below. Class description: Class for etl process, which moves data from postgres DB to elasticsearch Method signatures and docstrings: - def extract_first_level_connections(self, data): Coroutine that queries postgres to get genres based on the movies ids gotten in the p...
4ddc8a77e5a9e9bc2a900c7bb6ffbcf5999e8c89
<|skeleton|> class GenreETL: """Class for etl process, which moves data from postgres DB to elasticsearch""" def extract_first_level_connections(self, data): """Coroutine that queries postgres to get genres based on the movies ids gotten in the previous step :param data: :return: dataframe with genres ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GenreETL: """Class for etl process, which moves data from postgres DB to elasticsearch""" def extract_first_level_connections(self, data): """Coroutine that queries postgres to get genres based on the movies ids gotten in the previous step :param data: :return: dataframe with genres data + movies...
the_stack_v2_python_sparse
postgres_to_es/etl_genre.py
maffka123/Admin_panel_sprint_2
train
0
9e3e9c30f9b8440388e8e6677e1d7cc7b14c7f91
[ "e = Furniture('test product code', 'test description', 'test market price', 'test rental price', 'test material', 'test size')\nself.assertEqual(e.product_code, 'test product code')\nself.assertEqual(e.description, 'test description')\nself.assertEqual(e.market_price, 'test market price')\nself.assertEqual(e.renta...
<|body_start_0|> e = Furniture('test product code', 'test description', 'test market price', 'test rental price', 'test material', 'test size') self.assertEqual(e.product_code, 'test product code') self.assertEqual(e.description, 'test description') self.assertEqual(e.market_price, 'test...
FurnitureTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FurnitureTest: def test_furniture_init(self): """Tests that Furniture can be initiated""" <|body_0|> def test_furniture_return(self): """Tests Furniture return_as_dictionary""" <|body_1|> <|end_skeleton|> <|body_start_0|> e = Furniture('test product...
stack_v2_sparse_classes_10k_train_007851
9,076
no_license
[ { "docstring": "Tests that Furniture can be initiated", "name": "test_furniture_init", "signature": "def test_furniture_init(self)" }, { "docstring": "Tests Furniture return_as_dictionary", "name": "test_furniture_return", "signature": "def test_furniture_return(self)" } ]
2
stack_v2_sparse_classes_30k_train_003075
Implement the Python class `FurnitureTest` described below. Class description: Implement the FurnitureTest class. Method signatures and docstrings: - def test_furniture_init(self): Tests that Furniture can be initiated - def test_furniture_return(self): Tests Furniture return_as_dictionary
Implement the Python class `FurnitureTest` described below. Class description: Implement the FurnitureTest class. Method signatures and docstrings: - def test_furniture_init(self): Tests that Furniture can be initiated - def test_furniture_return(self): Tests Furniture return_as_dictionary <|skeleton|> class Furnitu...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class FurnitureTest: def test_furniture_init(self): """Tests that Furniture can be initiated""" <|body_0|> def test_furniture_return(self): """Tests Furniture return_as_dictionary""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FurnitureTest: def test_furniture_init(self): """Tests that Furniture can be initiated""" e = Furniture('test product code', 'test description', 'test market price', 'test rental price', 'test material', 'test size') self.assertEqual(e.product_code, 'test product code') self.as...
the_stack_v2_python_sparse
students/kyle_lehning/Lesson01/test_unit.py
JavaRod/SP_Python220B_2019
train
1
162d0fdc1f6466634341acc039c5baca02ec03f3
[ "self.prob = prob\nself.flip_axis = flip_axis\nsuper().__init__()", "if isinstance(self.flip_axis, (tuple, list)):\n flip_axis = self.flip_axis[random.randint(0, len(self.flip_axis) - 1)]\nelse:\n flip_axis = self.flip_axis\nif random.random() < self.prob:\n img = F.flip_3d(img, axis=flip_axis)\n if l...
<|body_start_0|> self.prob = prob self.flip_axis = flip_axis super().__init__() <|end_body_0|> <|body_start_1|> if isinstance(self.flip_axis, (tuple, list)): flip_axis = self.flip_axis[random.randint(0, len(self.flip_axis) - 1)] else: flip_axis = self.fli...
Flip an 4D image with a certain probability. Args: prob (float, optional): A probability of vertical flipping. Default: 0.1.
RandomFlip4D
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomFlip4D: """Flip an 4D image with a certain probability. Args: prob (float, optional): A probability of vertical flipping. Default: 0.1.""" def __init__(self, prob=0.5, flip_axis=[0, 1, 2]): """init""" <|body_0|> def __call__(self, img, label=None): """Args:...
stack_v2_sparse_classes_10k_train_007852
34,927
permissive
[ { "docstring": "init", "name": "__init__", "signature": "def __init__(self, prob=0.5, flip_axis=[0, 1, 2])" }, { "docstring": "Args: img (numpy ndarray): 4D Image to be flipped. label (numpy ndarray): 4D Label to be flipped. Returns: (np.array). Image after transformation.", "name": "__call_...
2
null
Implement the Python class `RandomFlip4D` described below. Class description: Flip an 4D image with a certain probability. Args: prob (float, optional): A probability of vertical flipping. Default: 0.1. Method signatures and docstrings: - def __init__(self, prob=0.5, flip_axis=[0, 1, 2]): init - def __call__(self, im...
Implement the Python class `RandomFlip4D` described below. Class description: Flip an 4D image with a certain probability. Args: prob (float, optional): A probability of vertical flipping. Default: 0.1. Method signatures and docstrings: - def __init__(self, prob=0.5, flip_axis=[0, 1, 2]): init - def __call__(self, im...
2c8c35a8949fef74599f5ec557d340a14415f20d
<|skeleton|> class RandomFlip4D: """Flip an 4D image with a certain probability. Args: prob (float, optional): A probability of vertical flipping. Default: 0.1.""" def __init__(self, prob=0.5, flip_axis=[0, 1, 2]): """init""" <|body_0|> def __call__(self, img, label=None): """Args:...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RandomFlip4D: """Flip an 4D image with a certain probability. Args: prob (float, optional): A probability of vertical flipping. Default: 0.1.""" def __init__(self, prob=0.5, flip_axis=[0, 1, 2]): """init""" self.prob = prob self.flip_axis = flip_axis super().__init__() ...
the_stack_v2_python_sparse
contrib/MedicalSeg/medicalseg/transforms/transform.py
PaddlePaddle/PaddleSeg
train
8,531
3db427bc4e54fae296e6d7dc252b4bb05b8fa09b
[ "name = 'RandomSampling'\nsuper(RandomSampling, self).__init__(name, xmin, xmax, use_logger)\nif self.use_logger:\n self.logger = ml.SciopeLogger().get_logger()\n self.logger.info('Random design in {0} dimensions initialized'.format(len(self.xmin)))", "num_variables = len(self.xmin)\nx = np.random.rand(n, n...
<|body_start_0|> name = 'RandomSampling' super(RandomSampling, self).__init__(name, xmin, xmax, use_logger) if self.use_logger: self.logger = ml.SciopeLogger().get_logger() self.logger.info('Random design in {0} dimensions initialized'.format(len(self.xmin))) <|end_body_0...
Random Sampling implemented through gpflowopt Properties/variables: * name (RandomSampling) * xmin (lower bound of multi-dimensional space encompassing generated points) * xmax (upper bound of multi-dimensional space encompassing generated points) * logger (a logging object to display/save events - set by derived class...
RandomSampling
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomSampling: """Random Sampling implemented through gpflowopt Properties/variables: * name (RandomSampling) * xmin (lower bound of multi-dimensional space encompassing generated points) * xmax (upper bound of multi-dimensional space encompassing generated points) * logger (a logging object to ...
stack_v2_sparse_classes_10k_train_007853
2,961
permissive
[ { "docstring": "[summary] Parameters ---------- xmin : vector or 1D array Specifies the lower bound of the hypercube within which the design is generated xmax : vector or 1D array Specifies the upper bound of the hypercube within which the design is generated use_logger : bool, optional controls whether logging...
2
stack_v2_sparse_classes_30k_train_001393
Implement the Python class `RandomSampling` described below. Class description: Random Sampling implemented through gpflowopt Properties/variables: * name (RandomSampling) * xmin (lower bound of multi-dimensional space encompassing generated points) * xmax (upper bound of multi-dimensional space encompassing generated...
Implement the Python class `RandomSampling` described below. Class description: Random Sampling implemented through gpflowopt Properties/variables: * name (RandomSampling) * xmin (lower bound of multi-dimensional space encompassing generated points) * xmax (upper bound of multi-dimensional space encompassing generated...
5122107dedcee9c39458e83d853ec35f91268780
<|skeleton|> class RandomSampling: """Random Sampling implemented through gpflowopt Properties/variables: * name (RandomSampling) * xmin (lower bound of multi-dimensional space encompassing generated points) * xmax (upper bound of multi-dimensional space encompassing generated points) * logger (a logging object to ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RandomSampling: """Random Sampling implemented through gpflowopt Properties/variables: * name (RandomSampling) * xmin (lower bound of multi-dimensional space encompassing generated points) * xmax (upper bound of multi-dimensional space encompassing generated points) * logger (a logging object to display/save ...
the_stack_v2_python_sparse
sciope/designs/random_sampling.py
rmjiang7/sciope
train
0
f7567c1aa357965ae781c491098554bbf05d8124
[ "self.food = food[::-1]\nself.snake = collections.deque([[0, 0]])\nself.dim = [height, width]\nself.score = 0", "dis = {'U': [-1, 0], 'L': [0, -1], 'R': [0, 1], 'D': [1, 0]}\nnext_pos = [self.snake[-1][0] + dis[direction][0], self.snake[-1][1] + dis[direction][1]]\nif not (0 <= next_pos[0] < self.dim[0] and 0 <= ...
<|body_start_0|> self.food = food[::-1] self.snake = collections.deque([[0, 0]]) self.dim = [height, width] self.score = 0 <|end_body_0|> <|body_start_1|> dis = {'U': [-1, 0], 'L': [0, -1], 'R': [0, 1], 'D': [1, 0]} next_pos = [self.snake[-1][0] + dis[direction][0], self...
SnakeGame
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SnakeGame: def __init__(self, width, height, food): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :typ...
stack_v2_sparse_classes_10k_train_007854
1,880
no_license
[ { "docstring": "Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :type width: int :type height: int :type food: List[List[int]]", ...
2
stack_v2_sparse_classes_30k_train_002800
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width, height, food): Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E...
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width, height, food): Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E...
c33559dc5e0bf6879bb3462ab65a9446a66d19f6
<|skeleton|> class SnakeGame: def __init__(self, width, height, food): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :typ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SnakeGame: def __init__(self, width, height, food): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :type width: int :...
the_stack_v2_python_sparse
353.py
htl1126/leetcode
train
7
eda308e80ef9f67f76eb58bcff984e82e9b8b21f
[ "super(lsf_sm, self).check()\nif 'WALLTIME' not in PAR:\n setattr(PAR, 'WALLTIME', 30.0)\nif 'LSFARGS' not in PAR:\n setattr(PAR, 'LSFARGS', '')", "unix.mkdir(PATH.OUTPUT)\nunix.cd(PATH.OUTPUT)\nunix.mkdir(PATH.SUBMIT + '/' + 'output.lsf')\nself.checkpoint()\nunix.run('bsub ' + '%s ' % PAR.LSFARGS + '-J %s ...
<|body_start_0|> super(lsf_sm, self).check() if 'WALLTIME' not in PAR: setattr(PAR, 'WALLTIME', 30.0) if 'LSFARGS' not in PAR: setattr(PAR, 'LSFARGS', '') <|end_body_0|> <|body_start_1|> unix.mkdir(PATH.OUTPUT) unix.cd(PATH.OUTPUT) unix.mkdir(PATH...
An interface through which to submit workflows, run tasks in serial or parallel, and perform other system functions. By hiding environment details behind a python interface layer, these classes provide a consistent command set across different computing environments. Intermediate files are written to a global scratch p...
lsf_sm
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class lsf_sm: """An interface through which to submit workflows, run tasks in serial or parallel, and perform other system functions. By hiding environment details behind a python interface layer, these classes provide a consistent command set across different computing environments. Intermediate files...
stack_v2_sparse_classes_10k_train_007855
2,039
permissive
[ { "docstring": "Checks parameters and paths", "name": "check", "signature": "def check(self)" }, { "docstring": "Submits workflow", "name": "submit", "signature": "def submit(self, workflow)" } ]
2
stack_v2_sparse_classes_30k_train_000607
Implement the Python class `lsf_sm` described below. Class description: An interface through which to submit workflows, run tasks in serial or parallel, and perform other system functions. By hiding environment details behind a python interface layer, these classes provide a consistent command set across different com...
Implement the Python class `lsf_sm` described below. Class description: An interface through which to submit workflows, run tasks in serial or parallel, and perform other system functions. By hiding environment details behind a python interface layer, these classes provide a consistent command set across different com...
47725866ac516767c9eb536f4a0e86c7c0b97482
<|skeleton|> class lsf_sm: """An interface through which to submit workflows, run tasks in serial or parallel, and perform other system functions. By hiding environment details behind a python interface layer, these classes provide a consistent command set across different computing environments. Intermediate files...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class lsf_sm: """An interface through which to submit workflows, run tasks in serial or parallel, and perform other system functions. By hiding environment details behind a python interface layer, these classes provide a consistent command set across different computing environments. Intermediate files are written ...
the_stack_v2_python_sparse
seisflows/system/lsf_sm.py
yanhuay/seisflows
train
1
8d7b3cf0b1e2a111e3d8a82569e91076c37a4e87
[ "objs = IndivRecord.objects.distinct('discipline').order_by('discipline')\nfor obj in objs:\n obj.titel = disc2str[obj.discipline]\n obj.img_src = DISCIPLINE_TO_ICON[obj.discipline]\n obj.tekst = 'Toon alle verbeterbare records van de discipline %s.' % obj.titel\n url_disc = disc2url[obj.discipline]\n ...
<|body_start_0|> objs = IndivRecord.objects.distinct('discipline').order_by('discipline') for obj in objs: obj.titel = disc2str[obj.discipline] obj.img_src = DISCIPLINE_TO_ICON[obj.discipline] obj.tekst = 'Toon alle verbeterbare records van de discipline %s.' % obj.ti...
Deze view laat de gebruiker een discipline kiezen
RecordsVerbeterbaarKiesDisc
[ "BSD-3-Clause-Clear" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RecordsVerbeterbaarKiesDisc: """Deze view laat de gebruiker een discipline kiezen""" def get_queryset(self): """called by the template system to get the queryset or list of objects for the template""" <|body_0|> def get_context_data(self, **kwargs): """called by ...
stack_v2_sparse_classes_10k_train_007856
8,410
permissive
[ { "docstring": "called by the template system to get the queryset or list of objects for the template", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docstring": "called by the template system to get the context data for the template", "name": "get_context_data", "s...
2
null
Implement the Python class `RecordsVerbeterbaarKiesDisc` described below. Class description: Deze view laat de gebruiker een discipline kiezen Method signatures and docstrings: - def get_queryset(self): called by the template system to get the queryset or list of objects for the template - def get_context_data(self, ...
Implement the Python class `RecordsVerbeterbaarKiesDisc` described below. Class description: Deze view laat de gebruiker een discipline kiezen Method signatures and docstrings: - def get_queryset(self): called by the template system to get the queryset or list of objects for the template - def get_context_data(self, ...
5ed38165a231f0caa56f67e8faf2dd074916e500
<|skeleton|> class RecordsVerbeterbaarKiesDisc: """Deze view laat de gebruiker een discipline kiezen""" def get_queryset(self): """called by the template system to get the queryset or list of objects for the template""" <|body_0|> def get_context_data(self, **kwargs): """called by ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RecordsVerbeterbaarKiesDisc: """Deze view laat de gebruiker een discipline kiezen""" def get_queryset(self): """called by the template system to get the queryset or list of objects for the template""" objs = IndivRecord.objects.distinct('discipline').order_by('discipline') for obj...
the_stack_v2_python_sparse
Records/views_verbeterbaar.py
RamonvdW/nhb-apps
train
2
99e795009b80a64a729c3884b487c1440dd383c0
[ "db_session = get_db_session(db_session)\nif status is UserStatuses.Pending:\n return db_session.query(UserPending)\nif status is None:\n return db_session.query(cls.model)\nquery = db_session.query(cls.model)\nusers = []\nif UserStatuses.Pending in status:\n users = list(db_session.query(UserPending))\n ...
<|body_start_0|> db_session = get_db_session(db_session) if status is UserStatuses.Pending: return db_session.query(UserPending) if status is None: return db_session.query(cls.model) query = db_session.query(cls.model) users = [] if UserStatuses.Pe...
Extends the :mod:`ziggurat_foundations` :class:`UserService` with additional features provided by `Magpie`. .. note:: For any search result where parameter ``status`` is equal to or contains :attr:`UserStatuses.Pending` combined with any other :class:`UserStatuses` members, or through the *all* representation, the retu...
UserSearchService
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserSearchService: """Extends the :mod:`ziggurat_foundations` :class:`UserService` with additional features provided by `Magpie`. .. note:: For any search result where parameter ``status`` is equal to or contains :attr:`UserStatuses.Pending` combined with any other :class:`UserStatuses` members, ...
stack_v2_sparse_classes_10k_train_007857
42,346
permissive
[ { "docstring": "Search for appropriate :class:`User` and/or :class:`UserPending` according to specified :class:`UserStatuses`. When the :paramref:`status` is ``None``, *normal* retrieval of all non-pending :class:`User` is executed, as if directly using the :class:`UserService` implementation. Otherwise, a comb...
3
stack_v2_sparse_classes_30k_test_000012
Implement the Python class `UserSearchService` described below. Class description: Extends the :mod:`ziggurat_foundations` :class:`UserService` with additional features provided by `Magpie`. .. note:: For any search result where parameter ``status`` is equal to or contains :attr:`UserStatuses.Pending` combined with an...
Implement the Python class `UserSearchService` described below. Class description: Extends the :mod:`ziggurat_foundations` :class:`UserService` with additional features provided by `Magpie`. .. note:: For any search result where parameter ``status`` is equal to or contains :attr:`UserStatuses.Pending` combined with an...
f9b00c6142372aff96fd0edf0537c8b383fd5ee9
<|skeleton|> class UserSearchService: """Extends the :mod:`ziggurat_foundations` :class:`UserService` with additional features provided by `Magpie`. .. note:: For any search result where parameter ``status`` is equal to or contains :attr:`UserStatuses.Pending` combined with any other :class:`UserStatuses` members, ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UserSearchService: """Extends the :mod:`ziggurat_foundations` :class:`UserService` with additional features provided by `Magpie`. .. note:: For any search result where parameter ``status`` is equal to or contains :attr:`UserStatuses.Pending` combined with any other :class:`UserStatuses` members, or through th...
the_stack_v2_python_sparse
magpie/models.py
Ouranosinc/Magpie
train
2
3312127a5ca9af17720696d0f5af8e7cc56b1034
[ "res = []\n\ndef preOrder(root):\n if not root:\n res.append('#')\n else:\n res.append(str(root.val))\n preOrder(root.left)\n preOrder(root.right)\npreOrder(root)\nreturn ','.join(res)", "def helper(l):\n if l[0] == '#':\n l.pop(0)\n return None\n root = TreeN...
<|body_start_0|> res = [] def preOrder(root): if not root: res.append('#') else: res.append(str(root.val)) preOrder(root.left) preOrder(root.right) preOrder(root) return ','.join(res) <|end_body_0|> ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = [] def preOrder(root): ...
stack_v2_sparse_classes_10k_train_007858
1,827
no_license
[ { "docstring": "Encodes a tree to a single string.", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree.", "name": "deserialize", "signature": "def deserialize(self, data)" } ]
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. - def deserialize(self, data): Decodes your encoded data to tree.
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. - def deserialize(self, data): Decodes your encoded data to tree. <|skeleton|> class Codec: def serialize(self, root...
44765a7d89423b7ec2c159f70b1a6f6e446523c2
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string.""" res = [] def preOrder(root): if not root: res.append('#') else: res.append(str(root.val)) preOrder(root.left) preOrder(roo...
the_stack_v2_python_sparse
python/CodingInterviews_2/37_xu-lie-hua-er-cha-shu-lcof.py
Wang-Yann/LeetCodeMe
train
0
ca29d42d1bed4bac7ffb6edb0e8ab94fd5891b5f
[ "super().__init__()\nself.pos_iou_thr = desc['pos_iou_thr']\nself.neg_iou_thr = desc['neg_iou_thr']\nself.min_pos_iou = desc['min_pos_iou'] if 'min_pos_iou' in desc else 0.0\nself.gt_max_assign_all = desc['gt_max_assign_all'] if 'gt_max_assign_all' in desc else True\nself.ignore_iof_thr = desc['ignore_iof_thr'] if ...
<|body_start_0|> super().__init__() self.pos_iou_thr = desc['pos_iou_thr'] self.neg_iou_thr = desc['neg_iou_thr'] self.min_pos_iou = desc['min_pos_iou'] if 'min_pos_iou' in desc else 0.0 self.gt_max_assign_all = desc['gt_max_assign_all'] if 'gt_max_assign_all' in desc else True ...
All negative assigner use max iou.
MaxIoUAllNegAssigner
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MaxIoUAllNegAssigner: """All negative assigner use max iou.""" def __init__(self, desc): """Init Max iou all neg assigner. :param desc: config dict""" <|body_0|> def assign(self, bboxes, gt_bboxes, gt_bboxes_ignore=None, gt_labels=None): """Assign. :param bboxes:...
stack_v2_sparse_classes_10k_train_007859
5,437
permissive
[ { "docstring": "Init Max iou all neg assigner. :param desc: config dict", "name": "__init__", "signature": "def __init__(self, desc)" }, { "docstring": "Assign. :param bboxes: bboxes :param gt_bboxes: ground truth boxes :param gt_bboxes_ignore: ground truth boxes need to be ignored :param gt_lab...
3
null
Implement the Python class `MaxIoUAllNegAssigner` described below. Class description: All negative assigner use max iou. Method signatures and docstrings: - def __init__(self, desc): Init Max iou all neg assigner. :param desc: config dict - def assign(self, bboxes, gt_bboxes, gt_bboxes_ignore=None, gt_labels=None): A...
Implement the Python class `MaxIoUAllNegAssigner` described below. Class description: All negative assigner use max iou. Method signatures and docstrings: - def __init__(self, desc): Init Max iou all neg assigner. :param desc: config dict - def assign(self, bboxes, gt_bboxes, gt_bboxes_ignore=None, gt_labels=None): A...
df51ed9c1d6dbde1deef63f2a037a369f8554406
<|skeleton|> class MaxIoUAllNegAssigner: """All negative assigner use max iou.""" def __init__(self, desc): """Init Max iou all neg assigner. :param desc: config dict""" <|body_0|> def assign(self, bboxes, gt_bboxes, gt_bboxes_ignore=None, gt_labels=None): """Assign. :param bboxes:...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MaxIoUAllNegAssigner: """All negative assigner use max iou.""" def __init__(self, desc): """Init Max iou all neg assigner. :param desc: config dict""" super().__init__() self.pos_iou_thr = desc['pos_iou_thr'] self.neg_iou_thr = desc['neg_iou_thr'] self.min_pos_iou ...
the_stack_v2_python_sparse
built-in/TensorFlow/Research/cv/image_classification/Darts_for_TensorFlow/automl/vega/search_space/networks/pytorch/utils/bbox_utils/assigner/all_neg_assigner.py
Huawei-Ascend/modelzoo
train
1
0e854a71321f5444b3a2f992ed4427f0f0f830c8
[ "self.run.start()\ncurrent_stage = self.run.start_stage\ntry:\n intent_input = self.intent_input\n if current_stage == PipelineStage.STT:\n assert self.stt_metadata is not None\n assert self.stt_stream is not None\n intent_input = await self.run.speech_to_text(self.stt_metadata, self.stt_...
<|body_start_0|> self.run.start() current_stage = self.run.start_stage try: intent_input = self.intent_input if current_stage == PipelineStage.STT: assert self.stt_metadata is not None assert self.stt_stream is not None inte...
Input to a pipeline run.
PipelineInput
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PipelineInput: """Input to a pipeline run.""" async def execute(self) -> None: """Run pipeline.""" <|body_0|> async def validate(self) -> None: """Validate pipeline input against start stage.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self....
stack_v2_sparse_classes_10k_train_007860
31,871
permissive
[ { "docstring": "Run pipeline.", "name": "execute", "signature": "async def execute(self) -> None" }, { "docstring": "Validate pipeline input against start stage.", "name": "validate", "signature": "async def validate(self) -> None" } ]
2
stack_v2_sparse_classes_30k_train_000164
Implement the Python class `PipelineInput` described below. Class description: Input to a pipeline run. Method signatures and docstrings: - async def execute(self) -> None: Run pipeline. - async def validate(self) -> None: Validate pipeline input against start stage.
Implement the Python class `PipelineInput` described below. Class description: Input to a pipeline run. Method signatures and docstrings: - async def execute(self) -> None: Run pipeline. - async def validate(self) -> None: Validate pipeline input against start stage. <|skeleton|> class PipelineInput: """Input to...
2e65b77b2b5c17919939481f327963abdfdc53f0
<|skeleton|> class PipelineInput: """Input to a pipeline run.""" async def execute(self) -> None: """Run pipeline.""" <|body_0|> async def validate(self) -> None: """Validate pipeline input against start stage.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PipelineInput: """Input to a pipeline run.""" async def execute(self) -> None: """Run pipeline.""" self.run.start() current_stage = self.run.start_stage try: intent_input = self.intent_input if current_stage == PipelineStage.STT: ass...
the_stack_v2_python_sparse
homeassistant/components/assist_pipeline/pipeline.py
konnected-io/home-assistant
train
24
0dede8582813858998aafa1921f7aa86ed0d54e4
[ "invalid = u'! # $ % ^ & * ( ) = + , : ; \" | ~ / \\\\ \\x00 \\u202a'.split()\nbase = u'User%sName'\nfor c in invalid:\n name = base % c\n assert not user.isValidName(self.request, name)", "cases = (u' User Name', u'User Name ', u'User Name')\nfor test in cases:\n assert not user.isValidName(self.reque...
<|body_start_0|> invalid = u'! # $ % ^ & * ( ) = + , : ; " | ~ / \\ \x00 \u202a'.split() base = u'User%sName' for c in invalid: name = base % c assert not user.isValidName(self.request, name) <|end_body_0|> <|body_start_1|> cases = (u' User Name', u'User Name ', ...
TestIsValidName
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestIsValidName: def testNonAlnumCharacters(self): """user: isValidName: reject unicode non alpha numeric characters : and , used in acl rules, we might add more characters to the syntax.""" <|body_0|> def testWhitespace(self): """user: isValidName: reject leading, t...
stack_v2_sparse_classes_10k_train_007861
11,347
no_license
[ { "docstring": "user: isValidName: reject unicode non alpha numeric characters : and , used in acl rules, we might add more characters to the syntax.", "name": "testNonAlnumCharacters", "signature": "def testNonAlnumCharacters(self)" }, { "docstring": "user: isValidName: reject leading, trailing...
3
stack_v2_sparse_classes_30k_train_002415
Implement the Python class `TestIsValidName` described below. Class description: Implement the TestIsValidName class. Method signatures and docstrings: - def testNonAlnumCharacters(self): user: isValidName: reject unicode non alpha numeric characters : and , used in acl rules, we might add more characters to the synt...
Implement the Python class `TestIsValidName` described below. Class description: Implement the TestIsValidName class. Method signatures and docstrings: - def testNonAlnumCharacters(self): user: isValidName: reject unicode non alpha numeric characters : and , used in acl rules, we might add more characters to the synt...
d6e801402c4538bdfb34a97cf07153101167c1ec
<|skeleton|> class TestIsValidName: def testNonAlnumCharacters(self): """user: isValidName: reject unicode non alpha numeric characters : and , used in acl rules, we might add more characters to the syntax.""" <|body_0|> def testWhitespace(self): """user: isValidName: reject leading, t...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestIsValidName: def testNonAlnumCharacters(self): """user: isValidName: reject unicode non alpha numeric characters : and , used in acl rules, we might add more characters to the syntax.""" invalid = u'! # $ % ^ & * ( ) = + , : ; " | ~ / \\ \x00 \u202a'.split() base = u'User%sName' ...
the_stack_v2_python_sparse
MoinMoin/_tests/test_user.py
happytk/jardin
train
0
e8e05023d5d3a4d7d689422fe3aae4b55299e097
[ "new_names_dict = {'old_name_1': 'new_name_1', 'old_name_2': 'new_name_2'}\ndict_to_change = {'old_name_1': 'some_value_1', 'old_name_2': 'some_value_2'}\nchanged_dict = change_dict_keys(new_names_dict, dict_to_change)\nassert changed_dict['new_name_1']\nassert changed_dict['new_name_2']\nassert 'old_name_1' not in...
<|body_start_0|> new_names_dict = {'old_name_1': 'new_name_1', 'old_name_2': 'new_name_2'} dict_to_change = {'old_name_1': 'some_value_1', 'old_name_2': 'some_value_2'} changed_dict = change_dict_keys(new_names_dict, dict_to_change) assert changed_dict['new_name_1'] assert change...
TestChangeDictKeys
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestChangeDictKeys: def test_change_dict_keys_expected_format(self): """Given - dictionary to be changed - dictionary with new keys' names When - the dictionaries are well formatted Then - return the dictionary with the new keys""" <|body_0|> def test_change_dict_keys_missin...
stack_v2_sparse_classes_10k_train_007862
44,285
permissive
[ { "docstring": "Given - dictionary to be changed - dictionary with new keys' names When - the dictionaries are well formatted Then - return the dictionary with the new keys", "name": "test_change_dict_keys_expected_format", "signature": "def test_change_dict_keys_expected_format(self)" }, { "doc...
3
null
Implement the Python class `TestChangeDictKeys` described below. Class description: Implement the TestChangeDictKeys class. Method signatures and docstrings: - def test_change_dict_keys_expected_format(self): Given - dictionary to be changed - dictionary with new keys' names When - the dictionaries are well formatted...
Implement the Python class `TestChangeDictKeys` described below. Class description: Implement the TestChangeDictKeys class. Method signatures and docstrings: - def test_change_dict_keys_expected_format(self): Given - dictionary to be changed - dictionary with new keys' names When - the dictionaries are well formatted...
890def5a0e0ae8d6eaa538148249ddbc851dbb6b
<|skeleton|> class TestChangeDictKeys: def test_change_dict_keys_expected_format(self): """Given - dictionary to be changed - dictionary with new keys' names When - the dictionaries are well formatted Then - return the dictionary with the new keys""" <|body_0|> def test_change_dict_keys_missin...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestChangeDictKeys: def test_change_dict_keys_expected_format(self): """Given - dictionary to be changed - dictionary with new keys' names When - the dictionaries are well formatted Then - return the dictionary with the new keys""" new_names_dict = {'old_name_1': 'new_name_1', 'old_name_2': 'n...
the_stack_v2_python_sparse
Packs/qualys/Integrations/Qualysv2/Qualysv2_test.py
demisto/content
train
1,023
e7dbab7330e823a635f7d49d0565782b92884f1f
[ "def gen_next(x, y):\n yield (y, n - 1 - x)\n yield (n - 1 - x, n - 1 - y)\n yield (n - 1 - y, x)\nn = len(matrix)\nif n <= 1:\n return\nfor d in range(0, n // 2):\n for i in range(d, n - d - 1):\n tmp = matrix[d][i]\n for a, b in gen_next(d, i):\n matrix[a][b], tmp = (tmp, m...
<|body_start_0|> def gen_next(x, y): yield (y, n - 1 - x) yield (n - 1 - x, n - 1 - y) yield (n - 1 - y, x) n = len(matrix) if n <= 1: return for d in range(0, n // 2): for i in range(d, n - d - 1): tmp = matrix[...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rotate(self, matrix: List[List[int]]) -> None: """Do not return anything, modify matrix in-place instead. Time complexity: O(n^2) Space complexity: O(1) inplace""" <|body_0|> def rotate(self, matrix: List[List[int]]) -> None: """Do not return anything, ...
stack_v2_sparse_classes_10k_train_007863
2,631
no_license
[ { "docstring": "Do not return anything, modify matrix in-place instead. Time complexity: O(n^2) Space complexity: O(1) inplace", "name": "rotate", "signature": "def rotate(self, matrix: List[List[int]]) -> None" }, { "docstring": "Do not return anything, modify matrix in-place instead.", "na...
2
stack_v2_sparse_classes_30k_train_006928
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate(self, matrix: List[List[int]]) -> None: Do not return anything, modify matrix in-place instead. Time complexity: O(n^2) Space complexity: O(1) inplace - def rotate(sel...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate(self, matrix: List[List[int]]) -> None: Do not return anything, modify matrix in-place instead. Time complexity: O(n^2) Space complexity: O(1) inplace - def rotate(sel...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def rotate(self, matrix: List[List[int]]) -> None: """Do not return anything, modify matrix in-place instead. Time complexity: O(n^2) Space complexity: O(1) inplace""" <|body_0|> def rotate(self, matrix: List[List[int]]) -> None: """Do not return anything, ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def rotate(self, matrix: List[List[int]]) -> None: """Do not return anything, modify matrix in-place instead. Time complexity: O(n^2) Space complexity: O(1) inplace""" def gen_next(x, y): yield (y, n - 1 - x) yield (n - 1 - x, n - 1 - y) yield (n -...
the_stack_v2_python_sparse
leetcode/solved/48_Rotate_Image/solution.py
sungminoh/algorithms
train
0
7c41143c55293f904525ce0bf5eb7734c14cb5f2
[ "self.n = n\nself.discount = discount\nself.products = products\nself.f = {}\nfor i in range(len(self.products)):\n self.f[self.products[i]] = i\nself.prices = prices\nself.cnt = 1", "ans = 0\nfor i in range(len(amount)):\n ans += self.prices[self.f[product[i]]] * amount[i]\nprint(self.cnt)\nif self.cnt % s...
<|body_start_0|> self.n = n self.discount = discount self.products = products self.f = {} for i in range(len(self.products)): self.f[self.products[i]] = i self.prices = prices self.cnt = 1 <|end_body_0|> <|body_start_1|> ans = 0 for i ...
Cashier
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cashier: def __init__(self, n, discount, products, prices): """:type n: int :type discount: int :type products: List[int] :type prices: List[int]""" <|body_0|> def getBill(self, product, amount): """:type product: List[int] :type amount: List[int] :rtype: float""" ...
stack_v2_sparse_classes_10k_train_007864
1,021
no_license
[ { "docstring": ":type n: int :type discount: int :type products: List[int] :type prices: List[int]", "name": "__init__", "signature": "def __init__(self, n, discount, products, prices)" }, { "docstring": ":type product: List[int] :type amount: List[int] :rtype: float", "name": "getBill", ...
2
null
Implement the Python class `Cashier` described below. Class description: Implement the Cashier class. Method signatures and docstrings: - def __init__(self, n, discount, products, prices): :type n: int :type discount: int :type products: List[int] :type prices: List[int] - def getBill(self, product, amount): :type pr...
Implement the Python class `Cashier` described below. Class description: Implement the Cashier class. Method signatures and docstrings: - def __init__(self, n, discount, products, prices): :type n: int :type discount: int :type products: List[int] :type prices: List[int] - def getBill(self, product, amount): :type pr...
67e9daecb7ffd8f7bcb2f120ad892498b1219327
<|skeleton|> class Cashier: def __init__(self, n, discount, products, prices): """:type n: int :type discount: int :type products: List[int] :type prices: List[int]""" <|body_0|> def getBill(self, product, amount): """:type product: List[int] :type amount: List[int] :rtype: float""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Cashier: def __init__(self, n, discount, products, prices): """:type n: int :type discount: int :type products: List[int] :type prices: List[int]""" self.n = n self.discount = discount self.products = products self.f = {} for i in range(len(self.products)): ...
the_stack_v2_python_sparse
比赛/1357. 每隔 n 个顾客打折.py
Comyn-Echo/leeCode
train
0
8f09ded99e1de928e0f7f0e92dc31a778d31605d
[ "query = '\\n select distinct * where {\\n\\n BIND (\"%s\" AS ?pid)\\n BIND (%s as ?sessionid)\\n BIND (\"%s\" as ?shortname)\\n \\n ?participant austalk:id ?pid .\\n ?rc rdf:type austalk:RecordedComponent .\\n ?rc...
<|body_start_0|> query = '\n select distinct * where {\n\n BIND ("%s" AS ?pid)\n BIND (%s as ?sessionid)\n BIND ("%s" as ?shortname)\n \n ?participant austalk:id ?pid .\n ?rc rdf:type austalk:RecordedComponent .\n ...
ComponentManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ComponentManager: def get(self, participant_id, session_id, component_id): """Return the component for this participant/session/component id or None if none exists participant_id is like 1_123 session_id is 1, 2, 3 component_id is shortname words-1, conversation""" <|body_0|> ...
stack_v2_sparse_classes_10k_train_007865
6,817
no_license
[ { "docstring": "Return the component for this participant/session/component id or None if none exists participant_id is like 1_123 session_id is 1, 2, 3 component_id is shortname words-1, conversation", "name": "get", "signature": "def get(self, participant_id, session_id, component_id)" }, { "d...
2
stack_v2_sparse_classes_30k_train_000603
Implement the Python class `ComponentManager` described below. Class description: Implement the ComponentManager class. Method signatures and docstrings: - def get(self, participant_id, session_id, component_id): Return the component for this participant/session/component id or None if none exists participant_id is l...
Implement the Python class `ComponentManager` described below. Class description: Implement the ComponentManager class. Method signatures and docstrings: - def get(self, participant_id, session_id, component_id): Return the component for this participant/session/component id or None if none exists participant_id is l...
88000a79f0a18c92de0092814de3dbb2409f5515
<|skeleton|> class ComponentManager: def get(self, participant_id, session_id, component_id): """Return the component for this participant/session/component id or None if none exists participant_id is like 1_123 session_id is 1, 2, 3 component_id is shortname words-1, conversation""" <|body_0|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ComponentManager: def get(self, participant_id, session_id, component_id): """Return the component for this participant/session/component id or None if none exists participant_id is like 1_123 session_id is 1, 2, 3 component_id is shortname words-1, conversation""" query = '\n selec...
the_stack_v2_python_sparse
browse/modelspackage/components.py
Alveo/smallasc
train
0
fd8c7c5eaf409a616faa419c351c99a95f78e6c8
[ "import itertools\nret = 0\nfor a, b, c in itertools.permutations(A, 3):\n if a < b + c and b < a + c and (c < a + b):\n ret = max(ret, a + b + c)\nreturn ret", "ret = 0\nA = sorted(A, reverse=True)\nfor i in range(0, len(A)):\n a = A[i]\n for j in range(i + 1, len(A)):\n b = A[j]\n ...
<|body_start_0|> import itertools ret = 0 for a, b, c in itertools.permutations(A, 3): if a < b + c and b < a + c and (c < a + b): ret = max(ret, a + b + c) return ret <|end_body_0|> <|body_start_1|> ret = 0 A = sorted(A, reverse=True) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def largestPerimeter(self, A): """:type A: List[int] :rtype: int""" <|body_0|> def largestPerimeter(self, A): """:type A: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> import itertools ret = 0 for a,...
stack_v2_sparse_classes_10k_train_007866
1,183
no_license
[ { "docstring": ":type A: List[int] :rtype: int", "name": "largestPerimeter", "signature": "def largestPerimeter(self, A)" }, { "docstring": ":type A: List[int] :rtype: int", "name": "largestPerimeter", "signature": "def largestPerimeter(self, A)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestPerimeter(self, A): :type A: List[int] :rtype: int - def largestPerimeter(self, A): :type A: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestPerimeter(self, A): :type A: List[int] :rtype: int - def largestPerimeter(self, A): :type A: List[int] :rtype: int <|skeleton|> class Solution: def largestPerime...
d8ed762d1005975f0de4f07760c9671195621c88
<|skeleton|> class Solution: def largestPerimeter(self, A): """:type A: List[int] :rtype: int""" <|body_0|> def largestPerimeter(self, A): """:type A: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def largestPerimeter(self, A): """:type A: List[int] :rtype: int""" import itertools ret = 0 for a, b, c in itertools.permutations(A, 3): if a < b + c and b < a + c and (c < a + b): ret = max(ret, a + b + c) return ret def larg...
the_stack_v2_python_sparse
largest-perimeter-triangle/solution.py
uxlsl/leetcode_practice
train
0
d855ea2ef9fcb7c557bc3e28a610f3d96bb5651a
[ "self._rules = tuple()\nfor rule in rules:\n if rule.matcher is None:\n matcher = BaseMatcher()\n elif isinstance(rule.matcher, BaseMatcher):\n matcher = rule.matcher\n elif isinstance(rule.matcher, basestring):\n matcher = default_matcher(rule.matcher)\n else:\n raise ValueE...
<|body_start_0|> self._rules = tuple() for rule in rules: if rule.matcher is None: matcher = BaseMatcher() elif isinstance(rule.matcher, BaseMatcher): matcher = rule.matcher elif isinstance(rule.matcher, basestring): mat...
Rules Manager
RulesManager
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RulesManager: """Rules Manager""" def __init__(self, rules, spider, default_matcher=UrlRegexMatcher): """Initialize rules using spider and default matcher""" <|body_0|> def get_rule_from_request(self, request): """Returns first rule that matches given Request""" ...
stack_v2_sparse_classes_10k_train_007867
3,671
permissive
[ { "docstring": "Initialize rules using spider and default matcher", "name": "__init__", "signature": "def __init__(self, rules, spider, default_matcher=UrlRegexMatcher)" }, { "docstring": "Returns first rule that matches given Request", "name": "get_rule_from_request", "signature": "def ...
3
stack_v2_sparse_classes_30k_train_001332
Implement the Python class `RulesManager` described below. Class description: Rules Manager Method signatures and docstrings: - def __init__(self, rules, spider, default_matcher=UrlRegexMatcher): Initialize rules using spider and default matcher - def get_rule_from_request(self, request): Returns first rule that matc...
Implement the Python class `RulesManager` described below. Class description: Rules Manager Method signatures and docstrings: - def __init__(self, rules, spider, default_matcher=UrlRegexMatcher): Initialize rules using spider and default matcher - def get_rule_from_request(self, request): Returns first rule that matc...
6f82ea19de1e61ef71373817f2ca9687b900744d
<|skeleton|> class RulesManager: """Rules Manager""" def __init__(self, rules, spider, default_matcher=UrlRegexMatcher): """Initialize rules using spider and default matcher""" <|body_0|> def get_rule_from_request(self, request): """Returns first rule that matches given Request""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RulesManager: """Rules Manager""" def __init__(self, rules, spider, default_matcher=UrlRegexMatcher): """Initialize rules using spider and default matcher""" self._rules = tuple() for rule in rules: if rule.matcher is None: matcher = BaseMatcher() ...
the_stack_v2_python_sparse
scrapy/contrib_exp/crawlspider/rules.py
herberthamaral/scrapy
train
1
63261ab45cee431839087451197539845792fd7a
[ "self.mapping = collections.defaultdict(set)\nfor op in (op for op in graph.get_operations()):\n if op.name.startswith(common.SKIPPED_PREFIXES):\n continue\n for op_input in op.inputs:\n self.mapping[op_input].add(op)", "result = set()\nfor inp in producer_op.outputs:\n result.update(self.m...
<|body_start_0|> self.mapping = collections.defaultdict(set) for op in (op for op in graph.get_operations()): if op.name.startswith(common.SKIPPED_PREFIXES): continue for op_input in op.inputs: self.mapping[op_input].add(op) <|end_body_0|> <|body_...
Holds a mapping from tensor's name to ops that take it as input.
InputToOps
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InputToOps: """Holds a mapping from tensor's name to ops that take it as input.""" def __init__(self, graph): """Initializes mapping from tensor's name to ops that take it. Helps find edges between ops faster and avoids iterating over the whole graph. The mapping is of type Dict[str,...
stack_v2_sparse_classes_10k_train_007868
2,232
permissive
[ { "docstring": "Initializes mapping from tensor's name to ops that take it. Helps find edges between ops faster and avoids iterating over the whole graph. The mapping is of type Dict[str, Set[tf.Operation]]. Note: while inserting operations into the graph, we do not update the mapping, assuming that insertion p...
2
null
Implement the Python class `InputToOps` described below. Class description: Holds a mapping from tensor's name to ops that take it as input. Method signatures and docstrings: - def __init__(self, graph): Initializes mapping from tensor's name to ops that take it. Helps find edges between ops faster and avoids iterati...
Implement the Python class `InputToOps` described below. Class description: Holds a mapping from tensor's name to ops that take it as input. Method signatures and docstrings: - def __init__(self, graph): Initializes mapping from tensor's name to ops that take it. Helps find edges between ops faster and avoids iterati...
cabf6e4f1970dc14302f87414f170de19944bac2
<|skeleton|> class InputToOps: """Holds a mapping from tensor's name to ops that take it as input.""" def __init__(self, graph): """Initializes mapping from tensor's name to ops that take it. Helps find edges between ops faster and avoids iterating over the whole graph. The mapping is of type Dict[str,...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class InputToOps: """Holds a mapping from tensor's name to ops that take it as input.""" def __init__(self, graph): """Initializes mapping from tensor's name to ops that take it. Helps find edges between ops faster and avoids iterating over the whole graph. The mapping is of type Dict[str, Set[tf.Opera...
the_stack_v2_python_sparse
Tensorflow/source/tensorflow/contrib/quantize/python/input_to_ops.py
ryfeus/lambda-packs
train
1,283
7f3a0ca70b1fb5927cc4bdf3e35c98b19524a42b
[ "if not root:\n return [None for _ in range(k)]\nn, cur = (0, root)\nwhile cur:\n n += 1\n cur = cur.next\nnums = [n // k] * k\nfor i in range(n % k):\n nums[i] += 1\ncur, res, i = (root, [], 0)\nwhile i < k:\n j, prev = (0, cur)\n res.append(cur)\n while j < nums[i]:\n prev, cur = (cur,...
<|body_start_0|> if not root: return [None for _ in range(k)] n, cur = (0, root) while cur: n += 1 cur = cur.next nums = [n // k] * k for i in range(n % k): nums[i] += 1 cur, res, i = (root, [], 0) while i < k: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def splitListToParts(self, root, k): """:type root: ListNode :type k: int :rtype: List[ListNode]""" <|body_0|> def splitListToPartsCleanCode(self, root, k): """:type root: ListNode :type k: int :rtype: List[ListNode]""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_10k_train_007869
3,965
no_license
[ { "docstring": ":type root: ListNode :type k: int :rtype: List[ListNode]", "name": "splitListToParts", "signature": "def splitListToParts(self, root, k)" }, { "docstring": ":type root: ListNode :type k: int :rtype: List[ListNode]", "name": "splitListToPartsCleanCode", "signature": "def s...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def splitListToParts(self, root, k): :type root: ListNode :type k: int :rtype: List[ListNode] - def splitListToPartsCleanCode(self, root, k): :type root: ListNode :type k: int :r...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def splitListToParts(self, root, k): :type root: ListNode :type k: int :rtype: List[ListNode] - def splitListToPartsCleanCode(self, root, k): :type root: ListNode :type k: int :r...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def splitListToParts(self, root, k): """:type root: ListNode :type k: int :rtype: List[ListNode]""" <|body_0|> def splitListToPartsCleanCode(self, root, k): """:type root: ListNode :type k: int :rtype: List[ListNode]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def splitListToParts(self, root, k): """:type root: ListNode :type k: int :rtype: List[ListNode]""" if not root: return [None for _ in range(k)] n, cur = (0, root) while cur: n += 1 cur = cur.next nums = [n // k] * k ...
the_stack_v2_python_sparse
S/SplitLinkedListinParts.py
bssrdf/pyleet
train
2
39f01ab1643286d0d10778342d7146f85a3ca685
[ "self.d = collections.defaultdict(int)\nself.partial = ''\nself.matches = []\nfor s, t in zip(sentences, times):\n self.d[s] = t", "if c == '#':\n self.d[self.partial] += 1\n self.partial = ''\n self.matches = []\n return []\nif self.partial == '':\n self.matches = [(-count, s) for s, count in s...
<|body_start_0|> self.d = collections.defaultdict(int) self.partial = '' self.matches = [] for s, t in zip(sentences, times): self.d[s] = t <|end_body_0|> <|body_start_1|> if c == '#': self.d[self.partial] += 1 self.partial = '' se...
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 = collections.d...
stack_v2_sparse_classes_10k_train_007870
1,219
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...
fe5c6936627c2459731ddda6f67422c217b3cc91
<|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 = collections.defaultdict(int) self.partial = '' self.matches = [] for s, t in zip(sentences, times): self.d[s] = t def input(self, ...
the_stack_v2_python_sparse
642. Design Search Autocomplete System/Python 2/solution.py
HarrrrryLi/LeetCode
train
0
4245fbe8e84e590f9869f8bb546c1a979c22217b
[ "self.height = height\nself.width = width\nself.food = deque()\nself.score = 0\nself.snake = deque()\nself.snake.appendleft([0, 0])\nfor r, c in food:\n self.food.appendleft((r, c))", "dir = {'U': [-1, 0], 'D': [1, 0], 'L': [0, -1], 'R': [0, 1]}\ncurRow, curCol = self.snake[0]\nnextRow, nextCol = (curRow + dir...
<|body_start_0|> self.height = height self.width = width self.food = deque() self.score = 0 self.snake = deque() self.snake.appendleft([0, 0]) for r, c in food: self.food.appendleft((r, c)) <|end_body_0|> <|body_start_1|> dir = {'U': [-1, 0], ...
SnakeGame
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SnakeGame: def __init__(self, width: int, height: int, food): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [...
stack_v2_sparse_classes_10k_train_007871
3,642
permissive
[ { "docstring": "Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0].", "name": "__init__", "signature": "def __init__(self, widt...
2
stack_v2_sparse_classes_30k_train_005332
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width: int, height: int, food): Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food p...
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width: int, height: int, food): Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food p...
6a83cb798cc317d1e4357ac6b2b1fbf76fa034fb
<|skeleton|> class SnakeGame: def __init__(self, width: int, height: int, food): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SnakeGame: def __init__(self, width: int, height: int, food): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0].""" ...
the_stack_v2_python_sparse
Month 01/Week 03/Day 07/a.py
KevinKnott/Coding-Review
train
0
b468362ab150b41326c9f328203652541a2d3b9d
[ "while left >= 0 and right < len(s) and (s[left] == s[right]):\n left -= 1\n right += 1\nreturn right - left - 1", "if not s or len(s) < 1:\n return ''\nleft = right = 0\nfor index in range(len(s)):\n odd_len = self.expand_center(s, index, index)\n even_len = self.expand_center(s, index, index + 1)...
<|body_start_0|> while left >= 0 and right < len(s) and (s[left] == s[right]): left -= 1 right += 1 return right - left - 1 <|end_body_0|> <|body_start_1|> if not s or len(s) < 1: return '' left = right = 0 for index in range(len(s)): ...
String
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class String: def expand_center(self, s: str, left: int, right: int) -> int: """:param s: :param l: :param r: :return:""" <|body_0|> def longest_palindromic_substring(self, s: str) -> str: """Approach: Expand Center Time Complexity: O(N^2) Space Complexity: O(1) :param s: ...
stack_v2_sparse_classes_10k_train_007872
1,441
no_license
[ { "docstring": ":param s: :param l: :param r: :return:", "name": "expand_center", "signature": "def expand_center(self, s: str, left: int, right: int) -> int" }, { "docstring": "Approach: Expand Center Time Complexity: O(N^2) Space Complexity: O(1) :param s: :return:", "name": "longest_palin...
2
null
Implement the Python class `String` described below. Class description: Implement the String class. Method signatures and docstrings: - def expand_center(self, s: str, left: int, right: int) -> int: :param s: :param l: :param r: :return: - def longest_palindromic_substring(self, s: str) -> str: Approach: Expand Cente...
Implement the Python class `String` described below. Class description: Implement the String class. Method signatures and docstrings: - def expand_center(self, s: str, left: int, right: int) -> int: :param s: :param l: :param r: :return: - def longest_palindromic_substring(self, s: str) -> str: Approach: Expand Cente...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class String: def expand_center(self, s: str, left: int, right: int) -> int: """:param s: :param l: :param r: :return:""" <|body_0|> def longest_palindromic_substring(self, s: str) -> str: """Approach: Expand Center Time Complexity: O(N^2) Space Complexity: O(1) :param s: ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class String: def expand_center(self, s: str, left: int, right: int) -> int: """:param s: :param l: :param r: :return:""" while left >= 0 and right < len(s) and (s[left] == s[right]): left -= 1 right += 1 return right - left - 1 def longest_palindromic_substring(...
the_stack_v2_python_sparse
revisited__2021/math_and_string/longest_palindromic_substring.py
Shiv2157k/leet_code
train
1
662acf7cea9d6a7993a3f426fac76ac994df8912
[ "request = request._request\nuser = getattr(request, 'user', None)\nif not user or user.is_anonymous:\n return None\nself.enforce_csrf(request)\nreturn (user, None)", "def get_response(request):\n return HttpResponse()\nreason = CSRFCheck(get_response).process_view(request, None, (), {})\nif reason:\n ra...
<|body_start_0|> request = request._request user = getattr(request, 'user', None) if not user or user.is_anonymous: return None self.enforce_csrf(request) return (user, None) <|end_body_0|> <|body_start_1|> def get_response(request): return HttpRe...
Use Django's session framework for authentication. Allows inactive users.
InactiveSessionAuthentication
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InactiveSessionAuthentication: """Use Django's session framework for authentication. Allows inactive users.""" def authenticate(self, request): """Returns a `User` if the request session currently has a logged in user. Otherwise returns `None`.""" <|body_0|> def enforce_...
stack_v2_sparse_classes_10k_train_007873
11,718
permissive
[ { "docstring": "Returns a `User` if the request session currently has a logged in user. Otherwise returns `None`.", "name": "authenticate", "signature": "def authenticate(self, request)" }, { "docstring": "Enforce CSRF validation for session based authentication.", "name": "enforce_csrf", ...
2
null
Implement the Python class `InactiveSessionAuthentication` described below. Class description: Use Django's session framework for authentication. Allows inactive users. Method signatures and docstrings: - def authenticate(self, request): Returns a `User` if the request session currently has a logged in user. Otherwis...
Implement the Python class `InactiveSessionAuthentication` described below. Class description: Use Django's session framework for authentication. Allows inactive users. Method signatures and docstrings: - def authenticate(self, request): Returns a `User` if the request session currently has a logged in user. Otherwis...
67ec527bfc32c715bf9f29d5e01362c4903aebd2
<|skeleton|> class InactiveSessionAuthentication: """Use Django's session framework for authentication. Allows inactive users.""" def authenticate(self, request): """Returns a `User` if the request session currently has a logged in user. Otherwise returns `None`.""" <|body_0|> def enforce_...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class InactiveSessionAuthentication: """Use Django's session framework for authentication. Allows inactive users.""" def authenticate(self, request): """Returns a `User` if the request session currently has a logged in user. Otherwise returns `None`.""" request = request._request user =...
the_stack_v2_python_sparse
kitsune/sumo/api_utils.py
mozilla/kitsune
train
1,218
07a203c157e3207352b4542eedc76eb993a5dbad
[ "self.entity_description = description\nself._attr_unique_id = f'{DOMAIN}-{description.key}-{inverter.serial_number}'\nself._attr_device_info = device_info\nself._attr_native_value = float(current_value)\nself._inverter: Inverter = inverter", "await self.entity_description.setter(self._inverter, int(value))\nself...
<|body_start_0|> self.entity_description = description self._attr_unique_id = f'{DOMAIN}-{description.key}-{inverter.serial_number}' self._attr_device_info = device_info self._attr_native_value = float(current_value) self._inverter: Inverter = inverter <|end_body_0|> <|body_star...
Inverter numeric setting entity.
InverterNumberEntity
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InverterNumberEntity: """Inverter numeric setting entity.""" def __init__(self, device_info: DeviceInfo, description: GoodweNumberEntityDescription, inverter: Inverter, current_value: int) -> None: """Initialize the number inverter setting entity.""" <|body_0|> async def...
stack_v2_sparse_classes_10k_train_007874
5,018
permissive
[ { "docstring": "Initialize the number inverter setting entity.", "name": "__init__", "signature": "def __init__(self, device_info: DeviceInfo, description: GoodweNumberEntityDescription, inverter: Inverter, current_value: int) -> None" }, { "docstring": "Set new value.", "name": "async_set_n...
2
null
Implement the Python class `InverterNumberEntity` described below. Class description: Inverter numeric setting entity. Method signatures and docstrings: - def __init__(self, device_info: DeviceInfo, description: GoodweNumberEntityDescription, inverter: Inverter, current_value: int) -> None: Initialize the number inve...
Implement the Python class `InverterNumberEntity` described below. Class description: Inverter numeric setting entity. Method signatures and docstrings: - def __init__(self, device_info: DeviceInfo, description: GoodweNumberEntityDescription, inverter: Inverter, current_value: int) -> None: Initialize the number inve...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class InverterNumberEntity: """Inverter numeric setting entity.""" def __init__(self, device_info: DeviceInfo, description: GoodweNumberEntityDescription, inverter: Inverter, current_value: int) -> None: """Initialize the number inverter setting entity.""" <|body_0|> async def...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class InverterNumberEntity: """Inverter numeric setting entity.""" def __init__(self, device_info: DeviceInfo, description: GoodweNumberEntityDescription, inverter: Inverter, current_value: int) -> None: """Initialize the number inverter setting entity.""" self.entity_description = description ...
the_stack_v2_python_sparse
homeassistant/components/goodwe/number.py
home-assistant/core
train
35,501
e273e77b604f23b055b2fa7d8c25d16df4986e8c
[ "for patient in patientDao.fetchAllPatients():\n if patient['id'] == id:\n return patient\napi.abort(404, \"Patient {} doesn't exist\".format(id))", "patient = self.get(id)\npatientDao.deletePatient(id)\nreturn ('patient {} deleted successfully'.format(id), 200)", "currPatient = self.get(id)\nupdatedP...
<|body_start_0|> for patient in patientDao.fetchAllPatients(): if patient['id'] == id: return patient api.abort(404, "Patient {} doesn't exist".format(id)) <|end_body_0|> <|body_start_1|> patient = self.get(id) patientDao.deletePatient(id) return ('pa...
Patient
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Patient: def get(self, id): """get patient by input id""" <|body_0|> def delete(self, id): """delete a specific patient""" <|body_1|> def put(self, id): """Update a patient record""" <|body_2|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_007875
2,957
no_license
[ { "docstring": "get patient by input id", "name": "get", "signature": "def get(self, id)" }, { "docstring": "delete a specific patient", "name": "delete", "signature": "def delete(self, id)" }, { "docstring": "Update a patient record", "name": "put", "signature": "def put...
3
stack_v2_sparse_classes_30k_train_003927
Implement the Python class `Patient` described below. Class description: Implement the Patient class. Method signatures and docstrings: - def get(self, id): get patient by input id - def delete(self, id): delete a specific patient - def put(self, id): Update a patient record
Implement the Python class `Patient` described below. Class description: Implement the Patient class. Method signatures and docstrings: - def get(self, id): get patient by input id - def delete(self, id): delete a specific patient - def put(self, id): Update a patient record <|skeleton|> class Patient: def get(...
d5aa7d822fa6b729a699cccad5a3f83f2d2a3bdb
<|skeleton|> class Patient: def get(self, id): """get patient by input id""" <|body_0|> def delete(self, id): """delete a specific patient""" <|body_1|> def put(self, id): """Update a patient record""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Patient: def get(self, id): """get patient by input id""" for patient in patientDao.fetchAllPatients(): if patient['id'] == id: return patient api.abort(404, "Patient {} doesn't exist".format(id)) def delete(self, id): """delete a specific patie...
the_stack_v2_python_sparse
apis/patient.py
Manik-Jain/EMR_API
train
0
a02aae8b0ad9829c94253ecbd7d633c80ff9b73a
[ "super().__init__(config)\nself.in_proj_weight = nn.Parameter(torch.cat([whisper_layer.self_attn.q_proj.weight, whisper_layer.self_attn.k_proj.weight, whisper_layer.self_attn.v_proj.weight]))\nself.in_proj_bias = nn.Parameter(torch.cat([whisper_layer.self_attn.q_proj.bias, torch.zeros_like(whisper_layer.self_attn.q...
<|body_start_0|> super().__init__(config) self.in_proj_weight = nn.Parameter(torch.cat([whisper_layer.self_attn.q_proj.weight, whisper_layer.self_attn.k_proj.weight, whisper_layer.self_attn.v_proj.weight])) self.in_proj_bias = nn.Parameter(torch.cat([whisper_layer.self_attn.q_proj.bias, torch.ze...
WhisperEncoderLayerBetterTransformer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WhisperEncoderLayerBetterTransformer: def __init__(self, whisper_layer, config): """A simple conversion of the WhisperEncoderLayer to its `BetterTransformer` implementation. Args: whisper_layer (`torch.nn.Module`): The original `WhisperEncoderLayer` where the weights needs to be retrieve...
stack_v2_sparse_classes_10k_train_007876
43,670
no_license
[ { "docstring": "A simple conversion of the WhisperEncoderLayer to its `BetterTransformer` implementation. Args: whisper_layer (`torch.nn.Module`): The original `WhisperEncoderLayer` where the weights needs to be retrieved.", "name": "__init__", "signature": "def __init__(self, whisper_layer, config)" ...
2
stack_v2_sparse_classes_30k_train_006789
Implement the Python class `WhisperEncoderLayerBetterTransformer` described below. Class description: Implement the WhisperEncoderLayerBetterTransformer class. Method signatures and docstrings: - def __init__(self, whisper_layer, config): A simple conversion of the WhisperEncoderLayer to its `BetterTransformer` imple...
Implement the Python class `WhisperEncoderLayerBetterTransformer` described below. Class description: Implement the WhisperEncoderLayerBetterTransformer class. Method signatures and docstrings: - def __init__(self, whisper_layer, config): A simple conversion of the WhisperEncoderLayer to its `BetterTransformer` imple...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class WhisperEncoderLayerBetterTransformer: def __init__(self, whisper_layer, config): """A simple conversion of the WhisperEncoderLayer to its `BetterTransformer` implementation. Args: whisper_layer (`torch.nn.Module`): The original `WhisperEncoderLayer` where the weights needs to be retrieve...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WhisperEncoderLayerBetterTransformer: def __init__(self, whisper_layer, config): """A simple conversion of the WhisperEncoderLayer to its `BetterTransformer` implementation. Args: whisper_layer (`torch.nn.Module`): The original `WhisperEncoderLayer` where the weights needs to be retrieved.""" ...
the_stack_v2_python_sparse
generated/test_huggingface_optimum.py
jansel/pytorch-jit-paritybench
train
35
ee8f359bb640c4a031ca203cfef6555d929d38ee
[ "super(PreTwoStem, self).__init__()\nself._C = desc.C\nself.stems = nn.ModuleList()\nstem0 = nn.Sequential(nn.Conv2d(3, self._C // 2, kernel_size=3, stride=2, padding=1, bias=False), nn.BatchNorm2d(self._C // 2), nn.ReLU(inplace=True), nn.Conv2d(self._C // 2, self._C, 3, stride=2, padding=1, bias=False), nn.BatchNo...
<|body_start_0|> super(PreTwoStem, self).__init__() self._C = desc.C self.stems = nn.ModuleList() stem0 = nn.Sequential(nn.Conv2d(3, self._C // 2, kernel_size=3, stride=2, padding=1, bias=False), nn.BatchNorm2d(self._C // 2), nn.ReLU(inplace=True), nn.Conv2d(self._C // 2, self._C, 3, str...
Class of two stems convolution. :param desc: description of PreTwoStem :type desc: Config
PreTwoStem
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PreTwoStem: """Class of two stems convolution. :param desc: description of PreTwoStem :type desc: Config""" def __init__(self, desc): """Init PreTwoStem.""" <|body_0|> def forward(self, x): """Forward function of PreTwoStem.""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_10k_train_007877
7,297
permissive
[ { "docstring": "Init PreTwoStem.", "name": "__init__", "signature": "def __init__(self, desc)" }, { "docstring": "Forward function of PreTwoStem.", "name": "forward", "signature": "def forward(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_000830
Implement the Python class `PreTwoStem` described below. Class description: Class of two stems convolution. :param desc: description of PreTwoStem :type desc: Config Method signatures and docstrings: - def __init__(self, desc): Init PreTwoStem. - def forward(self, x): Forward function of PreTwoStem.
Implement the Python class `PreTwoStem` described below. Class description: Class of two stems convolution. :param desc: description of PreTwoStem :type desc: Config Method signatures and docstrings: - def __init__(self, desc): Init PreTwoStem. - def forward(self, x): Forward function of PreTwoStem. <|skeleton|> cla...
df51ed9c1d6dbde1deef63f2a037a369f8554406
<|skeleton|> class PreTwoStem: """Class of two stems convolution. :param desc: description of PreTwoStem :type desc: Config""" def __init__(self, desc): """Init PreTwoStem.""" <|body_0|> def forward(self, x): """Forward function of PreTwoStem.""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PreTwoStem: """Class of two stems convolution. :param desc: description of PreTwoStem :type desc: Config""" def __init__(self, desc): """Init PreTwoStem.""" super(PreTwoStem, self).__init__() self._C = desc.C self.stems = nn.ModuleList() stem0 = nn.Sequential(nn.Co...
the_stack_v2_python_sparse
built-in/TensorFlow/Research/cv/image_classification/Darts_for_TensorFlow/automl/vega/search_space/networks/pytorch/blocks/darts_ops.py
Huawei-Ascend/modelzoo
train
1
5d92ba635398479a1097ad5d99b63cbce43fec2e
[ "try:\n return (ApplicationService.apply_custom_attributes(ApplicationService.get_application(application_id=application_id)), HTTPStatus.OK)\nexcept BusinessException as err:\n return (err.error, err.status_code)", "application_json = request.get_json()\ntry:\n application_schema = ApplicationUpdateSche...
<|body_start_0|> try: return (ApplicationService.apply_custom_attributes(ApplicationService.get_application(application_id=application_id)), HTTPStatus.OK) except BusinessException as err: return (err.error, err.status_code) <|end_body_0|> <|body_start_1|> application_js...
Resource for submissions.
ApplicationResourceById
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApplicationResourceById: """Resource for submissions.""" def get(application_id): """Get application by id.""" <|body_0|> def put(application_id): """Update application details.""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: re...
stack_v2_sparse_classes_10k_train_007878
12,166
permissive
[ { "docstring": "Get application by id.", "name": "get", "signature": "def get(application_id)" }, { "docstring": "Update application details.", "name": "put", "signature": "def put(application_id)" } ]
2
stack_v2_sparse_classes_30k_train_003074
Implement the Python class `ApplicationResourceById` described below. Class description: Resource for submissions. Method signatures and docstrings: - def get(application_id): Get application by id. - def put(application_id): Update application details.
Implement the Python class `ApplicationResourceById` described below. Class description: Resource for submissions. Method signatures and docstrings: - def get(application_id): Get application by id. - def put(application_id): Update application details. <|skeleton|> class ApplicationResourceById: """Resource for...
a1a447f364d1e7414ccb073b0749920ec3523e4a
<|skeleton|> class ApplicationResourceById: """Resource for submissions.""" def get(application_id): """Get application by id.""" <|body_0|> def put(application_id): """Update application details.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ApplicationResourceById: """Resource for submissions.""" def get(application_id): """Get application by id.""" try: return (ApplicationService.apply_custom_attributes(ApplicationService.get_application(application_id=application_id)), HTTPStatus.OK) except BusinessExce...
the_stack_v2_python_sparse
forms-flow-api/src/api/resources/application.py
sumathi-thirumani-aot/forms-flow-ai
train
0
8016ab8ec88e7fd8e3b377e204d83b4949469fb6
[ "self.server_is_running = server_is_running(port, hostname)\nself.viz = Visdom(port=port) if self.server_is_running else None\nself.env = env_name\nself.plots = {}\nself.plots_ic = defaultdict(int)", "if not self.server_is_running:\n return\nif x is None:\n x = self.plots_ic[var_name]\n self.plots_ic[var...
<|body_start_0|> self.server_is_running = server_is_running(port, hostname) self.viz = Visdom(port=port) if self.server_is_running else None self.env = env_name self.plots = {} self.plots_ic = defaultdict(int) <|end_body_0|> <|body_start_1|> if not self.server_is_running...
VisdomPlotter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VisdomPlotter: def __init__(self, env_name='main', port=8097, hostname='localhost'): """Params: * env_name : str * port : int * hostname : str""" <|body_0|> def line_plot(self, var_name, split_name, title_name, x, y, x_label='Epochs'): """Params: * var_name : variabl...
stack_v2_sparse_classes_10k_train_007879
33,326
no_license
[ { "docstring": "Params: * env_name : str * port : int * hostname : str", "name": "__init__", "signature": "def __init__(self, env_name='main', port=8097, hostname='localhost')" }, { "docstring": "Params: * var_name : variable name (e.g. loss, acc) * split_name : split name (e.g. train, val) * ti...
5
stack_v2_sparse_classes_30k_train_004473
Implement the Python class `VisdomPlotter` described below. Class description: Implement the VisdomPlotter class. Method signatures and docstrings: - def __init__(self, env_name='main', port=8097, hostname='localhost'): Params: * env_name : str * port : int * hostname : str - def line_plot(self, var_name, split_name,...
Implement the Python class `VisdomPlotter` described below. Class description: Implement the VisdomPlotter class. Method signatures and docstrings: - def __init__(self, env_name='main', port=8097, hostname='localhost'): Params: * env_name : str * port : int * hostname : str - def line_plot(self, var_name, split_name,...
0eebc122396583eccb05fc2fd9a595cbb554b0de
<|skeleton|> class VisdomPlotter: def __init__(self, env_name='main', port=8097, hostname='localhost'): """Params: * env_name : str * port : int * hostname : str""" <|body_0|> def line_plot(self, var_name, split_name, title_name, x, y, x_label='Epochs'): """Params: * var_name : variabl...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class VisdomPlotter: def __init__(self, env_name='main', port=8097, hostname='localhost'): """Params: * env_name : str * port : int * hostname : str""" self.server_is_running = server_is_running(port, hostname) self.viz = Visdom(port=port) if self.server_is_running else None self.env...
the_stack_v2_python_sparse
apop/utils.py
thbeucher/ML_pytorch
train
0
4931febcdd902851eca7b9ac2810955bfea2edd7
[ "if general_md is None:\n general_md = metadata_info.GeneralMd(name=_MODEL_NAME, description=_MODEL_DESCRIPTION)\nif input_md is None:\n input_md = metadata_info.BertInputTensorsMd(model_buffer, _DEFAULT_ID_NAME, _DEFAULT_MASK_NAME, _DEFAULT_SEGMENT_ID_NAME)\nif output_md is None:\n output_md = metadata_in...
<|body_start_0|> if general_md is None: general_md = metadata_info.GeneralMd(name=_MODEL_NAME, description=_MODEL_DESCRIPTION) if input_md is None: input_md = metadata_info.BertInputTensorsMd(model_buffer, _DEFAULT_ID_NAME, _DEFAULT_MASK_NAME, _DEFAULT_SEGMENT_ID_NAME) if...
Writes metadata into the Bert NL classifier.
MetadataWriter
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "GPL-1.0-or-later", "MIT", "LGPL-2.0-or-later", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MetadataWriter: """Writes metadata into the Bert NL classifier.""" def create_from_metadata_info(cls, model_buffer: bytearray, general_md: Optional[metadata_info.GeneralMd]=None, input_md: Optional[metadata_info.BertInputTensorsMd]=None, output_md: Optional[metadata_info.ClassificationTensor...
stack_v2_sparse_classes_10k_train_007880
6,756
permissive
[ { "docstring": "Creates MetadataWriter based on general/input/output information. Args: model_buffer: valid buffer of the model file. general_md: general information about the model. If not specified, default general metadata will be generated. input_md: input tensor information. If not specified, default input...
2
null
Implement the Python class `MetadataWriter` described below. Class description: Writes metadata into the Bert NL classifier. Method signatures and docstrings: - def create_from_metadata_info(cls, model_buffer: bytearray, general_md: Optional[metadata_info.GeneralMd]=None, input_md: Optional[metadata_info.BertInputTen...
Implement the Python class `MetadataWriter` described below. Class description: Writes metadata into the Bert NL classifier. Method signatures and docstrings: - def create_from_metadata_info(cls, model_buffer: bytearray, general_md: Optional[metadata_info.GeneralMd]=None, input_md: Optional[metadata_info.BertInputTen...
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
<|skeleton|> class MetadataWriter: """Writes metadata into the Bert NL classifier.""" def create_from_metadata_info(cls, model_buffer: bytearray, general_md: Optional[metadata_info.GeneralMd]=None, input_md: Optional[metadata_info.BertInputTensorsMd]=None, output_md: Optional[metadata_info.ClassificationTensor...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MetadataWriter: """Writes metadata into the Bert NL classifier.""" def create_from_metadata_info(cls, model_buffer: bytearray, general_md: Optional[metadata_info.GeneralMd]=None, input_md: Optional[metadata_info.BertInputTensorsMd]=None, output_md: Optional[metadata_info.ClassificationTensorMd]=None): ...
the_stack_v2_python_sparse
third_party/tflite_support/src/tensorflow_lite_support/metadata/python/metadata_writers/bert_nl_classifier.py
chromium/chromium
train
17,408
dcad37a8101e1054ceb0404e5dcec42041a1f2a3
[ "BaseController.__init__(self, veh_id, car_following_params, delay=time_delay, fail_safe=fail_safe, noise=noise)\nself.v0 = v0\nself.T = T\nself.a = a\nself.b = b\nself.delta = delta\nself.s0 = s0", "v = env.k.vehicle.get_speed(self.veh_id)\nlead_id = env.k.vehicle.get_leader(self.veh_id)\nh = env.k.vehicle.get_h...
<|body_start_0|> BaseController.__init__(self, veh_id, car_following_params, delay=time_delay, fail_safe=fail_safe, noise=noise) self.v0 = v0 self.T = T self.a = a self.b = b self.delta = delta self.s0 = s0 <|end_body_0|> <|body_start_1|> v = env.k.vehicl...
Intelligent Driver Model (IDM) controller. For more information on this controller, see: Treiber, Martin, Ansgar Hennecke, and Dirk Helbing. "Congested traffic states in empirical observations and microscopic simulations." Physical review E 62.2 (2000): 1805. Usage ----- See BaseController for usage example. Attributes...
IDMController
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IDMController: """Intelligent Driver Model (IDM) controller. For more information on this controller, see: Treiber, Martin, Ansgar Hennecke, and Dirk Helbing. "Congested traffic states in empirical observations and microscopic simulations." Physical review E 62.2 (2000): 1805. Usage ----- See Bas...
stack_v2_sparse_classes_10k_train_007881
17,548
permissive
[ { "docstring": "Instantiate an IDM controller.", "name": "__init__", "signature": "def __init__(self, veh_id, v0=30, T=1, a=1, b=1.5, delta=4, s0=2, time_delay=0.0, noise=0, fail_safe=None, car_following_params=None)" }, { "docstring": "See parent class.", "name": "get_accel", "signature...
2
stack_v2_sparse_classes_30k_train_003102
Implement the Python class `IDMController` described below. Class description: Intelligent Driver Model (IDM) controller. For more information on this controller, see: Treiber, Martin, Ansgar Hennecke, and Dirk Helbing. "Congested traffic states in empirical observations and microscopic simulations." Physical review E...
Implement the Python class `IDMController` described below. Class description: Intelligent Driver Model (IDM) controller. For more information on this controller, see: Treiber, Martin, Ansgar Hennecke, and Dirk Helbing. "Congested traffic states in empirical observations and microscopic simulations." Physical review E...
badac3da17f04d8d8ae5691ee8ba2af9d56fac35
<|skeleton|> class IDMController: """Intelligent Driver Model (IDM) controller. For more information on this controller, see: Treiber, Martin, Ansgar Hennecke, and Dirk Helbing. "Congested traffic states in empirical observations and microscopic simulations." Physical review E 62.2 (2000): 1805. Usage ----- See Bas...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class IDMController: """Intelligent Driver Model (IDM) controller. For more information on this controller, see: Treiber, Martin, Ansgar Hennecke, and Dirk Helbing. "Congested traffic states in empirical observations and microscopic simulations." Physical review E 62.2 (2000): 1805. Usage ----- See BaseController f...
the_stack_v2_python_sparse
flow/controllers/car_following_models.py
parthjaggi/flow
train
6
6f1f6f9c2481a22512d07360ff62d3ee4ff15cd5
[ "total = sum(nums)\nif total % 2 == 1:\n return False\ntarget = int(total / 2)\ndp = [0] * (total + 1)\nfor num in nums:\n i = target\n while i >= num:\n dp[i] = max(dp[i], dp[i - num] + num)\n i -= 1\n if dp[i] == target:\n return True\nreturn False", "total = sum(nums)\n...
<|body_start_0|> total = sum(nums) if total % 2 == 1: return False target = int(total / 2) dp = [0] * (total + 1) for num in nums: i = target while i >= num: dp[i] = max(dp[i], dp[i - num] + num) i -= 1 ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def can_partition(self, nums: List[int]) -> bool: """数组是否可以分为两半 Args: nums: 数组 Returns: 布尔值""" <|body_0|> def can_partition2(self, nums: List[int]) -> bool: """数组是否可以分为两半 Args: nums: 数组 Returns: 布尔值""" <|body_1|> def partition_helper(self, nums...
stack_v2_sparse_classes_10k_train_007882
2,791
permissive
[ { "docstring": "数组是否可以分为两半 Args: nums: 数组 Returns: 布尔值", "name": "can_partition", "signature": "def can_partition(self, nums: List[int]) -> bool" }, { "docstring": "数组是否可以分为两半 Args: nums: 数组 Returns: 布尔值", "name": "can_partition2", "signature": "def can_partition2(self, nums: List[int]) ...
3
stack_v2_sparse_classes_30k_train_007223
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def can_partition(self, nums: List[int]) -> bool: 数组是否可以分为两半 Args: nums: 数组 Returns: 布尔值 - def can_partition2(self, nums: List[int]) -> bool: 数组是否可以分为两半 Args: nums: 数组 Returns: 布...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def can_partition(self, nums: List[int]) -> bool: 数组是否可以分为两半 Args: nums: 数组 Returns: 布尔值 - def can_partition2(self, nums: List[int]) -> bool: 数组是否可以分为两半 Args: nums: 数组 Returns: 布...
50f35eef6a0ad63173efed10df3c835b1dceaa3f
<|skeleton|> class Solution: def can_partition(self, nums: List[int]) -> bool: """数组是否可以分为两半 Args: nums: 数组 Returns: 布尔值""" <|body_0|> def can_partition2(self, nums: List[int]) -> bool: """数组是否可以分为两半 Args: nums: 数组 Returns: 布尔值""" <|body_1|> def partition_helper(self, nums...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def can_partition(self, nums: List[int]) -> bool: """数组是否可以分为两半 Args: nums: 数组 Returns: 布尔值""" total = sum(nums) if total % 2 == 1: return False target = int(total / 2) dp = [0] * (total + 1) for num in nums: i = target ...
the_stack_v2_python_sparse
src/leetcodepython/array/partition_equal_subset_sum_416.py
zhangyu345293721/leetcode
train
101
faaabaeb71d1e73aed74372579eb77123fce9c8d
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('bohorqux_peterg04_rocksdan_yfchen', 'bohorqux_peterg04_rocksdan_yfchen')\nurl = 'http://datamechanics.io/data/eileenli_yidingou/Restaurant.json'\nresponse = urllib.request.urlopen(url).read().decode('utf...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('bohorqux_peterg04_rocksdan_yfchen', 'bohorqux_peterg04_rocksdan_yfchen') url = 'http://datamechanics.io/data/eileenli_yidingou/Restaurant.json' re...
getRestaurants
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class getRestaurants: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everythin...
stack_v2_sparse_classes_10k_train_007883
4,123
no_license
[ { "docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).", "name": "execute", "signature": "def execute(trial=False)" }, { "docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d...
2
stack_v2_sparse_classes_30k_train_004039
Implement the Python class `getRestaurants` described below. Class description: Implement the getRestaurants class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=None,...
Implement the Python class `getRestaurants` described below. Class description: Implement the getRestaurants class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=None,...
97e72731ffadbeae57d7a332decd58706e7c08de
<|skeleton|> class getRestaurants: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everythin...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class getRestaurants: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('bohorqux_peterg04_rocksdan_yfchen', ...
the_stack_v2_python_sparse
bohorqux_peterg04_rocksdan_yfchen/getRestaurants.py
ROODAY/course-2017-fal-proj
train
3
3f3512127d680bb5f79a9685decf337d7c91c727
[ "conn, cursor = get_db_cursor()\nbuild = 'toy_build'\ndatabase = 'scratch/toy.db'\nrun_info = talon.init_run_info(database, build)\ntalon.get_counters(database)\nedge_dict = init_refs.make_edge_dict(cursor)\nlocation_dict = init_refs.make_location_dict(build, cursor)\ntranscript_dict = init_refs.make_transcript_dic...
<|body_start_0|> conn, cursor = get_db_cursor() build = 'toy_build' database = 'scratch/toy.db' run_info = talon.init_run_info(database, build) talon.get_counters(database) edge_dict = init_refs.make_edge_dict(cursor) location_dict = init_refs.make_location_dict(b...
TestIdentifyISM
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestIdentifyISM: def test_ISM_suffix(self): """Example where the transcript is an ISM with suffix""" <|body_0|> def test_ISM_prefix(self): """Example where the transcript is a prefix ISM with a novel start""" <|body_1|> def test_no_match(self): "...
stack_v2_sparse_classes_10k_train_007884
4,995
permissive
[ { "docstring": "Example where the transcript is an ISM with suffix", "name": "test_ISM_suffix", "signature": "def test_ISM_suffix(self)" }, { "docstring": "Example where the transcript is a prefix ISM with a novel start", "name": "test_ISM_prefix", "signature": "def test_ISM_prefix(self)...
3
stack_v2_sparse_classes_30k_train_003391
Implement the Python class `TestIdentifyISM` described below. Class description: Implement the TestIdentifyISM class. Method signatures and docstrings: - def test_ISM_suffix(self): Example where the transcript is an ISM with suffix - def test_ISM_prefix(self): Example where the transcript is a prefix ISM with a novel...
Implement the Python class `TestIdentifyISM` described below. Class description: Implement the TestIdentifyISM class. Method signatures and docstrings: - def test_ISM_suffix(self): Example where the transcript is an ISM with suffix - def test_ISM_prefix(self): Example where the transcript is a prefix ISM with a novel...
8014faed5f982e5e106ec05239e47d65878e76c3
<|skeleton|> class TestIdentifyISM: def test_ISM_suffix(self): """Example where the transcript is an ISM with suffix""" <|body_0|> def test_ISM_prefix(self): """Example where the transcript is a prefix ISM with a novel start""" <|body_1|> def test_no_match(self): "...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestIdentifyISM: def test_ISM_suffix(self): """Example where the transcript is an ISM with suffix""" conn, cursor = get_db_cursor() build = 'toy_build' database = 'scratch/toy.db' run_info = talon.init_run_info(database, build) talon.get_counters(database) ...
the_stack_v2_python_sparse
testing_suite/test_ISM_identification.py
kopardev/TALON
train
0
49919c2323266cadcc59c59e708a976a5f266ba7
[ "flags.AddParentFlagsToParser(parser)\nparser.add_argument('--location', metavar='LOCATION', required=True, help='Location')\nparser.add_argument('--insight-type', metavar='INSIGHT_TYPE', required=False, help='Insight type to list insights for. Supported insight-types can be found here: https://cloud.google.com/rec...
<|body_start_0|> flags.AddParentFlagsToParser(parser) parser.add_argument('--location', metavar='LOCATION', required=True, help='Location') parser.add_argument('--insight-type', metavar='INSIGHT_TYPE', required=False, help='Insight type to list insights for. Supported insight-types can be found ...
List insights for a cloud entity. This command lists all insights for a given cloud entity, location and insight type. Supported insight-types can be found here: https://cloud.google.com/recommender/docs/insights/insight-types. Currently the following cloud_entity_types are supported: project, billing_account, folder a...
List
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class List: """List insights for a cloud entity. This command lists all insights for a given cloud entity, location and insight type. Supported insight-types can be found here: https://cloud.google.com/recommender/docs/insights/insight-types. Currently the following cloud_entity_types are supported: pr...
stack_v2_sparse_classes_10k_train_007885
6,196
permissive
[ { "docstring": "Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command.", "name": "Args", "signature": "def Args(parser)" }, { "docstring": "Run 'gcloud recommender insight...
2
stack_v2_sparse_classes_30k_train_007246
Implement the Python class `List` described below. Class description: List insights for a cloud entity. This command lists all insights for a given cloud entity, location and insight type. Supported insight-types can be found here: https://cloud.google.com/recommender/docs/insights/insight-types. Currently the followi...
Implement the Python class `List` described below. Class description: List insights for a cloud entity. This command lists all insights for a given cloud entity, location and insight type. Supported insight-types can be found here: https://cloud.google.com/recommender/docs/insights/insight-types. Currently the followi...
392abf004b16203030e6efd2f0af24db7c8d669e
<|skeleton|> class List: """List insights for a cloud entity. This command lists all insights for a given cloud entity, location and insight type. Supported insight-types can be found here: https://cloud.google.com/recommender/docs/insights/insight-types. Currently the following cloud_entity_types are supported: pr...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class List: """List insights for a cloud entity. This command lists all insights for a given cloud entity, location and insight type. Supported insight-types can be found here: https://cloud.google.com/recommender/docs/insights/insight-types. Currently the following cloud_entity_types are supported: project, billin...
the_stack_v2_python_sparse
lib/surface/recommender/insights/list.py
google-cloud-sdk-unofficial/google-cloud-sdk
train
9
fad45349477c4720b55af5af71e50dfc643c06bd
[ "if not matrix or not matrix[0]:\n return False\nxs, xe, ys, ye = (0, len(matrix), 0, len(matrix[0]))\nwhile True:\n row_s, col_s = (map(lambda line: line[ys], matrix), matrix[xs])\n row_s_index = bisect.bisect_left(row_s, target, xs, xe)\n if row_s_index != xe and row_s[row_s_index] == target:\n ...
<|body_start_0|> if not matrix or not matrix[0]: return False xs, xe, ys, ye = (0, len(matrix), 0, len(matrix[0])) while True: row_s, col_s = (map(lambda line: line[ys], matrix), matrix[xs]) row_s_index = bisect.bisect_left(row_s, target, xs, xe) i...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def searchMatrix(self, matrix, target): """:type matrix: List[List[int]] :type target: int :rtype: bool""" <|body_0|> def searchMatrix2(self, matrix, target): """:type matrix: List[List[int]] :type target: int :rtype: bool""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_10k_train_007886
2,041
permissive
[ { "docstring": ":type matrix: List[List[int]] :type target: int :rtype: bool", "name": "searchMatrix", "signature": "def searchMatrix(self, matrix, target)" }, { "docstring": ":type matrix: List[List[int]] :type target: int :rtype: bool", "name": "searchMatrix2", "signature": "def search...
2
stack_v2_sparse_classes_30k_train_001362
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchMatrix(self, matrix, target): :type matrix: List[List[int]] :type target: int :rtype: bool - def searchMatrix2(self, matrix, target): :type matrix: List[List[int]] :typ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchMatrix(self, matrix, target): :type matrix: List[List[int]] :type target: int :rtype: bool - def searchMatrix2(self, matrix, target): :type matrix: List[List[int]] :typ...
c8bf33af30569177c5276ffcd72a8d93ba4c402a
<|skeleton|> class Solution: def searchMatrix(self, matrix, target): """:type matrix: List[List[int]] :type target: int :rtype: bool""" <|body_0|> def searchMatrix2(self, matrix, target): """:type matrix: List[List[int]] :type target: int :rtype: bool""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def searchMatrix(self, matrix, target): """:type matrix: List[List[int]] :type target: int :rtype: bool""" if not matrix or not matrix[0]: return False xs, xe, ys, ye = (0, len(matrix), 0, len(matrix[0])) while True: row_s, col_s = (map(lambda ...
the_stack_v2_python_sparse
201-300/231-240/240-search2DArray2/search2DArray2.py
xuychen/Leetcode
train
0
30d16061e5d35c0b7cf7061e9787f9bf524500e9
[ "self.current_shoot_params = {'video_file': '', 'audio_file': '', 'merged_file': ''}\nself.current_shot_params = {'file': ''}\nself.current_video_file = ''\nself.current_audio_file = ''\nself.current_merged_file = ''\nself.shoot_formats = {'video': shoot_formats[0], 'audio': shoot_formats[1], 'merged': shoot_format...
<|body_start_0|> self.current_shoot_params = {'video_file': '', 'audio_file': '', 'merged_file': ''} self.current_shot_params = {'file': ''} self.current_video_file = '' self.current_audio_file = '' self.current_merged_file = '' self.shoot_formats = {'video': shoot_format...
Class to define a recording ability of tracking system. This class provides necessary initiations and functions named :func:`t_system.recordation.RecordManager.start` for creating a Record object and start recording by this object. :func:`t_system.recordation.RecordManager.merge_audio_and_video` for merging separate au...
Recorder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Recorder: """Class to define a recording ability of tracking system. This class provides necessary initiations and functions named :func:`t_system.recordation.RecordManager.start` for creating a Record object and start recording by this object. :func:`t_system.recordation.RecordManager.merge_audi...
stack_v2_sparse_classes_10k_train_007887
18,130
permissive
[ { "docstring": "Initialization method of :class:`t_system.recordation.Recorder` class. Args: shot_format (str): Format of the shot. (jpg, png etc.) shoot_formats (list): Formats of the records for video, audio and merged. camera: Camera object from PiCamera. hearer: Hearer object.", "name": "__init__", ...
6
stack_v2_sparse_classes_30k_train_003437
Implement the Python class `Recorder` described below. Class description: Class to define a recording ability of tracking system. This class provides necessary initiations and functions named :func:`t_system.recordation.RecordManager.start` for creating a Record object and start recording by this object. :func:`t_syst...
Implement the Python class `Recorder` described below. Class description: Class to define a recording ability of tracking system. This class provides necessary initiations and functions named :func:`t_system.recordation.RecordManager.start` for creating a Record object and start recording by this object. :func:`t_syst...
4cf34572b8f8eac54d6c339f37aa72b6a13d8934
<|skeleton|> class Recorder: """Class to define a recording ability of tracking system. This class provides necessary initiations and functions named :func:`t_system.recordation.RecordManager.start` for creating a Record object and start recording by this object. :func:`t_system.recordation.RecordManager.merge_audi...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Recorder: """Class to define a recording ability of tracking system. This class provides necessary initiations and functions named :func:`t_system.recordation.RecordManager.start` for creating a Record object and start recording by this object. :func:`t_system.recordation.RecordManager.merge_audio_and_video` ...
the_stack_v2_python_sparse
t_system/recordation.py
LookAtMe-Genius-Cameraman/T_System
train
9
0f3c4d09b7dcc6b293fa1e0701c12a1a6c5fc585
[ "super().__init__()\nself.d_model = d_model\nself.xscale = math.sqrt(self.d_model)\nself.dropout = nn.Dropout(p=dropout_rate)\nself.pe = None\nself.dtype = dtype\nself.extend_pe(paddle.expand(paddle.zeros([1]), (1, max_len)))", "if self.pe is not None:\n if paddle.shape(self.pe)[1] >= paddle.shape(x)[1] * 2 - ...
<|body_start_0|> super().__init__() self.d_model = d_model self.xscale = math.sqrt(self.d_model) self.dropout = nn.Dropout(p=dropout_rate) self.pe = None self.dtype = dtype self.extend_pe(paddle.expand(paddle.zeros([1]), (1, max_len))) <|end_body_0|> <|body_start...
Relative positional encoding module (new implementation). Details can be found in https://github.com/espnet/espnet/pull/2816. See : Appendix B in https://arxiv.org/abs/1901.02860 Args: d_model (int): Embedding dimension. dropout_rate (float): Dropout rate. max_len (int): Maximum input length.
RelPositionalEncoding
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RelPositionalEncoding: """Relative positional encoding module (new implementation). Details can be found in https://github.com/espnet/espnet/pull/2816. See : Appendix B in https://arxiv.org/abs/1901.02860 Args: d_model (int): Embedding dimension. dropout_rate (float): Dropout rate. max_len (int):...
stack_v2_sparse_classes_10k_train_007888
9,302
permissive
[ { "docstring": "Construct an PositionalEncoding object.", "name": "__init__", "signature": "def __init__(self, d_model, dropout_rate, max_len=5000, dtype='float32')" }, { "docstring": "Reset the positional encodings.", "name": "extend_pe", "signature": "def extend_pe(self, x)" }, { ...
3
null
Implement the Python class `RelPositionalEncoding` described below. Class description: Relative positional encoding module (new implementation). Details can be found in https://github.com/espnet/espnet/pull/2816. See : Appendix B in https://arxiv.org/abs/1901.02860 Args: d_model (int): Embedding dimension. dropout_rat...
Implement the Python class `RelPositionalEncoding` described below. Class description: Relative positional encoding module (new implementation). Details can be found in https://github.com/espnet/espnet/pull/2816. See : Appendix B in https://arxiv.org/abs/1901.02860 Args: d_model (int): Embedding dimension. dropout_rat...
17854a04d43c231eff66bfed9d6aa55e94a29e79
<|skeleton|> class RelPositionalEncoding: """Relative positional encoding module (new implementation). Details can be found in https://github.com/espnet/espnet/pull/2816. See : Appendix B in https://arxiv.org/abs/1901.02860 Args: d_model (int): Embedding dimension. dropout_rate (float): Dropout rate. max_len (int):...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RelPositionalEncoding: """Relative positional encoding module (new implementation). Details can be found in https://github.com/espnet/espnet/pull/2816. See : Appendix B in https://arxiv.org/abs/1901.02860 Args: d_model (int): Embedding dimension. dropout_rate (float): Dropout rate. max_len (int): Maximum inpu...
the_stack_v2_python_sparse
paddlespeech/t2s/modules/transformer/embedding.py
anniyanvr/DeepSpeech-1
train
0
bd3a352089c1a6a8c5b80fabaf252dc2b30bf8be
[ "if self.request.user.is_superuser:\n return self.queryset\nreturn self.queryset.filter(user=self.request.user)", "instance = self.get_object()\nif instance.contest.publish_date < timezone.now():\n raise exceptions.PermissionDenied('You cannot delete already published submission sets.')\ninstance.submission...
<|body_start_0|> if self.request.user.is_superuser: return self.queryset return self.queryset.filter(user=self.request.user) <|end_body_0|> <|body_start_1|> instance = self.get_object() if instance.contest.publish_date < timezone.now(): raise exceptions.Permissio...
SubmissionSetViewSet
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubmissionSetViewSet: def get_queryset(self): """Return queryset for submissions that can be shown to user. Return: * all submissions for already finished contests * user's submissions""" <|body_0|> def destroy(self, request, *args, **kwargs): """Destroy the instance...
stack_v2_sparse_classes_10k_train_007889
5,658
permissive
[ { "docstring": "Return queryset for submissions that can be shown to user. Return: * all submissions for already finished contests * user's submissions", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docstring": "Destroy the instance and all related submissions.", "name...
2
stack_v2_sparse_classes_30k_train_003589
Implement the Python class `SubmissionSetViewSet` described below. Class description: Implement the SubmissionSetViewSet class. Method signatures and docstrings: - def get_queryset(self): Return queryset for submissions that can be shown to user. Return: * all submissions for already finished contests * user's submis...
Implement the Python class `SubmissionSetViewSet` described below. Class description: Implement the SubmissionSetViewSet class. Method signatures and docstrings: - def get_queryset(self): Return queryset for submissions that can be shown to user. Return: * all submissions for already finished contests * user's submis...
d9876e37d8057009c10ef0c4d23a2b04d322f4eb
<|skeleton|> class SubmissionSetViewSet: def get_queryset(self): """Return queryset for submissions that can be shown to user. Return: * all submissions for already finished contests * user's submissions""" <|body_0|> def destroy(self, request, *args, **kwargs): """Destroy the instance...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SubmissionSetViewSet: def get_queryset(self): """Return queryset for submissions that can be shown to user. Return: * all submissions for already finished contests * user's submissions""" if self.request.user.is_superuser: return self.queryset return self.queryset.filter(us...
the_stack_v2_python_sparse
src/rolca/core/api/views.py
dblenkus/rolca
train
0
8af40f54ae1e25fee10666d8b576f84e25c4620e
[ "d = {'}': '{', ']': '[', ')': '('}\nstack = []\nfor i in s:\n if d.get(i) is not None:\n if len(stack) == 0 or stack.pop() != d[i]:\n return False\n else:\n stack.append(i)\nif len(stack) == 0:\n return True\nelse:\n return False", "d = {'}': '{', ']': '[', ')': '('}\nl = lis...
<|body_start_0|> d = {'}': '{', ']': '[', ')': '('} stack = [] for i in s: if d.get(i) is not None: if len(stack) == 0 or stack.pop() != d[i]: return False else: stack.append(i) if len(stack) == 0: re...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isValid(self, s): """:type s: str :rtype: bool""" <|body_0|> def other(self, s): """:type s: str :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> d = {'}': '{', ']': '[', ')': '('} stack = [] for i in s: ...
stack_v2_sparse_classes_10k_train_007890
956
no_license
[ { "docstring": ":type s: str :rtype: bool", "name": "isValid", "signature": "def isValid(self, s)" }, { "docstring": ":type s: str :rtype: bool", "name": "other", "signature": "def other(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_003161
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValid(self, s): :type s: str :rtype: bool - def other(self, s): :type s: str :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValid(self, s): :type s: str :rtype: bool - def other(self, s): :type s: str :rtype: bool <|skeleton|> class Solution: def isValid(self, s): """:type s: str :...
e178f91ebffff06977e8c231de12786a72b3b13d
<|skeleton|> class Solution: def isValid(self, s): """:type s: str :rtype: bool""" <|body_0|> def other(self, s): """:type s: str :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def isValid(self, s): """:type s: str :rtype: bool""" d = {'}': '{', ']': '[', ')': '('} stack = [] for i in s: if d.get(i) is not None: if len(stack) == 0 or stack.pop() != d[i]: return False else: ...
the_stack_v2_python_sparse
iamsochun/Leetcode20.py
moonlight035/algorithm
train
0
3d3ad799f7567edc33596bba82f96f319225ce12
[ "if head == None or head.next == None:\n return False\nslow = head\nfast = head.next\nwhile slow != fast:\n if fast == None or fast.next == None:\n return False\n else:\n slow = slow.next\n fast = fast.next.next\nreturn True", "table = {}\nwhile head != None:\n if head in table.ke...
<|body_start_0|> if head == None or head.next == None: return False slow = head fast = head.next while slow != fast: if fast == None or fast.next == None: return False else: slow = slow.next fast = fast.n...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def hasCycle(self, head): """:type head: ListNode :rtype: bool""" <|body_0|> def hasCycleHash(self, head): """:type head: ListNode :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if head == None or head.next == None: ...
stack_v2_sparse_classes_10k_train_007891
1,205
permissive
[ { "docstring": ":type head: ListNode :rtype: bool", "name": "hasCycle", "signature": "def hasCycle(self, head)" }, { "docstring": ":type head: ListNode :rtype: bool", "name": "hasCycleHash", "signature": "def hasCycleHash(self, head)" } ]
2
stack_v2_sparse_classes_30k_train_000394
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasCycle(self, head): :type head: ListNode :rtype: bool - def hasCycleHash(self, head): :type head: ListNode :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasCycle(self, head): :type head: ListNode :rtype: bool - def hasCycleHash(self, head): :type head: ListNode :rtype: bool <|skeleton|> class Solution: def hasCycle(self...
0e4af391274e33a9bb9f999a9032b74d06fc878e
<|skeleton|> class Solution: def hasCycle(self, head): """:type head: ListNode :rtype: bool""" <|body_0|> def hasCycleHash(self, head): """:type head: ListNode :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def hasCycle(self, head): """:type head: ListNode :rtype: bool""" if head == None or head.next == None: return False slow = head fast = head.next while slow != fast: if fast == None or fast.next == None: return False ...
the_stack_v2_python_sparse
leetcode/link-list/cycle.py
Gaurav-Pande/DataStructures
train
6
cdd7d53e7076a12223cfe9a047fa457d007ff587
[ "self.Id = id\nif transitions == None:\n self.Transitions = []\nself.IsStart = False\nself.IsEnd = False", "for l in range(len(self.Transitions)):\n conditions = self.Transitions[l].Conditions\n transitionActions = TransitionActions([], [])\n transitionActions.Actions = [action for action in self.Tran...
<|body_start_0|> self.Id = id if transitions == None: self.Transitions = [] self.IsStart = False self.IsEnd = False <|end_body_0|> <|body_start_1|> for l in range(len(self.Transitions)): conditions = self.Transitions[l].Conditions transitionAc...
# PyUML: Do not remove this line! # XMI_ID:_qzIH5I35Ed-gg8GOK1TmhA
State
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class State: """# PyUML: Do not remove this line! # XMI_ID:_qzIH5I35Ed-gg8GOK1TmhA""" def __init__(self, id=None, transitions=None): """Constructor""" <|body_0|> def NextStateWithActions(self, word, charIndex=None, charIndexForward=True): """[charIndexForward] is used ...
stack_v2_sparse_classes_10k_train_007892
3,795
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, id=None, transitions=None)" }, { "docstring": "[charIndexForward] is used to specify the look ahead direction is it forward or backward.", "name": "NextStateWithActions", "signature": "def NextStateWithAct...
2
stack_v2_sparse_classes_30k_train_000010
Implement the Python class `State` described below. Class description: # PyUML: Do not remove this line! # XMI_ID:_qzIH5I35Ed-gg8GOK1TmhA Method signatures and docstrings: - def __init__(self, id=None, transitions=None): Constructor - def NextStateWithActions(self, word, charIndex=None, charIndexForward=True): [charI...
Implement the Python class `State` described below. Class description: # PyUML: Do not remove this line! # XMI_ID:_qzIH5I35Ed-gg8GOK1TmhA Method signatures and docstrings: - def __init__(self, id=None, transitions=None): Constructor - def NextStateWithActions(self, word, charIndex=None, charIndexForward=True): [charI...
e02cf223442d50c4b11d926c79133496c79a4405
<|skeleton|> class State: """# PyUML: Do not remove this line! # XMI_ID:_qzIH5I35Ed-gg8GOK1TmhA""" def __init__(self, id=None, transitions=None): """Constructor""" <|body_0|> def NextStateWithActions(self, word, charIndex=None, charIndexForward=True): """[charIndexForward] is used ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class State: """# PyUML: Do not remove this line! # XMI_ID:_qzIH5I35Ed-gg8GOK1TmhA""" def __init__(self, id=None, transitions=None): """Constructor""" self.Id = id if transitions == None: self.Transitions = [] self.IsStart = False self.IsEnd = False def ...
the_stack_v2_python_sparse
SourceCode/Controllers/Transducers/State.py
Qutuf/Qutuf
train
112
2442b353ebb9395c5db7855d5cec451e8d0b957f
[ "total_len = len(nums1) + len(nums2)\nk = total_len // 2\nif total_len % 2 == 0:\n return (self.findKth(nums1, nums2, k) + self.findKth(nums1, nums2, k + 1)) / 2.0\nreturn self.findKth(nums1, nums2, k + 1) * 1.0", "if kth > len(nums1) + len(nums2):\n raise ValueError('kth should be lower than the total leng...
<|body_start_0|> total_len = len(nums1) + len(nums2) k = total_len // 2 if total_len % 2 == 0: return (self.findKth(nums1, nums2, k) + self.findKth(nums1, nums2, k + 1)) / 2.0 return self.findKth(nums1, nums2, k + 1) * 1.0 <|end_body_0|> <|body_start_1|> if kth > len...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMedianSortedArrays(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: float""" <|body_0|> def findKth(self, nums1, nums2, kth): """find kth element of two sorted list""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_10k_train_007893
1,741
no_license
[ { "docstring": ":type nums1: List[int] :type nums2: List[int] :rtype: float", "name": "findMedianSortedArrays", "signature": "def findMedianSortedArrays(self, nums1, nums2)" }, { "docstring": "find kth element of two sorted list", "name": "findKth", "signature": "def findKth(self, nums1,...
2
stack_v2_sparse_classes_30k_train_005901
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMedianSortedArrays(self, nums1, nums2): :type nums1: List[int] :type nums2: List[int] :rtype: float - def findKth(self, nums1, nums2, kth): find kth element of two sorted...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMedianSortedArrays(self, nums1, nums2): :type nums1: List[int] :type nums2: List[int] :rtype: float - def findKth(self, nums1, nums2, kth): find kth element of two sorted...
7e3929a4b5bd0344f93373979c9d1acc4ae192a7
<|skeleton|> class Solution: def findMedianSortedArrays(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: float""" <|body_0|> def findKth(self, nums1, nums2, kth): """find kth element of two sorted list""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def findMedianSortedArrays(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: float""" total_len = len(nums1) + len(nums2) k = total_len // 2 if total_len % 2 == 0: return (self.findKth(nums1, nums2, k) + self.findKth(nums1, nums...
the_stack_v2_python_sparse
median_of_two_sorted_arrays.py
xartisan/leetcode-solutions-in-python
train
1
d4ba1cd917884ee1503fe147fe6bb3ed9493e61f
[ "def serialize_core(root):\n str = ''\n if not root:\n str += '$'\n str += ' '\n return\n str += str(root.val)\n str += ' '\n return str + serialize_core(root.left) + serialize_core(root.right)\nif not root:\n return '$ '\nreturn serialize_core(root)", "if not data:\n ret...
<|body_start_0|> def serialize_core(root): str = '' if not root: str += '$' str += ' ' return str += str(root.val) str += ' ' return str + serialize_core(root.left) + serialize_core(root.right) if...
Codec2
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec2: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body...
stack_v2_sparse_classes_10k_train_007894
2,353
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_000885
Implement the Python class `Codec2` described below. Class description: Implement the Codec2 class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtyp...
Implement the Python class `Codec2` described below. Class description: Implement the Codec2 class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtyp...
ce29ea836bd20841d69972180273e4d4ec11514d
<|skeleton|> class Codec2: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec2: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def serialize_core(root): str = '' if not root: str += '$' str += ' ' return str += str(root.val) ...
the_stack_v2_python_sparse
37.py
NeilWangziyu/JZOffer
train
1
0cd2651fcda284073141c63060442ef1dafacbc5
[ "gerrit_setting = self.config.get('gerrit', None)\nif gerrit_setting is not None:\n return gerrit_setting\nrepo = utils.get_git_repo(self.pod.root)\nif repo is None:\n return False\nfor remote in repo.remotes:\n url = remote.config_reader.get('url')\n result = urllib.parse.urlparse(url)\n if result.n...
<|body_start_0|> gerrit_setting = self.config.get('gerrit', None) if gerrit_setting is not None: return gerrit_setting repo = utils.get_git_repo(self.pod.root) if repo is None: return False for remote in repo.remotes: url = remote.config_reader...
Gerrit installer.
GerritInstaller
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GerritInstaller: """Gerrit installer.""" def should_run(self): """Should the installer run?""" <|body_0|> def install(self): """Install dependencies.""" <|body_1|> <|end_skeleton|> <|body_start_0|> gerrit_setting = self.config.get('gerrit', None...
stack_v2_sparse_classes_10k_train_007895
1,751
permissive
[ { "docstring": "Should the installer run?", "name": "should_run", "signature": "def should_run(self)" }, { "docstring": "Install dependencies.", "name": "install", "signature": "def install(self)" } ]
2
null
Implement the Python class `GerritInstaller` described below. Class description: Gerrit installer. Method signatures and docstrings: - def should_run(self): Should the installer run? - def install(self): Install dependencies.
Implement the Python class `GerritInstaller` described below. Class description: Gerrit installer. Method signatures and docstrings: - def should_run(self): Should the installer run? - def install(self): Install dependencies. <|skeleton|> class GerritInstaller: """Gerrit installer.""" def should_run(self): ...
17471c436621ebfd978b51225fa4de05367a53e1
<|skeleton|> class GerritInstaller: """Gerrit installer.""" def should_run(self): """Should the installer run?""" <|body_0|> def install(self): """Install dependencies.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GerritInstaller: """Gerrit installer.""" def should_run(self): """Should the installer run?""" gerrit_setting = self.config.get('gerrit', None) if gerrit_setting is not None: return gerrit_setting repo = utils.get_git_repo(self.pod.root) if repo is None...
the_stack_v2_python_sparse
grow/sdk/installers/gerrit_installer.py
grow/grow
train
352
d448ae38e9c60446f77edf25aae476cb7fbe29bd
[ "vim_connection = pecan.request.vim.open_connection()\nvim_connection.send(rpc_request.serialize())\nmsg = vim_connection.receive()\nif msg is None:\n DLOG.error('No response received for %s.' % rpc_request)\n return httplib.INTERNAL_SERVER_ERROR\nresponse = rpc.RPCMessage.deserialize(msg)\nif rpc.RPC_MSG_RES...
<|body_start_0|> vim_connection = pecan.request.vim.open_connection() vim_connection.send(rpc_request.serialize()) msg = vim_connection.receive() if msg is None: DLOG.error('No response received for %s.' % rpc_request) return httplib.INTERNAL_SERVER_ERROR ...
Virtualised Resources - Computes Migrate API
ComputeMigrateAPI
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ComputeMigrateAPI: """Virtualised Resources - Computes Migrate API""" def _do_migrate(rpc_request): """Return an image details""" <|body_0|> def post(self, compute_id, request_data): """Perform a migrate against a virtual compute resource""" <|body_1|> <...
stack_v2_sparse_classes_10k_train_007896
23,213
permissive
[ { "docstring": "Return an image details", "name": "_do_migrate", "signature": "def _do_migrate(rpc_request)" }, { "docstring": "Perform a migrate against a virtual compute resource", "name": "post", "signature": "def post(self, compute_id, request_data)" } ]
2
null
Implement the Python class `ComputeMigrateAPI` described below. Class description: Virtualised Resources - Computes Migrate API Method signatures and docstrings: - def _do_migrate(rpc_request): Return an image details - def post(self, compute_id, request_data): Perform a migrate against a virtual compute resource
Implement the Python class `ComputeMigrateAPI` described below. Class description: Virtualised Resources - Computes Migrate API Method signatures and docstrings: - def _do_migrate(rpc_request): Return an image details - def post(self, compute_id, request_data): Perform a migrate against a virtual compute resource <|...
6dba3df3e3c4e5f4ae20ae0c4a48ae72e6d6e274
<|skeleton|> class ComputeMigrateAPI: """Virtualised Resources - Computes Migrate API""" def _do_migrate(rpc_request): """Return an image details""" <|body_0|> def post(self, compute_id, request_data): """Perform a migrate against a virtual compute resource""" <|body_1|> <...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ComputeMigrateAPI: """Virtualised Resources - Computes Migrate API""" def _do_migrate(rpc_request): """Return an image details""" vim_connection = pecan.request.vim.open_connection() vim_connection.send(rpc_request.serialize()) msg = vim_connection.receive() if msg...
the_stack_v2_python_sparse
nfv/nfv-vim/nfv_vim/api/controllers/v1/virtualised_resources/_computes_api.py
starlingx/nfv
train
3
8702a664fee7703c48db3aef5d829cd76fe8286f
[ "settings.addListsToRepository('skeinforge_tools.craft_plugins.lash.html', '', self)\nself.fileNameInput = settings.FileNameInput().getFromFileName(interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File for Lash', self, '')\nself.openWikiManualHelpPage = settings.HelpPage().getOpenFromAbsolute('http://www.bits...
<|body_start_0|> settings.addListsToRepository('skeinforge_tools.craft_plugins.lash.html', '', self) self.fileNameInput = settings.FileNameInput().getFromFileName(interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File for Lash', self, '') self.openWikiManualHelpPage = settings.HelpPage().ge...
A class to handle the lash settings.
LashRepository
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LashRepository: """A class to handle the lash settings.""" def __init__(self): """Set the default settings, execute title & settings fileName.""" <|body_0|> def execute(self): """Lash button has been clicked.""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_10k_train_007897
6,957
no_license
[ { "docstring": "Set the default settings, execute title & settings fileName.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Lash button has been clicked.", "name": "execute", "signature": "def execute(self)" } ]
2
stack_v2_sparse_classes_30k_train_002871
Implement the Python class `LashRepository` described below. Class description: A class to handle the lash settings. Method signatures and docstrings: - def __init__(self): Set the default settings, execute title & settings fileName. - def execute(self): Lash button has been clicked.
Implement the Python class `LashRepository` described below. Class description: A class to handle the lash settings. Method signatures and docstrings: - def __init__(self): Set the default settings, execute title & settings fileName. - def execute(self): Lash button has been clicked. <|skeleton|> class LashRepositor...
fd69d8e856780c826386dc973ceabcc03623f3e8
<|skeleton|> class LashRepository: """A class to handle the lash settings.""" def __init__(self): """Set the default settings, execute title & settings fileName.""" <|body_0|> def execute(self): """Lash button has been clicked.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LashRepository: """A class to handle the lash settings.""" def __init__(self): """Set the default settings, execute title & settings fileName.""" settings.addListsToRepository('skeinforge_tools.craft_plugins.lash.html', '', self) self.fileNameInput = settings.FileNameInput().getFr...
the_stack_v2_python_sparse
skeinforge_tools/craft_plugins/lash.py
bmander/skeinforge
train
34
3e11ea23b73cd44233ce95d18c02ed90782b7faf
[ "self._name = name or 'swaption'\nwith tf.name_scope(self._name):\n self._dtype = dtype\n self._expiry_date = dates.convert_to_date_tensor(expiry_date)\n self._swap = swap", "model = model or rc.InterestRateModelType.LOGNORMAL_RATE\nname = name or self._name + '_price'\nwith tf.name_scope(name):\n swa...
<|body_start_0|> self._name = name or 'swaption' with tf.name_scope(self._name): self._dtype = dtype self._expiry_date = dates.convert_to_date_tensor(expiry_date) self._swap = swap <|end_body_0|> <|body_start_1|> model = model or rc.InterestRateModelType.LOGN...
Represents a batch of European Swaptions. A European Swaption is a contract that gives the holder an option to enter a swap contract at a future date at a prespecified fixed rate. A swaption that grants the holder to pay fixed rate and receive floating rate is called a payer swaption while the swaption that grants the ...
Swaption
[ "Apache-2.0", "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Swaption: """Represents a batch of European Swaptions. A European Swaption is a contract that gives the holder an option to enter a swap contract at a future date at a prespecified fixed rate. A swaption that grants the holder to pay fixed rate and receive floating rate is called a payer swaption...
stack_v2_sparse_classes_10k_train_007898
8,660
permissive
[ { "docstring": "Initialize a batch of European swaptions. Args: swap: An instance of `InterestRateSwap` specifying the interest rate swaps underlying the swaptions. The batch size of the swaptions being created would be the same as the batch size of the `swap`. expiry_date: An optional rank 1 `DateTensor` speci...
3
stack_v2_sparse_classes_30k_train_000555
Implement the Python class `Swaption` described below. Class description: Represents a batch of European Swaptions. A European Swaption is a contract that gives the holder an option to enter a swap contract at a future date at a prespecified fixed rate. A swaption that grants the holder to pay fixed rate and receive f...
Implement the Python class `Swaption` described below. Class description: Represents a batch of European Swaptions. A European Swaption is a contract that gives the holder an option to enter a swap contract at a future date at a prespecified fixed rate. A swaption that grants the holder to pay fixed rate and receive f...
0d3a2193c0f2d320b65e602cf01d7a617da484df
<|skeleton|> class Swaption: """Represents a batch of European Swaptions. A European Swaption is a contract that gives the holder an option to enter a swap contract at a future date at a prespecified fixed rate. A swaption that grants the holder to pay fixed rate and receive floating rate is called a payer swaption...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Swaption: """Represents a batch of European Swaptions. A European Swaption is a contract that gives the holder an option to enter a swap contract at a future date at a prespecified fixed rate. A swaption that grants the holder to pay fixed rate and receive floating rate is called a payer swaption while the sw...
the_stack_v2_python_sparse
tf_quant_finance/experimental/instruments/swaption.py
google/tf-quant-finance
train
4,165
1cac1555a7173861e64dcd0166c179adbda9b727
[ "if compute is None:\n compute = impl.get_runtime().default_ip\nreturn tf_impl.type_factory.custom_int(bits, signed, compute)", "frac_type = Quant.int(bits=frac, signed=signed, compute=ti.i32)\nif signed:\n scale = range / 2 ** (frac - 1)\nelse:\n scale = range / 2 ** frac\nif compute is None:\n compu...
<|body_start_0|> if compute is None: compute = impl.get_runtime().default_ip return tf_impl.type_factory.custom_int(bits, signed, compute) <|end_body_0|> <|body_start_1|> frac_type = Quant.int(bits=frac, signed=signed, compute=ti.i32) if signed: scale = range / 2...
Generator of quantized types. For more details, read https://yuanming.taichi.graphics/publication/2021-quantaichi/quantaichi.pdf.
Quant
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Quant: """Generator of quantized types. For more details, read https://yuanming.taichi.graphics/publication/2021-quantaichi/quantaichi.pdf.""" def int(bits, signed=False, compute=None): """Generates a quantized type for integers. Args: bits (int): Number of bits. signed (bool): Signe...
stack_v2_sparse_classes_10k_train_007899
2,606
permissive
[ { "docstring": "Generates a quantized type for integers. Args: bits (int): Number of bits. signed (bool): Signed or unsigned. compute (DataType): Type for computation. Returns: DataType: The specified type.", "name": "int", "signature": "def int(bits, signed=False, compute=None)" }, { "docstring...
3
stack_v2_sparse_classes_30k_train_005678
Implement the Python class `Quant` described below. Class description: Generator of quantized types. For more details, read https://yuanming.taichi.graphics/publication/2021-quantaichi/quantaichi.pdf. Method signatures and docstrings: - def int(bits, signed=False, compute=None): Generates a quantized type for integer...
Implement the Python class `Quant` described below. Class description: Generator of quantized types. For more details, read https://yuanming.taichi.graphics/publication/2021-quantaichi/quantaichi.pdf. Method signatures and docstrings: - def int(bits, signed=False, compute=None): Generates a quantized type for integer...
c9b8166d7b019734438232d9b247eb3555e0d6f0
<|skeleton|> class Quant: """Generator of quantized types. For more details, read https://yuanming.taichi.graphics/publication/2021-quantaichi/quantaichi.pdf.""" def int(bits, signed=False, compute=None): """Generates a quantized type for integers. Args: bits (int): Number of bits. signed (bool): Signe...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Quant: """Generator of quantized types. For more details, read https://yuanming.taichi.graphics/publication/2021-quantaichi/quantaichi.pdf.""" def int(bits, signed=False, compute=None): """Generates a quantized type for integers. Args: bits (int): Number of bits. signed (bool): Signed or unsigned...
the_stack_v2_python_sparse
python/taichi/lang/quant_impl.py
ljcc0930/taichi
train
2