blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 6.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 438 7.52k | id stringlengths 40 40 | length_bytes int64 506 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.25k | prompted_full_text stringlengths 645 10.7k | revision_id stringlengths 40 40 | skeleton stringlengths 162 4.34k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | solution stringlengths 302 7.33k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ee9293970ded784a2562a0a0430868e4e9eb8848 | [
"try:\n category = GoodsCategory.objects.get(id=value, parent=None)\nexcept GoodsCategory.DoesNotExist:\n raise serializers.ValidationError('一级分类不存在')\nreturn value",
"try:\n group = GoodsChannelGroup.objects.get(id=value)\nexcept GoodsChannelGroup.DoesNotExist:\n raise serializers.ValidationError('频道... | <|body_start_0|>
try:
category = GoodsCategory.objects.get(id=value, parent=None)
except GoodsCategory.DoesNotExist:
raise serializers.ValidationError('一级分类不存在')
return value
<|end_body_0|>
<|body_start_1|>
try:
group = GoodsChannelGroup.objects.get(i... | 频道序列化器类 | ChannelSerializer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChannelSerializer:
"""频道序列化器类"""
def validate_category_id(self, value):
"""一级分类是否存在"""
<|body_0|>
def validate_group_id(self, value):
"""频道组是否存在"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
try:
category = GoodsCategory.objects.ge... | stack_v2_sparse_classes_36k_train_016000 | 1,607 | no_license | [
{
"docstring": "一级分类是否存在",
"name": "validate_category_id",
"signature": "def validate_category_id(self, value)"
},
{
"docstring": "频道组是否存在",
"name": "validate_group_id",
"signature": "def validate_group_id(self, value)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007255 | Implement the Python class `ChannelSerializer` described below.
Class description:
频道序列化器类
Method signatures and docstrings:
- def validate_category_id(self, value): 一级分类是否存在
- def validate_group_id(self, value): 频道组是否存在 | Implement the Python class `ChannelSerializer` described below.
Class description:
频道序列化器类
Method signatures and docstrings:
- def validate_category_id(self, value): 一级分类是否存在
- def validate_group_id(self, value): 频道组是否存在
<|skeleton|>
class ChannelSerializer:
"""频道序列化器类"""
def validate_category_id(self, valu... | cd23ae5fa4261f92dc92d4444dc58ff2e703d541 | <|skeleton|>
class ChannelSerializer:
"""频道序列化器类"""
def validate_category_id(self, value):
"""一级分类是否存在"""
<|body_0|>
def validate_group_id(self, value):
"""频道组是否存在"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ChannelSerializer:
"""频道序列化器类"""
def validate_category_id(self, value):
"""一级分类是否存在"""
try:
category = GoodsCategory.objects.get(id=value, parent=None)
except GoodsCategory.DoesNotExist:
raise serializers.ValidationError('一级分类不存在')
return value
... | the_stack_v2_python_sparse | meiduo_mall/meiduo_mall/apps/meiduo_admin/serializers/channels.py | YumiVan/meiduo | train | 1 |
cfb56714cf7dfd03cb4036bd96a7216c6438966b | [
"if len(nums) == 0:\n return\nleft = 0\ncurrent, maxsum = (0, nums[0])\nfor right in range(len(nums)):\n current += nums[right]\n maxsum = max(maxsum, current)\n while current <= 0 and left <= right:\n current -= nums[left]\n left += 1\nreturn maxsum",
"maxnum = nums[0]\nfor i in range(1... | <|body_start_0|>
if len(nums) == 0:
return
left = 0
current, maxsum = (0, nums[0])
for right in range(len(nums)):
current += nums[right]
maxsum = max(maxsum, current)
while current <= 0 and left <= right:
current -= nums[lef... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxSubArray_org(self, nums: List[int]) -> int:
"""76.21 % 思路 滑窗遍历列表; sum < 0 时候 left+1 直到 与right重合; right + 1,重新计算 current 值;"""
<|body_0|>
def maxSubArray(self, nums: List[int]) -> int:
"""76.21% 作者:z1m 动态规划,原地修改数组"""
<|body_1|>
<|end_skeleton... | stack_v2_sparse_classes_36k_train_016001 | 1,356 | no_license | [
{
"docstring": "76.21 % 思路 滑窗遍历列表; sum < 0 时候 left+1 直到 与right重合; right + 1,重新计算 current 值;",
"name": "maxSubArray_org",
"signature": "def maxSubArray_org(self, nums: List[int]) -> int"
},
{
"docstring": "76.21% 作者:z1m 动态规划,原地修改数组",
"name": "maxSubArray",
"signature": "def maxSubArray(se... | 2 | stack_v2_sparse_classes_30k_train_006076 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxSubArray_org(self, nums: List[int]) -> int: 76.21 % 思路 滑窗遍历列表; sum < 0 时候 left+1 直到 与right重合; right + 1,重新计算 current 值;
- def maxSubArray(self, nums: List[int]) -> int: 76... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxSubArray_org(self, nums: List[int]) -> int: 76.21 % 思路 滑窗遍历列表; sum < 0 时候 left+1 直到 与right重合; right + 1,重新计算 current 值;
- def maxSubArray(self, nums: List[int]) -> int: 76... | b6712c793bbfe443953e7186b5dbd876c01cd9a0 | <|skeleton|>
class Solution:
def maxSubArray_org(self, nums: List[int]) -> int:
"""76.21 % 思路 滑窗遍历列表; sum < 0 时候 left+1 直到 与right重合; right + 1,重新计算 current 值;"""
<|body_0|>
def maxSubArray(self, nums: List[int]) -> int:
"""76.21% 作者:z1m 动态规划,原地修改数组"""
<|body_1|>
<|end_skeleton... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxSubArray_org(self, nums: List[int]) -> int:
"""76.21 % 思路 滑窗遍历列表; sum < 0 时候 left+1 直到 与right重合; right + 1,重新计算 current 值;"""
if len(nums) == 0:
return
left = 0
current, maxsum = (0, nums[0])
for right in range(len(nums)):
curren... | the_stack_v2_python_sparse | 05_leetcode/53.最大子序和.py | niceNASA/Python-Foundation-Suda | train | 0 | |
be7e8eeda076146c6a5952c7daa30333c9f7290c | [
"self.paths = paths\nself.interval = interval\nself.default = default",
"if step % self.interval == 0:\n for path in self.paths:\n retrieve(last_results, path, default=self.default)"
] | <|body_start_0|>
self.paths = paths
self.interval = interval
self.default = default
<|end_body_0|>
<|body_start_1|>
if step % self.interval == 0:
for path in self.paths:
retrieve(last_results, path, default=self.default)
<|end_body_1|>
| Retrieve paths. | ExpandHook | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExpandHook:
"""Retrieve paths."""
def __init__(self, paths, interval, default=None):
"""Parameters ---------- paths : list of keypaths to expand. interval : int The interval in which expansion is performed."""
<|body_0|>
def after_step(self, step, last_results):
... | stack_v2_sparse_classes_36k_train_016002 | 4,225 | permissive | [
{
"docstring": "Parameters ---------- paths : list of keypaths to expand. interval : int The interval in which expansion is performed.",
"name": "__init__",
"signature": "def __init__(self, paths, interval, default=None)"
},
{
"docstring": "Called after each step.",
"name": "after_step",
... | 2 | stack_v2_sparse_classes_30k_train_001063 | Implement the Python class `ExpandHook` described below.
Class description:
Retrieve paths.
Method signatures and docstrings:
- def __init__(self, paths, interval, default=None): Parameters ---------- paths : list of keypaths to expand. interval : int The interval in which expansion is performed.
- def after_step(sel... | Implement the Python class `ExpandHook` described below.
Class description:
Retrieve paths.
Method signatures and docstrings:
- def __init__(self, paths, interval, default=None): Parameters ---------- paths : list of keypaths to expand. interval : int The interval in which expansion is performed.
- def after_step(sel... | 317cb1b61bf810a68004788d08418a5352653264 | <|skeleton|>
class ExpandHook:
"""Retrieve paths."""
def __init__(self, paths, interval, default=None):
"""Parameters ---------- paths : list of keypaths to expand. interval : int The interval in which expansion is performed."""
<|body_0|>
def after_step(self, step, last_results):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ExpandHook:
"""Retrieve paths."""
def __init__(self, paths, interval, default=None):
"""Parameters ---------- paths : list of keypaths to expand. interval : int The interval in which expansion is performed."""
self.paths = paths
self.interval = interval
self.default = defa... | the_stack_v2_python_sparse | edflow/hooks/util_hooks.py | pesser/edflow | train | 27 |
ea50a66d85f57aa69962500ddbbbe8ff3923e01c | [
"super(IdEmbedLayer, self).__init__()\nself._num_id_fields = num_id_fields\nself.min_len = DEFAULT_MIN_LEN\nself.max_len = DEFAULT_MAX_LEN\nself.num_cls_sep = 0\nif num_id_fields:\n self.embedding = create_embedding_layer(embedding_layer_param, embedding_hub_url_for_id_ftr)\n self.id_ftr_size = self.embedding... | <|body_start_0|>
super(IdEmbedLayer, self).__init__()
self._num_id_fields = num_id_fields
self.min_len = DEFAULT_MIN_LEN
self.max_len = DEFAULT_MAX_LEN
self.num_cls_sep = 0
if num_id_fields:
self.embedding = create_embedding_layer(embedding_layer_param, embedd... | ID embedding layer | IdEmbedLayer | [
"BSD-2-Clause",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IdEmbedLayer:
"""ID embedding layer"""
def __init__(self, num_id_fields, embedding_layer_param, embedding_hub_url_for_id_ftr):
"""Initializes the layer For more details on parameters, check args.py"""
<|body_0|>
def call(self, inputs, **kwargs):
"""Applies ID emb... | stack_v2_sparse_classes_36k_train_016003 | 4,399 | permissive | [
{
"docstring": "Initializes the layer For more details on parameters, check args.py",
"name": "__init__",
"signature": "def __init__(self, num_id_fields, embedding_layer_param, embedding_hub_url_for_id_ftr)"
},
{
"docstring": "Applies ID embedding lookup and summation on document and user fields... | 5 | null | Implement the Python class `IdEmbedLayer` described below.
Class description:
ID embedding layer
Method signatures and docstrings:
- def __init__(self, num_id_fields, embedding_layer_param, embedding_hub_url_for_id_ftr): Initializes the layer For more details on parameters, check args.py
- def call(self, inputs, **kw... | Implement the Python class `IdEmbedLayer` described below.
Class description:
ID embedding layer
Method signatures and docstrings:
- def __init__(self, num_id_fields, embedding_layer_param, embedding_hub_url_for_id_ftr): Initializes the layer For more details on parameters, check args.py
- def call(self, inputs, **kw... | 671d43c5ffc83cae635174ed15c58d0bc84b76ef | <|skeleton|>
class IdEmbedLayer:
"""ID embedding layer"""
def __init__(self, num_id_fields, embedding_layer_param, embedding_hub_url_for_id_ftr):
"""Initializes the layer For more details on parameters, check args.py"""
<|body_0|>
def call(self, inputs, **kwargs):
"""Applies ID emb... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IdEmbedLayer:
"""ID embedding layer"""
def __init__(self, num_id_fields, embedding_layer_param, embedding_hub_url_for_id_ftr):
"""Initializes the layer For more details on parameters, check args.py"""
super(IdEmbedLayer, self).__init__()
self._num_id_fields = num_id_fields
... | the_stack_v2_python_sparse | src/detext/layers/id_embed_layer.py | linkedin/detext | train | 1,289 |
bff211b69b352fbe9174ecaa7060f6d379c6c711 | [
"self.control_points = Vec3.list(control_points)\nself.degree = degree\nself.closed = closed",
"if self.closed:\n spline = closed_uniform_bspline(self.control_points, order=self.degree + 1)\nelse:\n spline = BSpline(self.control_points, order=self.degree + 1)\nvertices = spline.approximate(segments)\nif ucs... | <|body_start_0|>
self.control_points = Vec3.list(control_points)
self.degree = degree
self.closed = closed
<|end_body_0|>
<|body_start_1|>
if self.closed:
spline = closed_uniform_bspline(self.control_points, order=self.degree + 1)
else:
spline = BSpline(s... | DXF R12 supports 2D B-splines, but Autodesk do not document the usage in the DXF Reference. The base entity for splines in DXF R12 is the POLYLINE entity. The spline itself is always in a plane, but as any 2D entity, the spline can be transformed into the 3D object by elevation and extrusion (:ref:`OCS`, :ref:`UCS`). T... | R12Spline | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class R12Spline:
"""DXF R12 supports 2D B-splines, but Autodesk do not document the usage in the DXF Reference. The base entity for splines in DXF R12 is the POLYLINE entity. The spline itself is always in a plane, but as any 2D entity, the spline can be transformed into the 3D object by elevation and ... | stack_v2_sparse_classes_36k_train_016004 | 7,650 | permissive | [
{
"docstring": "Args: control_points: B-spline control frame vertices degree: degree of B-spline, only 2 and 3 is supported closed: ``True`` for closed curve",
"name": "__init__",
"signature": "def __init__(self, control_points: Iterable[UVec], degree: int=2, closed: bool=True)"
},
{
"docstring"... | 3 | stack_v2_sparse_classes_30k_val_000115 | Implement the Python class `R12Spline` described below.
Class description:
DXF R12 supports 2D B-splines, but Autodesk do not document the usage in the DXF Reference. The base entity for splines in DXF R12 is the POLYLINE entity. The spline itself is always in a plane, but as any 2D entity, the spline can be transform... | Implement the Python class `R12Spline` described below.
Class description:
DXF R12 supports 2D B-splines, but Autodesk do not document the usage in the DXF Reference. The base entity for splines in DXF R12 is the POLYLINE entity. The spline itself is always in a plane, but as any 2D entity, the spline can be transform... | ba6ab0264dcb6833173042a37b1b5ae878d75113 | <|skeleton|>
class R12Spline:
"""DXF R12 supports 2D B-splines, but Autodesk do not document the usage in the DXF Reference. The base entity for splines in DXF R12 is the POLYLINE entity. The spline itself is always in a plane, but as any 2D entity, the spline can be transformed into the 3D object by elevation and ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class R12Spline:
"""DXF R12 supports 2D B-splines, but Autodesk do not document the usage in the DXF Reference. The base entity for splines in DXF R12 is the POLYLINE entity. The spline itself is always in a plane, but as any 2D entity, the spline can be transformed into the 3D object by elevation and extrusion (:r... | the_stack_v2_python_sparse | src/ezdxf/render/r12spline.py | mozman/ezdxf | train | 750 |
e7f94c9341cf37b7c81fc3f0c768eb2154c4ef14 | [
"super(Decoder, self).__init__()\nself.input_dim = input_dim\nself.rep_dim = rep_dim\nself.hidden_dim = hidden_dim\nself.output_dim = output_dim\nself.decoder_y = nn.Sequential(nn.Linear(self.input_dim + self.rep_dim, self.hidden_dim), nn.ReLU(), nn.Linear(self.hidden_dim, self.hidden_dim), nn.ReLU())\nself.hidden_... | <|body_start_0|>
super(Decoder, self).__init__()
self.input_dim = input_dim
self.rep_dim = rep_dim
self.hidden_dim = hidden_dim
self.output_dim = output_dim
self.decoder_y = nn.Sequential(nn.Linear(self.input_dim + self.rep_dim, self.hidden_dim), nn.ReLU(), nn.Linear(self... | (A)NP decoder | Decoder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Decoder:
"""(A)NP decoder"""
def __init__(self, input_dim, rep_dim, hidden_dim, output_dim):
"""Args: input_dim : x_dim + latent_dim layer_sizes : the array of each layer size in encoding NP"""
<|body_0|>
def forward(self, target_x, stochastic_rep, deterministic_rep=None... | stack_v2_sparse_classes_36k_train_016005 | 12,534 | no_license | [
{
"docstring": "Args: input_dim : x_dim + latent_dim layer_sizes : the array of each layer size in encoding NP",
"name": "__init__",
"signature": "def __init__(self, input_dim, rep_dim, hidden_dim, output_dim)"
},
{
"docstring": "Decoders the individual targets Args: representation : [batch_size... | 2 | stack_v2_sparse_classes_30k_train_012891 | Implement the Python class `Decoder` described below.
Class description:
(A)NP decoder
Method signatures and docstrings:
- def __init__(self, input_dim, rep_dim, hidden_dim, output_dim): Args: input_dim : x_dim + latent_dim layer_sizes : the array of each layer size in encoding NP
- def forward(self, target_x, stocha... | Implement the Python class `Decoder` described below.
Class description:
(A)NP decoder
Method signatures and docstrings:
- def __init__(self, input_dim, rep_dim, hidden_dim, output_dim): Args: input_dim : x_dim + latent_dim layer_sizes : the array of each layer size in encoding NP
- def forward(self, target_x, stocha... | c7e1bfb49ebaec6937ed7b186689227f95a43e0f | <|skeleton|>
class Decoder:
"""(A)NP decoder"""
def __init__(self, input_dim, rep_dim, hidden_dim, output_dim):
"""Args: input_dim : x_dim + latent_dim layer_sizes : the array of each layer size in encoding NP"""
<|body_0|>
def forward(self, target_x, stochastic_rep, deterministic_rep=None... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Decoder:
"""(A)NP decoder"""
def __init__(self, input_dim, rep_dim, hidden_dim, output_dim):
"""Args: input_dim : x_dim + latent_dim layer_sizes : the array of each layer size in encoding NP"""
super(Decoder, self).__init__()
self.input_dim = input_dim
self.rep_dim = rep_d... | the_stack_v2_python_sparse | model/CNP/cnp.py | MingyuKim87/MLwM | train | 0 |
b11f8b9e8317c2e6d78ad1b74c43c4f200a703c9 | [
"if not parent:\n raise ValueError('Missing parent value.')\nsuper(APMPathSpec, self).__init__(parent=parent, **kwargs)\nself.entry_index = entry_index\nself.location = location",
"string_parts = []\nif self.entry_index is not None:\n string_parts.append(f'entry index: {self.entry_index:d}')\nif self.locati... | <|body_start_0|>
if not parent:
raise ValueError('Missing parent value.')
super(APMPathSpec, self).__init__(parent=parent, **kwargs)
self.entry_index = entry_index
self.location = location
<|end_body_0|>
<|body_start_1|>
string_parts = []
if self.entry_index ... | APM path specification. Attributes: entry_index (int): partition entry index. location (str): location. | APMPathSpec | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class APMPathSpec:
"""APM path specification. Attributes: entry_index (int): partition entry index. location (str): location."""
def __init__(self, location=None, entry_index=None, parent=None, **kwargs):
"""Initializes a path specification. Note that the APM path specification must have a... | stack_v2_sparse_classes_36k_train_016006 | 1,473 | permissive | [
{
"docstring": "Initializes a path specification. Note that the APM path specification must have a parent. Args: entry_index (Optional[int]): partition entry index. location (Optional[str]): location. parent (Optional[PathSpec]): parent path specification. Raises: ValueError: when parent is not set.",
"name... | 2 | stack_v2_sparse_classes_30k_train_014631 | Implement the Python class `APMPathSpec` described below.
Class description:
APM path specification. Attributes: entry_index (int): partition entry index. location (str): location.
Method signatures and docstrings:
- def __init__(self, location=None, entry_index=None, parent=None, **kwargs): Initializes a path specif... | Implement the Python class `APMPathSpec` described below.
Class description:
APM path specification. Attributes: entry_index (int): partition entry index. location (str): location.
Method signatures and docstrings:
- def __init__(self, location=None, entry_index=None, parent=None, **kwargs): Initializes a path specif... | 28756d910e951a22c5f0b2bcf5184f055a19d544 | <|skeleton|>
class APMPathSpec:
"""APM path specification. Attributes: entry_index (int): partition entry index. location (str): location."""
def __init__(self, location=None, entry_index=None, parent=None, **kwargs):
"""Initializes a path specification. Note that the APM path specification must have a... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class APMPathSpec:
"""APM path specification. Attributes: entry_index (int): partition entry index. location (str): location."""
def __init__(self, location=None, entry_index=None, parent=None, **kwargs):
"""Initializes a path specification. Note that the APM path specification must have a parent. Args... | the_stack_v2_python_sparse | dfvfs/path/apm_path_spec.py | log2timeline/dfvfs | train | 197 |
49c4b99e0d56c2b7f4d684c30445eac55629078b | [
"for item in list_target:\n if fun_condition(item):\n yield item",
"count = 0\nfor item in list_target:\n if fun_condition(item):\n count += 1\nreturn count",
"for item in list_target:\n if fun_condition(item):\n return True\nreturn False"
] | <|body_start_0|>
for item in list_target:
if fun_condition(item):
yield item
<|end_body_0|>
<|body_start_1|>
count = 0
for item in list_target:
if fun_condition(item):
count += 1
return count
<|end_body_1|>
<|body_start_2|>
... | list helper | List_helper | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class List_helper:
"""list helper"""
def find_enemy_info(list_target, fun_condition):
""":param list_target: :param fun_condition: :return:"""
<|body_0|>
def find_enemy_count(list_target, fun_condition):
""":param fun_condition: :return:"""
<|body_1|>
def ... | stack_v2_sparse_classes_36k_train_016007 | 854 | no_license | [
{
"docstring": ":param list_target: :param fun_condition: :return:",
"name": "find_enemy_info",
"signature": "def find_enemy_info(list_target, fun_condition)"
},
{
"docstring": ":param fun_condition: :return:",
"name": "find_enemy_count",
"signature": "def find_enemy_count(list_target, f... | 3 | stack_v2_sparse_classes_30k_train_006933 | Implement the Python class `List_helper` described below.
Class description:
list helper
Method signatures and docstrings:
- def find_enemy_info(list_target, fun_condition): :param list_target: :param fun_condition: :return:
- def find_enemy_count(list_target, fun_condition): :param fun_condition: :return:
- def is_e... | Implement the Python class `List_helper` described below.
Class description:
list helper
Method signatures and docstrings:
- def find_enemy_info(list_target, fun_condition): :param list_target: :param fun_condition: :return:
- def find_enemy_count(list_target, fun_condition): :param fun_condition: :return:
- def is_e... | ac197a70f4744505e392bd1fda342d680c6aa6fe | <|skeleton|>
class List_helper:
"""list helper"""
def find_enemy_info(list_target, fun_condition):
""":param list_target: :param fun_condition: :return:"""
<|body_0|>
def find_enemy_count(list_target, fun_condition):
""":param fun_condition: :return:"""
<|body_1|>
def ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class List_helper:
"""list helper"""
def find_enemy_info(list_target, fun_condition):
""":param list_target: :param fun_condition: :return:"""
for item in list_target:
if fun_condition(item):
yield item
def find_enemy_count(list_target, fun_condition):
"... | the_stack_v2_python_sparse | moth1/day17/common_task/list_helper.py | BruceLHH/tedu_month2 | train | 0 |
7b717635da902f410c2a2096a1ded4d9e5ec79f9 | [
"super(PublishingClient, self).__init__(serialize_format, deserialize_format)\nself.url = url\nself.api_version = api_version",
"remote = '{base}/{version}/tenant/{tenant_id}/publish'.format(base=self.url, version=self.api_version, tenant_id=tenant_id)\nbody = PublishMessage(host=host, pname=pname, time=time, nat... | <|body_start_0|>
super(PublishingClient, self).__init__(serialize_format, deserialize_format)
self.url = url
self.api_version = api_version
<|end_body_0|>
<|body_start_1|>
remote = '{base}/{version}/tenant/{tenant_id}/publish'.format(base=self.url, version=self.api_version, tenant_id=te... | PublishingClient | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PublishingClient:
def __init__(self, url, api_version, serialize_format=None, deserialize_format=None):
"""Client to interact with the Correlator API to "publish" event messages"""
<|body_0|>
def publish(self, tenant_id, message_token, host, pname, time, native):
"""... | stack_v2_sparse_classes_36k_train_016008 | 2,111 | permissive | [
{
"docstring": "Client to interact with the Correlator API to \"publish\" event messages",
"name": "__init__",
"signature": "def __init__(self, url, api_version, serialize_format=None, deserialize_format=None)"
},
{
"docstring": "POST {base_url}/{api_version}/{tenant_id}/publish Publishes a mess... | 2 | stack_v2_sparse_classes_30k_train_006038 | Implement the Python class `PublishingClient` described below.
Class description:
Implement the PublishingClient class.
Method signatures and docstrings:
- def __init__(self, url, api_version, serialize_format=None, deserialize_format=None): Client to interact with the Correlator API to "publish" event messages
- def... | Implement the Python class `PublishingClient` described below.
Class description:
Implement the PublishingClient class.
Method signatures and docstrings:
- def __init__(self, url, api_version, serialize_format=None, deserialize_format=None): Client to interact with the Correlator API to "publish" event messages
- def... | 7d49cf6bfd7e1a6e5b739e7de52f2e18e5ccf924 | <|skeleton|>
class PublishingClient:
def __init__(self, url, api_version, serialize_format=None, deserialize_format=None):
"""Client to interact with the Correlator API to "publish" event messages"""
<|body_0|>
def publish(self, tenant_id, message_token, host, pname, time, native):
"""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PublishingClient:
def __init__(self, url, api_version, serialize_format=None, deserialize_format=None):
"""Client to interact with the Correlator API to "publish" event messages"""
super(PublishingClient, self).__init__(serialize_format, deserialize_format)
self.url = url
self.... | the_stack_v2_python_sparse | cloudcafe/meniscus/correlator_api/client.py | kurhula/cloudcafe | train | 0 | |
43f4401333a2c6925e613b0fb2670df654547cc2 | [
"self.offer_listing_id = offer_listing_id\nself.price = price\nself.sale_price = sale_price\nself.amount_saved = amount_saved\nself.percentage_saved = percentage_saved\nself.availability = availability\nself.availability_attributes = availability_attributes\nself.is_eligible_for_super_saver_shipping = is_eligible_f... | <|body_start_0|>
self.offer_listing_id = offer_listing_id
self.price = price
self.sale_price = sale_price
self.amount_saved = amount_saved
self.percentage_saved = percentage_saved
self.availability = availability
self.availability_attributes = availability_attribu... | Implementation of the 'OfferListing' model. TODO: type model description here. Attributes: offer_listing_id (string): TODO: type description here. price (Price): TODO: type description here. sale_price (Price): TODO: type description here. amount_saved (Price): TODO: type description here. percentage_saved (int): TODO:... | OfferListing | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OfferListing:
"""Implementation of the 'OfferListing' model. TODO: type model description here. Attributes: offer_listing_id (string): TODO: type description here. price (Price): TODO: type description here. sale_price (Price): TODO: type description here. amount_saved (Price): TODO: type descrip... | stack_v2_sparse_classes_36k_train_016009 | 4,415 | permissive | [
{
"docstring": "Constructor for the OfferListing class",
"name": "__init__",
"signature": "def __init__(self, offer_listing_id=None, price=None, sale_price=None, amount_saved=None, percentage_saved=None, availability=None, availability_attributes=None, is_eligible_for_super_saver_shipping=None, is_eligi... | 2 | stack_v2_sparse_classes_30k_test_000721 | Implement the Python class `OfferListing` described below.
Class description:
Implementation of the 'OfferListing' model. TODO: type model description here. Attributes: offer_listing_id (string): TODO: type description here. price (Price): TODO: type description here. sale_price (Price): TODO: type description here. a... | Implement the Python class `OfferListing` described below.
Class description:
Implementation of the 'OfferListing' model. TODO: type model description here. Attributes: offer_listing_id (string): TODO: type description here. price (Price): TODO: type description here. sale_price (Price): TODO: type description here. a... | 26ea1019115a1de3b1b37a4b830525e164ac55ce | <|skeleton|>
class OfferListing:
"""Implementation of the 'OfferListing' model. TODO: type model description here. Attributes: offer_listing_id (string): TODO: type description here. price (Price): TODO: type description here. sale_price (Price): TODO: type description here. amount_saved (Price): TODO: type descrip... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OfferListing:
"""Implementation of the 'OfferListing' model. TODO: type model description here. Attributes: offer_listing_id (string): TODO: type description here. price (Price): TODO: type description here. sale_price (Price): TODO: type description here. amount_saved (Price): TODO: type description here. pe... | the_stack_v2_python_sparse | awsecommerceservice/models/offer_listing.py | nidaizamir/Test-PY | train | 0 |
7b3c781f4f856c73ed66f12062d410f8e51b69dc | [
"size = len(nums)\ndp = [1] * size\nfor x in range(size):\n for y in range(x):\n if nums[x] > nums[y]:\n dp[x] = max(dp[x], dp[y] + 1)\nreturn max(dp) if dp else 0",
"size = len(nums)\nl = 0\ndp = []\nfor x in range(size):\n low, high = (0, len(dp) - 1)\n while low <= high:\n mid... | <|body_start_0|>
size = len(nums)
dp = [1] * size
for x in range(size):
for y in range(x):
if nums[x] > nums[y]:
dp[x] = max(dp[x], dp[y] + 1)
return max(dp) if dp else 0
<|end_body_0|>
<|body_start_1|>
size = len(nums)
l =... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lengthOfLIS1(self, nums):
""":type nums: List[int] :rtype: int 时间复杂度O(N^2) dp状态方程: dp[0] = 1 dp[i] = max(dp[i], dp[j]+biger(nums[i], nums[j])) 其中0 <= j < i, biger函数返回1/0"""
<|body_0|>
def lengthOfLIS(self, nums):
""":type nums: List[int] :rtype: int 时间复... | stack_v2_sparse_classes_36k_train_016010 | 1,814 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int 时间复杂度O(N^2) dp状态方程: dp[0] = 1 dp[i] = max(dp[i], dp[j]+biger(nums[i], nums[j])) 其中0 <= j < i, biger函数返回1/0",
"name": "lengthOfLIS1",
"signature": "def lengthOfLIS1(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int 时间复杂度O(NlogN) dp... | 2 | stack_v2_sparse_classes_30k_train_010483 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLIS1(self, nums): :type nums: List[int] :rtype: int 时间复杂度O(N^2) dp状态方程: dp[0] = 1 dp[i] = max(dp[i], dp[j]+biger(nums[i], nums[j])) 其中0 <= j < i, biger函数返回1/0
- def l... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLIS1(self, nums): :type nums: List[int] :rtype: int 时间复杂度O(N^2) dp状态方程: dp[0] = 1 dp[i] = max(dp[i], dp[j]+biger(nums[i], nums[j])) 其中0 <= j < i, biger函数返回1/0
- def l... | 9687f8e743a8b6396fff192f22b5256d1025f86b | <|skeleton|>
class Solution:
def lengthOfLIS1(self, nums):
""":type nums: List[int] :rtype: int 时间复杂度O(N^2) dp状态方程: dp[0] = 1 dp[i] = max(dp[i], dp[j]+biger(nums[i], nums[j])) 其中0 <= j < i, biger函数返回1/0"""
<|body_0|>
def lengthOfLIS(self, nums):
""":type nums: List[int] :rtype: int 时间复... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def lengthOfLIS1(self, nums):
""":type nums: List[int] :rtype: int 时间复杂度O(N^2) dp状态方程: dp[0] = 1 dp[i] = max(dp[i], dp[j]+biger(nums[i], nums[j])) 其中0 <= j < i, biger函数返回1/0"""
size = len(nums)
dp = [1] * size
for x in range(size):
for y in range(x):
... | the_stack_v2_python_sparse | 2017/dp/Longest_Increasing_Subsequence.py | buhuipao/LeetCode | train | 5 | |
b3806c15b57e8e0f85ead970acfe80ae7bb5f244 | [
"from storybase.context_processors import conf\ncontext = conf(request)\nreturn context",
"from storybase_user.auth.utils import send_password_reset_email\nfor user in self.users_cache:\n send_password_reset_email(user, domain_override=domain_override, subject_template_name=subject_template_name, email_templat... | <|body_start_0|>
from storybase.context_processors import conf
context = conf(request)
return context
<|end_body_0|>
<|body_start_1|>
from storybase_user.auth.utils import send_password_reset_email
for user in self.users_cache:
send_password_reset_email(user, domain_... | CustomContextPasswordResetForm | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CustomContextPasswordResetForm:
def get_custom_context(self, request):
"""Return a dictionary of context variables These are added to the template context for the email template"""
<|body_0|>
def save(self, domain_override=None, subject_template_name='registration/password_r... | stack_v2_sparse_classes_36k_train_016011 | 6,249 | permissive | [
{
"docstring": "Return a dictionary of context variables These are added to the template context for the email template",
"name": "get_custom_context",
"signature": "def get_custom_context(self, request)"
},
{
"docstring": "Generates a one-use only link for resetting password and sends to the us... | 2 | stack_v2_sparse_classes_30k_train_012589 | Implement the Python class `CustomContextPasswordResetForm` described below.
Class description:
Implement the CustomContextPasswordResetForm class.
Method signatures and docstrings:
- def get_custom_context(self, request): Return a dictionary of context variables These are added to the template context for the email ... | Implement the Python class `CustomContextPasswordResetForm` described below.
Class description:
Implement the CustomContextPasswordResetForm class.
Method signatures and docstrings:
- def get_custom_context(self, request): Return a dictionary of context variables These are added to the template context for the email ... | 15e429df850b68ee107a9b8206adc44fe1174370 | <|skeleton|>
class CustomContextPasswordResetForm:
def get_custom_context(self, request):
"""Return a dictionary of context variables These are added to the template context for the email template"""
<|body_0|>
def save(self, domain_override=None, subject_template_name='registration/password_r... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CustomContextPasswordResetForm:
def get_custom_context(self, request):
"""Return a dictionary of context variables These are added to the template context for the email template"""
from storybase.context_processors import conf
context = conf(request)
return context
def sav... | the_stack_v2_python_sparse | apps/storybase_user/auth/forms.py | denverfoundation/storybase | train | 3 | |
24f8c836e8f846f3f573bb1e1214f44983821ff3 | [
"self.WFSObj = WFS()\nself.ml_dimen = self.WFSObj.ml_dimen\nself.total_of_lenses = self.WFSObj.total_of_lenses\nself.n_ml = self.WFSObj.n_ml\nself.Wf1[n_ml][n_ml] = self.WFSObj.Wf1[n_ml][n_ml]\nself.dWx[n_ml][n_ml] = self.WFSObj.dWx[n_ml][n_ml]\nself.dWy[n_ml][n_ml] = self.WFSObj.dWy[n_ml][n_ml]\nself.Xr[n_ml][n_ml... | <|body_start_0|>
self.WFSObj = WFS()
self.ml_dimen = self.WFSObj.ml_dimen
self.total_of_lenses = self.WFSObj.total_of_lenses
self.n_ml = self.WFSObj.n_ml
self.Wf1[n_ml][n_ml] = self.WFSObj.Wf1[n_ml][n_ml]
self.dWx[n_ml][n_ml] = self.WFSObj.dWx[n_ml][n_ml]
self.dWy... | TestWFSTypes | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestWFSTypes:
def setUp(self):
"""Setup function TestTypes for class WFS"""
<|body_0|>
def test_types(self):
"""Function to test data types for class WFS"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.WFSObj = WFS()
self.ml_dimen = sel... | stack_v2_sparse_classes_36k_train_016012 | 4,326 | permissive | [
{
"docstring": "Setup function TestTypes for class WFS",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Function to test data types for class WFS",
"name": "test_types",
"signature": "def test_types(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_014978 | Implement the Python class `TestWFSTypes` described below.
Class description:
Implement the TestWFSTypes class.
Method signatures and docstrings:
- def setUp(self): Setup function TestTypes for class WFS
- def test_types(self): Function to test data types for class WFS | Implement the Python class `TestWFSTypes` described below.
Class description:
Implement the TestWFSTypes class.
Method signatures and docstrings:
- def setUp(self): Setup function TestTypes for class WFS
- def test_types(self): Function to test data types for class WFS
<|skeleton|>
class TestWFSTypes:
def setUp... | 825a0eab64be709efe161b9a48eb54c4bc5c1bef | <|skeleton|>
class TestWFSTypes:
def setUp(self):
"""Setup function TestTypes for class WFS"""
<|body_0|>
def test_types(self):
"""Function to test data types for class WFS"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestWFSTypes:
def setUp(self):
"""Setup function TestTypes for class WFS"""
self.WFSObj = WFS()
self.ml_dimen = self.WFSObj.ml_dimen
self.total_of_lenses = self.WFSObj.total_of_lenses
self.n_ml = self.WFSObj.n_ml
self.Wf1[n_ml][n_ml] = self.WFSObj.Wf1[n_ml][n_ml... | the_stack_v2_python_sparse | VLC_devel/class structure_old/__auto_gen__/test_WFS.py | wenh81/vlc_simulator | train | 0 | |
2fa417d4d0364590e2fedc09ccc1400d746d34ad | [
"super().__init__()\nself.enc_hidden_size = enc_hidden_size\nself.dec_hidden_size = dec_hidden_size\nself.coverage = coverage\nself.bias = bias\nself.weight_norm = weight_norm\nself.end_bias = pointer_end_bias\nself.Wh = nn.Linear(enc_hidden_size, attention_size, bias=False)\nself.Ws = nn.Linear(dec_hidden_size, at... | <|body_start_0|>
super().__init__()
self.enc_hidden_size = enc_hidden_size
self.dec_hidden_size = dec_hidden_size
self.coverage = coverage
self.bias = bias
self.weight_norm = weight_norm
self.end_bias = pointer_end_bias
self.Wh = nn.Linear(enc_hidden_size,... | BahdanauAttention | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BahdanauAttention:
def __init__(self, enc_hidden_size=512, dec_hidden_size=256, attention_size=700, coverage=False, weight_norm=False, bias=True, pointer_end_bias=False):
"""Bahdanau Attention (+ Coverage)"""
<|body_0|>
def forward(self, encoder_outputs, decoder_state, mask,... | stack_v2_sparse_classes_36k_train_016013 | 49,575 | no_license | [
{
"docstring": "Bahdanau Attention (+ Coverage)",
"name": "__init__",
"signature": "def __init__(self, enc_hidden_size=512, dec_hidden_size=256, attention_size=700, coverage=False, weight_norm=False, bias=True, pointer_end_bias=False)"
},
{
"docstring": "Args: encoder_outputs [B, source_len, hid... | 2 | null | Implement the Python class `BahdanauAttention` described below.
Class description:
Implement the BahdanauAttention class.
Method signatures and docstrings:
- def __init__(self, enc_hidden_size=512, dec_hidden_size=256, attention_size=700, coverage=False, weight_norm=False, bias=True, pointer_end_bias=False): Bahdanau... | Implement the Python class `BahdanauAttention` described below.
Class description:
Implement the BahdanauAttention class.
Method signatures and docstrings:
- def __init__(self, enc_hidden_size=512, dec_hidden_size=256, attention_size=700, coverage=False, weight_norm=False, bias=True, pointer_end_bias=False): Bahdanau... | 7e55a422588c1d1e00f35a3d3a3ff896cce59e18 | <|skeleton|>
class BahdanauAttention:
def __init__(self, enc_hidden_size=512, dec_hidden_size=256, attention_size=700, coverage=False, weight_norm=False, bias=True, pointer_end_bias=False):
"""Bahdanau Attention (+ Coverage)"""
<|body_0|>
def forward(self, encoder_outputs, decoder_state, mask,... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BahdanauAttention:
def __init__(self, enc_hidden_size=512, dec_hidden_size=256, attention_size=700, coverage=False, weight_norm=False, bias=True, pointer_end_bias=False):
"""Bahdanau Attention (+ Coverage)"""
super().__init__()
self.enc_hidden_size = enc_hidden_size
self.dec_hi... | the_stack_v2_python_sparse | generated/test_clovaai_FocusSeq2Seq.py | jansel/pytorch-jit-paritybench | train | 35 | |
8c3634b2d62a11d17021bd9d3d41d82d411fdea2 | [
"if n == 0:\n return False\nwhile n % 2 == 0:\n n /= 2\nif n == 1:\n return True\nelse:\n return False",
"if n <= 0:\n return False\nfor i in range(32):\n if n > 1:\n if n & 1 == 1:\n return False\n else:\n return True\n n = n >> 1"
] | <|body_start_0|>
if n == 0:
return False
while n % 2 == 0:
n /= 2
if n == 1:
return True
else:
return False
<|end_body_0|>
<|body_start_1|>
if n <= 0:
return False
for i in range(32):
if n > 1:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isPowerOfTwo2(self, n):
""":type n: int :rtype: bool"""
<|body_0|>
def isPowerOfTwo(self, n):
""":type n: int :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if n == 0:
return False
while n % 2 == 0:
... | stack_v2_sparse_classes_36k_train_016014 | 1,162 | no_license | [
{
"docstring": ":type n: int :rtype: bool",
"name": "isPowerOfTwo2",
"signature": "def isPowerOfTwo2(self, n)"
},
{
"docstring": ":type n: int :rtype: bool",
"name": "isPowerOfTwo",
"signature": "def isPowerOfTwo(self, n)"
}
] | 2 | stack_v2_sparse_classes_30k_train_008132 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isPowerOfTwo2(self, n): :type n: int :rtype: bool
- def isPowerOfTwo(self, n): :type n: int :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isPowerOfTwo2(self, n): :type n: int :rtype: bool
- def isPowerOfTwo(self, n): :type n: int :rtype: bool
<|skeleton|>
class Solution:
def isPowerOfTwo2(self, n):
... | 4d7e675c795c841f99ca95b8b60c4995bcb632fb | <|skeleton|>
class Solution:
def isPowerOfTwo2(self, n):
""":type n: int :rtype: bool"""
<|body_0|>
def isPowerOfTwo(self, n):
""":type n: int :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def isPowerOfTwo2(self, n):
""":type n: int :rtype: bool"""
if n == 0:
return False
while n % 2 == 0:
n /= 2
if n == 1:
return True
else:
return False
def isPowerOfTwo(self, n):
""":type n: int :rtyp... | the_stack_v2_python_sparse | 231_Power of Two.py | stephenchenxj/myLeetCode | train | 0 | |
3f8e53009ab8311f53c1ccba9ed00800535a2dd7 | [
"if not nums:\n return 0\nlis = [1] * len(nums)\nfor i, n in enumerate(nums):\n for j, m in enumerate(nums[:i]):\n if m < n:\n lis[i] = max(lis[i], lis[j] + 1)\nprint(lis)\nreturn max(lis)",
"if not nums:\n return 0\n\ndef bisearch(arr, n):\n left, right = (0, len(arr) - 1)\n whil... | <|body_start_0|>
if not nums:
return 0
lis = [1] * len(nums)
for i, n in enumerate(nums):
for j, m in enumerate(nums[:i]):
if m < n:
lis[i] = max(lis[i], lis[j] + 1)
print(lis)
return max(lis)
<|end_body_0|>
<|body_star... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lengthOfLIS(self, nums: List[int]) -> int:
"""11/05/2019 01:36"""
<|body_0|>
def lengthOfLIS(self, nums: List[int]) -> int:
"""11/05/2019 02:28"""
<|body_1|>
def lengthOfLIS(self, nums: List[int]) -> int:
"""DP Time complexity: O(n^... | stack_v2_sparse_classes_36k_train_016015 | 3,572 | no_license | [
{
"docstring": "11/05/2019 01:36",
"name": "lengthOfLIS",
"signature": "def lengthOfLIS(self, nums: List[int]) -> int"
},
{
"docstring": "11/05/2019 02:28",
"name": "lengthOfLIS",
"signature": "def lengthOfLIS(self, nums: List[int]) -> int"
},
{
"docstring": "DP Time complexity: ... | 5 | stack_v2_sparse_classes_30k_train_018845 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLIS(self, nums: List[int]) -> int: 11/05/2019 01:36
- def lengthOfLIS(self, nums: List[int]) -> int: 11/05/2019 02:28
- def lengthOfLIS(self, nums: List[int]) -> int:... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLIS(self, nums: List[int]) -> int: 11/05/2019 01:36
- def lengthOfLIS(self, nums: List[int]) -> int: 11/05/2019 02:28
- def lengthOfLIS(self, nums: List[int]) -> int:... | 1389a009a02e90e8700a7a00e0b7f797c129cdf4 | <|skeleton|>
class Solution:
def lengthOfLIS(self, nums: List[int]) -> int:
"""11/05/2019 01:36"""
<|body_0|>
def lengthOfLIS(self, nums: List[int]) -> int:
"""11/05/2019 02:28"""
<|body_1|>
def lengthOfLIS(self, nums: List[int]) -> int:
"""DP Time complexity: O(n^... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def lengthOfLIS(self, nums: List[int]) -> int:
"""11/05/2019 01:36"""
if not nums:
return 0
lis = [1] * len(nums)
for i, n in enumerate(nums):
for j, m in enumerate(nums[:i]):
if m < n:
lis[i] = max(lis[i], l... | the_stack_v2_python_sparse | leetcode/solved/300_Longest_Increasing_Subsequence/solution.py | sungminoh/algorithms | train | 0 | |
3e74461d17a4ee61e1e574f1a6e50d9bc040c547 | [
"self.token = token\nself.sentence = sentence\nself.event_domain = event_domain\nself.event_type = event_type\nself._allocate_arrays(params.get_int('max_sent_length'), params.get_int('cnn.neighbor_dist'), params.get_int('embedding.none_token_index'), params.get_string('cnn.int_type'), params.get_boolean('cnn.use_bi... | <|body_start_0|>
self.token = token
self.sentence = sentence
self.event_domain = event_domain
self.event_type = event_type
self._allocate_arrays(params.get_int('max_sent_length'), params.get_int('cnn.neighbor_dist'), params.get_int('embedding.none_token_index'), params.get_string... | EventTriggerExample | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EventTriggerExample:
def __init__(self, token, sentence, event_domain, params, event_type=None):
"""We are given a token, sentence as context, and event_type (present during training) :type token: text.text_span.Token :type sentence: text.text_span.Sentence :type event_domain: event.even... | stack_v2_sparse_classes_36k_train_016016 | 17,179 | permissive | [
{
"docstring": "We are given a token, sentence as context, and event_type (present during training) :type token: text.text_span.Token :type sentence: text.text_span.Sentence :type event_domain: event.event_domain.EventDomain :type params: common.parameters.Parameters :type event_type: str",
"name": "__init_... | 2 | stack_v2_sparse_classes_30k_train_006644 | Implement the Python class `EventTriggerExample` described below.
Class description:
Implement the EventTriggerExample class.
Method signatures and docstrings:
- def __init__(self, token, sentence, event_domain, params, event_type=None): We are given a token, sentence as context, and event_type (present during traini... | Implement the Python class `EventTriggerExample` described below.
Class description:
Implement the EventTriggerExample class.
Method signatures and docstrings:
- def __init__(self, token, sentence, event_domain, params, event_type=None): We are given a token, sentence as context, and event_type (present during traini... | 3d5d7f8e17f7e77ecf94a6de58ac5859a03789ce | <|skeleton|>
class EventTriggerExample:
def __init__(self, token, sentence, event_domain, params, event_type=None):
"""We are given a token, sentence as context, and event_type (present during training) :type token: text.text_span.Token :type sentence: text.text_span.Sentence :type event_domain: event.even... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EventTriggerExample:
def __init__(self, token, sentence, event_domain, params, event_type=None):
"""We are given a token, sentence as context, and event_type (present during training) :type token: text.text_span.Token :type sentence: text.text_span.Sentence :type event_domain: event.event_domain.Event... | the_stack_v2_python_sparse | src/python/cyberlingo/event/event_trigger.py | BBN-E/Hume | train | 5 | |
1fff5836adaabc5434a045f4b7c8399d072072cc | [
"citations.sort()\ni = 0\nwhile i < len(citations) and citations[len(citations) - 1 - i] > i:\n i += 1\nreturn i",
"n = len(citations)\npapers = [0] * (n + 1)\nfor c in citations:\n papers[min(n, c)] += 1\nk = n\ns = papers[n]\nwhile k > s:\n k -= 1\n s += papers[k]\nreturn k"
] | <|body_start_0|>
citations.sort()
i = 0
while i < len(citations) and citations[len(citations) - 1 - i] > i:
i += 1
return i
<|end_body_0|>
<|body_start_1|>
n = len(citations)
papers = [0] * (n + 1)
for c in citations:
papers[min(n, c)] += ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def hIndex(self, citations):
"""offical solution: https://leetcode.com/problems/h-index/solution/ o(nlogn),o(1) :type citations: List[int] :rtype: int"""
<|body_0|>
def hIndex2(self, citations):
"""o(n) o(n) :param citations: :return:"""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_016017 | 1,600 | no_license | [
{
"docstring": "offical solution: https://leetcode.com/problems/h-index/solution/ o(nlogn),o(1) :type citations: List[int] :rtype: int",
"name": "hIndex",
"signature": "def hIndex(self, citations)"
},
{
"docstring": "o(n) o(n) :param citations: :return:",
"name": "hIndex2",
"signature": ... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hIndex(self, citations): offical solution: https://leetcode.com/problems/h-index/solution/ o(nlogn),o(1) :type citations: List[int] :rtype: int
- def hIndex2(self, citations)... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hIndex(self, citations): offical solution: https://leetcode.com/problems/h-index/solution/ o(nlogn),o(1) :type citations: List[int] :rtype: int
- def hIndex2(self, citations)... | 2526f8c0dec7101123123740e146ee4081e979ee | <|skeleton|>
class Solution:
def hIndex(self, citations):
"""offical solution: https://leetcode.com/problems/h-index/solution/ o(nlogn),o(1) :type citations: List[int] :rtype: int"""
<|body_0|>
def hIndex2(self, citations):
"""o(n) o(n) :param citations: :return:"""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def hIndex(self, citations):
"""offical solution: https://leetcode.com/problems/h-index/solution/ o(nlogn),o(1) :type citations: List[int] :rtype: int"""
citations.sort()
i = 0
while i < len(citations) and citations[len(citations) - 1 - i] > i:
i += 1
... | the_stack_v2_python_sparse | 274. H-Index.py | zhangpengGenedock/leetcode_python | train | 1 | |
ba29354f901649b302fb0598e8691e815e691120 | [
"if self.tool in RelengTool.detected:\n return RelengTool.detected[self.tool]\nfound = True\ntool = self.tool\nif execute([tool] + self.exists_args, quiet=True, critical=False):\n found = True\nelif sys.platform == 'win32' and os.path.basename(tool) == tool:\n debug('{} tool not available in path; attempti... | <|body_start_0|>
if self.tool in RelengTool.detected:
return RelengTool.detected[self.tool]
found = True
tool = self.tool
if execute([tool] + self.exists_args, quiet=True, critical=False):
found = True
elif sys.platform == 'win32' and os.path.basename(tool... | python host tool Provides addition helper methods for Python-based tool interaction. | PythonTool | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PythonTool:
"""python host tool Provides addition helper methods for Python-based tool interaction."""
def exists(self):
"""return whether or not the host tool exists Returns whether or not the tool is available on the host for use. Returns: ``True``, if the tool exists; ``False`` ot... | stack_v2_sparse_classes_36k_train_016018 | 3,764 | permissive | [
{
"docstring": "return whether or not the host tool exists Returns whether or not the tool is available on the host for use. Returns: ``True``, if the tool exists; ``False`` otherwise",
"name": "exists",
"signature": "def exists(self)"
},
{
"docstring": "return a python path value for the python... | 2 | stack_v2_sparse_classes_30k_train_014876 | Implement the Python class `PythonTool` described below.
Class description:
python host tool Provides addition helper methods for Python-based tool interaction.
Method signatures and docstrings:
- def exists(self): return whether or not the host tool exists Returns whether or not the tool is available on the host for... | Implement the Python class `PythonTool` described below.
Class description:
python host tool Provides addition helper methods for Python-based tool interaction.
Method signatures and docstrings:
- def exists(self): return whether or not the host tool exists Returns whether or not the tool is available on the host for... | d05eb2153c72e9bd82c5fdddd5eb41d5316592d6 | <|skeleton|>
class PythonTool:
"""python host tool Provides addition helper methods for Python-based tool interaction."""
def exists(self):
"""return whether or not the host tool exists Returns whether or not the tool is available on the host for use. Returns: ``True``, if the tool exists; ``False`` ot... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PythonTool:
"""python host tool Provides addition helper methods for Python-based tool interaction."""
def exists(self):
"""return whether or not the host tool exists Returns whether or not the tool is available on the host for use. Returns: ``True``, if the tool exists; ``False`` otherwise"""
... | the_stack_v2_python_sparse | releng_tool/tool/python.py | releng-tool/releng-tool | train | 12 |
39b9bf61e2548fb60327b3700385112014c8b782 | [
"ret = {}\nret['movie'] = {'pv': '', 'uv': ''}\nret['travel'] = {'pv': '', 'uv': ''}\nret['food'] = {'pv': '', 'uv': ''}\ntemp_Db = midpagedb.DateLogDb()\ntemp = temp_Db.get_collection()\ntempDb = temp_Db.get_db()\nSHOW_REG = re.compile('^/movie/\\\\w+\\\\.html')\nret['movie']['pv'] = temp.find({'query.f': 'dumi', ... | <|body_start_0|>
ret = {}
ret['movie'] = {'pv': '', 'uv': ''}
ret['travel'] = {'pv': '', 'uv': ''}
ret['food'] = {'pv': '', 'uv': ''}
temp_Db = midpagedb.DateLogDb()
temp = temp_Db.get_collection()
tempDb = temp_Db.get_db()
SHOW_REG = re.compile('^/movie/\... | Product | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Product:
def statist(self):
"""self.log_collection可以拿到mongo中的日志集合,用于统计指标的函数"""
<|body_0|>
def save_result(self, result):
"""result为statist返回的结果,用于存储结果,可以存储到本地也可以存储如数据库"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
ret = {}
ret['movie'] = {... | stack_v2_sparse_classes_36k_train_016019 | 2,045 | no_license | [
{
"docstring": "self.log_collection可以拿到mongo中的日志集合,用于统计指标的函数",
"name": "statist",
"signature": "def statist(self)"
},
{
"docstring": "result为statist返回的结果,用于存储结果,可以存储到本地也可以存储如数据库",
"name": "save_result",
"signature": "def save_result(self, result)"
}
] | 2 | null | Implement the Python class `Product` described below.
Class description:
Implement the Product class.
Method signatures and docstrings:
- def statist(self): self.log_collection可以拿到mongo中的日志集合,用于统计指标的函数
- def save_result(self, result): result为statist返回的结果,用于存储结果,可以存储到本地也可以存储如数据库 | Implement the Python class `Product` described below.
Class description:
Implement the Product class.
Method signatures and docstrings:
- def statist(self): self.log_collection可以拿到mongo中的日志集合,用于统计指标的函数
- def save_result(self, result): result为statist返回的结果,用于存储结果,可以存储到本地也可以存储如数据库
<|skeleton|>
class Product:
def s... | f2303a443122e87296fb5b72a8af02d642297bc4 | <|skeleton|>
class Product:
def statist(self):
"""self.log_collection可以拿到mongo中的日志集合,用于统计指标的函数"""
<|body_0|>
def save_result(self, result):
"""result为statist返回的结果,用于存储结果,可以存储到本地也可以存储如数据库"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Product:
def statist(self):
"""self.log_collection可以拿到mongo中的日志集合,用于统计指标的函数"""
ret = {}
ret['movie'] = {'pv': '', 'uv': ''}
ret['travel'] = {'pv': '', 'uv': ''}
ret['food'] = {'pv': '', 'uv': ''}
temp_Db = midpagedb.DateLogDb()
temp = temp_Db.get_collect... | the_stack_v2_python_sparse | midpage/products/temp.py | cash2one/statistic | train | 0 | |
d7003ec82ebe2f03bca2a2d8cf37c1302a6e1612 | [
"row_ct = defaultdict(list)\ncol_ct = Counter()\nfor i, row in enumerate(picture):\n for j, pixel in enumerate(row):\n if pixel == 'W':\n continue\n col_ct[j] += 1\n if len(row_ct[i]) <= 2:\n row_ct[i].append(j)\nres = 0\nfor i, js in row_ct.items():\n if len(js) != ... | <|body_start_0|>
row_ct = defaultdict(list)
col_ct = Counter()
for i, row in enumerate(picture):
for j, pixel in enumerate(row):
if pixel == 'W':
continue
col_ct[j] += 1
if len(row_ct[i]) <= 2:
ro... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findLonelyPixel(self, picture: List[List[str]]) -> int:
"""Prototype solution using dictionaries: O(N*M) time O(N+M) space"""
<|body_0|>
def findLonelyPixel(self, picture: List[List[str]]) -> int:
"""Using array instead of dictionaries (slightly faster)... | stack_v2_sparse_classes_36k_train_016020 | 1,650 | no_license | [
{
"docstring": "Prototype solution using dictionaries: O(N*M) time O(N+M) space",
"name": "findLonelyPixel",
"signature": "def findLonelyPixel(self, picture: List[List[str]]) -> int"
},
{
"docstring": "Using array instead of dictionaries (slightly faster): O(N*M) time O(N+M) space",
"name": ... | 2 | stack_v2_sparse_classes_30k_train_020916 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findLonelyPixel(self, picture: List[List[str]]) -> int: Prototype solution using dictionaries: O(N*M) time O(N+M) space
- def findLonelyPixel(self, picture: List[List[str]]) ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findLonelyPixel(self, picture: List[List[str]]) -> int: Prototype solution using dictionaries: O(N*M) time O(N+M) space
- def findLonelyPixel(self, picture: List[List[str]]) ... | f4cd43f082b58d4410008af49325770bc84d3aba | <|skeleton|>
class Solution:
def findLonelyPixel(self, picture: List[List[str]]) -> int:
"""Prototype solution using dictionaries: O(N*M) time O(N+M) space"""
<|body_0|>
def findLonelyPixel(self, picture: List[List[str]]) -> int:
"""Using array instead of dictionaries (slightly faster)... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findLonelyPixel(self, picture: List[List[str]]) -> int:
"""Prototype solution using dictionaries: O(N*M) time O(N+M) space"""
row_ct = defaultdict(list)
col_ct = Counter()
for i, row in enumerate(picture):
for j, pixel in enumerate(row):
... | the_stack_v2_python_sparse | 531.Lonely_Pixel.py | welsny/solutions | train | 1 | |
e758262aa1ed3359a0b88d6596810ac5732c15c3 | [
"n = len(coins)\ndp = [[0] * (amount + 1) for _ in range(n + 1)]\nfor i in range(n + 1):\n dp[i][0] = 1\nfor i in range(1, n + 1):\n for j in range(1, amount + 1):\n if j >= coins[i - 1]:\n dp[i][j] = dp[i - 1][j] + dp[i][j - coins[i - 1]]\n else:\n dp[i][j] = dp[i - 1][j]\... | <|body_start_0|>
n = len(coins)
dp = [[0] * (amount + 1) for _ in range(n + 1)]
for i in range(n + 1):
dp[i][0] = 1
for i in range(1, n + 1):
for j in range(1, amount + 1):
if j >= coins[i - 1]:
dp[i][j] = dp[i - 1][j] + dp[i][j... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def change(self, amount: int, coins: List[int]) -> int:
"""dp[i][j]: 前 i 个硬币,组成 j 的方案 当前硬币价值 coins[i]"""
<|body_0|>
def change2(self, amount: int, coins: List[int]) -> int:
"""完全背包,每个硬币可用无限个,能组成面额 amount 的组合"""
<|body_1|>
<|end_skeleton|>
<|body_s... | stack_v2_sparse_classes_36k_train_016021 | 1,623 | no_license | [
{
"docstring": "dp[i][j]: 前 i 个硬币,组成 j 的方案 当前硬币价值 coins[i]",
"name": "change",
"signature": "def change(self, amount: int, coins: List[int]) -> int"
},
{
"docstring": "完全背包,每个硬币可用无限个,能组成面额 amount 的组合",
"name": "change2",
"signature": "def change2(self, amount: int, coins: List[int]) -> i... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def change(self, amount: int, coins: List[int]) -> int: dp[i][j]: 前 i 个硬币,组成 j 的方案 当前硬币价值 coins[i]
- def change2(self, amount: int, coins: List[int]) -> int: 完全背包,每个硬币可用无限个,能组成面额... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def change(self, amount: int, coins: List[int]) -> int: dp[i][j]: 前 i 个硬币,组成 j 的方案 当前硬币价值 coins[i]
- def change2(self, amount: int, coins: List[int]) -> int: 完全背包,每个硬币可用无限个,能组成面额... | 4ca0ec2ab9510b12b7e8c65af52dee719f099ea6 | <|skeleton|>
class Solution:
def change(self, amount: int, coins: List[int]) -> int:
"""dp[i][j]: 前 i 个硬币,组成 j 的方案 当前硬币价值 coins[i]"""
<|body_0|>
def change2(self, amount: int, coins: List[int]) -> int:
"""完全背包,每个硬币可用无限个,能组成面额 amount 的组合"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def change(self, amount: int, coins: List[int]) -> int:
"""dp[i][j]: 前 i 个硬币,组成 j 的方案 当前硬币价值 coins[i]"""
n = len(coins)
dp = [[0] * (amount + 1) for _ in range(n + 1)]
for i in range(n + 1):
dp[i][0] = 1
for i in range(1, n + 1):
for j ... | the_stack_v2_python_sparse | labuladong/1_动态规划/518 零钱兑换2.py | JDer-liuodngkai/LeetCode | train | 0 | |
13a1eed7db60904d4e66dacbfa0d3d742c4dad05 | [
"if n < 2:\n return []\nfactors = []\nx = 2\nwhile x <= n:\n if n % x == 0:\n factors.append(x)\n n = n // x\n elif x == 2:\n x = 3\n else:\n x += 2\nreturn factors",
"primes = Integers.prime_factors(n)\nother_divisors = set([1])\nq1 = []\nfor i in primes:\n q2 = []\n ... | <|body_start_0|>
if n < 2:
return []
factors = []
x = 2
while x <= n:
if n % x == 0:
factors.append(x)
n = n // x
elif x == 2:
x = 3
else:
x += 2
return factors
<|end_b... | Integers | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Integers:
def prime_factors(cls, n: int) -> List[int]:
"""Returns a list of all prime factors of the given integer 'n' in ascending order. Returns and empty list for integers lower than 2."""
<|body_0|>
def all_divisors(cls, n: int) -> List[int]:
"""Returns all integ... | stack_v2_sparse_classes_36k_train_016022 | 1,119 | permissive | [
{
"docstring": "Returns a list of all prime factors of the given integer 'n' in ascending order. Returns and empty list for integers lower than 2.",
"name": "prime_factors",
"signature": "def prime_factors(cls, n: int) -> List[int]"
},
{
"docstring": "Returns all integral divisors of a given int... | 2 | null | Implement the Python class `Integers` described below.
Class description:
Implement the Integers class.
Method signatures and docstrings:
- def prime_factors(cls, n: int) -> List[int]: Returns a list of all prime factors of the given integer 'n' in ascending order. Returns and empty list for integers lower than 2.
- ... | Implement the Python class `Integers` described below.
Class description:
Implement the Integers class.
Method signatures and docstrings:
- def prime_factors(cls, n: int) -> List[int]: Returns a list of all prime factors of the given integer 'n' in ascending order. Returns and empty list for integers lower than 2.
- ... | ecbcef544e8d89ec019464811760ce86f84dbc6e | <|skeleton|>
class Integers:
def prime_factors(cls, n: int) -> List[int]:
"""Returns a list of all prime factors of the given integer 'n' in ascending order. Returns and empty list for integers lower than 2."""
<|body_0|>
def all_divisors(cls, n: int) -> List[int]:
"""Returns all integ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Integers:
def prime_factors(cls, n: int) -> List[int]:
"""Returns a list of all prime factors of the given integer 'n' in ascending order. Returns and empty list for integers lower than 2."""
if n < 2:
return []
factors = []
x = 2
while x <= n:
i... | the_stack_v2_python_sparse | 2018/aoc/integers.py | cz-fish/advent-of-code | train | 0 | |
45ec1b5ef7ef1eebcfafee0bbbef1349dcae59ef | [
"self.Pantone = code\nself.getRGB_from_Code = lambda c: self.ref_colPantone.get(c)[0]\nself.getHEX_from_Code = lambda c: self.ref_colPantone.get(c)[1]\ncRGB.__init__(self, *self.ref_colPantone.get(self.Pantone)[0], *args, **kwargs)\nself.type = 'Pantone'",
"if srch == 'self':\n srch = self.Pantone\nif not isin... | <|body_start_0|>
self.Pantone = code
self.getRGB_from_Code = lambda c: self.ref_colPantone.get(c)[0]
self.getHEX_from_Code = lambda c: self.ref_colPantone.get(c)[1]
cRGB.__init__(self, *self.ref_colPantone.get(self.Pantone)[0], *args, **kwargs)
self.type = 'Pantone'
<|end_body_0|... | RAL set of colors class Inherits from ColRGB & RefPantone | ColPantone | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ColPantone:
"""RAL set of colors class Inherits from ColRGB & RefPantone"""
def __init__(self, code, *args, **kwargs):
"""Init Pantone & RGB values from Pantone string code passed as argument note: Pantone needs to be provided with init Code"""
<|body_0|>
def get(self, t... | stack_v2_sparse_classes_36k_train_016023 | 43,852 | permissive | [
{
"docstring": "Init Pantone & RGB values from Pantone string code passed as argument note: Pantone needs to be provided with init Code",
"name": "__init__",
"signature": "def __init__(self, code, *args, **kwargs)"
},
{
"docstring": "get data from RAL colors dict :param typ: row in dict (from lf... | 2 | stack_v2_sparse_classes_30k_train_000960 | Implement the Python class `ColPantone` described below.
Class description:
RAL set of colors class Inherits from ColRGB & RefPantone
Method signatures and docstrings:
- def __init__(self, code, *args, **kwargs): Init Pantone & RGB values from Pantone string code passed as argument note: Pantone needs to be provided ... | Implement the Python class `ColPantone` described below.
Class description:
RAL set of colors class Inherits from ColRGB & RefPantone
Method signatures and docstrings:
- def __init__(self, code, *args, **kwargs): Init Pantone & RGB values from Pantone string code passed as argument note: Pantone needs to be provided ... | a158bfc0f2ccc2bd2dfb1d68028b804e3dcc5117 | <|skeleton|>
class ColPantone:
"""RAL set of colors class Inherits from ColRGB & RefPantone"""
def __init__(self, code, *args, **kwargs):
"""Init Pantone & RGB values from Pantone string code passed as argument note: Pantone needs to be provided with init Code"""
<|body_0|>
def get(self, t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ColPantone:
"""RAL set of colors class Inherits from ColRGB & RefPantone"""
def __init__(self, code, *args, **kwargs):
"""Init Pantone & RGB values from Pantone string code passed as argument note: Pantone needs to be provided with init Code"""
self.Pantone = code
self.getRGB_from... | the_stack_v2_python_sparse | SMFSWcolor/colPantone.py | SMFSW/SMFSWcolor | train | 0 |
9cd5bbf2ed762f3784060d90b86ceaa57f997a37 | [
"custom_classes = env.COMMON_CUSTOM_CLASSES + env.PROJECT_CUSTOM_CLASSES\nfor cc in custom_classes:\n split_cc = cc.split('.')\n custom_cls_name = split_cc[1]\n if cls_name == custom_cls_name:\n return True\nreturn False",
"custom_cls_candidates = env.COMMON_CUSTOM_CLASSES + env.PROJECT_CUSTOM_CLA... | <|body_start_0|>
custom_classes = env.COMMON_CUSTOM_CLASSES + env.PROJECT_CUSTOM_CLASSES
for cc in custom_classes:
split_cc = cc.split('.')
custom_cls_name = split_cc[1]
if cls_name == custom_cls_name:
return True
return False
<|end_body_0|>
<... | ClassUtil | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClassUtil:
def is_custom_cls(self, cls_name):
"""Check if given class is a custom class. Args: cls_name: Class name Return: True: Custom class False: Default class"""
<|body_0|>
def describe_class(self, cls_name):
"""Returns a pair of module path and class name by gi... | stack_v2_sparse_classes_36k_train_016024 | 1,285 | permissive | [
{
"docstring": "Check if given class is a custom class. Args: cls_name: Class name Return: True: Custom class False: Default class",
"name": "is_custom_cls",
"signature": "def is_custom_cls(self, cls_name)"
},
{
"docstring": "Returns a pair of module path and class name by given name. Args: cls_... | 2 | stack_v2_sparse_classes_30k_train_020550 | Implement the Python class `ClassUtil` described below.
Class description:
Implement the ClassUtil class.
Method signatures and docstrings:
- def is_custom_cls(self, cls_name): Check if given class is a custom class. Args: cls_name: Class name Return: True: Custom class False: Default class
- def describe_class(self,... | Implement the Python class `ClassUtil` described below.
Class description:
Implement the ClassUtil class.
Method signatures and docstrings:
- def is_custom_cls(self, cls_name): Check if given class is a custom class. Args: cls_name: Class name Return: True: Custom class False: Default class
- def describe_class(self,... | e523653a9f96f84810c06824133c3a146a053b75 | <|skeleton|>
class ClassUtil:
def is_custom_cls(self, cls_name):
"""Check if given class is a custom class. Args: cls_name: Class name Return: True: Custom class False: Default class"""
<|body_0|>
def describe_class(self, cls_name):
"""Returns a pair of module path and class name by gi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ClassUtil:
def is_custom_cls(self, cls_name):
"""Check if given class is a custom class. Args: cls_name: Class name Return: True: Custom class False: Default class"""
custom_classes = env.COMMON_CUSTOM_CLASSES + env.PROJECT_CUSTOM_CLASSES
for cc in custom_classes:
split_cc ... | the_stack_v2_python_sparse | cliboa/util/class_util.py | BrainPad/cliboa | train | 27 | |
cb4c021f77704289820f0c1dec6a99632d8424ad | [
"super().__init__()\nself.dim_head = int(dim / heads) if dim_head is None else dim_head\n_dim = self.dim_head * heads\nself.heads = heads\nself.to_qvk = nn.Linear(dim, _dim * 3, bias=False)\nself.W_0 = nn.Linear(_dim, dim, bias=False)\nself.scale_factor = self.dim_head ** (-0.5)\nself.space_att = space_att\nself.re... | <|body_start_0|>
super().__init__()
self.dim_head = int(dim / heads) if dim_head is None else dim_head
_dim = self.dim_head * heads
self.heads = heads
self.to_qvk = nn.Linear(dim, _dim * 3, bias=False)
self.W_0 = nn.Linear(_dim, dim, bias=False)
self.scale_factor ... | SpacetimeMHSA | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SpacetimeMHSA:
def __init__(self, dim, tokens_to_attend, space_att, heads=8, dim_head=None, classification=True, linear_spatial_attention=False, k=None):
"""Attention through time and space to process videos choose mode (whether to operate in space and time with space_att (bool) ) CLS to... | stack_v2_sparse_classes_36k_train_016025 | 4,810 | permissive | [
{
"docstring": "Attention through time and space to process videos choose mode (whether to operate in space and time with space_att (bool) ) CLS token is used for video classification, which will attend all tokens in both space and time before attention only in time or space. Code is based on lucidrains repo: h... | 2 | stack_v2_sparse_classes_30k_train_020973 | Implement the Python class `SpacetimeMHSA` described below.
Class description:
Implement the SpacetimeMHSA class.
Method signatures and docstrings:
- def __init__(self, dim, tokens_to_attend, space_att, heads=8, dim_head=None, classification=True, linear_spatial_attention=False, k=None): Attention through time and sp... | Implement the Python class `SpacetimeMHSA` described below.
Class description:
Implement the SpacetimeMHSA class.
Method signatures and docstrings:
- def __init__(self, dim, tokens_to_attend, space_att, heads=8, dim_head=None, classification=True, linear_spatial_attention=False, k=None): Attention through time and sp... | 25622d56490ccca60a62a492fe48743e874a3e16 | <|skeleton|>
class SpacetimeMHSA:
def __init__(self, dim, tokens_to_attend, space_att, heads=8, dim_head=None, classification=True, linear_spatial_attention=False, k=None):
"""Attention through time and space to process videos choose mode (whether to operate in space and time with space_att (bool) ) CLS to... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SpacetimeMHSA:
def __init__(self, dim, tokens_to_attend, space_att, heads=8, dim_head=None, classification=True, linear_spatial_attention=False, k=None):
"""Attention through time and space to process videos choose mode (whether to operate in space and time with space_att (bool) ) CLS token is used fo... | the_stack_v2_python_sparse | self_attention_cv/timesformer/spacetime_attention.py | cumtChenLL/self-attention-cv | train | 1 | |
4a9cf49521b1d5efb99f675eb5a7431c06f342fc | [
"super().__init__()\nself.dropout = nn.Dropout(p=dropout)\nself.padding_idx = padding_idx\nrng = 1.0 / math.sqrt(num_features)\nself.bias = Parameter(torch.Tensor(num_features).uniform_(-rng, rng))\nif shared_weight is None:\n self.shared = False\n self.weight = Parameter(torch.Tensor(num_features, embeddings... | <|body_start_0|>
super().__init__()
self.dropout = nn.Dropout(p=dropout)
self.padding_idx = padding_idx
rng = 1.0 / math.sqrt(num_features)
self.bias = Parameter(torch.Tensor(num_features).uniform_(-rng, rng))
if shared_weight is None:
self.shared = False
... | Takes in final states and returns distribution over candidates. | OutputLayer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OutputLayer:
"""Takes in final states and returns distribution over candidates."""
def __init__(self, num_features, embeddingsize, hiddensize, dropout=0, numsoftmax=1, shared_weight=None, padding_idx=-1):
"""Initialize output layer. :param num_features: number of candidates to rank :... | stack_v2_sparse_classes_36k_train_016026 | 24,820 | permissive | [
{
"docstring": "Initialize output layer. :param num_features: number of candidates to rank :param hiddensize: (last) dimension of the input vectors :param embeddingsize: (last) dimension of the candidate vectors :param numsoftmax: (default 1) number of softmaxes to calculate. see arxiv.org/abs/1711.03953 for mo... | 2 | null | Implement the Python class `OutputLayer` described below.
Class description:
Takes in final states and returns distribution over candidates.
Method signatures and docstrings:
- def __init__(self, num_features, embeddingsize, hiddensize, dropout=0, numsoftmax=1, shared_weight=None, padding_idx=-1): Initialize output l... | Implement the Python class `OutputLayer` described below.
Class description:
Takes in final states and returns distribution over candidates.
Method signatures and docstrings:
- def __init__(self, num_features, embeddingsize, hiddensize, dropout=0, numsoftmax=1, shared_weight=None, padding_idx=-1): Initialize output l... | e1d899edfb92471552bae153f59ad30aa7fca468 | <|skeleton|>
class OutputLayer:
"""Takes in final states and returns distribution over candidates."""
def __init__(self, num_features, embeddingsize, hiddensize, dropout=0, numsoftmax=1, shared_weight=None, padding_idx=-1):
"""Initialize output layer. :param num_features: number of candidates to rank :... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OutputLayer:
"""Takes in final states and returns distribution over candidates."""
def __init__(self, num_features, embeddingsize, hiddensize, dropout=0, numsoftmax=1, shared_weight=None, padding_idx=-1):
"""Initialize output layer. :param num_features: number of candidates to rank :param hiddens... | the_stack_v2_python_sparse | parlai/agents/seq2seq/modules.py | facebookresearch/ParlAI | train | 10,943 |
33fb8f25e6dbb5b50c4e80c72cd896cbba84bea9 | [
"resp = self.client.get('/')\nself.assertEqual(resp.status_code, 200)\nprint('test inicio exitoso')",
"resp = self.client.get('/')\nself.assertEqual(200, resp.status_code)\nprint('test login exitoso')"
] | <|body_start_0|>
resp = self.client.get('/')
self.assertEqual(resp.status_code, 200)
print('test inicio exitoso')
<|end_body_0|>
<|body_start_1|>
resp = self.client.get('/')
self.assertEqual(200, resp.status_code)
print('test login exitoso')
<|end_body_1|>
| TestLoginView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestLoginView:
def test_inicio(self):
"""test para verificar si va a la pagina de inicio"""
<|body_0|>
def test_login(self):
"""test para verificar si realiza el login"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
resp = self.client.get('/')
... | stack_v2_sparse_classes_36k_train_016027 | 585 | no_license | [
{
"docstring": "test para verificar si va a la pagina de inicio",
"name": "test_inicio",
"signature": "def test_inicio(self)"
},
{
"docstring": "test para verificar si realiza el login",
"name": "test_login",
"signature": "def test_login(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_014195 | Implement the Python class `TestLoginView` described below.
Class description:
Implement the TestLoginView class.
Method signatures and docstrings:
- def test_inicio(self): test para verificar si va a la pagina de inicio
- def test_login(self): test para verificar si realiza el login | Implement the Python class `TestLoginView` described below.
Class description:
Implement the TestLoginView class.
Method signatures and docstrings:
- def test_inicio(self): test para verificar si va a la pagina de inicio
- def test_login(self): test para verificar si realiza el login
<|skeleton|>
class TestLoginView... | a54bea249451169d8289e1380ac7a6c7ad233244 | <|skeleton|>
class TestLoginView:
def test_inicio(self):
"""test para verificar si va a la pagina de inicio"""
<|body_0|>
def test_login(self):
"""test para verificar si realiza el login"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestLoginView:
def test_inicio(self):
"""test para verificar si va a la pagina de inicio"""
resp = self.client.get('/')
self.assertEqual(resp.status_code, 200)
print('test inicio exitoso')
def test_login(self):
"""test para verificar si realiza el login"""
... | the_stack_v2_python_sparse | Aplicaciones/Login/tests.py | amigleon92/ProyectoIS2 | train | 0 | |
7a8ab791fc82dab487faad051367b5c5f43ee5eb | [
"try:\n estimate_ttc = False\n params = loads(request.data)\n if 'estimate_ttc' in params:\n estimate_ttc = params['estimate_ttc']\nexcept ValueError:\n estimate_ttc = False\ntry:\n rule = get_replication_rule(rule_id, estimate_ttc=estimate_ttc, issuer=request.environ.get('issuer'), vo=request... | <|body_start_0|>
try:
estimate_ttc = False
params = loads(request.data)
if 'estimate_ttc' in params:
estimate_ttc = params['estimate_ttc']
except ValueError:
estimate_ttc = False
try:
rule = get_replication_rule(rule_id,... | REST APIs for replication rules. | Rule | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Rule:
"""REST APIs for replication rules."""
def get(self, rule_id):
"""get rule information for given rule id. .. :quickref: Rule; get rule info :returns: JSON dict containing informations about the requested user. :status 200: Rule found :status 406: Not Acceptable :status 410: Inv... | stack_v2_sparse_classes_36k_train_016028 | 25,290 | permissive | [
{
"docstring": "get rule information for given rule id. .. :quickref: Rule; get rule info :returns: JSON dict containing informations about the requested user. :status 200: Rule found :status 406: Not Acceptable :status 410: Invalid Auth Token :status 404: no rule found for id",
"name": "get",
"signatur... | 3 | null | Implement the Python class `Rule` described below.
Class description:
REST APIs for replication rules.
Method signatures and docstrings:
- def get(self, rule_id): get rule information for given rule id. .. :quickref: Rule; get rule info :returns: JSON dict containing informations about the requested user. :status 200... | Implement the Python class `Rule` described below.
Class description:
REST APIs for replication rules.
Method signatures and docstrings:
- def get(self, rule_id): get rule information for given rule id. .. :quickref: Rule; get rule info :returns: JSON dict containing informations about the requested user. :status 200... | bf33d9441d3b4ff160a392eed56724f635a03fe6 | <|skeleton|>
class Rule:
"""REST APIs for replication rules."""
def get(self, rule_id):
"""get rule information for given rule id. .. :quickref: Rule; get rule info :returns: JSON dict containing informations about the requested user. :status 200: Rule found :status 406: Not Acceptable :status 410: Inv... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Rule:
"""REST APIs for replication rules."""
def get(self, rule_id):
"""get rule information for given rule id. .. :quickref: Rule; get rule info :returns: JSON dict containing informations about the requested user. :status 200: Rule found :status 406: Not Acceptable :status 410: Invalid Auth Tok... | the_stack_v2_python_sparse | lib/rucio/web/rest/flaskapi/v1/rules.py | viveknigam3003/rucio | train | 1 |
959d54db70b46c51a455e1a6f27e5b555c5d2e51 | [
"queryset = self.filter_queryset(self.get_object().follows.all())\npage = self.paginate_queryset(queryset)\nserializer = self.get_serializer(page, many=True)\nreturn self.get_paginated_response(serializer.data)",
"company = self.get_object()\ndata = request.data.copy()\ndata['company'] = company.pk\ndata['owner']... | <|body_start_0|>
queryset = self.filter_queryset(self.get_object().follows.all())
page = self.paginate_queryset(queryset)
serializer = self.get_serializer(page, many=True)
return self.get_paginated_response(serializer.data)
<|end_body_0|>
<|body_start_1|>
company = self.get_obje... | Company follow view. | CompanyFollow | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CompanyFollow:
"""Company follow view."""
def get(self, request: Request, *args: tuple, **kwargs: dict) -> Response:
"""Get the company. :param request: Request :return: List of follows"""
<|body_0|>
def post(self, request: Request, *args: tuple, **kwargs: dict) -> Respo... | stack_v2_sparse_classes_36k_train_016029 | 2,210 | no_license | [
{
"docstring": "Get the company. :param request: Request :return: List of follows",
"name": "get",
"signature": "def get(self, request: Request, *args: tuple, **kwargs: dict) -> Response"
},
{
"docstring": "Add the company to favorites. :return: Follow instance",
"name": "post",
"signatu... | 3 | stack_v2_sparse_classes_30k_train_020418 | Implement the Python class `CompanyFollow` described below.
Class description:
Company follow view.
Method signatures and docstrings:
- def get(self, request: Request, *args: tuple, **kwargs: dict) -> Response: Get the company. :param request: Request :return: List of follows
- def post(self, request: Request, *args:... | Implement the Python class `CompanyFollow` described below.
Class description:
Company follow view.
Method signatures and docstrings:
- def get(self, request: Request, *args: tuple, **kwargs: dict) -> Response: Get the company. :param request: Request :return: List of follows
- def post(self, request: Request, *args:... | 713b9d84ac70d964d46f189ab1f9c7b944b9684b | <|skeleton|>
class CompanyFollow:
"""Company follow view."""
def get(self, request: Request, *args: tuple, **kwargs: dict) -> Response:
"""Get the company. :param request: Request :return: List of follows"""
<|body_0|>
def post(self, request: Request, *args: tuple, **kwargs: dict) -> Respo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CompanyFollow:
"""Company follow view."""
def get(self, request: Request, *args: tuple, **kwargs: dict) -> Response:
"""Get the company. :param request: Request :return: List of follows"""
queryset = self.filter_queryset(self.get_object().follows.all())
page = self.paginate_querys... | the_stack_v2_python_sparse | jobadvisor/companies/views/follow.py | ewgen19892/jobadvisor | train | 0 |
1f2e58a08ebaf39e7dfcdab5d15c779d576e9466 | [
"super(AttentionCell, self).__init__()\nself.i2h = nn.Linear(input_size, hidden_size, bias=False)\nself.h2h = nn.Linear(hidden_size, hidden_size)\nself.score = nn.Linear(hidden_size, 1, bias=False)\nself.rnn = nn.LSTMCell(input_size + num_embeddings, hidden_size)\nself.hidden_size = hidden_size",
"batch_h_proj = ... | <|body_start_0|>
super(AttentionCell, self).__init__()
self.i2h = nn.Linear(input_size, hidden_size, bias=False)
self.h2h = nn.Linear(hidden_size, hidden_size)
self.score = nn.Linear(hidden_size, 1, bias=False)
self.rnn = nn.LSTMCell(input_size + num_embeddings, hidden_size)
... | Attention Cell Structure | AttentionCell | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AttentionCell:
"""Attention Cell Structure"""
def __init__(self, input_size, hidden_size, num_embeddings):
"""Args: input_size (int): input channel hidden_size (int): hidden state num num_embeddings (int): embedding layers"""
<|body_0|>
def forward(self, prev_hidden, bat... | stack_v2_sparse_classes_36k_train_016030 | 11,113 | permissive | [
{
"docstring": "Args: input_size (int): input channel hidden_size (int): hidden state num num_embeddings (int): embedding layers",
"name": "__init__",
"signature": "def __init__(self, input_size, hidden_size, num_embeddings)"
},
{
"docstring": "Args: prev_hidden (Torch.Tensor): previous layer's ... | 2 | null | Implement the Python class `AttentionCell` described below.
Class description:
Attention Cell Structure
Method signatures and docstrings:
- def __init__(self, input_size, hidden_size, num_embeddings): Args: input_size (int): input channel hidden_size (int): hidden state num num_embeddings (int): embedding layers
- de... | Implement the Python class `AttentionCell` described below.
Class description:
Attention Cell Structure
Method signatures and docstrings:
- def __init__(self, input_size, hidden_size, num_embeddings): Args: input_size (int): input channel hidden_size (int): hidden state num num_embeddings (int): embedding layers
- de... | fb47a96d1a38f5ce634c6f12d710ed5300cc89fc | <|skeleton|>
class AttentionCell:
"""Attention Cell Structure"""
def __init__(self, input_size, hidden_size, num_embeddings):
"""Args: input_size (int): input channel hidden_size (int): hidden state num num_embeddings (int): embedding layers"""
<|body_0|>
def forward(self, prev_hidden, bat... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AttentionCell:
"""Attention Cell Structure"""
def __init__(self, input_size, hidden_size, num_embeddings):
"""Args: input_size (int): input channel hidden_size (int): hidden state num num_embeddings (int): embedding layers"""
super(AttentionCell, self).__init__()
self.i2h = nn.Lin... | the_stack_v2_python_sparse | davarocr/davarocr/davar_rcg/models/sequence_heads/att_head.py | OCRWorld/DAVAR-Lab-OCR | train | 0 |
06757d78312606f728f3888bc6a9c37de1fde3b6 | [
"self.inbound = 8303\nself.outbound = 8304\nself.processCommand()\nhost = ('localhost', self.inbound)\nserver = ProxyHTTPServer(host, self.outbound, Handler)\nprint('Addition service proxy')\nprint(' Proxy for port ' + str(self.outbound))\nprint(' Listening on port ' + str(self.inbound))\ntry:\n server.serve_f... | <|body_start_0|>
self.inbound = 8303
self.outbound = 8304
self.processCommand()
host = ('localhost', self.inbound)
server = ProxyHTTPServer(host, self.outbound, Handler)
print('Addition service proxy')
print(' Proxy for port ' + str(self.outbound))
print(... | Start server for addition service. | AdditionProxy | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AdditionProxy:
"""Start server for addition service."""
def __init__(self):
"""Set port and start server"""
<|body_0|>
def processCommand(self):
"""Get ports from command line arguments."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.inbou... | stack_v2_sparse_classes_36k_train_016031 | 4,977 | permissive | [
{
"docstring": "Set port and start server",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Get ports from command line arguments.",
"name": "processCommand",
"signature": "def processCommand(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000124 | Implement the Python class `AdditionProxy` described below.
Class description:
Start server for addition service.
Method signatures and docstrings:
- def __init__(self): Set port and start server
- def processCommand(self): Get ports from command line arguments. | Implement the Python class `AdditionProxy` described below.
Class description:
Start server for addition service.
Method signatures and docstrings:
- def __init__(self): Set port and start server
- def processCommand(self): Get ports from command line arguments.
<|skeleton|>
class AdditionProxy:
"""Start server ... | d6e8ca06c70e31bff0e56f7d94bfa0bd835bf61c | <|skeleton|>
class AdditionProxy:
"""Start server for addition service."""
def __init__(self):
"""Set port and start server"""
<|body_0|>
def processCommand(self):
"""Get ports from command line arguments."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AdditionProxy:
"""Start server for addition service."""
def __init__(self):
"""Set port and start server"""
self.inbound = 8303
self.outbound = 8304
self.processCommand()
host = ('localhost', self.inbound)
server = ProxyHTTPServer(host, self.outbound, Handl... | the_stack_v2_python_sparse | chapter7/additionProxy.py | MikeBeaulieu/ujs-book-materials | train | 0 |
d6b17a7ef4d239b5be3d805044f63152d8f988a5 | [
"activite = Activite.objects.first()\nserializer = ActiviteSerializer(instance=activite)\ndata = serializer.data\nnew_serializer = ActiviteSerializer(data=data)\nif not new_serializer.is_valid():\n print(new_serializer.errors)\nself.assertTrue(new_serializer.is_valid())\nnew_activite = new_serializer.save()\nfor... | <|body_start_0|>
activite = Activite.objects.first()
serializer = ActiviteSerializer(instance=activite)
data = serializer.data
new_serializer = ActiviteSerializer(data=data)
if not new_serializer.is_valid():
print(new_serializer.errors)
self.assertTrue(new_ser... | ActiviteTestCase | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ActiviteTestCase:
def test_activite_serializer(self):
"""Test the activite model serializer by serializing and deserializing an activite object."""
<|body_0|>
def test_get_all_activites(self):
"""Test the enpoint to get all activites"""
<|body_1|>
<|end_skel... | stack_v2_sparse_classes_36k_train_016032 | 1,442 | no_license | [
{
"docstring": "Test the activite model serializer by serializing and deserializing an activite object.",
"name": "test_activite_serializer",
"signature": "def test_activite_serializer(self)"
},
{
"docstring": "Test the enpoint to get all activites",
"name": "test_get_all_activites",
"si... | 2 | stack_v2_sparse_classes_30k_train_010519 | Implement the Python class `ActiviteTestCase` described below.
Class description:
Implement the ActiviteTestCase class.
Method signatures and docstrings:
- def test_activite_serializer(self): Test the activite model serializer by serializing and deserializing an activite object.
- def test_get_all_activites(self): Te... | Implement the Python class `ActiviteTestCase` described below.
Class description:
Implement the ActiviteTestCase class.
Method signatures and docstrings:
- def test_activite_serializer(self): Test the activite model serializer by serializing and deserializing an activite object.
- def test_get_all_activites(self): Te... | dc96b1cc35b4ca49e5e0c80e6b31f8610fe31a26 | <|skeleton|>
class ActiviteTestCase:
def test_activite_serializer(self):
"""Test the activite model serializer by serializing and deserializing an activite object."""
<|body_0|>
def test_get_all_activites(self):
"""Test the enpoint to get all activites"""
<|body_1|>
<|end_skel... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ActiviteTestCase:
def test_activite_serializer(self):
"""Test the activite model serializer by serializing and deserializing an activite object."""
activite = Activite.objects.first()
serializer = ActiviteSerializer(instance=activite)
data = serializer.data
new_serializ... | the_stack_v2_python_sparse | backend/crechesite/activite/tests.py | bricekouetcheu/Les-lionceaux | train | 1 | |
1e99306d2916f977f93567f6069f0638d0fdee8f | [
"if pos_label not in (0, 1):\n raise ValueError('only {0, 1} are accepted for `pos_label`')\ny_true = convert_binary_labels(y_true).ravel()\nscore = _check_binary_score(score, pos_label)\nh = 1.0 - y_true * score\nh[h < 0] = 0.0\nreturn h ** 2",
"if pos_label not in (0, 1):\n raise ValueError('only {0, 1} a... | <|body_start_0|>
if pos_label not in (0, 1):
raise ValueError('only {0, 1} are accepted for `pos_label`')
y_true = convert_binary_labels(y_true).ravel()
score = _check_binary_score(score, pos_label)
h = 1.0 - y_true * score
h[h < 0] = 0.0
return h ** 2
<|end_b... | Squared Hinge Loss Function. The function computes the average distance between the model and the data using hinge loss, a one-sided metric that considers only prediction errors. After converting the labels to {-1, +1}, then the hinge loss is defined as: .. math:: L^2_\\text{Hinge} (y, s) = {\\left( \\max \\left\\{ 1 -... | CLossHingeSquared | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CLossHingeSquared:
"""Squared Hinge Loss Function. The function computes the average distance between the model and the data using hinge loss, a one-sided metric that considers only prediction errors. After converting the labels to {-1, +1}, then the hinge loss is defined as: .. math:: L^2_\\text... | stack_v2_sparse_classes_36k_train_016033 | 6,353 | permissive | [
{
"docstring": "Computes the value of the squared hinge loss function. Parameters ---------- y_true : CArray Ground truth (correct), targets. Vector-like array. score : CArray Outputs (predicted), targets. 2-D array of shape (n_samples, n_classes) or 1-D flat array of shape (n_samples,). If 1-D array, the proba... | 2 | null | Implement the Python class `CLossHingeSquared` described below.
Class description:
Squared Hinge Loss Function. The function computes the average distance between the model and the data using hinge loss, a one-sided metric that considers only prediction errors. After converting the labels to {-1, +1}, then the hinge l... | Implement the Python class `CLossHingeSquared` described below.
Class description:
Squared Hinge Loss Function. The function computes the average distance between the model and the data using hinge loss, a one-sided metric that considers only prediction errors. After converting the labels to {-1, +1}, then the hinge l... | 431373e65d8cfe2cb7cf042ce1a6c9519ea5a14a | <|skeleton|>
class CLossHingeSquared:
"""Squared Hinge Loss Function. The function computes the average distance between the model and the data using hinge loss, a one-sided metric that considers only prediction errors. After converting the labels to {-1, +1}, then the hinge loss is defined as: .. math:: L^2_\\text... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CLossHingeSquared:
"""Squared Hinge Loss Function. The function computes the average distance between the model and the data using hinge loss, a one-sided metric that considers only prediction errors. After converting the labels to {-1, +1}, then the hinge loss is defined as: .. math:: L^2_\\text{Hinge} (y, s... | the_stack_v2_python_sparse | src/secml/ml/classifiers/loss/c_loss_hinge.py | Cinofix/secml | train | 0 |
3b0b7ec40fab6545921022d0553699f6c2c6dbb1 | [
"super(Model, self).__init__()\nself.w2v_size = param['embedding'].shape[1]\nself.vocab_size = param['embedding'].shape[0]\nself.embedding_type = param['embedding_type']\nself.embedding_is_training = param['embedding_is_training']\nself.mode = param['mode']\nself.hidden_size = param['hidden_size']\nself.dropout_p =... | <|body_start_0|>
super(Model, self).__init__()
self.w2v_size = param['embedding'].shape[1]
self.vocab_size = param['embedding'].shape[0]
self.embedding_type = param['embedding_type']
self.embedding_is_training = param['embedding_is_training']
self.mode = param['mode']
... | match-lstm model for machine comprehension | Model | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Model:
"""match-lstm model for machine comprehension"""
def __init__(self, param):
""":param param: embedding, hidden_size, dropout_p, encoder_dropout_p, encoder_direction_num, encoder_layer_num"""
<|body_0|>
def forward(self, batch):
""":param batch: [content, q... | stack_v2_sparse_classes_36k_train_016034 | 3,371 | no_license | [
{
"docstring": ":param param: embedding, hidden_size, dropout_p, encoder_dropout_p, encoder_direction_num, encoder_layer_num",
"name": "__init__",
"signature": "def __init__(self, param)"
},
{
"docstring": ":param batch: [content, question, answer_start, answer_end] :return: ans_range (2, batch_... | 2 | stack_v2_sparse_classes_30k_train_011214 | Implement the Python class `Model` described below.
Class description:
match-lstm model for machine comprehension
Method signatures and docstrings:
- def __init__(self, param): :param param: embedding, hidden_size, dropout_p, encoder_dropout_p, encoder_direction_num, encoder_layer_num
- def forward(self, batch): :par... | Implement the Python class `Model` described below.
Class description:
match-lstm model for machine comprehension
Method signatures and docstrings:
- def __init__(self, param): :param param: embedding, hidden_size, dropout_p, encoder_dropout_p, encoder_direction_num, encoder_layer_num
- def forward(self, batch): :par... | 4aaca6397c94ee62ef62e6436c649507ceb1e69b | <|skeleton|>
class Model:
"""match-lstm model for machine comprehension"""
def __init__(self, param):
""":param param: embedding, hidden_size, dropout_p, encoder_dropout_p, encoder_direction_num, encoder_layer_num"""
<|body_0|>
def forward(self, batch):
""":param batch: [content, q... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Model:
"""match-lstm model for machine comprehension"""
def __init__(self, param):
""":param param: embedding, hidden_size, dropout_p, encoder_dropout_p, encoder_direction_num, encoder_layer_num"""
super(Model, self).__init__()
self.w2v_size = param['embedding'].shape[1]
s... | the_stack_v2_python_sparse | modules/match_lstm.py | xy09Player/rd_opinion | train | 2 |
30b59d64407d56252a76db8656c3006fd1b5221e | [
"if isinstance(video_or_file, VideoContext):\n self.video_or_file = video_or_file.video\nelse:\n self.video_or_file = video_or_file",
"if isinstance(self.video_or_file, str):\n if not os.path.exists(self.video_or_file):\n raise FileNotFoundError(self.video_or_file)\n video = VideoFileClip(self.... | <|body_start_0|>
if isinstance(video_or_file, VideoContext):
self.video_or_file = video_or_file.video
else:
self.video_or_file = video_or_file
<|end_body_0|>
<|body_start_1|>
if isinstance(self.video_or_file, str):
if not os.path.exists(self.video_or_file):
... | Creates a context for a :epkg:`VideoClip`. It deals with opening, closing subprocesses. @return :epkg:`VideoClip` | VideoContext | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VideoContext:
"""Creates a context for a :epkg:`VideoClip`. It deals with opening, closing subprocesses. @return :epkg:`VideoClip`"""
def __init__(self, video_or_file):
"""@param video_or_file string or :epkg:`VideoClip`"""
<|body_0|>
def __enter__(self):
"""Ente... | stack_v2_sparse_classes_36k_train_016035 | 5,305 | permissive | [
{
"docstring": "@param video_or_file string or :epkg:`VideoClip`",
"name": "__init__",
"signature": "def __init__(self, video_or_file)"
},
{
"docstring": "Enters the context.",
"name": "__enter__",
"signature": "def __enter__(self)"
},
{
"docstring": "Leaves the context.",
"n... | 4 | null | Implement the Python class `VideoContext` described below.
Class description:
Creates a context for a :epkg:`VideoClip`. It deals with opening, closing subprocesses. @return :epkg:`VideoClip`
Method signatures and docstrings:
- def __init__(self, video_or_file): @param video_or_file string or :epkg:`VideoClip`
- def ... | Implement the Python class `VideoContext` described below.
Class description:
Creates a context for a :epkg:`VideoClip`. It deals with opening, closing subprocesses. @return :epkg:`VideoClip`
Method signatures and docstrings:
- def __init__(self, video_or_file): @param video_or_file string or :epkg:`VideoClip`
- def ... | e39f8ae416c23940c1a227c11c667c19104b2ff4 | <|skeleton|>
class VideoContext:
"""Creates a context for a :epkg:`VideoClip`. It deals with opening, closing subprocesses. @return :epkg:`VideoClip`"""
def __init__(self, video_or_file):
"""@param video_or_file string or :epkg:`VideoClip`"""
<|body_0|>
def __enter__(self):
"""Ente... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VideoContext:
"""Creates a context for a :epkg:`VideoClip`. It deals with opening, closing subprocesses. @return :epkg:`VideoClip`"""
def __init__(self, video_or_file):
"""@param video_or_file string or :epkg:`VideoClip`"""
if isinstance(video_or_file, VideoContext):
self.vide... | the_stack_v2_python_sparse | src/code_beatrix/art/moviepy_context.py | sdpython/code_beatrix | train | 1 |
d445d0dba9a909400d7222d8f171e943ba03ec42 | [
"with open(file, 'r') as f:\n for line in f:\n print(socket.gethostbyname(line.strip()))",
"with open(file) as f:\n for line in f:\n print(socket.gethostbyaddr(line.strip())[0])"
] | <|body_start_0|>
with open(file, 'r') as f:
for line in f:
print(socket.gethostbyname(line.strip()))
<|end_body_0|>
<|body_start_1|>
with open(file) as f:
for line in f:
print(socket.gethostbyaddr(line.strip())[0])
<|end_body_1|>
| DnsHelper | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DnsHelper:
def resolve_hostname_into_ip(file):
"""Reads a list of hostnames and resolves each IP address and print them"""
<|body_0|>
def resolve_ip_into_hostname(file):
"""Resolves IP address into hostname"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_016036 | 806 | permissive | [
{
"docstring": "Reads a list of hostnames and resolves each IP address and print them",
"name": "resolve_hostname_into_ip",
"signature": "def resolve_hostname_into_ip(file)"
},
{
"docstring": "Resolves IP address into hostname",
"name": "resolve_ip_into_hostname",
"signature": "def resol... | 2 | null | Implement the Python class `DnsHelper` described below.
Class description:
Implement the DnsHelper class.
Method signatures and docstrings:
- def resolve_hostname_into_ip(file): Reads a list of hostnames and resolves each IP address and print them
- def resolve_ip_into_hostname(file): Resolves IP address into hostnam... | Implement the Python class `DnsHelper` described below.
Class description:
Implement the DnsHelper class.
Method signatures and docstrings:
- def resolve_hostname_into_ip(file): Reads a list of hostnames and resolves each IP address and print them
- def resolve_ip_into_hostname(file): Resolves IP address into hostnam... | eae5ee9dd6829d52644c4df489d5514a0e0c8728 | <|skeleton|>
class DnsHelper:
def resolve_hostname_into_ip(file):
"""Reads a list of hostnames and resolves each IP address and print them"""
<|body_0|>
def resolve_ip_into_hostname(file):
"""Resolves IP address into hostname"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DnsHelper:
def resolve_hostname_into_ip(file):
"""Reads a list of hostnames and resolves each IP address and print them"""
with open(file, 'r') as f:
for line in f:
print(socket.gethostbyname(line.strip()))
def resolve_ip_into_hostname(file):
"""Resolve... | the_stack_v2_python_sparse | facebook/resolve_ip_addresses.py | sgrade/pytest | train | 0 | |
d1ea109066e096f2b7fdea08374a4e3d0e0119c2 | [
"self.queue1 = deque([])\nself.queue2 = deque([])\nself.flag = True",
"if self.flag:\n self.queue2.append(x)\nelse:\n self.queue1.append(x)",
"if self.flag:\n while len(self.queue2) > 1:\n self.queue1.append(self.queue2.popleft())\n self.flag = not self.flag\n return self.queue2.popleft()\... | <|body_start_0|>
self.queue1 = deque([])
self.queue2 = deque([])
self.flag = True
<|end_body_0|>
<|body_start_1|>
if self.flag:
self.queue2.append(x)
else:
self.queue1.append(x)
<|end_body_1|>
<|body_start_2|>
if self.flag:
while len(... | MyStack | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyStack:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def push(self, x: int) -> None:
"""Push element x onto stack."""
<|body_1|>
def pop(self) -> int:
"""Removes the element on top of the stack and returns that eleme... | stack_v2_sparse_classes_36k_train_016037 | 4,575 | no_license | [
{
"docstring": "Initialize your data structure here.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Push element x onto stack.",
"name": "push",
"signature": "def push(self, x: int) -> None"
},
{
"docstring": "Removes the element on top of the stack an... | 5 | stack_v2_sparse_classes_30k_train_002598 | Implement the Python class `MyStack` described below.
Class description:
Implement the MyStack class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def push(self, x: int) -> None: Push element x onto stack.
- def pop(self) -> int: Removes the element on top of the stac... | Implement the Python class `MyStack` described below.
Class description:
Implement the MyStack class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def push(self, x: int) -> None: Push element x onto stack.
- def pop(self) -> int: Removes the element on top of the stac... | 4c94ce215d1a9dc265c430b7949e2ccf2696f8b4 | <|skeleton|>
class MyStack:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def push(self, x: int) -> None:
"""Push element x onto stack."""
<|body_1|>
def pop(self) -> int:
"""Removes the element on top of the stack and returns that eleme... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MyStack:
def __init__(self):
"""Initialize your data structure here."""
self.queue1 = deque([])
self.queue2 = deque([])
self.flag = True
def push(self, x: int) -> None:
"""Push element x onto stack."""
if self.flag:
self.queue2.append(x)
... | the_stack_v2_python_sparse | review_code2/0802_stack.py | yliu6680/algorithm_note | train | 0 | |
4a0521e733d7580ef3eba6519f3e26a369b68637 | [
"super().__init__()\nself.in_channels = in_channels\nself.out_channels = out_channels\nself.spherical_cheb_bn_1 = SphericalChebBN(in_channels, middle_channels, lap, kernel_size)\nself.spherical_cheb_bn_2 = SphericalChebBN(middle_channels, out_channels, lap, kernel_size)",
"x = self.spherical_cheb_bn_1(x)\nx = sel... | <|body_start_0|>
super().__init__()
self.in_channels = in_channels
self.out_channels = out_channels
self.spherical_cheb_bn_1 = SphericalChebBN(in_channels, middle_channels, lap, kernel_size)
self.spherical_cheb_bn_2 = SphericalChebBN(middle_channels, out_channels, lap, kernel_siz... | Building Block made of 2 Building Blocks (convolution, batchnorm, activation). | SphericalChebBN2 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SphericalChebBN2:
"""Building Block made of 2 Building Blocks (convolution, batchnorm, activation)."""
def __init__(self, in_channels, middle_channels, out_channels, lap, kernel_size):
"""Initialization. Args: in_channels (int): initial number of channels. middle_channels (int): midd... | stack_v2_sparse_classes_36k_train_016038 | 41,403 | no_license | [
{
"docstring": "Initialization. Args: in_channels (int): initial number of channels. middle_channels (int): middle number of channels. out_channels (int): output number of channels. lap (:obj:`torch.sparse.FloatTensor`): laplacian. kernel_size (int, optional): polynomial degree.",
"name": "__init__",
"s... | 2 | stack_v2_sparse_classes_30k_train_021133 | Implement the Python class `SphericalChebBN2` described below.
Class description:
Building Block made of 2 Building Blocks (convolution, batchnorm, activation).
Method signatures and docstrings:
- def __init__(self, in_channels, middle_channels, out_channels, lap, kernel_size): Initialization. Args: in_channels (int)... | Implement the Python class `SphericalChebBN2` described below.
Class description:
Building Block made of 2 Building Blocks (convolution, batchnorm, activation).
Method signatures and docstrings:
- def __init__(self, in_channels, middle_channels, out_channels, lap, kernel_size): Initialization. Args: in_channels (int)... | 7e55a422588c1d1e00f35a3d3a3ff896cce59e18 | <|skeleton|>
class SphericalChebBN2:
"""Building Block made of 2 Building Blocks (convolution, batchnorm, activation)."""
def __init__(self, in_channels, middle_channels, out_channels, lap, kernel_size):
"""Initialization. Args: in_channels (int): initial number of channels. middle_channels (int): midd... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SphericalChebBN2:
"""Building Block made of 2 Building Blocks (convolution, batchnorm, activation)."""
def __init__(self, in_channels, middle_channels, out_channels, lap, kernel_size):
"""Initialization. Args: in_channels (int): initial number of channels. middle_channels (int): middle number of ... | the_stack_v2_python_sparse | generated/test_deepsphere_deepsphere_pytorch.py | jansel/pytorch-jit-paritybench | train | 35 |
2968199be47606452dbc768461fa40782dc26323 | [
"trigger = TimerTrigger(self.mudpi, config)\nself.add_component(trigger)\nreturn True",
"if not isinstance(config, list):\n config = [config]\nfor conf in config:\n if not conf.get('key'):\n raise ConfigError('Missing `key` in Timer Trigger config.')\nreturn config",
"self.register_component_action... | <|body_start_0|>
trigger = TimerTrigger(self.mudpi, config)
self.add_component(trigger)
return True
<|end_body_0|>
<|body_start_1|>
if not isinstance(config, list):
config = [config]
for conf in config:
if not conf.get('key'):
raise Config... | Interface | [
"BSD-4-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Interface:
def load(self, config):
"""Load timer trigger component from configs"""
<|body_0|>
def validate(self, config):
"""Validate the trigger config"""
<|body_1|>
def register_actions(self):
"""Register any interface actions"""
<|body... | stack_v2_sparse_classes_36k_train_016039 | 6,506 | permissive | [
{
"docstring": "Load timer trigger component from configs",
"name": "load",
"signature": "def load(self, config)"
},
{
"docstring": "Validate the trigger config",
"name": "validate",
"signature": "def validate(self, config)"
},
{
"docstring": "Register any interface actions",
... | 3 | stack_v2_sparse_classes_30k_train_015612 | Implement the Python class `Interface` described below.
Class description:
Implement the Interface class.
Method signatures and docstrings:
- def load(self, config): Load timer trigger component from configs
- def validate(self, config): Validate the trigger config
- def register_actions(self): Register any interface... | Implement the Python class `Interface` described below.
Class description:
Implement the Interface class.
Method signatures and docstrings:
- def load(self, config): Load timer trigger component from configs
- def validate(self, config): Validate the trigger config
- def register_actions(self): Register any interface... | fb206b1136f529c7197f1e6b29629ed05630d377 | <|skeleton|>
class Interface:
def load(self, config):
"""Load timer trigger component from configs"""
<|body_0|>
def validate(self, config):
"""Validate the trigger config"""
<|body_1|>
def register_actions(self):
"""Register any interface actions"""
<|body... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Interface:
def load(self, config):
"""Load timer trigger component from configs"""
trigger = TimerTrigger(self.mudpi, config)
self.add_component(trigger)
return True
def validate(self, config):
"""Validate the trigger config"""
if not isinstance(config, lis... | the_stack_v2_python_sparse | mudpi/extensions/timer/trigger.py | mistasp0ck/mudpi-core | train | 0 | |
f42560d4f76a58f494805fdc9edc25fa12563262 | [
"super().__init__(hass, _LOGGER, name=DOMAIN, update_interval=UPDATE_INTERVAL)\nself.entry = entry\nself.api = HomeWizardEnergy(host, clientsession=async_get_clientsession(hass))",
"try:\n data = DeviceResponseEntry(device=await self.api.device(), data=await self.api.data())\n try:\n if self.supports... | <|body_start_0|>
super().__init__(hass, _LOGGER, name=DOMAIN, update_interval=UPDATE_INTERVAL)
self.entry = entry
self.api = HomeWizardEnergy(host, clientsession=async_get_clientsession(hass))
<|end_body_0|>
<|body_start_1|>
try:
data = DeviceResponseEntry(device=await self.... | Gather data for the energy device. | HWEnergyDeviceUpdateCoordinator | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HWEnergyDeviceUpdateCoordinator:
"""Gather data for the energy device."""
def __init__(self, hass: HomeAssistant, entry: ConfigEntry, host: str) -> None:
"""Initialize update coordinator."""
<|body_0|>
async def _async_update_data(self) -> DeviceResponseEntry:
""... | stack_v2_sparse_classes_36k_train_016040 | 3,525 | permissive | [
{
"docstring": "Initialize update coordinator.",
"name": "__init__",
"signature": "def __init__(self, hass: HomeAssistant, entry: ConfigEntry, host: str) -> None"
},
{
"docstring": "Fetch all device and sensor data from api.",
"name": "_async_update_data",
"signature": "async def _async_... | 5 | null | Implement the Python class `HWEnergyDeviceUpdateCoordinator` described below.
Class description:
Gather data for the energy device.
Method signatures and docstrings:
- def __init__(self, hass: HomeAssistant, entry: ConfigEntry, host: str) -> None: Initialize update coordinator.
- async def _async_update_data(self) ->... | Implement the Python class `HWEnergyDeviceUpdateCoordinator` described below.
Class description:
Gather data for the energy device.
Method signatures and docstrings:
- def __init__(self, hass: HomeAssistant, entry: ConfigEntry, host: str) -> None: Initialize update coordinator.
- async def _async_update_data(self) ->... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class HWEnergyDeviceUpdateCoordinator:
"""Gather data for the energy device."""
def __init__(self, hass: HomeAssistant, entry: ConfigEntry, host: str) -> None:
"""Initialize update coordinator."""
<|body_0|>
async def _async_update_data(self) -> DeviceResponseEntry:
""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HWEnergyDeviceUpdateCoordinator:
"""Gather data for the energy device."""
def __init__(self, hass: HomeAssistant, entry: ConfigEntry, host: str) -> None:
"""Initialize update coordinator."""
super().__init__(hass, _LOGGER, name=DOMAIN, update_interval=UPDATE_INTERVAL)
self.entry =... | the_stack_v2_python_sparse | homeassistant/components/homewizard/coordinator.py | home-assistant/core | train | 35,501 |
b3b1b4266cafe7327db1f305385e010c22976a5b | [
"logger.info('Processing BS Filter')\nif configuration is None:\n configuration = {}\nself.configuration.update(configuration)",
"output_results_files = {}\noutput_metadata = {}\nlogger.info('BS-Filter')\nfrt = filterReadsTool(self.configuration)\nlogger.progress('BSseeker2 Filter', status='RUNNING')\nfastq1f,... | <|body_start_0|>
logger.info('Processing BS Filter')
if configuration is None:
configuration = {}
self.configuration.update(configuration)
<|end_body_0|>
<|body_start_1|>
output_results_files = {}
output_metadata = {}
logger.info('BS-Filter')
frt = fi... | Functions for filtering FASTQ files. Files are filtered for removal of duplicate reads. Low quality reads in qseq file can also be filtered. | process_bsFilter | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class process_bsFilter:
"""Functions for filtering FASTQ files. Files are filtered for removal of duplicate reads. Low quality reads in qseq file can also be filtered."""
def __init__(self, configuration=None):
"""Initialise the class Parameters ---------- configuration : dict a dictionary... | stack_v2_sparse_classes_36k_train_016041 | 6,373 | permissive | [
{
"docstring": "Initialise the class Parameters ---------- configuration : dict a dictionary containing parameters that define how the operation should be carried out, which are specific to each Tool.",
"name": "__init__",
"signature": "def __init__(self, configuration=None)"
},
{
"docstring": "... | 2 | stack_v2_sparse_classes_30k_train_005233 | Implement the Python class `process_bsFilter` described below.
Class description:
Functions for filtering FASTQ files. Files are filtered for removal of duplicate reads. Low quality reads in qseq file can also be filtered.
Method signatures and docstrings:
- def __init__(self, configuration=None): Initialise the clas... | Implement the Python class `process_bsFilter` described below.
Class description:
Functions for filtering FASTQ files. Files are filtered for removal of duplicate reads. Low quality reads in qseq file can also be filtered.
Method signatures and docstrings:
- def __init__(self, configuration=None): Initialise the clas... | 50c7115c0c1a6af48dc34f275e469d1b9eb02999 | <|skeleton|>
class process_bsFilter:
"""Functions for filtering FASTQ files. Files are filtered for removal of duplicate reads. Low quality reads in qseq file can also be filtered."""
def __init__(self, configuration=None):
"""Initialise the class Parameters ---------- configuration : dict a dictionary... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class process_bsFilter:
"""Functions for filtering FASTQ files. Files are filtered for removal of duplicate reads. Low quality reads in qseq file can also be filtered."""
def __init__(self, configuration=None):
"""Initialise the class Parameters ---------- configuration : dict a dictionary containing p... | the_stack_v2_python_sparse | process_bs_seeker_filter.py | Multiscale-Genomics/mg-process-fastq | train | 2 |
1c83950c8bd6700a1a2172d3cdb6d38ab3537b45 | [
"self.pump = Pump('127.0.0.1', 8000)\nself.sensor = Sensor('127.0.0.1', 8000)\nself.decider = Decider(target_height=100, margin=0.05)\nself.controller = Controller(self.sensor, self.pump, self.decider)\nself.pump.set_state = MagicMock(return_value=True)",
"self.sensor.measure = MagicMock(return_value=125)\nself.p... | <|body_start_0|>
self.pump = Pump('127.0.0.1', 8000)
self.sensor = Sensor('127.0.0.1', 8000)
self.decider = Decider(target_height=100, margin=0.05)
self.controller = Controller(self.sensor, self.pump, self.decider)
self.pump.set_state = MagicMock(return_value=True)
<|end_body_0|>... | Module tests for the water-regulation module | ModuleTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModuleTests:
"""Module tests for the water-regulation module"""
def setUp(self):
"""Sets up pump, sensor, decider and controller for use with unit tests."""
<|body_0|>
def test_waterregulation(self):
"""Random integration tests for water-regulation module"""
... | stack_v2_sparse_classes_36k_train_016042 | 2,197 | no_license | [
{
"docstring": "Sets up pump, sensor, decider and controller for use with unit tests.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Random integration tests for water-regulation module",
"name": "test_waterregulation",
"signature": "def test_waterregulation(self)"
... | 2 | null | Implement the Python class `ModuleTests` described below.
Class description:
Module tests for the water-regulation module
Method signatures and docstrings:
- def setUp(self): Sets up pump, sensor, decider and controller for use with unit tests.
- def test_waterregulation(self): Random integration tests for water-regu... | Implement the Python class `ModuleTests` described below.
Class description:
Module tests for the water-regulation module
Method signatures and docstrings:
- def setUp(self): Sets up pump, sensor, decider and controller for use with unit tests.
- def test_waterregulation(self): Random integration tests for water-regu... | b1fea0309b3495b3e1dc167d7029bc9e4b6f00f1 | <|skeleton|>
class ModuleTests:
"""Module tests for the water-regulation module"""
def setUp(self):
"""Sets up pump, sensor, decider and controller for use with unit tests."""
<|body_0|>
def test_waterregulation(self):
"""Random integration tests for water-regulation module"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ModuleTests:
"""Module tests for the water-regulation module"""
def setUp(self):
"""Sets up pump, sensor, decider and controller for use with unit tests."""
self.pump = Pump('127.0.0.1', 8000)
self.sensor = Sensor('127.0.0.1', 8000)
self.decider = Decider(target_height=100... | the_stack_v2_python_sparse | students/Dennis_Coffey/lesson06/water-regulation/waterregulation/integrationtest.py | UWPCE-PythonCert-ClassRepos/SP_Online_Course2_2018 | train | 4 |
ccc9ea9bcf06f62eeb0b6f8cf9c9d24e71d3f002 | [
"board = self.board_class()\nboard.place_token(1, 1, 'X')\nboard.place_token(0, 0, 'O')\nboard.place_token(1, 0, 'X')\nassert str(board) == 'O|X| \\n |X| \\n | | \\n'",
"board = self.board_class()\nboard.place_token(1, 1, 'X')\nboard.place_token(0, 0, 'O')\nboard.place_token(1, 0, 'X')\nboard.place_token(0, 2, 'O... | <|body_start_0|>
board = self.board_class()
board.place_token(1, 1, 'X')
board.place_token(0, 0, 'O')
board.place_token(1, 0, 'X')
assert str(board) == 'O|X| \n |X| \n | | \n'
<|end_body_0|>
<|body_start_1|>
board = self.board_class()
board.place_token(1, 1, 'X')... | Test class that will test a board. Store the class to be tested in a board_class class variable. | BaseBoardTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseBoardTest:
"""Test class that will test a board. Store the class to be tested in a board_class class variable."""
def test_str(self):
"""Test that the magic string method on a full board works."""
<|body_0|>
def test_calc_winner_none(self):
"""Test that calcu... | stack_v2_sparse_classes_36k_train_016043 | 1,716 | no_license | [
{
"docstring": "Test that the magic string method on a full board works.",
"name": "test_str",
"signature": "def test_str(self)"
},
{
"docstring": "Test that calculating a winner returns None when no winner.",
"name": "test_calc_winner_none",
"signature": "def test_calc_winner_none(self)... | 3 | stack_v2_sparse_classes_30k_train_001753 | Implement the Python class `BaseBoardTest` described below.
Class description:
Test class that will test a board. Store the class to be tested in a board_class class variable.
Method signatures and docstrings:
- def test_str(self): Test that the magic string method on a full board works.
- def test_calc_winner_none(s... | Implement the Python class `BaseBoardTest` described below.
Class description:
Test class that will test a board. Store the class to be tested in a board_class class variable.
Method signatures and docstrings:
- def test_str(self): Test that the magic string method on a full board works.
- def test_calc_winner_none(s... | 1c77e724b3f11a97998972f5a1f65593257e1c99 | <|skeleton|>
class BaseBoardTest:
"""Test class that will test a board. Store the class to be tested in a board_class class variable."""
def test_str(self):
"""Test that the magic string method on a full board works."""
<|body_0|>
def test_calc_winner_none(self):
"""Test that calcu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BaseBoardTest:
"""Test class that will test a board. Store the class to be tested in a board_class class variable."""
def test_str(self):
"""Test that the magic string method on a full board works."""
board = self.board_class()
board.place_token(1, 1, 'X')
board.place_toke... | the_stack_v2_python_sparse | practice/ttt-interface/boards_test.py | PdxCodeGuild/Full-Stack-Day-Class | train | 7 |
106e17fc4868a6b4f7e486540f0b9e41e4aba3c8 | [
"assert isinstance(schema, Struct), 'Schema must be a schema.Struct'\nfor name, child in schema.get_children():\n assert isinstance(child, Scalar), 'Only scalar fields are supported in TextFileReader.'\nfield_types = [data_type_for_dtype(dtype) for dtype in schema.field_types()]\nReader.__init__(self, schema)\ns... | <|body_start_0|>
assert isinstance(schema, Struct), 'Schema must be a schema.Struct'
for name, child in schema.get_children():
assert isinstance(child, Scalar), 'Only scalar fields are supported in TextFileReader.'
field_types = [data_type_for_dtype(dtype) for dtype in schema.field_t... | Wrapper around operators for reading from text files. | TextFileReader | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TextFileReader:
"""Wrapper around operators for reading from text files."""
def __init__(self, init_net, filename, schema, num_passes=1, batch_size=1):
"""Create op for building a TextFileReader instance in the workspace. Args: init_net : Net that will be run only once at startup. fi... | stack_v2_sparse_classes_36k_train_016044 | 2,123 | permissive | [
{
"docstring": "Create op for building a TextFileReader instance in the workspace. Args: init_net : Net that will be run only once at startup. filename : Path to file to read from. schema : schema.Struct representing the schema of the data. Currently, only support Struct of strings. num_passes : Number of passe... | 2 | null | Implement the Python class `TextFileReader` described below.
Class description:
Wrapper around operators for reading from text files.
Method signatures and docstrings:
- def __init__(self, init_net, filename, schema, num_passes=1, batch_size=1): Create op for building a TextFileReader instance in the workspace. Args:... | Implement the Python class `TextFileReader` described below.
Class description:
Wrapper around operators for reading from text files.
Method signatures and docstrings:
- def __init__(self, init_net, filename, schema, num_passes=1, batch_size=1): Create op for building a TextFileReader instance in the workspace. Args:... | cabf6e4f1970dc14302f87414f170de19944bac2 | <|skeleton|>
class TextFileReader:
"""Wrapper around operators for reading from text files."""
def __init__(self, init_net, filename, schema, num_passes=1, batch_size=1):
"""Create op for building a TextFileReader instance in the workspace. Args: init_net : Net that will be run only once at startup. fi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TextFileReader:
"""Wrapper around operators for reading from text files."""
def __init__(self, init_net, filename, schema, num_passes=1, batch_size=1):
"""Create op for building a TextFileReader instance in the workspace. Args: init_net : Net that will be run only once at startup. filename : Path... | the_stack_v2_python_sparse | pytorch/source/caffe2/python/text_file_reader.py | ryfeus/lambda-packs | train | 1,283 |
69fdf7292ea892b1421982e198fa611bb973b4d1 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')"
] | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | A session represents an interaction with a user. You retrieve user input and pass it to the [DetectIntent][google.cloud.dialogflow.v2.Sessions.DetectIntent] (or [StreamingDetectIntent][google.cloud.dialogflow.v2.Sessions.StreamingDetectIntent]) method to determine user intent and respond. | SessionsServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SessionsServicer:
"""A session represents an interaction with a user. You retrieve user input and pass it to the [DetectIntent][google.cloud.dialogflow.v2.Sessions.DetectIntent] (or [StreamingDetectIntent][google.cloud.dialogflow.v2.Sessions.StreamingDetectIntent]) method to determine user intent... | stack_v2_sparse_classes_36k_train_016045 | 3,682 | permissive | [
{
"docstring": "Processes a natural language query and returns structured, actionable data as a result. This method is not idempotent, because it may cause contexts and session entity types to be updated, which in turn might affect results of future queries.",
"name": "DetectIntent",
"signature": "def D... | 2 | stack_v2_sparse_classes_30k_test_000786 | Implement the Python class `SessionsServicer` described below.
Class description:
A session represents an interaction with a user. You retrieve user input and pass it to the [DetectIntent][google.cloud.dialogflow.v2.Sessions.DetectIntent] (or [StreamingDetectIntent][google.cloud.dialogflow.v2.Sessions.StreamingDetectI... | Implement the Python class `SessionsServicer` described below.
Class description:
A session represents an interaction with a user. You retrieve user input and pass it to the [DetectIntent][google.cloud.dialogflow.v2.Sessions.DetectIntent] (or [StreamingDetectIntent][google.cloud.dialogflow.v2.Sessions.StreamingDetectI... | c9c830feb6b66c2e362f8fb5d147ef0c4f4a08cf | <|skeleton|>
class SessionsServicer:
"""A session represents an interaction with a user. You retrieve user input and pass it to the [DetectIntent][google.cloud.dialogflow.v2.Sessions.DetectIntent] (or [StreamingDetectIntent][google.cloud.dialogflow.v2.Sessions.StreamingDetectIntent]) method to determine user intent... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SessionsServicer:
"""A session represents an interaction with a user. You retrieve user input and pass it to the [DetectIntent][google.cloud.dialogflow.v2.Sessions.DetectIntent] (or [StreamingDetectIntent][google.cloud.dialogflow.v2.Sessions.StreamingDetectIntent]) method to determine user intent and respond.... | the_stack_v2_python_sparse | pyenv/lib/python3.6/site-packages/dialogflow_v2/proto/session_pb2_grpc.py | ronald-rgr/ai-chatbot-smartguide | train | 0 |
e8803fb0b37441fc39afd7061341d8695d73ff35 | [
"super(__class__, self).__init__()\nself.parent = parent\nself.app = app\nuic.loadUi(self.app.theme['ui_path'] + '/AddBlockedDialog.ui', self)\nself.setWindowTitle('TROLLSLUM')\nself.setWindowIcon(QIcon(app.theme['path'] + '/trayicon.png'))\nself.acceptButton.clicked.connect(self.accepted)\nself.rejectButton.clicke... | <|body_start_0|>
super(__class__, self).__init__()
self.parent = parent
self.app = app
uic.loadUi(self.app.theme['ui_path'] + '/AddBlockedDialog.ui', self)
self.setWindowTitle('TROLLSLUM')
self.setWindowIcon(QIcon(app.theme['path'] + '/trayicon.png'))
self.acceptB... | AddBlockedDialog | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AddBlockedDialog:
def __init__(self, app, parent):
"""Dialog opened when the Add button is pressed in TROLLSLUM, adds to parent.blockedList widget"""
<|body_0|>
def accepted(self):
"""Call once accepted, check if name is alphanumeric if not warn and try again"""
... | stack_v2_sparse_classes_36k_train_016046 | 40,316 | permissive | [
{
"docstring": "Dialog opened when the Add button is pressed in TROLLSLUM, adds to parent.blockedList widget",
"name": "__init__",
"signature": "def __init__(self, app, parent)"
},
{
"docstring": "Call once accepted, check if name is alphanumeric if not warn and try again",
"name": "accepted... | 2 | stack_v2_sparse_classes_30k_train_010651 | Implement the Python class `AddBlockedDialog` described below.
Class description:
Implement the AddBlockedDialog class.
Method signatures and docstrings:
- def __init__(self, app, parent): Dialog opened when the Add button is pressed in TROLLSLUM, adds to parent.blockedList widget
- def accepted(self): Call once acce... | Implement the Python class `AddBlockedDialog` described below.
Class description:
Implement the AddBlockedDialog class.
Method signatures and docstrings:
- def __init__(self, app, parent): Dialog opened when the Add button is pressed in TROLLSLUM, adds to parent.blockedList widget
- def accepted(self): Call once acce... | 70be67f3671b35aa6cbe6e4eb66a4a1c07707ce3 | <|skeleton|>
class AddBlockedDialog:
def __init__(self, app, parent):
"""Dialog opened when the Add button is pressed in TROLLSLUM, adds to parent.blockedList widget"""
<|body_0|>
def accepted(self):
"""Call once accepted, check if name is alphanumeric if not warn and try again"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AddBlockedDialog:
def __init__(self, app, parent):
"""Dialog opened when the Add button is pressed in TROLLSLUM, adds to parent.blockedList widget"""
super(__class__, self).__init__()
self.parent = parent
self.app = app
uic.loadUi(self.app.theme['ui_path'] + '/AddBlocke... | the_stack_v2_python_sparse | dialogs.py | henry232323/Pesterchum-Discord | train | 28 | |
f962c905ff1f8668c807947da0b0830cba42c39d | [
"try:\n content_list = FacadeContent.get_list(search)\n print('RETURNING CONTENT LIST')\n return json.dumps(content_list)\nexcept Exception as e:\n raise ServiceException('USER_DATABASE_QUERY_FAIL', 'Unable to fetch content.', str(e))",
"try:\n FacadeContent.add(entity)\n print('ADDING CONTENT L... | <|body_start_0|>
try:
content_list = FacadeContent.get_list(search)
print('RETURNING CONTENT LIST')
return json.dumps(content_list)
except Exception as e:
raise ServiceException('USER_DATABASE_QUERY_FAIL', 'Unable to fetch content.', str(e))
<|end_body_0|>... | Content management class | Content | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Content:
"""Content management class"""
def get_content_list(search):
"""Get a content list data :param search: search parameter :return: A List of Dictionary with all the item information"""
<|body_0|>
def add_content(entity):
"""Add content to content list data... | stack_v2_sparse_classes_36k_train_016047 | 4,942 | no_license | [
{
"docstring": "Get a content list data :param search: search parameter :return: A List of Dictionary with all the item information",
"name": "get_content_list",
"signature": "def get_content_list(search)"
},
{
"docstring": "Add content to content list data :param entity: content to be added :re... | 5 | stack_v2_sparse_classes_30k_train_018323 | Implement the Python class `Content` described below.
Class description:
Content management class
Method signatures and docstrings:
- def get_content_list(search): Get a content list data :param search: search parameter :return: A List of Dictionary with all the item information
- def add_content(entity): Add content... | Implement the Python class `Content` described below.
Class description:
Content management class
Method signatures and docstrings:
- def get_content_list(search): Get a content list data :param search: search parameter :return: A List of Dictionary with all the item information
- def add_content(entity): Add content... | 8dd3118eab24ee3992bc345573f4bb427930b30c | <|skeleton|>
class Content:
"""Content management class"""
def get_content_list(search):
"""Get a content list data :param search: search parameter :return: A List of Dictionary with all the item information"""
<|body_0|>
def add_content(entity):
"""Add content to content list data... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Content:
"""Content management class"""
def get_content_list(search):
"""Get a content list data :param search: search parameter :return: A List of Dictionary with all the item information"""
try:
content_list = FacadeContent.get_list(search)
print('RETURNING CONTE... | the_stack_v2_python_sparse | content/bl/content.py | amityadav17/catalog | train | 0 |
01bc48ed390f6ab5ba16eb0a4249940853b27f48 | [
"if lazy_numer is None:\n self.lazy_numer = int(points_number / 10) + 1\nelse:\n self.lazy_numer = lazy_numer\nneighborhood_radius = 1\nsuper().__init__(points_number, neighborhood_radius, dim_network, dist_func_points, net_dist_to_lr, points_to_aprox, self.lazy_numer)",
"for pos_net, pos_space in self.neur... | <|body_start_0|>
if lazy_numer is None:
self.lazy_numer = int(points_number / 10) + 1
else:
self.lazy_numer = lazy_numer
neighborhood_radius = 1
super().__init__(points_number, neighborhood_radius, dim_network, dist_func_points, net_dist_to_lr, points_to_aprox, se... | Implementation neuron gas | Kohonen_network | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Kohonen_network:
"""Implementation neuron gas"""
def __init__(self, points_number, points_to_aprox, neighborhood_radius=1, net_dist_to_lr=GNF, dist_func_points=E_dist, lazy_numer=None, lr=0.2, dim_network=1):
"""Args: points_number: number of points to approximate dinm_network: numbe... | stack_v2_sparse_classes_36k_train_016048 | 2,416 | no_license | [
{
"docstring": "Args: points_number: number of points to approximate dinm_network: number of dimensions of network organization dist_func: callable object that takes two points of from points_to_aprox and returns distance between them net_dist_to_lr: callable object that takes poison of two neurons and returns ... | 2 | stack_v2_sparse_classes_30k_train_018462 | Implement the Python class `Kohonen_network` described below.
Class description:
Implementation neuron gas
Method signatures and docstrings:
- def __init__(self, points_number, points_to_aprox, neighborhood_radius=1, net_dist_to_lr=GNF, dist_func_points=E_dist, lazy_numer=None, lr=0.2, dim_network=1): Args: points_nu... | Implement the Python class `Kohonen_network` described below.
Class description:
Implementation neuron gas
Method signatures and docstrings:
- def __init__(self, points_number, points_to_aprox, neighborhood_radius=1, net_dist_to_lr=GNF, dist_func_points=E_dist, lazy_numer=None, lr=0.2, dim_network=1): Args: points_nu... | 2609bf83e00e1d8773f127e10d9c140341397554 | <|skeleton|>
class Kohonen_network:
"""Implementation neuron gas"""
def __init__(self, points_number, points_to_aprox, neighborhood_radius=1, net_dist_to_lr=GNF, dist_func_points=E_dist, lazy_numer=None, lr=0.2, dim_network=1):
"""Args: points_number: number of points to approximate dinm_network: numbe... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Kohonen_network:
"""Implementation neuron gas"""
def __init__(self, points_number, points_to_aprox, neighborhood_radius=1, net_dist_to_lr=GNF, dist_func_points=E_dist, lazy_numer=None, lr=0.2, dim_network=1):
"""Args: points_number: number of points to approximate dinm_network: number of dimensio... | the_stack_v2_python_sparse | Zadanie2/SOM/Kohonen_network.py | PatrykLisik/iad | train | 0 |
7f7d9a36ac14170a0235e3013451a3b7d78552a1 | [
"super().__init__()\nni = in_shape\nfor i, no in enumerate(units):\n setattr(self, f'fc{i}', nn.Linear(ni, no))\n ni = no\nself.activation_fn = activation_fn\nself.nlayers = len(units)\nself.activate_last = activate_last",
"for i in range(self.nlayers - 1):\n x = self.activation_fn(getattr(self, f'fc{i}'... | <|body_start_0|>
super().__init__()
ni = in_shape
for i, no in enumerate(units):
setattr(self, f'fc{i}', nn.Linear(ni, no))
ni = no
self.activation_fn = activation_fn
self.nlayers = len(units)
self.activate_last = activate_last
<|end_body_0|>
<|bo... | Feed forward network. | FeedForwardNet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FeedForwardNet:
"""Feed forward network."""
def __init__(self, in_shape, units=[], activation_fn=F.relu, activate_last=False):
"""Init. Creates a simple feed forward net. Example: net = FeedForwardNet(16, [32,32,1]) Args: in_shape (int): number of channels of the input to the network... | stack_v2_sparse_classes_36k_train_016049 | 4,966 | no_license | [
{
"docstring": "Init. Creates a simple feed forward net. Example: net = FeedForwardNet(16, [32,32,1]) Args: in_shape (int): number of channels of the input to the network. units (list): The number of units in each layer. The length of the list denotes the number of layers. activation_fn (callable): The activati... | 2 | stack_v2_sparse_classes_30k_train_018050 | Implement the Python class `FeedForwardNet` described below.
Class description:
Feed forward network.
Method signatures and docstrings:
- def __init__(self, in_shape, units=[], activation_fn=F.relu, activate_last=False): Init. Creates a simple feed forward net. Example: net = FeedForwardNet(16, [32,32,1]) Args: in_sh... | Implement the Python class `FeedForwardNet` described below.
Class description:
Feed forward network.
Method signatures and docstrings:
- def __init__(self, in_shape, units=[], activation_fn=F.relu, activate_last=False): Init. Creates a simple feed forward net. Example: net = FeedForwardNet(16, [32,32,1]) Args: in_sh... | e71c4b12955b01bfb907aa31c91ded6bcd8aaec8 | <|skeleton|>
class FeedForwardNet:
"""Feed forward network."""
def __init__(self, in_shape, units=[], activation_fn=F.relu, activate_last=False):
"""Init. Creates a simple feed forward net. Example: net = FeedForwardNet(16, [32,32,1]) Args: in_shape (int): number of channels of the input to the network... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FeedForwardNet:
"""Feed forward network."""
def __init__(self, in_shape, units=[], activation_fn=F.relu, activate_last=False):
"""Init. Creates a simple feed forward net. Example: net = FeedForwardNet(16, [32,32,1]) Args: in_shape (int): number of channels of the input to the network. units (list... | the_stack_v2_python_sparse | dl/modules/core.py | cbschaff/dl | train | 1 |
cefbd0464db5762ad670394baf0502c961302603 | [
"self.caffe = Caffe.objects.create(name='kafo', city='Gliwice', street='Wieczorka', house_number='14', postal_code='44-100')\nself.filtry = Caffe.objects.create(name='filtry', city='Warszawa', street='Filry', house_number='14', postal_code='44-100')\nself.cakes = Category.objects.create(name='cakes', caffe=self.caf... | <|body_start_0|>
self.caffe = Caffe.objects.create(name='kafo', city='Gliwice', street='Wieczorka', house_number='14', postal_code='44-100')
self.filtry = Caffe.objects.create(name='filtry', city='Warszawa', street='Filry', house_number='14', postal_code='44-100')
self.cakes = Category.objects.c... | Product tests. | ProductModelTest | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProductModelTest:
"""Product tests."""
def setUp(self):
"""Test data setup."""
<|body_0|>
def test_product(self):
"""Check correctness of creating products and validation."""
<|body_1|>
def test_product_validation(self):
"""Check if Product m... | stack_v2_sparse_classes_36k_train_016050 | 14,711 | permissive | [
{
"docstring": "Test data setup.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Check correctness of creating products and validation.",
"name": "test_product",
"signature": "def test_product(self)"
},
{
"docstring": "Check if Product model is properly valid... | 3 | stack_v2_sparse_classes_30k_train_002072 | Implement the Python class `ProductModelTest` described below.
Class description:
Product tests.
Method signatures and docstrings:
- def setUp(self): Test data setup.
- def test_product(self): Check correctness of creating products and validation.
- def test_product_validation(self): Check if Product model is properl... | Implement the Python class `ProductModelTest` described below.
Class description:
Product tests.
Method signatures and docstrings:
- def setUp(self): Test data setup.
- def test_product(self): Check correctness of creating products and validation.
- def test_product_validation(self): Check if Product model is properl... | cdb7f5edb29255c7e874eaa6231621063210a8b0 | <|skeleton|>
class ProductModelTest:
"""Product tests."""
def setUp(self):
"""Test data setup."""
<|body_0|>
def test_product(self):
"""Check correctness of creating products and validation."""
<|body_1|>
def test_product_validation(self):
"""Check if Product m... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProductModelTest:
"""Product tests."""
def setUp(self):
"""Test data setup."""
self.caffe = Caffe.objects.create(name='kafo', city='Gliwice', street='Wieczorka', house_number='14', postal_code='44-100')
self.filtry = Caffe.objects.create(name='filtry', city='Warszawa', street='Fil... | the_stack_v2_python_sparse | caffe/reports/test_models.py | VirrageS/io-kawiarnie | train | 3 |
00d1355c4758fcaf0a9db7003b749f9795d8ef44 | [
"self.threaded = threaded\nself.colorize = colorize\nkwargs['fmt'] = LOG_FORMAT.format('', '', color='')\nif self.colorize:\n color = ''\n if random_color:\n color = random.choice(COLOR_SEQS)\n kwargs['fmt'] = LOG_FORMAT.format(BOLD, RESET_SEQ, color=color)\nsuper(WolfFormatter, self).__init__(**kwa... | <|body_start_0|>
self.threaded = threaded
self.colorize = colorize
kwargs['fmt'] = LOG_FORMAT.format('', '', color='')
if self.colorize:
color = ''
if random_color:
color = random.choice(COLOR_SEQS)
kwargs['fmt'] = LOG_FORMAT.format(BOL... | Helper class used to add color to log messages depending on their level. | WolfFormatter | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WolfFormatter:
"""Helper class used to add color to log messages depending on their level."""
def __init__(self, colorize: bool=True, random_color: bool=False, threaded: bool=False, **kwargs: Any) -> None:
"""Initializes the WolfFormatter object. Args: colorize (bool): If True, outpu... | stack_v2_sparse_classes_36k_train_016051 | 3,839 | permissive | [
{
"docstring": "Initializes the WolfFormatter object. Args: colorize (bool): If True, output will be colorized. random_color (bool): If True, will colorize the module name with a random color picked from COLOR_SEQS.",
"name": "__init__",
"signature": "def __init__(self, colorize: bool=True, random_color... | 2 | stack_v2_sparse_classes_30k_train_002129 | Implement the Python class `WolfFormatter` described below.
Class description:
Helper class used to add color to log messages depending on their level.
Method signatures and docstrings:
- def __init__(self, colorize: bool=True, random_color: bool=False, threaded: bool=False, **kwargs: Any) -> None: Initializes the Wo... | Implement the Python class `WolfFormatter` described below.
Class description:
Helper class used to add color to log messages depending on their level.
Method signatures and docstrings:
- def __init__(self, colorize: bool=True, random_color: bool=False, threaded: bool=False, **kwargs: Any) -> None: Initializes the Wo... | bcea85b1ce7a0feb2aa28b5be4fc6ae124e8ca3c | <|skeleton|>
class WolfFormatter:
"""Helper class used to add color to log messages depending on their level."""
def __init__(self, colorize: bool=True, random_color: bool=False, threaded: bool=False, **kwargs: Any) -> None:
"""Initializes the WolfFormatter object. Args: colorize (bool): If True, outpu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WolfFormatter:
"""Helper class used to add color to log messages depending on their level."""
def __init__(self, colorize: bool=True, random_color: bool=False, threaded: bool=False, **kwargs: Any) -> None:
"""Initializes the WolfFormatter object. Args: colorize (bool): If True, output will be col... | the_stack_v2_python_sparse | dftimewolf/lib/logging_utils.py | log2timeline/dftimewolf | train | 248 |
e43edefa8af0c62c0c8b5743927c799f340d750e | [
"if len(nums1) == 0:\n return n\nif len(nums2) == 0:\n return m\npi = 0\npj = 0\nd = 0\nwhile pi < m + n and pj < n:\n if nums1[pi] >= nums2[pj]:\n nums1.insert(pi, nums2[pj])\n d += 1\n pj += 1\n if nums1[pi] == 0 and pi >= m + d:\n nums1.insert(pi, nums2[pj])\n d += ... | <|body_start_0|>
if len(nums1) == 0:
return n
if len(nums2) == 0:
return m
pi = 0
pj = 0
d = 0
while pi < m + n and pj < n:
if nums1[pi] >= nums2[pj]:
nums1.insert(pi, nums2[pj])
d += 1
pj... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def merge(self, nums1, m: int, nums2, n: int) -> None:
"""Do not return anything, modify nums1 in-place instead."""
<|body_0|>
def merge2(self, nums1, m: int, nums2, n: int) -> None:
"""Do not return anything, modify nums1 in-place instead."""
<|bod... | stack_v2_sparse_classes_36k_train_016052 | 1,549 | no_license | [
{
"docstring": "Do not return anything, modify nums1 in-place instead.",
"name": "merge",
"signature": "def merge(self, nums1, m: int, nums2, n: int) -> None"
},
{
"docstring": "Do not return anything, modify nums1 in-place instead.",
"name": "merge2",
"signature": "def merge2(self, nums... | 2 | stack_v2_sparse_classes_30k_train_003738 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def merge(self, nums1, m: int, nums2, n: int) -> None: Do not return anything, modify nums1 in-place instead.
- def merge2(self, nums1, m: int, nums2, n: int) -> None: Do not ret... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def merge(self, nums1, m: int, nums2, n: int) -> None: Do not return anything, modify nums1 in-place instead.
- def merge2(self, nums1, m: int, nums2, n: int) -> None: Do not ret... | 3afcfc2a0ff5156cfb40614418e1b846ede84da0 | <|skeleton|>
class Solution:
def merge(self, nums1, m: int, nums2, n: int) -> None:
"""Do not return anything, modify nums1 in-place instead."""
<|body_0|>
def merge2(self, nums1, m: int, nums2, n: int) -> None:
"""Do not return anything, modify nums1 in-place instead."""
<|bod... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def merge(self, nums1, m: int, nums2, n: int) -> None:
"""Do not return anything, modify nums1 in-place instead."""
if len(nums1) == 0:
return n
if len(nums2) == 0:
return m
pi = 0
pj = 0
d = 0
while pi < m + n and pj < ... | the_stack_v2_python_sparse | src/easy/Merge_Two_Ordered_Arrays.py | TuGengs/LeetCode | train | 4 | |
2a06f0aeebcdce1be7cc8d89a885893547bbab2b | [
"if self.dataset_doi:\n return '{0} ({1})'.format(self.datafile_id, self.dataset_doi)\nreturn '{0}'.format(self.datafile_id)",
"if not self.dataverse:\n return None\nreturn self.dataverse.get_file_access_url(self.datafile_id)",
"if not self.dataverse:\n return None\nreturn self.dataverse.get_file_page_... | <|body_start_0|>
if self.dataset_doi:
return '{0} ({1})'.format(self.datafile_id, self.dataset_doi)
return '{0}'.format(self.datafile_id)
<|end_body_0|>
<|body_start_1|>
if not self.dataverse:
return None
return self.dataverse.get_file_access_url(self.datafile_id... | Information about Preprocessed DataverseFile | DataverseFileInfo | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataverseFileInfo:
"""Information about Preprocessed DataverseFile"""
def __str__(self):
"""display name"""
<|body_0|>
def get_file_access_url(self):
"""Build a url similar to: https://dataverse.harvard.edu/api/access/datafile/{{ file id }}"""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_016053 | 6,271 | permissive | [
{
"docstring": "display name",
"name": "__str__",
"signature": "def __str__(self)"
},
{
"docstring": "Build a url similar to: https://dataverse.harvard.edu/api/access/datafile/{{ file id }}",
"name": "get_file_access_url",
"signature": "def get_file_access_url(self)"
},
{
"docstr... | 3 | null | Implement the Python class `DataverseFileInfo` described below.
Class description:
Information about Preprocessed DataverseFile
Method signatures and docstrings:
- def __str__(self): display name
- def get_file_access_url(self): Build a url similar to: https://dataverse.harvard.edu/api/access/datafile/{{ file id }}
-... | Implement the Python class `DataverseFileInfo` described below.
Class description:
Information about Preprocessed DataverseFile
Method signatures and docstrings:
- def __str__(self): display name
- def get_file_access_url(self): Build a url similar to: https://dataverse.harvard.edu/api/access/datafile/{{ file id }}
-... | 9461522219f5ef0f4877f24c8f5923e462bd9557 | <|skeleton|>
class DataverseFileInfo:
"""Information about Preprocessed DataverseFile"""
def __str__(self):
"""display name"""
<|body_0|>
def get_file_access_url(self):
"""Build a url similar to: https://dataverse.harvard.edu/api/access/datafile/{{ file id }}"""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DataverseFileInfo:
"""Information about Preprocessed DataverseFile"""
def __str__(self):
"""display name"""
if self.dataset_doi:
return '{0} ({1})'.format(self.datafile_id, self.dataset_doi)
return '{0}'.format(self.datafile_id)
def get_file_access_url(self):
... | the_stack_v2_python_sparse | preprocess_web/code/ravens_metadata_apps/dataverse_connect/models.py | TwoRavens/raven-metadata-service | train | 0 |
6d7b9e560e0fea1009ceff9bcfb444e20c280650 | [
"\"\"\"\n\t\tA flag to indicate whether or not a goal has not been reached.\n\t\tTrue means that a goal is in progress of being completed.\n\t\tFalse means that a goal has been completed (or not started\n\t\twith any goal)\n\t\t\"\"\"\nself.flag = False\nrospy.init_node('los_path_following')\nself.sub = rospy.Subsc... | <|body_start_0|>
"""
A flag to indicate whether or not a goal has not been reached.
True means that a goal is in progress of being completed.
False means that a goal has been completed (or not started
with any goal)
"""
self.flag = False
rospy.in... | This is the ROS wrapper class for the LOS class. Attributes: _feedback A vortex_msgs action that contains the distance to goal _result A vortex_msgs action, true if a goal is set within the sphereof acceptance, false if not Nodes created: los_path_following Subscribes to: /odometry/filtered Publishes to: /manta/thruste... | LosPathFollowing | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LosPathFollowing:
"""This is the ROS wrapper class for the LOS class. Attributes: _feedback A vortex_msgs action that contains the distance to goal _result A vortex_msgs action, true if a goal is set within the sphereof acceptance, false if not Nodes created: los_path_following Subscribes to: /od... | stack_v2_sparse_classes_36k_train_016054 | 10,684 | permissive | [
{
"docstring": "To initialize the ROS wrapper, the node, subscribers and publishers are set up. The high-level guidance and controller objects are also intialized. Lastly, dynamic reconfigure and action servers are set up.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring":... | 6 | stack_v2_sparse_classes_30k_val_000466 | Implement the Python class `LosPathFollowing` described below.
Class description:
This is the ROS wrapper class for the LOS class. Attributes: _feedback A vortex_msgs action that contains the distance to goal _result A vortex_msgs action, true if a goal is set within the sphereof acceptance, false if not Nodes created... | Implement the Python class `LosPathFollowing` described below.
Class description:
This is the ROS wrapper class for the LOS class. Attributes: _feedback A vortex_msgs action that contains the distance to goal _result A vortex_msgs action, true if a goal is set within the sphereof acceptance, false if not Nodes created... | a5b4a292b6b29b765cbe29d4701e6a8917adbb0a | <|skeleton|>
class LosPathFollowing:
"""This is the ROS wrapper class for the LOS class. Attributes: _feedback A vortex_msgs action that contains the distance to goal _result A vortex_msgs action, true if a goal is set within the sphereof acceptance, false if not Nodes created: los_path_following Subscribes to: /od... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LosPathFollowing:
"""This is the ROS wrapper class for the LOS class. Attributes: _feedback A vortex_msgs action that contains the distance to goal _result A vortex_msgs action, true if a goal is set within the sphereof acceptance, false if not Nodes created: los_path_following Subscribes to: /odometry/filter... | the_stack_v2_python_sparse | motion/los_guidance/scripts/old_los_guidance_euler.py | oysand/Vortex-AUV | train | 0 |
cb1125c1d16facbed01c7297819a231ab44763da | [
"if len(spline_files) != len(parameter_values):\n raise RuntimeError('number of spline files and parameter values must match')\ncrossections = []\nt0, t1 = spline_limits\ncurve_ts = np.linspace(t0, t1, crossection_pts)\nfor spline_file in spline_files:\n curve_pts = load_spline_points(spline_file, curve_ts) *... | <|body_start_0|>
if len(spline_files) != len(parameter_values):
raise RuntimeError('number of spline files and parameter values must match')
crossections = []
t0, t1 = spline_limits
curve_ts = np.linspace(t0, t1, crossection_pts)
for spline_file in spline_files:
... | Interpolate between samples of the crossection of a tube. Useful for simulating e.g. a realistic artery. | InterpolatedTube | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InterpolatedTube:
"""Interpolate between samples of the crossection of a tube. Useful for simulating e.g. a realistic artery."""
def __init__(self, spline_files, parameter_values, scale=1.0, crossection_pts=100, spline_limits=(0.0, 1.0), interp_kind='linear'):
"""spline_files: List o... | stack_v2_sparse_classes_36k_train_016055 | 6,418 | permissive | [
{
"docstring": "spline_files: List of .txt files which can be loaded as a spline. parameter_values: Parametric position of each spline cross-section. scale: Common scale factor for all splines. crossection_pts: Number of points to use when rendering the crossectional spline curves. spline_limits: Parametric lim... | 3 | null | Implement the Python class `InterpolatedTube` described below.
Class description:
Interpolate between samples of the crossection of a tube. Useful for simulating e.g. a realistic artery.
Method signatures and docstrings:
- def __init__(self, spline_files, parameter_values, scale=1.0, crossection_pts=100, spline_limit... | Implement the Python class `InterpolatedTube` described below.
Class description:
Interpolate between samples of the crossection of a tube. Useful for simulating e.g. a realistic artery.
Method signatures and docstrings:
- def __init__(self, spline_files, parameter_values, scale=1.0, crossection_pts=100, spline_limit... | 7b0208082ecb9b0b661aee50815fc85577d1c715 | <|skeleton|>
class InterpolatedTube:
"""Interpolate between samples of the crossection of a tube. Useful for simulating e.g. a realistic artery."""
def __init__(self, spline_files, parameter_values, scale=1.0, crossection_pts=100, spline_limits=(0.0, 1.0), interp_kind='linear'):
"""spline_files: List o... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InterpolatedTube:
"""Interpolate between samples of the crossection of a tube. Useful for simulating e.g. a realistic artery."""
def __init__(self, spline_files, parameter_values, scale=1.0, crossection_pts=100, spline_limits=(0.0, 1.0), interp_kind='linear'):
"""spline_files: List of .txt files ... | the_stack_v2_python_sparse | phantom_scripts/realistic_artery.py | spenceryue/OpenBCSim | train | 4 |
c91bd5fe299614d09f658834839cf9eadf78ccf3 | [
"self.h = h\nself.w = w\nself.n_channels = n_channels\nself.repeat_channels = repeat_channels\nn_constr_para = int(n_channels / repeat_channels)\nif not n_channels == n_constr_para * repeat_channels:\n raise ValueError('Number of channels in constraint parameter tensor representation must be ... | <|body_start_0|>
self.h = h
self.w = w
self.n_channels = n_channels
self.repeat_channels = repeat_channels
n_constr_para = int(n_channels / repeat_channels)
if not n_channels == n_constr_para * repeat_channels:
raise ValueError('Number of channels in constrain... | This functor generates a tensor representation g(s) of the constraint parameter s. Each component of the constraint parameter s corresponds to <repeat_channels> channels of the generated tensor. The assigned channels have entries with a constant value and are given by a constraint parameter rescaled with a factor. The ... | ConstFeatPlanes | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConstFeatPlanes:
"""This functor generates a tensor representation g(s) of the constraint parameter s. Each component of the constraint parameter s corresponds to <repeat_channels> channels of the generated tensor. The assigned channels have entries with a constant value and are given by a constr... | stack_v2_sparse_classes_36k_train_016056 | 13,699 | permissive | [
{
"docstring": "Initialization for setting parameters. Args: h (int): Height of channels. w (int): Width of channels. n_channels (int): Number of channels of generated tensor. Specified number must match n_channels = <length of constraint parameter) * repeat_channels repeat_channels (int): The channel for a con... | 2 | stack_v2_sparse_classes_30k_train_014122 | Implement the Python class `ConstFeatPlanes` described below.
Class description:
This functor generates a tensor representation g(s) of the constraint parameter s. Each component of the constraint parameter s corresponds to <repeat_channels> channels of the generated tensor. The assigned channels have entries with a c... | Implement the Python class `ConstFeatPlanes` described below.
Class description:
This functor generates a tensor representation g(s) of the constraint parameter s. Each component of the constraint parameter s corresponds to <repeat_channels> channels of the generated tensor. The assigned channels have entries with a c... | 3f53a4694f3c6b229679ef9014ac98573f45fd43 | <|skeleton|>
class ConstFeatPlanes:
"""This functor generates a tensor representation g(s) of the constraint parameter s. Each component of the constraint parameter s corresponds to <repeat_channels> channels of the generated tensor. The assigned channels have entries with a constant value and are given by a constr... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ConstFeatPlanes:
"""This functor generates a tensor representation g(s) of the constraint parameter s. Each component of the constraint parameter s corresponds to <repeat_channels> channels of the generated tensor. The assigned channels have entries with a constant value and are given by a constraint paramete... | the_stack_v2_python_sparse | models/bb_rel_cvxpy.py | mbroso/constraintnet_facial_detect | train | 0 |
3eee3c20521da9edd15910b1581b27b1cb60cd9a | [
"super(TestingBlock, self).__init__()\nif isinstance(test_array, np.ndarray):\n if test_array.dtype == np.complex64:\n complex_numbers = True\nif complex_numbers:\n self.test_array = np.array(test_array).astype(np.complex64)\n header = {'nbit': 64, 'dtype': 'complex64', 'shape': self.test_array.shap... | <|body_start_0|>
super(TestingBlock, self).__init__()
if isinstance(test_array, np.ndarray):
if test_array.dtype == np.complex64:
complex_numbers = True
if complex_numbers:
self.test_array = np.array(test_array).astype(np.complex64)
header = {'... | Block for debugging purposes. Allows you to pass arbitrary N-dimensional arrays in initialization, which will be outputted into a ring buffer | TestingBlock | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestingBlock:
"""Block for debugging purposes. Allows you to pass arbitrary N-dimensional arrays in initialization, which will be outputted into a ring buffer"""
def __init__(self, test_array, complex_numbers=False):
"""Figure out data settings from the test array. @param[in] test_ar... | stack_v2_sparse_classes_36k_train_016057 | 49,813 | permissive | [
{
"docstring": "Figure out data settings from the test array. @param[in] test_array A list or numpy array containing test data",
"name": "__init__",
"signature": "def __init__(self, test_array, complex_numbers=False)"
},
{
"docstring": "Put the test array onto the output ring @param[in] output_r... | 2 | null | Implement the Python class `TestingBlock` described below.
Class description:
Block for debugging purposes. Allows you to pass arbitrary N-dimensional arrays in initialization, which will be outputted into a ring buffer
Method signatures and docstrings:
- def __init__(self, test_array, complex_numbers=False): Figure ... | Implement the Python class `TestingBlock` described below.
Class description:
Block for debugging purposes. Allows you to pass arbitrary N-dimensional arrays in initialization, which will be outputted into a ring buffer
Method signatures and docstrings:
- def __init__(self, test_array, complex_numbers=False): Figure ... | 5a93e5d4e906694cf754ac4f1015640a710ffc02 | <|skeleton|>
class TestingBlock:
"""Block for debugging purposes. Allows you to pass arbitrary N-dimensional arrays in initialization, which will be outputted into a ring buffer"""
def __init__(self, test_array, complex_numbers=False):
"""Figure out data settings from the test array. @param[in] test_ar... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestingBlock:
"""Block for debugging purposes. Allows you to pass arbitrary N-dimensional arrays in initialization, which will be outputted into a ring buffer"""
def __init__(self, test_array, complex_numbers=False):
"""Figure out data settings from the test array. @param[in] test_array A list or... | the_stack_v2_python_sparse | python/bifrost/block.py | ledatelescope/bifrost | train | 66 |
fc26cb07de0a6458130cedb2be9e5491fe0cc862 | [
"self.sensor_dimensions_in_cm = (Sensor_dim_in_px[0] * (pixel_size_in_um / 10000), Sensor_dim_in_px[1] * (pixel_size_in_um / 10000))\nself.focal_in_cm = focal_in_mm / 10\nself.element_height_in_cm = element_heigth_in_cm\nself.sensor_aperture_in_degrees = 2 * atan(self.sensor_dimensions_in_cm[0] / (2 * self.focal_in... | <|body_start_0|>
self.sensor_dimensions_in_cm = (Sensor_dim_in_px[0] * (pixel_size_in_um / 10000), Sensor_dim_in_px[1] * (pixel_size_in_um / 10000))
self.focal_in_cm = focal_in_mm / 10
self.element_height_in_cm = element_heigth_in_cm
self.sensor_aperture_in_degrees = 2 * atan(self.sensor... | CameraCalculator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CameraCalculator:
def __init__(self, pixel_size_in_um=SENSOR_PIXEL_SIZE_IN_UM, Sensor_dim_in_px=SENSOR_DIM_IN_PIXELS, focal_in_mm=FOCAL_IN_MM, element_heigth_in_cm=ELEMENT_HEIGHT_IN_CM):
"""Uses the Gauss Formula for Lens for calculating the distance to the baby in function of the parame... | stack_v2_sparse_classes_36k_train_016058 | 5,412 | no_license | [
{
"docstring": "Uses the Gauss Formula for Lens for calculating the distance to the baby in function of the parameters of the camera (focal length, sensor dimensions and pixel size), the height of the target and the height of its detected reflexion in the camera sensor. :param pixel_size_in_um: Float. Pixel siz... | 4 | stack_v2_sparse_classes_30k_val_000717 | Implement the Python class `CameraCalculator` described below.
Class description:
Implement the CameraCalculator class.
Method signatures and docstrings:
- def __init__(self, pixel_size_in_um=SENSOR_PIXEL_SIZE_IN_UM, Sensor_dim_in_px=SENSOR_DIM_IN_PIXELS, focal_in_mm=FOCAL_IN_MM, element_heigth_in_cm=ELEMENT_HEIGHT_I... | Implement the Python class `CameraCalculator` described below.
Class description:
Implement the CameraCalculator class.
Method signatures and docstrings:
- def __init__(self, pixel_size_in_um=SENSOR_PIXEL_SIZE_IN_UM, Sensor_dim_in_px=SENSOR_DIM_IN_PIXELS, focal_in_mm=FOCAL_IN_MM, element_heigth_in_cm=ELEMENT_HEIGHT_I... | 5103b2bd78ffbbb42afb892bdca67859324726e9 | <|skeleton|>
class CameraCalculator:
def __init__(self, pixel_size_in_um=SENSOR_PIXEL_SIZE_IN_UM, Sensor_dim_in_px=SENSOR_DIM_IN_PIXELS, focal_in_mm=FOCAL_IN_MM, element_heigth_in_cm=ELEMENT_HEIGHT_IN_CM):
"""Uses the Gauss Formula for Lens for calculating the distance to the baby in function of the parame... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CameraCalculator:
def __init__(self, pixel_size_in_um=SENSOR_PIXEL_SIZE_IN_UM, Sensor_dim_in_px=SENSOR_DIM_IN_PIXELS, focal_in_mm=FOCAL_IN_MM, element_heigth_in_cm=ELEMENT_HEIGHT_IN_CM):
"""Uses the Gauss Formula for Lens for calculating the distance to the baby in function of the parameters of the ca... | the_stack_v2_python_sparse | RobotController/PiCamera/CameraCalculator/CameraCalculator.py | Eric-Canas/BabyRobot | train | 1 | |
af6812b0a8e2afab8dd196ced4919957eb805097 | [
"if not obstacleGrid or obstacleGrid[-1][-1] == 1:\n return 0\nm = len(obstacleGrid)\nn = len(obstacleGrid[0])\ndp = [[0 for num in row] for row in obstacleGrid]\ndp[-1][-1] = 1\n'\\n dp = [[0] * n] * m\\n 踩到了浅拷贝的坑,后面m个[0,0,0]相当于是复制的数组地址;\\n 声明采用上面的方式,每一行都新生成一个列表\\n '\nfor i in range(... | <|body_start_0|>
if not obstacleGrid or obstacleGrid[-1][-1] == 1:
return 0
m = len(obstacleGrid)
n = len(obstacleGrid[0])
dp = [[0 for num in row] for row in obstacleGrid]
dp[-1][-1] = 1
'\n dp = [[0] * n] * m\n 踩到了浅拷贝的坑,后面m个[0,0,0]相当于是复制的数组地址;\... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def uniquePathsWithObstacles(self, obstacleGrid):
""":type obstacleGrid: List[List[int]] :rtype: int 空间复杂度 m*n dp[i][j] 含义是到右下角的路径数,一直从右下角推导到左上角"""
<|body_0|>
def uniquePathsWithObstacles(self, obstacleGrid):
""":type obstacleGrid: List[List[int]] :rtype: i... | stack_v2_sparse_classes_36k_train_016059 | 2,922 | no_license | [
{
"docstring": ":type obstacleGrid: List[List[int]] :rtype: int 空间复杂度 m*n dp[i][j] 含义是到右下角的路径数,一直从右下角推导到左上角",
"name": "uniquePathsWithObstacles",
"signature": "def uniquePathsWithObstacles(self, obstacleGrid)"
},
{
"docstring": ":type obstacleGrid: List[List[int]] :rtype: int",
"name": "uniq... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def uniquePathsWithObstacles(self, obstacleGrid): :type obstacleGrid: List[List[int]] :rtype: int 空间复杂度 m*n dp[i][j] 含义是到右下角的路径数,一直从右下角推导到左上角
- def uniquePathsWithObstacles(self,... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def uniquePathsWithObstacles(self, obstacleGrid): :type obstacleGrid: List[List[int]] :rtype: int 空间复杂度 m*n dp[i][j] 含义是到右下角的路径数,一直从右下角推导到左上角
- def uniquePathsWithObstacles(self,... | c162817f717b78997197649c084c27af48c3fd6f | <|skeleton|>
class Solution:
def uniquePathsWithObstacles(self, obstacleGrid):
""":type obstacleGrid: List[List[int]] :rtype: int 空间复杂度 m*n dp[i][j] 含义是到右下角的路径数,一直从右下角推导到左上角"""
<|body_0|>
def uniquePathsWithObstacles(self, obstacleGrid):
""":type obstacleGrid: List[List[int]] :rtype: i... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def uniquePathsWithObstacles(self, obstacleGrid):
""":type obstacleGrid: List[List[int]] :rtype: int 空间复杂度 m*n dp[i][j] 含义是到右下角的路径数,一直从右下角推导到左上角"""
if not obstacleGrid or obstacleGrid[-1][-1] == 1:
return 0
m = len(obstacleGrid)
n = len(obstacleGrid[0])
... | the_stack_v2_python_sparse | Week_06/63.不同路径-ii.py | dream201188/algorithm017 | train | 1 | |
02fcf800cf414b286f03ff5d7169689f6ef64e31 | [
"if num <= 0:\n return False\nfor d in (2, 3, 5):\n while num % d == 0:\n num //= d\nreturn num == 1",
"if num <= 0:\n return False\nelif num in (1, 2, 3, 5):\n return True\nfor d in (2, 3, 5):\n if num % d == 0:\n return self.isUgly(num // d)\nreturn False"
] | <|body_start_0|>
if num <= 0:
return False
for d in (2, 3, 5):
while num % d == 0:
num //= d
return num == 1
<|end_body_0|>
<|body_start_1|>
if num <= 0:
return False
elif num in (1, 2, 3, 5):
return True
fo... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isUgly(self, num):
""":type num: int :rtype: bool"""
<|body_0|>
def isUgly_recursive(self, num):
""":type num: int :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if num <= 0:
return False
for d in (2, ... | stack_v2_sparse_classes_36k_train_016060 | 1,433 | no_license | [
{
"docstring": ":type num: int :rtype: bool",
"name": "isUgly",
"signature": "def isUgly(self, num)"
},
{
"docstring": ":type num: int :rtype: bool",
"name": "isUgly_recursive",
"signature": "def isUgly_recursive(self, num)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isUgly(self, num): :type num: int :rtype: bool
- def isUgly_recursive(self, num): :type num: int :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isUgly(self, num): :type num: int :rtype: bool
- def isUgly_recursive(self, num): :type num: int :rtype: bool
<|skeleton|>
class Solution:
def isUgly(self, num):
... | e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59 | <|skeleton|>
class Solution:
def isUgly(self, num):
""":type num: int :rtype: bool"""
<|body_0|>
def isUgly_recursive(self, num):
""":type num: int :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def isUgly(self, num):
""":type num: int :rtype: bool"""
if num <= 0:
return False
for d in (2, 3, 5):
while num % d == 0:
num //= d
return num == 1
def isUgly_recursive(self, num):
""":type num: int :rtype: bool"""... | the_stack_v2_python_sparse | src/lt_263.py | oxhead/CodingYourWay | train | 0 | |
9565296ffe8b13b3a1d30861232a122b09913af4 | [
"super().__init__(x_ref=x_ref, p_val=p_val, x_ref_preprocessed=x_ref_preprocessed, preprocess_at_init=preprocess_at_init, update_x_ref=update_x_ref, preprocess_fn=preprocess_fn, correction=correction, n_features=n_features, input_shape=input_shape, data_type=data_type)\nself._set_config(locals())\nself.alternative ... | <|body_start_0|>
super().__init__(x_ref=x_ref, p_val=p_val, x_ref_preprocessed=x_ref_preprocessed, preprocess_at_init=preprocess_at_init, update_x_ref=update_x_ref, preprocess_fn=preprocess_fn, correction=correction, n_features=n_features, input_shape=input_shape, data_type=data_type)
self._set_config(l... | KSDrift | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KSDrift:
def __init__(self, x_ref: Union[np.ndarray, list], p_val: float=0.05, x_ref_preprocessed: bool=False, preprocess_at_init: bool=True, update_x_ref: Optional[Dict[str, int]]=None, preprocess_fn: Optional[Callable]=None, correction: str='bonferroni', alternative: str='two-sided', n_feature... | stack_v2_sparse_classes_36k_train_016061 | 4,384 | permissive | [
{
"docstring": "Kolmogorov-Smirnov (K-S) data drift detector with Bonferroni or False Discovery Rate (FDR) correction for multivariate data. Parameters ---------- x_ref Data used as reference distribution. p_val p-value used for significance of the K-S test for each feature. If the FDR correction method is used... | 2 | stack_v2_sparse_classes_30k_train_011821 | Implement the Python class `KSDrift` described below.
Class description:
Implement the KSDrift class.
Method signatures and docstrings:
- def __init__(self, x_ref: Union[np.ndarray, list], p_val: float=0.05, x_ref_preprocessed: bool=False, preprocess_at_init: bool=True, update_x_ref: Optional[Dict[str, int]]=None, pr... | Implement the Python class `KSDrift` described below.
Class description:
Implement the KSDrift class.
Method signatures and docstrings:
- def __init__(self, x_ref: Union[np.ndarray, list], p_val: float=0.05, x_ref_preprocessed: bool=False, preprocess_at_init: bool=True, update_x_ref: Optional[Dict[str, int]]=None, pr... | 4a1b4f74a8590117965421e86c2295bff0f33e89 | <|skeleton|>
class KSDrift:
def __init__(self, x_ref: Union[np.ndarray, list], p_val: float=0.05, x_ref_preprocessed: bool=False, preprocess_at_init: bool=True, update_x_ref: Optional[Dict[str, int]]=None, preprocess_fn: Optional[Callable]=None, correction: str='bonferroni', alternative: str='two-sided', n_feature... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class KSDrift:
def __init__(self, x_ref: Union[np.ndarray, list], p_val: float=0.05, x_ref_preprocessed: bool=False, preprocess_at_init: bool=True, update_x_ref: Optional[Dict[str, int]]=None, preprocess_fn: Optional[Callable]=None, correction: str='bonferroni', alternative: str='two-sided', n_features: Optional[in... | the_stack_v2_python_sparse | alibi_detect/cd/ks.py | SeldonIO/alibi-detect | train | 1,922 | |
c8c00c2f7e6dd27cdb5ca5748ee9b011b527e0f2 | [
"body = dict(request.data)\norg_id = self.get_organization(request)\nproperty_view_ids = body.get('property_view_ids')\ntaxlot_view_ids = body.get('taxlot_view_ids')\nif property_view_ids:\n property_views = PropertyView.objects.filter(id__in=property_view_ids, cycle__organization_id=org_id)\n properties = Pr... | <|body_start_0|>
body = dict(request.data)
org_id = self.get_organization(request)
property_view_ids = body.get('property_view_ids')
taxlot_view_ids = body.get('taxlot_view_ids')
if property_view_ids:
property_views = PropertyView.objects.filter(id__in=property_view_i... | GeocodeViewSet | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GeocodeViewSet:
def geocode_by_ids(self, request):
"""Submit a request to geocode property and tax lot records."""
<|body_0|>
def confidence_summary(self, request):
"""Generate a summary of geocoding confidence values for property and tax lot records."""
<|bo... | stack_v2_sparse_classes_36k_train_016062 | 6,094 | permissive | [
{
"docstring": "Submit a request to geocode property and tax lot records.",
"name": "geocode_by_ids",
"signature": "def geocode_by_ids(self, request)"
},
{
"docstring": "Generate a summary of geocoding confidence values for property and tax lot records.",
"name": "confidence_summary",
"s... | 2 | stack_v2_sparse_classes_30k_test_000733 | Implement the Python class `GeocodeViewSet` described below.
Class description:
Implement the GeocodeViewSet class.
Method signatures and docstrings:
- def geocode_by_ids(self, request): Submit a request to geocode property and tax lot records.
- def confidence_summary(self, request): Generate a summary of geocoding ... | Implement the Python class `GeocodeViewSet` described below.
Class description:
Implement the GeocodeViewSet class.
Method signatures and docstrings:
- def geocode_by_ids(self, request): Submit a request to geocode property and tax lot records.
- def confidence_summary(self, request): Generate a summary of geocoding ... | 680b6a2b45f3c568d779d8ac86553a0b08c384c8 | <|skeleton|>
class GeocodeViewSet:
def geocode_by_ids(self, request):
"""Submit a request to geocode property and tax lot records."""
<|body_0|>
def confidence_summary(self, request):
"""Generate a summary of geocoding confidence values for property and tax lot records."""
<|bo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GeocodeViewSet:
def geocode_by_ids(self, request):
"""Submit a request to geocode property and tax lot records."""
body = dict(request.data)
org_id = self.get_organization(request)
property_view_ids = body.get('property_view_ids')
taxlot_view_ids = body.get('taxlot_view... | the_stack_v2_python_sparse | seed/views/v3/geocode.py | SEED-platform/seed | train | 108 | |
024acda22f46a4e2172b2263c8eba4b9616b0030 | [
"self.pass_not_found = pass_not_found\nself.colors = colors\nself.labels = self.colors\nself.raise_if_not = raise_if_not\nself.without_notfound = without_notfound\nif colors and len(colors) == 2 and (len(colors[0]) == 2):\n self.LABEL = [str(colors[0][1]) + '-' + str(colors[0][0]), str(colors[1][1]) + '-' + str(... | <|body_start_0|>
self.pass_not_found = pass_not_found
self.colors = colors
self.labels = self.colors
self.raise_if_not = raise_if_not
self.without_notfound = without_notfound
if colors and len(colors) == 2 and (len(colors[0]) == 2):
self.LABEL = [str(colors[0]... | Filter star according their color indexes Attributes ----------- colors : list of strings List of magnitudes which will be used. They are keys to color indexes in star's object attribute 'more', where can be stored anything pass_not_found : bool If False stars without color index will be denied raise_if_not : bool If T... | ColorIndexDescr | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ColorIndexDescr:
"""Filter star according their color indexes Attributes ----------- colors : list of strings List of magnitudes which will be used. They are keys to color indexes in star's object attribute 'more', where can be stored anything pass_not_found : bool If False stars without color in... | stack_v2_sparse_classes_36k_train_016063 | 3,337 | permissive | [
{
"docstring": "Parameters ----------- colors : list of strings List of magnitudes which will be used. They are keys to color indexes in star's object attribute 'more', where can be stored anything. It can be list of keys (in stars more attribute) or list of tuples of two keys. In this case differences of these... | 2 | stack_v2_sparse_classes_30k_train_007259 | Implement the Python class `ColorIndexDescr` described below.
Class description:
Filter star according their color indexes Attributes ----------- colors : list of strings List of magnitudes which will be used. They are keys to color indexes in star's object attribute 'more', where can be stored anything pass_not_found... | Implement the Python class `ColorIndexDescr` described below.
Class description:
Filter star according their color indexes Attributes ----------- colors : list of strings List of magnitudes which will be used. They are keys to color indexes in star's object attribute 'more', where can be stored anything pass_not_found... | a0a51f033cb8adf45296913f0de0aa2568e0530c | <|skeleton|>
class ColorIndexDescr:
"""Filter star according their color indexes Attributes ----------- colors : list of strings List of magnitudes which will be used. They are keys to color indexes in star's object attribute 'more', where can be stored anything pass_not_found : bool If False stars without color in... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ColorIndexDescr:
"""Filter star according their color indexes Attributes ----------- colors : list of strings List of magnitudes which will be used. They are keys to color indexes in star's object attribute 'more', where can be stored anything pass_not_found : bool If False stars without color index will be d... | the_stack_v2_python_sparse | lcc/stars_processing/descriptors/color_index_descr.py | pierfra-rocci/LightCurvesClassifier | train | 0 |
7508459ff4d57bc23c09dbb0f981861003ddc406 | [
"self.capacity = capacity\nself.count = 0\nself.linkedlist = DoubleLinkedList()\nself.map = {}",
"if key not in self.map:\n return -1\nnode = self.map[key]\nself.linkedlist.remove(node)\nself.linkedlist.add_first(node)\nreturn node.val",
"if key not in self.map:\n self.count += 1\n node = Node(key, val... | <|body_start_0|>
self.capacity = capacity
self.count = 0
self.linkedlist = DoubleLinkedList()
self.map = {}
<|end_body_0|>
<|body_start_1|>
if key not in self.map:
return -1
node = self.map[key]
self.linkedlist.remove(node)
self.linkedlist.add... | LRUCache | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":type key: int :rtype: int"""
<|body_1|>
def put(self, key, value):
""":type key: int :type value: int :rtype: void"""
<|body_2|>
<|end_s... | stack_v2_sparse_classes_36k_train_016064 | 3,838 | no_license | [
{
"docstring": ":type capacity: int",
"name": "__init__",
"signature": "def __init__(self, capacity)"
},
{
"docstring": ":type key: int :rtype: int",
"name": "get",
"signature": "def get(self, key)"
},
{
"docstring": ":type key: int :type value: int :rtype: void",
"name": "pu... | 3 | null | Implement the Python class `LRUCache` described below.
Class description:
Implement the LRUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :type key: int :rtype: int
- def put(self, key, value): :type key: int :type value: int :rtype: void | Implement the Python class `LRUCache` described below.
Class description:
Implement the LRUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :type key: int :rtype: int
- def put(self, key, value): :type key: int :type value: int :rtype: void
<|sk... | 48d436701840f8c162829cb101ecde444def2307 | <|skeleton|>
class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":type key: int :rtype: int"""
<|body_1|>
def put(self, key, value):
""":type key: int :type value: int :rtype: void"""
<|body_2|>
<|end_s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
self.capacity = capacity
self.count = 0
self.linkedlist = DoubleLinkedList()
self.map = {}
def get(self, key):
""":type key: int :rtype: int"""
if key not in self.map:
ret... | the_stack_v2_python_sparse | LRU Cache.py | lixuanhong/LeetCode | train | 0 | |
056d68cf270fb95b6e18aa8dffe9a3bb5ef1c50f | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')"
] | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | Proto file describing the Remarketing Action service. Service to manage remarketing actions. | RemarketingActionServiceServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RemarketingActionServiceServicer:
"""Proto file describing the Remarketing Action service. Service to manage remarketing actions."""
def GetRemarketingAction(self, request, context):
"""Returns the requested remarketing action in full detail."""
<|body_0|>
def MutateRema... | stack_v2_sparse_classes_36k_train_016065 | 3,608 | permissive | [
{
"docstring": "Returns the requested remarketing action in full detail.",
"name": "GetRemarketingAction",
"signature": "def GetRemarketingAction(self, request, context)"
},
{
"docstring": "Creates or updates remarketing actions. Operation statuses are returned.",
"name": "MutateRemarketingA... | 2 | null | Implement the Python class `RemarketingActionServiceServicer` described below.
Class description:
Proto file describing the Remarketing Action service. Service to manage remarketing actions.
Method signatures and docstrings:
- def GetRemarketingAction(self, request, context): Returns the requested remarketing action ... | Implement the Python class `RemarketingActionServiceServicer` described below.
Class description:
Proto file describing the Remarketing Action service. Service to manage remarketing actions.
Method signatures and docstrings:
- def GetRemarketingAction(self, request, context): Returns the requested remarketing action ... | a5b6cede64f4d9912ae6ad26927a54e40448c9fe | <|skeleton|>
class RemarketingActionServiceServicer:
"""Proto file describing the Remarketing Action service. Service to manage remarketing actions."""
def GetRemarketingAction(self, request, context):
"""Returns the requested remarketing action in full detail."""
<|body_0|>
def MutateRema... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RemarketingActionServiceServicer:
"""Proto file describing the Remarketing Action service. Service to manage remarketing actions."""
def GetRemarketingAction(self, request, context):
"""Returns the requested remarketing action in full detail."""
context.set_code(grpc.StatusCode.UNIMPLEMEN... | the_stack_v2_python_sparse | google/ads/google_ads/v3/proto/services/remarketing_action_service_pb2_grpc.py | fiboknacky/google-ads-python | train | 0 |
07afd389adff77115102a8a3856db02db375d081 | [
"if not isinstance(compressed_array, abstract.Array):\n if not isinstance(compressed_array, numpy.ndarray):\n compressed_array = numpy.asanyarray(compressed_array)\n compressed_array = NumpyArray(compressed_array)\nsuper().__init__(compressed_array=compressed_array, shape=shape, size=size, ndim=ndim, c... | <|body_start_0|>
if not isinstance(compressed_array, abstract.Array):
if not isinstance(compressed_array, numpy.ndarray):
compressed_array = numpy.asanyarray(compressed_array)
compressed_array = NumpyArray(compressed_array)
super().__init__(compressed_array=compre... | An underlying contiguous ragged array. A collection of features stored using a contiguous ragged array combines all features along a single dimension (the "sample dimension") such that each feature in the collection occupies a contiguous block. The information needed to uncompress the data is stored in a "count variabl... | RaggedContiguousArray | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RaggedContiguousArray:
"""An underlying contiguous ragged array. A collection of features stored using a contiguous ragged array combines all features along a single dimension (the "sample dimension") such that each feature in the collection occupies a contiguous block. The information needed to ... | stack_v2_sparse_classes_36k_train_016066 | 3,839 | permissive | [
{
"docstring": "**Initialization** :Parameters: compressed_array: numpy array-like or subclass of Array The compressed data. shape: `tuple` The uncompressed array dimension sizes. size: `int` Number of elements in the uncompressed array. ndim: `int` The number of uncompressed array dimensions count_variable: `C... | 2 | stack_v2_sparse_classes_30k_train_009815 | Implement the Python class `RaggedContiguousArray` described below.
Class description:
An underlying contiguous ragged array. A collection of features stored using a contiguous ragged array combines all features along a single dimension (the "sample dimension") such that each feature in the collection occupies a conti... | Implement the Python class `RaggedContiguousArray` described below.
Class description:
An underlying contiguous ragged array. A collection of features stored using a contiguous ragged array combines all features along a single dimension (the "sample dimension") such that each feature in the collection occupies a conti... | 1e074dbc28054780a9ec667d61b9098b94956ea6 | <|skeleton|>
class RaggedContiguousArray:
"""An underlying contiguous ragged array. A collection of features stored using a contiguous ragged array combines all features along a single dimension (the "sample dimension") such that each feature in the collection occupies a contiguous block. The information needed to ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RaggedContiguousArray:
"""An underlying contiguous ragged array. A collection of features stored using a contiguous ragged array combines all features along a single dimension (the "sample dimension") such that each feature in the collection occupies a contiguous block. The information needed to uncompress th... | the_stack_v2_python_sparse | cfdm/data/raggedcontiguousarray.py | cofinoa/cfdm | train | 0 |
6205c91bb619671c31dc660dc46228a7e40313e4 | [
"super().__init__()\nself.recorder = recorder\nself.params = MethodParameters(recorder=recorder)\nself.rval = MethodReturn(recorder=recorder)\nself.exception = MethodException(recorder=recorder)\nself.repository = MethodRepository(recorder=recorder)\nself.pass_recorder = MethodPassRecorder(recorder=recorder)\nself.... | <|body_start_0|>
super().__init__()
self.recorder = recorder
self.params = MethodParameters(recorder=recorder)
self.rval = MethodReturn(recorder=recorder)
self.exception = MethodException(recorder=recorder)
self.repository = MethodRepository(recorder=recorder)
sel... | Record interesting things about methods. Usage: @rekorder.method.param(when=When.AROUND) @rekorder.method.rval @rekorder.method.exception @rekorder.method.repository(paths=['some/path']) def some_func(...) Alternate Usage: Method can also be used as a decorator. This usage delegates to the param, rval and exception Dev... | Method | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Method:
"""Record interesting things about methods. Usage: @rekorder.method.param(when=When.AROUND) @rekorder.method.rval @rekorder.method.exception @rekorder.method.repository(paths=['some/path']) def some_func(...) Alternate Usage: Method can also be used as a decorator. This usage delegates to... | stack_v2_sparse_classes_36k_train_016067 | 2,717 | no_license | [
{
"docstring": "Construct the Method with a reference to the Recorder capable of recording the tunes created by our Recordable devices. Args: recorder (Recorder): Recorder instance.",
"name": "__init__",
"signature": "def __init__(self, recorder)"
},
{
"docstring": "Use this decorator to pass th... | 3 | stack_v2_sparse_classes_30k_train_002725 | Implement the Python class `Method` described below.
Class description:
Record interesting things about methods. Usage: @rekorder.method.param(when=When.AROUND) @rekorder.method.rval @rekorder.method.exception @rekorder.method.repository(paths=['some/path']) def some_func(...) Alternate Usage: Method can also be used ... | Implement the Python class `Method` described below.
Class description:
Record interesting things about methods. Usage: @rekorder.method.param(when=When.AROUND) @rekorder.method.rval @rekorder.method.exception @rekorder.method.repository(paths=['some/path']) def some_func(...) Alternate Usage: Method can also be used ... | 8135438b5785e1e9f23b44f5b93130b73196ea8f | <|skeleton|>
class Method:
"""Record interesting things about methods. Usage: @rekorder.method.param(when=When.AROUND) @rekorder.method.rval @rekorder.method.exception @rekorder.method.repository(paths=['some/path']) def some_func(...) Alternate Usage: Method can also be used as a decorator. This usage delegates to... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Method:
"""Record interesting things about methods. Usage: @rekorder.method.param(when=When.AROUND) @rekorder.method.rval @rekorder.method.exception @rekorder.method.repository(paths=['some/path']) def some_func(...) Alternate Usage: Method can also be used as a decorator. This usage delegates to the param, r... | the_stack_v2_python_sparse | rekorder/lib/method/method.py | jcejohnson/rekorder | train | 0 |
7851fc560bbb59297aa582e70a58aed5938f8d88 | [
"user = User.get_user_by_id(user_id=user_id)\nif not user:\n raise SystemGlobalException(StatusCodeMessage.USERNAME_NOT_EXISTS)\nserializer = UserListSerializers(user)\nreturn APIResponse(data=serializer.data).get_result()",
"user = User.get_user_by_id(user_id=user_id)\nif not user:\n raise SystemGlobalExce... | <|body_start_0|>
user = User.get_user_by_id(user_id=user_id)
if not user:
raise SystemGlobalException(StatusCodeMessage.USERNAME_NOT_EXISTS)
serializer = UserListSerializers(user)
return APIResponse(data=serializer.data).get_result()
<|end_body_0|>
<|body_start_1|>
u... | 用户查询,更新APIView | UserFindUpdateDelAPIView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserFindUpdateDelAPIView:
"""用户查询,更新APIView"""
def get(_, user_id):
"""用户查询"""
<|body_0|>
def put(request, user_id):
"""用户修改"""
<|body_1|>
def delete(request, user_id):
"""用户删除"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_016068 | 2,573 | no_license | [
{
"docstring": "用户查询",
"name": "get",
"signature": "def get(_, user_id)"
},
{
"docstring": "用户修改",
"name": "put",
"signature": "def put(request, user_id)"
},
{
"docstring": "用户删除",
"name": "delete",
"signature": "def delete(request, user_id)"
}
] | 3 | stack_v2_sparse_classes_30k_train_000988 | Implement the Python class `UserFindUpdateDelAPIView` described below.
Class description:
用户查询,更新APIView
Method signatures and docstrings:
- def get(_, user_id): 用户查询
- def put(request, user_id): 用户修改
- def delete(request, user_id): 用户删除 | Implement the Python class `UserFindUpdateDelAPIView` described below.
Class description:
用户查询,更新APIView
Method signatures and docstrings:
- def get(_, user_id): 用户查询
- def put(request, user_id): 用户修改
- def delete(request, user_id): 用户删除
<|skeleton|>
class UserFindUpdateDelAPIView:
"""用户查询,更新APIView"""
def ... | bb85b52598d68956bde8756c8321ade7b8479ba7 | <|skeleton|>
class UserFindUpdateDelAPIView:
"""用户查询,更新APIView"""
def get(_, user_id):
"""用户查询"""
<|body_0|>
def put(request, user_id):
"""用户修改"""
<|body_1|>
def delete(request, user_id):
"""用户删除"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserFindUpdateDelAPIView:
"""用户查询,更新APIView"""
def get(_, user_id):
"""用户查询"""
user = User.get_user_by_id(user_id=user_id)
if not user:
raise SystemGlobalException(StatusCodeMessage.USERNAME_NOT_EXISTS)
serializer = UserListSerializers(user)
return APIR... | the_stack_v2_python_sparse | rbac_v1/v1/rbac_app/views/user/user_views.py | huiiiuh/huihuiproject | train | 0 |
89eb65bf9f6fae732eb87d8db7ae2357cc13029f | [
"event = request.data\nworker = Worker.get_or_create(event)\nworker.started = timezone.now()\nworker.save()\nreturn Response()",
"try:\n worker = Worker.objects.filter(hostname=hostname, finished__isnull=True).order_by('-created')[0]\nexcept IndexError:\n worker = Worker.objects.create(hostname=hostname)\nd... | <|body_start_0|>
event = request.data
worker = Worker.get_or_create(event)
worker.started = timezone.now()
worker.save()
return Response()
<|end_body_0|>
<|body_start_1|>
try:
worker = Worker.objects.filter(hostname=hostname, finished__isnull=True).order_by('... | A view set intended for the `overseer` service to update the status of workers. Requires that the user is a Stencila staff member. Does not require the `overseer` to know which account a worker is associated with, or have account permission. | WorkersViewSet | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WorkersViewSet:
"""A view set intended for the `overseer` service to update the status of workers. Requires that the user is a Stencila staff member. Does not require the `overseer` to know which account a worker is associated with, or have account permission."""
def online(self, request: Re... | stack_v2_sparse_classes_36k_train_016069 | 21,054 | permissive | [
{
"docstring": "Record that a worker has come online. An internal route, intended primarily for the `overseer` service. Receives event data. Returns an empty response.",
"name": "online",
"signature": "def online(self, request: Request) -> Response"
},
{
"docstring": "Update information on the w... | 4 | null | Implement the Python class `WorkersViewSet` described below.
Class description:
A view set intended for the `overseer` service to update the status of workers. Requires that the user is a Stencila staff member. Does not require the `overseer` to know which account a worker is associated with, or have account permissio... | Implement the Python class `WorkersViewSet` described below.
Class description:
A view set intended for the `overseer` service to update the status of workers. Requires that the user is a Stencila staff member. Does not require the `overseer` to know which account a worker is associated with, or have account permissio... | b0edf060f4cc5494eef81fce62a563bd5b4e8e31 | <|skeleton|>
class WorkersViewSet:
"""A view set intended for the `overseer` service to update the status of workers. Requires that the user is a Stencila staff member. Does not require the `overseer` to know which account a worker is associated with, or have account permission."""
def online(self, request: Re... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WorkersViewSet:
"""A view set intended for the `overseer` service to update the status of workers. Requires that the user is a Stencila staff member. Does not require the `overseer` to know which account a worker is associated with, or have account permission."""
def online(self, request: Request) -> Res... | the_stack_v2_python_sparse | manager/jobs/api/views.py | stencila/hub | train | 31 |
f21e31153dc53523b75205a7057a973e055ac825 | [
"email = args['email']\npassword = args['password']\nuser = User.find(email=email, password=password)\nfailure = None\nif user is not None:\n status = login_user(user, remember=False)\n if status:\n log.info('Logged in User via API: {!r}'.format(user))\n create_session_oauth2_token()\n else:\... | <|body_start_0|>
email = args['email']
password = args['password']
user = User.find(email=email, password=password)
failure = None
if user is not None:
status = login_user(user, remember=False)
if status:
log.info('Logged in User via API: {... | Login with Session. | OAuth2Sessions | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OAuth2Sessions:
"""Login with Session."""
def post(self, args):
"""Log-in via a new OAuth2 Session."""
<|body_0|>
def delete(self):
"""Log-out the active OAuth2 Session."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
email = args['email']
... | stack_v2_sparse_classes_36k_train_016070 | 5,850 | permissive | [
{
"docstring": "Log-in via a new OAuth2 Session.",
"name": "post",
"signature": "def post(self, args)"
},
{
"docstring": "Log-out the active OAuth2 Session.",
"name": "delete",
"signature": "def delete(self)"
}
] | 2 | null | Implement the Python class `OAuth2Sessions` described below.
Class description:
Login with Session.
Method signatures and docstrings:
- def post(self, args): Log-in via a new OAuth2 Session.
- def delete(self): Log-out the active OAuth2 Session. | Implement the Python class `OAuth2Sessions` described below.
Class description:
Login with Session.
Method signatures and docstrings:
- def post(self, args): Log-in via a new OAuth2 Session.
- def delete(self): Log-out the active OAuth2 Session.
<|skeleton|>
class OAuth2Sessions:
"""Login with Session."""
d... | b28af2af01f1c66024e7a4fc20a01b5bd61ca863 | <|skeleton|>
class OAuth2Sessions:
"""Login with Session."""
def post(self, args):
"""Log-in via a new OAuth2 Session."""
<|body_0|>
def delete(self):
"""Log-out the active OAuth2 Session."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OAuth2Sessions:
"""Login with Session."""
def post(self, args):
"""Log-in via a new OAuth2 Session."""
email = args['email']
password = args['password']
user = User.find(email=email, password=password)
failure = None
if user is not None:
status ... | the_stack_v2_python_sparse | wbia/web/modules/auth/resources.py | WildMeOrg/wildbook-ia | train | 48 |
60e1974529abe367af4d41550588c4b2f14f456d | [
"self.Name = 'LOL'\nself.Name = input('Введите имя: ')\nself.targets = targets\npygame.display.update()\nself.clock = pygame.time.Clock()\nself.finished = False\nself.start_time = self.end_time = time()\nself.score_board = score_board",
"for number, ball in enumerate(self.targets):\n if (inc := ball.click_hand... | <|body_start_0|>
self.Name = 'LOL'
self.Name = input('Введите имя: ')
self.targets = targets
pygame.display.update()
self.clock = pygame.time.Clock()
self.finished = False
self.start_time = self.end_time = time()
self.score_board = score_board
<|end_body_0... | EventLoop | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EventLoop:
def __init__(self, score_board, targets):
""":param score_board: scoreboard object :param targets: list of the targets"""
<|body_0|>
def mouse_handler(self, event):
"""Handle mouseclick :param event: click event :return: None"""
<|body_1|>
def... | stack_v2_sparse_classes_36k_train_016071 | 4,054 | no_license | [
{
"docstring": ":param score_board: scoreboard object :param targets: list of the targets",
"name": "__init__",
"signature": "def __init__(self, score_board, targets)"
},
{
"docstring": "Handle mouseclick :param event: click event :return: None",
"name": "mouse_handler",
"signature": "de... | 4 | stack_v2_sparse_classes_30k_train_009134 | Implement the Python class `EventLoop` described below.
Class description:
Implement the EventLoop class.
Method signatures and docstrings:
- def __init__(self, score_board, targets): :param score_board: scoreboard object :param targets: list of the targets
- def mouse_handler(self, event): Handle mouseclick :param e... | Implement the Python class `EventLoop` described below.
Class description:
Implement the EventLoop class.
Method signatures and docstrings:
- def __init__(self, score_board, targets): :param score_board: scoreboard object :param targets: list of the targets
- def mouse_handler(self, event): Handle mouseclick :param e... | 292123157b6b7b217544231a46deeb3cd9066e14 | <|skeleton|>
class EventLoop:
def __init__(self, score_board, targets):
""":param score_board: scoreboard object :param targets: list of the targets"""
<|body_0|>
def mouse_handler(self, event):
"""Handle mouseclick :param event: click event :return: None"""
<|body_1|>
def... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EventLoop:
def __init__(self, score_board, targets):
""":param score_board: scoreboard object :param targets: list of the targets"""
self.Name = 'LOL'
self.Name = input('Введите имя: ')
self.targets = targets
pygame.display.update()
self.clock = pygame.time.Cloc... | the_stack_v2_python_sparse | 1sem(python)/lab4/main.py | dimon58/all_mipt_labs | train | 0 | |
a7b47a5a44788ad09de86c3227d85f8ec52e2ce8 | [
"if value:\n if not self.multivalued:\n value = [value]\n value = [v for v in value if v]\n input_value = ','.join((force_str(v) for v in value))\n existing_users = User.objects.filter(pk__in=value).order_by('first_name', 'last_name', 'username')\nelse:\n input_value = None\n existing_users... | <|body_start_0|>
if value:
if not self.multivalued:
value = [value]
value = [v for v in value if v]
input_value = ','.join((force_str(v) for v in value))
existing_users = User.objects.filter(pk__in=value).order_by('first_name', 'last_name', 'userna... | A form widget to allow people to select one or more User relations. It's not unheard of to have a server with thousands or tens of thousands of registered users. In this case, the existing Django admin widgets fall down hard. The filtered select widgets can actually crash the webserver due to trying to pre-populate an ... | RelatedUserWidget | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RelatedUserWidget:
"""A form widget to allow people to select one or more User relations. It's not unheard of to have a server with thousands or tens of thousands of registered users. In this case, the existing Django admin widgets fall down hard. The filtered select widgets can actually crash th... | stack_v2_sparse_classes_36k_train_016072 | 16,804 | permissive | [
{
"docstring": "Render the widget. Args: name (unicode): The name of the field. value (list): The current value of the field. attrs (dict, optional): Attributes for the HTML element. renderer (django.forms.renderers.BaseRenderer, optional): The form renderer. Returns: django.utils.safestring.SafeText: The rende... | 2 | stack_v2_sparse_classes_30k_val_001078 | Implement the Python class `RelatedUserWidget` described below.
Class description:
A form widget to allow people to select one or more User relations. It's not unheard of to have a server with thousands or tens of thousands of registered users. In this case, the existing Django admin widgets fall down hard. The filter... | Implement the Python class `RelatedUserWidget` described below.
Class description:
A form widget to allow people to select one or more User relations. It's not unheard of to have a server with thousands or tens of thousands of registered users. In this case, the existing Django admin widgets fall down hard. The filter... | c3a991f1e9d7682239a1ab0e8661cee6da01d537 | <|skeleton|>
class RelatedUserWidget:
"""A form widget to allow people to select one or more User relations. It's not unheard of to have a server with thousands or tens of thousands of registered users. In this case, the existing Django admin widgets fall down hard. The filtered select widgets can actually crash th... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RelatedUserWidget:
"""A form widget to allow people to select one or more User relations. It's not unheard of to have a server with thousands or tens of thousands of registered users. In this case, the existing Django admin widgets fall down hard. The filtered select widgets can actually crash the webserver d... | the_stack_v2_python_sparse | reviewboard/admin/form_widgets.py | reviewboard/reviewboard | train | 1,141 |
b97d7c27e24d045cc2ba6af3d9948f8fbbf4c881 | [
"object.__setattr__(self, 'user', user)\nobject.__setattr__(self, 'token', token)\nobject.__setattr__(self, 'cmd', cmd)\nobject.__setattr__(self, 'format', format)\nobject.__setattr__(self, 'args', args)\nobject.__setattr__(self, 'size', size)",
"args = self.args if self.args else ''\ntoken = self.token if self.t... | <|body_start_0|>
object.__setattr__(self, 'user', user)
object.__setattr__(self, 'token', token)
object.__setattr__(self, 'cmd', cmd)
object.__setattr__(self, 'format', format)
object.__setattr__(self, 'args', args)
object.__setattr__(self, 'size', size)
<|end_body_0|>
<... | RequestMessage | [
"MIT",
"LicenseRef-scancode-public-domain"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RequestMessage:
def __init__(self, user: str, cmd: str, token: str=None, format: MessageFormat=MessageFormat.STRING, args: str=None, size: int=-1) -> None:
"""Overridden __init__ method sets instance attributes to default values if the corresponding init params are missing. Parameters --... | stack_v2_sparse_classes_36k_train_016073 | 12,481 | permissive | [
{
"docstring": "Overridden __init__ method sets instance attributes to default values if the corresponding init params are missing. Parameters ---------- user : str The user the request corresponds to cmd : str The Arkouda server command name token : str, defaults to None The authentication token corresponding ... | 2 | null | Implement the Python class `RequestMessage` described below.
Class description:
Implement the RequestMessage class.
Method signatures and docstrings:
- def __init__(self, user: str, cmd: str, token: str=None, format: MessageFormat=MessageFormat.STRING, args: str=None, size: int=-1) -> None: Overridden __init__ method... | Implement the Python class `RequestMessage` described below.
Class description:
Implement the RequestMessage class.
Method signatures and docstrings:
- def __init__(self, user: str, cmd: str, token: str=None, format: MessageFormat=MessageFormat.STRING, args: str=None, size: int=-1) -> None: Overridden __init__ method... | 1362cb04f42e9a3af14829f7c0229a986142dec2 | <|skeleton|>
class RequestMessage:
def __init__(self, user: str, cmd: str, token: str=None, format: MessageFormat=MessageFormat.STRING, args: str=None, size: int=-1) -> None:
"""Overridden __init__ method sets instance attributes to default values if the corresponding init params are missing. Parameters --... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RequestMessage:
def __init__(self, user: str, cmd: str, token: str=None, format: MessageFormat=MessageFormat.STRING, args: str=None, size: int=-1) -> None:
"""Overridden __init__ method sets instance attributes to default values if the corresponding init params are missing. Parameters ---------- user ... | the_stack_v2_python_sparse | arkouda/message.py | hokiegeek2/arkouda | train | 1 | |
0d0662c43a5d9a7703fd6b09578c2a3ee47ea32e | [
"RelModelBase.__init__(self, classes, rel_classes, mode, num_gpus, require_overlap_det)\nassert depth_model in DEPTH_MODELS\nself.depth_model = depth_model\nself.pretrained_depth = pretrained_depth\nself.depth_pooling_dim = DEPTH_DIMS[self.depth_model]\nself.depth_channels = DEPTH_CHANNELS[self.depth_model]\nself.p... | <|body_start_0|>
RelModelBase.__init__(self, classes, rel_classes, mode, num_gpus, require_overlap_det)
assert depth_model in DEPTH_MODELS
self.depth_model = depth_model
self.pretrained_depth = pretrained_depth
self.depth_pooling_dim = DEPTH_DIMS[self.depth_model]
self.de... | Depth-Union relation detection model | RelModel | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RelModel:
"""Depth-Union relation detection model"""
def __init__(self, classes, rel_classes, mode='sgdet', num_gpus=1, require_overlap_det=True, depth_model=None, pretrained_depth=False, **kwargs):
""":param classes: object classes :param rel_classes: relationship classes. None if w... | stack_v2_sparse_classes_36k_train_016074 | 6,300 | permissive | [
{
"docstring": ":param classes: object classes :param rel_classes: relationship classes. None if were not using rel mode :param mode: (sgcls, predcls, or sgdet) :param num_gpus: how many GPUS 2 use :param require_overlap_det: Whether two objects must intersect :param depth_model: provided architecture for depth... | 3 | stack_v2_sparse_classes_30k_train_002653 | Implement the Python class `RelModel` described below.
Class description:
Depth-Union relation detection model
Method signatures and docstrings:
- def __init__(self, classes, rel_classes, mode='sgdet', num_gpus=1, require_overlap_det=True, depth_model=None, pretrained_depth=False, **kwargs): :param classes: object cl... | Implement the Python class `RelModel` described below.
Class description:
Depth-Union relation detection model
Method signatures and docstrings:
- def __init__(self, classes, rel_classes, mode='sgdet', num_gpus=1, require_overlap_det=True, depth_model=None, pretrained_depth=False, **kwargs): :param classes: object cl... | 39fb0d493f44ac2daf4bbc8569a1c74e8828da5f | <|skeleton|>
class RelModel:
"""Depth-Union relation detection model"""
def __init__(self, classes, rel_classes, mode='sgdet', num_gpus=1, require_overlap_det=True, depth_model=None, pretrained_depth=False, **kwargs):
""":param classes: object classes :param rel_classes: relationship classes. None if w... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RelModel:
"""Depth-Union relation detection model"""
def __init__(self, classes, rel_classes, mode='sgdet', num_gpus=1, require_overlap_det=True, depth_model=None, pretrained_depth=False, **kwargs):
""":param classes: object classes :param rel_classes: relationship classes. None if were not using... | the_stack_v2_python_sparse | lib/shz_models/rel_model_depth_union.py | sharifza/Depth-VRD | train | 1 |
b8d6e7f6b4a3c3bd8c12c809944e051547c9f642 | [
"self.res_path = str(Path('components/res/'))\nself.data_table = Table.read_table(self.res_path + '/probability_table.csv')\nself.notes = self.data_table.column('octave')\nself.num_notes = num_notes\nself.starting_note = starting_note",
"actual_note = self.notes[self.starting_note]\nnote_list = np.array([actual_n... | <|body_start_0|>
self.res_path = str(Path('components/res/'))
self.data_table = Table.read_table(self.res_path + '/probability_table.csv')
self.notes = self.data_table.column('octave')
self.num_notes = num_notes
self.starting_note = starting_note
<|end_body_0|>
<|body_start_1|>
... | class for using the markov chains | MarkovChains | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MarkovChains:
"""class for using the markov chains"""
def __init__(self, num_notes=20, starting_note='0'):
"""__init__"""
<|body_0|>
def element_selector(self):
"""method for selecting elements"""
<|body_1|>
def sound_player(self, notes):
"""... | stack_v2_sparse_classes_36k_train_016075 | 1,454 | no_license | [
{
"docstring": "__init__",
"name": "__init__",
"signature": "def __init__(self, num_notes=20, starting_note='0')"
},
{
"docstring": "method for selecting elements",
"name": "element_selector",
"signature": "def element_selector(self)"
},
{
"docstring": "method used to play sounds... | 4 | stack_v2_sparse_classes_30k_train_020382 | Implement the Python class `MarkovChains` described below.
Class description:
class for using the markov chains
Method signatures and docstrings:
- def __init__(self, num_notes=20, starting_note='0'): __init__
- def element_selector(self): method for selecting elements
- def sound_player(self, notes): method used to ... | Implement the Python class `MarkovChains` described below.
Class description:
class for using the markov chains
Method signatures and docstrings:
- def __init__(self, num_notes=20, starting_note='0'): __init__
- def element_selector(self): method for selecting elements
- def sound_player(self, notes): method used to ... | 08e7fbb5644306d69f1dac910567df7472593cb2 | <|skeleton|>
class MarkovChains:
"""class for using the markov chains"""
def __init__(self, num_notes=20, starting_note='0'):
"""__init__"""
<|body_0|>
def element_selector(self):
"""method for selecting elements"""
<|body_1|>
def sound_player(self, notes):
"""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MarkovChains:
"""class for using the markov chains"""
def __init__(self, num_notes=20, starting_note='0'):
"""__init__"""
self.res_path = str(Path('components/res/'))
self.data_table = Table.read_table(self.res_path + '/probability_table.csv')
self.notes = self.data_table.... | the_stack_v2_python_sparse | homeworks/generador_de_melodias/components/markov_chains.py | ferpart/metodos_cuantitativos | train | 1 |
27e2db0f96453751978fe2b1455273cfe2e8b1f6 | [
"add_input_output_information(self, input_names, output_name, output_shape)\nzonotope = np.ascontiguousarray(zonotope, dtype=np.double)\nself.num_error_terms = zonotope.shape[1]\nself.zonotope = get_xpp(zonotope)",
"zonotope_shape = self.zonotope.shape\nelement = elina_abstract0_from_zonotope(man, 0, zonotope_sha... | <|body_start_0|>
add_input_output_information(self, input_names, output_name, output_shape)
zonotope = np.ascontiguousarray(zonotope, dtype=np.double)
self.num_error_terms = zonotope.shape[1]
self.zonotope = get_xpp(zonotope)
<|end_body_0|>
<|body_start_1|>
zonotope_shape = self... | DeepzonoInputZonotope | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DeepzonoInputZonotope:
def __init__(self, zonotope, input_names, output_name, output_shape):
"""Arguments --------- specLB : numpy.ndarray 1D array with the lower bound of the input spec specUB : numpy.ndarray 1D array with the upper bound of the input spec output_name : str name of this... | stack_v2_sparse_classes_36k_train_016076 | 34,420 | permissive | [
{
"docstring": "Arguments --------- specLB : numpy.ndarray 1D array with the lower bound of the input spec specUB : numpy.ndarray 1D array with the upper bound of the input spec output_name : str name of this node's output output_shape : iterable iterable of ints with the shape of the output of this node",
... | 2 | stack_v2_sparse_classes_30k_train_019222 | Implement the Python class `DeepzonoInputZonotope` described below.
Class description:
Implement the DeepzonoInputZonotope class.
Method signatures and docstrings:
- def __init__(self, zonotope, input_names, output_name, output_shape): Arguments --------- specLB : numpy.ndarray 1D array with the lower bound of the in... | Implement the Python class `DeepzonoInputZonotope` described below.
Class description:
Implement the DeepzonoInputZonotope class.
Method signatures and docstrings:
- def __init__(self, zonotope, input_names, output_name, output_shape): Arguments --------- specLB : numpy.ndarray 1D array with the lower bound of the in... | 8771d3158b2c64a360d5bdfd4433490863257dd6 | <|skeleton|>
class DeepzonoInputZonotope:
def __init__(self, zonotope, input_names, output_name, output_shape):
"""Arguments --------- specLB : numpy.ndarray 1D array with the lower bound of the input spec specUB : numpy.ndarray 1D array with the upper bound of the input spec output_name : str name of this... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DeepzonoInputZonotope:
def __init__(self, zonotope, input_names, output_name, output_shape):
"""Arguments --------- specLB : numpy.ndarray 1D array with the lower bound of the input spec specUB : numpy.ndarray 1D array with the upper bound of the input spec output_name : str name of this node's output... | the_stack_v2_python_sparse | tf_verify/deepzono_nodes.py | eth-sri/eran | train | 306 | |
5d40f7ee9a5e3b08a51ced198d26641f830966da | [
"threading.Thread.__init__(self)\nself._channel_modeler = channel_modeler\nself._the_device = device\nself._the_channel = the_channel\nself._dist_callback = dist_callback\nself._active = False\nself._status = random.randrange(1, 3)",
"if not self._active:\n raise AttributeError\nif self._status:\n self._the... | <|body_start_0|>
threading.Thread.__init__(self)
self._channel_modeler = channel_modeler
self._the_device = device
self._the_channel = the_channel
self._dist_callback = dist_callback
self._active = False
self._status = random.randrange(1, 3)
<|end_body_0|>
<|body... | Thread representing a channel whose status changes in time. Each channel thread must be associated to a Channel object. When the center_freq method on the ChannelModeler is called, the corresponding ChannelThread is activated. The ChannelThread controls an AbstractDevice object, by changing is central frequency followi... | ChannelThread | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChannelThread:
"""Thread representing a channel whose status changes in time. Each channel thread must be associated to a Channel object. When the center_freq method on the ChannelModeler is called, the corresponding ChannelThread is activated. The ChannelThread controls an AbstractDevice object,... | stack_v2_sparse_classes_36k_train_016077 | 6,582 | permissive | [
{
"docstring": "CTOR. @param channel_modeler ChannelModeler instance. @param device AbstractDevice object instance. @param the_channel Channel object instance. @param dist_callback Distribution callback.",
"name": "__init__",
"signature": "def __init__(self, channel_modeler, device, the_channel, dist_ca... | 4 | stack_v2_sparse_classes_30k_train_002017 | Implement the Python class `ChannelThread` described below.
Class description:
Thread representing a channel whose status changes in time. Each channel thread must be associated to a Channel object. When the center_freq method on the ChannelModeler is called, the corresponding ChannelThread is activated. The ChannelTh... | Implement the Python class `ChannelThread` described below.
Class description:
Thread representing a channel whose status changes in time. Each channel thread must be associated to a Channel object. When the center_freq method on the ChannelModeler is called, the corresponding ChannelThread is activated. The ChannelTh... | aafc0e93a81da86f414743b6b19ff4739045763a | <|skeleton|>
class ChannelThread:
"""Thread representing a channel whose status changes in time. Each channel thread must be associated to a Channel object. When the center_freq method on the ChannelModeler is called, the corresponding ChannelThread is activated. The ChannelThread controls an AbstractDevice object,... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ChannelThread:
"""Thread representing a channel whose status changes in time. Each channel thread must be associated to a Channel object. When the center_freq method on the ChannelModeler is called, the corresponding ChannelThread is activated. The ChannelThread controls an AbstractDevice object, by changing ... | the_stack_v2_python_sparse | python/utils/channel.py | ComputerNetworks-UFRGS/OpERA | train | 3 |
341fe78242e1e71294ac6735e4839ee381f5e106 | [
"if pb == 'classif':\n raise NotImplementedError()\nelif pb == 'regression':\n pass\nelse:\n raise ValueError('Unknown pb: %s' % pb)\nself.no_covar = no_covar",
"if isinstance(x, list):\n x, Sigma = (x[0], x[1])\n log_Sigma = Sigma\n Sigma = torch.exp(log_Sigma) + 1e-06\nC, ndims = (x.shape[1], ... | <|body_start_0|>
if pb == 'classif':
raise NotImplementedError()
elif pb == 'regression':
pass
else:
raise ValueError('Unknown pb: %s' % pb)
self.no_covar = no_covar
<|end_body_0|>
<|body_start_1|>
if isinstance(x, list):
x, Sigma ... | thanks to benoit dufumier https://github.com/Duplums/bhb10k-dl-benchmark/blob/main/losses.py cf. Multivariate Uncertainty in Deep Learning, Russell, IEEE TNLS 21 | MultiVarGaussianLogLkd | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiVarGaussianLogLkd:
"""thanks to benoit dufumier https://github.com/Duplums/bhb10k-dl-benchmark/blob/main/losses.py cf. Multivariate Uncertainty in Deep Learning, Russell, IEEE TNLS 21"""
def __init__(self, pb: str='regression', no_covar=False, **kwargs):
""":param pb: "classif" ... | stack_v2_sparse_classes_36k_train_016078 | 15,293 | no_license | [
{
"docstring": ":param pb: \"classif\" or \"regression\" :param no_covar: If True, assume that the covariance matrix is diagonal :param kwargs: kwargs given to PyTorch Cross Entropy Loss",
"name": "__init__",
"signature": "def __init__(self, pb: str='regression', no_covar=False, **kwargs)"
},
{
... | 2 | stack_v2_sparse_classes_30k_val_000063 | Implement the Python class `MultiVarGaussianLogLkd` described below.
Class description:
thanks to benoit dufumier https://github.com/Duplums/bhb10k-dl-benchmark/blob/main/losses.py cf. Multivariate Uncertainty in Deep Learning, Russell, IEEE TNLS 21
Method signatures and docstrings:
- def __init__(self, pb: str='regr... | Implement the Python class `MultiVarGaussianLogLkd` described below.
Class description:
thanks to benoit dufumier https://github.com/Duplums/bhb10k-dl-benchmark/blob/main/losses.py cf. Multivariate Uncertainty in Deep Learning, Russell, IEEE TNLS 21
Method signatures and docstrings:
- def __init__(self, pb: str='regr... | e1d013b81bdfb2f9692a02dd4a1a860bcb13c02d | <|skeleton|>
class MultiVarGaussianLogLkd:
"""thanks to benoit dufumier https://github.com/Duplums/bhb10k-dl-benchmark/blob/main/losses.py cf. Multivariate Uncertainty in Deep Learning, Russell, IEEE TNLS 21"""
def __init__(self, pb: str='regression', no_covar=False, **kwargs):
""":param pb: "classif" ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MultiVarGaussianLogLkd:
"""thanks to benoit dufumier https://github.com/Duplums/bhb10k-dl-benchmark/blob/main/losses.py cf. Multivariate Uncertainty in Deep Learning, Russell, IEEE TNLS 21"""
def __init__(self, pb: str='regression', no_covar=False, **kwargs):
""":param pb: "classif" or "regressio... | the_stack_v2_python_sparse | segmentation/losses/dice_loss.py | romainVala/torchQC | train | 0 |
d55b50b108a5e76dcacba7e2f69b1134fbf31e50 | [
"import instrument.elements as ies\ninstrument = ies.instrument('instrument')\ngeometer = Geometer(instrument)\ngeometer.finishRegistration()\nreturn",
"import instrument.elements as ies\ninstrument = ies.instrument('instrument')\nmoderator = ies.moderator('moderator', 100.0, 100.0, 10.0)\ninstrument.addElement(m... | <|body_start_0|>
import instrument.elements as ies
instrument = ies.instrument('instrument')
geometer = Geometer(instrument)
geometer.finishRegistration()
return
<|end_body_0|>
<|body_start_1|>
import instrument.elements as ies
instrument = ies.instrument('instru... | Geometer_TestCase | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Geometer_TestCase:
def test1(self):
"""Geometer: simplest instrument"""
<|body_0|>
def test2(self):
"""Geometer: instrument with one moderator given abs position"""
<|body_1|>
def test3(self):
"""Geometer: instrument with one moderator and monito... | stack_v2_sparse_classes_36k_train_016079 | 8,225 | no_license | [
{
"docstring": "Geometer: simplest instrument",
"name": "test1",
"signature": "def test1(self)"
},
{
"docstring": "Geometer: instrument with one moderator given abs position",
"name": "test2",
"signature": "def test2(self)"
},
{
"docstring": "Geometer: instrument with one moderat... | 3 | null | Implement the Python class `Geometer_TestCase` described below.
Class description:
Implement the Geometer_TestCase class.
Method signatures and docstrings:
- def test1(self): Geometer: simplest instrument
- def test2(self): Geometer: instrument with one moderator given abs position
- def test3(self): Geometer: instru... | Implement the Python class `Geometer_TestCase` described below.
Class description:
Implement the Geometer_TestCase class.
Method signatures and docstrings:
- def test1(self): Geometer: simplest instrument
- def test2(self): Geometer: instrument with one moderator given abs position
- def test3(self): Geometer: instru... | 7d6fb88e7ec8245c488ab7988a8518de57dd73df | <|skeleton|>
class Geometer_TestCase:
def test1(self):
"""Geometer: simplest instrument"""
<|body_0|>
def test2(self):
"""Geometer: instrument with one moderator given abs position"""
<|body_1|>
def test3(self):
"""Geometer: instrument with one moderator and monito... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Geometer_TestCase:
def test1(self):
"""Geometer: simplest instrument"""
import instrument.elements as ies
instrument = ies.instrument('instrument')
geometer = Geometer(instrument)
geometer.finishRegistration()
return
def test2(self):
"""Geometer: in... | the_stack_v2_python_sparse | instrument/geometers/Geometer.py | danse-inelastic/instrument | train | 0 | |
2496f123b0ff1cae7a4473d613161b865ab51d26 | [
"if not email or not password:\n raise ValueError\nself.setOpener()\nurl_login = 'http://mp.weixin.qq.com/cgi-bin/login?lang=en_US'\nm = hashlib.md5(password[0:16])\nm.digest()\npassword = m.hexdigest()\nbody = (('username', email), ('pwd', password), ('imgcode', ''), ('f', 'json'))\ntry:\n msg = json.loads(s... | <|body_start_0|>
if not email or not password:
raise ValueError
self.setOpener()
url_login = 'http://mp.weixin.qq.com/cgi-bin/login?lang=en_US'
m = hashlib.md5(password[0:16])
m.digest()
password = m.hexdigest()
body = (('username', email), ('pwd', pas... | Client | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Client:
def __init__(self, email=None, password=None):
"""登录公共平台服务器,如果失败将报客户端登录异常错误 :param email: :param password: :raise:"""
<|body_0|>
def sendTextMsg(self, sendTo, content):
"""给用户发送文字内容,成功返回True,使用时注意两次发送间隔,不能少于2s :param sendTo: :param content: :return:"""
... | stack_v2_sparse_classes_36k_train_016080 | 3,428 | permissive | [
{
"docstring": "登录公共平台服务器,如果失败将报客户端登录异常错误 :param email: :param password: :raise:",
"name": "__init__",
"signature": "def __init__(self, email=None, password=None)"
},
{
"docstring": "给用户发送文字内容,成功返回True,使用时注意两次发送间隔,不能少于2s :param sendTo: :param content: :return:",
"name": "sendTextMsg",
"s... | 3 | stack_v2_sparse_classes_30k_train_018402 | Implement the Python class `Client` described below.
Class description:
Implement the Client class.
Method signatures and docstrings:
- def __init__(self, email=None, password=None): 登录公共平台服务器,如果失败将报客户端登录异常错误 :param email: :param password: :raise:
- def sendTextMsg(self, sendTo, content): 给用户发送文字内容,成功返回True,使用时注意两次发送... | Implement the Python class `Client` described below.
Class description:
Implement the Client class.
Method signatures and docstrings:
- def __init__(self, email=None, password=None): 登录公共平台服务器,如果失败将报客户端登录异常错误 :param email: :param password: :raise:
- def sendTextMsg(self, sendTo, content): 给用户发送文字内容,成功返回True,使用时注意两次发送... | 665d39a2bd82543d5196555f0801ef8fd4a3ee48 | <|skeleton|>
class Client:
def __init__(self, email=None, password=None):
"""登录公共平台服务器,如果失败将报客户端登录异常错误 :param email: :param password: :raise:"""
<|body_0|>
def sendTextMsg(self, sendTo, content):
"""给用户发送文字内容,成功返回True,使用时注意两次发送间隔,不能少于2s :param sendTo: :param content: :return:"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Client:
def __init__(self, email=None, password=None):
"""登录公共平台服务器,如果失败将报客户端登录异常错误 :param email: :param password: :raise:"""
if not email or not password:
raise ValueError
self.setOpener()
url_login = 'http://mp.weixin.qq.com/cgi-bin/login?lang=en_US'
m = h... | the_stack_v2_python_sparse | all-gists/5168051/snippet.py | gistable/gistable | train | 76 | |
9086a96e3d74cf6d00f9b64e13836214d89f1c0d | [
"self.memory = {}\nself.knn_models = {}\nself.n_neighbors = n_neighbors",
"sett_key = (case_t.settings['photo'], case_t.settings['spectrum'], case_t.settings['color'])\ndelta = case_t1.reward - case_t.reward\nexperience = [case_t.x, delta]\nif not sett_key in self.memory:\n self.memory[sett_key] = {}\nif not a... | <|body_start_0|>
self.memory = {}
self.knn_models = {}
self.n_neighbors = n_neighbors
<|end_body_0|>
<|body_start_1|>
sett_key = (case_t.settings['photo'], case_t.settings['spectrum'], case_t.settings['color'])
delta = case_t1.reward - case_t.reward
experience = [case_t.... | Recommender | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Recommender:
def __init__(self, n_neighbors=1):
"""Parameters ---------- cases_groups: dict Dictionary with neighbour candidates cases grouped by the number of photometric, spectrum and color observations (n_obs, n_spec, n_color). This would be the exploration space to decide which step ... | stack_v2_sparse_classes_36k_train_016081 | 4,294 | permissive | [
{
"docstring": "Parameters ---------- cases_groups: dict Dictionary with neighbour candidates cases grouped by the number of photometric, spectrum and color observations (n_obs, n_spec, n_color). This would be the exploration space to decide which step is the best in a given scenario. Each group is a dictionary... | 5 | stack_v2_sparse_classes_30k_train_007894 | Implement the Python class `Recommender` described below.
Class description:
Implement the Recommender class.
Method signatures and docstrings:
- def __init__(self, n_neighbors=1): Parameters ---------- cases_groups: dict Dictionary with neighbour candidates cases grouped by the number of photometric, spectrum and co... | Implement the Python class `Recommender` described below.
Class description:
Implement the Recommender class.
Method signatures and docstrings:
- def __init__(self, n_neighbors=1): Parameters ---------- cases_groups: dict Dictionary with neighbour candidates cases grouped by the number of photometric, spectrum and co... | 930fa3089230fdaec44e99d1d36e7970824708fd | <|skeleton|>
class Recommender:
def __init__(self, n_neighbors=1):
"""Parameters ---------- cases_groups: dict Dictionary with neighbour candidates cases grouped by the number of photometric, spectrum and color observations (n_obs, n_spec, n_color). This would be the exploration space to decide which step ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Recommender:
def __init__(self, n_neighbors=1):
"""Parameters ---------- cases_groups: dict Dictionary with neighbour candidates cases grouped by the number of photometric, spectrum and color observations (n_obs, n_spec, n_color). This would be the exploration space to decide which step is the best in... | the_stack_v2_python_sparse | src/models/rl/player/baseline1.py | jastudillo1/A-Reinforcement-Learning-based-Follow-Up-Framework | train | 0 | |
b9e85bf87b6ebc4ba4da8acab3dbe3770533d11a | [
"if not pushed and (not popped):\n return True\nstack = []\nwhile popped:\n flag = len(pushed)\n for i, val in enumerate(pushed):\n stack.append(val)\n if val == popped[0]:\n flag = i + 1\n break\n pushed = pushed[flag:]\n start = 0\n while start < len(popped) a... | <|body_start_0|>
if not pushed and (not popped):
return True
stack = []
while popped:
flag = len(pushed)
for i, val in enumerate(pushed):
stack.append(val)
if val == popped[0]:
flag = i + 1
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def validateStackSequences(self, pushed, popped):
""":type pushed: List[int] :type popped: List[int] :rtype: bool 72 ms"""
<|body_0|>
def validateStackSequences_1(self, pushed, popped):
"""28MS :param pushed: :param popped: :return:"""
<|body_1|>
<... | stack_v2_sparse_classes_36k_train_016082 | 2,392 | no_license | [
{
"docstring": ":type pushed: List[int] :type popped: List[int] :rtype: bool 72 ms",
"name": "validateStackSequences",
"signature": "def validateStackSequences(self, pushed, popped)"
},
{
"docstring": "28MS :param pushed: :param popped: :return:",
"name": "validateStackSequences_1",
"sig... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def validateStackSequences(self, pushed, popped): :type pushed: List[int] :type popped: List[int] :rtype: bool 72 ms
- def validateStackSequences_1(self, pushed, popped): 28MS :p... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def validateStackSequences(self, pushed, popped): :type pushed: List[int] :type popped: List[int] :rtype: bool 72 ms
- def validateStackSequences_1(self, pushed, popped): 28MS :p... | 679a2b246b8b6bb7fc55ed1c8096d3047d6d4461 | <|skeleton|>
class Solution:
def validateStackSequences(self, pushed, popped):
""":type pushed: List[int] :type popped: List[int] :rtype: bool 72 ms"""
<|body_0|>
def validateStackSequences_1(self, pushed, popped):
"""28MS :param pushed: :param popped: :return:"""
<|body_1|>
<... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def validateStackSequences(self, pushed, popped):
""":type pushed: List[int] :type popped: List[int] :rtype: bool 72 ms"""
if not pushed and (not popped):
return True
stack = []
while popped:
flag = len(pushed)
for i, val in enumera... | the_stack_v2_python_sparse | ValidateStackSequences_MID_946.py | 953250587/leetcode-python | train | 2 | |
421561e2b24cdc7e74060af3be6626225c515b6f | [
"if node.next != None:\n tmp = node.next\n node.val = node.next.val\n node.next = node.next.next\n del tmp\nelse:\n del node",
"p, q = (node, node.next)\nwhile p and q:\n p.val = q.val\n if q.next == None:\n p.next = None\n p = q\n q = q.next"
] | <|body_start_0|>
if node.next != None:
tmp = node.next
node.val = node.next.val
node.next = node.next.next
del tmp
else:
del node
<|end_body_0|>
<|body_start_1|>
p, q = (node, node.next)
while p and q:
p.val = q.val... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def deleteNode1(self, node):
""":type node: ListNode :rtype: void Do not return anything, modify node in-place instead."""
<|body_0|>
def deleteNode2(self, node):
""":type node: ListNode :rtype: void Do not return anything, modify node in-place instead."""
... | stack_v2_sparse_classes_36k_train_016083 | 1,130 | no_license | [
{
"docstring": ":type node: ListNode :rtype: void Do not return anything, modify node in-place instead.",
"name": "deleteNode1",
"signature": "def deleteNode1(self, node)"
},
{
"docstring": ":type node: ListNode :rtype: void Do not return anything, modify node in-place instead.",
"name": "de... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def deleteNode1(self, node): :type node: ListNode :rtype: void Do not return anything, modify node in-place instead.
- def deleteNode2(self, node): :type node: ListNode :rtype: v... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def deleteNode1(self, node): :type node: ListNode :rtype: void Do not return anything, modify node in-place instead.
- def deleteNode2(self, node): :type node: ListNode :rtype: v... | d3e8669f932fc2e22711e8b7590d3365d020e189 | <|skeleton|>
class Solution:
def deleteNode1(self, node):
""":type node: ListNode :rtype: void Do not return anything, modify node in-place instead."""
<|body_0|>
def deleteNode2(self, node):
""":type node: ListNode :rtype: void Do not return anything, modify node in-place instead."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def deleteNode1(self, node):
""":type node: ListNode :rtype: void Do not return anything, modify node in-place instead."""
if node.next != None:
tmp = node.next
node.val = node.next.val
node.next = node.next.next
del tmp
else:
... | the_stack_v2_python_sparse | leetcode/237.py | liuweilin17/algorithm | train | 3 | |
e227b26cb22484f0788feb7ca59a082801c31ca9 | [
"return_codes = []\nfor nc_process in self:\n return_codes.append(nc_process.return_code)",
"for nc_process in self:\n if not nc_process.is_ok:\n return False\nreturn True",
"NC_processes = []\nfor nc_process in self:\n NC_processes.append('NCProc(\\n\\tcmd={}\\n\\treturn_code={}'.format(' '.joi... | <|body_start_0|>
return_codes = []
for nc_process in self:
return_codes.append(nc_process.return_code)
<|end_body_0|>
<|body_start_1|>
for nc_process in self:
if not nc_process.is_ok:
return False
return True
<|end_body_1|>
<|body_start_2|>
... | Processes class aggregates Process list. Provide helper methods to retrieve information about all executed processes. | NCProcesses | [
"MIT",
"Intel",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NCProcesses:
"""Processes class aggregates Process list. Provide helper methods to retrieve information about all executed processes."""
def return_code_all(self) -> None:
"""Provide list of return codes of all Process. :rtype : list :return: List of int with process return codes."""... | stack_v2_sparse_classes_36k_train_016084 | 2,271 | permissive | [
{
"docstring": "Provide list of return codes of all Process. :rtype : list :return: List of int with process return codes.",
"name": "return_code_all",
"signature": "def return_code_all(self) -> None"
},
{
"docstring": "Property provide information if all executed process during one call execute... | 4 | null | Implement the Python class `NCProcesses` described below.
Class description:
Processes class aggregates Process list. Provide helper methods to retrieve information about all executed processes.
Method signatures and docstrings:
- def return_code_all(self) -> None: Provide list of return codes of all Process. :rtype ... | Implement the Python class `NCProcesses` described below.
Class description:
Processes class aggregates Process list. Provide helper methods to retrieve information about all executed processes.
Method signatures and docstrings:
- def return_code_all(self) -> None: Provide list of return codes of all Process. :rtype ... | 3976edc4215398e69ce0213f87ec295f5dc96e0e | <|skeleton|>
class NCProcesses:
"""Processes class aggregates Process list. Provide helper methods to retrieve information about all executed processes."""
def return_code_all(self) -> None:
"""Provide list of return codes of all Process. :rtype : list :return: List of int with process return codes."""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NCProcesses:
"""Processes class aggregates Process list. Provide helper methods to retrieve information about all executed processes."""
def return_code_all(self) -> None:
"""Provide list of return codes of all Process. :rtype : list :return: List of int with process return codes."""
retu... | the_stack_v2_python_sparse | neural_compressor/ux/utils/processes.py | Skp80/neural-compressor | train | 0 |
42f726b0b6f44c97b7b4f1cb8200e1d4dfee2632 | [
"self.signature_package_formats = signature_package_formats\nself.pades_settings = pades_settings\nself.additional_properties = additional_properties",
"if dictionary is None:\n return None\nsignature_package_formats = dictionary.get('signaturePackageFormats')\npades_settings = idfy_rest_client.models.pades_se... | <|body_start_0|>
self.signature_package_formats = signature_package_formats
self.pades_settings = pades_settings
self.additional_properties = additional_properties
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
signature_package_formats = dictiona... | Implementation of the 'Packaging' model. TODO: type model description here. Attributes: signature_package_formats (list of SignaturePackageFormat): The format(s) that you will be able to fetch the signed document afterwards. Read more about SignaturePackage format in the documentation. (The native package format is inc... | Packaging | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Packaging:
"""Implementation of the 'Packaging' model. TODO: type model description here. Attributes: signature_package_formats (list of SignaturePackageFormat): The format(s) that you will be able to fetch the signed document afterwards. Read more about SignaturePackage format in the documentati... | stack_v2_sparse_classes_36k_train_016085 | 2,719 | permissive | [
{
"docstring": "Constructor for the Packaging class",
"name": "__init__",
"signature": "def __init__(self, signature_package_formats=None, pades_settings=None, additional_properties={})"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dicti... | 2 | null | Implement the Python class `Packaging` described below.
Class description:
Implementation of the 'Packaging' model. TODO: type model description here. Attributes: signature_package_formats (list of SignaturePackageFormat): The format(s) that you will be able to fetch the signed document afterwards. Read more about Sig... | Implement the Python class `Packaging` described below.
Class description:
Implementation of the 'Packaging' model. TODO: type model description here. Attributes: signature_package_formats (list of SignaturePackageFormat): The format(s) that you will be able to fetch the signed document afterwards. Read more about Sig... | fa3918a6c54ea0eedb9146578645b7eb1755b642 | <|skeleton|>
class Packaging:
"""Implementation of the 'Packaging' model. TODO: type model description here. Attributes: signature_package_formats (list of SignaturePackageFormat): The format(s) that you will be able to fetch the signed document afterwards. Read more about SignaturePackage format in the documentati... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Packaging:
"""Implementation of the 'Packaging' model. TODO: type model description here. Attributes: signature_package_formats (list of SignaturePackageFormat): The format(s) that you will be able to fetch the signed document afterwards. Read more about SignaturePackage format in the documentation. (The nati... | the_stack_v2_python_sparse | idfy_rest_client/models/packaging.py | dealflowteam/Idfy | train | 0 |
4658d3005b8558d5698280ca2ba9b08494be7b27 | [
"Exception.__init__(self)\nself.rank = rank\nself.name = name\nif exc_info == None:\n exception_type, exception_instance, exception_traceback = sys.exc_info()\nelse:\n exception_type, exception_instance, exception_traceback = exc_info\nif not exception_type:\n return\nif isinstance(exception_type, str):\n ... | <|body_start_0|>
Exception.__init__(self)
self.rank = rank
self.name = name
if exc_info == None:
exception_type, exception_instance, exception_traceback = sys.exc_info()
else:
exception_type, exception_instance, exception_traceback = exc_info
if no... | A wrapper exception for an exception captured on a slave processor. The wrapper will remember the stack trace on the remote machine and when raised and caught has a string that includes the remote stack trace, which will be displayed along with the stack trace on the master. | Capturing_exception | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Capturing_exception:
"""A wrapper exception for an exception captured on a slave processor. The wrapper will remember the stack trace on the remote machine and when raised and caught has a string that includes the remote stack trace, which will be displayed along with the stack trace on the maste... | stack_v2_sparse_classes_36k_train_016086 | 11,187 | no_license | [
{
"docstring": "Initialise the wrapping exception. @todo: Would it be easier to pass a processor here. @keyword exc_info: Exception information as produced by sys.exc_info(). @type exc_info: tuple @keyword rank: The rank of the processor on which the exception was raised. The value is always greater than 1. @ty... | 2 | stack_v2_sparse_classes_30k_train_012167 | Implement the Python class `Capturing_exception` described below.
Class description:
A wrapper exception for an exception captured on a slave processor. The wrapper will remember the stack trace on the remote machine and when raised and caught has a string that includes the remote stack trace, which will be displayed ... | Implement the Python class `Capturing_exception` described below.
Class description:
A wrapper exception for an exception captured on a slave processor. The wrapper will remember the stack trace on the remote machine and when raised and caught has a string that includes the remote stack trace, which will be displayed ... | c317326ddeacd1a1c608128769676899daeae531 | <|skeleton|>
class Capturing_exception:
"""A wrapper exception for an exception captured on a slave processor. The wrapper will remember the stack trace on the remote machine and when raised and caught has a string that includes the remote stack trace, which will be displayed along with the stack trace on the maste... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Capturing_exception:
"""A wrapper exception for an exception captured on a slave processor. The wrapper will remember the stack trace on the remote machine and when raised and caught has a string that includes the remote stack trace, which will be displayed along with the stack trace on the master."""
de... | the_stack_v2_python_sparse | multi/misc.py | jlec/relax | train | 4 |
3c54577a58ae0980ae7e50bba98f4e78f9be434d | [
"query, session = context[:2]\ncondition = True\nif 's' in query:\n condition = Plugin.name.matches(query.s) | Plugin.description.matches(query.s)\nplugins = session.query(Plugin, condition)\nreturn cv.create_json('success', cv.dictize(plugins))",
"request, session = context[:2]\nzip_file = ZipFile(BytesIO(req... | <|body_start_0|>
query, session = context[:2]
condition = True
if 's' in query:
condition = Plugin.name.matches(query.s) | Plugin.description.matches(query.s)
plugins = session.query(Plugin, condition)
return cv.create_json('success', cv.dictize(plugins))
<|end_body_0... | PluginCollectionEndpoint | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PluginCollectionEndpoint:
def on_get(self, context):
"""Retrieve a list of plugins."""
<|body_0|>
def on_post(self, context):
"""Upload a plugin."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
query, session = context[:2]
condition = True
... | stack_v2_sparse_classes_36k_train_016087 | 1,550 | permissive | [
{
"docstring": "Retrieve a list of plugins.",
"name": "on_get",
"signature": "def on_get(self, context)"
},
{
"docstring": "Upload a plugin.",
"name": "on_post",
"signature": "def on_post(self, context)"
}
] | 2 | stack_v2_sparse_classes_30k_train_014550 | Implement the Python class `PluginCollectionEndpoint` described below.
Class description:
Implement the PluginCollectionEndpoint class.
Method signatures and docstrings:
- def on_get(self, context): Retrieve a list of plugins.
- def on_post(self, context): Upload a plugin. | Implement the Python class `PluginCollectionEndpoint` described below.
Class description:
Implement the PluginCollectionEndpoint class.
Method signatures and docstrings:
- def on_get(self, context): Retrieve a list of plugins.
- def on_post(self, context): Upload a plugin.
<|skeleton|>
class PluginCollectionEndpoint... | 20fd6a3cc42af5f2cde73e3b100d3edeb4e50c01 | <|skeleton|>
class PluginCollectionEndpoint:
def on_get(self, context):
"""Retrieve a list of plugins."""
<|body_0|>
def on_post(self, context):
"""Upload a plugin."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PluginCollectionEndpoint:
def on_get(self, context):
"""Retrieve a list of plugins."""
query, session = context[:2]
condition = True
if 's' in query:
condition = Plugin.name.matches(query.s) | Plugin.description.matches(query.s)
plugins = session.query(Plugi... | the_stack_v2_python_sparse | cvpl-homepage/homepage/api.py | robinsax/canvas-plugin-multirepo | train | 0 | |
97126404bc1cbec7c9daa3622909b52755830540 | [
"self.encoding_size = encoding_size\nself.policy_model = policy_model\nself.next_visual_in: List[tf.Tensor] = []\nencoded_state, encoded_next_state = self.create_curiosity_encoders()\nself.create_inverse_model(encoded_state, encoded_next_state)\nself.create_forward_model(encoded_state, encoded_next_state)\nself.cre... | <|body_start_0|>
self.encoding_size = encoding_size
self.policy_model = policy_model
self.next_visual_in: List[tf.Tensor] = []
encoded_state, encoded_next_state = self.create_curiosity_encoders()
self.create_inverse_model(encoded_state, encoded_next_state)
self.create_for... | CuriosityModel | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CuriosityModel:
def __init__(self, policy_model: LearningModel, encoding_size: int=128, learning_rate: float=0.0003):
"""Creates the curiosity model for the Curiosity reward Generator :param policy_model: The model being used by the learning policy :param encoding_size: The size of the e... | stack_v2_sparse_classes_36k_train_016088 | 8,093 | permissive | [
{
"docstring": "Creates the curiosity model for the Curiosity reward Generator :param policy_model: The model being used by the learning policy :param encoding_size: The size of the encoding for the Curiosity module :param learning_rate: The learning rate for the curiosity module",
"name": "__init__",
"... | 5 | stack_v2_sparse_classes_30k_train_018324 | Implement the Python class `CuriosityModel` described below.
Class description:
Implement the CuriosityModel class.
Method signatures and docstrings:
- def __init__(self, policy_model: LearningModel, encoding_size: int=128, learning_rate: float=0.0003): Creates the curiosity model for the Curiosity reward Generator :... | Implement the Python class `CuriosityModel` described below.
Class description:
Implement the CuriosityModel class.
Method signatures and docstrings:
- def __init__(self, policy_model: LearningModel, encoding_size: int=128, learning_rate: float=0.0003): Creates the curiosity model for the Curiosity reward Generator :... | 334df1e8afbfff3544413ade46fb12f03556014b | <|skeleton|>
class CuriosityModel:
def __init__(self, policy_model: LearningModel, encoding_size: int=128, learning_rate: float=0.0003):
"""Creates the curiosity model for the Curiosity reward Generator :param policy_model: The model being used by the learning policy :param encoding_size: The size of the e... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CuriosityModel:
def __init__(self, policy_model: LearningModel, encoding_size: int=128, learning_rate: float=0.0003):
"""Creates the curiosity model for the Curiosity reward Generator :param policy_model: The model being used by the learning policy :param encoding_size: The size of the encoding for th... | the_stack_v2_python_sparse | mlagents/trainers/components/reward_signals/curiosity/model.py | Abluceli/HRG-SAC | train | 7 | |
b25dc4c52ef011ef0753cfdf82b31376294f8ff9 | [
"nums.sort()\nret = [[]]\nprev = []\nfor i, num in enumerate(nums):\n if i > 0 and nums[i - 1] == num:\n temp = [l + [num] for l in prev]\n else:\n temp = [l + [num] for l in ret]\n prev = temp\n ret.extend(temp)\nreturn ret",
"def dfs(i, path):\n ret.append(path[:])\n for j in ran... | <|body_start_0|>
nums.sort()
ret = [[]]
prev = []
for i, num in enumerate(nums):
if i > 0 and nums[i - 1] == num:
temp = [l + [num] for l in prev]
else:
temp = [l + [num] for l in ret]
prev = temp
ret.extend(... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def subsetsWithDup(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_0|>
def subsetsWithDup(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
nums.sort()
... | stack_v2_sparse_classes_36k_train_016089 | 982 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: List[List[int]]",
"name": "subsetsWithDup",
"signature": "def subsetsWithDup(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: List[List[int]]",
"name": "subsetsWithDup",
"signature": "def subsetsWithDup(self, nums)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def subsetsWithDup(self, nums): :type nums: List[int] :rtype: List[List[int]]
- def subsetsWithDup(self, nums): :type nums: List[int] :rtype: List[List[int]] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def subsetsWithDup(self, nums): :type nums: List[int] :rtype: List[List[int]]
- def subsetsWithDup(self, nums): :type nums: List[int] :rtype: List[List[int]]
<|skeleton|>
class ... | 9fa6f81d8968dea51c255a6f92708cfc6bafb057 | <|skeleton|>
class Solution:
def subsetsWithDup(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_0|>
def subsetsWithDup(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def subsetsWithDup(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
nums.sort()
ret = [[]]
prev = []
for i, num in enumerate(nums):
if i > 0 and nums[i - 1] == num:
temp = [l + [num] for l in prev]
else:
... | the_stack_v2_python_sparse | 90. Subsets II.py | ChihaoFeng/Leetcode | train | 0 | |
927386ee855b5cc5da8bb1b416cc1de92d4116c5 | [
"list_conf = conf.Configure2Dict('./conf/test.list.conf', False).get_dict()\nut.assert_eq(len(list_conf['arrary_test']['a']), 4)\nut.assert_eq(len(list_conf['arrary_test']['b']), 2)\nut.assert_eq(len(list_conf['arrary_test']['c']), 1)\nut.assert_eq(list_conf['sepecial_chars']['with_back_slash_d'], '^/((home(/disk\\... | <|body_start_0|>
list_conf = conf.Configure2Dict('./conf/test.list.conf', False).get_dict()
ut.assert_eq(len(list_conf['arrary_test']['a']), 4)
ut.assert_eq(len(list_conf['arrary_test']['b']), 2)
ut.assert_eq(len(list_conf['arrary_test']['c']), 1)
ut.assert_eq(list_conf['sepecial... | test cup.util.conf | TestUtilConf | [
"Apache-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestUtilConf:
"""test cup.util.conf"""
def test_arrary_special_chars(self):
"""test arrary"""
<|body_0|>
def test_include_files(self):
"""test include"""
<|body_1|>
def test_include_wrong_file(self):
"""test wrong include"""
<|body_2|... | stack_v2_sparse_classes_36k_train_016090 | 3,142 | permissive | [
{
"docstring": "test arrary",
"name": "test_arrary_special_chars",
"signature": "def test_arrary_special_chars(self)"
},
{
"docstring": "test include",
"name": "test_include_files",
"signature": "def test_include_files(self)"
},
{
"docstring": "test wrong include",
"name": "t... | 3 | stack_v2_sparse_classes_30k_train_004249 | Implement the Python class `TestUtilConf` described below.
Class description:
test cup.util.conf
Method signatures and docstrings:
- def test_arrary_special_chars(self): test arrary
- def test_include_files(self): test include
- def test_include_wrong_file(self): test wrong include | Implement the Python class `TestUtilConf` described below.
Class description:
test cup.util.conf
Method signatures and docstrings:
- def test_arrary_special_chars(self): test arrary
- def test_include_files(self): test include
- def test_include_wrong_file(self): test wrong include
<|skeleton|>
class TestUtilConf:
... | 0e09b393673dacdd985c064cf03062b950a74179 | <|skeleton|>
class TestUtilConf:
"""test cup.util.conf"""
def test_arrary_special_chars(self):
"""test arrary"""
<|body_0|>
def test_include_files(self):
"""test include"""
<|body_1|>
def test_include_wrong_file(self):
"""test wrong include"""
<|body_2|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestUtilConf:
"""test cup.util.conf"""
def test_arrary_special_chars(self):
"""test arrary"""
list_conf = conf.Configure2Dict('./conf/test.list.conf', False).get_dict()
ut.assert_eq(len(list_conf['arrary_test']['a']), 4)
ut.assert_eq(len(list_conf['arrary_test']['b']), 2)
... | the_stack_v2_python_sparse | cup_test/cup_util_conf_test.py | liu0208xuan/CUP | train | 0 |
4bd7fcc206aed6060b170dded48af132a4a454d0 | [
"filters = options.get('conv_filters', [[16, [8, 8], 4], [32, [4, 4], 2], [512, [10, 10], 1]])\nlayers = []\nin_channels, in_size = (inputs[0], inputs[1:])\nfor out_channels, kernel, stride in filters[:-1]:\n padding, out_size = valid_padding(in_size, kernel, [stride, stride])\n layers.append(SlimConv2d(in_ch... | <|body_start_0|>
filters = options.get('conv_filters', [[16, [8, 8], 4], [32, [4, 4], 2], [512, [10, 10], 1]])
layers = []
in_channels, in_size = (inputs[0], inputs[1:])
for out_channels, kernel, stride in filters[:-1]:
padding, out_size = valid_padding(in_size, kernel, [stri... | Generic vision network | VisionNetwork | [
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VisionNetwork:
"""Generic vision network"""
def _init(self, inputs, num_outputs, options):
"""TF visionnet in PyTorch. Params: inputs (tuple): (channels, rows/height, cols/width) num_outputs (int): logits size"""
<|body_0|>
def hidden_layers(self, obs):
"""Intern... | stack_v2_sparse_classes_36k_train_016091 | 2,254 | permissive | [
{
"docstring": "TF visionnet in PyTorch. Params: inputs (tuple): (channels, rows/height, cols/width) num_outputs (int): logits size",
"name": "_init",
"signature": "def _init(self, inputs, num_outputs, options)"
},
{
"docstring": "Internal method - pass in Variables, not numpy arrays args: obs: ... | 3 | null | Implement the Python class `VisionNetwork` described below.
Class description:
Generic vision network
Method signatures and docstrings:
- def _init(self, inputs, num_outputs, options): TF visionnet in PyTorch. Params: inputs (tuple): (channels, rows/height, cols/width) num_outputs (int): logits size
- def hidden_laye... | Implement the Python class `VisionNetwork` described below.
Class description:
Generic vision network
Method signatures and docstrings:
- def _init(self, inputs, num_outputs, options): TF visionnet in PyTorch. Params: inputs (tuple): (channels, rows/height, cols/width) num_outputs (int): logits size
- def hidden_laye... | 8e333977e0991738558f4c8bb737da5fb29df0c6 | <|skeleton|>
class VisionNetwork:
"""Generic vision network"""
def _init(self, inputs, num_outputs, options):
"""TF visionnet in PyTorch. Params: inputs (tuple): (channels, rows/height, cols/width) num_outputs (int): logits size"""
<|body_0|>
def hidden_layers(self, obs):
"""Intern... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VisionNetwork:
"""Generic vision network"""
def _init(self, inputs, num_outputs, options):
"""TF visionnet in PyTorch. Params: inputs (tuple): (channels, rows/height, cols/width) num_outputs (int): logits size"""
filters = options.get('conv_filters', [[16, [8, 8], 4], [32, [4, 4], 2], [51... | the_stack_v2_python_sparse | python/ray/rllib/models/pytorch/visionnet.py | cathywu/ray | train | 2 |
258dd787b9119b8928eafee95259b747e61dcef3 | [
"super().__init__()\nself.hidden_size = hidden_size\nself.embedding = nn.Embedding(input_size, hidden_size)\nself.gru = nn.GRU(hidden_size, hidden_size, num_layers=numlayers, batch_first=True)",
"embedded = self.embedding(input)\noutput, hidden = self.gru(embedded, hidden)\nreturn (output, hidden)"
] | <|body_start_0|>
super().__init__()
self.hidden_size = hidden_size
self.embedding = nn.Embedding(input_size, hidden_size)
self.gru = nn.GRU(hidden_size, hidden_size, num_layers=numlayers, batch_first=True)
<|end_body_0|>
<|body_start_1|>
embedded = self.embedding(input)
... | Encodes the input context. | EncoderRNN | [
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EncoderRNN:
"""Encodes the input context."""
def __init__(self, input_size, hidden_size, numlayers):
"""Initialize encoder. :param input_size: size of embedding :param hidden_size: size of GRU hidden layers :param numlayers: number of GRU layers"""
<|body_0|>
def forward... | stack_v2_sparse_classes_36k_train_016092 | 10,301 | permissive | [
{
"docstring": "Initialize encoder. :param input_size: size of embedding :param hidden_size: size of GRU hidden layers :param numlayers: number of GRU layers",
"name": "__init__",
"signature": "def __init__(self, input_size, hidden_size, numlayers)"
},
{
"docstring": "Return encoded state. :para... | 2 | null | Implement the Python class `EncoderRNN` described below.
Class description:
Encodes the input context.
Method signatures and docstrings:
- def __init__(self, input_size, hidden_size, numlayers): Initialize encoder. :param input_size: size of embedding :param hidden_size: size of GRU hidden layers :param numlayers: nu... | Implement the Python class `EncoderRNN` described below.
Class description:
Encodes the input context.
Method signatures and docstrings:
- def __init__(self, input_size, hidden_size, numlayers): Initialize encoder. :param input_size: size of embedding :param hidden_size: size of GRU hidden layers :param numlayers: nu... | ccf60824b28f0ce8ceda44a7ce52a0d117669115 | <|skeleton|>
class EncoderRNN:
"""Encodes the input context."""
def __init__(self, input_size, hidden_size, numlayers):
"""Initialize encoder. :param input_size: size of embedding :param hidden_size: size of GRU hidden layers :param numlayers: number of GRU layers"""
<|body_0|>
def forward... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EncoderRNN:
"""Encodes the input context."""
def __init__(self, input_size, hidden_size, numlayers):
"""Initialize encoder. :param input_size: size of embedding :param hidden_size: size of GRU hidden layers :param numlayers: number of GRU layers"""
super().__init__()
self.hidden_s... | the_stack_v2_python_sparse | ParlAI/parlai/agents/example_seq2seq/example_seq2seq.py | ethanjperez/convince | train | 27 |
0b534c0d6b19042785f0af5ba68d535156105504 | [
"if not root:\n return 0\nif root.left and root.right:\n return min(self.minDepth(root.left), self.minDepth(root.right)) + 1\nelif root.left:\n return self.minDepth(root.left) + 1\nelse:\n return self.minDepth(root.right) + 1",
"def traverse(node, height, min_height):\n if not node:\n min_he... | <|body_start_0|>
if not root:
return 0
if root.left and root.right:
return min(self.minDepth(root.left), self.minDepth(root.right)) + 1
elif root.left:
return self.minDepth(root.left) + 1
else:
return self.minDepth(root.right) + 1
<|end_bod... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minDepth(self, root):
""":type root: TreeNode :rtype: int"""
<|body_0|>
def minDepth_verbose(self, root):
""":type root: TreeNode :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not root:
return 0
if ... | stack_v2_sparse_classes_36k_train_016093 | 2,489 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: int",
"name": "minDepth",
"signature": "def minDepth(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: int",
"name": "minDepth_verbose",
"signature": "def minDepth_verbose(self, root)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minDepth(self, root): :type root: TreeNode :rtype: int
- def minDepth_verbose(self, root): :type root: TreeNode :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minDepth(self, root): :type root: TreeNode :rtype: int
- def minDepth_verbose(self, root): :type root: TreeNode :rtype: int
<|skeleton|>
class Solution:
def minDepth(se... | e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59 | <|skeleton|>
class Solution:
def minDepth(self, root):
""":type root: TreeNode :rtype: int"""
<|body_0|>
def minDepth_verbose(self, root):
""":type root: TreeNode :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def minDepth(self, root):
""":type root: TreeNode :rtype: int"""
if not root:
return 0
if root.left and root.right:
return min(self.minDepth(root.left), self.minDepth(root.right)) + 1
elif root.left:
return self.minDepth(root.left) ... | the_stack_v2_python_sparse | src/lt_111.py | oxhead/CodingYourWay | train | 0 | |
c6b724d3e4e69af61fdfb63ace6d534a8081399f | [
"self.debug = False\nself.filename = None\nself.endpoint = None\nself.engine = None\nself.Base = None\nself.meta = None\nif not database.__monostate:\n database.__monostate = self.__dict__\n self.activate()\nelse:\n self.__dict__ = database.__monostate",
"self.filename = Config.path_expand(os.path.join('... | <|body_start_0|>
self.debug = False
self.filename = None
self.endpoint = None
self.engine = None
self.Base = None
self.meta = None
if not database.__monostate:
database.__monostate = self.__dict__
self.activate()
else:
s... | A simple class with all the details to create and provide some elementary methods for the database. This class is a state sharing class also known as Borg Pattern. Thus, multiple instantiations will share the same sate. TODO: An import to the model.py will instantiate the db object. | database | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class database:
"""A simple class with all the details to create and provide some elementary methods for the database. This class is a state sharing class also known as Borg Pattern. Thus, multiple instantiations will share the same sate. TODO: An import to the model.py will instantiate the db object."... | stack_v2_sparse_classes_36k_train_016094 | 22,814 | permissive | [
{
"docstring": "Initializes the database and shares the state with other instantiations of it",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "activates the shared variables",
"name": "activate",
"signature": "def activate(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_018897 | Implement the Python class `database` described below.
Class description:
A simple class with all the details to create and provide some elementary methods for the database. This class is a state sharing class also known as Borg Pattern. Thus, multiple instantiations will share the same sate. TODO: An import to the mo... | Implement the Python class `database` described below.
Class description:
A simple class with all the details to create and provide some elementary methods for the database. This class is a state sharing class also known as Borg Pattern. Thus, multiple instantiations will share the same sate. TODO: An import to the mo... | ec43eb44be50e10d962ed69631e0a8f83f55c5ca | <|skeleton|>
class database:
"""A simple class with all the details to create and provide some elementary methods for the database. This class is a state sharing class also known as Borg Pattern. Thus, multiple instantiations will share the same sate. TODO: An import to the model.py will instantiate the db object."... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class database:
"""A simple class with all the details to create and provide some elementary methods for the database. This class is a state sharing class also known as Borg Pattern. Thus, multiple instantiations will share the same sate. TODO: An import to the model.py will instantiate the db object."""
def _... | the_stack_v2_python_sparse | cloudmesh_client/db/model.py | izelarabm/client | train | 0 |
035148d5be5f89589fe82b4a4f100972a85ee38b | [
"ctx.alpha = alpha\nctx.offset = offset\nscale = 2 ** nbit - 1 if alpha is None else (2 ** nbit - 1) / alpha\nctx.scale = scale\nreturn torch.round(input * scale) / scale if offset is None else (torch.round(input * scale) + torch.round(offset)) / scale",
"if ctx.offset is None:\n return (grad_output, None, Non... | <|body_start_0|>
ctx.alpha = alpha
ctx.offset = offset
scale = 2 ** nbit - 1 if alpha is None else (2 ** nbit - 1) / alpha
ctx.scale = scale
return torch.round(input * scale) / scale if offset is None else (torch.round(input * scale) + torch.round(offset)) / scale
<|end_body_0|>
... | Quantize class for weights and activations. take a real value x in alpha*[0,1] or alpha*[-1,1] output a discrete-valued x in alpha*{0, 1/(2^k-1), ..., (2^k-1)/(2^k-1)} or likeness where k is nbit | Quantizer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Quantizer:
"""Quantize class for weights and activations. take a real value x in alpha*[0,1] or alpha*[-1,1] output a discrete-valued x in alpha*{0, 1/(2^k-1), ..., (2^k-1)/(2^k-1)} or likeness where k is nbit"""
def forward(ctx, input, nbit, alpha=None, offset=None):
"""Forward. :pa... | stack_v2_sparse_classes_36k_train_016095 | 14,341 | permissive | [
{
"docstring": "Forward. :param input: batch of input :type input: Tensor :param nbit: bit width :type nbit: int :param alpha: scale factor :type alpha: float or Tensor :param offset: offset factor :type offset: float or Tensor :return: quantized output :rtype: Tensor",
"name": "forward",
"signature": "... | 2 | stack_v2_sparse_classes_30k_train_021559 | Implement the Python class `Quantizer` described below.
Class description:
Quantize class for weights and activations. take a real value x in alpha*[0,1] or alpha*[-1,1] output a discrete-valued x in alpha*{0, 1/(2^k-1), ..., (2^k-1)/(2^k-1)} or likeness where k is nbit
Method signatures and docstrings:
- def forward... | Implement the Python class `Quantizer` described below.
Class description:
Quantize class for weights and activations. take a real value x in alpha*[0,1] or alpha*[-1,1] output a discrete-valued x in alpha*{0, 1/(2^k-1), ..., (2^k-1)/(2^k-1)} or likeness where k is nbit
Method signatures and docstrings:
- def forward... | e4ef3a1c92d19d1d08c3ef0e2156b6fecefdbe04 | <|skeleton|>
class Quantizer:
"""Quantize class for weights and activations. take a real value x in alpha*[0,1] or alpha*[-1,1] output a discrete-valued x in alpha*{0, 1/(2^k-1), ..., (2^k-1)/(2^k-1)} or likeness where k is nbit"""
def forward(ctx, input, nbit, alpha=None, offset=None):
"""Forward. :pa... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Quantizer:
"""Quantize class for weights and activations. take a real value x in alpha*[0,1] or alpha*[-1,1] output a discrete-valued x in alpha*{0, 1/(2^k-1), ..., (2^k-1)/(2^k-1)} or likeness where k is nbit"""
def forward(ctx, input, nbit, alpha=None, offset=None):
"""Forward. :param input: ba... | the_stack_v2_python_sparse | zeus/modules/operators/quant/pytorch_quant.py | huawei-noah/xingtian | train | 308 |
4a9016371138fe81fa23c35cd03070c937284354 | [
"self.name = [name for name in open('plot_names.txt').read().split('\\n') if name != '']\nself.adjectives = [adj for adj in open('plot_adjectives.txt').read().split('\\n') if adj != '']\nself.professions = [prof.strip() for prof in open('plot_profesions.txt').read().split('\\n') if prof != '']\nself.verbs = [verb f... | <|body_start_0|>
self.name = [name for name in open('plot_names.txt').read().split('\n') if name != '']
self.adjectives = [adj for adj in open('plot_adjectives.txt').read().split('\n') if adj != '']
self.professions = [prof.strip() for prof in open('plot_profesions.txt').read().split('\n') if pr... | Class User interactive plot | InteractivePlotGenerator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InteractivePlotGenerator:
"""Class User interactive plot"""
def __init__(self):
"""Constructor : store each files to variables"""
<|body_0|>
def screen_input(self, random_5):
"""Pre-Screen User input only for the given choices"""
<|body_1|>
def gener... | stack_v2_sparse_classes_36k_train_016096 | 5,720 | no_license | [
{
"docstring": "Constructor : store each files to variables",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Pre-Screen User input only for the given choices",
"name": "screen_input",
"signature": "def screen_input(self, random_5)"
},
{
"docstring": "Sho... | 3 | stack_v2_sparse_classes_30k_train_012493 | Implement the Python class `InteractivePlotGenerator` described below.
Class description:
Class User interactive plot
Method signatures and docstrings:
- def __init__(self): Constructor : store each files to variables
- def screen_input(self, random_5): Pre-Screen User input only for the given choices
- def generate(... | Implement the Python class `InteractivePlotGenerator` described below.
Class description:
Class User interactive plot
Method signatures and docstrings:
- def __init__(self): Constructor : store each files to variables
- def screen_input(self, random_5): Pre-Screen User input only for the given choices
- def generate(... | 3f900864ac3e85bc60988bf08eca160a408d44d7 | <|skeleton|>
class InteractivePlotGenerator:
"""Class User interactive plot"""
def __init__(self):
"""Constructor : store each files to variables"""
<|body_0|>
def screen_input(self, random_5):
"""Pre-Screen User input only for the given choices"""
<|body_1|>
def gener... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InteractivePlotGenerator:
"""Class User interactive plot"""
def __init__(self):
"""Constructor : store each files to variables"""
self.name = [name for name in open('plot_names.txt').read().split('\n') if name != '']
self.adjectives = [adj for adj in open('plot_adjectives.txt').re... | the_stack_v2_python_sparse | Hw8/Hw8_1.py | paripon123/DSC-430-Python | train | 2 |
87c7d0c06340205282988aa7ee56fb7ee3fa1fcf | [
"f = TF1('pyf1', identity, -1.0, 1.0, 0)\nself.assertEqual(f.Eval(0.5), 0.5)\nself.assertEqual(f.Eval(-10.0), -10.0)\nself.assertEqual(f.Eval(1.0), 1.0)\nf = TF1('pyf1d', identity, -1.0, 1.0)\nself.assertEqual(f.Eval(0.5), 0.5)",
"pycal = Linear()\nf = TF1('pyf2', pycal, -1.0, 1.0, 2)\nf.SetParameters(5.0, 2.0)\n... | <|body_start_0|>
f = TF1('pyf1', identity, -1.0, 1.0, 0)
self.assertEqual(f.Eval(0.5), 0.5)
self.assertEqual(f.Eval(-10.0), -10.0)
self.assertEqual(f.Eval(1.0), 1.0)
f = TF1('pyf1d', identity, -1.0, 1.0)
self.assertEqual(f.Eval(0.5), 0.5)
<|end_body_0|>
<|body_start_1|>
... | Func1CallFunctionTestCase | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Func1CallFunctionTestCase:
def test1GlobalFunction(self):
"""Test calling of a python global function"""
<|body_0|>
def test2CallableObject(self):
"""Test calling of a python callable object"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
f = TF1('p... | stack_v2_sparse_classes_36k_train_016097 | 10,433 | no_license | [
{
"docstring": "Test calling of a python global function",
"name": "test1GlobalFunction",
"signature": "def test1GlobalFunction(self)"
},
{
"docstring": "Test calling of a python callable object",
"name": "test2CallableObject",
"signature": "def test2CallableObject(self)"
}
] | 2 | null | Implement the Python class `Func1CallFunctionTestCase` described below.
Class description:
Implement the Func1CallFunctionTestCase class.
Method signatures and docstrings:
- def test1GlobalFunction(self): Test calling of a python global function
- def test2CallableObject(self): Test calling of a python callable objec... | Implement the Python class `Func1CallFunctionTestCase` described below.
Class description:
Implement the Func1CallFunctionTestCase class.
Method signatures and docstrings:
- def test1GlobalFunction(self): Test calling of a python global function
- def test2CallableObject(self): Test calling of a python callable objec... | 134508460915282a5d82d6cbbb6e6afa14653413 | <|skeleton|>
class Func1CallFunctionTestCase:
def test1GlobalFunction(self):
"""Test calling of a python global function"""
<|body_0|>
def test2CallableObject(self):
"""Test calling of a python callable object"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Func1CallFunctionTestCase:
def test1GlobalFunction(self):
"""Test calling of a python global function"""
f = TF1('pyf1', identity, -1.0, 1.0, 0)
self.assertEqual(f.Eval(0.5), 0.5)
self.assertEqual(f.Eval(-10.0), -10.0)
self.assertEqual(f.Eval(1.0), 1.0)
f = TF1(... | the_stack_v2_python_sparse | python/function/PyROOT_functiontests.py | root-project/roottest | train | 41 | |
96c2c3130fb47b5736215804034e8a2a69e66e51 | [
"super(TF_Encoder, self).__init__()\nself.device = device\nself.pass_all_memory_to_dec = pass_all_memory_to_dec\nlogger.warning('We add <CLS> token as a special token here')\nself.vocab_size = vocab_size\nself.add_vocab_size = 1\nself.cls_id = self.vocab_size + ans_size\nencoder_layer = trm.TransformerEncoderLayer(... | <|body_start_0|>
super(TF_Encoder, self).__init__()
self.device = device
self.pass_all_memory_to_dec = pass_all_memory_to_dec
logger.warning('We add <CLS> token as a special token here')
self.vocab_size = vocab_size
self.add_vocab_size = 1
self.cls_id = self.vocab... | Transformer Guesser * TODO: rename ? or deprecate tf_generator.py/TF_Encoder(nn.Module) ? * TODO: context image ? * TODO: docstring | TF_Encoder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TF_Encoder:
"""Transformer Guesser * TODO: rename ? or deprecate tf_generator.py/TF_Encoder(nn.Module) ? * TODO: context image ? * TODO: docstring"""
def __init__(self, device, obj_feature_dim, vocab_size, ans_size, d_model, n_head, n_hid, n_layers, max_batch_size=1024, pass_all_memory_to_de... | stack_v2_sparse_classes_36k_train_016098 | 10,600 | no_license | [
{
"docstring": "Parameters ---------- device : str obj_feature_dim : int object feature dimension + split_cluster_dim vocab_size : int question vocabulary size ans_size : int answer vocabulary size d_model : int the number of expected features in the input n_head : int the number of heads in the multi-head-atte... | 5 | stack_v2_sparse_classes_30k_train_006346 | Implement the Python class `TF_Encoder` described below.
Class description:
Transformer Guesser * TODO: rename ? or deprecate tf_generator.py/TF_Encoder(nn.Module) ? * TODO: context image ? * TODO: docstring
Method signatures and docstrings:
- def __init__(self, device, obj_feature_dim, vocab_size, ans_size, d_model,... | Implement the Python class `TF_Encoder` described below.
Class description:
Transformer Guesser * TODO: rename ? or deprecate tf_generator.py/TF_Encoder(nn.Module) ? * TODO: context image ? * TODO: docstring
Method signatures and docstrings:
- def __init__(self, device, obj_feature_dim, vocab_size, ans_size, d_model,... | 1ea0a2ce48196b2f572b2e597d8469bdbc38732f | <|skeleton|>
class TF_Encoder:
"""Transformer Guesser * TODO: rename ? or deprecate tf_generator.py/TF_Encoder(nn.Module) ? * TODO: context image ? * TODO: docstring"""
def __init__(self, device, obj_feature_dim, vocab_size, ans_size, d_model, n_head, n_hid, n_layers, max_batch_size=1024, pass_all_memory_to_de... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TF_Encoder:
"""Transformer Guesser * TODO: rename ? or deprecate tf_generator.py/TF_Encoder(nn.Module) ? * TODO: context image ? * TODO: docstring"""
def __init__(self, device, obj_feature_dim, vocab_size, ans_size, d_model, n_head, n_hid, n_layers, max_batch_size=1024, pass_all_memory_to_dec=True, dropo... | the_stack_v2_python_sparse | src/modules/guesser/tf_guesser.py | smatsumori/uniqer | train | 5 |
d7dac44b839d9e45b0cada07de343a6ae6513a71 | [
"super(EmrDeploy, self).__init__()\nself.__emr_cluster = emr_cluster\nself.__filesystem = filesystem\nself.__hdfs = hdfs\nself._base_remote_dir = '/tmp/workflows'",
"remote_properties_path = properties_file\nif cluster_id:\n remote_properties_path = os.path.join(self._base_remote_dir, os.path.basename(properti... | <|body_start_0|>
super(EmrDeploy, self).__init__()
self.__emr_cluster = emr_cluster
self.__filesystem = filesystem
self.__hdfs = hdfs
self._base_remote_dir = '/tmp/workflows'
<|end_body_0|>
<|body_start_1|>
remote_properties_path = properties_file
if cluster_id:
... | Execute all the deploy process inside an EMR cluster | EmrDeploy | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EmrDeploy:
"""Execute all the deploy process inside an EMR cluster"""
def __init__(self, emr_cluster, hdfs, filesystem):
"""Initialize the class :param emr_cluster: EmrCluster :param hdfs: HDFSFilesystem :param filesystem: Filesystem"""
<|body_0|>
def run_properties_file... | stack_v2_sparse_classes_36k_train_016099 | 2,908 | permissive | [
{
"docstring": "Initialize the class :param emr_cluster: EmrCluster :param hdfs: HDFSFilesystem :param filesystem: Filesystem",
"name": "__init__",
"signature": "def __init__(self, emr_cluster, hdfs, filesystem)"
},
{
"docstring": "Try to execute the given properties file in the selected cluster... | 3 | null | Implement the Python class `EmrDeploy` described below.
Class description:
Execute all the deploy process inside an EMR cluster
Method signatures and docstrings:
- def __init__(self, emr_cluster, hdfs, filesystem): Initialize the class :param emr_cluster: EmrCluster :param hdfs: HDFSFilesystem :param filesystem: File... | Implement the Python class `EmrDeploy` described below.
Class description:
Execute all the deploy process inside an EMR cluster
Method signatures and docstrings:
- def __init__(self, emr_cluster, hdfs, filesystem): Initialize the class :param emr_cluster: EmrCluster :param hdfs: HDFSFilesystem :param filesystem: File... | d0e52277daff523eda63f5d3137b5a990413923d | <|skeleton|>
class EmrDeploy:
"""Execute all the deploy process inside an EMR cluster"""
def __init__(self, emr_cluster, hdfs, filesystem):
"""Initialize the class :param emr_cluster: EmrCluster :param hdfs: HDFSFilesystem :param filesystem: Filesystem"""
<|body_0|>
def run_properties_file... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EmrDeploy:
"""Execute all the deploy process inside an EMR cluster"""
def __init__(self, emr_cluster, hdfs, filesystem):
"""Initialize the class :param emr_cluster: EmrCluster :param hdfs: HDFSFilesystem :param filesystem: Filesystem"""
super(EmrDeploy, self).__init__()
self.__emr... | the_stack_v2_python_sparse | src/slippinj/emr/deploy.py | cupid4/slippin-jimmy | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.