blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
378
8.64k
id
stringlengths
44
44
length_bytes
int64
505
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.88k
prompted_full_text
stringlengths
565
12.5k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
5.05k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
snapshot_total_rows
int64
75.8k
75.8k
solution
stringlengths
242
8.3k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
f34a29071aabec3b4f322d461488c8f4bf9b805c
[ "super(ResNets, self).__init__()\nself.ResNet_name = ResNet_name\nself.classes_num = classes_num\nself.block_class = self.cfg[ResNet_name][0]\nself.num_blocks = self.cfg[ResNet_name][1]\nself.expansion = self.block_class.expansion\nself.in_channels = 64\nself.conv = nn.Sequential(nn.Conv3d(in_channels=3, out_channe...
<|body_start_0|> super(ResNets, self).__init__() self.ResNet_name = ResNet_name self.classes_num = classes_num self.block_class = self.cfg[ResNet_name][0] self.num_blocks = self.cfg[ResNet_name][1] self.expansion = self.block_class.expansion self.in_channels = 64 ...
ResNets神经网络搭建,部分优化
ResNets
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResNets: """ResNets神经网络搭建,部分优化""" def __init__(self, ResNet_name, classes_num): """网络初始化 :param: ResNet_name 选用的ResNet模型名字 :param: classes_num 分类数""" <|body_0|> def _make_layer(self, out_channels, num_block, stride): """搭建对应的残差块集合网络 输入通道数类内全局化, 因为in_channels到第二块才...
stack_v2_sparse_classes_75kplus_train_069200
28,867
no_license
[ { "docstring": "网络初始化 :param: ResNet_name 选用的ResNet模型名字 :param: classes_num 分类数", "name": "__init__", "signature": "def __init__(self, ResNet_name, classes_num)" }, { "docstring": "搭建对应的残差块集合网络 输入通道数类内全局化, 因为in_channels到第二块才改为out_channels * expansion, 为方便定义将其全局化 :param: out_channels 输出通道数 :param...
3
stack_v2_sparse_classes_30k_train_014937
Implement the Python class `ResNets` described below. Class description: ResNets神经网络搭建,部分优化 Method signatures and docstrings: - def __init__(self, ResNet_name, classes_num): 网络初始化 :param: ResNet_name 选用的ResNet模型名字 :param: classes_num 分类数 - def _make_layer(self, out_channels, num_block, stride): 搭建对应的残差块集合网络 输入通道数类内全局...
Implement the Python class `ResNets` described below. Class description: ResNets神经网络搭建,部分优化 Method signatures and docstrings: - def __init__(self, ResNet_name, classes_num): 网络初始化 :param: ResNet_name 选用的ResNet模型名字 :param: classes_num 分类数 - def _make_layer(self, out_channels, num_block, stride): 搭建对应的残差块集合网络 输入通道数类内全局...
2a68fd854bc5b1806319dfc40e36e084f9c4c5d0
<|skeleton|> class ResNets: """ResNets神经网络搭建,部分优化""" def __init__(self, ResNet_name, classes_num): """网络初始化 :param: ResNet_name 选用的ResNet模型名字 :param: classes_num 分类数""" <|body_0|> def _make_layer(self, out_channels, num_block, stride): """搭建对应的残差块集合网络 输入通道数类内全局化, 因为in_channels到第二块才...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ResNets: """ResNets神经网络搭建,部分优化""" def __init__(self, ResNet_name, classes_num): """网络初始化 :param: ResNet_name 选用的ResNet模型名字 :param: classes_num 分类数""" super(ResNets, self).__init__() self.ResNet_name = ResNet_name self.classes_num = classes_num self.block_class = se...
the_stack_v2_python_sparse
code_keh/Pytorch_nets3d.py
ruichen9/3DCTLungDiseaseDiagnosis
train
0
9403e1fa60a7528020e303aa6c5d1ce6c3fcc0cd
[ "ll_a_length = Solution.get_link_list_length(self, headA)\nll_b_length = Solution.get_link_list_length(self, headB)\ndiff_length = abs(ll_a_length - ll_b_length)\ntemp_short = []\ntemp_long = []\nif ll_a_length <= ll_b_length:\n temp_short = headA\n temp_long = headB\nelse:\n temp_short = headB\n temp_l...
<|body_start_0|> ll_a_length = Solution.get_link_list_length(self, headA) ll_b_length = Solution.get_link_list_length(self, headB) diff_length = abs(ll_a_length - ll_b_length) temp_short = [] temp_long = [] if ll_a_length <= ll_b_length: temp_short = headA ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def getIntersectionNode(self, headA, headB): """:type head1, head1: ListNode :rtype: ListNode""" <|body_0|> def get_link_list_length(self, ll): """:type ll: ListNode :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> ll_a_length =...
stack_v2_sparse_classes_75kplus_train_069201
1,303
no_license
[ { "docstring": ":type head1, head1: ListNode :rtype: ListNode", "name": "getIntersectionNode", "signature": "def getIntersectionNode(self, headA, headB)" }, { "docstring": ":type ll: ListNode :rtype: int", "name": "get_link_list_length", "signature": "def get_link_list_length(self, ll)" ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getIntersectionNode(self, headA, headB): :type head1, head1: ListNode :rtype: ListNode - def get_link_list_length(self, ll): :type ll: ListNode :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getIntersectionNode(self, headA, headB): :type head1, head1: ListNode :rtype: ListNode - def get_link_list_length(self, ll): :type ll: ListNode :rtype: int <|skeleton|> clas...
ac0f517d4e68d46f0e4cbf5795c7a4752e2c6bc3
<|skeleton|> class Solution: def getIntersectionNode(self, headA, headB): """:type head1, head1: ListNode :rtype: ListNode""" <|body_0|> def get_link_list_length(self, ll): """:type ll: ListNode :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def getIntersectionNode(self, headA, headB): """:type head1, head1: ListNode :rtype: ListNode""" ll_a_length = Solution.get_link_list_length(self, headA) ll_b_length = Solution.get_link_list_length(self, headB) diff_length = abs(ll_a_length - ll_b_length) temp...
the_stack_v2_python_sparse
Algorithms_questions/ez/linked_list_intersection.py
Nirol/LeetCodeTests
train
0
f883e6a880abb00f919217d18f267ad42e5f8ff9
[ "self.__self = '_' + type(self).__name__\nself.__ai = baidu_ai\nself.__Set_Token()", "host = f'https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id={self.__ai.Ak}&client_secret={self.__ai.Sk}'\nhtml = requests.get(host)\nself.__token = html.json().get('access_token')", "video = cv2.V...
<|body_start_0|> self.__self = '_' + type(self).__name__ self.__ai = baidu_ai self.__Set_Token() <|end_body_0|> <|body_start_1|> host = f'https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id={self.__ai.Ak}&client_secret={self.__ai.Sk}' html = requests...
百度AI工具
BAIDU_AI_TOOLS
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BAIDU_AI_TOOLS: """百度AI工具""" def __init__(self, baidu_ai: BAIDU_AI): """BAIDU_AI_TOOLS(baidu_ai: BAIDU_AI) 初始化 Args: baidu_ai: 百度AI""" <|body_0|> def __Set_Token(self) -> None: """__Set_Token() -> None 获取设置token Returns: None""" <|body_1|> def Cut(cl...
stack_v2_sparse_classes_75kplus_train_069202
3,183
permissive
[ { "docstring": "BAIDU_AI_TOOLS(baidu_ai: BAIDU_AI) 初始化 Args: baidu_ai: 百度AI", "name": "__init__", "signature": "def __init__(self, baidu_ai: BAIDU_AI)" }, { "docstring": "__Set_Token() -> None 获取设置token Returns: None", "name": "__Set_Token", "signature": "def __Set_Token(self) -> None" ...
4
stack_v2_sparse_classes_30k_train_024696
Implement the Python class `BAIDU_AI_TOOLS` described below. Class description: 百度AI工具 Method signatures and docstrings: - def __init__(self, baidu_ai: BAIDU_AI): BAIDU_AI_TOOLS(baidu_ai: BAIDU_AI) 初始化 Args: baidu_ai: 百度AI - def __Set_Token(self) -> None: __Set_Token() -> None 获取设置token Returns: None - def Cut(cls, v...
Implement the Python class `BAIDU_AI_TOOLS` described below. Class description: 百度AI工具 Method signatures and docstrings: - def __init__(self, baidu_ai: BAIDU_AI): BAIDU_AI_TOOLS(baidu_ai: BAIDU_AI) 初始化 Args: baidu_ai: 百度AI - def __Set_Token(self) -> None: __Set_Token() -> None 获取设置token Returns: None - def Cut(cls, v...
9e2a023917b86460fb02984aed9fe638c3d38dd4
<|skeleton|> class BAIDU_AI_TOOLS: """百度AI工具""" def __init__(self, baidu_ai: BAIDU_AI): """BAIDU_AI_TOOLS(baidu_ai: BAIDU_AI) 初始化 Args: baidu_ai: 百度AI""" <|body_0|> def __Set_Token(self) -> None: """__Set_Token() -> None 获取设置token Returns: None""" <|body_1|> def Cut(cl...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BAIDU_AI_TOOLS: """百度AI工具""" def __init__(self, baidu_ai: BAIDU_AI): """BAIDU_AI_TOOLS(baidu_ai: BAIDU_AI) 初始化 Args: baidu_ai: 百度AI""" self.__self = '_' + type(self).__name__ self.__ai = baidu_ai self.__Set_Token() def __Set_Token(self) -> None: """__Set_Token...
the_stack_v2_python_sparse
inside/Baidu_AI/Baidu_AI_Tools.py
lifansama/learning-power
train
1
541c5eb6806e56ff161929305e0102a4e7bad8d1
[ "super().__init__()\nself._backend = backend\nself._cache = None\nself._dtype = dtype\nself._thread = thread\nif dtype == data_types.cpu_float:\n self._array_builder = arrays.darray\nelif dtype == data_types.cpu_int:\n self._array_builder = arrays.iarray\nelif dtype == data_types.cpu_bool:\n self._array_bu...
<|body_start_0|> super().__init__() self._backend = backend self._cache = None self._dtype = dtype self._thread = thread if dtype == data_types.cpu_float: self._array_builder = arrays.darray elif dtype == data_types.cpu_int: self._array_bui...
ArrayCacheManager
[ "MIT", "MIT-0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArrayCacheManager: def __init__(self, backend, thread, dtype): """Object that keeps array in the GPU device in order to avoid creating and destroying them many times, and calls functions with them. :param dtype: data type of the output arrays. :type dtype: numpy.dtype :raises ValueError:...
stack_v2_sparse_classes_75kplus_train_069203
9,270
permissive
[ { "docstring": "Object that keeps array in the GPU device in order to avoid creating and destroying them many times, and calls functions with them. :param dtype: data type of the output arrays. :type dtype: numpy.dtype :raises ValueError: If the data type is not supported.", "name": "__init__", "signatu...
3
stack_v2_sparse_classes_30k_train_028981
Implement the Python class `ArrayCacheManager` described below. Class description: Implement the ArrayCacheManager class. Method signatures and docstrings: - def __init__(self, backend, thread, dtype): Object that keeps array in the GPU device in order to avoid creating and destroying them many times, and calls funct...
Implement the Python class `ArrayCacheManager` described below. Class description: Implement the ArrayCacheManager class. Method signatures and docstrings: - def __init__(self, backend, thread, dtype): Object that keeps array in the GPU device in order to avoid creating and destroying them many times, and calls funct...
fa6808a6ca8063751da92f683f2b810a0690a462
<|skeleton|> class ArrayCacheManager: def __init__(self, backend, thread, dtype): """Object that keeps array in the GPU device in order to avoid creating and destroying them many times, and calls functions with them. :param dtype: data type of the output arrays. :type dtype: numpy.dtype :raises ValueError:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ArrayCacheManager: def __init__(self, backend, thread, dtype): """Object that keeps array in the GPU device in order to avoid creating and destroying them many times, and calls functions with them. :param dtype: data type of the output arrays. :type dtype: numpy.dtype :raises ValueError: If the data t...
the_stack_v2_python_sparse
minkit/backends/gpu_cache.py
mramospe/minkit
train
0
36a8e5327e1820d4c46ae5a382ec24bd5c917933
[ "if not array:\n return -1\nif n < 10:\n return n\ndigits = 1\nwhile True:\n if n <= self.helper1(digits) * digits:\n start_num = 10 ** (digits - 1)\n num = start_num + (n + digits - 1) // digits - 1\n for i in range(digits - n % digits):\n num //= 10\n return num % 1...
<|body_start_0|> if not array: return -1 if n < 10: return n digits = 1 while True: if n <= self.helper1(digits) * digits: start_num = 10 ** (digits - 1) num = start_num + (n + digits - 1) // digits - 1 f...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def test(self, array, n): """一个无限的整数数组[1,2,3,4,....], 找出其第n位数,比如[1,2,3,4,5,6,7,8,9,10,11], 第10位数为1,第11位数为0""" <|body_0|> def helper1(self, digits): """统计digits位数共有多少个""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not array: ...
stack_v2_sparse_classes_75kplus_train_069204
1,294
no_license
[ { "docstring": "一个无限的整数数组[1,2,3,4,....], 找出其第n位数,比如[1,2,3,4,5,6,7,8,9,10,11], 第10位数为1,第11位数为0", "name": "test", "signature": "def test(self, array, n)" }, { "docstring": "统计digits位数共有多少个", "name": "helper1", "signature": "def helper1(self, digits)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def test(self, array, n): 一个无限的整数数组[1,2,3,4,....], 找出其第n位数,比如[1,2,3,4,5,6,7,8,9,10,11], 第10位数为1,第11位数为0 - def helper1(self, digits): 统计digits位数共有多少个
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def test(self, array, n): 一个无限的整数数组[1,2,3,4,....], 找出其第n位数,比如[1,2,3,4,5,6,7,8,9,10,11], 第10位数为1,第11位数为0 - def helper1(self, digits): 统计digits位数共有多少个 <|skeleton|> class Solution:...
ef6aee94c7990d734271c204034ec273b665226d
<|skeleton|> class Solution: def test(self, array, n): """一个无限的整数数组[1,2,3,4,....], 找出其第n位数,比如[1,2,3,4,5,6,7,8,9,10,11], 第10位数为1,第11位数为0""" <|body_0|> def helper1(self, digits): """统计digits位数共有多少个""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def test(self, array, n): """一个无限的整数数组[1,2,3,4,....], 找出其第n位数,比如[1,2,3,4,5,6,7,8,9,10,11], 第10位数为1,第11位数为0""" if not array: return -1 if n < 10: return n digits = 1 while True: if n <= self.helper1(digits) * digits: ...
the_stack_v2_python_sparse
剑指offer/数字序列中某一位数字.py
godzzbboss/leetcode
train
0
dd4723cf274bf0e148288fa0433d9a7cfdc310ef
[ "requestor = Requestor(local_api_key=api_key)\nurl = '%s/%s' % (cls.class_url(), 'create_and_buy')\nwrapped_params = {cls.snakecase_name(): params}\nresponse, api_key = requestor.request(method=RequestMethod.POST, url=url, params=wrapped_params)\nreturn convert_to_easypost_object(response=response, api_key=api_key)...
<|body_start_0|> requestor = Requestor(local_api_key=api_key) url = '%s/%s' % (cls.class_url(), 'create_and_buy') wrapped_params = {cls.snakecase_name(): params} response, api_key = requestor.request(method=RequestMethod.POST, url=url, params=wrapped_params) return convert_to_eas...
Batch
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Batch: def create_and_buy(cls, api_key: Optional[str]=None, **params) -> 'Batch': """Create and buy a Batch.""" <|body_0|> def buy(self, **params) -> 'Batch': """Buy a batch.""" <|body_1|> def label(self, **params) -> 'Batch': """Create a batch l...
stack_v2_sparse_classes_75kplus_train_069205
2,679
permissive
[ { "docstring": "Create and buy a Batch.", "name": "create_and_buy", "signature": "def create_and_buy(cls, api_key: Optional[str]=None, **params) -> 'Batch'" }, { "docstring": "Buy a batch.", "name": "buy", "signature": "def buy(self, **params) -> 'Batch'" }, { "docstring": "Creat...
6
null
Implement the Python class `Batch` described below. Class description: Implement the Batch class. Method signatures and docstrings: - def create_and_buy(cls, api_key: Optional[str]=None, **params) -> 'Batch': Create and buy a Batch. - def buy(self, **params) -> 'Batch': Buy a batch. - def label(self, **params) -> 'Ba...
Implement the Python class `Batch` described below. Class description: Implement the Batch class. Method signatures and docstrings: - def create_and_buy(cls, api_key: Optional[str]=None, **params) -> 'Batch': Create and buy a Batch. - def buy(self, **params) -> 'Batch': Buy a batch. - def label(self, **params) -> 'Ba...
c8f7a3f2472ae5fea13a5b596b4618bd55f3be0c
<|skeleton|> class Batch: def create_and_buy(cls, api_key: Optional[str]=None, **params) -> 'Batch': """Create and buy a Batch.""" <|body_0|> def buy(self, **params) -> 'Batch': """Buy a batch.""" <|body_1|> def label(self, **params) -> 'Batch': """Create a batch l...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Batch: def create_and_buy(cls, api_key: Optional[str]=None, **params) -> 'Batch': """Create and buy a Batch.""" requestor = Requestor(local_api_key=api_key) url = '%s/%s' % (cls.class_url(), 'create_and_buy') wrapped_params = {cls.snakecase_name(): params} response, api...
the_stack_v2_python_sparse
easypost/batch.py
dsanders11/easypost-python
train
0
7613e90773658c32af5d2cbe793149c42cbf7fc7
[ "super(output_layer, self).__init__()\nself.num_of_vertices = num_of_vertices\nself.history = history\nself.in_dim = in_dim\nself.hidden_dim = hidden_dim\nself.horizon = horizon\nself.FC1 = nn.Linear(self.in_dim * self.history, self.hidden_dim, bias=True)\nself.FC2 = nn.Linear(self.hidden_dim, self.horizon, bias=Tr...
<|body_start_0|> super(output_layer, self).__init__() self.num_of_vertices = num_of_vertices self.history = history self.in_dim = in_dim self.hidden_dim = hidden_dim self.horizon = horizon self.FC1 = nn.Linear(self.in_dim * self.history, self.hidden_dim, bias=True...
output_layer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class output_layer: def __init__(self, num_of_vertices, history, in_dim, hidden_dim=128, horizon=12): """预测层,注意在作者的实验中是对每一个预测时间step做处理的,也即他会令horizon=1 :param num_of_vertices:节点数 :param history:输入时间步长 :param in_dim: 输入维度 :param hidden_dim:中间层维度 :param horizon:预测时间步长""" <|body_0|> d...
stack_v2_sparse_classes_75kplus_train_069206
12,020
no_license
[ { "docstring": "预测层,注意在作者的实验中是对每一个预测时间step做处理的,也即他会令horizon=1 :param num_of_vertices:节点数 :param history:输入时间步长 :param in_dim: 输入维度 :param hidden_dim:中间层维度 :param horizon:预测时间步长", "name": "__init__", "signature": "def __init__(self, num_of_vertices, history, in_dim, hidden_dim=128, horizon=12)" }, { ...
2
stack_v2_sparse_classes_30k_train_028557
Implement the Python class `output_layer` described below. Class description: Implement the output_layer class. Method signatures and docstrings: - def __init__(self, num_of_vertices, history, in_dim, hidden_dim=128, horizon=12): 预测层,注意在作者的实验中是对每一个预测时间step做处理的,也即他会令horizon=1 :param num_of_vertices:节点数 :param history:...
Implement the Python class `output_layer` described below. Class description: Implement the output_layer class. Method signatures and docstrings: - def __init__(self, num_of_vertices, history, in_dim, hidden_dim=128, horizon=12): 预测层,注意在作者的实验中是对每一个预测时间step做处理的,也即他会令horizon=1 :param num_of_vertices:节点数 :param history:...
87c8adbf0db2e24d2ffa2ecac11da7a36bcae51c
<|skeleton|> class output_layer: def __init__(self, num_of_vertices, history, in_dim, hidden_dim=128, horizon=12): """预测层,注意在作者的实验中是对每一个预测时间step做处理的,也即他会令horizon=1 :param num_of_vertices:节点数 :param history:输入时间步长 :param in_dim: 输入维度 :param hidden_dim:中间层维度 :param horizon:预测时间步长""" <|body_0|> d...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class output_layer: def __init__(self, num_of_vertices, history, in_dim, hidden_dim=128, horizon=12): """预测层,注意在作者的实验中是对每一个预测时间step做处理的,也即他会令horizon=1 :param num_of_vertices:节点数 :param history:输入时间步长 :param in_dim: 输入维度 :param hidden_dim:中间层维度 :param horizon:预测时间步长""" super(output_layer, self).__ini...
the_stack_v2_python_sparse
model.py
airissky/STSGCN_Pytorch
train
0
1fe89e0523c9160939709328d164a6fb22522b9e
[ "counter = 0\nwhile head:\n counter += 1\n head = head.next\nreturn counter", "for i in range(size - 1):\n if not head:\n break\n head = head.next\nif not head:\n return None\nnext_start, head.next = (head.next, None)\nreturn next_start", "curr = dummy_start\nwhile l1 and l2:\n if l1.va...
<|body_start_0|> counter = 0 while head: counter += 1 head = head.next return counter <|end_body_0|> <|body_start_1|> for i in range(size - 1): if not head: break head = head.next if not head: return Non...
Algorithm: Bottom Up Merge Sort 1) Start with splitting the list into sublists of size 1. Each adjacent pair of sublists of size 1 is merged in sorted order. After the first iteration, we get the sorted lists of size 2. A similar process is repeated for a sublist of size 2. In this way, we iteratively split the list in...
Solution2
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution2: """Algorithm: Bottom Up Merge Sort 1) Start with splitting the list into sublists of size 1. Each adjacent pair of sublists of size 1 is merged in sorted order. After the first iteration, we get the sorted lists of size 2. A similar process is repeated for a sublist of size 2. In this ...
stack_v2_sparse_classes_75kplus_train_069207
4,593
permissive
[ { "docstring": "Count the length of the linked list", "name": "get_size", "signature": "def get_size(self, head: ListNode) -> int" }, { "docstring": "Given the head & size, return the start node of the next chunk", "name": "split", "signature": "def split(self, head: ListNode, size: int)...
4
stack_v2_sparse_classes_30k_train_013424
Implement the Python class `Solution2` described below. Class description: Algorithm: Bottom Up Merge Sort 1) Start with splitting the list into sublists of size 1. Each adjacent pair of sublists of size 1 is merged in sorted order. After the first iteration, we get the sorted lists of size 2. A similar process is rep...
Implement the Python class `Solution2` described below. Class description: Algorithm: Bottom Up Merge Sort 1) Start with splitting the list into sublists of size 1. Each adjacent pair of sublists of size 1 is merged in sorted order. After the first iteration, we get the sorted lists of size 2. A similar process is rep...
9f66d352c805fcdd9930aaa18c93d7546768287c
<|skeleton|> class Solution2: """Algorithm: Bottom Up Merge Sort 1) Start with splitting the list into sublists of size 1. Each adjacent pair of sublists of size 1 is merged in sorted order. After the first iteration, we get the sorted lists of size 2. A similar process is repeated for a sublist of size 2. In this ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution2: """Algorithm: Bottom Up Merge Sort 1) Start with splitting the list into sublists of size 1. Each adjacent pair of sublists of size 1 is merged in sorted order. After the first iteration, we get the sorted lists of size 2. A similar process is repeated for a sublist of size 2. In this way, we itera...
the_stack_v2_python_sparse
medium/148_sort_list.py
niki4/leetcode_py3
train
0
31575b5931f31b96e854d3d86d136f26e0ca19dc
[ "_query_builder = Configuration.base_uri\n_query_builder += '/messages/provisioning/subscriptions'\n_query_url = APIHelper.clean_url(_query_builder)\n_headers = {'accept': 'application/json'}\n_request = self.http_client.get(_query_url, headers=_headers)\nOAuth2.apply(_request)\n_context = self.execute_request(_req...
<|body_start_0|> _query_builder = Configuration.base_uri _query_builder += '/messages/provisioning/subscriptions' _query_url = APIHelper.clean_url(_query_builder) _headers = {'accept': 'application/json'} _request = self.http_client.get(_query_url, headers=_headers) OAuth...
A Controller to access Endpoints in the pythonwithgittest API.
ProvisioningController
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProvisioningController: """A Controller to access Endpoints in the pythonwithgittest API.""" def get_subscription(self): """Does a GET request to /messages/provisioning/subscriptions. Get mobile number subscription for an account Returns: ProvisionNumberResponse: Response from the AP...
stack_v2_sparse_classes_75kplus_train_069208
8,123
no_license
[ { "docstring": "Does a GET request to /messages/provisioning/subscriptions. Get mobile number subscription for an account Returns: ProvisionNumberResponse: Response from the API. Success Raises: APIException: When an error occurs while fetching the data from the remote API. This exception includes the HTTP Resp...
3
stack_v2_sparse_classes_30k_train_021368
Implement the Python class `ProvisioningController` described below. Class description: A Controller to access Endpoints in the pythonwithgittest API. Method signatures and docstrings: - def get_subscription(self): Does a GET request to /messages/provisioning/subscriptions. Get mobile number subscription for an accou...
Implement the Python class `ProvisioningController` described below. Class description: A Controller to access Endpoints in the pythonwithgittest API. Method signatures and docstrings: - def get_subscription(self): Does a GET request to /messages/provisioning/subscriptions. Get mobile number subscription for an accou...
c5d8eefa4f7fa20adad9380a19ba1bec55bf7ab2
<|skeleton|> class ProvisioningController: """A Controller to access Endpoints in the pythonwithgittest API.""" def get_subscription(self): """Does a GET request to /messages/provisioning/subscriptions. Get mobile number subscription for an account Returns: ProvisionNumberResponse: Response from the AP...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProvisioningController: """A Controller to access Endpoints in the pythonwithgittest API.""" def get_subscription(self): """Does a GET request to /messages/provisioning/subscriptions. Get mobile number subscription for an account Returns: ProvisionNumberResponse: Response from the API. Success Ra...
the_stack_v2_python_sparse
venv/Lib/site-packages/pythonwithgittest/controllers/provisioning_controller.py
OT-seven/HKCostPlatformTest
train
0
9dc63efdb34df2faf109aee4ba309a2fd58705ae
[ "CGestionSav.__init__(self, bdd, logger, isHeritage, nbEssaiBdd, dureeEntreEssaiBdd)\nfonction = 'CGestionSavThread.CThreadMemBdd:self.__init__()'\nself.__codeAction = codeAction\nself.__dateHeure = dateHeure\nthreading.Thread.__init__(self)\nmessage = \"Création d'un objet 'CThreadMemBdd' avec lien à bdd et logger...
<|body_start_0|> CGestionSav.__init__(self, bdd, logger, isHeritage, nbEssaiBdd, dureeEntreEssaiBdd) fonction = 'CGestionSavThread.CThreadMemBdd:self.__init__()' self.__codeAction = codeAction self.__dateHeure = dateHeure threading.Thread.__init__(self) message = "Créatio...
Thread permettant de mettre en base un enregistrement. En cas d'échec, le thread essaiera le nombre de fois défini cette opération avec une durée d'attente définie entre chaque essai.
CThreadMemBdd
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CThreadMemBdd: """Thread permettant de mettre en base un enregistrement. En cas d'échec, le thread essaiera le nombre de fois défini cette opération avec une durée d'attente définie entre chaque essai.""" def __init__(self, bdd, logger, isHeritage=True, codeAction='0', nbEssaiBdd=5, dureeEnt...
stack_v2_sparse_classes_75kplus_train_069209
45,947
no_license
[ { "docstring": "constructeur bdd : référence à un objet \"connexion bdd\" logger : référence à un objet \"logger console et fichier rotatif\" isHeritage : boolean, différencie un objet créé par la classe mère de la classe fille, utile pour le debug (affichage création objet) False : objet classe mère True : obj...
2
stack_v2_sparse_classes_30k_train_044605
Implement the Python class `CThreadMemBdd` described below. Class description: Thread permettant de mettre en base un enregistrement. En cas d'échec, le thread essaiera le nombre de fois défini cette opération avec une durée d'attente définie entre chaque essai. Method signatures and docstrings: - def __init__(self, ...
Implement the Python class `CThreadMemBdd` described below. Class description: Thread permettant de mettre en base un enregistrement. En cas d'échec, le thread essaiera le nombre de fois défini cette opération avec une durée d'attente définie entre chaque essai. Method signatures and docstrings: - def __init__(self, ...
1a64f0b0a6a3bcf1dd7e6e59a2b5faeb7cae67a8
<|skeleton|> class CThreadMemBdd: """Thread permettant de mettre en base un enregistrement. En cas d'échec, le thread essaiera le nombre de fois défini cette opération avec une durée d'attente définie entre chaque essai.""" def __init__(self, bdd, logger, isHeritage=True, codeAction='0', nbEssaiBdd=5, dureeEnt...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CThreadMemBdd: """Thread permettant de mettre en base un enregistrement. En cas d'échec, le thread essaiera le nombre de fois défini cette opération avec une durée d'attente définie entre chaque essai.""" def __init__(self, bdd, logger, isHeritage=True, codeAction='0', nbEssaiBdd=5, dureeEntreEssaiBdd=5,...
the_stack_v2_python_sparse
prog_python/gestion_sav__bdd_thread_initiation/CGestionSavThread.py
HerveDugast/public_hervedugast_stfelix_lasalle
train
0
63fc2dec0300362b409b05205fc35826294a4b2b
[ "super(type(self), self).__init__()\nwriter_module_name = 'grit.format.policy_templates.writers.' + writer_name + '_writer'\n__import__(writer_module_name)\nself._writer_module = sys.modules[writer_module_name]", "self._lang = lang\nself._config = writer_configuration.GetConfigurationForBuild(item.defines)\nself....
<|body_start_0|> super(type(self), self).__init__() writer_module_name = 'grit.format.policy_templates.writers.' + writer_name + '_writer' __import__(writer_module_name) self._writer_module = sys.modules[writer_module_name] <|end_body_0|> <|body_start_1|> self._lang = lang ...
Creates a template file corresponding to an <output> node of the grit tree. More precisely, processes the whole grit tree for a given <output> node whose type is 'adm'. TODO(gfeher) add new types here The result of processing is a policy template file with the given type and language of the <output> node. A new instanc...
TemplateFormatter
[ "BSD-3-Clause", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TemplateFormatter: """Creates a template file corresponding to an <output> node of the grit tree. More precisely, processes the whole grit tree for a given <output> node whose type is 'adm'. TODO(gfeher) add new types here The result of processing is a policy template file with the given type and...
stack_v2_sparse_classes_75kplus_train_069210
3,721
permissive
[ { "docstring": "Initializes this formatter to output messages with a given writer. Args: writer_name: A string identifying the TemplateWriter subclass used for generating the output. If writer name is 'adm', then the class from module 'writers.adm_writer' will be used.", "name": "__init__", "signature":...
4
null
Implement the Python class `TemplateFormatter` described below. Class description: Creates a template file corresponding to an <output> node of the grit tree. More precisely, processes the whole grit tree for a given <output> node whose type is 'adm'. TODO(gfeher) add new types here The result of processing is a polic...
Implement the Python class `TemplateFormatter` described below. Class description: Creates a template file corresponding to an <output> node of the grit tree. More precisely, processes the whole grit tree for a given <output> node whose type is 'adm'. TODO(gfeher) add new types here The result of processing is a polic...
232638c56378a8b2e621e8403be939d34d3c91a0
<|skeleton|> class TemplateFormatter: """Creates a template file corresponding to an <output> node of the grit tree. More precisely, processes the whole grit tree for a given <output> node whose type is 'adm'. TODO(gfeher) add new types here The result of processing is a policy template file with the given type and...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TemplateFormatter: """Creates a template file corresponding to an <output> node of the grit tree. More precisely, processes the whole grit tree for a given <output> node whose type is 'adm'. TODO(gfeher) add new types here The result of processing is a policy template file with the given type and language of ...
the_stack_v2_python_sparse
tools/grit/grit/format/policy_templates/template_formatter.py
Chingliu/WTL-DUI
train
1
12b0cdd344ebe336e37775ad511db77962c2afdd
[ "logging.info(u'测试 枚举 选项的取值')\nassert Platform() == [(1, 'IOS'), (2, 'ANDROID'), (3, 'WP')]\nassert Platform._items == [(1, 'IOS'), (2, 'ANDROID'), (3, 'WP')]\nassert LocationType() == [('America', '美洲'), ('Asia', u'亚洲'), ('Australia', '澳洲'), ('Europe', u'欧洲')]\nassert LocationType._items == [('America', '美洲'), ('A...
<|body_start_0|> logging.info(u'测试 枚举 选项的取值') assert Platform() == [(1, 'IOS'), (2, 'ANDROID'), (3, 'WP')] assert Platform._items == [(1, 'IOS'), (2, 'ANDROID'), (3, 'WP')] assert LocationType() == [('America', '美洲'), ('Asia', u'亚洲'), ('Australia', '澳洲'), ('Europe', u'欧洲')] asser...
TestConst
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestConst: def test_items(self): """返回数值列表 测试""" <|body_0|> def test_key(self): """获取键 测试""" <|body_1|> def test_value(self): """获取展示值 测试""" <|body_2|> <|end_skeleton|> <|body_start_0|> logging.info(u'测试 枚举 选项的取值') asser...
stack_v2_sparse_classes_75kplus_train_069211
3,426
no_license
[ { "docstring": "返回数值列表 测试", "name": "test_items", "signature": "def test_items(self)" }, { "docstring": "获取键 测试", "name": "test_key", "signature": "def test_key(self)" }, { "docstring": "获取展示值 测试", "name": "test_value", "signature": "def test_value(self)" } ]
3
null
Implement the Python class `TestConst` described below. Class description: Implement the TestConst class. Method signatures and docstrings: - def test_items(self): 返回数值列表 测试 - def test_key(self): 获取键 测试 - def test_value(self): 获取展示值 测试
Implement the Python class `TestConst` described below. Class description: Implement the TestConst class. Method signatures and docstrings: - def test_items(self): 返回数值列表 测试 - def test_key(self): 获取键 测试 - def test_value(self): 获取展示值 测试 <|skeleton|> class TestConst: def test_items(self): """返回数值列表 测试""" ...
ad65bc3b711ec00844da7493fc55e5445d58639f
<|skeleton|> class TestConst: def test_items(self): """返回数值列表 测试""" <|body_0|> def test_key(self): """获取键 测试""" <|body_1|> def test_value(self): """获取展示值 测试""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestConst: def test_items(self): """返回数值列表 测试""" logging.info(u'测试 枚举 选项的取值') assert Platform() == [(1, 'IOS'), (2, 'ANDROID'), (3, 'WP')] assert Platform._items == [(1, 'IOS'), (2, 'ANDROID'), (3, 'WP')] assert LocationType() == [('America', '美洲'), ('Asia', u'亚洲'), ('A...
the_stack_v2_python_sparse
cheatsheet/编程笔记/_util/python/libs_my_test/test_enum.py
wangfuli217/ld_note
train
5
e6c1db56f8a2e134896c17f833fc5d42da49ab27
[ "super().__init__()\nself.kickh = -25 / 1000\nself.kickv = +20 / 1000\nself.wait_bbb = 9\nself.currents = _np.arange(0.05, 2.1, 0.1)", "dtmp = '{0:10s} = {1:9d} {2:s}\\n'.format\nftmp = '{0:10s} = {1:9.3f} {2:s}\\n'.format\nltmp = '{0:6.3f},'.format\nstg = ''\nstg += ftmp('kickh', self.kickh, '[mrad]')\nstg += ...
<|body_start_0|> super().__init__() self.kickh = -25 / 1000 self.kickv = +20 / 1000 self.wait_bbb = 9 self.currents = _np.arange(0.05, 2.1, 0.1) <|end_body_0|> <|body_start_1|> dtmp = '{0:10s} = {1:9d} {2:s}\n'.format ftmp = '{0:10s} = {1:9.3f} {2:s}\n'.format ...
.
TuneShiftParams
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TuneShiftParams: """.""" def __init__(self): """.""" <|body_0|> def __str__(self): """.""" <|body_1|> <|end_skeleton|> <|body_start_0|> super().__init__() self.kickh = -25 / 1000 self.kickv = +20 / 1000 self.wait_bbb = 9 ...
stack_v2_sparse_classes_75kplus_train_069212
45,488
permissive
[ { "docstring": ".", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": ".", "name": "__str__", "signature": "def __str__(self)" } ]
2
stack_v2_sparse_classes_30k_train_048891
Implement the Python class `TuneShiftParams` described below. Class description: . Method signatures and docstrings: - def __init__(self): . - def __str__(self): .
Implement the Python class `TuneShiftParams` described below. Class description: . Method signatures and docstrings: - def __init__(self): . - def __str__(self): . <|skeleton|> class TuneShiftParams: """.""" def __init__(self): """.""" <|body_0|> def __str__(self): """.""" ...
39644161d98964a3a3d80d63269201f0a1712e82
<|skeleton|> class TuneShiftParams: """.""" def __init__(self): """.""" <|body_0|> def __str__(self): """.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TuneShiftParams: """.""" def __init__(self): """.""" super().__init__() self.kickh = -25 / 1000 self.kickv = +20 / 1000 self.wait_bbb = 9 self.currents = _np.arange(0.05, 2.1, 0.1) def __str__(self): """.""" dtmp = '{0:10s} = {1:9d} {2...
the_stack_v2_python_sparse
apsuite/commisslib/measure_bbb_data.py
lnls-fac/apsuite
train
1
4fc5b8a135c695c5b24b11096175f6145308383b
[ "\"\"\"\n :type name: str \n :rtype: int\n \"\"\"\nself.name = name", "self.prob = prob\nself.R = R\nif self.name == 'Binomial':\n return np.where(self.prob <= 1 - self.R, 1, 0)\nelse:\n print('Not available!')\n return []" ]
<|body_start_0|> """ :type name: str :rtype: int """ self.name = name <|end_body_0|> <|body_start_1|> self.prob = prob self.R = R if self.name == 'Binomial': return np.where(self.prob <= 1 - self.R, 1, 0) else:...
Indicator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Indicator: def __init__(self, name): """Constructor for this class.""" <|body_0|> def Binary_Indicator(self, prob, R): """:type pi: float :type R: float :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> """ :type name: str ...
stack_v2_sparse_classes_75kplus_train_069213
771
permissive
[ { "docstring": "Constructor for this class.", "name": "__init__", "signature": "def __init__(self, name)" }, { "docstring": ":type pi: float :type R: float :rtype: int", "name": "Binary_Indicator", "signature": "def Binary_Indicator(self, prob, R)" } ]
2
stack_v2_sparse_classes_30k_train_036885
Implement the Python class `Indicator` described below. Class description: Implement the Indicator class. Method signatures and docstrings: - def __init__(self, name): Constructor for this class. - def Binary_Indicator(self, prob, R): :type pi: float :type R: float :rtype: int
Implement the Python class `Indicator` described below. Class description: Implement the Indicator class. Method signatures and docstrings: - def __init__(self, name): Constructor for this class. - def Binary_Indicator(self, prob, R): :type pi: float :type R: float :rtype: int <|skeleton|> class Indicator: def ...
0517780d05443cb77ce339db1854c298b87681e3
<|skeleton|> class Indicator: def __init__(self, name): """Constructor for this class.""" <|body_0|> def Binary_Indicator(self, prob, R): """:type pi: float :type R: float :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Indicator: def __init__(self, name): """Constructor for this class.""" """ :type name: str :rtype: int """ self.name = name def Binary_Indicator(self, prob, R): """:type pi: float :type R: float :rtype: int""" self.p...
the_stack_v2_python_sparse
brdt/Indicator.py
ericchen12377/BRDT-Python
train
2
b3f8547044db5d63dfe2785460a0003540075783
[ "super(GroupAttention, self).__init__(**kwargs)\nif n_group < 1:\n raise ValueError('The number of groups (`n_group`) must be an integer greater than 0.')\nself.n_group = n_group\nif n_dim < 1:\n raise ValueError('The dimensionality (`n_dim`) must be an integer greater than 0.')\nself.n_dim = n_dim\nif embedd...
<|body_start_0|> super(GroupAttention, self).__init__(**kwargs) if n_group < 1: raise ValueError('The number of groups (`n_group`) must be an integer greater than 0.') self.n_group = n_group if n_dim < 1: raise ValueError('The dimensionality (`n_dim`) must be an i...
Group-specific attention weights.
GroupAttention
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GroupAttention: """Group-specific attention weights.""" def __init__(self, n_group=1, n_dim=None, fit_group=None, embeddings_initializer=None, embeddings_regularizer=None, embeddings_constraint=None, **kwargs): """Initialize. Arguments: n_dim: An integer indicating the dimensionality...
stack_v2_sparse_classes_75kplus_train_069214
31,603
permissive
[ { "docstring": "Initialize. Arguments: n_dim: An integer indicating the dimensionality of the embeddings. Must be equal to or greater than one. n_group (optional): An integer indicating the number of different population groups in the embedding. A separate set of attention weights will be inferred for each grou...
3
null
Implement the Python class `GroupAttention` described below. Class description: Group-specific attention weights. Method signatures and docstrings: - def __init__(self, n_group=1, n_dim=None, fit_group=None, embeddings_initializer=None, embeddings_regularizer=None, embeddings_constraint=None, **kwargs): Initialize. A...
Implement the Python class `GroupAttention` described below. Class description: Group-specific attention weights. Method signatures and docstrings: - def __init__(self, n_group=1, n_dim=None, fit_group=None, embeddings_initializer=None, embeddings_regularizer=None, embeddings_constraint=None, **kwargs): Initialize. A...
4f05348cf43d2d53ff9cc6dee633de385df883e3
<|skeleton|> class GroupAttention: """Group-specific attention weights.""" def __init__(self, n_group=1, n_dim=None, fit_group=None, embeddings_initializer=None, embeddings_regularizer=None, embeddings_constraint=None, **kwargs): """Initialize. Arguments: n_dim: An integer indicating the dimensionality...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GroupAttention: """Group-specific attention weights.""" def __init__(self, n_group=1, n_dim=None, fit_group=None, embeddings_initializer=None, embeddings_regularizer=None, embeddings_constraint=None, **kwargs): """Initialize. Arguments: n_dim: An integer indicating the dimensionality of the embed...
the_stack_v2_python_sparse
psiz/keras/layers/.ipynb_checkpoints/kernel-checkpoint.py
asuiconlab/psiz
train
0
c1be3ab695e01e93b25fd5f012554ea0436675cd
[ "assert linkage.shape[1] == 4, 'a linkage matrix is needed to choose thresholds'\nsz = np.mean(linkage[:, 3])\nthresholds = linkage[linkage[:, 3] > sz, 2]\nthresholds = np.unique(thresholds)\nthresholds = np.sort(thresholds)[::-1]\nlogger.info('Obtained %d thresholds', len(thresholds))\nreturn thresholds", "logge...
<|body_start_0|> assert linkage.shape[1] == 4, 'a linkage matrix is needed to choose thresholds' sz = np.mean(linkage[:, 3]) thresholds = linkage[linkage[:, 3] > sz, 2] thresholds = np.unique(thresholds) thresholds = np.sort(thresholds)[::-1] logger.info('Obtained %d thre...
SceneClustering
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SceneClustering: def choose_thresholds(self, linkage): """Chooses thresholds where two or more clusters where merged Args: lnk: numpy matrix (n x 4) that is the result from linkage. N is the number of clusterings Returns: thresholds: a list of thresholds (float) Assertions: AssertError w...
stack_v2_sparse_classes_75kplus_train_069215
2,032
no_license
[ { "docstring": "Chooses thresholds where two or more clusters where merged Args: lnk: numpy matrix (n x 4) that is the result from linkage. N is the number of clusterings Returns: thresholds: a list of thresholds (float) Assertions: AssertError when lnk has the incorrect shape", "name": "choose_thresholds",...
2
stack_v2_sparse_classes_30k_train_017950
Implement the Python class `SceneClustering` described below. Class description: Implement the SceneClustering class. Method signatures and docstrings: - def choose_thresholds(self, linkage): Chooses thresholds where two or more clusters where merged Args: lnk: numpy matrix (n x 4) that is the result from linkage. N ...
Implement the Python class `SceneClustering` described below. Class description: Implement the SceneClustering class. Method signatures and docstrings: - def choose_thresholds(self, linkage): Chooses thresholds where two or more clusters where merged Args: lnk: numpy matrix (n x 4) that is the result from linkage. N ...
2f9c33c4e1a26b3e9e699210ac974047936f49e1
<|skeleton|> class SceneClustering: def choose_thresholds(self, linkage): """Chooses thresholds where two or more clusters where merged Args: lnk: numpy matrix (n x 4) that is the result from linkage. N is the number of clusterings Returns: thresholds: a list of thresholds (float) Assertions: AssertError w...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SceneClustering: def choose_thresholds(self, linkage): """Chooses thresholds where two or more clusters where merged Args: lnk: numpy matrix (n x 4) that is the result from linkage. N is the number of clusterings Returns: thresholds: a list of thresholds (float) Assertions: AssertError when lnk has th...
the_stack_v2_python_sparse
vision/scene/discovery/clustering.py
winkash/image-classification
train
0
49c12560293527b6f4f7984d4192c5c725235773
[ "self.auth = auth\nif isinstance(tid, PracticeTag):\n self.tag = tid\nelse:\n self.tag = self.get_tag_model(tid)", "if not tid:\n return None\ntag = PracticeTag.objects.get_once(tid)\nif not tag:\n raise not PracticeTagInfoExcept.tag_is_not_exists()\nreturn tag", "if not self.tag:\n return {}\nre...
<|body_start_0|> self.auth = auth if isinstance(tid, PracticeTag): self.tag = tid else: self.tag = self.get_tag_model(tid) <|end_body_0|> <|body_start_1|> if not tid: return None tag = PracticeTag.objects.get_once(tid) if not tag: ...
TagLogic
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TagLogic: def __init__(self, auth, tid): """INIT :param auth: :param tid:""" <|body_0|> def get_tag_model(self, tid): """获取标签model :param tid: :return:""" <|body_1|> def get_tag_info(self): """获取标签信息 :return:""" <|body_2|> def is_not...
stack_v2_sparse_classes_75kplus_train_069216
1,466
no_license
[ { "docstring": "INIT :param auth: :param tid:", "name": "__init__", "signature": "def __init__(self, auth, tid)" }, { "docstring": "获取标签model :param tid: :return:", "name": "get_tag_model", "signature": "def get_tag_model(self, tid)" }, { "docstring": "获取标签信息 :return:", "name...
4
stack_v2_sparse_classes_30k_train_001690
Implement the Python class `TagLogic` described below. Class description: Implement the TagLogic class. Method signatures and docstrings: - def __init__(self, auth, tid): INIT :param auth: :param tid: - def get_tag_model(self, tid): 获取标签model :param tid: :return: - def get_tag_info(self): 获取标签信息 :return: - def is_not...
Implement the Python class `TagLogic` described below. Class description: Implement the TagLogic class. Method signatures and docstrings: - def __init__(self, auth, tid): INIT :param auth: :param tid: - def get_tag_model(self, tid): 获取标签model :param tid: :return: - def get_tag_info(self): 获取标签信息 :return: - def is_not...
7467cd66e1fc91f0b3a264f8fc9b93f22f09fe7b
<|skeleton|> class TagLogic: def __init__(self, auth, tid): """INIT :param auth: :param tid:""" <|body_0|> def get_tag_model(self, tid): """获取标签model :param tid: :return:""" <|body_1|> def get_tag_info(self): """获取标签信息 :return:""" <|body_2|> def is_not...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TagLogic: def __init__(self, auth, tid): """INIT :param auth: :param tid:""" self.auth = auth if isinstance(tid, PracticeTag): self.tag = tid else: self.tag = self.get_tag_model(tid) def get_tag_model(self, tid): """获取标签model :param tid: :re...
the_stack_v2_python_sparse
FireHydrant/server/practice/logics/tag.py
shoogoome/FireHydrant
train
4
f96effe90b6f755a40e8bd43799a13543eb81529
[ "super().__init__()\nself.embedding_part = nn.Embedding(num_embeddings=len(vocab.id2char), embedding_dim=e_char, padding_idx=vocab.pad_index)\nself.dropout_part = nn.Dropout(p=dropout_p)\nself.cnn_part = CNN(e_char=e_char, filter_num=filter_num, window_size=window_size, padding=padding)\nparameter_init.init_embeddi...
<|body_start_0|> super().__init__() self.embedding_part = nn.Embedding(num_embeddings=len(vocab.id2char), embedding_dim=e_char, padding_idx=vocab.pad_index) self.dropout_part = nn.Dropout(p=dropout_p) self.cnn_part = CNN(e_char=e_char, filter_num=filter_num, window_size=window_size, padd...
CharCNNEmbedding
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CharCNNEmbedding: def __init__(self, e_char: int, filter_num: int, window_size: int, padding: int, dropout_p: float, vocab: CharVocab): """:param e_char: char 的向量维数 :param filter_num: cnn filter 数目,也是 char cnn 的输出维度(每个 word 的对应向量维数) :param dropout_p: p :param window_size: cnn filter 的窗口大...
stack_v2_sparse_classes_75kplus_train_069217
3,826
no_license
[ { "docstring": ":param e_char: char 的向量维数 :param filter_num: cnn filter 数目,也是 char cnn 的输出维度(每个 word 的对应向量维数) :param dropout_p: p :param window_size: cnn filter 的窗口大小 :param padding: cnn padding :param vocab: CharVocab object. See vocab.py for documentation. 全局共享即可", "name": "__init__", "signature": "de...
2
null
Implement the Python class `CharCNNEmbedding` described below. Class description: Implement the CharCNNEmbedding class. Method signatures and docstrings: - def __init__(self, e_char: int, filter_num: int, window_size: int, padding: int, dropout_p: float, vocab: CharVocab): :param e_char: char 的向量维数 :param filter_num:...
Implement the Python class `CharCNNEmbedding` described below. Class description: Implement the CharCNNEmbedding class. Method signatures and docstrings: - def __init__(self, e_char: int, filter_num: int, window_size: int, padding: int, dropout_p: float, vocab: CharVocab): :param e_char: char 的向量维数 :param filter_num:...
29dc4aa0ebd3f610135ceb88f62634b4597b564a
<|skeleton|> class CharCNNEmbedding: def __init__(self, e_char: int, filter_num: int, window_size: int, padding: int, dropout_p: float, vocab: CharVocab): """:param e_char: char 的向量维数 :param filter_num: cnn filter 数目,也是 char cnn 的输出维度(每个 word 的对应向量维数) :param dropout_p: p :param window_size: cnn filter 的窗口大...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CharCNNEmbedding: def __init__(self, e_char: int, filter_num: int, window_size: int, padding: int, dropout_p: float, vocab: CharVocab): """:param e_char: char 的向量维数 :param filter_num: cnn filter 数目,也是 char cnn 的输出维度(每个 word 的对应向量维数) :param dropout_p: p :param window_size: cnn filter 的窗口大小 :param paddi...
the_stack_v2_python_sparse
task04/modules/char_cnn.py
yjqiang/nlp-beginner
train
2
9ea6a21cb69bea2dde6d2504583fb38c175a5d65
[ "for filename in self.changes.get_files():\n log.debug('Looking whether %s was actually uploaded' % filename)\n if os.path.isfile(os.path.join(config['debexpo.upload.incoming'], filename)):\n log.debug('%s is present' % filename)\n self.passed('file-is-present', filename, constants.PLUGIN_SEVERI...
<|body_start_0|> for filename in self.changes.get_files(): log.debug('Looking whether %s was actually uploaded' % filename) if os.path.isfile(os.path.join(config['debexpo.upload.incoming'], filename)): log.debug('%s is present' % filename) self.passed('fil...
CheckFilesPlugin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CheckFilesPlugin: def test_files_present(self): """Check whether each file listed in the changes file is present.""" <|body_0|> def test_md5sum(self): """Check each file's md5sum and make sure the md5sum in the changes file is the same as the actual file's md5sum."""...
stack_v2_sparse_classes_75kplus_train_069218
3,751
no_license
[ { "docstring": "Check whether each file listed in the changes file is present.", "name": "test_files_present", "signature": "def test_files_present(self)" }, { "docstring": "Check each file's md5sum and make sure the md5sum in the changes file is the same as the actual file's md5sum.", "name...
2
stack_v2_sparse_classes_30k_train_046088
Implement the Python class `CheckFilesPlugin` described below. Class description: Implement the CheckFilesPlugin class. Method signatures and docstrings: - def test_files_present(self): Check whether each file listed in the changes file is present. - def test_md5sum(self): Check each file's md5sum and make sure the m...
Implement the Python class `CheckFilesPlugin` described below. Class description: Implement the CheckFilesPlugin class. Method signatures and docstrings: - def test_files_present(self): Check whether each file listed in the changes file is present. - def test_md5sum(self): Check each file's md5sum and make sure the m...
04c09606daca2fceccffaed0b9df777efad375bb
<|skeleton|> class CheckFilesPlugin: def test_files_present(self): """Check whether each file listed in the changes file is present.""" <|body_0|> def test_md5sum(self): """Check each file's md5sum and make sure the md5sum in the changes file is the same as the actual file's md5sum."""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CheckFilesPlugin: def test_files_present(self): """Check whether each file listed in the changes file is present.""" for filename in self.changes.get_files(): log.debug('Looking whether %s was actually uploaded' % filename) if os.path.isfile(os.path.join(config['debexpo...
the_stack_v2_python_sparse
debexpo/plugins/checkfiles.py
certik/debexpo
train
1
5a3e77ed905eb5336b7117a3c08e681b279bf8ed
[ "X = check_array(X, dtype=np.float32, accept_sparse='csc')\nif quantile is None:\n return super(BaseTreeQuantileRegressor, self).predict(X, check_input=check_input)\nquantiles = np.zeros(X.shape[0])\nX_leaves = self.apply(X)\nunique_leaves = np.unique(X_leaves)\nfor leaf in unique_leaves:\n quantiles[X_leaves...
<|body_start_0|> X = check_array(X, dtype=np.float32, accept_sparse='csc') if quantile is None: return super(BaseTreeQuantileRegressor, self).predict(X, check_input=check_input) quantiles = np.zeros(X.shape[0]) X_leaves = self.apply(X) unique_leaves = np.unique(X_leav...
BaseTreeQuantileRegressor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseTreeQuantileRegressor: def predict(self, X, quantile=None, check_input=False): """Predict regression value for X. Parameters ---------- X : array-like or sparse matrix of shape = [n_samples, n_features] The input samples. Internally, it will be converted to ``dtype=np.float32`` and i...
stack_v2_sparse_classes_75kplus_train_069219
36,172
permissive
[ { "docstring": "Predict regression value for X. Parameters ---------- X : array-like or sparse matrix of shape = [n_samples, n_features] The input samples. Internally, it will be converted to ``dtype=np.float32`` and if a sparse matrix is provided to a sparse ``csr_matrix``. quantile : int, optional Value rangi...
2
stack_v2_sparse_classes_30k_train_012561
Implement the Python class `BaseTreeQuantileRegressor` described below. Class description: Implement the BaseTreeQuantileRegressor class. Method signatures and docstrings: - def predict(self, X, quantile=None, check_input=False): Predict regression value for X. Parameters ---------- X : array-like or sparse matrix of...
Implement the Python class `BaseTreeQuantileRegressor` described below. Class description: Implement the BaseTreeQuantileRegressor class. Method signatures and docstrings: - def predict(self, X, quantile=None, check_input=False): Predict regression value for X. Parameters ---------- X : array-like or sparse matrix of...
6af92e149491f6e5062495d87306b3625d12d992
<|skeleton|> class BaseTreeQuantileRegressor: def predict(self, X, quantile=None, check_input=False): """Predict regression value for X. Parameters ---------- X : array-like or sparse matrix of shape = [n_samples, n_features] The input samples. Internally, it will be converted to ``dtype=np.float32`` and i...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseTreeQuantileRegressor: def predict(self, X, quantile=None, check_input=False): """Predict regression value for X. Parameters ---------- X : array-like or sparse matrix of shape = [n_samples, n_features] The input samples. Internally, it will be converted to ``dtype=np.float32`` and if a sparse mat...
the_stack_v2_python_sparse
tabular/src/autogluon/tabular/models/rf/rf_quantile.py
stjordanis/autogluon
train
0
128aab7fa24b33e80ed4f862e142677ba13e6dd7
[ "self.sarr = sarr\nself.alpha = alpha\nself.gamma = gamma", "a = self.sarr.steer(angle)\nphase = np.random.random() * np.pi * 2\nsignal = np.exp(1j * np.pi * phase)\ny = signal * a\nnoise = salphas_cplx(self.alpha, self.gamma, size=y.shape)\ny += noise\nreturn y", "nsnapshots = angles.size\nphase = np.random.ra...
<|body_start_0|> self.sarr = sarr self.alpha = alpha self.gamma = gamma <|end_body_0|> <|body_start_1|> a = self.sarr.steer(angle) phase = np.random.random() * np.pi * 2 signal = np.exp(1j * np.pi * phase) y = signal * a noise = salphas_cplx(self.alpha, s...
Generating and yielding signals. See the reference for definition and form of signal. Reference --------- Zhong, X., Prekumar, A. B., and Madhukumar, A. S., "Particle filtering for acoustic source tracking in impulsive noise with alpha-stable process", IEEE Sensors Journal, Feb. 2013, Vol. 13 No. 2: 589-600.
SignalYielder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SignalYielder: """Generating and yielding signals. See the reference for definition and form of signal. Reference --------- Zhong, X., Prekumar, A. B., and Madhukumar, A. S., "Particle filtering for acoustic source tracking in impulsive noise with alpha-stable process", IEEE Sensors Journal, Feb....
stack_v2_sparse_classes_75kplus_train_069220
2,828
no_license
[ { "docstring": "Parameters ---------- sarr : DOAArray Instance of sensor array. alpha : float Alpha coefficient (characteristic exponent) of S-alpha-S distribution. gamma : float Gamma coefficient (dispersion parameter) of S-alpha-S distribution.", "name": "__init__", "signature": "def __init__(self, sa...
3
null
Implement the Python class `SignalYielder` described below. Class description: Generating and yielding signals. See the reference for definition and form of signal. Reference --------- Zhong, X., Prekumar, A. B., and Madhukumar, A. S., "Particle filtering for acoustic source tracking in impulsive noise with alpha-stab...
Implement the Python class `SignalYielder` described below. Class description: Generating and yielding signals. See the reference for definition and form of signal. Reference --------- Zhong, X., Prekumar, A. B., and Madhukumar, A. S., "Particle filtering for acoustic source tracking in impulsive noise with alpha-stab...
4cbb2eba87c6ffd79e474014584ee31c893ade13
<|skeleton|> class SignalYielder: """Generating and yielding signals. See the reference for definition and form of signal. Reference --------- Zhong, X., Prekumar, A. B., and Madhukumar, A. S., "Particle filtering for acoustic source tracking in impulsive noise with alpha-stable process", IEEE Sensors Journal, Feb....
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SignalYielder: """Generating and yielding signals. See the reference for definition and form of signal. Reference --------- Zhong, X., Prekumar, A. B., and Madhukumar, A. S., "Particle filtering for acoustic source tracking in impulsive noise with alpha-stable process", IEEE Sensors Journal, Feb. 2013, Vol. 1...
the_stack_v2_python_sparse
signalyielder.py
qrqiuren/particle
train
5
0ad0e087b5794c4e6fa536447cfd3b7a71a79818
[ "self.wifi_mac = wifi_mac\nself.id = id\nself.serial = serial\nself.pin = pin", "if dictionary is None:\n return None\nwifi_mac = dictionary.get('wifiMac')\nid = dictionary.get('id')\nserial = dictionary.get('serial')\npin = dictionary.get('pin')\nreturn cls(wifi_mac, id, serial, pin)" ]
<|body_start_0|> self.wifi_mac = wifi_mac self.id = id self.serial = serial self.pin = pin <|end_body_0|> <|body_start_1|> if dictionary is None: return None wifi_mac = dictionary.get('wifiMac') id = dictionary.get('id') serial = dictionary.ge...
Implementation of the 'wipeNetworkSmDevice' model. TODO: type model description here. Attributes: wifi_mac (string): The wifiMac of the device to be wiped. id (string): The id of the device to be wiped. serial (string): The serial of the device to be wiped. pin (int): The pin number (a six digit value) for wiping a mac...
WipeNetworkSmDeviceModel
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WipeNetworkSmDeviceModel: """Implementation of the 'wipeNetworkSmDevice' model. TODO: type model description here. Attributes: wifi_mac (string): The wifiMac of the device to be wiped. id (string): The id of the device to be wiped. serial (string): The serial of the device to be wiped. pin (int):...
stack_v2_sparse_classes_75kplus_train_069221
2,124
permissive
[ { "docstring": "Constructor for the WipeNetworkSmDeviceModel class", "name": "__init__", "signature": "def __init__(self, wifi_mac=None, id=None, serial=None, pin=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representat...
2
stack_v2_sparse_classes_30k_train_035580
Implement the Python class `WipeNetworkSmDeviceModel` described below. Class description: Implementation of the 'wipeNetworkSmDevice' model. TODO: type model description here. Attributes: wifi_mac (string): The wifiMac of the device to be wiped. id (string): The id of the device to be wiped. serial (string): The seria...
Implement the Python class `WipeNetworkSmDeviceModel` described below. Class description: Implementation of the 'wipeNetworkSmDevice' model. TODO: type model description here. Attributes: wifi_mac (string): The wifiMac of the device to be wiped. id (string): The id of the device to be wiped. serial (string): The seria...
9894089eb013318243ae48869cc5130eb37f80c0
<|skeleton|> class WipeNetworkSmDeviceModel: """Implementation of the 'wipeNetworkSmDevice' model. TODO: type model description here. Attributes: wifi_mac (string): The wifiMac of the device to be wiped. id (string): The id of the device to be wiped. serial (string): The serial of the device to be wiped. pin (int):...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WipeNetworkSmDeviceModel: """Implementation of the 'wipeNetworkSmDevice' model. TODO: type model description here. Attributes: wifi_mac (string): The wifiMac of the device to be wiped. id (string): The id of the device to be wiped. serial (string): The serial of the device to be wiped. pin (int): The pin numb...
the_stack_v2_python_sparse
meraki_sdk/models/wipe_network_sm_device_model.py
RaulCatalano/meraki-python-sdk
train
1
aba10745d92b974d920aaf4fd3118041e5186fdc
[ "self.cache = {}\nrecord = defaultdict(list)\nfor x, y in richer:\n record[y].append(x)\nresult = []\nfor i in xrange(len(quiet)):\n result.append(self.helper(record, i, quiet))\nreturn result", "if idx not in record:\n return idx\nif idx not in self.cache:\n r = idx\n for i in xrange(len(record[id...
<|body_start_0|> self.cache = {} record = defaultdict(list) for x, y in richer: record[y].append(x) result = [] for i in xrange(len(quiet)): result.append(self.helper(record, i, quiet)) return result <|end_body_0|> <|body_start_1|> if idx ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def loudAndRich(self, richer, quiet): """:type richer: List[List[int]] :type quiet: List[int] :rtype: List[int]""" <|body_0|> def helper(self, record, idx, quiet): """return index of person that is richer than idx and is the least quiet""" <|body_1|...
stack_v2_sparse_classes_75kplus_train_069222
1,952
no_license
[ { "docstring": ":type richer: List[List[int]] :type quiet: List[int] :rtype: List[int]", "name": "loudAndRich", "signature": "def loudAndRich(self, richer, quiet)" }, { "docstring": "return index of person that is richer than idx and is the least quiet", "name": "helper", "signature": "d...
2
stack_v2_sparse_classes_30k_train_039462
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def loudAndRich(self, richer, quiet): :type richer: List[List[int]] :type quiet: List[int] :rtype: List[int] - def helper(self, record, idx, quiet): return index of person that i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def loudAndRich(self, richer, quiet): :type richer: List[List[int]] :type quiet: List[int] :rtype: List[int] - def helper(self, record, idx, quiet): return index of person that i...
ee79d3437cf47b26a4bca0ec798dc54d7b623453
<|skeleton|> class Solution: def loudAndRich(self, richer, quiet): """:type richer: List[List[int]] :type quiet: List[int] :rtype: List[int]""" <|body_0|> def helper(self, record, idx, quiet): """return index of person that is richer than idx and is the least quiet""" <|body_1|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def loudAndRich(self, richer, quiet): """:type richer: List[List[int]] :type quiet: List[int] :rtype: List[int]""" self.cache = {} record = defaultdict(list) for x, y in richer: record[y].append(x) result = [] for i in xrange(len(quiet)): ...
the_stack_v2_python_sparse
Algorithm/Python/851. Loud and Rich.py
WuLC/LeetCode
train
29
b3e87975a505a0082bf88f5c44bd6a39ca71666a
[ "super(SentinelClient, self).__init__(server, params, backend)\nself._client_write = None\nself._client_read = None\nself._connection_string = server", "try:\n connection_params = constring.split('/')\n master_name = connection_params[0]\n servers = [host_port.split(':') for host_port in connection_param...
<|body_start_0|> super(SentinelClient, self).__init__(server, params, backend) self._client_write = None self._client_read = None self._connection_string = server <|end_body_0|> <|body_start_1|> try: connection_params = constring.split('/') master_name = ...
Sentinel client object extending django-redis DefaultClient
SentinelClient
[ "MIT", "LGPL-2.1-or-later", "LGPL-3.0-only" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SentinelClient: """Sentinel client object extending django-redis DefaultClient""" def __init__(self, server, params, backend): """Slightly different logic than connection to multiple Redis servers. Reserve only one write and read descriptors, as they will be closed on exit anyway."""...
stack_v2_sparse_classes_75kplus_train_069223
5,721
permissive
[ { "docstring": "Slightly different logic than connection to multiple Redis servers. Reserve only one write and read descriptors, as they will be closed on exit anyway.", "name": "__init__", "signature": "def __init__(self, server, params, backend)" }, { "docstring": "Parse connection string in f...
5
stack_v2_sparse_classes_30k_train_041446
Implement the Python class `SentinelClient` described below. Class description: Sentinel client object extending django-redis DefaultClient Method signatures and docstrings: - def __init__(self, server, params, backend): Slightly different logic than connection to multiple Redis servers. Reserve only one write and re...
Implement the Python class `SentinelClient` described below. Class description: Sentinel client object extending django-redis DefaultClient Method signatures and docstrings: - def __init__(self, server, params, backend): Slightly different logic than connection to multiple Redis servers. Reserve only one write and re...
2d708bd0d869d391456e0fb8d644af3b9f031acf
<|skeleton|> class SentinelClient: """Sentinel client object extending django-redis DefaultClient""" def __init__(self, server, params, backend): """Slightly different logic than connection to multiple Redis servers. Reserve only one write and read descriptors, as they will be closed on exit anyway."""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SentinelClient: """Sentinel client object extending django-redis DefaultClient""" def __init__(self, server, params, backend): """Slightly different logic than connection to multiple Redis servers. Reserve only one write and read descriptors, as they will be closed on exit anyway.""" supe...
the_stack_v2_python_sparse
itsm/component/data/sentinel.py
TencentBlueKing/bk-itsm
train
100
731bfd429312fdc84c8a4cb85f6ec57cbfa537db
[ "self.population = population\nself.selection = selection\nself.crossover = crossover\nself.mutation = mutation\nself.fun_fitness = fun_fitness", "self.population.initialize()\nfor i in range(0, gen):\n fitness, _ = self.population.fitness(fun_evaluation, self.fun_fitness)\n self.selection.select(self.popul...
<|body_start_0|> self.population = population self.selection = selection self.crossover = crossover self.mutation = mutation self.fun_fitness = fun_fitness <|end_body_0|> <|body_start_1|> self.population.initialize() for i in range(0, gen): fitness, _...
Simple Genetic Algorithm
GA
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GA: """Simple Genetic Algorithm""" def __init__(self, population, selection, crossover, mutation, fun_fitness=lambda x: np.arctan(-x) + np.pi): """fun_fitness: fitness based on objective values. minimize the objective by default""" <|body_0|> def run(self, fun_evaluation...
stack_v2_sparse_classes_75kplus_train_069224
1,255
permissive
[ { "docstring": "fun_fitness: fitness based on objective values. minimize the objective by default", "name": "__init__", "signature": "def __init__(self, population, selection, crossover, mutation, fun_fitness=lambda x: np.arctan(-x) + np.pi)" }, { "docstring": "solve the problem based on Simple ...
2
null
Implement the Python class `GA` described below. Class description: Simple Genetic Algorithm Method signatures and docstrings: - def __init__(self, population, selection, crossover, mutation, fun_fitness=lambda x: np.arctan(-x) + np.pi): fun_fitness: fitness based on objective values. minimize the objective by defaul...
Implement the Python class `GA` described below. Class description: Simple Genetic Algorithm Method signatures and docstrings: - def __init__(self, population, selection, crossover, mutation, fun_fitness=lambda x: np.arctan(-x) + np.pi): fun_fitness: fitness based on objective values. minimize the objective by defaul...
a25b03a4e654bdf3c468fffc36efc5b1b6d3c158
<|skeleton|> class GA: """Simple Genetic Algorithm""" def __init__(self, population, selection, crossover, mutation, fun_fitness=lambda x: np.arctan(-x) + np.pi): """fun_fitness: fitness based on objective values. minimize the objective by default""" <|body_0|> def run(self, fun_evaluation...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GA: """Simple Genetic Algorithm""" def __init__(self, population, selection, crossover, mutation, fun_fitness=lambda x: np.arctan(-x) + np.pi): """fun_fitness: fitness based on objective values. minimize the objective by default""" self.population = population self.selection = sel...
the_stack_v2_python_sparse
GA/GA.py
zxhyJack/opt
train
0
6c07884cb9cf653755ceee5748d26b379c236eaf
[ "author = get_object_or_404(models.Author, id=author_id)\ndata = {'author': author, 'form': forms.AuthorForm(instance=author)}\nreturn TemplateResponse(request, 'author/edit_author.html', data)", "author = get_object_or_404(models.Author, id=author_id)\nform = forms.AuthorForm(request.POST, request.FILES, instanc...
<|body_start_0|> author = get_object_or_404(models.Author, id=author_id) data = {'author': author, 'form': forms.AuthorForm(instance=author)} return TemplateResponse(request, 'author/edit_author.html', data) <|end_body_0|> <|body_start_1|> author = get_object_or_404(models.Author, id=au...
edit author info
EditAuthor
[ "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EditAuthor: """edit author info""" def get(self, request, author_id): """info about a book""" <|body_0|> def post(self, request, author_id): """edit a author cool""" <|body_1|> <|end_skeleton|> <|body_start_0|> author = get_object_or_404(models....
stack_v2_sparse_classes_75kplus_train_069225
3,215
no_license
[ { "docstring": "info about a book", "name": "get", "signature": "def get(self, request, author_id)" }, { "docstring": "edit a author cool", "name": "post", "signature": "def post(self, request, author_id)" } ]
2
stack_v2_sparse_classes_30k_train_021906
Implement the Python class `EditAuthor` described below. Class description: edit author info Method signatures and docstrings: - def get(self, request, author_id): info about a book - def post(self, request, author_id): edit a author cool
Implement the Python class `EditAuthor` described below. Class description: edit author info Method signatures and docstrings: - def get(self, request, author_id): info about a book - def post(self, request, author_id): edit a author cool <|skeleton|> class EditAuthor: """edit author info""" def get(self, r...
0f8da5b738047f3c34d60d93f59bdedd8f797224
<|skeleton|> class EditAuthor: """edit author info""" def get(self, request, author_id): """info about a book""" <|body_0|> def post(self, request, author_id): """edit a author cool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EditAuthor: """edit author info""" def get(self, request, author_id): """info about a book""" author = get_object_or_404(models.Author, id=author_id) data = {'author': author, 'form': forms.AuthorForm(instance=author)} return TemplateResponse(request, 'author/edit_author.h...
the_stack_v2_python_sparse
bookwyrm/views/author.py
bookwyrm-social/bookwyrm
train
1,398
26414571f4b8a9629940400cbeff1387fdfe08db
[ "self.path1 = path\nself.path2 = path2\nself.d1 = defaultdict(str)\nself.d2 = defaultdict(int)\nself.dfinal = defaultdict(list)\nself.analyze_files()", "for line in file_reading_gen(self.path1, 4, sep='|', header=True):\n self.d1[line[1]] = line[3]\n self.d2[line[1]] += +1\nself.dfinal = {k: [self.d1[k], se...
<|body_start_0|> self.path1 = path self.path2 = path2 self.d1 = defaultdict(str) self.d2 = defaultdict(int) self.dfinal = defaultdict(list) self.analyze_files() <|end_body_0|> <|body_start_1|> for line in file_reading_gen(self.path1, 4, sep='|', header=True): ...
Instructor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Instructor: def __init__(self, path, path2): """self function""" <|body_0|> def analyze_files(self): """File analyze function. amost of the operetions are performed here""" <|body_1|> def pretty_print(self): """prints prettytable""" <|bod...
stack_v2_sparse_classes_75kplus_train_069226
6,468
no_license
[ { "docstring": "self function", "name": "__init__", "signature": "def __init__(self, path, path2)" }, { "docstring": "File analyze function. amost of the operetions are performed here", "name": "analyze_files", "signature": "def analyze_files(self)" }, { "docstring": "prints pret...
3
null
Implement the Python class `Instructor` described below. Class description: Implement the Instructor class. Method signatures and docstrings: - def __init__(self, path, path2): self function - def analyze_files(self): File analyze function. amost of the operetions are performed here - def pretty_print(self): prints p...
Implement the Python class `Instructor` described below. Class description: Implement the Instructor class. Method signatures and docstrings: - def __init__(self, path, path2): self function - def analyze_files(self): File analyze function. amost of the operetions are performed here - def pretty_print(self): prints p...
9fae4c459f4718411530c9917f30c03b05a4d753
<|skeleton|> class Instructor: def __init__(self, path, path2): """self function""" <|body_0|> def analyze_files(self): """File analyze function. amost of the operetions are performed here""" <|body_1|> def pretty_print(self): """prints prettytable""" <|bod...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Instructor: def __init__(self, path, path2): """self function""" self.path1 = path self.path2 = path2 self.d1 = defaultdict(str) self.d2 = defaultdict(int) self.dfinal = defaultdict(list) self.analyze_files() def analyze_files(self): """File...
the_stack_v2_python_sparse
HW10_Ameya_Desai.py
Ameya221/hello-world
train
0
63cfb61ea82d11af274acd160ae070c6992fb9d6
[ "self._deferred = deferred\nself._buff = []\nself._uid = None\nself._key = createKey()", "if not self._uid:\n if not definition.validateSuffix(line):\n raise ValueError('Received address suffix is not valid.')\n self._uid = line\n self.transport.write('{0}{1}{1}'.format(dumpCertReq(createCertReq(s...
<|body_start_0|> self._deferred = deferred self._buff = [] self._uid = None self._key = createKey() <|end_body_0|> <|body_start_1|> if not self._uid: if not definition.validateSuffix(line): raise ValueError('Received address suffix is not valid.') ...
Protocol which is used by a client to retrieve a new UID and certificate for a machine.
_SSLClientProtocol
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _SSLClientProtocol: """Protocol which is used by a client to retrieve a new UID and certificate for a machine.""" def __init__(self, deferred): """Initialize SSLClientProtocol. @param deferred: Deferred which should be called with the received UID, certificate and private key. @type ...
stack_v2_sparse_classes_75kplus_train_069227
18,143
permissive
[ { "docstring": "Initialize SSLClientProtocol. @param deferred: Deferred which should be called with the received UID, certificate and private key. @type deferred: Deferred", "name": "__init__", "signature": "def __init__(self, deferred)" }, { "docstring": "Callback which is called by twisted whe...
3
stack_v2_sparse_classes_30k_train_024018
Implement the Python class `_SSLClientProtocol` described below. Class description: Protocol which is used by a client to retrieve a new UID and certificate for a machine. Method signatures and docstrings: - def __init__(self, deferred): Initialize SSLClientProtocol. @param deferred: Deferred which should be called w...
Implement the Python class `_SSLClientProtocol` described below. Class description: Protocol which is used by a client to retrieve a new UID and certificate for a machine. Method signatures and docstrings: - def __init__(self, deferred): Initialize SSLClientProtocol. @param deferred: Deferred which should be called w...
c277efd809fce8f0f18b009fb3b9c7f785cc3739
<|skeleton|> class _SSLClientProtocol: """Protocol which is used by a client to retrieve a new UID and certificate for a machine.""" def __init__(self, deferred): """Initialize SSLClientProtocol. @param deferred: Deferred which should be called with the received UID, certificate and private key. @type ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class _SSLClientProtocol: """Protocol which is used by a client to retrieve a new UID and certificate for a machine.""" def __init__(self, deferred): """Initialize SSLClientProtocol. @param deferred: Deferred which should be called with the received UID, certificate and private key. @type deferred: Def...
the_stack_v2_python_sparse
framework/core/machine.py
LCROBOT/rce
train
0
11e94eeb40ae1fa9cfed981bf3ec3dca7011550c
[ "def backtrace(s, visited, path):\n repeat = []\n if len(path) == len(s):\n res.append(''.join(path))\n return\n for i in range(0, len(s)):\n if s[i] in repeat or visited[i] == True:\n continue\n path.append(s[i])\n repeat.append(s[i])\n visited[i] = Tru...
<|body_start_0|> def backtrace(s, visited, path): repeat = [] if len(path) == len(s): res.append(''.join(path)) return for i in range(0, len(s)): if s[i] in repeat or visited[i] == True: continue ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def permutation(self, s): """:type s: str :rtype: List[str]""" <|body_0|> def permutation(self, s): """:type s: str :rtype: List[str]""" <|body_1|> <|end_skeleton|> <|body_start_0|> def backtrace(s, visited, path): repeat = [] ...
stack_v2_sparse_classes_75kplus_train_069228
1,998
no_license
[ { "docstring": ":type s: str :rtype: List[str]", "name": "permutation", "signature": "def permutation(self, s)" }, { "docstring": ":type s: str :rtype: List[str]", "name": "permutation", "signature": "def permutation(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_025403
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def permutation(self, s): :type s: str :rtype: List[str] - def permutation(self, s): :type s: str :rtype: List[str]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def permutation(self, s): :type s: str :rtype: List[str] - def permutation(self, s): :type s: str :rtype: List[str] <|skeleton|> class Solution: def permutation(self, s): ...
6e18c5d257840489cc3fb1079ae3804c743982a4
<|skeleton|> class Solution: def permutation(self, s): """:type s: str :rtype: List[str]""" <|body_0|> def permutation(self, s): """:type s: str :rtype: List[str]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def permutation(self, s): """:type s: str :rtype: List[str]""" def backtrace(s, visited, path): repeat = [] if len(path) == len(s): res.append(''.join(path)) return for i in range(0, len(s)): if s[i] ...
the_stack_v2_python_sparse
剑指 Offer 38. 字符串的排列.py
yangyuxiang1996/leetcode
train
0
8665338f7d30dd5317ae9f0a28e287f17106eea3
[ "args = parser.parse_args()\ntask_id = args.get('task_id')\nrely_task_id = args.get('rely_task_id')\nrequest_id = args.get('request_id')\nsubmitter = args.get('submitter')\npgnum = args.get('pgnum')\nif not pgnum:\n pgnum = 1\noptions = {'page': pgnum, 'task_id': task_id, 'rely_task_id': rely_task_id, 'request_i...
<|body_start_0|> args = parser.parse_args() task_id = args.get('task_id') rely_task_id = args.get('rely_task_id') request_id = args.get('request_id') submitter = args.get('submitter') pgnum = args.get('pgnum') if not pgnum: pgnum = 1 options = ...
LogTask
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LogTask: def get(self): """获取任务日志信息 --- tags: - logs summary: Add a new pet to the store parameters: - in: query name: task_id type: string description: 任务id - in: query name: rely_task_id type: string description: 依赖任务id - in: query name: pgnum type: int description: 页码 - name: submitte...
stack_v2_sparse_classes_75kplus_train_069229
4,993
no_license
[ { "docstring": "获取任务日志信息 --- tags: - logs summary: Add a new pet to the store parameters: - in: query name: task_id type: string description: 任务id - in: query name: rely_task_id type: string description: 依赖任务id - in: query name: pgnum type: int description: 页码 - name: submitter type: string in: query descriptio...
2
null
Implement the Python class `LogTask` described below. Class description: Implement the LogTask class. Method signatures and docstrings: - def get(self): 获取任务日志信息 --- tags: - logs summary: Add a new pet to the store parameters: - in: query name: task_id type: string description: 任务id - in: query name: rely_task_id typ...
Implement the Python class `LogTask` described below. Class description: Implement the LogTask class. Method signatures and docstrings: - def get(self): 获取任务日志信息 --- tags: - logs summary: Add a new pet to the store parameters: - in: query name: task_id type: string description: 任务id - in: query name: rely_task_id typ...
d25871dc66dfbd9f04e3d4d95843e39de286cfc8
<|skeleton|> class LogTask: def get(self): """获取任务日志信息 --- tags: - logs summary: Add a new pet to the store parameters: - in: query name: task_id type: string description: 任务id - in: query name: rely_task_id type: string description: 依赖任务id - in: query name: pgnum type: int description: 页码 - name: submitte...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LogTask: def get(self): """获取任务日志信息 --- tags: - logs summary: Add a new pet to the store parameters: - in: query name: task_id type: string description: 任务id - in: query name: rely_task_id type: string description: 依赖任务id - in: query name: pgnum type: int description: 页码 - name: submitter type: string...
the_stack_v2_python_sparse
app/main/base/apis/task_logs.py
zcl-organization/naguan
train
0
81568dc2bb21ab0a42087a4a17a118f8f9673a7f
[ "if not root:\n return True\nnLeft = self.NodeDepth(root.left)\nnRight = self.NodeDepth(root.right)\nif nLeft - nRight > 1 or nRight - nLeft > 1:\n return False\nreturn self.isBalanced(root.left) and self.isBalanced(root.right)", "if not node:\n return 0\nreturn max(self.NodeDepth(node.left), self.NodeDe...
<|body_start_0|> if not root: return True nLeft = self.NodeDepth(root.left) nRight = self.NodeDepth(root.right) if nLeft - nRight > 1 or nRight - nLeft > 1: return False return self.isBalanced(root.left) and self.isBalanced(root.right) <|end_body_0|> <|bo...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isBalanced(self, root): """:type root: TreeNode :rtype: bool""" <|body_0|> def NodeDepth(self, node): """DP获取树的节点深度,同104题 :type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: return ...
stack_v2_sparse_classes_75kplus_train_069230
1,232
no_license
[ { "docstring": ":type root: TreeNode :rtype: bool", "name": "isBalanced", "signature": "def isBalanced(self, root)" }, { "docstring": "DP获取树的节点深度,同104题 :type root: TreeNode :rtype: int", "name": "NodeDepth", "signature": "def NodeDepth(self, node)" } ]
2
stack_v2_sparse_classes_30k_train_010069
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isBalanced(self, root): :type root: TreeNode :rtype: bool - def NodeDepth(self, node): DP获取树的节点深度,同104题 :type root: TreeNode :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isBalanced(self, root): :type root: TreeNode :rtype: bool - def NodeDepth(self, node): DP获取树的节点深度,同104题 :type root: TreeNode :rtype: int <|skeleton|> class Solution: de...
f012740215568768794a019153af0b6e4c77b91b
<|skeleton|> class Solution: def isBalanced(self, root): """:type root: TreeNode :rtype: bool""" <|body_0|> def NodeDepth(self, node): """DP获取树的节点深度,同104题 :type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def isBalanced(self, root): """:type root: TreeNode :rtype: bool""" if not root: return True nLeft = self.NodeDepth(root.left) nRight = self.NodeDepth(root.right) if nLeft - nRight > 1 or nRight - nLeft > 1: return False return ...
the_stack_v2_python_sparse
No.110_BalancedBinaryTree.py
wh279813/LeetCode
train
0
5e5f8576e7a302675499af2023afb21453ddaad7
[ "self.total = num_rows * num_columns\nself.row_names = row_index_names\nif row_index_names:\n data_frame = pd.DataFrame(index=np.arange(num_rows), columns=['index'] + column_names)\n data_frame['index'] = row_index_names\n self.row_index_to_row_name_map = self.map_row_names()\nelse:\n data_frame = pd.Da...
<|body_start_0|> self.total = num_rows * num_columns self.row_names = row_index_names if row_index_names: data_frame = pd.DataFrame(index=np.arange(num_rows), columns=['index'] + column_names) data_frame['index'] = row_index_names self.row_index_to_row_name_ma...
Datatable object synced with a server session that updates on the bokeh server every time update_table is called.
DataTable
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataTable: """Datatable object synced with a server session that updates on the bokeh server every time update_table is called.""" def __init__(self, num_rows: int, num_columns: int, column_names: list, bokeh_document: Optional[BokehDocument], row_index_names: list=None): """:param n...
stack_v2_sparse_classes_75kplus_train_069231
14,891
permissive
[ { "docstring": ":param num_rows: number of records in the table :param num_columns: number of columns to create :param column_names: list containing column headers :param bokeh_document: bokeh document to which to add the table if provided :param row_index_names: list containing unique index names for each reco...
3
stack_v2_sparse_classes_30k_train_038228
Implement the Python class `DataTable` described below. Class description: Datatable object synced with a server session that updates on the bokeh server every time update_table is called. Method signatures and docstrings: - def __init__(self, num_rows: int, num_columns: int, column_names: list, bokeh_document: Optio...
Implement the Python class `DataTable` described below. Class description: Datatable object synced with a server session that updates on the bokeh server every time update_table is called. Method signatures and docstrings: - def __init__(self, num_rows: int, num_columns: int, column_names: list, bokeh_document: Optio...
5a406e657082b6a4f6e4bf48f0e46e085cb1e351
<|skeleton|> class DataTable: """Datatable object synced with a server session that updates on the bokeh server every time update_table is called.""" def __init__(self, num_rows: int, num_columns: int, column_names: list, bokeh_document: Optional[BokehDocument], row_index_names: list=None): """:param n...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DataTable: """Datatable object synced with a server session that updates on the bokeh server every time update_table is called.""" def __init__(self, num_rows: int, num_columns: int, column_names: list, bokeh_document: Optional[BokehDocument], row_index_names: list=None): """:param num_rows: numb...
the_stack_v2_python_sparse
TrainingExtensions/common/src/python/aimet_common/bokeh_plots.py
quic/aimet
train
1,676
1cc1487eb70f0cbeac5b58fa51dde279d08579ce
[ "MD = '100'\nops, cts = tu.splitMD(MD)\nassert ops == ['M']\nassert cts == [100]", "MD = '48T42G8'\nops, cts = tu.splitMD(MD)\nassert ops == ['M', 'X', 'M', 'X', 'M']\nassert cts == [48, 1, 42, 1, 8]", "MD = '56^ACG45'\nops, cts = tu.splitMD(MD)\nassert ops == ['M', 'D', 'M']\nassert cts == [56, 3, 45]", "MD ...
<|body_start_0|> MD = '100' ops, cts = tu.splitMD(MD) assert ops == ['M'] assert cts == [100] <|end_body_0|> <|body_start_1|> MD = '48T42G8' ops, cts = tu.splitMD(MD) assert ops == ['M', 'X', 'M', 'X', 'M'] assert cts == [48, 1, 42, 1, 8] <|end_body_1|> ...
TestSplitMD
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSplitMD: def test_splitMD(self): """Easy case- full match""" <|body_0|> def test_with_mismatches(self): """MD tag with mismatches in it""" <|body_1|> def test_with_deletion(self): """MD tag with deletions in it""" <|body_2|> def ...
stack_v2_sparse_classes_75kplus_train_069232
992
permissive
[ { "docstring": "Easy case- full match", "name": "test_splitMD", "signature": "def test_splitMD(self)" }, { "docstring": "MD tag with mismatches in it", "name": "test_with_mismatches", "signature": "def test_with_mismatches(self)" }, { "docstring": "MD tag with deletions in it", ...
4
stack_v2_sparse_classes_30k_train_037992
Implement the Python class `TestSplitMD` described below. Class description: Implement the TestSplitMD class. Method signatures and docstrings: - def test_splitMD(self): Easy case- full match - def test_with_mismatches(self): MD tag with mismatches in it - def test_with_deletion(self): MD tag with deletions in it - d...
Implement the Python class `TestSplitMD` described below. Class description: Implement the TestSplitMD class. Method signatures and docstrings: - def test_splitMD(self): Easy case- full match - def test_with_mismatches(self): MD tag with mismatches in it - def test_with_deletion(self): MD tag with deletions in it - d...
8014faed5f982e5e106ec05239e47d65878e76c3
<|skeleton|> class TestSplitMD: def test_splitMD(self): """Easy case- full match""" <|body_0|> def test_with_mismatches(self): """MD tag with mismatches in it""" <|body_1|> def test_with_deletion(self): """MD tag with deletions in it""" <|body_2|> def ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestSplitMD: def test_splitMD(self): """Easy case- full match""" MD = '100' ops, cts = tu.splitMD(MD) assert ops == ['M'] assert cts == [100] def test_with_mismatches(self): """MD tag with mismatches in it""" MD = '48T42G8' ops, cts = tu.spl...
the_stack_v2_python_sparse
testing_suite/test_splitMD.py
kopardev/TALON
train
0
4c2a1444247262272dd7b14a9c8ff112d330332f
[ "if not self.root:\n self.root = Node(value)\n\ndef add_helper(root):\n if value < root.value:\n if root.left is None:\n root.left = Node(value)\n else:\n add_helper(root.left)\n elif value > root.value:\n if root.right is None:\n root.right = Node(valu...
<|body_start_0|> if not self.root: self.root = Node(value) def add_helper(root): if value < root.value: if root.left is None: root.left = Node(value) else: add_helper(root.left) elif value > root...
Binary Search Tree class. Inherits from BinaryTree.
BinarySearchTree
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BinarySearchTree: """Binary Search Tree class. Inherits from BinaryTree.""" def add(self, value): """Add a value to the tree Args: value (any): value to add""" <|body_0|> def contains(self, value): """Checks if given value exists in the tree Args: value (any): va...
stack_v2_sparse_classes_75kplus_train_069233
3,725
no_license
[ { "docstring": "Add a value to the tree Args: value (any): value to add", "name": "add", "signature": "def add(self, value)" }, { "docstring": "Checks if given value exists in the tree Args: value (any): value to check Returns: bool: True if value exists", "name": "contains", "signature"...
2
stack_v2_sparse_classes_30k_train_006385
Implement the Python class `BinarySearchTree` described below. Class description: Binary Search Tree class. Inherits from BinaryTree. Method signatures and docstrings: - def add(self, value): Add a value to the tree Args: value (any): value to add - def contains(self, value): Checks if given value exists in the tree ...
Implement the Python class `BinarySearchTree` described below. Class description: Binary Search Tree class. Inherits from BinaryTree. Method signatures and docstrings: - def add(self, value): Add a value to the tree Args: value (any): value to add - def contains(self, value): Checks if given value exists in the tree ...
d923132849f799985440dd5c510e932d731b82d1
<|skeleton|> class BinarySearchTree: """Binary Search Tree class. Inherits from BinaryTree.""" def add(self, value): """Add a value to the tree Args: value (any): value to add""" <|body_0|> def contains(self, value): """Checks if given value exists in the tree Args: value (any): va...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BinarySearchTree: """Binary Search Tree class. Inherits from BinaryTree.""" def add(self, value): """Add a value to the tree Args: value (any): value to add""" if not self.root: self.root = Node(value) def add_helper(root): if value < root.value: ...
the_stack_v2_python_sparse
python/data_structures/tree/tree.py
okayjones/data-structures-and-algorithms
train
0
9e61d3ba723e396ab2899ec04aa876bbca17b467
[ "for id, op in vars(cls).items():\n if isinstance(op, UnaryOperation) and op.is_valid(operator, operand):\n return op.build(operand)", "for id, op in vars(cls).items():\n if isinstance(op, UnaryOperation) and op.operator is operator:\n return op", "for id, op in vars(cls).items():\n if ty...
<|body_start_0|> for id, op in vars(cls).items(): if isinstance(op, UnaryOperation) and op.is_valid(operator, operand): return op.build(operand) <|end_body_0|> <|body_start_1|> for id, op in vars(cls).items(): if isinstance(op, UnaryOperation) and op.operator is ...
UnaryOp
[ "Apache-2.0", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UnaryOp: def validate_type(cls, operator: Operator, operand: IType) -> Optional[UnaryOperation]: """Gets a unary operation given the operator and the operand type. :param operator: unary operator :param operand: type of the operand :return: The operation if exists. None otherwise; :rtype...
stack_v2_sparse_classes_75kplus_train_069234
1,937
permissive
[ { "docstring": "Gets a unary operation given the operator and the operand type. :param operator: unary operator :param operand: type of the operand :return: The operation if exists. None otherwise; :rtype: UnaryOperation or None", "name": "validate_type", "signature": "def validate_type(cls, operator: O...
3
stack_v2_sparse_classes_30k_train_046659
Implement the Python class `UnaryOp` described below. Class description: Implement the UnaryOp class. Method signatures and docstrings: - def validate_type(cls, operator: Operator, operand: IType) -> Optional[UnaryOperation]: Gets a unary operation given the operator and the operand type. :param operator: unary opera...
Implement the Python class `UnaryOp` described below. Class description: Implement the UnaryOp class. Method signatures and docstrings: - def validate_type(cls, operator: Operator, operand: IType) -> Optional[UnaryOperation]: Gets a unary operation given the operator and the operand type. :param operator: unary opera...
e4ef340744b5bd25ade26f847eac50789b97f3e9
<|skeleton|> class UnaryOp: def validate_type(cls, operator: Operator, operand: IType) -> Optional[UnaryOperation]: """Gets a unary operation given the operator and the operand type. :param operator: unary operator :param operand: type of the operand :return: The operation if exists. None otherwise; :rtype...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UnaryOp: def validate_type(cls, operator: Operator, operand: IType) -> Optional[UnaryOperation]: """Gets a unary operation given the operator and the operand type. :param operator: unary operator :param operand: type of the operand :return: The operation if exists. None otherwise; :rtype: UnaryOperati...
the_stack_v2_python_sparse
boa3/model/operation/unaryop.py
DanPopa46/neo3-boa
train
0
208f18b877d83e98f5c728a926808e43aa01fde2
[ "if not client:\n client = utils.create_datastore_client()\nself.kind = kind\nself.client = client\nself.id_field = id_field", "if not entity_id and (not make_new):\n raise ValueError('entity_id is None and make_new is False')\nif not entity_id:\n entity = datastore.Entity(self._get_key(utils.get_id()))\...
<|body_start_0|> if not client: client = utils.create_datastore_client() self.kind = kind self.client = client self.id_field = id_field <|end_body_0|> <|body_start_1|> if not entity_id and (not make_new): raise ValueError('entity_id is None and make_new i...
Base class for a Database service that stores some kind of entities using Google Cloud Datastore for storage. New datastore Entity objects must be created using get(make_new=True). The datastore Client will attempt to infer credentials based on host environment. See https://cloud.google.com/docs/authentication/producti...
BaseDatabase
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseDatabase: """Base class for a Database service that stores some kind of entities using Google Cloud Datastore for storage. New datastore Entity objects must be created using get(make_new=True). The datastore Client will attempt to infer credentials based on host environment. See https://cloud...
stack_v2_sparse_classes_75kplus_train_069235
5,117
permissive
[ { "docstring": "Constructs an BaseDatabase. Args: kind: Kind of entities stored client: Client to communicate with Datastore. id_field: Name of the ID field of an entity as a string. Every operation checks if id_field is not already a field in the entity. If not, it will be added to the entity with the value of...
5
stack_v2_sparse_classes_30k_val_000222
Implement the Python class `BaseDatabase` described below. Class description: Base class for a Database service that stores some kind of entities using Google Cloud Datastore for storage. New datastore Entity objects must be created using get(make_new=True). The datastore Client will attempt to infer credentials based...
Implement the Python class `BaseDatabase` described below. Class description: Base class for a Database service that stores some kind of entities using Google Cloud Datastore for storage. New datastore Entity objects must be created using get(make_new=True). The datastore Client will attempt to infer credentials based...
6b32c869f426a8a5ba1b99edd324cc0c77bbd4ad
<|skeleton|> class BaseDatabase: """Base class for a Database service that stores some kind of entities using Google Cloud Datastore for storage. New datastore Entity objects must be created using get(make_new=True). The datastore Client will attempt to infer credentials based on host environment. See https://cloud...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseDatabase: """Base class for a Database service that stores some kind of entities using Google Cloud Datastore for storage. New datastore Entity objects must be created using get(make_new=True). The datastore Client will attempt to infer credentials based on host environment. See https://cloud.google.com/d...
the_stack_v2_python_sparse
import-automation/import-progress-dashboard-api/app/service/base_database.py
wh1210/data
train
1
a2d5ba4a37c7f1b6b066eaa2b252e070df19ea64
[ "super().__init__()\nself.q_proj = nn.Linear(q_dim, h_dim)\nself.s_proj = nn.Linear(s_dim, h_dim)\nself.linear = nn.Linear(h_dim, 1)\nself.out = nn.Linear(s_dim, out_dim)", "q_proj = self.q_proj(q).unsqueeze(2)\ns_proj = self.s_proj(s).unsqueeze(1)\nout = torch.tanh(q_proj + s_proj)\nattn_score = self.linear(out)...
<|body_start_0|> super().__init__() self.q_proj = nn.Linear(q_dim, h_dim) self.s_proj = nn.Linear(s_dim, h_dim) self.linear = nn.Linear(h_dim, 1) self.out = nn.Linear(s_dim, out_dim) <|end_body_0|> <|body_start_1|> q_proj = self.q_proj(q).unsqueeze(2) s_proj = se...
Bahdanau attention score = v*tanh(W1*q + W2*s)
AdditiveAttention
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdditiveAttention: """Bahdanau attention score = v*tanh(W1*q + W2*s)""" def __init__(self, q_dim, s_dim, h_dim, out_dim): """params: q_dim: query dim s_dim: source dim h_dim: attn hidden dim out_dim: final out dim""" <|body_0|> def forward(self, q, s, mask): """q...
stack_v2_sparse_classes_75kplus_train_069236
4,057
no_license
[ { "docstring": "params: q_dim: query dim s_dim: source dim h_dim: attn hidden dim out_dim: final out dim", "name": "__init__", "signature": "def __init__(self, q_dim, s_dim, h_dim, out_dim)" }, { "docstring": "q: [B, q_len, q_dim] s: [B, s_len, s_dim] mask: [B, 1, s_len]", "name": "forward",...
2
stack_v2_sparse_classes_30k_train_047338
Implement the Python class `AdditiveAttention` described below. Class description: Bahdanau attention score = v*tanh(W1*q + W2*s) Method signatures and docstrings: - def __init__(self, q_dim, s_dim, h_dim, out_dim): params: q_dim: query dim s_dim: source dim h_dim: attn hidden dim out_dim: final out dim - def forward...
Implement the Python class `AdditiveAttention` described below. Class description: Bahdanau attention score = v*tanh(W1*q + W2*s) Method signatures and docstrings: - def __init__(self, q_dim, s_dim, h_dim, out_dim): params: q_dim: query dim s_dim: source dim h_dim: attn hidden dim out_dim: final out dim - def forward...
54dcd23112d452b856e4f8000cf697d352cfec05
<|skeleton|> class AdditiveAttention: """Bahdanau attention score = v*tanh(W1*q + W2*s)""" def __init__(self, q_dim, s_dim, h_dim, out_dim): """params: q_dim: query dim s_dim: source dim h_dim: attn hidden dim out_dim: final out dim""" <|body_0|> def forward(self, q, s, mask): """q...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AdditiveAttention: """Bahdanau attention score = v*tanh(W1*q + W2*s)""" def __init__(self, q_dim, s_dim, h_dim, out_dim): """params: q_dim: query dim s_dim: source dim h_dim: attn hidden dim out_dim: final out dim""" super().__init__() self.q_proj = nn.Linear(q_dim, h_dim) ...
the_stack_v2_python_sparse
models/rnn/attention.py
khanrc/pt.seq2seq
train
3
b24b6ef3b75a05ec0e17f4a57ff9b8d434e42e2d
[ "code = Utils.code_to_symbol(code)\ncalc_date = Utils.to_date(calc_date)\nttm_fin_data_latest = Utils.get_ttm_fin_basic_data(code, calc_date)\nif ttm_fin_data_latest is None:\n return None\ntry:\n pre_date = datetime.datetime(calc_date.year - 1, calc_date.month, calc_date.day)\nexcept ValueError:\n pre_dat...
<|body_start_0|> code = Utils.code_to_symbol(code) calc_date = Utils.to_date(calc_date) ttm_fin_data_latest = Utils.get_ttm_fin_basic_data(code, calc_date) if ttm_fin_data_latest is None: return None try: pre_date = datetime.datetime(calc_date.year - 1, ca...
成长类因子 -------- 包含:npg_ttm(净利润增长率_TTM), opg_ttm(营业收入增长率_TTM) --------
Growth
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Growth: """成长类因子 -------- 包含:npg_ttm(净利润增长率_TTM), opg_ttm(营业收入增长率_TTM) --------""" def _calc_factor_loading(cls, code, calc_date): """计算指定日期、指定个股的成长因子,包含npg_ttm, opg_ttm Parameters: -------- :param code: str 个股代码,如600000或SH600000 :param calc_date: datetime-like or str 计算日期,格式YYYY-MM-...
stack_v2_sparse_classes_75kplus_train_069237
7,265
no_license
[ { "docstring": "计算指定日期、指定个股的成长因子,包含npg_ttm, opg_ttm Parameters: -------- :param code: str 个股代码,如600000或SH600000 :param calc_date: datetime-like or str 计算日期,格式YYYY-MM-DD, YYYYMMDD :return: pd.Series -------- 成长类因子值 0. id: 证券代码 1. npg_ttm: 净利润增长率_TTM 2. opg_ttm: 营业收入增长率_TTM 若计算失败, 返回None", "name": "_calc_fact...
3
stack_v2_sparse_classes_30k_train_035739
Implement the Python class `Growth` described below. Class description: 成长类因子 -------- 包含:npg_ttm(净利润增长率_TTM), opg_ttm(营业收入增长率_TTM) -------- Method signatures and docstrings: - def _calc_factor_loading(cls, code, calc_date): 计算指定日期、指定个股的成长因子,包含npg_ttm, opg_ttm Parameters: -------- :param code: str 个股代码,如600000或SH6000...
Implement the Python class `Growth` described below. Class description: 成长类因子 -------- 包含:npg_ttm(净利润增长率_TTM), opg_ttm(营业收入增长率_TTM) -------- Method signatures and docstrings: - def _calc_factor_loading(cls, code, calc_date): 计算指定日期、指定个股的成长因子,包含npg_ttm, opg_ttm Parameters: -------- :param code: str 个股代码,如600000或SH6000...
c796951a7200af5ea247a505bbc7d456f43f9922
<|skeleton|> class Growth: """成长类因子 -------- 包含:npg_ttm(净利润增长率_TTM), opg_ttm(营业收入增长率_TTM) --------""" def _calc_factor_loading(cls, code, calc_date): """计算指定日期、指定个股的成长因子,包含npg_ttm, opg_ttm Parameters: -------- :param code: str 个股代码,如600000或SH600000 :param calc_date: datetime-like or str 计算日期,格式YYYY-MM-...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Growth: """成长类因子 -------- 包含:npg_ttm(净利润增长率_TTM), opg_ttm(营业收入增长率_TTM) --------""" def _calc_factor_loading(cls, code, calc_date): """计算指定日期、指定个股的成长因子,包含npg_ttm, opg_ttm Parameters: -------- :param code: str 个股代码,如600000或SH600000 :param calc_date: datetime-like or str 计算日期,格式YYYY-MM-DD, YYYYMMDD ...
the_stack_v2_python_sparse
src/factors/Growth.py
fan1018wen/MultiFactor
train
0
6c534ab421dd312248fcb969e0c085ccd8f7d7b9
[ "if freezer_type is not FreezerPropertyFreezer:\n assert issubclass(freezer_type, Freezer)\n if not on_freeze is on_thaw is do_nothing:\n raise Exception(\"You've passed a `freezer_type` argument, so you're not allowed to pass `on_freeze` or `on_thaw` arguments. The freeze/thaw handlers should be defin...
<|body_start_0|> if freezer_type is not FreezerPropertyFreezer: assert issubclass(freezer_type, Freezer) if not on_freeze is on_thaw is do_nothing: raise Exception("You've passed a `freezer_type` argument, so you're not allowed to pass `on_freeze` or `on_thaw` arguments. ...
A property which lazy-creates a freezer. A freezer is used as a context manager to "freeze" and "thaw" an object. See documentation of `Freezer` in this package for more info. The advantages of using a `FreezerProperty` instead of creating a freezer attribute for each instance: - The `.on_freeze` and `.on_thaw` decorat...
FreezerProperty
[ "BSD-3-Clause", "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FreezerProperty: """A property which lazy-creates a freezer. A freezer is used as a context manager to "freeze" and "thaw" an object. See documentation of `Freezer` in this package for more info. The advantages of using a `FreezerProperty` instead of creating a freezer attribute for each instance...
stack_v2_sparse_classes_75kplus_train_069238
3,931
permissive
[ { "docstring": "Create the `FreezerProperty`. All arguments are optional: You may pass in freeze/thaw handlers as `on_freeze` and `on_thaw`, but you don't have to. You may choose a specific freezer type to use as `freezer_type`, in which case you can't use either the `on_freeze`/`on_thaw` arguments nor the deco...
4
stack_v2_sparse_classes_30k_train_006932
Implement the Python class `FreezerProperty` described below. Class description: A property which lazy-creates a freezer. A freezer is used as a context manager to "freeze" and "thaw" an object. See documentation of `Freezer` in this package for more info. The advantages of using a `FreezerProperty` instead of creatin...
Implement the Python class `FreezerProperty` described below. Class description: A property which lazy-creates a freezer. A freezer is used as a context manager to "freeze" and "thaw" an object. See documentation of `Freezer` in this package for more info. The advantages of using a `FreezerProperty` instead of creatin...
cb9ef64b48f1d03275484d707dc5079b6701ad0c
<|skeleton|> class FreezerProperty: """A property which lazy-creates a freezer. A freezer is used as a context manager to "freeze" and "thaw" an object. See documentation of `Freezer` in this package for more info. The advantages of using a `FreezerProperty` instead of creating a freezer attribute for each instance...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FreezerProperty: """A property which lazy-creates a freezer. A freezer is used as a context manager to "freeze" and "thaw" an object. See documentation of `Freezer` in this package for more info. The advantages of using a `FreezerProperty` instead of creating a freezer attribute for each instance: - The `.on_...
the_stack_v2_python_sparse
python_toolbox/freezing/freezer_property.py
cool-RR/python_toolbox
train
130
bd0113a620af4243dc01c49558ab8b5d01229913
[ "if nums is None or target is None:\n return []\nlength = len(nums)\nif length < 2:\n return []\nrvt = sorted(enumerate(nums), key=lambda x: x[1])\nleft = 0\nright = length - 1\nwhile left < right:\n sum = rvt[left][1] + rvt[right][1]\n if sum == target:\n return sorted([rvt[left][0], rvt[right][...
<|body_start_0|> if nums is None or target is None: return [] length = len(nums) if length < 2: return [] rvt = sorted(enumerate(nums), key=lambda x: x[1]) left = 0 right = length - 1 while left < right: sum = rvt[left][1] + rvt...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def twoSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def findTarget(self, root, k): """:type root: TreeNode :type k: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if ...
stack_v2_sparse_classes_75kplus_train_069239
1,777
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: List[int]", "name": "twoSum", "signature": "def twoSum(self, nums, target)" }, { "docstring": ":type root: TreeNode :type k: int :rtype: bool", "name": "findTarget", "signature": "def findTarget(self, root, k)" } ]
2
stack_v2_sparse_classes_30k_train_021405
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] - def findTarget(self, root, k): :type root: TreeNode :type k: int :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] - def findTarget(self, root, k): :type root: TreeNode :type k: int :rtype: bool <|skele...
c1f27c0cec80585095ce98a678ab85079e1a4c46
<|skeleton|> class Solution: def twoSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def findTarget(self, root, k): """:type root: TreeNode :type k: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def twoSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" if nums is None or target is None: return [] length = len(nums) if length < 2: return [] rvt = sorted(enumerate(nums), key=lambda x: x[1]) ...
the_stack_v2_python_sparse
Leetcode/1_TwoSum.py
wbq9224/Leetcode_Python
train
0
f0a1f12694e99ba46af996e444ef32d7ebce0b22
[ "if model._meta.app_label == 'researcherquery':\n return 'safedb'\nreturn None", "if model._meta.app_label == 'researcherquery':\n return 'safedb'\nreturn None", "if obj1._meta.app_label == 'researcherquery' and obj2._meta.app_label == 'researcherquery':\n return True\nreturn None", "if app_label == ...
<|body_start_0|> if model._meta.app_label == 'researcherquery': return 'safedb' return None <|end_body_0|> <|body_start_1|> if model._meta.app_label == 'researcherquery': return 'safedb' return None <|end_body_1|> <|body_start_2|> if obj1._meta.app_label...
A router to control all database operations on models in the researcherquery application.
ResearcherqueryRouter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResearcherqueryRouter: """A router to control all database operations on models in the researcherquery application.""" def db_for_read(self, model, **hints): """Attempts to read researcherquery models go to safedb.""" <|body_0|> def db_for_write(self, model, **hints): ...
stack_v2_sparse_classes_75kplus_train_069240
1,295
no_license
[ { "docstring": "Attempts to read researcherquery models go to safedb.", "name": "db_for_read", "signature": "def db_for_read(self, model, **hints)" }, { "docstring": "Attempts to write researcherquery models go to safedb.", "name": "db_for_write", "signature": "def db_for_write(self, mod...
4
stack_v2_sparse_classes_30k_train_046843
Implement the Python class `ResearcherqueryRouter` described below. Class description: A router to control all database operations on models in the researcherquery application. Method signatures and docstrings: - def db_for_read(self, model, **hints): Attempts to read researcherquery models go to safedb. - def db_for...
Implement the Python class `ResearcherqueryRouter` described below. Class description: A router to control all database operations on models in the researcherquery application. Method signatures and docstrings: - def db_for_read(self, model, **hints): Attempts to read researcherquery models go to safedb. - def db_for...
685c2b9d40fb24ca1735352846a39fdf5d3728eb
<|skeleton|> class ResearcherqueryRouter: """A router to control all database operations on models in the researcherquery application.""" def db_for_read(self, model, **hints): """Attempts to read researcherquery models go to safedb.""" <|body_0|> def db_for_write(self, model, **hints): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ResearcherqueryRouter: """A router to control all database operations on models in the researcherquery application.""" def db_for_read(self, model, **hints): """Attempts to read researcherquery models go to safedb.""" if model._meta.app_label == 'researcherquery': return 'safe...
the_stack_v2_python_sparse
researcherquery/router.py
guekling/ifs4205team1
train
0
6c09bcd71368d11f3c310a97834a919bd6d36c5b
[ "if name in dir(self):\n raise ValueError(f'{name} is already registered')\nelif inspect.isclass(item) and issubclass(item, SimpleBase):\n setattr(self, name, item)\nelif isinstance(item, SimpleBase):\n setattr(self, name, item.__class__)\nelse:\n raise TypeError(f'item must be a SimpleBase')\nreturn se...
<|body_start_0|> if name in dir(self): raise ValueError(f'{name} is already registered') elif inspect.isclass(item) and issubclass(item, SimpleBase): setattr(self, name, item) elif isinstance(item, SimpleBase): setattr(self, name, item.__class__) else:...
Stores base classes in siMpLify.
SimpleBases
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleBases: """Stores base classes in siMpLify.""" def register(self, name: str, item: Union[Type, object]) -> None: """[summary] Args: name (str): [description] item (Union[Type, object]): [description] Raises: ValueError: [description] TypeError: [description] Returns: [type]: [de...
stack_v2_sparse_classes_75kplus_train_069241
10,643
permissive
[ { "docstring": "[summary] Args: name (str): [description] item (Union[Type, object]): [description] Raises: ValueError: [description] TypeError: [description] Returns: [type]: [description]", "name": "register", "signature": "def register(self, name: str, item: Union[Type, object]) -> None" }, { ...
2
stack_v2_sparse_classes_30k_train_017759
Implement the Python class `SimpleBases` described below. Class description: Stores base classes in siMpLify. Method signatures and docstrings: - def register(self, name: str, item: Union[Type, object]) -> None: [summary] Args: name (str): [description] item (Union[Type, object]): [description] Raises: ValueError: [d...
Implement the Python class `SimpleBases` described below. Class description: Stores base classes in siMpLify. Method signatures and docstrings: - def register(self, name: str, item: Union[Type, object]) -> None: [summary] Args: name (str): [description] item (Union[Type, object]): [description] Raises: ValueError: [d...
5302da8bf4944ac518d22cc37c181e5a09baaabe
<|skeleton|> class SimpleBases: """Stores base classes in siMpLify.""" def register(self, name: str, item: Union[Type, object]) -> None: """[summary] Args: name (str): [description] item (Union[Type, object]): [description] Raises: ValueError: [description] TypeError: [description] Returns: [type]: [de...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SimpleBases: """Stores base classes in siMpLify.""" def register(self, name: str, item: Union[Type, object]) -> None: """[summary] Args: name (str): [description] item (Union[Type, object]): [description] Raises: ValueError: [description] TypeError: [description] Returns: [type]: [description]"""...
the_stack_v2_python_sparse
simplify/core/base.py
WithPrecedent/simplify
train
1
5f252570411540b0b71662f845169d8b9454ae95
[ "if type(capacity) != int or capacity <= 0:\n raise Exception('Capacity Error')\n'@helpDescription(When the CircularQueue class is initialized, a list is initalized which acts as the queue. The capacity, count (number of items in the queue), head (index of the first item in the queue) and tail (index of the last...
<|body_start_0|> if type(capacity) != int or capacity <= 0: raise Exception('Capacity Error') '@helpDescription(When the CircularQueue class is initialized, a list is initalized which acts as the queue. The capacity, count (number of items in the queue), head (index of the first item in the ...
@helpDescription(The capacity, or the maximum length allowed in the queue, is passed in as an integer when the CircularQueue class is initialized.)
CircularQueue
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CircularQueue: """@helpDescription(The capacity, or the maximum length allowed in the queue, is passed in as an integer when the CircularQueue class is initialized.)""" def __init__(self, capacity): """@helpDescription(The value passed in for capacity of a queue must be a positive in...
stack_v2_sparse_classes_75kplus_train_069242
6,664
no_license
[ { "docstring": "@helpDescription(The value passed in for capacity of a queue must be a positive integer. If the value is not, an exception with the line 'Capacity Error' is rasied.)", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": "@helpDescription(If the queue...
5
stack_v2_sparse_classes_30k_test_002623
Implement the Python class `CircularQueue` described below. Class description: @helpDescription(The capacity, or the maximum length allowed in the queue, is passed in as an integer when the CircularQueue class is initialized.) Method signatures and docstrings: - def __init__(self, capacity): @helpDescription(The valu...
Implement the Python class `CircularQueue` described below. Class description: @helpDescription(The capacity, or the maximum length allowed in the queue, is passed in as an integer when the CircularQueue class is initialized.) Method signatures and docstrings: - def __init__(self, capacity): @helpDescription(The valu...
688638f6c3fa3d31c4f8be6391147d773e1aa9dd
<|skeleton|> class CircularQueue: """@helpDescription(The capacity, or the maximum length allowed in the queue, is passed in as an integer when the CircularQueue class is initialized.)""" def __init__(self, capacity): """@helpDescription(The value passed in for capacity of a queue must be a positive in...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CircularQueue: """@helpDescription(The capacity, or the maximum length allowed in the queue, is passed in as an integer when the CircularQueue class is initialized.)""" def __init__(self, capacity): """@helpDescription(The value passed in for capacity of a queue must be a positive integer. If the...
the_stack_v2_python_sparse
python/py_queue_class/queue_class.py
cskamil/PcExParser
train
1
8a8847b00bf0ad4a96fbb9c153776356939fcf58
[ "length = len(nums)\nleft, right = (0, length - 1)\nwhile left <= right:\n if nums[left] == val:\n nums[left] = nums[right]\n right -= 1\n else:\n left += 1\nreturn left", "slow = 0\nfor fast in range(len(nums)):\n if nums[fast] != val:\n nums[slow] = nums[fast]\n slow ...
<|body_start_0|> length = len(nums) left, right = (0, length - 1) while left <= right: if nums[left] == val: nums[left] = nums[right] right -= 1 else: left += 1 return left <|end_body_0|> <|body_start_1|> sl...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeElement1(self, nums: List[int], val: int) -> int: """First of all, use two points $left, $right which points to the beginnning and the end. As long as $left <= $right, we keeping doing the followings. If the left num equals the target $val, copy the right num to the l...
stack_v2_sparse_classes_75kplus_train_069243
2,401
no_license
[ { "docstring": "First of all, use two points $left, $right which points to the beginnning and the end. As long as $left <= $right, we keeping doing the followings. If the left num equals the target $val, copy the right num to the left num and decrease $right by one. Otherwise, increase $left by one. In the end,...
2
stack_v2_sparse_classes_30k_train_041901
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeElement1(self, nums: List[int], val: int) -> int: First of all, use two points $left, $right which points to the beginnning and the end. As long as $left <= $right, we ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeElement1(self, nums: List[int], val: int) -> int: First of all, use two points $left, $right which points to the beginnning and the end. As long as $left <= $right, we ...
9bdbe3232faedc5b23caeb0c47baeb0bda9d313d
<|skeleton|> class Solution: def removeElement1(self, nums: List[int], val: int) -> int: """First of all, use two points $left, $right which points to the beginnning and the end. As long as $left <= $right, we keeping doing the followings. If the left num equals the target $val, copy the right num to the l...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def removeElement1(self, nums: List[int], val: int) -> int: """First of all, use two points $left, $right which points to the beginnning and the end. As long as $left <= $right, we keeping doing the followings. If the left num equals the target $val, copy the right num to the left num and de...
the_stack_v2_python_sparse
TwoPointers/27_RemoveElement.py
ideaqiwang/leetcode
train
0
f5f7eacb720d20b1c48c8905d5c4f3f16125de62
[ "def get_list_element(nlis):\n res = []\n for elem in nlis:\n if elem.isInteger():\n res.append(elem.getInteger())\n else:\n res.extend(get_list_element(elem.getList()))\n return res\nself.iterator = get_list_element(nestedList)", "if self.hasNext:\n res = self.iter...
<|body_start_0|> def get_list_element(nlis): res = [] for elem in nlis: if elem.isInteger(): res.append(elem.getInteger()) else: res.extend(get_list_element(elem.getList())) return res self.iterat...
NestedIterator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NestedIterator: def __init__(self, nestedList): """Initialize your data structure here. :type nestedList: List[NestedInteger]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|e...
stack_v2_sparse_classes_75kplus_train_069244
2,774
no_license
[ { "docstring": "Initialize your data structure here. :type nestedList: List[NestedInteger]", "name": "__init__", "signature": "def __init__(self, nestedList)" }, { "docstring": ":rtype: int", "name": "next", "signature": "def next(self)" }, { "docstring": ":rtype: bool", "nam...
3
stack_v2_sparse_classes_30k_train_019154
Implement the Python class `NestedIterator` described below. Class description: Implement the NestedIterator class. Method signatures and docstrings: - def __init__(self, nestedList): Initialize your data structure here. :type nestedList: List[NestedInteger] - def next(self): :rtype: int - def hasNext(self): :rtype: ...
Implement the Python class `NestedIterator` described below. Class description: Implement the NestedIterator class. Method signatures and docstrings: - def __init__(self, nestedList): Initialize your data structure here. :type nestedList: List[NestedInteger] - def next(self): :rtype: int - def hasNext(self): :rtype: ...
ee59b82125f100970c842d5e1245287c484d6649
<|skeleton|> class NestedIterator: def __init__(self, nestedList): """Initialize your data structure here. :type nestedList: List[NestedInteger]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|e...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NestedIterator: def __init__(self, nestedList): """Initialize your data structure here. :type nestedList: List[NestedInteger]""" def get_list_element(nlis): res = [] for elem in nlis: if elem.isInteger(): res.append(elem.getInteger())...
the_stack_v2_python_sparse
_CodeTopics/LeetCode/201-400/000341/000341.py
BIAOXYZ/variousCodes
train
0
a3b5b67bccd916f09f37fb18587f6d9f64adf8da
[ "super().__init__()\nif backbone not in FLEXUNET_BACKBONE.register_dict:\n raise ValueError(f'invalid model_name {backbone} found, must be one of {FLEXUNET_BACKBONE.register_dict.keys()}.')\nif spatial_dims not in (2, 3):\n raise ValueError('spatial_dims can only be 2 or 3.')\nencoder = FLEXUNET_BACKBONE.regi...
<|body_start_0|> super().__init__() if backbone not in FLEXUNET_BACKBONE.register_dict: raise ValueError(f'invalid model_name {backbone} found, must be one of {FLEXUNET_BACKBONE.register_dict.keys()}.') if spatial_dims not in (2, 3): raise ValueError('spatial_dims can onl...
A flexible implementation of UNet-like encoder-decoder architecture.
FlexibleUNet
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FlexibleUNet: """A flexible implementation of UNet-like encoder-decoder architecture.""" def __init__(self, in_channels: int, out_channels: int, backbone: str, pretrained: bool=False, decoder_channels: tuple=(256, 128, 64, 32, 16), spatial_dims: int=2, norm: str | tuple=('batch', {'eps': 0.0...
stack_v2_sparse_classes_75kplus_train_069245
14,147
permissive
[ { "docstring": "A flexible implement of UNet, in which the backbone/encoder can be replaced with any efficient network. Currently the input must have a 2 or 3 spatial dimension and the spatial size of each dimension must be a multiple of 32 if is_pad parameter is False. Please notice each output of backbone mus...
2
stack_v2_sparse_classes_30k_train_007669
Implement the Python class `FlexibleUNet` described below. Class description: A flexible implementation of UNet-like encoder-decoder architecture. Method signatures and docstrings: - def __init__(self, in_channels: int, out_channels: int, backbone: str, pretrained: bool=False, decoder_channels: tuple=(256, 128, 64, 3...
Implement the Python class `FlexibleUNet` described below. Class description: A flexible implementation of UNet-like encoder-decoder architecture. Method signatures and docstrings: - def __init__(self, in_channels: int, out_channels: int, backbone: str, pretrained: bool=False, decoder_channels: tuple=(256, 128, 64, 3...
e48c3e2c741fa3fc705c4425d17ac4a5afac6c47
<|skeleton|> class FlexibleUNet: """A flexible implementation of UNet-like encoder-decoder architecture.""" def __init__(self, in_channels: int, out_channels: int, backbone: str, pretrained: bool=False, decoder_channels: tuple=(256, 128, 64, 32, 16), spatial_dims: int=2, norm: str | tuple=('batch', {'eps': 0.0...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FlexibleUNet: """A flexible implementation of UNet-like encoder-decoder architecture.""" def __init__(self, in_channels: int, out_channels: int, backbone: str, pretrained: bool=False, decoder_channels: tuple=(256, 128, 64, 32, 16), spatial_dims: int=2, norm: str | tuple=('batch', {'eps': 0.001, 'momentum...
the_stack_v2_python_sparse
monai/networks/nets/flexible_unet.py
Project-MONAI/MONAI
train
4,805
af76bd56c70a5114c2653097226efa9b0f2f7067
[ "n = len(stones)\nmemo = [[[-1] * 2 for _ in range(n)] for j in range(n)]\nsm = sum(stones)\n\ndef helper(l, r, ID, left):\n if r < l:\n return 0\n if memo[l][r][ID] != -1:\n return memo[l][r][ID]\n ne = 1 if ID == 0 else 0\n if ID == 1:\n memo[l][r][ID] = max(left - stones[l] + hel...
<|body_start_0|> n = len(stones) memo = [[[-1] * 2 for _ in range(n)] for j in range(n)] sm = sum(stones) def helper(l, r, ID, left): if r < l: return 0 if memo[l][r][ID] != -1: return memo[l][r][ID] ne = 1 if ID == 0 e...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def stoneGameVIITLE(self, stones): """:type stones: List[int] :rtype: int""" <|body_0|> def stoneGameVII(self, stones): """:type stones: List[int] :rtype: int""" <|body_1|> def stoneGameVIIDP(self, stones): """:type stones: List[int] :r...
stack_v2_sparse_classes_75kplus_train_069246
4,232
no_license
[ { "docstring": ":type stones: List[int] :rtype: int", "name": "stoneGameVIITLE", "signature": "def stoneGameVIITLE(self, stones)" }, { "docstring": ":type stones: List[int] :rtype: int", "name": "stoneGameVII", "signature": "def stoneGameVII(self, stones)" }, { "docstring": ":typ...
3
stack_v2_sparse_classes_30k_train_021344
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def stoneGameVIITLE(self, stones): :type stones: List[int] :rtype: int - def stoneGameVII(self, stones): :type stones: List[int] :rtype: int - def stoneGameVIIDP(self, stones): :...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def stoneGameVIITLE(self, stones): :type stones: List[int] :rtype: int - def stoneGameVII(self, stones): :type stones: List[int] :rtype: int - def stoneGameVIIDP(self, stones): :...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def stoneGameVIITLE(self, stones): """:type stones: List[int] :rtype: int""" <|body_0|> def stoneGameVII(self, stones): """:type stones: List[int] :rtype: int""" <|body_1|> def stoneGameVIIDP(self, stones): """:type stones: List[int] :r...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def stoneGameVIITLE(self, stones): """:type stones: List[int] :rtype: int""" n = len(stones) memo = [[[-1] * 2 for _ in range(n)] for j in range(n)] sm = sum(stones) def helper(l, r, ID, left): if r < l: return 0 if mem...
the_stack_v2_python_sparse
S/StoneGameVII.py
bssrdf/pyleet
train
2
33a00c7915633944ff9ad5ca88e58e1f8ef8aa52
[ "driver.get(url)\nloginButton = WebDriverWait(driver, 5, 0.5).until(EC.presence_of_element_located((By.NAME, 'username')))\nloginButton.clear()\nloginButton.send_keys(username)\ndriver.implicitly_wait(1.5)\ndriver.find_element_by_name('password').clear()\ndriver.find_element_by_name('password').send_keys(password)\...
<|body_start_0|> driver.get(url) loginButton = WebDriverWait(driver, 5, 0.5).until(EC.presence_of_element_located((By.NAME, 'username'))) loginButton.clear() loginButton.send_keys(username) driver.implicitly_wait(1.5) driver.find_element_by_name('password').clear() ...
Action
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Action: def loginG(self, driver, username, password, url): """:param driver: webdriver userd :param username: login name required :param password: auth password :param url: login url :return:""" <|body_0|> def logoutG(self, driver): """此时应该用户是登陆状态的 写一个类似与 login_requi...
stack_v2_sparse_classes_75kplus_train_069247
2,363
no_license
[ { "docstring": ":param driver: webdriver userd :param username: login name required :param password: auth password :param url: login url :return:", "name": "loginG", "signature": "def loginG(self, driver, username, password, url)" }, { "docstring": "此时应该用户是登陆状态的 写一个类似与 login_requied() 语法糖 装饰器 :p...
2
stack_v2_sparse_classes_30k_train_034018
Implement the Python class `Action` described below. Class description: Implement the Action class. Method signatures and docstrings: - def loginG(self, driver, username, password, url): :param driver: webdriver userd :param username: login name required :param password: auth password :param url: login url :return: -...
Implement the Python class `Action` described below. Class description: Implement the Action class. Method signatures and docstrings: - def loginG(self, driver, username, password, url): :param driver: webdriver userd :param username: login name required :param password: auth password :param url: login url :return: -...
508d9c5949588e66802cc06377d43be8fdc3e35d
<|skeleton|> class Action: def loginG(self, driver, username, password, url): """:param driver: webdriver userd :param username: login name required :param password: auth password :param url: login url :return:""" <|body_0|> def logoutG(self, driver): """此时应该用户是登陆状态的 写一个类似与 login_requi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Action: def loginG(self, driver, username, password, url): """:param driver: webdriver userd :param username: login name required :param password: auth password :param url: login url :return:""" driver.get(url) loginButton = WebDriverWait(driver, 5, 0.5).until(EC.presence_of_element_lo...
the_stack_v2_python_sparse
EmpireCMS/Moduledriver/parameterizationG.py
Onebigbera/CrawlerTest
train
1
6713abb09de37e0f79ed7dc0233161525f0f5698
[ "try:\n data = PolicyManager.get_object_assignments(user_id=user_id, policy_id=uuid, object_id=perimeter_id, category_id=category_id)\nexcept Exception as e:\n LOG.error(e, exc_info=True)\n return ({'result': False, 'error': str(e)}, 500)\nreturn {'object_assignments': data}", "try:\n data_id = reques...
<|body_start_0|> try: data = PolicyManager.get_object_assignments(user_id=user_id, policy_id=uuid, object_id=perimeter_id, category_id=category_id) except Exception as e: LOG.error(e, exc_info=True) return ({'result': False, 'error': str(e)}, 500) return {'obj...
Endpoint for object assignment requests
ObjectAssignments
[ "Apache-2.0", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObjectAssignments: """Endpoint for object assignment requests""" def get(self, uuid=None, perimeter_id=None, category_id=None, data_id=None, user_id=None): """Retrieve all object assignment or a specific one for a given policy :param uuid: uuid of the policy :param perimeter_id: uuid...
stack_v2_sparse_classes_75kplus_train_069248
14,093
permissive
[ { "docstring": "Retrieve all object assignment or a specific one for a given policy :param uuid: uuid of the policy :param perimeter_id: uuid of the object :param category_id: uuid of the object category :param data_id: uuid of the object scope :param user_id: user ID who do the request :return: { \"object_data...
3
stack_v2_sparse_classes_30k_train_002299
Implement the Python class `ObjectAssignments` described below. Class description: Endpoint for object assignment requests Method signatures and docstrings: - def get(self, uuid=None, perimeter_id=None, category_id=None, data_id=None, user_id=None): Retrieve all object assignment or a specific one for a given policy ...
Implement the Python class `ObjectAssignments` described below. Class description: Endpoint for object assignment requests Method signatures and docstrings: - def get(self, uuid=None, perimeter_id=None, category_id=None, data_id=None, user_id=None): Retrieve all object assignment or a specific one for a given policy ...
daaba34fa2ed4426bc0fde359e54a5e1b872208c
<|skeleton|> class ObjectAssignments: """Endpoint for object assignment requests""" def get(self, uuid=None, perimeter_id=None, category_id=None, data_id=None, user_id=None): """Retrieve all object assignment or a specific one for a given policy :param uuid: uuid of the policy :param perimeter_id: uuid...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ObjectAssignments: """Endpoint for object assignment requests""" def get(self, uuid=None, perimeter_id=None, category_id=None, data_id=None, user_id=None): """Retrieve all object assignment or a specific one for a given policy :param uuid: uuid of the policy :param perimeter_id: uuid of the objec...
the_stack_v2_python_sparse
moonv4/moon_manager/moon_manager/api/assignments.py
hashnfv/hashnfv-moon
train
0
8c144b11d41557879fbd37e0a970bdbb166ef3bd
[ "super().__init__(dataset_reader, data_iterator, evaluation_command, model, batch_size)\nself.k = k\nself.threads = threads\nself.give_up = give_up\nif give_up_k_1 is None:\n self.give_up_k_1 = give_up\nelse:\n self.give_up_k_1 = give_up_k_1", "assert self.model, 'model must be given, either to the construc...
<|body_start_0|> super().__init__(dataset_reader, data_iterator, evaluation_command, model, batch_size) self.k = k self.threads = threads self.give_up = give_up if give_up_k_1 is None: self.give_up_k_1 = give_up else: self.give_up_k_1 = give_up_k_1...
Predictor that calls the fixed-tree decoder.
AMconllPredictor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AMconllPredictor: """Predictor that calls the fixed-tree decoder.""" def __init__(self, dataset_reader: DatasetReader, k: int, give_up: float, threads: int=4, data_iterator: DataIterator=None, evaluation_command: BaseEvaluationCommand=None, model: Model=None, batch_size: int=64, give_up_k_1:...
stack_v2_sparse_classes_75kplus_train_069249
11,088
permissive
[ { "docstring": "Creates a predictor from an AMConllDatasetReader, optionally takes an AllenNLP model. The model can also be given later using set_model. If evaluation is required, en evaluation_command can be supplied as well. :param dataset_reader: an AMConllDatasetReader :param k: number of supertags to be us...
2
null
Implement the Python class `AMconllPredictor` described below. Class description: Predictor that calls the fixed-tree decoder. Method signatures and docstrings: - def __init__(self, dataset_reader: DatasetReader, k: int, give_up: float, threads: int=4, data_iterator: DataIterator=None, evaluation_command: BaseEvaluat...
Implement the Python class `AMconllPredictor` described below. Class description: Predictor that calls the fixed-tree decoder. Method signatures and docstrings: - def __init__(self, dataset_reader: DatasetReader, k: int, give_up: float, threads: int=4, data_iterator: DataIterator=None, evaluation_command: BaseEvaluat...
81432b9e3c165f8c0efb84a23e5a0d0493717e63
<|skeleton|> class AMconllPredictor: """Predictor that calls the fixed-tree decoder.""" def __init__(self, dataset_reader: DatasetReader, k: int, give_up: float, threads: int=4, data_iterator: DataIterator=None, evaluation_command: BaseEvaluationCommand=None, model: Model=None, batch_size: int=64, give_up_k_1:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AMconllPredictor: """Predictor that calls the fixed-tree decoder.""" def __init__(self, dataset_reader: DatasetReader, k: int, give_up: float, threads: int=4, data_iterator: DataIterator=None, evaluation_command: BaseEvaluationCommand=None, model: Model=None, batch_size: int=64, give_up_k_1: float=None):...
the_stack_v2_python_sparse
graph_dependency_parser/components/evaluation/predictors.py
coli-saar/am-parser
train
30
131ff3d947bda5c81fa027b6f071c80c28d235e3
[ "test_env = {'OAUTH_CLIENT_ID': 'id', 'OAUTH_CLIENT_SECRET': 'shhh', 'FOUNDATION': 'foundation', 'CC_URL': 'e/f/g/h'}\nwith patch.dict(os.environ, test_env) as mock_env:\n param = parameters.SysParams()\nself.assertEqual(param, test_env)", "make_missing = 'FOUNDATION'\ntest_env = {'OAUTH_CLIENT_ID': 'id', 'OAU...
<|body_start_0|> test_env = {'OAUTH_CLIENT_ID': 'id', 'OAUTH_CLIENT_SECRET': 'shhh', 'FOUNDATION': 'foundation', 'CC_URL': 'e/f/g/h'} with patch.dict(os.environ, test_env) as mock_env: param = parameters.SysParams() self.assertEqual(param, test_env) <|end_body_0|> <|body_start_1|> ...
Test basic operation of the class.
TestParams
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestParams: """Test basic operation of the class.""" def testParamOK(self): """Test the Sysparams object 'happy' path""" <|body_0|> def testParamMissing(self): """Test the Sysparams object 'sad' path""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_069250
1,332
no_license
[ { "docstring": "Test the Sysparams object 'happy' path", "name": "testParamOK", "signature": "def testParamOK(self)" }, { "docstring": "Test the Sysparams object 'sad' path", "name": "testParamMissing", "signature": "def testParamMissing(self)" } ]
2
null
Implement the Python class `TestParams` described below. Class description: Test basic operation of the class. Method signatures and docstrings: - def testParamOK(self): Test the Sysparams object 'happy' path - def testParamMissing(self): Test the Sysparams object 'sad' path
Implement the Python class `TestParams` described below. Class description: Test basic operation of the class. Method signatures and docstrings: - def testParamOK(self): Test the Sysparams object 'happy' path - def testParamMissing(self): Test the Sysparams object 'sad' path <|skeleton|> class TestParams: """Tes...
3173fd1f4e4a54a286ced2734ca30b1d9a918206
<|skeleton|> class TestParams: """Test basic operation of the class.""" def testParamOK(self): """Test the Sysparams object 'happy' path""" <|body_0|> def testParamMissing(self): """Test the Sysparams object 'sad' path""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestParams: """Test basic operation of the class.""" def testParamOK(self): """Test the Sysparams object 'happy' path""" test_env = {'OAUTH_CLIENT_ID': 'id', 'OAUTH_CLIENT_SECRET': 'shhh', 'FOUNDATION': 'foundation', 'CC_URL': 'e/f/g/h'} with patch.dict(os.environ, test_env) as mo...
the_stack_v2_python_sparse
unit_tests/test_parameters.py
halm90/cf-diff
train
0
454383a4bfdd6c9891e8f6068757f54657e817cf
[ "self.facility = self.request.user.profile.instrument.facility\nself.instrument = self.request.user.profile.instrument\nself.catalog = Catalog(facility=self.facility.name, technique=self.instrument.technique, instrument=self.instrument.catalog_name, request=self.request)\nreturn super(CatalogMixin, self).dispatch(r...
<|body_start_0|> self.facility = self.request.user.profile.instrument.facility self.instrument = self.request.user.profile.instrument self.catalog = Catalog(facility=self.facility.name, technique=self.instrument.technique, instrument=self.instrument.catalog_name, request=self.request) re...
Context enhancer for the Catalog
CatalogMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CatalogMixin: """Context enhancer for the Catalog""" def dispatch(self, request, *args, **kwargs): """First method being called Usefull for debug and set member variables""" <|body_0|> def get_template_names(self): """Let's override this function. Returns a list ...
stack_v2_sparse_classes_75kplus_train_069251
9,842
no_license
[ { "docstring": "First method being called Usefull for debug and set member variables", "name": "dispatch", "signature": "def dispatch(self, request, *args, **kwargs)" }, { "docstring": "Let's override this function. Returns a list of priority templates to render. From specific to general. facili...
2
stack_v2_sparse_classes_30k_train_015674
Implement the Python class `CatalogMixin` described below. Class description: Context enhancer for the Catalog Method signatures and docstrings: - def dispatch(self, request, *args, **kwargs): First method being called Usefull for debug and set member variables - def get_template_names(self): Let's override this func...
Implement the Python class `CatalogMixin` described below. Class description: Context enhancer for the Catalog Method signatures and docstrings: - def dispatch(self, request, *args, **kwargs): First method being called Usefull for debug and set member variables - def get_template_names(self): Let's override this func...
507ff81617abf583edd4ef4858985daefc0afcbe
<|skeleton|> class CatalogMixin: """Context enhancer for the Catalog""" def dispatch(self, request, *args, **kwargs): """First method being called Usefull for debug and set member variables""" <|body_0|> def get_template_names(self): """Let's override this function. Returns a list ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CatalogMixin: """Context enhancer for the Catalog""" def dispatch(self, request, *args, **kwargs): """First method being called Usefull for debug and set member variables""" self.facility = self.request.user.profile.instrument.facility self.instrument = self.request.user.profile.i...
the_stack_v2_python_sparse
src/server/apps/catalog/views.py
bidochon/WebReduction
train
0
004619dceb3e980ce9c1bd74ce32051d3cbd1c83
[ "suff_words = {}\nfor w in words:\n n = len(w)\n for i in range(n - 1):\n tmp_w = w[n - i - 1:]\n if tmp_w not in suff_words:\n suff_words[tmp_w] = False\n suff_words[w] = True\nself.words = suff_words\nself.len = max((len(w) for w in words))\nself.queries = ''", "self.queries +=...
<|body_start_0|> suff_words = {} for w in words: n = len(w) for i in range(n - 1): tmp_w = w[n - i - 1:] if tmp_w not in suff_words: suff_words[tmp_w] = False suff_words[w] = True self.words = suff_words ...
StreamChecker
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StreamChecker: def __init__(self, words): """:type words: List[str]""" <|body_0|> def query(self, letter): """:type letter: str :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> suff_words = {} for w in words: n = len(...
stack_v2_sparse_classes_75kplus_train_069252
1,467
no_license
[ { "docstring": ":type words: List[str]", "name": "__init__", "signature": "def __init__(self, words)" }, { "docstring": ":type letter: str :rtype: bool", "name": "query", "signature": "def query(self, letter)" } ]
2
null
Implement the Python class `StreamChecker` described below. Class description: Implement the StreamChecker class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def query(self, letter): :type letter: str :rtype: bool
Implement the Python class `StreamChecker` described below. Class description: Implement the StreamChecker class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def query(self, letter): :type letter: str :rtype: bool <|skeleton|> class StreamChecker: def __init__(self, w...
80e44f4e9d3a5b592fdebe0bf16d1df54e99991e
<|skeleton|> class StreamChecker: def __init__(self, words): """:type words: List[str]""" <|body_0|> def query(self, letter): """:type letter: str :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StreamChecker: def __init__(self, words): """:type words: List[str]""" suff_words = {} for w in words: n = len(w) for i in range(n - 1): tmp_w = w[n - i - 1:] if tmp_w not in suff_words: suff_words[tmp_w] = Fal...
the_stack_v2_python_sparse
Python/1032 - Stream of Characters/1032_stream-of-characters.py
aptend/leetcode-rua
train
2
146659f63d3690b47d02d12ff2d70764a4026972
[ "self.num_ends = {}\nself.milestones = []\nif A:\n size = 0\n for i in xrange(0, len(A), 2):\n if A[i] > 0:\n size += A[i]\n self.num_ends[size] = A[i + 1]\n self.milestones.append(size)\nself.start = 0\nself.milestone = 0", "self.start += n\nif self.start > self.mile...
<|body_start_0|> self.num_ends = {} self.milestones = [] if A: size = 0 for i in xrange(0, len(A), 2): if A[i] > 0: size += A[i] self.num_ends[size] = A[i + 1] self.milestones.append(size) ...
RLEIterator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RLEIterator: def __init__(self, A): """:type A: List[int]""" <|body_0|> def next(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.num_ends = {} self.milestones = [] if A: size = 0...
stack_v2_sparse_classes_75kplus_train_069253
997
no_license
[ { "docstring": ":type A: List[int]", "name": "__init__", "signature": "def __init__(self, A)" }, { "docstring": ":type n: int :rtype: int", "name": "next", "signature": "def next(self, n)" } ]
2
stack_v2_sparse_classes_30k_train_033804
Implement the Python class `RLEIterator` described below. Class description: Implement the RLEIterator class. Method signatures and docstrings: - def __init__(self, A): :type A: List[int] - def next(self, n): :type n: int :rtype: int
Implement the Python class `RLEIterator` described below. Class description: Implement the RLEIterator class. Method signatures and docstrings: - def __init__(self, A): :type A: List[int] - def next(self, n): :type n: int :rtype: int <|skeleton|> class RLEIterator: def __init__(self, A): """:type A: Lis...
ea10ce7fe465431399e444c6ecb0b7560b17e1e4
<|skeleton|> class RLEIterator: def __init__(self, A): """:type A: List[int]""" <|body_0|> def next(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RLEIterator: def __init__(self, A): """:type A: List[int]""" self.num_ends = {} self.milestones = [] if A: size = 0 for i in xrange(0, len(A), 2): if A[i] > 0: size += A[i] self.num_ends[size] = A[i...
the_stack_v2_python_sparse
leetcode_python2/lc900_RLE_iterator.py
garderobin/Leetcode
train
0
a71517ecc347a27c1a1f3f922084e1fa913fab41
[ "global dic\ndic = {}\n\ndef find(s, i, j):\n \"\"\"\n :type s: str\n :type i: int\n :rtype: str\n \"\"\"\n if j == len(s) - 1:\n dic[len(s[i:j + 1])] = s[i:j + 1]\n return\n if i == 0 and i != j:\n dic[len(s[i:j + 1])] = s[i:j + 1]\n ...
<|body_start_0|> global dic dic = {} def find(s, i, j): """ :type s: str :type i: int :rtype: str """ if j == len(s) - 1: dic[len(s[i:j + 1])] = s[i:j + 1] ret...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestPalindrome1(self, s): """Method_one : Dynamic Programming :type s: str :rtype: str""" <|body_0|> def longestPalindrome2(self, s): """Method_two : Expand Around Center :type s: str :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_75kplus_train_069254
1,656
no_license
[ { "docstring": "Method_one : Dynamic Programming :type s: str :rtype: str", "name": "longestPalindrome1", "signature": "def longestPalindrome1(self, s)" }, { "docstring": "Method_two : Expand Around Center :type s: str :rtype: str", "name": "longestPalindrome2", "signature": "def longest...
2
stack_v2_sparse_classes_30k_val_002392
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome1(self, s): Method_one : Dynamic Programming :type s: str :rtype: str - def longestPalindrome2(self, s): Method_two : Expand Around Center :type s: str :rtyp...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome1(self, s): Method_one : Dynamic Programming :type s: str :rtype: str - def longestPalindrome2(self, s): Method_two : Expand Around Center :type s: str :rtyp...
030f2d48d20341a16f6ca57715ff1f06a59a20ec
<|skeleton|> class Solution: def longestPalindrome1(self, s): """Method_one : Dynamic Programming :type s: str :rtype: str""" <|body_0|> def longestPalindrome2(self, s): """Method_two : Expand Around Center :type s: str :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def longestPalindrome1(self, s): """Method_one : Dynamic Programming :type s: str :rtype: str""" global dic dic = {} def find(s, i, j): """ :type s: str :type i: int :rtype: str ...
the_stack_v2_python_sparse
Code/Longest Palindromic Substring.py
zolars/LeetCode-Solution
train
0
78431501d605fdfece6777ab9f0739692c418e01
[ "self.content = ''\nself.fd = None\nself.ctype = ''\nfilename = ''\nif file[0] == '/':\n filename = file[1:]\nelse:\n filename = file\ntry:\n resource = managers.resource_manager.get_resource(application_id, filename)\n if not resource:\n raise VDOM_exception('Resource not found')\n self.fd = ...
<|body_start_0|> self.content = '' self.fd = None self.ctype = '' filename = '' if file[0] == '/': filename = file[1:] else: filename = file try: resource = managers.resource_manager.get_resource(application_id, filename) ...
resource module class
VDOM_module_resource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VDOM_module_resource: """resource module class""" def getfile(self, application_id, file): """read file""" <|body_0|> def run(self, request_object, request_type): """process request""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.content = ...
stack_v2_sparse_classes_75kplus_train_069255
2,571
no_license
[ { "docstring": "read file", "name": "getfile", "signature": "def getfile(self, application_id, file)" }, { "docstring": "process request", "name": "run", "signature": "def run(self, request_object, request_type)" } ]
2
null
Implement the Python class `VDOM_module_resource` described below. Class description: resource module class Method signatures and docstrings: - def getfile(self, application_id, file): read file - def run(self, request_object, request_type): process request
Implement the Python class `VDOM_module_resource` described below. Class description: resource module class Method signatures and docstrings: - def getfile(self, application_id, file): read file - def run(self, request_object, request_type): process request <|skeleton|> class VDOM_module_resource: """resource mo...
cb9932f5f75d5c6d7889f26d58aee079b4127299
<|skeleton|> class VDOM_module_resource: """resource module class""" def getfile(self, application_id, file): """read file""" <|body_0|> def run(self, request_object, request_type): """process request""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VDOM_module_resource: """resource module class""" def getfile(self, application_id, file): """read file""" self.content = '' self.fd = None self.ctype = '' filename = '' if file[0] == '/': filename = file[1:] else: filename =...
the_stack_v2_python_sparse
sources/module/resource.py
VDOMBoxGroup/runtime2.0
train
0
129442ef12a0a44da273b12d30c2ccfa8ec40681
[ "with warnings.catch_warnings():\n warnings.simplefilter('ignore')\n resolver_options = {'place': {'allow_unknown_locations': True}}\n self.geotagger = get_resolver(options=resolver_options)\n self.geotagger.load_locations()\n self.location_resolver = LocationEncoder()\nsuper().__init__(*args, **kwar...
<|body_start_0|> with warnings.catch_warnings(): warnings.simplefilter('ignore') resolver_options = {'place': {'allow_unknown_locations': True}} self.geotagger = get_resolver(options=resolver_options) self.geotagger.load_locations() self.location_resol...
Class that will attempt to geotag a tweet.
GeoCoding
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GeoCoding: """Class that will attempt to geotag a tweet.""" def __init__(self, *args, **kwargs) -> None: """Setup Carmen geotagging options, then init super.""" <|body_0|> def process_tweet(self, tweet_json: Dict[str, Any]) -> Dict[str, Any]: """Attempt to geotag...
stack_v2_sparse_classes_75kplus_train_069256
3,134
permissive
[ { "docstring": "Setup Carmen geotagging options, then init super.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs) -> None" }, { "docstring": "Attempt to geotag the tweet data. Returns the tweet with new data if any was resolved and will set geotagged according to success ...
2
stack_v2_sparse_classes_30k_train_047416
Implement the Python class `GeoCoding` described below. Class description: Class that will attempt to geotag a tweet. Method signatures and docstrings: - def __init__(self, *args, **kwargs) -> None: Setup Carmen geotagging options, then init super. - def process_tweet(self, tweet_json: Dict[str, Any]) -> Dict[str, An...
Implement the Python class `GeoCoding` described below. Class description: Class that will attempt to geotag a tweet. Method signatures and docstrings: - def __init__(self, *args, **kwargs) -> None: Setup Carmen geotagging options, then init super. - def process_tweet(self, tweet_json: Dict[str, Any]) -> Dict[str, An...
8aec35117f943dc4579db4a448ef0bea013b3f5b
<|skeleton|> class GeoCoding: """Class that will attempt to geotag a tweet.""" def __init__(self, *args, **kwargs) -> None: """Setup Carmen geotagging options, then init super.""" <|body_0|> def process_tweet(self, tweet_json: Dict[str, Any]) -> Dict[str, Any]: """Attempt to geotag...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GeoCoding: """Class that will attempt to geotag a tweet.""" def __init__(self, *args, **kwargs) -> None: """Setup Carmen geotagging options, then init super.""" with warnings.catch_warnings(): warnings.simplefilter('ignore') resolver_options = {'place': {'allow_unk...
the_stack_v2_python_sparse
containers/ingress/ingress/data_processing/geocode.py
martsa1/twitterELK
train
0
f63f790b42b9446ca7ab69bef9b3481725721a79
[ "ip = self.get_argument('ip')\nresponse = (yield self.get_ip_info(ip))\nif response['code'] == 0:\n self.write(response)\nelse:\n self.write('查询ip地址失败!')\nself.finish()", "http = tornado.httpclient.AsyncHTTPClient()\nresponse = (yield http.fetch(request='http://ip.taobao.com/service/getIpInfo.php?ip={}'.for...
<|body_start_0|> ip = self.get_argument('ip') response = (yield self.get_ip_info(ip)) if response['code'] == 0: self.write(response) else: self.write('查询ip地址失败!') self.finish() <|end_body_0|> <|body_start_1|> http = tornado.httpclient.AsyncHTTPCli...
首页handler类
IndexHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IndexHandler: """首页handler类""" def get(self): """异步请求客户端""" <|body_0|> def get_ip_info(self, ip): """将异步web请求单独出来""" <|body_1|> <|end_skeleton|> <|body_start_0|> ip = self.get_argument('ip') response = (yield self.get_ip_info(ip)) ...
stack_v2_sparse_classes_75kplus_train_069257
2,195
no_license
[ { "docstring": "异步请求客户端", "name": "get", "signature": "def get(self)" }, { "docstring": "将异步web请求单独出来", "name": "get_ip_info", "signature": "def get_ip_info(self, ip)" } ]
2
stack_v2_sparse_classes_30k_train_008745
Implement the Python class `IndexHandler` described below. Class description: 首页handler类 Method signatures and docstrings: - def get(self): 异步请求客户端 - def get_ip_info(self, ip): 将异步web请求单独出来
Implement the Python class `IndexHandler` described below. Class description: 首页handler类 Method signatures and docstrings: - def get(self): 异步请求客户端 - def get_ip_info(self, ip): 将异步web请求单独出来 <|skeleton|> class IndexHandler: """首页handler类""" def get(self): """异步请求客户端""" <|body_0|> def get...
34021339fea059ef1ba1d562cf091f3f07aeedc9
<|skeleton|> class IndexHandler: """首页handler类""" def get(self): """异步请求客户端""" <|body_0|> def get_ip_info(self, ip): """将异步web请求单独出来""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IndexHandler: """首页handler类""" def get(self): """异步请求客户端""" ip = self.get_argument('ip') response = (yield self.get_ip_info(ip)) if response['code'] == 0: self.write(response) else: self.write('查询ip地址失败!') self.finish() def get_...
the_stack_v2_python_sparse
4_异步与Websocket/06_tornado协程异步.py
Sbwillbealier/tornado_study
train
0
7f81a579aabf2d2fd369b88fd0cdd0bd864d5a34
[ "self.data_dict: typing.Dict[str, DataStruct] = {}\nself.index_dict: typing.Dict[str, int] = {}\nself.datetime: typing.Union[str, datetime] = None\n_symbol_dict.clear()\nfor k, v in _register_dict.items():\n symbol = _fetcher.fetchSymbol(_tradingday, **v.toKwargs())\n if symbol is None:\n continue\n ...
<|body_start_0|> self.data_dict: typing.Dict[str, DataStruct] = {} self.index_dict: typing.Dict[str, int] = {} self.datetime: typing.Union[str, datetime] = None _symbol_dict.clear() for k, v in _register_dict.items(): symbol = _fetcher.fetchSymbol(_tradingday, **v.toK...
JUST FOR BACKTEST !!!
DataGenerator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataGenerator: """JUST FOR BACKTEST !!!""" def __init__(self, _tradingday: str, _register_dict: typing.Dict[str, RegisterAbstract], _symbol_dict: typing.Dict[str, typing.Set[str]], _fetcher: FetchAbstract): """fetch data according to market registers, and pop tick data by happentime ...
stack_v2_sparse_classes_75kplus_train_069258
5,578
permissive
[ { "docstring": "fetch data according to market registers, and pop tick data by happentime :param _tradingday: the day to fetch :param _register_dict: :param _symbol_dict:", "name": "__init__", "signature": "def __init__(self, _tradingday: str, _register_dict: typing.Dict[str, RegisterAbstract], _symbol_...
2
null
Implement the Python class `DataGenerator` described below. Class description: JUST FOR BACKTEST !!! Method signatures and docstrings: - def __init__(self, _tradingday: str, _register_dict: typing.Dict[str, RegisterAbstract], _symbol_dict: typing.Dict[str, typing.Set[str]], _fetcher: FetchAbstract): fetch data accord...
Implement the Python class `DataGenerator` described below. Class description: JUST FOR BACKTEST !!! Method signatures and docstrings: - def __init__(self, _tradingday: str, _register_dict: typing.Dict[str, RegisterAbstract], _symbol_dict: typing.Dict[str, typing.Set[str]], _fetcher: FetchAbstract): fetch data accord...
2c4024e60b14bf630fd141ccd4c77f197b7c901a
<|skeleton|> class DataGenerator: """JUST FOR BACKTEST !!!""" def __init__(self, _tradingday: str, _register_dict: typing.Dict[str, RegisterAbstract], _symbol_dict: typing.Dict[str, typing.Set[str]], _fetcher: FetchAbstract): """fetch data according to market registers, and pop tick data by happentime ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DataGenerator: """JUST FOR BACKTEST !!!""" def __init__(self, _tradingday: str, _register_dict: typing.Dict[str, RegisterAbstract], _symbol_dict: typing.Dict[str, typing.Set[str]], _fetcher: FetchAbstract): """fetch data according to market registers, and pop tick data by happentime :param _tradi...
the_stack_v2_python_sparse
ParadoxTrading/EngineExt/BacktestMarketSupply.py
ppaanngggg/ParadoxTrading
train
96
4eeb5f3a039348c101787a022a52a2da53770be0
[ "super(AuViSubNet, self).__init__()\nself.rnn = nn.LSTM(in_size, hidden_size, num_layers=num_layers, dropout=dropout, bidirectional=bidirectional, batch_first=True)\nself.dropout = nn.Dropout(dropout)\nself.linear_1 = nn.Linear(hidden_size, out_size)", "_, final_states = self.rnn(x)\nh = self.dropout(final_states...
<|body_start_0|> super(AuViSubNet, self).__init__() self.rnn = nn.LSTM(in_size, hidden_size, num_layers=num_layers, dropout=dropout, bidirectional=bidirectional, batch_first=True) self.dropout = nn.Dropout(dropout) self.linear_1 = nn.Linear(hidden_size, out_size) <|end_body_0|> <|body_s...
AuViSubNet
[ "GPL-1.0-or-later", "Apache-2.0", "BSD-2-Clause", "MIT", "BSD-3-Clause", "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuViSubNet: def __init__(self, in_size, hidden_size, out_size, num_layers=1, dropout=0.2, bidirectional=False): """Args: in_size: input dimension hidden_size: hidden layer dimension num_layers: specify the number of layers of LSTMs. dropout: dropout probability bidirectional: specify usa...
stack_v2_sparse_classes_75kplus_train_069259
7,016
permissive
[ { "docstring": "Args: in_size: input dimension hidden_size: hidden layer dimension num_layers: specify the number of layers of LSTMs. dropout: dropout probability bidirectional: specify usage of bidirectional LSTM Output: (return value in forward) a tensor of shape (batch_size, out_size)", "name": "__init__...
2
stack_v2_sparse_classes_30k_train_036335
Implement the Python class `AuViSubNet` described below. Class description: Implement the AuViSubNet class. Method signatures and docstrings: - def __init__(self, in_size, hidden_size, out_size, num_layers=1, dropout=0.2, bidirectional=False): Args: in_size: input dimension hidden_size: hidden layer dimension num_lay...
Implement the Python class `AuViSubNet` described below. Class description: Implement the AuViSubNet class. Method signatures and docstrings: - def __init__(self, in_size, hidden_size, out_size, num_layers=1, dropout=0.2, bidirectional=False): Args: in_size: input dimension hidden_size: hidden layer dimension num_lay...
92acc188d3a0f634de58463b6676e70df83ef808
<|skeleton|> class AuViSubNet: def __init__(self, in_size, hidden_size, out_size, num_layers=1, dropout=0.2, bidirectional=False): """Args: in_size: input dimension hidden_size: hidden layer dimension num_layers: specify the number of layers of LSTMs. dropout: dropout probability bidirectional: specify usa...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AuViSubNet: def __init__(self, in_size, hidden_size, out_size, num_layers=1, dropout=0.2, bidirectional=False): """Args: in_size: input dimension hidden_size: hidden layer dimension num_layers: specify the number of layers of LSTMs. dropout: dropout probability bidirectional: specify usage of bidirect...
the_stack_v2_python_sparse
PyTorch/contrib/others/MMSA_ID2979_for_PyTorch/models/multiTask/SELF_MM.py
Ascend/ModelZoo-PyTorch
train
23
cdfcf00a2b59490e729b8733ff4471a0ea73d610
[ "super().__init__()\nself.n_target_frames = n_target_frames\nself.loss_type = loss_type\nself.loss = None\nif loss_type == 'l1':\n self.loss = nn.L1Loss()\nelif loss_type == 'l2':\n self.loss = nn.MSELoss()\nelif loss_type == 'tversky':\n self.loss = cross_entropy_tversky_weighted_loss\nelse:\n raise Va...
<|body_start_0|> super().__init__() self.n_target_frames = n_target_frames self.loss_type = loss_type self.loss = None if loss_type == 'l1': self.loss = nn.L1Loss() elif loss_type == 'l2': self.loss = nn.MSELoss() elif loss_type == 'tversky...
AutoregressiveCriterion
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AutoregressiveCriterion: def __init__(self, n_target_frames: int=1, loss_type: str='tversky'): """Multi frames loss which backpropagate loss error through time""" <|body_0|> def forward(self, inputs, targets): """inputs shape is (B, T, C, H, W) where C is 23 targets ...
stack_v2_sparse_classes_75kplus_train_069260
5,809
permissive
[ { "docstring": "Multi frames loss which backpropagate loss error through time", "name": "__init__", "signature": "def __init__(self, n_target_frames: int=1, loss_type: str='tversky')" }, { "docstring": "inputs shape is (B, T, C, H, W) where C is 23 targets shape is (B, T, C, H, W) where C is 1",...
2
stack_v2_sparse_classes_30k_train_015644
Implement the Python class `AutoregressiveCriterion` described below. Class description: Implement the AutoregressiveCriterion class. Method signatures and docstrings: - def __init__(self, n_target_frames: int=1, loss_type: str='tversky'): Multi frames loss which backpropagate loss error through time - def forward(se...
Implement the Python class `AutoregressiveCriterion` described below. Class description: Implement the AutoregressiveCriterion class. Method signatures and docstrings: - def __init__(self, n_target_frames: int=1, loss_type: str='tversky'): Multi frames loss which backpropagate loss error through time - def forward(se...
37a273ff393e4f43c38c7fff9271218efe1d3bd1
<|skeleton|> class AutoregressiveCriterion: def __init__(self, n_target_frames: int=1, loss_type: str='tversky'): """Multi frames loss which backpropagate loss error through time""" <|body_0|> def forward(self, inputs, targets): """inputs shape is (B, T, C, H, W) where C is 23 targets ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AutoregressiveCriterion: def __init__(self, n_target_frames: int=1, loss_type: str='tversky'): """Multi frames loss which backpropagate loss error through time""" super().__init__() self.n_target_frames = n_target_frames self.loss_type = loss_type self.loss = None ...
the_stack_v2_python_sparse
PMoE/trainer/loss.py
iasbs-isg/PMoE
train
0
b1fe5806dc28bd18b47f1798b1f4e4e8b3bf12e1
[ "if not history:\n return\nhistory = self._history_dt_fmt(dt=history)\nvalid_dates = history_dates.value[asset_type]\nif history not in valid_dates:\n known = '\\n ' + '\\n '.join(list(valid_dates))\n expl = 'known history dates'\n err = f'Unknown history date {history!r}'\n msg = f'{err}, {expl}: ...
<|body_start_0|> if not history: return history = self._history_dt_fmt(dt=history) valid_dates = history_dates.value[asset_type] if history not in valid_dates: known = '\n ' + '\n '.join(list(valid_dates)) expl = 'known history dates' err...
Pass.
AssetMixins
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AssetMixins: """Pass.""" def set_history(self, history: Union[str, datetime.timedelta, datetime.datetime], history_dates: DictValue, asset_type: str) -> str: """Pass.""" <|body_0|> def _history_dt_fmt(dt: Union[str, datetime.timedelta, datetime.datetime], tmpl: str='%Y-%...
stack_v2_sparse_classes_75kplus_train_069261
16,427
permissive
[ { "docstring": "Pass.", "name": "set_history", "signature": "def set_history(self, history: Union[str, datetime.timedelta, datetime.datetime], history_dates: DictValue, asset_type: str) -> str" }, { "docstring": "Parse a string into the format used by the REST API. Args: dt: date time to parse u...
2
stack_v2_sparse_classes_30k_train_003728
Implement the Python class `AssetMixins` described below. Class description: Pass. Method signatures and docstrings: - def set_history(self, history: Union[str, datetime.timedelta, datetime.datetime], history_dates: DictValue, asset_type: str) -> str: Pass. - def _history_dt_fmt(dt: Union[str, datetime.timedelta, dat...
Implement the Python class `AssetMixins` described below. Class description: Pass. Method signatures and docstrings: - def set_history(self, history: Union[str, datetime.timedelta, datetime.datetime], history_dates: DictValue, asset_type: str) -> str: Pass. - def _history_dt_fmt(dt: Union[str, datetime.timedelta, dat...
8321788df279ffb7794f179a4bd8943fe1ac44c4
<|skeleton|> class AssetMixins: """Pass.""" def set_history(self, history: Union[str, datetime.timedelta, datetime.datetime], history_dates: DictValue, asset_type: str) -> str: """Pass.""" <|body_0|> def _history_dt_fmt(dt: Union[str, datetime.timedelta, datetime.datetime], tmpl: str='%Y-%...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AssetMixins: """Pass.""" def set_history(self, history: Union[str, datetime.timedelta, datetime.datetime], history_dates: DictValue, asset_type: str) -> str: """Pass.""" if not history: return history = self._history_dt_fmt(dt=history) valid_dates = history_dat...
the_stack_v2_python_sparse
axonius_api_client/api/json_api/assets.py
zahediss/axonius_api_client
train
0
f08127dd5fe1ced51a5c5633d8edf332e04ec7f1
[ "query = \"SELECT {1} FROM {0} WHERE {1} = '{2}'\".format(table, value, item)\ndata = QuestionerDB.fetch_one(query)\nif data:\n return (jsonify({'status': 409, 'error': '{} already exists'.format(item)}), 409)\nelse:\n return False", "query = 'SELECT username FROM {0} WHERE meetup_id = {1}'.format(table, me...
<|body_start_0|> query = "SELECT {1} FROM {0} WHERE {1} = '{2}'".format(table, value, item) data = QuestionerDB.fetch_one(query) if data: return (jsonify({'status': 409, 'error': '{} already exists'.format(item)}), 409) else: return False <|end_body_0|> <|body_st...
This class contains validation methods
Validations
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Validations: """This class contains validation methods""" def check_exist(self, table, value, item): """Method to check if a value exists in the database""" <|body_0|> def made_rsvp(self, table, meetup_id, username): """method to check if user made a rsvp""" ...
stack_v2_sparse_classes_75kplus_train_069262
2,608
no_license
[ { "docstring": "Method to check if a value exists in the database", "name": "check_exist", "signature": "def check_exist(self, table, value, item)" }, { "docstring": "method to check if user made a rsvp", "name": "made_rsvp", "signature": "def made_rsvp(self, table, meetup_id, username)"...
6
stack_v2_sparse_classes_30k_train_032079
Implement the Python class `Validations` described below. Class description: This class contains validation methods Method signatures and docstrings: - def check_exist(self, table, value, item): Method to check if a value exists in the database - def made_rsvp(self, table, meetup_id, username): method to check if use...
Implement the Python class `Validations` described below. Class description: This class contains validation methods Method signatures and docstrings: - def check_exist(self, table, value, item): Method to check if a value exists in the database - def made_rsvp(self, table, meetup_id, username): method to check if use...
607257db910f9b44fb4497e25de8b295cd2fcdcb
<|skeleton|> class Validations: """This class contains validation methods""" def check_exist(self, table, value, item): """Method to check if a value exists in the database""" <|body_0|> def made_rsvp(self, table, meetup_id, username): """method to check if user made a rsvp""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Validations: """This class contains validation methods""" def check_exist(self, table, value, item): """Method to check if a value exists in the database""" query = "SELECT {1} FROM {0} WHERE {1} = '{2}'".format(table, value, item) data = QuestionerDB.fetch_one(query) if d...
the_stack_v2_python_sparse
app/api/v2/utils/validations.py
misocho/questioner
train
0
ddb40de01b1021f099a8bb44814afc55866e6ce6
[ "self._gis = gis\nself._portal = gis._portal\nself._is_portal = self._gis.properties.isPortal\nself._workdir = tempfile.gettempdir()", "access = kwargs.pop('access', None)\nfiles = None\nif key is None and path:\n key = os.path.basename(path)\nelif key is None and path is None:\n raise ValueError('key must ...
<|body_start_0|> self._gis = gis self._portal = gis._portal self._is_portal = self._gis.properties.isPortal self._workdir = tempfile.gettempdir() <|end_body_0|> <|body_start_1|> access = kwargs.pop('access', None) files = None if key is None and path: ...
Helper class to manage a GIS' resources ================ =============================================================== **Argument** **Description** ---------------- --------------------------------------------------------------- gis required GIS, connection to ArcGIS Online or ArcGIS Enterprise ================ =====...
PortalResourceManager
[ "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PortalResourceManager: """Helper class to manage a GIS' resources ================ =============================================================== **Argument** **Description** ---------------- --------------------------------------------------------------- gis required GIS, connection to ArcGIS O...
stack_v2_sparse_classes_75kplus_train_069263
7,275
permissive
[ { "docstring": "Creates helper object to manage custom roles in the GIS", "name": "__init__", "signature": "def __init__(self, gis)" }, { "docstring": "The add resource operation allows the administrator to add a file resource, for example, the organization's logo or custom banner. The resource ...
5
null
Implement the Python class `PortalResourceManager` described below. Class description: Helper class to manage a GIS' resources ================ =============================================================== **Argument** **Description** ---------------- --------------------------------------------------------------- g...
Implement the Python class `PortalResourceManager` described below. Class description: Helper class to manage a GIS' resources ================ =============================================================== **Argument** **Description** ---------------- --------------------------------------------------------------- g...
a874fe7e5c95196e4de68db2da0e2a05eb70e5d8
<|skeleton|> class PortalResourceManager: """Helper class to manage a GIS' resources ================ =============================================================== **Argument** **Description** ---------------- --------------------------------------------------------------- gis required GIS, connection to ArcGIS O...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PortalResourceManager: """Helper class to manage a GIS' resources ================ =============================================================== **Argument** **Description** ---------------- --------------------------------------------------------------- gis required GIS, connection to ArcGIS Online or ArcG...
the_stack_v2_python_sparse
arcpyenv/arcgispro-py3-clone/Lib/site-packages/arcgis/gis/admin/_resources.py
SherbazHashmi/HackathonServer
train
3
3332f40223004e1be18d1012f79910850736edf9
[ "defined_fields = self.form.used_field_names\nrequired_fields = self.form.get_required_field_names()\nmissing_fields = []\nfor field in required_fields:\n if field not in defined_fields:\n missing_fields.append(field)\nif len(missing_fields) > 0:\n raise ValidationError('The save instance handler can o...
<|body_start_0|> defined_fields = self.form.used_field_names required_fields = self.form.get_required_field_names() missing_fields = [] for field in required_fields: if field not in defined_fields: missing_fields.append(field) if len(missing_fields) > ...
Handler for saving the form instance
OmniFormSaveInstanceHandler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OmniFormSaveInstanceHandler: """Handler for saving the form instance""" def assert_has_all_required_fields(self): """Property that determines whether or not the associated form defines all of the required fields :raises: ValidationError""" <|body_0|> def clean(self): ...
stack_v2_sparse_classes_75kplus_train_069264
47,532
permissive
[ { "docstring": "Property that determines whether or not the associated form defines all of the required fields :raises: ValidationError", "name": "assert_has_all_required_fields", "signature": "def assert_has_all_required_fields(self)" }, { "docstring": "Cleans the handler for saving a model ins...
3
stack_v2_sparse_classes_30k_train_023510
Implement the Python class `OmniFormSaveInstanceHandler` described below. Class description: Handler for saving the form instance Method signatures and docstrings: - def assert_has_all_required_fields(self): Property that determines whether or not the associated form defines all of the required fields :raises: Valida...
Implement the Python class `OmniFormSaveInstanceHandler` described below. Class description: Handler for saving the form instance Method signatures and docstrings: - def assert_has_all_required_fields(self): Property that determines whether or not the associated form defines all of the required fields :raises: Valida...
0c96162445f8b5ddf7f326f6b0a2e6ec239c4bd5
<|skeleton|> class OmniFormSaveInstanceHandler: """Handler for saving the form instance""" def assert_has_all_required_fields(self): """Property that determines whether or not the associated form defines all of the required fields :raises: ValidationError""" <|body_0|> def clean(self): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OmniFormSaveInstanceHandler: """Handler for saving the form instance""" def assert_has_all_required_fields(self): """Property that determines whether or not the associated form defines all of the required fields :raises: ValidationError""" defined_fields = self.form.used_field_names ...
the_stack_v2_python_sparse
omniforms/models.py
omni-digital/omni-forms
train
6
9f051cc4f04772819c8207608b1f7d5f69f4f996
[ "super(FPN, self).__init__()\nself.inner_blocks = []\nself.layer_blocks = []\nfor idx, in_channels in enumerate(in_channels_list, 1):\n inner_block = 'fpn_inner{}'.format(idx)\n layer_block = 'fpn_layer{}'.format(idx)\n if in_channels == 0:\n continue\n inner_block_module = conv_block(in_channels...
<|body_start_0|> super(FPN, self).__init__() self.inner_blocks = [] self.layer_blocks = [] for idx, in_channels in enumerate(in_channels_list, 1): inner_block = 'fpn_inner{}'.format(idx) layer_block = 'fpn_layer{}'.format(idx) if in_channels == 0: ...
Module that adds FPN on top of a list of feature maps. The feature maps are currently supposed to be in increasing depth order, and must be consecutive
FPN
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FPN: """Module that adds FPN on top of a list of feature maps. The feature maps are currently supposed to be in increasing depth order, and must be consecutive""" def __init__(self, in_channels_list, out_channels, conv_block, top_blocks=None): """Arguments: in_channels_list (list[int...
stack_v2_sparse_classes_75kplus_train_069265
10,890
permissive
[ { "docstring": "Arguments: in_channels_list (list[int]): number of channels for each feature map that will be fed out_channels (int): number of channels of the FPN representation top_blocks (nn.Module or None): if provided, an extra operation will be performed on the output of the last (smallest resolution) FPN...
2
stack_v2_sparse_classes_30k_train_054677
Implement the Python class `FPN` described below. Class description: Module that adds FPN on top of a list of feature maps. The feature maps are currently supposed to be in increasing depth order, and must be consecutive Method signatures and docstrings: - def __init__(self, in_channels_list, out_channels, conv_block...
Implement the Python class `FPN` described below. Class description: Module that adds FPN on top of a list of feature maps. The feature maps are currently supposed to be in increasing depth order, and must be consecutive Method signatures and docstrings: - def __init__(self, in_channels_list, out_channels, conv_block...
54e0821e73f67be5360c36f01229a123c34ab3b3
<|skeleton|> class FPN: """Module that adds FPN on top of a list of feature maps. The feature maps are currently supposed to be in increasing depth order, and must be consecutive""" def __init__(self, in_channels_list, out_channels, conv_block, top_blocks=None): """Arguments: in_channels_list (list[int...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FPN: """Module that adds FPN on top of a list of feature maps. The feature maps are currently supposed to be in increasing depth order, and must be consecutive""" def __init__(self, in_channels_list, out_channels, conv_block, top_blocks=None): """Arguments: in_channels_list (list[int]): number of...
the_stack_v2_python_sparse
AnchorFree/FCOS/models/asff.py
Le1kk/ObjectDetection
train
0
9a98e6e35aa15c8807db1b00942dbce6948b5bb4
[ "self.name = 'compare'\nsuper(CompareTable, self).__init__(results, best_results, options, group_dir, pp_locations, table_name)\nself.has_pp = True\nself.pp_filenames = [os.path.relpath(pp, group_dir) for pp in pp_locations]", "abs_value = {}\nrel_value = {}\nfor key, value in results_dict.items():\n acc_abs_v...
<|body_start_0|> self.name = 'compare' super(CompareTable, self).__init__(results, best_results, options, group_dir, pp_locations, table_name) self.has_pp = True self.pp_filenames = [os.path.relpath(pp, group_dir) for pp in pp_locations] <|end_body_0|> <|body_start_1|> abs_value...
The combined results show the accuracy in the first line of the cell and the runtime on the second line of the cell.
CompareTable
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CompareTable: """The combined results show the accuracy in the first line of the cell and the runtime on the second line of the cell.""" def __init__(self, results, best_results, options, group_dir, pp_locations, table_name): """Initialise the compare table which shows both accuracy ...
stack_v2_sparse_classes_75kplus_train_069266
5,289
permissive
[ { "docstring": "Initialise the compare table which shows both accuracy and runtime results :param results: results nested array of objects :type results: list of list of fitbenchmarking.utils.fitbm_result.FittingResult :param best_results: best result for each problem :type best_results: list of fitbenchmarking...
4
null
Implement the Python class `CompareTable` described below. Class description: The combined results show the accuracy in the first line of the cell and the runtime on the second line of the cell. Method signatures and docstrings: - def __init__(self, results, best_results, options, group_dir, pp_locations, table_name)...
Implement the Python class `CompareTable` described below. Class description: The combined results show the accuracy in the first line of the cell and the runtime on the second line of the cell. Method signatures and docstrings: - def __init__(self, results, best_results, options, group_dir, pp_locations, table_name)...
edae46c0361568bc537de2425d603e7b271eabe7
<|skeleton|> class CompareTable: """The combined results show the accuracy in the first line of the cell and the runtime on the second line of the cell.""" def __init__(self, results, best_results, options, group_dir, pp_locations, table_name): """Initialise the compare table which shows both accuracy ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CompareTable: """The combined results show the accuracy in the first line of the cell and the runtime on the second line of the cell.""" def __init__(self, results, best_results, options, group_dir, pp_locations, table_name): """Initialise the compare table which shows both accuracy and runtime r...
the_stack_v2_python_sparse
fitbenchmarking/results_processing/compare_table.py
dsotiropoulos/fitbenchmarking
train
0
05a102057641d96c56c77c41542f77eaa4345d6e
[ "super(IdentityResidualBlock, self).__init__()\nself.dist_bn = dist_bn\nif len(channels) != 2 and len(channels) != 3:\n raise ValueError('channels must contain either two or three values')\nif len(channels) == 2 and groups != 1:\n raise ValueError('groups > 1 are only valid if len(channels) == 3')\nis_bottlen...
<|body_start_0|> super(IdentityResidualBlock, self).__init__() self.dist_bn = dist_bn if len(channels) != 2 and len(channels) != 3: raise ValueError('channels must contain either two or three values') if len(channels) == 2 and groups != 1: raise ValueError('groups...
Identity Residual Block for WideResnet
IdentityResidualBlock
[ "GPL-1.0-or-later", "BSD-3-Clause", "Apache-2.0", "BSD-2-Clause", "MIT", "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IdentityResidualBlock: """Identity Residual Block for WideResnet""" def __init__(self, in_channels, channels, stride=1, dilation=1, groups=1, norm_act=bnrelu, dropout=None, dist_bn=False): """Configurable identity-mapping residual block Parameters ---------- in_channels : int Number ...
stack_v2_sparse_classes_75kplus_train_069267
15,930
permissive
[ { "docstring": "Configurable identity-mapping residual block Parameters ---------- in_channels : int Number of input channels. channels : list of int Number of channels in the internal feature maps. Can either have two or three elements: if three construct a residual block with two `3 x 3` convolutions, otherwi...
2
stack_v2_sparse_classes_30k_train_016276
Implement the Python class `IdentityResidualBlock` described below. Class description: Identity Residual Block for WideResnet Method signatures and docstrings: - def __init__(self, in_channels, channels, stride=1, dilation=1, groups=1, norm_act=bnrelu, dropout=None, dist_bn=False): Configurable identity-mapping resid...
Implement the Python class `IdentityResidualBlock` described below. Class description: Identity Residual Block for WideResnet Method signatures and docstrings: - def __init__(self, in_channels, channels, stride=1, dilation=1, groups=1, norm_act=bnrelu, dropout=None, dist_bn=False): Configurable identity-mapping resid...
92acc188d3a0f634de58463b6676e70df83ef808
<|skeleton|> class IdentityResidualBlock: """Identity Residual Block for WideResnet""" def __init__(self, in_channels, channels, stride=1, dilation=1, groups=1, norm_act=bnrelu, dropout=None, dist_bn=False): """Configurable identity-mapping residual block Parameters ---------- in_channels : int Number ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IdentityResidualBlock: """Identity Residual Block for WideResnet""" def __init__(self, in_channels, channels, stride=1, dilation=1, groups=1, norm_act=bnrelu, dropout=None, dist_bn=False): """Configurable identity-mapping residual block Parameters ---------- in_channels : int Number of input chan...
the_stack_v2_python_sparse
PyTorch/contrib/cv/semantic_segmentation/HRnet-OCR/network/wider_resnet.py
Ascend/ModelZoo-PyTorch
train
23
76bb4b22bf861ce99460ba72b2d5ca1d7a3216ba
[ "if opus is None:\n raise RuntimeError(f'{cls.__name__} cannot be created if opus is not loaded.')\nreturn Exception.__new__(cls)", "self.code = code\nmsg = opus.opus_strerror(code).decode('utf-8')\nException.__init__(self, msg)" ]
<|body_start_0|> if opus is None: raise RuntimeError(f'{cls.__name__} cannot be created if opus is not loaded.') return Exception.__new__(cls) <|end_body_0|> <|body_start_1|> self.code = code msg = opus.opus_strerror(code).decode('utf-8') Exception.__init__(self, msg...
Exception raised by lib-opus related methods. Attributes ---------- code : `int` Returned error code by lib-opus.
OpusError
[ "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OpusError: """Exception raised by lib-opus related methods. Attributes ---------- code : `int` Returned error code by lib-opus.""" def __new__(cls, code): """Raises ----- RuntimeError If opus is not loaded.""" <|body_0|> def __init__(self, code): """Creates an ``...
stack_v2_sparse_classes_75kplus_train_069268
17,943
permissive
[ { "docstring": "Raises ----- RuntimeError If opus is not loaded.", "name": "__new__", "signature": "def __new__(cls, code)" }, { "docstring": "Creates an ``OpusError`` Parameters ---------- code : `int` Returned error code by lib-opus.", "name": "__init__", "signature": "def __init__(sel...
2
null
Implement the Python class `OpusError` described below. Class description: Exception raised by lib-opus related methods. Attributes ---------- code : `int` Returned error code by lib-opus. Method signatures and docstrings: - def __new__(cls, code): Raises ----- RuntimeError If opus is not loaded. - def __init__(self,...
Implement the Python class `OpusError` described below. Class description: Exception raised by lib-opus related methods. Attributes ---------- code : `int` Returned error code by lib-opus. Method signatures and docstrings: - def __new__(cls, code): Raises ----- RuntimeError If opus is not loaded. - def __init__(self,...
53f24fdb38459dc5a4fd04f11bdbfee8295b76a4
<|skeleton|> class OpusError: """Exception raised by lib-opus related methods. Attributes ---------- code : `int` Returned error code by lib-opus.""" def __new__(cls, code): """Raises ----- RuntimeError If opus is not loaded.""" <|body_0|> def __init__(self, code): """Creates an ``...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OpusError: """Exception raised by lib-opus related methods. Attributes ---------- code : `int` Returned error code by lib-opus.""" def __new__(cls, code): """Raises ----- RuntimeError If opus is not loaded.""" if opus is None: raise RuntimeError(f'{cls.__name__} cannot be crea...
the_stack_v2_python_sparse
hata/discord/voice/opus.py
HuyaneMatsu/hata
train
3
152aff2507e410d3883eb54100d6d8551b621fb7
[ "self.user = user\nself.client = client\nself.key = key\nself.secret = secret\nself.endpoint = endpoint\nself.cred_type = cred_type\nself.token_properties = token_properties", "credentials_path = expanduser(expandvars(path))\nif not exists(credentials_path):\n raise HereCredentialsException('Unable to find cre...
<|body_start_0|> self.user = user self.client = client self.key = key self.secret = secret self.endpoint = endpoint self.cred_type = cred_type self.token_properties = token_properties <|end_body_0|> <|body_start_1|> credentials_path = expanduser(expandvar...
HereCredentials
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HereCredentials: def __init__(self, user: str, client: str, key: str, secret: str, endpoint: str='https://account.api.here.com/oauth2/token', cred_type: str='DEFAULT', token_properties: dict=None): """Instantiate the credentials object. :param user: the HERE user id :param client: the HE...
stack_v2_sparse_classes_75kplus_train_069269
2,705
permissive
[ { "docstring": "Instantiate the credentials object. :param user: the HERE user id :param client: the HERE client id :param key: the HERE access key id :param secret: there HERE access key secret :param endpoint: the URL of the HERE account service :param cred_type: the type of credentials eg: DEFAULT, TOKEN :to...
2
stack_v2_sparse_classes_30k_train_039343
Implement the Python class `HereCredentials` described below. Class description: Implement the HereCredentials class. Method signatures and docstrings: - def __init__(self, user: str, client: str, key: str, secret: str, endpoint: str='https://account.api.here.com/oauth2/token', cred_type: str='DEFAULT', token_propert...
Implement the Python class `HereCredentials` described below. Class description: Implement the HereCredentials class. Method signatures and docstrings: - def __init__(self, user: str, client: str, key: str, secret: str, endpoint: str='https://account.api.here.com/oauth2/token', cred_type: str='DEFAULT', token_propert...
e45f6c578733b3adce5a32dba575884ff76274b3
<|skeleton|> class HereCredentials: def __init__(self, user: str, client: str, key: str, secret: str, endpoint: str='https://account.api.here.com/oauth2/token', cred_type: str='DEFAULT', token_properties: dict=None): """Instantiate the credentials object. :param user: the HERE user id :param client: the HE...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HereCredentials: def __init__(self, user: str, client: str, key: str, secret: str, endpoint: str='https://account.api.here.com/oauth2/token', cred_type: str='DEFAULT', token_properties: dict=None): """Instantiate the credentials object. :param user: the HERE user id :param client: the HERE client id :...
the_stack_v2_python_sparse
XYZHubConnector/xyz_qgis/common/here_credentials.py
heremaps/xyz-qgis-plugin
train
23
92f282ef6400ca269ce88e21c196b15206f78fcd
[ "self.characters = characters\nself.combinationLength = combinationLength\nself.length = len(self.characters)\nself.cur = [1] * self.combinationLength + [0] * (self.length - self.combinationLength)\nself.start = True", "if self.start:\n self.start = False\nelse:\n zero_idx = 0\n for i in range(self.lengt...
<|body_start_0|> self.characters = characters self.combinationLength = combinationLength self.length = len(self.characters) self.cur = [1] * self.combinationLength + [0] * (self.length - self.combinationLength) self.start = True <|end_body_0|> <|body_start_1|> if self.st...
CombinationIterator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CombinationIterator: def __init__(self, characters, combinationLength): """:type characters: str :type combinationLength: int""" <|body_0|> def next(self): """:rtype: str""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|e...
stack_v2_sparse_classes_75kplus_train_069270
2,328
no_license
[ { "docstring": ":type characters: str :type combinationLength: int", "name": "__init__", "signature": "def __init__(self, characters, combinationLength)" }, { "docstring": ":rtype: str", "name": "next", "signature": "def next(self)" }, { "docstring": ":rtype: bool", "name": "...
3
stack_v2_sparse_classes_30k_train_034429
Implement the Python class `CombinationIterator` described below. Class description: Implement the CombinationIterator class. Method signatures and docstrings: - def __init__(self, characters, combinationLength): :type characters: str :type combinationLength: int - def next(self): :rtype: str - def hasNext(self): :rt...
Implement the Python class `CombinationIterator` described below. Class description: Implement the CombinationIterator class. Method signatures and docstrings: - def __init__(self, characters, combinationLength): :type characters: str :type combinationLength: int - def next(self): :rtype: str - def hasNext(self): :rt...
80940738f9eab7f641efb2df9bce8b7bc888a4eb
<|skeleton|> class CombinationIterator: def __init__(self, characters, combinationLength): """:type characters: str :type combinationLength: int""" <|body_0|> def next(self): """:rtype: str""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|e...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CombinationIterator: def __init__(self, characters, combinationLength): """:type characters: str :type combinationLength: int""" self.characters = characters self.combinationLength = combinationLength self.length = len(self.characters) self.cur = [1] * self.combinationL...
the_stack_v2_python_sparse
1286. 字母组合迭代器.py
half-empty/LeetCode
train
0
37e1f8a22b076af4ebfd5bb33cca051c2ffd3c7f
[ "role_id = g.account_obj.role_id\nmenus = list()\nif role_id in site.role_menus:\n role_menus = site.role_menus[role_id]\n for menu_name in role_menus:\n menus.append(site.menus[menu_name])\nreturn self.return_success(menus)", "store_article_category_form = StoreArticleCategoryForm.from_json(self.req...
<|body_start_0|> role_id = g.account_obj.role_id menus = list() if role_id in site.role_menus: role_menus = site.role_menus[role_id] for menu_name in role_menus: menus.append(site.menus[menu_name]) return self.return_success(menus) <|end_body_0|> ...
Site
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Site: def get_menus(self): """@description: 获取权限菜单 @return: list 菜单列表""" <|body_0|> def store_article_category(self): """@descripttion: 新增文章分类 @param {type} @return:""" <|body_1|> def index_article_category(self): """@descripttion: 获取文章分类列表 @retu...
stack_v2_sparse_classes_75kplus_train_069271
3,184
no_license
[ { "docstring": "@description: 获取权限菜单 @return: list 菜单列表", "name": "get_menus", "signature": "def get_menus(self)" }, { "docstring": "@descripttion: 新增文章分类 @param {type} @return:", "name": "store_article_category", "signature": "def store_article_category(self)" }, { "docstring": ...
4
stack_v2_sparse_classes_30k_train_020188
Implement the Python class `Site` described below. Class description: Implement the Site class. Method signatures and docstrings: - def get_menus(self): @description: 获取权限菜单 @return: list 菜单列表 - def store_article_category(self): @descripttion: 新增文章分类 @param {type} @return: - def index_article_category(self): @descrip...
Implement the Python class `Site` described below. Class description: Implement the Site class. Method signatures and docstrings: - def get_menus(self): @description: 获取权限菜单 @return: list 菜单列表 - def store_article_category(self): @descripttion: 新增文章分类 @param {type} @return: - def index_article_category(self): @descrip...
12ebf7caad8e8884e2f35bbad16314b8716b105b
<|skeleton|> class Site: def get_menus(self): """@description: 获取权限菜单 @return: list 菜单列表""" <|body_0|> def store_article_category(self): """@descripttion: 新增文章分类 @param {type} @return:""" <|body_1|> def index_article_category(self): """@descripttion: 获取文章分类列表 @retu...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Site: def get_menus(self): """@description: 获取权限菜单 @return: list 菜单列表""" role_id = g.account_obj.role_id menus = list() if role_id in site.role_menus: role_menus = site.role_menus[role_id] for menu_name in role_menus: menus.append(site.me...
the_stack_v2_python_sparse
lingkblog/services/admin/site.py
GGGanon/lingkblog-service
train
3
ebf6968ea4adeae4b9828e8186b810ad8c081722
[ "super().__init__(images, class_dict, args)\nassert self.image_channels == 3\nassert np.shape(self.image_data)[-1] == self.image_channels", "index, tag = meta_index\nlabel, seed = tag\nimage = self.image_data[index]\nh, w, c = image.shape\nimage = Image.fromarray(np.uint8(image)).convert('RGB')\nimage = self.tran...
<|body_start_0|> super().__init__(images, class_dict, args) assert self.image_channels == 3 assert np.shape(self.image_data)[-1] == self.image_channels <|end_body_0|> <|body_start_1|> index, tag = meta_index label, seed = tag image = self.image_data[index] h, w, ...
ColorDatasetInMemory
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ColorDatasetInMemory: def __init__(self, images, class_dict, args): """Constructor of DatasetInMemory for datasets that can fit in memory. Use DatasetOnDrive to load images from hard drive. :param images: All images in a single array or list already loaded in memory :param class_dict: Di...
stack_v2_sparse_classes_75kplus_train_069272
9,434
permissive
[ { "docstring": "Constructor of DatasetInMemory for datasets that can fit in memory. Use DatasetOnDrive to load images from hard drive. :param images: All images in a single array or list already loaded in memory :param class_dict: Dictionary mapping class names to a list of indices of images belonging to the cl...
3
stack_v2_sparse_classes_30k_train_000320
Implement the Python class `ColorDatasetInMemory` described below. Class description: Implement the ColorDatasetInMemory class. Method signatures and docstrings: - def __init__(self, images, class_dict, args): Constructor of DatasetInMemory for datasets that can fit in memory. Use DatasetOnDrive to load images from h...
Implement the Python class `ColorDatasetInMemory` described below. Class description: Implement the ColorDatasetInMemory class. Method signatures and docstrings: - def __init__(self, images, class_dict, args): Constructor of DatasetInMemory for datasets that can fit in memory. Use DatasetOnDrive to load images from h...
d654a9898e19bf4278af8a4bfcebef5950c615e0
<|skeleton|> class ColorDatasetInMemory: def __init__(self, images, class_dict, args): """Constructor of DatasetInMemory for datasets that can fit in memory. Use DatasetOnDrive to load images from hard drive. :param images: All images in a single array or list already loaded in memory :param class_dict: Di...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ColorDatasetInMemory: def __init__(self, images, class_dict, args): """Constructor of DatasetInMemory for datasets that can fit in memory. Use DatasetOnDrive to load images from hard drive. :param images: All images in a single array or list already loaded in memory :param class_dict: Dictionary mappi...
the_stack_v2_python_sparse
src/datasets/dataset_template.py
licj1/imbalanced_fsl_public
train
0
cf603d1c032ffc9d726595322cf4115167caa7c5
[ "if N == 1:\n return 10\ntemp = 10 ** 9 + 7\ndp = [[0] * 10 for _ in range(N)]\nfor i in range(10):\n dp[0][i] = 1\nfor i in range(1, N):\n dp[i][0] = (dp[i - 1][4] + dp[i - 1][6]) % temp\n dp[i][1] = (dp[i - 1][6] + dp[i - 1][8]) % temp\n dp[i][2] = (dp[i - 1][7] + dp[i - 1][9]) % temp\n dp[i][3]...
<|body_start_0|> if N == 1: return 10 temp = 10 ** 9 + 7 dp = [[0] * 10 for _ in range(N)] for i in range(10): dp[0][i] = 1 for i in range(1, N): dp[i][0] = (dp[i - 1][4] + dp[i - 1][6]) % temp dp[i][1] = (dp[i - 1][6] + dp[i - 1][8...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def knightDialer(self, N): """:type N: int :rtype: int 552 ms""" <|body_0|> def knightDialer_1(self, N): """:type N: int :rtype: int 80ms 矩阵乘法,斐波那契数列的方法!!!!""" <|body_1|> <|end_skeleton|> <|body_start_0|> if N == 1: return 10 ...
stack_v2_sparse_classes_75kplus_train_069273
2,749
no_license
[ { "docstring": ":type N: int :rtype: int 552 ms", "name": "knightDialer", "signature": "def knightDialer(self, N)" }, { "docstring": ":type N: int :rtype: int 80ms 矩阵乘法,斐波那契数列的方法!!!!", "name": "knightDialer_1", "signature": "def knightDialer_1(self, N)" } ]
2
stack_v2_sparse_classes_30k_train_003517
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def knightDialer(self, N): :type N: int :rtype: int 552 ms - def knightDialer_1(self, N): :type N: int :rtype: int 80ms 矩阵乘法,斐波那契数列的方法!!!!
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def knightDialer(self, N): :type N: int :rtype: int 552 ms - def knightDialer_1(self, N): :type N: int :rtype: int 80ms 矩阵乘法,斐波那契数列的方法!!!! <|skeleton|> class Solution: def ...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def knightDialer(self, N): """:type N: int :rtype: int 552 ms""" <|body_0|> def knightDialer_1(self, N): """:type N: int :rtype: int 80ms 矩阵乘法,斐波那契数列的方法!!!!""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def knightDialer(self, N): """:type N: int :rtype: int 552 ms""" if N == 1: return 10 temp = 10 ** 9 + 7 dp = [[0] * 10 for _ in range(N)] for i in range(10): dp[0][i] = 1 for i in range(1, N): dp[i][0] = (dp[i - 1][...
the_stack_v2_python_sparse
KnightDialer_MID_935.py
953250587/leetcode-python
train
2
46225ea435305b631646589cffb2fcd472da70c0
[ "if dedent:\n template = _textwrap.dedent(template).lstrip()\nif rstrip:\n template = template.rstrip()\nself._template = template", "if args:\n if kwargs:\n raise TypeError('Both args and kwargs given')\n return self._template % args\nelif kwargs:\n return self._template % kwargs\nreturn se...
<|body_start_0|> if dedent: template = _textwrap.dedent(template).lstrip() if rstrip: template = template.rstrip() self._template = template <|end_body_0|> <|body_start_1|> if args: if kwargs: raise TypeError('Both args and kwargs give...
Template container Attributes: _template (str): Template string
Template
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Template: """Template container Attributes: _template (str): Template string""" def __init__(self, template, dedent=True, rstrip=True): """Initialization Parameters: template (str): Template string dedent (bool): Dedent automatically? rstrip (bool): rstrip the template automatically?...
stack_v2_sparse_classes_75kplus_train_069274
2,184
permissive
[ { "docstring": "Initialization Parameters: template (str): Template string dedent (bool): Dedent automatically? rstrip (bool): rstrip the template automatically?", "name": "__init__", "signature": "def __init__(self, template, dedent=True, rstrip=True)" }, { "docstring": "Expand the template Eit...
2
stack_v2_sparse_classes_30k_train_029428
Implement the Python class `Template` described below. Class description: Template container Attributes: _template (str): Template string Method signatures and docstrings: - def __init__(self, template, dedent=True, rstrip=True): Initialization Parameters: template (str): Template string dedent (bool): Dedent automat...
Implement the Python class `Template` described below. Class description: Template container Attributes: _template (str): Template string Method signatures and docstrings: - def __init__(self, template, dedent=True, rstrip=True): Initialization Parameters: template (str): Template string dedent (bool): Dedent automat...
69b94193f6a12e6b52b44ff2eb9d82468883b318
<|skeleton|> class Template: """Template container Attributes: _template (str): Template string""" def __init__(self, template, dedent=True, rstrip=True): """Initialization Parameters: template (str): Template string dedent (bool): Dedent automatically? rstrip (bool): rstrip the template automatically?...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Template: """Template container Attributes: _template (str): Template string""" def __init__(self, template, dedent=True, rstrip=True): """Initialization Parameters: template (str): Template string dedent (bool): Dedent automatically? rstrip (bool): rstrip the template automatically?""" i...
the_stack_v2_python_sparse
gensaschema/_template.py
ndparker/gensaschema
train
3
28c0a2cf713e50e00759627afbfeedf338c757ba
[ "self.original_fn = original_fn\nself.is_method = isinstance(self.original_fn, types.MethodType)\nself.pack_fn_name = f'_{original_fn.__name__}_pack'\nself._generate_pack_op()", "if self.is_method:\n sig = inspect.signature(self.original_fn.pack_fn)\n arg_num = len(sig.parameters) - 1\n arg_str = ', '.jo...
<|body_start_0|> self.original_fn = original_fn self.is_method = isinstance(self.original_fn, types.MethodType) self.pack_fn_name = f'_{original_fn.__name__}_pack' self._generate_pack_op() <|end_body_0|> <|body_start_1|> if self.is_method: sig = inspect.signature(sel...
Generation Pack Python code by method
_PackSourceBuilder
[ "Apache-2.0", "LicenseRef-scancode-proprietary-license", "MPL-1.0", "OpenSSL", "LGPL-3.0-only", "LicenseRef-scancode-warranty-disclaimer", "BSD-3-Clause-Open-MPI", "MIT", "MPL-2.0-no-copyleft-exception", "NTP", "BSD-3-Clause", "GPL-1.0-or-later", "0BSD", "MPL-2.0", "LicenseRef-scancode-f...
stack_v2_sparse_python_classes_v1
<|skeleton|> class _PackSourceBuilder: """Generation Pack Python code by method""" def __init__(self, original_fn): """Initialize the _PackSourceBuilder""" <|body_0|> def get_code_source(self): """Return Pack Python code""" <|body_1|> def _generate_pack_op(self): ...
stack_v2_sparse_classes_75kplus_train_069275
7,643
permissive
[ { "docstring": "Initialize the _PackSourceBuilder", "name": "__init__", "signature": "def __init__(self, original_fn)" }, { "docstring": "Return Pack Python code", "name": "get_code_source", "signature": "def get_code_source(self)" }, { "docstring": "Generate the pack operation a...
3
stack_v2_sparse_classes_30k_test_002939
Implement the Python class `_PackSourceBuilder` described below. Class description: Generation Pack Python code by method Method signatures and docstrings: - def __init__(self, original_fn): Initialize the _PackSourceBuilder - def get_code_source(self): Return Pack Python code - def _generate_pack_op(self): Generate ...
Implement the Python class `_PackSourceBuilder` described below. Class description: Generation Pack Python code by method Method signatures and docstrings: - def __init__(self, original_fn): Initialize the _PackSourceBuilder - def get_code_source(self): Return Pack Python code - def _generate_pack_op(self): Generate ...
54acb15d435533c815ee1bd9f6dc0b56b4d4cf83
<|skeleton|> class _PackSourceBuilder: """Generation Pack Python code by method""" def __init__(self, original_fn): """Initialize the _PackSourceBuilder""" <|body_0|> def get_code_source(self): """Return Pack Python code""" <|body_1|> def _generate_pack_op(self): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class _PackSourceBuilder: """Generation Pack Python code by method""" def __init__(self, original_fn): """Initialize the _PackSourceBuilder""" self.original_fn = original_fn self.is_method = isinstance(self.original_fn, types.MethodType) self.pack_fn_name = f'_{original_fn.__nam...
the_stack_v2_python_sparse
mindspore/python/mindspore/ops/_tracefunc.py
mindspore-ai/mindspore
train
4,178
ff6868c40b4bd30e0e3d2654f6f0ff7f5eb29cda
[ "try:\n dhcpController = DhcpController()\n json_data = json.dumps(dhcpController.get_dhcp_server_configuration_default_lease_time())\n resp = Response(json_data, status=200, mimetype='application/json')\n return resp\nexcept ValueError as ve:\n return Response(json.dumps(str(ve)), status=404, mimety...
<|body_start_0|> try: dhcpController = DhcpController() json_data = json.dumps(dhcpController.get_dhcp_server_configuration_default_lease_time()) resp = Response(json_data, status=200, mimetype='application/json') return resp except ValueError as ve: ...
DhcpServer_Configuration_DefaultLeaseTime
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DhcpServer_Configuration_DefaultLeaseTime: def get(self): """Gets the default lease time parameter""" <|body_0|> def put(self): """Update the default lease time parameter""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: dhcpControlle...
stack_v2_sparse_classes_75kplus_train_069276
20,424
no_license
[ { "docstring": "Gets the default lease time parameter", "name": "get", "signature": "def get(self)" }, { "docstring": "Update the default lease time parameter", "name": "put", "signature": "def put(self)" } ]
2
null
Implement the Python class `DhcpServer_Configuration_DefaultLeaseTime` described below. Class description: Implement the DhcpServer_Configuration_DefaultLeaseTime class. Method signatures and docstrings: - def get(self): Gets the default lease time parameter - def put(self): Update the default lease time parameter
Implement the Python class `DhcpServer_Configuration_DefaultLeaseTime` described below. Class description: Implement the DhcpServer_Configuration_DefaultLeaseTime class. Method signatures and docstrings: - def get(self): Gets the default lease time parameter - def put(self): Update the default lease time parameter <...
6070e3cb6bf957e04f5d8267db11f3296410e18e
<|skeleton|> class DhcpServer_Configuration_DefaultLeaseTime: def get(self): """Gets the default lease time parameter""" <|body_0|> def put(self): """Update the default lease time parameter""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DhcpServer_Configuration_DefaultLeaseTime: def get(self): """Gets the default lease time parameter""" try: dhcpController = DhcpController() json_data = json.dumps(dhcpController.get_dhcp_server_configuration_default_lease_time()) resp = Response(json_data, ...
the_stack_v2_python_sparse
configuration-agent/dhcp/rest_api/resources/dhcp_server.py
ReliableLion/frog4-configurable-vnf
train
0
fbb3e9a85636144fde65b43bc6441221acfeba7d
[ "self.name = name\nself.x = pos[0]\nself.y = pos[1]\nself.width = width\nself.height = height\nself.color = color\nself.show = True\nself.image = pygame.Surface((width, height))\nself.rect = self.image.get_rect(center=pos)\nself.image.fill(self.color)", "self.x = x\nself.y = y\nself.rect.center = (x, y)" ]
<|body_start_0|> self.name = name self.x = pos[0] self.y = pos[1] self.width = width self.height = height self.color = color self.show = True self.image = pygame.Surface((width, height)) self.rect = self.image.get_rect(center=pos) self.imag...
Rectangle.
Rectangle
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Rectangle: """Rectangle.""" def __init__(self, name, pos, width, height, color): """Initialize Rectangle Sprite. Args: name (string): The name of the sprite pos (tuple): Position of the sprite width (int): Width of the sprite height (int): Height of the sprite color (tuple): Color of...
stack_v2_sparse_classes_75kplus_train_069277
1,033
no_license
[ { "docstring": "Initialize Rectangle Sprite. Args: name (string): The name of the sprite pos (tuple): Position of the sprite width (int): Width of the sprite height (int): Height of the sprite color (tuple): Color of the sprite", "name": "__init__", "signature": "def __init__(self, name, pos, width, hei...
2
null
Implement the Python class `Rectangle` described below. Class description: Rectangle. Method signatures and docstrings: - def __init__(self, name, pos, width, height, color): Initialize Rectangle Sprite. Args: name (string): The name of the sprite pos (tuple): Position of the sprite width (int): Width of the sprite h...
Implement the Python class `Rectangle` described below. Class description: Rectangle. Method signatures and docstrings: - def __init__(self, name, pos, width, height, color): Initialize Rectangle Sprite. Args: name (string): The name of the sprite pos (tuple): Position of the sprite width (int): Width of the sprite h...
d2e70a820b6e7388657912912d16c917d8ef020a
<|skeleton|> class Rectangle: """Rectangle.""" def __init__(self, name, pos, width, height, color): """Initialize Rectangle Sprite. Args: name (string): The name of the sprite pos (tuple): Position of the sprite width (int): Width of the sprite height (int): Height of the sprite color (tuple): Color of...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Rectangle: """Rectangle.""" def __init__(self, name, pos, width, height, color): """Initialize Rectangle Sprite. Args: name (string): The name of the sprite pos (tuple): Position of the sprite width (int): Width of the sprite height (int): Height of the sprite color (tuple): Color of the sprite""...
the_stack_v2_python_sparse
8_Directional/CollectCoins/rectangle.py
JushBJJ/Pygame-Examples
train
0
6396d4fb00467611541cf92bb9b118ade7d42b08
[ "if '\\\\' in key:\n key = key.replace('\\\\', '/')\ncleaned_parts = [part for part in key.split('/') if part]\nreturn '/'.join(cleaned_parts)", "if not value:\n lazy_value = path.normpath('{0}{1}{2}'.format(self.caching_dir, os.sep, key))\n if path.isfile(lazy_value):\n value = lazy_value\n el...
<|body_start_0|> if '\\' in key: key = key.replace('\\', '/') cleaned_parts = [part for part in key.split('/') if part] return '/'.join(cleaned_parts) <|end_body_0|> <|body_start_1|> if not value: lazy_value = path.normpath('{0}{1}{2}'.format(self.caching_dir, os...
Artifactory Cache System
ArtifactoryCacheManager
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArtifactoryCacheManager: """Artifactory Cache System""" def get_key(key): """Here we want to ensure uniqueness of the key :param key: :type key: str :return: the processed key if implemented :rtype: str""" <|body_0|> def add(self, key, value=None): """Add an Entr...
stack_v2_sparse_classes_75kplus_train_069278
25,285
permissive
[ { "docstring": "Here we want to ensure uniqueness of the key :param key: :type key: str :return: the processed key if implemented :rtype: str", "name": "get_key", "signature": "def get_key(key)" }, { "docstring": "Add an Entry to the Cache if not already there * Create the Entry from given key/v...
4
stack_v2_sparse_classes_30k_train_039582
Implement the Python class `ArtifactoryCacheManager` described below. Class description: Artifactory Cache System Method signatures and docstrings: - def get_key(key): Here we want to ensure uniqueness of the key :param key: :type key: str :return: the processed key if implemented :rtype: str - def add(self, key, val...
Implement the Python class `ArtifactoryCacheManager` described below. Class description: Artifactory Cache System Method signatures and docstrings: - def get_key(key): Here we want to ensure uniqueness of the key :param key: :type key: str :return: the processed key if implemented :rtype: str - def add(self, key, val...
7bf09f20f117fc74d02b7635305ce664b65cdcba
<|skeleton|> class ArtifactoryCacheManager: """Artifactory Cache System""" def get_key(key): """Here we want to ensure uniqueness of the key :param key: :type key: str :return: the processed key if implemented :rtype: str""" <|body_0|> def add(self, key, value=None): """Add an Entr...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ArtifactoryCacheManager: """Artifactory Cache System""" def get_key(key): """Here we want to ensure uniqueness of the key :param key: :type key: str :return: the processed key if implemented :rtype: str""" if '\\' in key: key = key.replace('\\', '/') cleaned_parts = [p...
the_stack_v2_python_sparse
acs/acs/UtilitiesFWK/Caching.py
intel/test-framework-and-suites-for-android
train
9
2a6b0eb8101ae5273772b7adc4aa03d592f8edad
[ "LDC_Info.__init__(self)\nself.setTitle(self.name)\nself.status = compat_res[0]\nui = Ui_MotherboardFrame()\nui.setupUi(self.frame)\nself.__fill_frame(ui, info_res, compat_res, diag_res)", "ui.modelLineEdit.setText(QtGui.QApplication.translate('MotherboardFrame', self._check_invalid_values(info_res.model), None, ...
<|body_start_0|> LDC_Info.__init__(self) self.setTitle(self.name) self.status = compat_res[0] ui = Ui_MotherboardFrame() ui.setupUi(self.frame) self.__fill_frame(ui, info_res, compat_res, diag_res) <|end_body_0|> <|body_start_1|> ui.modelLineEdit.setText(QtGui.QA...
Estende a classe 'LDC_Info'. Classe que define a interface gráfica de exibição dos resultados para a placa mãe
GUIMotherboard
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GUIMotherboard: """Estende a classe 'LDC_Info'. Classe que define a interface gráfica de exibição dos resultados para a placa mãe""" def __init__(self, info_res, compat_res, diag_res): """Construtor Parâmetros: info_res -- lista com os resultados informativos (lista de 'InfoResMother...
stack_v2_sparse_classes_75kplus_train_069279
3,833
no_license
[ { "docstring": "Construtor Parâmetros: info_res -- lista com os resultados informativos (lista de 'InfoResMotherboard') compat_res -- Lista com as tuples de resultado de compatibilidade [(True, msg)] diag_res -- Lista com os resultados do diagnóstico (nesse caso não existe teste de diagnóstico, recebe-se uma li...
2
stack_v2_sparse_classes_30k_train_005535
Implement the Python class `GUIMotherboard` described below. Class description: Estende a classe 'LDC_Info'. Classe que define a interface gráfica de exibição dos resultados para a placa mãe Method signatures and docstrings: - def __init__(self, info_res, compat_res, diag_res): Construtor Parâmetros: info_res -- list...
Implement the Python class `GUIMotherboard` described below. Class description: Estende a classe 'LDC_Info'. Classe que define a interface gráfica de exibição dos resultados para a placa mãe Method signatures and docstrings: - def __init__(self, info_res, compat_res, diag_res): Construtor Parâmetros: info_res -- list...
bda0c2c8977dd1246339f1f0f4718d29e8795f21
<|skeleton|> class GUIMotherboard: """Estende a classe 'LDC_Info'. Classe que define a interface gráfica de exibição dos resultados para a placa mãe""" def __init__(self, info_res, compat_res, diag_res): """Construtor Parâmetros: info_res -- lista com os resultados informativos (lista de 'InfoResMother...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GUIMotherboard: """Estende a classe 'LDC_Info'. Classe que define a interface gráfica de exibição dos resultados para a placa mãe""" def __init__(self, info_res, compat_res, diag_res): """Construtor Parâmetros: info_res -- lista com os resultados informativos (lista de 'InfoResMotherboard') compa...
the_stack_v2_python_sparse
src/libs/motherboard/gui_motherboard.py
adrianomelo/ldc-desktop
train
1
6076e495a26499e95b0952b09fe798175f6c299c
[ "super().validate_order_by(value)\nvalidate_field(self, 'order_by', OrderBySerializer, value)\nreturn value", "valid_delta = 'usage'\nrequest = self.context.get('request')\nif request and 'costs' in request.path:\n valid_delta = 'cost_total'\n if value == 'cost':\n return valid_delta\nif value != val...
<|body_start_0|> super().validate_order_by(value) validate_field(self, 'order_by', OrderBySerializer, value) return value <|end_body_0|> <|body_start_1|> valid_delta = 'usage' request = self.context.get('request') if request and 'costs' in request.path: valid...
Serializer for handling cost query parameters.
OCPCostQueryParamSerializer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OCPCostQueryParamSerializer: """Serializer for handling cost query parameters.""" def validate_order_by(self, value): """Validate incoming order_by data. Args: data (Dict): data to be validated Returns: (Dict): Validated data Raises: (ValidationError): if order_by field inputs are in...
stack_v2_sparse_classes_75kplus_train_069280
8,402
permissive
[ { "docstring": "Validate incoming order_by data. Args: data (Dict): data to be validated Returns: (Dict): Validated data Raises: (ValidationError): if order_by field inputs are invalid", "name": "validate_order_by", "signature": "def validate_order_by(self, value)" }, { "docstring": "Validate in...
2
null
Implement the Python class `OCPCostQueryParamSerializer` described below. Class description: Serializer for handling cost query parameters. Method signatures and docstrings: - def validate_order_by(self, value): Validate incoming order_by data. Args: data (Dict): data to be validated Returns: (Dict): Validated data R...
Implement the Python class `OCPCostQueryParamSerializer` described below. Class description: Serializer for handling cost query parameters. Method signatures and docstrings: - def validate_order_by(self, value): Validate incoming order_by data. Args: data (Dict): data to be validated Returns: (Dict): Validated data R...
2979f03fbdd1c20c3abc365a963a1282b426f321
<|skeleton|> class OCPCostQueryParamSerializer: """Serializer for handling cost query parameters.""" def validate_order_by(self, value): """Validate incoming order_by data. Args: data (Dict): data to be validated Returns: (Dict): Validated data Raises: (ValidationError): if order_by field inputs are in...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OCPCostQueryParamSerializer: """Serializer for handling cost query parameters.""" def validate_order_by(self, value): """Validate incoming order_by data. Args: data (Dict): data to be validated Returns: (Dict): Validated data Raises: (ValidationError): if order_by field inputs are invalid""" ...
the_stack_v2_python_sparse
koku/api/report/ocp/serializers.py
luisfdez/koku
train
0
b1d217c48da1f80ffbbea6749dd6d83afb775db1
[ "include_inactive = request.args.get('include_inactive', '0') != '0'\nget_users_response = InternalApi().get(url_for('flexmeasures_api_v2_0.get_users', include_inactive=include_inactive))\nusers = [process_internal_api_response(user, make_obj=True) for user in get_users_response.json()]\nreturn render_flexmeasures_...
<|body_start_0|> include_inactive = request.args.get('include_inactive', '0') != '0' get_users_response = InternalApi().get(url_for('flexmeasures_api_v2_0.get_users', include_inactive=include_inactive)) users = [process_internal_api_response(user, make_obj=True) for user in get_users_response.js...
UserCrudUI
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserCrudUI: def index(self): """/users""" <|body_0|> def get(self, id: str): """GET from /users/<id>""" <|body_1|> def toggle_active(self, id: str): """Toggle activation status via /users/toggle_active/<id>""" <|body_2|> def reset_pa...
stack_v2_sparse_classes_75kplus_train_069281
4,885
permissive
[ { "docstring": "/users", "name": "index", "signature": "def index(self)" }, { "docstring": "GET from /users/<id>", "name": "get", "signature": "def get(self, id: str)" }, { "docstring": "Toggle activation status via /users/toggle_active/<id>", "name": "toggle_active", "si...
4
stack_v2_sparse_classes_30k_train_037940
Implement the Python class `UserCrudUI` described below. Class description: Implement the UserCrudUI class. Method signatures and docstrings: - def index(self): /users - def get(self, id: str): GET from /users/<id> - def toggle_active(self, id: str): Toggle activation status via /users/toggle_active/<id> - def reset_...
Implement the Python class `UserCrudUI` described below. Class description: Implement the UserCrudUI class. Method signatures and docstrings: - def index(self): /users - def get(self, id: str): GET from /users/<id> - def toggle_active(self, id: str): Toggle activation status via /users/toggle_active/<id> - def reset_...
6ba518bae7e9b8a715b9a05f6fae19f5e4ade791
<|skeleton|> class UserCrudUI: def index(self): """/users""" <|body_0|> def get(self, id: str): """GET from /users/<id>""" <|body_1|> def toggle_active(self, id: str): """Toggle activation status via /users/toggle_active/<id>""" <|body_2|> def reset_pa...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserCrudUI: def index(self): """/users""" include_inactive = request.args.get('include_inactive', '0') != '0' get_users_response = InternalApi().get(url_for('flexmeasures_api_v2_0.get_users', include_inactive=include_inactive)) users = [process_internal_api_response(user, make_...
the_stack_v2_python_sparse
flexmeasures/ui/crud/users.py
meeseeksmachine/flexmeasures
train
0
ceb0059d25d7aa4c8fd6106c115f0ba2f873661e
[ "Precondition.is_string(dataset_csv_file_path, 'Invalid dataset_csv_file_path')\nself.dataset_csv_file_path = dataset_csv_file_path\nself.logger = logger\nself.data_array = []\nif should_load:\n self.load(self.dataset_csv_file_path)", "if self.logger:\n self.logger.trace('Loading dataset: {0} with a delimit...
<|body_start_0|> Precondition.is_string(dataset_csv_file_path, 'Invalid dataset_csv_file_path') self.dataset_csv_file_path = dataset_csv_file_path self.logger = logger self.data_array = [] if should_load: self.load(self.dataset_csv_file_path) <|end_body_0|> <|body_st...
A class to load and access csv dataset and it's fields
CsvDataset
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CsvDataset: """A class to load and access csv dataset and it's fields""" def __init__(self, dataset_csv_file_path, logger=None, should_load=True): """Init Args: dataset_csv_file_path: absolute path to the csv file logger: shared logger (could be null) should_load: should the dataset ...
stack_v2_sparse_classes_75kplus_train_069282
2,784
no_license
[ { "docstring": "Init Args: dataset_csv_file_path: absolute path to the csv file logger: shared logger (could be null) should_load: should the dataset (default = True) Returns: None Raises: None", "name": "__init__", "signature": "def __init__(self, dataset_csv_file_path, logger=None, should_load=True)" ...
4
stack_v2_sparse_classes_30k_train_050039
Implement the Python class `CsvDataset` described below. Class description: A class to load and access csv dataset and it's fields Method signatures and docstrings: - def __init__(self, dataset_csv_file_path, logger=None, should_load=True): Init Args: dataset_csv_file_path: absolute path to the csv file logger: share...
Implement the Python class `CsvDataset` described below. Class description: A class to load and access csv dataset and it's fields Method signatures and docstrings: - def __init__(self, dataset_csv_file_path, logger=None, should_load=True): Init Args: dataset_csv_file_path: absolute path to the csv file logger: share...
d90b19eb68a599a4b6bcff3290aaba0881ebb23d
<|skeleton|> class CsvDataset: """A class to load and access csv dataset and it's fields""" def __init__(self, dataset_csv_file_path, logger=None, should_load=True): """Init Args: dataset_csv_file_path: absolute path to the csv file logger: shared logger (could be null) should_load: should the dataset ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CsvDataset: """A class to load and access csv dataset and it's fields""" def __init__(self, dataset_csv_file_path, logger=None, should_load=True): """Init Args: dataset_csv_file_path: absolute path to the csv file logger: shared logger (could be null) should_load: should the dataset (default = Tr...
the_stack_v2_python_sparse
common/dataset/csv_dataset.py
santhosh-kumar/DataScienceToolbox
train
2
4936a198b564c2680863123cb37f76b979a6b332
[ "super(Albert, self).__init__()\nself.expanddims = P.ExpandDims()\nself.cast = P.Cast()\nself.sub = P.Sub()\nself.mul = P.Mul()\nself.gather = P.Gather()\nself.add = P.Add()\nself.layernorm_1_weight = Parameter(Tensor(np.random.uniform(0, 1, (128,)).astype(np.float32)), name=None)\nself.layernorm_1_bias = Parameter...
<|body_start_0|> super(Albert, self).__init__() self.expanddims = P.ExpandDims() self.cast = P.Cast() self.sub = P.Sub() self.mul = P.Mul() self.gather = P.Gather() self.add = P.Add() self.layernorm_1_weight = Parameter(Tensor(np.random.uniform(0, 1, (128,...
Albert model for rerank
Albert
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Albert: """Albert model for rerank""" def __init__(self, batch_size): """init function""" <|body_0|> def construct(self, input_ids, attention_mask, token_type_ids): """construct function""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(Albe...
stack_v2_sparse_classes_75kplus_train_069283
12,912
permissive
[ { "docstring": "init function", "name": "__init__", "signature": "def __init__(self, batch_size)" }, { "docstring": "construct function", "name": "construct", "signature": "def construct(self, input_ids, attention_mask, token_type_ids)" } ]
2
stack_v2_sparse_classes_30k_train_024380
Implement the Python class `Albert` described below. Class description: Albert model for rerank Method signatures and docstrings: - def __init__(self, batch_size): init function - def construct(self, input_ids, attention_mask, token_type_ids): construct function
Implement the Python class `Albert` described below. Class description: Albert model for rerank Method signatures and docstrings: - def __init__(self, batch_size): init function - def construct(self, input_ids, attention_mask, token_type_ids): construct function <|skeleton|> class Albert: """Albert model for rer...
eab643f51336dbf7d711f02d27e6516e5affee59
<|skeleton|> class Albert: """Albert model for rerank""" def __init__(self, batch_size): """init function""" <|body_0|> def construct(self, input_ids, attention_mask, token_type_ids): """construct function""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Albert: """Albert model for rerank""" def __init__(self, batch_size): """init function""" super(Albert, self).__init__() self.expanddims = P.ExpandDims() self.cast = P.Cast() self.sub = P.Sub() self.mul = P.Mul() self.gather = P.Gather() sel...
the_stack_v2_python_sparse
research/nlp/tprr/src/albert.py
mindspore-ai/models
train
301
b24607c000e916e6f6618946d56e6c255bb15044
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Missing associated documentation comment in .proto file.
DualToRActiveServicer
[ "LicenseRef-scancode-generic-cla", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DualToRActiveServicer: """Missing associated documentation comment in .proto file.""" def QueryAdminForwardingPortState(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def SetAdminForwardingPortState(self, request, conte...
stack_v2_sparse_classes_75kplus_train_069284
12,711
permissive
[ { "docstring": "Missing associated documentation comment in .proto file.", "name": "QueryAdminForwardingPortState", "signature": "def QueryAdminForwardingPortState(self, request, context)" }, { "docstring": "Missing associated documentation comment in .proto file.", "name": "SetAdminForwardi...
6
stack_v2_sparse_classes_30k_train_026117
Implement the Python class `DualToRActiveServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def QueryAdminForwardingPortState(self, request, context): Missing associated documentation comment in .proto file. - def SetAdminForwardi...
Implement the Python class `DualToRActiveServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def QueryAdminForwardingPortState(self, request, context): Missing associated documentation comment in .proto file. - def SetAdminForwardi...
a86f0e5b1742d01b8d8a28a537f79bf608955695
<|skeleton|> class DualToRActiveServicer: """Missing associated documentation comment in .proto file.""" def QueryAdminForwardingPortState(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def SetAdminForwardingPortState(self, request, conte...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DualToRActiveServicer: """Missing associated documentation comment in .proto file.""" def QueryAdminForwardingPortState(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Meth...
the_stack_v2_python_sparse
ansible/dualtor/nic_simulator/nic_simulator_grpc_service_pb2_grpc.py
ramakristipati/sonic-mgmt
train
2
d160947cae3f8e94af729f6776fd10ca44d92225
[ "self.candidate_classes = candidate_classes if isinstance(candidate_classes, (list, tuple)) else [candidate_classes]\nself.throttlers = throttlers if isinstance(throttlers, (list, tuple)) else [throttlers]\nself.nested_relations = nested_relations\nself.self_relations = self_relations\nself.symmetric_relations = sy...
<|body_start_0|> self.candidate_classes = candidate_classes if isinstance(candidate_classes, (list, tuple)) else [candidate_classes] self.throttlers = throttlers if isinstance(throttlers, (list, tuple)) else [throttlers] self.nested_relations = nested_relations self.self_relations = self...
UDF for performing candidate extraction.
CandidateExtractorUDF
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CandidateExtractorUDF: """UDF for performing candidate extraction.""" def __init__(self, candidate_classes: Union[Type[Candidate], List[Type[Candidate]]], throttlers: Union[Throttler, List[Throttler]], self_relations: bool, nested_relations: bool, symmetric_relations: bool, **kwargs: Any) ->...
stack_v2_sparse_classes_75kplus_train_069285
12,265
permissive
[ { "docstring": "Initialize the CandidateExtractorUDF.", "name": "__init__", "signature": "def __init__(self, candidate_classes: Union[Type[Candidate], List[Type[Candidate]]], throttlers: Union[Throttler, List[Throttler]], self_relations: bool, nested_relations: bool, symmetric_relations: bool, **kwargs:...
2
stack_v2_sparse_classes_30k_train_017947
Implement the Python class `CandidateExtractorUDF` described below. Class description: UDF for performing candidate extraction. Method signatures and docstrings: - def __init__(self, candidate_classes: Union[Type[Candidate], List[Type[Candidate]]], throttlers: Union[Throttler, List[Throttler]], self_relations: bool, ...
Implement the Python class `CandidateExtractorUDF` described below. Class description: UDF for performing candidate extraction. Method signatures and docstrings: - def __init__(self, candidate_classes: Union[Type[Candidate], List[Type[Candidate]]], throttlers: Union[Throttler, List[Throttler]], self_relations: bool, ...
e857285867f01536192524a195b02cbffe40c4b2
<|skeleton|> class CandidateExtractorUDF: """UDF for performing candidate extraction.""" def __init__(self, candidate_classes: Union[Type[Candidate], List[Type[Candidate]]], throttlers: Union[Throttler, List[Throttler]], self_relations: bool, nested_relations: bool, symmetric_relations: bool, **kwargs: Any) ->...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CandidateExtractorUDF: """UDF for performing candidate extraction.""" def __init__(self, candidate_classes: Union[Type[Candidate], List[Type[Candidate]]], throttlers: Union[Throttler, List[Throttler]], self_relations: bool, nested_relations: bool, symmetric_relations: bool, **kwargs: Any) -> None: ...
the_stack_v2_python_sparse
src/fonduer/candidates/candidates.py
HiromuHota/fonduer
train
0
5b1951ca4052c764fabe5b2de4fc4aef32f6bd68
[ "if n == 1:\n return '1'\nif n == 2:\n return '11'\nresult = '11'\nflag = 2\nwhile flag < n:\n result = self.count(result)\n flag += 1\nreturn result", "index = []\ncount = []\nindex.append(input[0])\ncount.append(1)\nfor i in range(1, len(input)):\n if input[i] == input[i - 1]:\n count[-1] ...
<|body_start_0|> if n == 1: return '1' if n == 2: return '11' result = '11' flag = 2 while flag < n: result = self.count(result) flag += 1 return result <|end_body_0|> <|body_start_1|> index = [] count = [] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countAndSay(self, n: int) -> str: """主函数,控制遍历描述函数的次数 :param n: :return:""" <|body_0|> def count(self, input): """对上一次结果描述的函数 :param input: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n == 1: return '1' ...
stack_v2_sparse_classes_75kplus_train_069286
2,116
no_license
[ { "docstring": "主函数,控制遍历描述函数的次数 :param n: :return:", "name": "countAndSay", "signature": "def countAndSay(self, n: int) -> str" }, { "docstring": "对上一次结果描述的函数 :param input: :return:", "name": "count", "signature": "def count(self, input)" } ]
2
stack_v2_sparse_classes_30k_test_002764
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countAndSay(self, n: int) -> str: 主函数,控制遍历描述函数的次数 :param n: :return: - def count(self, input): 对上一次结果描述的函数 :param input: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countAndSay(self, n: int) -> str: 主函数,控制遍历描述函数的次数 :param n: :return: - def count(self, input): 对上一次结果描述的函数 :param input: :return: <|skeleton|> class Solution: def count...
fa45cd44c3d4e7b0205833efcdc708d1638cbbe4
<|skeleton|> class Solution: def countAndSay(self, n: int) -> str: """主函数,控制遍历描述函数的次数 :param n: :return:""" <|body_0|> def count(self, input): """对上一次结果描述的函数 :param input: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def countAndSay(self, n: int) -> str: """主函数,控制遍历描述函数的次数 :param n: :return:""" if n == 1: return '1' if n == 2: return '11' result = '11' flag = 2 while flag < n: result = self.count(result) flag += 1 ...
the_stack_v2_python_sparse
Python/t38.py
g-lyc/LeetCode
train
15
03ec0f020726295e01791edcdb7fe6a72f38cc03
[ "self.head = head\nc = head\nlength = 0\nwhile c:\n length += 1\n c = c.next\nself.length = length", "c = self.head\nrand_index = randrange(0, self.length)\nwhile rand_index:\n c = c.next\n rand_index -= 1\nreturn c.val" ]
<|body_start_0|> self.head = head c = head length = 0 while c: length += 1 c = c.next self.length = length <|end_body_0|> <|body_start_1|> c = self.head rand_index = randrange(0, self.length) while rand_index: c = c.nex...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, head): """@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode""" <|body_0|> def getRandom(self): """Returns a random node's value. :rtype: int""" ...
stack_v2_sparse_classes_75kplus_train_069287
1,038
no_license
[ { "docstring": "@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode", "name": "__init__", "signature": "def __init__(self, head)" }, { "docstring": "Returns a random node's value. :rtype: int", "name": "g...
2
stack_v2_sparse_classes_30k_train_022923
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, head): @param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode - def getRan...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, head): @param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode - def getRan...
97533d53c8892b6519e99f344489fa4fd4c9ab93
<|skeleton|> class Solution: def __init__(self, head): """@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode""" <|body_0|> def getRandom(self): """Returns a random node's value. :rtype: int""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def __init__(self, head): """@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode""" self.head = head c = head length = 0 while c: length += 1 c = c....
the_stack_v2_python_sparse
12. ReserviorSampling/382.py
proTao/leetcode
train
0
87afac5d563560c732ee67f5a3bdb97735b196f8
[ "self.batch_size = 0\nself.games = np.asarray([])\nself.max_steps = game_config.game.duration * game_config.game.fps\nself.game_config = game_config\nself.pop_config = pop_config", "genome_id, genome = genome\nstates = np.asarray([g.reset()[D_SENSOR_LIST] for g in self.games])\nfinished = np.repeat(False, self.ba...
<|body_start_0|> self.batch_size = 0 self.games = np.asarray([]) self.max_steps = game_config.game.duration * game_config.game.fps self.game_config = game_config self.pop_config = pop_config <|end_body_0|> <|body_start_1|> genome_id, genome = genome states = np.a...
This class provides an environment to evaluate a single genome on multiple games.
MultiEnvironment
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiEnvironment: """This class provides an environment to evaluate a single genome on multiple games.""" def __init__(self, game_config: Config, pop_config: Config): """Create an environment in which the genomes get evaluated across different games. :param game_config: Config file f...
stack_v2_sparse_classes_75kplus_train_069288
7,283
permissive
[ { "docstring": "Create an environment in which the genomes get evaluated across different games. :param game_config: Config file for game-creation :param pop_config: Config file specifying how genome's network will be made", "name": "__init__", "signature": "def __init__(self, game_config: Config, pop_c...
4
stack_v2_sparse_classes_30k_train_054331
Implement the Python class `MultiEnvironment` described below. Class description: This class provides an environment to evaluate a single genome on multiple games. Method signatures and docstrings: - def __init__(self, game_config: Config, pop_config: Config): Create an environment in which the genomes get evaluated ...
Implement the Python class `MultiEnvironment` described below. Class description: This class provides an environment to evaluate a single genome on multiple games. Method signatures and docstrings: - def __init__(self, game_config: Config, pop_config: Config): Create an environment in which the genomes get evaluated ...
818a4ce941536611c0f1780f7c4a6238f0e1884e
<|skeleton|> class MultiEnvironment: """This class provides an environment to evaluate a single genome on multiple games.""" def __init__(self, game_config: Config, pop_config: Config): """Create an environment in which the genomes get evaluated across different games. :param game_config: Config file f...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MultiEnvironment: """This class provides an environment to evaluate a single genome on multiple games.""" def __init__(self, game_config: Config, pop_config: Config): """Create an environment in which the genomes get evaluated across different games. :param game_config: Config file for game-creat...
the_stack_v2_python_sparse
environment/env_multi.py
RubenPants/EvolvableRNN
train
1
dd1f7203f1b2a149d773c5488bb6726d1bd17e7e
[ "super(IntermediateClassifier, self).__init__()\nself.num_channels = num_channels\nself.num_classes = num_classes\nself.device = 'cuda'\nkernel_size = global_pooling_size\nself.features = nn.Sequential(nn.AvgPool2d(kernel_size=(kernel_size, kernel_size)), nn.Dropout(p=0.2, inplace=False)).to(self.device)\nself.clas...
<|body_start_0|> super(IntermediateClassifier, self).__init__() self.num_channels = num_channels self.num_classes = num_classes self.device = 'cuda' kernel_size = global_pooling_size self.features = nn.Sequential(nn.AvgPool2d(kernel_size=(kernel_size, kernel_size)), nn.Dr...
IntermediateClassifier
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IntermediateClassifier: def __init__(self, global_pooling_size, num_channels, num_classes): """Classifier of a cifar10/100 image. :param num_channels: Number of input channels to the classifier :param num_classes: Number of classes to classify""" <|body_0|> def forward(self,...
stack_v2_sparse_classes_75kplus_train_069289
9,744
no_license
[ { "docstring": "Classifier of a cifar10/100 image. :param num_channels: Number of input channels to the classifier :param num_classes: Number of classes to classify", "name": "__init__", "signature": "def __init__(self, global_pooling_size, num_channels, num_classes)" }, { "docstring": "Drive fe...
2
null
Implement the Python class `IntermediateClassifier` described below. Class description: Implement the IntermediateClassifier class. Method signatures and docstrings: - def __init__(self, global_pooling_size, num_channels, num_classes): Classifier of a cifar10/100 image. :param num_channels: Number of input channels t...
Implement the Python class `IntermediateClassifier` described below. Class description: Implement the IntermediateClassifier class. Method signatures and docstrings: - def __init__(self, global_pooling_size, num_channels, num_classes): Classifier of a cifar10/100 image. :param num_channels: Number of input channels t...
fd5d3595129140e36411f7abc055b30b233da653
<|skeleton|> class IntermediateClassifier: def __init__(self, global_pooling_size, num_channels, num_classes): """Classifier of a cifar10/100 image. :param num_channels: Number of input channels to the classifier :param num_classes: Number of classes to classify""" <|body_0|> def forward(self,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IntermediateClassifier: def __init__(self, global_pooling_size, num_channels, num_classes): """Classifier of a cifar10/100 image. :param num_channels: Number of input channels to the classifier :param num_classes: Number of classes to classify""" super(IntermediateClassifier, self).__init__() ...
the_stack_v2_python_sparse
models/Elastic_SqueezeNet.py
essdev24/elastic-neural-networks-for-classification
train
0
51736f0c2ce8961e02cc2cf06318e6f0903acfad
[ "import apache_beam as beam\nfrom google.datalab.utils import LambdaJob\nfrom . import _preprocess\nif checkpoint is None:\n checkpoint = _util._DEFAULT_CHECKPOINT_GSURL\njob_id = 'preprocess-image-classification-' + datetime.datetime.now().strftime('%y%m%d-%H%M%S')\noptions = {'project': _util.default_project()...
<|body_start_0|> import apache_beam as beam from google.datalab.utils import LambdaJob from . import _preprocess if checkpoint is None: checkpoint = _util._DEFAULT_CHECKPOINT_GSURL job_id = 'preprocess-image-classification-' + datetime.datetime.now().strftime('%y%m%d-...
Class for local training, preprocessing and prediction.
Local
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Local: """Class for local training, preprocessing and prediction.""" def preprocess(train_dataset, output_dir, eval_dataset, checkpoint): """Preprocess data locally.""" <|body_0|> def train(input_dir, batch_size, max_steps, output_dir, checkpoint): """Train model...
stack_v2_sparse_classes_75kplus_train_069290
3,681
permissive
[ { "docstring": "Preprocess data locally.", "name": "preprocess", "signature": "def preprocess(train_dataset, output_dir, eval_dataset, checkpoint)" }, { "docstring": "Train model locally.", "name": "train", "signature": "def train(input_dir, batch_size, max_steps, output_dir, checkpoint)...
4
stack_v2_sparse_classes_30k_train_053668
Implement the Python class `Local` described below. Class description: Class for local training, preprocessing and prediction. Method signatures and docstrings: - def preprocess(train_dataset, output_dir, eval_dataset, checkpoint): Preprocess data locally. - def train(input_dir, batch_size, max_steps, output_dir, che...
Implement the Python class `Local` described below. Class description: Class for local training, preprocessing and prediction. Method signatures and docstrings: - def preprocess(train_dataset, output_dir, eval_dataset, checkpoint): Preprocess data locally. - def train(input_dir, batch_size, max_steps, output_dir, che...
8bf007da3e43096aa3a3dca158fc56b286ba6f5c
<|skeleton|> class Local: """Class for local training, preprocessing and prediction.""" def preprocess(train_dataset, output_dir, eval_dataset, checkpoint): """Preprocess data locally.""" <|body_0|> def train(input_dir, batch_size, max_steps, output_dir, checkpoint): """Train model...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Local: """Class for local training, preprocessing and prediction.""" def preprocess(train_dataset, output_dir, eval_dataset, checkpoint): """Preprocess data locally.""" import apache_beam as beam from google.datalab.utils import LambdaJob from . import _preprocess ...
the_stack_v2_python_sparse
solutionbox/image_classification/mltoolbox/image/classification/_local.py
googledatalab/pydatalab
train
200
ba6cf20004e4b9c543a487e4bc16c4dbd5b57dbd
[ "def cal(s1: str, s2: str) -> int:\n res = 0\n curSum, curSumWithS2 = (0, -int(1e+18))\n for char in s:\n if char == s1:\n curSum += 1\n curSumWithS2 += 1\n elif char == s2:\n curSum -= 1\n curSumWithS2 = curSum\n if curSum < 0:\n ...
<|body_start_0|> def cal(s1: str, s2: str) -> int: res = 0 curSum, curSumWithS2 = (0, -int(1e+18)) for char in s: if char == s1: curSum += 1 curSumWithS2 += 1 elif char == s2: curSum -...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def largestVariance(self, s: str) -> int: """时间复杂度O(26*26*n)""" <|body_0|> def largestVariance2(self, s: str) -> int: """时间复杂度O(26*n)""" <|body_1|> <|end_skeleton|> <|body_start_0|> def cal(s1: str, s2: str) -> int: res = 0 ...
stack_v2_sparse_classes_75kplus_train_069291
2,204
no_license
[ { "docstring": "时间复杂度O(26*26*n)", "name": "largestVariance", "signature": "def largestVariance(self, s: str) -> int" }, { "docstring": "时间复杂度O(26*n)", "name": "largestVariance2", "signature": "def largestVariance2(self, s: str) -> int" } ]
2
stack_v2_sparse_classes_30k_train_000867
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestVariance(self, s: str) -> int: 时间复杂度O(26*26*n) - def largestVariance2(self, s: str) -> int: 时间复杂度O(26*n)
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestVariance(self, s: str) -> int: 时间复杂度O(26*26*n) - def largestVariance2(self, s: str) -> int: 时间复杂度O(26*n) <|skeleton|> class Solution: def largestVariance(self, s...
7e79e26bb8f641868561b186e34c1127ed63c9e0
<|skeleton|> class Solution: def largestVariance(self, s: str) -> int: """时间复杂度O(26*26*n)""" <|body_0|> def largestVariance2(self, s: str) -> int: """时间复杂度O(26*n)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def largestVariance(self, s: str) -> int: """时间复杂度O(26*26*n)""" def cal(s1: str, s2: str) -> int: res = 0 curSum, curSumWithS2 = (0, -int(1e+18)) for char in s: if char == s1: curSum += 1 curS...
the_stack_v2_python_sparse
11_动态规划/子数组/最大子数组和/6069. 最大波动的子字符串-kanade.py
981377660LMT/algorithm-study
train
225
924db1e689a1e67ca2cd0b7a1e9b1ce183cdb833
[ "create_l7policy_flow = linear_flow.Flow(constants.CREATE_L7POLICY_FLOW)\ncreate_l7policy_flow.add(lifecycle_tasks.L7PolicyToErrorOnRevertTask(requires=[constants.L7POLICY, constants.LISTENERS, constants.LOADBALANCER_ID]))\ncreate_l7policy_flow.add(database_tasks.MarkL7PolicyPendingCreateInDB(requires=constants.L7P...
<|body_start_0|> create_l7policy_flow = linear_flow.Flow(constants.CREATE_L7POLICY_FLOW) create_l7policy_flow.add(lifecycle_tasks.L7PolicyToErrorOnRevertTask(requires=[constants.L7POLICY, constants.LISTENERS, constants.LOADBALANCER_ID])) create_l7policy_flow.add(database_tasks.MarkL7PolicyPendin...
L7PolicyFlows
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class L7PolicyFlows: def get_create_l7policy_flow(self): """Create a flow to create an L7 policy :returns: The flow for creating an L7 policy""" <|body_0|> def get_delete_l7policy_flow(self): """Create a flow to delete an L7 policy :returns: The flow for deleting an L7 pol...
stack_v2_sparse_classes_75kplus_train_069292
4,109
permissive
[ { "docstring": "Create a flow to create an L7 policy :returns: The flow for creating an L7 policy", "name": "get_create_l7policy_flow", "signature": "def get_create_l7policy_flow(self)" }, { "docstring": "Create a flow to delete an L7 policy :returns: The flow for deleting an L7 policy", "na...
3
stack_v2_sparse_classes_30k_train_011593
Implement the Python class `L7PolicyFlows` described below. Class description: Implement the L7PolicyFlows class. Method signatures and docstrings: - def get_create_l7policy_flow(self): Create a flow to create an L7 policy :returns: The flow for creating an L7 policy - def get_delete_l7policy_flow(self): Create a flo...
Implement the Python class `L7PolicyFlows` described below. Class description: Implement the L7PolicyFlows class. Method signatures and docstrings: - def get_create_l7policy_flow(self): Create a flow to create an L7 policy :returns: The flow for creating an L7 policy - def get_delete_l7policy_flow(self): Create a flo...
0426285a41464a5015494584f109eed35a0d44db
<|skeleton|> class L7PolicyFlows: def get_create_l7policy_flow(self): """Create a flow to create an L7 policy :returns: The flow for creating an L7 policy""" <|body_0|> def get_delete_l7policy_flow(self): """Create a flow to delete an L7 policy :returns: The flow for deleting an L7 pol...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class L7PolicyFlows: def get_create_l7policy_flow(self): """Create a flow to create an L7 policy :returns: The flow for creating an L7 policy""" create_l7policy_flow = linear_flow.Flow(constants.CREATE_L7POLICY_FLOW) create_l7policy_flow.add(lifecycle_tasks.L7PolicyToErrorOnRevertTask(requir...
the_stack_v2_python_sparse
octavia/controller/worker/v2/flows/l7policy_flows.py
openstack/octavia
train
147
076f9b66354cf8d6be88c56dea6d576c8271042e
[ "self.stack = []\nself.l = nestedList\nself.i = 0", "if self.hasNext():\n v = self.l[self.i]\n self.i += 1\n return v.getInteger()\nelse:\n return None", "while True:\n while self.i == len(self.l):\n if self.stack:\n self.l, self.i = self.stack.pop()\n self.i += 1\n ...
<|body_start_0|> self.stack = [] self.l = nestedList self.i = 0 <|end_body_0|> <|body_start_1|> if self.hasNext(): v = self.l[self.i] self.i += 1 return v.getInteger() else: return None <|end_body_1|> <|body_start_2|> whil...
NestedIterator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NestedIterator: def __init__(self, nestedList): """Initialize your data structure here. :type nestedList: List[NestedInteger]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|e...
stack_v2_sparse_classes_75kplus_train_069293
2,819
no_license
[ { "docstring": "Initialize your data structure here. :type nestedList: List[NestedInteger]", "name": "__init__", "signature": "def __init__(self, nestedList)" }, { "docstring": ":rtype: int", "name": "next", "signature": "def next(self)" }, { "docstring": ":rtype: bool", "nam...
3
stack_v2_sparse_classes_30k_train_049253
Implement the Python class `NestedIterator` described below. Class description: Implement the NestedIterator class. Method signatures and docstrings: - def __init__(self, nestedList): Initialize your data structure here. :type nestedList: List[NestedInteger] - def next(self): :rtype: int - def hasNext(self): :rtype: ...
Implement the Python class `NestedIterator` described below. Class description: Implement the NestedIterator class. Method signatures and docstrings: - def __init__(self, nestedList): Initialize your data structure here. :type nestedList: List[NestedInteger] - def next(self): :rtype: int - def hasNext(self): :rtype: ...
d6b9f07e2d1437681fa77fee0687ea9b83cab135
<|skeleton|> class NestedIterator: def __init__(self, nestedList): """Initialize your data structure here. :type nestedList: List[NestedInteger]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|e...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NestedIterator: def __init__(self, nestedList): """Initialize your data structure here. :type nestedList: List[NestedInteger]""" self.stack = [] self.l = nestedList self.i = 0 def next(self): """:rtype: int""" if self.hasNext(): v = self.l[self....
the_stack_v2_python_sparse
python/algorithm/leetcode/341.py
yanxurui/keepcoding
train
1
fe85a295c6a01d1ba18c185bd8bf8ce9b3b37003
[ "from nestedworld_api.db import UserFriend as DbUserFriend\nfriends = DbUserFriend.query.filter(DbUserFriend.user_id == current_session.user.id).all()\nreturn friends", "from nestedworld_api.db import db\nfrom nestedworld_api.db import User as DbUser\nfrom nestedworld_api.db import UserFriend as DbUserFriend\nfri...
<|body_start_0|> from nestedworld_api.db import UserFriend as DbUserFriend friends = DbUserFriend.query.filter(DbUserFriend.user_id == current_session.user.id).all() return friends <|end_body_0|> <|body_start_1|> from nestedworld_api.db import db from nestedworld_api.db import U...
UserFriends
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserFriends: def get(self): """Retrieve current user's friends list. This request is used by a user for retrieve his own friends list.""" <|body_0|> def post(self, data): """Add an user in to current user's friends list This request is used by a user for create a lin...
stack_v2_sparse_classes_75kplus_train_069294
3,764
no_license
[ { "docstring": "Retrieve current user's friends list. This request is used by a user for retrieve his own friends list.", "name": "get", "signature": "def get(self)" }, { "docstring": "Add an user in to current user's friends list This request is used by a user for create a link between him and ...
2
null
Implement the Python class `UserFriends` described below. Class description: Implement the UserFriends class. Method signatures and docstrings: - def get(self): Retrieve current user's friends list. This request is used by a user for retrieve his own friends list. - def post(self, data): Add an user in to current use...
Implement the Python class `UserFriends` described below. Class description: Implement the UserFriends class. Method signatures and docstrings: - def get(self): Retrieve current user's friends list. This request is used by a user for retrieve his own friends list. - def post(self, data): Add an user in to current use...
af2262742b04c823d2cf6e0fa40fa0fc6456671e
<|skeleton|> class UserFriends: def get(self): """Retrieve current user's friends list. This request is used by a user for retrieve his own friends list.""" <|body_0|> def post(self, data): """Add an user in to current user's friends list This request is used by a user for create a lin...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserFriends: def get(self): """Retrieve current user's friends list. This request is used by a user for retrieve his own friends list.""" from nestedworld_api.db import UserFriend as DbUserFriend friends = DbUserFriend.query.filter(DbUserFriend.user_id == current_session.user.id).all()...
the_stack_v2_python_sparse
nestedworld_api/views/api/v1/user/friends.py
NestedWorld/NestedWorld-Server-API
train
1
007bb8e3830951b43655a4d04d853741e20b540d
[ "GaussianClassifier.train(self, trainingData)\ncovariance = numpy.zeros(self.classes[0].stats.cov.shape, numpy.float)\nnsamples = np.sum((cl.stats.nsamples for cl in self.classes))\nfor cl in self.classes:\n covariance += cl.stats.nsamples / float(nsamples) * cl.stats.cov\nself.background = GaussianStats(cov=cov...
<|body_start_0|> GaussianClassifier.train(self, trainingData) covariance = numpy.zeros(self.classes[0].stats.cov.shape, numpy.float) nsamples = np.sum((cl.stats.nsamples for cl in self.classes)) for cl in self.classes: covariance += cl.stats.nsamples / float(nsamples) * cl.st...
A Classifier using Mahalanobis distance for class discrimination
MahalanobisDistanceClassifier
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MahalanobisDistanceClassifier: """A Classifier using Mahalanobis distance for class discrimination""" def train(self, trainingData): """Trains the classifier on the given training data. Arguments: `trainingData` (:class:`~spectral.algorithms.TrainingClassSet`): Data for the training ...
stack_v2_sparse_classes_75kplus_train_069295
16,400
permissive
[ { "docstring": "Trains the classifier on the given training data. Arguments: `trainingData` (:class:`~spectral.algorithms.TrainingClassSet`): Data for the training classes.", "name": "train", "signature": "def train(self, trainingData)" }, { "docstring": "Classifies a pixel into one of the train...
3
stack_v2_sparse_classes_30k_train_043963
Implement the Python class `MahalanobisDistanceClassifier` described below. Class description: A Classifier using Mahalanobis distance for class discrimination Method signatures and docstrings: - def train(self, trainingData): Trains the classifier on the given training data. Arguments: `trainingData` (:class:`~spect...
Implement the Python class `MahalanobisDistanceClassifier` described below. Class description: A Classifier using Mahalanobis distance for class discrimination Method signatures and docstrings: - def train(self, trainingData): Trains the classifier on the given training data. Arguments: `trainingData` (:class:`~spect...
0659ee71614455d99a80ffd4f5f5edd8d032608c
<|skeleton|> class MahalanobisDistanceClassifier: """A Classifier using Mahalanobis distance for class discrimination""" def train(self, trainingData): """Trains the classifier on the given training data. Arguments: `trainingData` (:class:`~spectral.algorithms.TrainingClassSet`): Data for the training ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MahalanobisDistanceClassifier: """A Classifier using Mahalanobis distance for class discrimination""" def train(self, trainingData): """Trains the classifier on the given training data. Arguments: `trainingData` (:class:`~spectral.algorithms.TrainingClassSet`): Data for the training classes.""" ...
the_stack_v2_python_sparse
spectral/algorithms/classifiers.py
spectralpython/spectral
train
527
615c9d91e1d3a4c36cbc59cf315d8765b06bcd35
[ "View.__init__(self, *args, **kwargs)\nself._plot = PlotWidget()\nself.addWidget(self._plot)\nself.setTitle('PlotView')\nself._pen = {'width': 5}", "assert type(args) is dict, 'PlotView did not receive a dict while calling update.'\nassert 'xAxis' in args, 'PlotView did not receive an x-axis'\nassert 'yAxis' in a...
<|body_start_0|> View.__init__(self, *args, **kwargs) self._plot = PlotWidget() self.addWidget(self._plot) self.setTitle('PlotView') self._pen = {'width': 5} <|end_body_0|> <|body_start_1|> assert type(args) is dict, 'PlotView did not receive a dict while calling update....
classdocs
PlotView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlotView: """classdocs""" def __init__(self, *args, **kwargs): """Constructor""" <|body_0|> def update_slot(self, args): """Method called to update the plot. In this case, arguments to specify how to draw a line plot. Parameters: - args (:class:`dict`) : a `dict`...
stack_v2_sparse_classes_75kplus_train_069296
1,613
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Method called to update the plot. In this case, arguments to specify how to draw a line plot. Parameters: - args (:class:`dict`) : a `dict` with at least two fields - \"xAxis\"...
2
null
Implement the Python class `PlotView` described below. Class description: classdocs Method signatures and docstrings: - def __init__(self, *args, **kwargs): Constructor - def update_slot(self, args): Method called to update the plot. In this case, arguments to specify how to draw a line plot. Parameters: - args (:cla...
Implement the Python class `PlotView` described below. Class description: classdocs Method signatures and docstrings: - def __init__(self, *args, **kwargs): Constructor - def update_slot(self, args): Method called to update the plot. In this case, arguments to specify how to draw a line plot. Parameters: - args (:cla...
520f2ed49d381e8d64d7b433e40a2fb42bff85e8
<|skeleton|> class PlotView: """classdocs""" def __init__(self, *args, **kwargs): """Constructor""" <|body_0|> def update_slot(self, args): """Method called to update the plot. In this case, arguments to specify how to draw a line plot. Parameters: - args (:class:`dict`) : a `dict`...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PlotView: """classdocs""" def __init__(self, *args, **kwargs): """Constructor""" View.__init__(self, *args, **kwargs) self._plot = PlotWidget() self.addWidget(self._plot) self.setTitle('PlotView') self._pen = {'width': 5} def update_slot(self, args): ...
the_stack_v2_python_sparse
src/app/views/PlotView.py
JordanKoeller/MirageOld
train
0
ad115ebc46a0ddff71fcdee2a880a1e7fbe05c72
[ "component_spc = kwargs['spc'] if 'spc' in kwargs else spc.SPC\nobject.iqObject.__init__(self, parent=parent, resource=resource, spc=component_spc, context=context)\ndb_engine_choice.iqDBEngineChoiceManager.__init__(self, *args, **kwargs)", "filename = self.getAttribute('filename')\nif filename is None:\n file...
<|body_start_0|> component_spc = kwargs['spc'] if 'spc' in kwargs else spc.SPC object.iqObject.__init__(self, parent=parent, resource=resource, spc=component_spc, context=context) db_engine_choice.iqDBEngineChoiceManager.__init__(self, *args, **kwargs) <|end_body_0|> <|body_start_1|> fi...
Data engine choice component.
iqDataEngineChoice
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class iqDataEngineChoice: """Data engine choice component.""" def __init__(self, parent=None, resource=None, context=None, *args, **kwargs): """Standard component constructor. :param parent: Parent object. :param resource: Object resource dictionary. :param context: Context dictionary.""" ...
stack_v2_sparse_classes_75kplus_train_069297
1,209
no_license
[ { "docstring": "Standard component constructor. :param parent: Parent object. :param resource: Object resource dictionary. :param context: Context dictionary.", "name": "__init__", "signature": "def __init__(self, parent=None, resource=None, context=None, *args, **kwargs)" }, { "docstring": "Get...
2
null
Implement the Python class `iqDataEngineChoice` described below. Class description: Data engine choice component. Method signatures and docstrings: - def __init__(self, parent=None, resource=None, context=None, *args, **kwargs): Standard component constructor. :param parent: Parent object. :param resource: Object res...
Implement the Python class `iqDataEngineChoice` described below. Class description: Data engine choice component. Method signatures and docstrings: - def __init__(self, parent=None, resource=None, context=None, *args, **kwargs): Standard component constructor. :param parent: Parent object. :param resource: Object res...
7550e242746cb2fb1219474463f8db21f8e3e114
<|skeleton|> class iqDataEngineChoice: """Data engine choice component.""" def __init__(self, parent=None, resource=None, context=None, *args, **kwargs): """Standard component constructor. :param parent: Parent object. :param resource: Object resource dictionary. :param context: Context dictionary.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class iqDataEngineChoice: """Data engine choice component.""" def __init__(self, parent=None, resource=None, context=None, *args, **kwargs): """Standard component constructor. :param parent: Parent object. :param resource: Object resource dictionary. :param context: Context dictionary.""" compo...
the_stack_v2_python_sparse
iq/components/data_engine_choice/component.py
XHermitOne/iq_framework
train
1
323186cdc3c6115d56a4296c6aa248023d06e0d1
[ "self.__name = '{}_{}'.format(type(self).__name__, id(self))\nself.__overlayList = overlayList\nself.__displayCtx = displayCtx\nself.__target = target\nself.__propNames = propNames\nself.__currentOverlay = None\nself.__cache = {}\nself.__overlayList.addListener('overlays', self.__name, self.__selectedOverlayChanged...
<|body_start_0|> self.__name = '{}_{}'.format(type(self).__name__, id(self)) self.__overlayList = overlayList self.__displayCtx = displayCtx self.__target = target self.__propNames = propNames self.__currentOverlay = None self.__cache = {} self.__overlayLi...
Deprecated - use :class:`fsleyes_props.PropCache` instead. A little convenience class which can be used to track and cache property values, related to each overlay in the :class:`.OverlayList`, on some :class:`.HasProperties` object. Whenever the selected overlay changes, the property values of the previously selected ...
PropCache
[ "BSD-3-Clause", "CC-BY-3.0", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PropCache: """Deprecated - use :class:`fsleyes_props.PropCache` instead. A little convenience class which can be used to track and cache property values, related to each overlay in the :class:`.OverlayList`, on some :class:`.HasProperties` object. Whenever the selected overlay changes, the proper...
stack_v2_sparse_classes_75kplus_train_069298
18,637
permissive
[ { "docstring": "Create a ``PropCache``. :arg overlayList: The :class:`.OverlayList`. :arg displayCtx: The :class:`.DisplayContext` instance. :arg target: The :class:`.HasProperties` instance containing the properties that are to be cached. :arg propNames: List containing the names of ``target`` properties to be...
5
stack_v2_sparse_classes_30k_train_039745
Implement the Python class `PropCache` described below. Class description: Deprecated - use :class:`fsleyes_props.PropCache` instead. A little convenience class which can be used to track and cache property values, related to each overlay in the :class:`.OverlayList`, on some :class:`.HasProperties` object. Whenever t...
Implement the Python class `PropCache` described below. Class description: Deprecated - use :class:`fsleyes_props.PropCache` instead. A little convenience class which can be used to track and cache property values, related to each overlay in the :class:`.OverlayList`, on some :class:`.HasProperties` object. Whenever t...
46ccb4fe2b2346eb57576247f49714032b61307a
<|skeleton|> class PropCache: """Deprecated - use :class:`fsleyes_props.PropCache` instead. A little convenience class which can be used to track and cache property values, related to each overlay in the :class:`.OverlayList`, on some :class:`.HasProperties` object. Whenever the selected overlay changes, the proper...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PropCache: """Deprecated - use :class:`fsleyes_props.PropCache` instead. A little convenience class which can be used to track and cache property values, related to each overlay in the :class:`.OverlayList`, on some :class:`.HasProperties` object. Whenever the selected overlay changes, the property values of ...
the_stack_v2_python_sparse
fsleyes/overlay.py
sanjayankur31/fsleyes
train
1
bf424c2992dfc90eaead1edb7d06a374a0ec57ee
[ "disableCSRFProtection()\nif language is None:\n language = os.environ.get('LANGUAGE') or 'en'\nregistry = getUtility(IRegistry)\nsettings = registry.forInterface(ILanguageSchema, prefix='plone')\nsettings.default_language = language", "for arg in [x for x in args if '=' in x]:\n name, value = arg.split('='...
<|body_start_0|> disableCSRFProtection() if language is None: language = os.environ.get('LANGUAGE') or 'en' registry = getUtility(IRegistry) settings = registry.forInterface(ILanguageSchema, prefix='plone') settings.default_language = language <|end_body_0|> <|body_s...
I18N
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class I18N: def set_default_language(self, language=None): """Change portal default language""" <|body_0|> def translate(self, msgid, *args, **kwargs): """Return localized string for given msgid""" <|body_1|> <|end_skeleton|> <|body_start_0|> disableCSRFP...
stack_v2_sparse_classes_75kplus_train_069299
2,068
no_license
[ { "docstring": "Change portal default language", "name": "set_default_language", "signature": "def set_default_language(self, language=None)" }, { "docstring": "Return localized string for given msgid", "name": "translate", "signature": "def translate(self, msgid, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_027234
Implement the Python class `I18N` described below. Class description: Implement the I18N class. Method signatures and docstrings: - def set_default_language(self, language=None): Change portal default language - def translate(self, msgid, *args, **kwargs): Return localized string for given msgid
Implement the Python class `I18N` described below. Class description: Implement the I18N class. Method signatures and docstrings: - def set_default_language(self, language=None): Change portal default language - def translate(self, msgid, *args, **kwargs): Return localized string for given msgid <|skeleton|> class I...
c67a08671050f3c0ed156b09b44902ad1544b382
<|skeleton|> class I18N: def set_default_language(self, language=None): """Change portal default language""" <|body_0|> def translate(self, msgid, *args, **kwargs): """Return localized string for given msgid""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class I18N: def set_default_language(self, language=None): """Change portal default language""" disableCSRFProtection() if language is None: language = os.environ.get('LANGUAGE') or 'en' registry = getUtility(IRegistry) settings = registry.forInterface(ILanguageSc...
the_stack_v2_python_sparse
src/plone/app/robotframework/i18n.py
plone/plone.app.robotframework
train
9