blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 6.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 438 7.52k | id stringlengths 40 40 | length_bytes int64 506 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.25k | prompted_full_text stringlengths 645 10.7k | revision_id stringlengths 40 40 | skeleton stringlengths 162 4.34k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | solution stringlengths 302 7.33k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
64421231438195329f6b3d7c83b251fdd2ee7800 | [
"user = request.user\ntry:\n address = Address.objects.filter()\nexcept Exception as e:\n address = None\nreturn render(request, 'user_center_site.html', {'page': 'address', 'address': address})",
"receiver = request.POST.get('receiver')\naddr = request.POST.get('addr')\nzip_code = request.POST.get('zip_cod... | <|body_start_0|>
user = request.user
try:
address = Address.objects.filter()
except Exception as e:
address = None
return render(request, 'user_center_site.html', {'page': 'address', 'address': address})
<|end_body_0|>
<|body_start_1|>
receiver = request.... | 用户中心--收货地址 | AddressView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AddressView:
"""用户中心--收货地址"""
def get(self, request):
"""显示页面"""
<|body_0|>
def post(self, request):
"""添加地址"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
user = request.user
try:
address = Address.objects.filter()
... | stack_v2_sparse_classes_36k_train_008000 | 20,631 | no_license | [
{
"docstring": "显示页面",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "添加地址",
"name": "post",
"signature": "def post(self, request)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007643 | Implement the Python class `AddressView` described below.
Class description:
用户中心--收货地址
Method signatures and docstrings:
- def get(self, request): 显示页面
- def post(self, request): 添加地址 | Implement the Python class `AddressView` described below.
Class description:
用户中心--收货地址
Method signatures and docstrings:
- def get(self, request): 显示页面
- def post(self, request): 添加地址
<|skeleton|>
class AddressView:
"""用户中心--收货地址"""
def get(self, request):
"""显示页面"""
<|body_0|>
def pos... | 206909fa8ab76de4b2aa5cabc9d76e9977809d46 | <|skeleton|>
class AddressView:
"""用户中心--收货地址"""
def get(self, request):
"""显示页面"""
<|body_0|>
def post(self, request):
"""添加地址"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AddressView:
"""用户中心--收货地址"""
def get(self, request):
"""显示页面"""
user = request.user
try:
address = Address.objects.filter()
except Exception as e:
address = None
return render(request, 'user_center_site.html', {'page': 'address', 'address':... | the_stack_v2_python_sparse | E-commerce/dailyfresh/apps/user/views.py | zxk1994/Project | train | 0 |
316dfa108cdce4290c8e67622731e61419a2f603 | [
"F = self._preprocess()\nF = librosa.util.normalize(F, axis=0)\nF = librosa.feature.stack_memory(F.T).T\nself.config['hier'] = False\nmy_bounds, my_labels, _ = main.scluster_segment(F, self.config, self.in_bound_idxs)\nest_idxs, est_labels = self._postprocess(my_bounds, my_labels)\nassert est_idxs[0] == 0 and est_i... | <|body_start_0|>
F = self._preprocess()
F = librosa.util.normalize(F, axis=0)
F = librosa.feature.stack_memory(F.T).T
self.config['hier'] = False
my_bounds, my_labels, _ = main.scluster_segment(F, self.config, self.in_bound_idxs)
est_idxs, est_labels = self._postprocess(m... | This script identifies the structure of a given track using the Variable Markov Oracle technique described here: Wang, C., Mysore, J. G., Structural Segmentation With The Variable Markov Oracle And Boundary Adjustment. Proc. of the 41st IEEE International Conference on Acoustics, Speech, and Signal Processing (ICASSP).... | Segmenter | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Segmenter:
"""This script identifies the structure of a given track using the Variable Markov Oracle technique described here: Wang, C., Mysore, J. G., Structural Segmentation With The Variable Markov Oracle And Boundary Adjustment. Proc. of the 41st IEEE International Conference on Acoustics, Sp... | stack_v2_sparse_classes_36k_train_008001 | 2,496 | permissive | [
{
"docstring": "Main process. Returns ------- est_idxs : np.array(N) Estimated indeces the segment boundaries in frame indeces. est_labels : np.array(N-1) Estimated labels for the segments.",
"name": "processFlat",
"signature": "def processFlat(self)"
},
{
"docstring": "Main process.for hierarch... | 2 | null | Implement the Python class `Segmenter` described below.
Class description:
This script identifies the structure of a given track using the Variable Markov Oracle technique described here: Wang, C., Mysore, J. G., Structural Segmentation With The Variable Markov Oracle And Boundary Adjustment. Proc. of the 41st IEEE In... | Implement the Python class `Segmenter` described below.
Class description:
This script identifies the structure of a given track using the Variable Markov Oracle technique described here: Wang, C., Mysore, J. G., Structural Segmentation With The Variable Markov Oracle And Boundary Adjustment. Proc. of the 41st IEEE In... | 5581db79499a7a2067038527c8e1f19e501395df | <|skeleton|>
class Segmenter:
"""This script identifies the structure of a given track using the Variable Markov Oracle technique described here: Wang, C., Mysore, J. G., Structural Segmentation With The Variable Markov Oracle And Boundary Adjustment. Proc. of the 41st IEEE International Conference on Acoustics, Sp... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Segmenter:
"""This script identifies the structure of a given track using the Variable Markov Oracle technique described here: Wang, C., Mysore, J. G., Structural Segmentation With The Variable Markov Oracle And Boundary Adjustment. Proc. of the 41st IEEE International Conference on Acoustics, Speech, and Sig... | the_stack_v2_python_sparse | msaf/algorithms/vmo/segmenter.py | urinieto/msaf | train | 447 |
b3798049e6c75374d536ff536dc61b318353630b | [
"ways = [1, 1]\nif n < 2:\n return ways[n]\nelse:\n for i in range(2, n + 1):\n tmp = ways[0] + ways[1]\n ways[0] = ways[1]\n ways[1] = tmp\n return ways[1]",
"ways = [1, 1]\nfor i in range(1, n):\n ways.append(ways[i] + ways[i - 1])\n'\\n\\t\\tfor i in range(2, n+1):\\n\\t\\t\\tw... | <|body_start_0|>
ways = [1, 1]
if n < 2:
return ways[n]
else:
for i in range(2, n + 1):
tmp = ways[0] + ways[1]
ways[0] = ways[1]
ways[1] = tmp
return ways[1]
<|end_body_0|>
<|body_start_1|>
ways = [1, 1... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def climbStairs1(self, n: int) -> int:
""":type prices: List[int] :rtype: int 时间复杂度:O(n), 一次遍历, 36ms beaten 99.72% 空间复杂度:O(1), 未使用额外空间, 12.8MB beaten 99.51%"""
<|body_0|>
def climbStairs2(self, n: int) -> int:
""":type prices: List[int] :rtype: int 时间复杂度:O(... | stack_v2_sparse_classes_36k_train_008002 | 1,333 | permissive | [
{
"docstring": ":type prices: List[int] :rtype: int 时间复杂度:O(n), 一次遍历, 36ms beaten 99.72% 空间复杂度:O(1), 未使用额外空间, 12.8MB beaten 99.51%",
"name": "climbStairs1",
"signature": "def climbStairs1(self, n: int) -> int"
},
{
"docstring": ":type prices: List[int] :rtype: int 时间复杂度:O(n), 一次遍历, 40ms beaten 9... | 2 | stack_v2_sparse_classes_30k_train_009929 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def climbStairs1(self, n: int) -> int: :type prices: List[int] :rtype: int 时间复杂度:O(n), 一次遍历, 36ms beaten 99.72% 空间复杂度:O(1), 未使用额外空间, 12.8MB beaten 99.51%
- def climbStairs2(self,... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def climbStairs1(self, n: int) -> int: :type prices: List[int] :rtype: int 时间复杂度:O(n), 一次遍历, 36ms beaten 99.72% 空间复杂度:O(1), 未使用额外空间, 12.8MB beaten 99.51%
- def climbStairs2(self,... | a2e5256f27dbfb23fc34119fc857cd9b00e28c03 | <|skeleton|>
class Solution:
def climbStairs1(self, n: int) -> int:
""":type prices: List[int] :rtype: int 时间复杂度:O(n), 一次遍历, 36ms beaten 99.72% 空间复杂度:O(1), 未使用额外空间, 12.8MB beaten 99.51%"""
<|body_0|>
def climbStairs2(self, n: int) -> int:
""":type prices: List[int] :rtype: int 时间复杂度:O(... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def climbStairs1(self, n: int) -> int:
""":type prices: List[int] :rtype: int 时间复杂度:O(n), 一次遍历, 36ms beaten 99.72% 空间复杂度:O(1), 未使用额外空间, 12.8MB beaten 99.51%"""
ways = [1, 1]
if n < 2:
return ways[n]
else:
for i in range(2, n + 1):
... | the_stack_v2_python_sparse | toTheMoon/leetcode_070_ClimbingStairs.py | jercas/offer66-leetcode-newcode | train | 0 | |
bdfda37b01a4fcab0b9df19e4ea6383dc1710c3e | [
"if len(s) <= 1:\n return s\ns1 = ''\ns2 = ''\nfor i in range(len(s) - 1):\n s1_max = self.max_str(s, i, i)\n s2_max = self.max_str(s, i, i + 1)\n s1 = s1 if len(s1) >= len(s1_max) else s1_max\n s2 = s2 if len(s2) >= len(s2_max) else s2_max\nreturn s1 if len(s1) > len(s2) else s2",
"while i >= 0 an... | <|body_start_0|>
if len(s) <= 1:
return s
s1 = ''
s2 = ''
for i in range(len(s) - 1):
s1_max = self.max_str(s, i, i)
s2_max = self.max_str(s, i, i + 1)
s1 = s1 if len(s1) >= len(s1_max) else s1_max
s2 = s2 if len(s2) >= len(s2_m... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def get_longest_substr1(self, s: str) -> str:
"""获取字符串中最大的子回文串 Args: s: 字符串 Returns: 最长子字符串"""
<|body_0|>
def max_str(self, s: str, i: int, j: int) -> str:
"""最大回文串 Args: s: 总字符串 i: 下标i j: 下标j Returns: 最大子字符串"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_36k_train_008003 | 1,955 | permissive | [
{
"docstring": "获取字符串中最大的子回文串 Args: s: 字符串 Returns: 最长子字符串",
"name": "get_longest_substr1",
"signature": "def get_longest_substr1(self, s: str) -> str"
},
{
"docstring": "最大回文串 Args: s: 总字符串 i: 下标i j: 下标j Returns: 最大子字符串",
"name": "max_str",
"signature": "def max_str(self, s: str, i: int... | 2 | stack_v2_sparse_classes_30k_train_007523 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def get_longest_substr1(self, s: str) -> str: 获取字符串中最大的子回文串 Args: s: 字符串 Returns: 最长子字符串
- def max_str(self, s: str, i: int, j: int) -> str: 最大回文串 Args: s: 总字符串 i: 下标i j: 下标j Ret... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def get_longest_substr1(self, s: str) -> str: 获取字符串中最大的子回文串 Args: s: 字符串 Returns: 最长子字符串
- def max_str(self, s: str, i: int, j: int) -> str: 最大回文串 Args: s: 总字符串 i: 下标i j: 下标j Ret... | 50f35eef6a0ad63173efed10df3c835b1dceaa3f | <|skeleton|>
class Solution:
def get_longest_substr1(self, s: str) -> str:
"""获取字符串中最大的子回文串 Args: s: 字符串 Returns: 最长子字符串"""
<|body_0|>
def max_str(self, s: str, i: int, j: int) -> str:
"""最大回文串 Args: s: 总字符串 i: 下标i j: 下标j Returns: 最大子字符串"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def get_longest_substr1(self, s: str) -> str:
"""获取字符串中最大的子回文串 Args: s: 字符串 Returns: 最长子字符串"""
if len(s) <= 1:
return s
s1 = ''
s2 = ''
for i in range(len(s) - 1):
s1_max = self.max_str(s, i, i)
s2_max = self.max_str(s, i, i... | the_stack_v2_python_sparse | src/leetcodepython/string/longest_palindromic_substring_5.py | zhangyu345293721/leetcode | train | 101 | |
07ed1e8e9e73708d844d91334b46547d80582c29 | [
"FlipFlopCommandMixin.__init__(self, add)\nif add:\n dsc = _(\"Add widgets to size group '%s'\") % sizegroup.name\nelse:\n dsc = _(\"Remove widgets from size group '%s'\") % sizegroup.name\nCommand.__init__(self, dsc)\nself._sizegroup = sizegroup\nself._gadgets = gadgets\nself._project = project",
"if self.... | <|body_start_0|>
FlipFlopCommandMixin.__init__(self, add)
if add:
dsc = _("Add widgets to size group '%s'") % sizegroup.name
else:
dsc = _("Remove widgets from size group '%s'") % sizegroup.name
Command.__init__(self, dsc)
self._sizegroup = sizegroup
... | Command for adding and removing sizegroup gadgets. When adding gadgets to an empty sizegroup the sizegroup will be added to the project. When the last gadgets is removed from a sizegroup the sizegroup will be removed as well. | CommandAddRemoveSizeGroupGadgets | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CommandAddRemoveSizeGroupGadgets:
"""Command for adding and removing sizegroup gadgets. When adding gadgets to an empty sizegroup the sizegroup will be added to the project. When the last gadgets is removed from a sizegroup the sizegroup will be removed as well."""
def __init__(self, sizegro... | stack_v2_sparse_classes_36k_train_008004 | 28,642 | no_license | [
{
"docstring": "Initialize the command. @param sizegroup: the sizegroup that the gadgets belong to @type sizegroup: gazpacho.sizegroup.GSizeGroup @param gadgets: the gadgets that should be added or removed @type gadgets: list (of gazpacho.gadget.Gadget) @param project: the project that the sizegroup belongs to ... | 3 | stack_v2_sparse_classes_30k_train_018416 | Implement the Python class `CommandAddRemoveSizeGroupGadgets` described below.
Class description:
Command for adding and removing sizegroup gadgets. When adding gadgets to an empty sizegroup the sizegroup will be added to the project. When the last gadgets is removed from a sizegroup the sizegroup will be removed as w... | Implement the Python class `CommandAddRemoveSizeGroupGadgets` described below.
Class description:
Command for adding and removing sizegroup gadgets. When adding gadgets to an empty sizegroup the sizegroup will be added to the project. When the last gadgets is removed from a sizegroup the sizegroup will be removed as w... | 516784f6891a99a92285314797dc12b721bceba0 | <|skeleton|>
class CommandAddRemoveSizeGroupGadgets:
"""Command for adding and removing sizegroup gadgets. When adding gadgets to an empty sizegroup the sizegroup will be added to the project. When the last gadgets is removed from a sizegroup the sizegroup will be removed as well."""
def __init__(self, sizegro... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CommandAddRemoveSizeGroupGadgets:
"""Command for adding and removing sizegroup gadgets. When adding gadgets to an empty sizegroup the sizegroup will be added to the project. When the last gadgets is removed from a sizegroup the sizegroup will be removed as well."""
def __init__(self, sizegroup, gadgets, ... | the_stack_v2_python_sparse | lib/gazpacho/sizegroupeditor.py | dsaran/packagehelper | train | 0 |
ed586ef994b83c021d83c840702200361f105b15 | [
"def maxDepth(root):\n if not root:\n return 0\n left_branch = maxDepth(root.left) + 1\n right_brance = maxDepth(root.right) + 1\n return max(left_branch, right_brance)\nif not root:\n return True\nreturn self.isBalanced(root.left) and self.isBalanced(root.right) and (abs(maxDepth(root.left) -... | <|body_start_0|>
def maxDepth(root):
if not root:
return 0
left_branch = maxDepth(root.left) + 1
right_brance = maxDepth(root.right) + 1
return max(left_branch, right_brance)
if not root:
return True
return self.isBalanc... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isBalanced(self, root):
"""方法一:自顶向下的递归 time O(n^2) space O(n) 空间复杂度主要取决于递归调用的层数,递归调用的层数不会超过 n :type root: TreeNode :rtype: bool"""
<|body_0|>
def isBalanced_1(self, root):
"""方法二:自底向上的递归 自底向上递归的做法类似于后序遍历,对于当前遍历到的节点,先递归地判断其左右子树是否平衡,再判断以当前节点为根的子树是否平衡。如果一棵... | stack_v2_sparse_classes_36k_train_008005 | 1,872 | no_license | [
{
"docstring": "方法一:自顶向下的递归 time O(n^2) space O(n) 空间复杂度主要取决于递归调用的层数,递归调用的层数不会超过 n :type root: TreeNode :rtype: bool",
"name": "isBalanced",
"signature": "def isBalanced(self, root)"
},
{
"docstring": "方法二:自底向上的递归 自底向上递归的做法类似于后序遍历,对于当前遍历到的节点,先递归地判断其左右子树是否平衡,再判断以当前节点为根的子树是否平衡。如果一棵子树 是平衡的,则返回其高度(高... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isBalanced(self, root): 方法一:自顶向下的递归 time O(n^2) space O(n) 空间复杂度主要取决于递归调用的层数,递归调用的层数不会超过 n :type root: TreeNode :rtype: bool
- def isBalanced_1(self, root): 方法二:自底向上的递归 自底向上递... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isBalanced(self, root): 方法一:自顶向下的递归 time O(n^2) space O(n) 空间复杂度主要取决于递归调用的层数,递归调用的层数不会超过 n :type root: TreeNode :rtype: bool
- def isBalanced_1(self, root): 方法二:自底向上的递归 自底向上递... | 85f71621c54f6b0029f3a2746f022f89dd7419d9 | <|skeleton|>
class Solution:
def isBalanced(self, root):
"""方法一:自顶向下的递归 time O(n^2) space O(n) 空间复杂度主要取决于递归调用的层数,递归调用的层数不会超过 n :type root: TreeNode :rtype: bool"""
<|body_0|>
def isBalanced_1(self, root):
"""方法二:自底向上的递归 自底向上递归的做法类似于后序遍历,对于当前遍历到的节点,先递归地判断其左右子树是否平衡,再判断以当前节点为根的子树是否平衡。如果一棵... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def isBalanced(self, root):
"""方法一:自顶向下的递归 time O(n^2) space O(n) 空间复杂度主要取决于递归调用的层数,递归调用的层数不会超过 n :type root: TreeNode :rtype: bool"""
def maxDepth(root):
if not root:
return 0
left_branch = maxDepth(root.left) + 1
right_brance = ma... | the_stack_v2_python_sparse | LeetCode/Tree/110_balanced_binary_tree.py | XyK0907/for_work | train | 0 | |
fe0926ccd4252577d0c0192fb2493657c875cd1f | [
"memo = [[-1] * len(grid[0]) for _ in range(len(grid))]\nmemo[0][0] = grid[0][0]\nfor j in range(1, len(grid[0])):\n memo[0][j] = memo[0][j - 1] + grid[0][j]\nfor i in range(1, len(grid)):\n memo[i][0] = memo[i - 1][0] + grid[i][0]\n\ndef short_to(i, j):\n if memo[i][j] >= 0:\n return memo[i][j]\n ... | <|body_start_0|>
memo = [[-1] * len(grid[0]) for _ in range(len(grid))]
memo[0][0] = grid[0][0]
for j in range(1, len(grid[0])):
memo[0][j] = memo[0][j - 1] + grid[0][j]
for i in range(1, len(grid)):
memo[i][0] = memo[i - 1][0] + grid[i][0]
def short_to(i... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minPathSum(self, grid):
"""Dec 28, 2017 19:42"""
<|body_0|>
def minPathSum(self, grid: List[List[int]]) -> int:
"""Apr 23, 2023 21:34"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
memo = [[-1] * len(grid[0]) for _ in range(len(grid))... | stack_v2_sparse_classes_36k_train_008006 | 2,037 | no_license | [
{
"docstring": "Dec 28, 2017 19:42",
"name": "minPathSum",
"signature": "def minPathSum(self, grid)"
},
{
"docstring": "Apr 23, 2023 21:34",
"name": "minPathSum",
"signature": "def minPathSum(self, grid: List[List[int]]) -> int"
}
] | 2 | stack_v2_sparse_classes_30k_train_014024 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minPathSum(self, grid): Dec 28, 2017 19:42
- def minPathSum(self, grid: List[List[int]]) -> int: Apr 23, 2023 21:34 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minPathSum(self, grid): Dec 28, 2017 19:42
- def minPathSum(self, grid: List[List[int]]) -> int: Apr 23, 2023 21:34
<|skeleton|>
class Solution:
def minPathSum(self, gr... | 1389a009a02e90e8700a7a00e0b7f797c129cdf4 | <|skeleton|>
class Solution:
def minPathSum(self, grid):
"""Dec 28, 2017 19:42"""
<|body_0|>
def minPathSum(self, grid: List[List[int]]) -> int:
"""Apr 23, 2023 21:34"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def minPathSum(self, grid):
"""Dec 28, 2017 19:42"""
memo = [[-1] * len(grid[0]) for _ in range(len(grid))]
memo[0][0] = grid[0][0]
for j in range(1, len(grid[0])):
memo[0][j] = memo[0][j - 1] + grid[0][j]
for i in range(1, len(grid)):
... | the_stack_v2_python_sparse | leetcode/solved/64_Minimum_Path_Sum/solution.py | sungminoh/algorithms | train | 0 | |
a8333756ca8a2856aefe89a4af6986e9dc3f0845 | [
"super().__init__(config)\nself.kg_start_idx = kg_start_idx\nself.prot_start_idx = prot_start_idx\nself.text_decoder = nn.Linear(config.hidden_size, config.lm_vocab_size, bias=False)\nself.entity_decoder = nn.Linear(config.hidden_size, config.kg_vocab_size, bias=False)\nself.prot_decoder = nn.Linear(config.hidden_s... | <|body_start_0|>
super().__init__(config)
self.kg_start_idx = kg_start_idx
self.prot_start_idx = prot_start_idx
self.text_decoder = nn.Linear(config.hidden_size, config.lm_vocab_size, bias=False)
self.entity_decoder = nn.Linear(config.hidden_size, config.kg_vocab_size, bias=False... | Custom masked protein, entity and language modeling (PELM) head for proteins, entities and text tokens. | ProtSTonKGsPELMPredictionHead | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProtSTonKGsPELMPredictionHead:
"""Custom masked protein, entity and language modeling (PELM) head for proteins, entities and text tokens."""
def __init__(self, config, kg_start_idx: int=768, prot_start_idx: int=1024):
"""Initialize the ELM head based on the (hyper)parameters in the p... | stack_v2_sparse_classes_36k_train_008007 | 17,026 | permissive | [
{
"docstring": "Initialize the ELM head based on the (hyper)parameters in the provided BertConfig.",
"name": "__init__",
"signature": "def __init__(self, config, kg_start_idx: int=768, prot_start_idx: int=1024)"
},
{
"docstring": "Map hidden states to values for the text (1st part), kg (2nd part... | 2 | stack_v2_sparse_classes_30k_train_017171 | Implement the Python class `ProtSTonKGsPELMPredictionHead` described below.
Class description:
Custom masked protein, entity and language modeling (PELM) head for proteins, entities and text tokens.
Method signatures and docstrings:
- def __init__(self, config, kg_start_idx: int=768, prot_start_idx: int=1024): Initia... | Implement the Python class `ProtSTonKGsPELMPredictionHead` described below.
Class description:
Custom masked protein, entity and language modeling (PELM) head for proteins, entities and text tokens.
Method signatures and docstrings:
- def __init__(self, config, kg_start_idx: int=768, prot_start_idx: int=1024): Initia... | 2810353739a785ab9aee75ec15ffc738470bc288 | <|skeleton|>
class ProtSTonKGsPELMPredictionHead:
"""Custom masked protein, entity and language modeling (PELM) head for proteins, entities and text tokens."""
def __init__(self, config, kg_start_idx: int=768, prot_start_idx: int=1024):
"""Initialize the ELM head based on the (hyper)parameters in the p... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProtSTonKGsPELMPredictionHead:
"""Custom masked protein, entity and language modeling (PELM) head for proteins, entities and text tokens."""
def __init__(self, config, kg_start_idx: int=768, prot_start_idx: int=1024):
"""Initialize the ELM head based on the (hyper)parameters in the provided BertC... | the_stack_v2_python_sparse | src/stonkgs/models/protstonkgs_model.py | stonkgs/stonkgs | train | 30 |
8a5aa16e11180522bc54f1399ea63cb3bcef207a | [
"if expr.is_number:\n return AskImaginaryHandler._number(expr, assumptions)\nreturn test_closed_group(expr, assumptions, Q.antihermitian)",
"if expr.is_number:\n return AskImaginaryHandler._number(expr, assumptions)\nnccount = 0\nresult = False\nfor arg in expr.args:\n if ask(Q.antihermitian(arg), assump... | <|body_start_0|>
if expr.is_number:
return AskImaginaryHandler._number(expr, assumptions)
return test_closed_group(expr, assumptions, Q.antihermitian)
<|end_body_0|>
<|body_start_1|>
if expr.is_number:
return AskImaginaryHandler._number(expr, assumptions)
nccount... | Handler for Q.antihermitian Test that an expression belongs to the field of anti-Hermitian operators, that is, operators in the form x*I, where x is Hermitian | AskAntiHermitianHandler | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AskAntiHermitianHandler:
"""Handler for Q.antihermitian Test that an expression belongs to the field of anti-Hermitian operators, that is, operators in the form x*I, where x is Hermitian"""
def Add(expr, assumptions):
"""Antihermitian + Antihermitian -> Antihermitian Antihermitian + ... | stack_v2_sparse_classes_36k_train_008008 | 21,918 | permissive | [
{
"docstring": "Antihermitian + Antihermitian -> Antihermitian Antihermitian + !Antihermitian -> !Antihermitian",
"name": "Add",
"signature": "def Add(expr, assumptions)"
},
{
"docstring": "As long as there is at most only one noncommutative term: Hermitian*Hermitian -> !Antihermitian Hermitian*... | 3 | null | Implement the Python class `AskAntiHermitianHandler` described below.
Class description:
Handler for Q.antihermitian Test that an expression belongs to the field of anti-Hermitian operators, that is, operators in the form x*I, where x is Hermitian
Method signatures and docstrings:
- def Add(expr, assumptions): Antihe... | Implement the Python class `AskAntiHermitianHandler` described below.
Class description:
Handler for Q.antihermitian Test that an expression belongs to the field of anti-Hermitian operators, that is, operators in the form x*I, where x is Hermitian
Method signatures and docstrings:
- def Add(expr, assumptions): Antihe... | 1ad7ec05fb1e3676ac879585296c513c3ee50ef9 | <|skeleton|>
class AskAntiHermitianHandler:
"""Handler for Q.antihermitian Test that an expression belongs to the field of anti-Hermitian operators, that is, operators in the form x*I, where x is Hermitian"""
def Add(expr, assumptions):
"""Antihermitian + Antihermitian -> Antihermitian Antihermitian + ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AskAntiHermitianHandler:
"""Handler for Q.antihermitian Test that an expression belongs to the field of anti-Hermitian operators, that is, operators in the form x*I, where x is Hermitian"""
def Add(expr, assumptions):
"""Antihermitian + Antihermitian -> Antihermitian Antihermitian + !Antihermitia... | the_stack_v2_python_sparse | Library/lib/python3.7/site-packages/sympy/assumptions/handlers/sets.py | holzschu/Carnets | train | 541 |
dcaee25ef2eae840730946cde9009cf88a030689 | [
"def isCompleteSubTree(root):\n if not root:\n return (0, 0)\n if root:\n left_deep = isCompleteSubTree(root.left)\n right_deep = isCompleteSubTree(root.right)\n print(root.val, left_deep, right_deep)\n if not left_deep or not right_deep:\n return None\n if... | <|body_start_0|>
def isCompleteSubTree(root):
if not root:
return (0, 0)
if root:
left_deep = isCompleteSubTree(root.left)
right_deep = isCompleteSubTree(root.right)
print(root.val, left_deep, right_deep)
if ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isCompleteTree(self, root):
""":type root: TreeNode :rtype: bool 44 ms"""
<|body_0|>
def isCompleteTree_1(self, root):
""":type root: TreeNode :rtype: bool 24ms 排序输出查看情况"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
def isCompleteSub... | stack_v2_sparse_classes_36k_train_008009 | 3,277 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: bool 44 ms",
"name": "isCompleteTree",
"signature": "def isCompleteTree(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: bool 24ms 排序输出查看情况",
"name": "isCompleteTree_1",
"signature": "def isCompleteTree_1(self, root)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005347 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isCompleteTree(self, root): :type root: TreeNode :rtype: bool 44 ms
- def isCompleteTree_1(self, root): :type root: TreeNode :rtype: bool 24ms 排序输出查看情况 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isCompleteTree(self, root): :type root: TreeNode :rtype: bool 44 ms
- def isCompleteTree_1(self, root): :type root: TreeNode :rtype: bool 24ms 排序输出查看情况
<|skeleton|>
class So... | 679a2b246b8b6bb7fc55ed1c8096d3047d6d4461 | <|skeleton|>
class Solution:
def isCompleteTree(self, root):
""":type root: TreeNode :rtype: bool 44 ms"""
<|body_0|>
def isCompleteTree_1(self, root):
""":type root: TreeNode :rtype: bool 24ms 排序输出查看情况"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def isCompleteTree(self, root):
""":type root: TreeNode :rtype: bool 44 ms"""
def isCompleteSubTree(root):
if not root:
return (0, 0)
if root:
left_deep = isCompleteSubTree(root.left)
right_deep = isCompleteSubTr... | the_stack_v2_python_sparse | CheckCompletenessOfABinaryTree_MID_958.py | 953250587/leetcode-python | train | 2 | |
51eb8c09b0a3e80ff8ba20f5cd92a61d533622bc | [
"self.fullname = fullname\nself.min_version = min_version\nself.vfunc = vfunc",
"if fullname == self.fullname:\n self.path = path\n return self\nreturn None",
"if fullname in sys.modules:\n return sys.modules[fullname]\nmodule_info = imp.find_module(fullname, self.path)\nmodule = imp.load_module(fullna... | <|body_start_0|>
self.fullname = fullname
self.min_version = min_version
self.vfunc = vfunc
<|end_body_0|>
<|body_start_1|>
if fullname == self.fullname:
self.path = path
return self
return None
<|end_body_1|>
<|body_start_2|>
if fullname in sys.... | An import hook to enforce minimum versions of Python modules. This class implements both the module finder (find_module) and loader (load_module). It can be installed in sys.meta_path to intercept every attempt to import a new module, checking whether it has the required version and raising ImportError otherwise. | RequireModuleVersionHook | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RequireModuleVersionHook:
"""An import hook to enforce minimum versions of Python modules. This class implements both the module finder (find_module) and loader (load_module). It can be installed in sys.meta_path to intercept every attempt to import a new module, checking whether it has the requi... | stack_v2_sparse_classes_36k_train_008010 | 5,846 | no_license | [
{
"docstring": "Instantiation method for the RequireModuleVersionHook class. The 'fullname' parameter is the a fully qualified name of the module that we want to import, such as 'pyfits' or 'scipy'. 'min_version' is a tuple of integers specifying the minimum version of the module, such as (1, 2, 1). Finally, 'v... | 3 | stack_v2_sparse_classes_30k_train_008584 | Implement the Python class `RequireModuleVersionHook` described below.
Class description:
An import hook to enforce minimum versions of Python modules. This class implements both the module finder (find_module) and loader (load_module). It can be installed in sys.meta_path to intercept every attempt to import a new mo... | Implement the Python class `RequireModuleVersionHook` described below.
Class description:
An import hook to enforce minimum versions of Python modules. This class implements both the module finder (find_module) and loader (load_module). It can be installed in sys.meta_path to intercept every attempt to import a new mo... | a043b145df0622006186488d284b848a489ee2e9 | <|skeleton|>
class RequireModuleVersionHook:
"""An import hook to enforce minimum versions of Python modules. This class implements both the module finder (find_module) and loader (load_module). It can be installed in sys.meta_path to intercept every attempt to import a new module, checking whether it has the requi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RequireModuleVersionHook:
"""An import hook to enforce minimum versions of Python modules. This class implements both the module finder (find_module) and loader (load_module). It can be installed in sys.meta_path to intercept every attempt to import a new module, checking whether it has the required version a... | the_stack_v2_python_sparse | check_versions.py | pablogsal/lemon | train | 1 |
df6fc3bc856a3525d920d2be574cb912f812b039 | [
"self._path = path\nself._headers = output_headers\nself._delimiter = output_delimiter",
"with open(self._path, 'r') as csv_file:\n dialect = csv.Sniffer().sniff(csv_file.read(1024))\n csv_file.seek(0)\n reader = csv.DictReader(csv_file, dialect=dialect)\n return list(reader)",
"with open(self._path... | <|body_start_0|>
self._path = path
self._headers = output_headers
self._delimiter = output_delimiter
<|end_body_0|>
<|body_start_1|>
with open(self._path, 'r') as csv_file:
dialect = csv.Sniffer().sniff(csv_file.read(1024))
csv_file.seek(0)
reader = c... | CsvReport | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CsvReport:
def __init__(self, path, output_headers=None, output_delimiter=';'):
"""CsvReport constructor :param path: Path to CSV file :param output_headers: List of column headers to use in output file :param output_delimiter: Delimiter to use in output file, defaults to ';'"""
... | stack_v2_sparse_classes_36k_train_008011 | 1,706 | permissive | [
{
"docstring": "CsvReport constructor :param path: Path to CSV file :param output_headers: List of column headers to use in output file :param output_delimiter: Delimiter to use in output file, defaults to ';'",
"name": "__init__",
"signature": "def __init__(self, path, output_headers=None, output_delim... | 4 | stack_v2_sparse_classes_30k_val_001117 | Implement the Python class `CsvReport` described below.
Class description:
Implement the CsvReport class.
Method signatures and docstrings:
- def __init__(self, path, output_headers=None, output_delimiter=';'): CsvReport constructor :param path: Path to CSV file :param output_headers: List of column headers to use in... | Implement the Python class `CsvReport` described below.
Class description:
Implement the CsvReport class.
Method signatures and docstrings:
- def __init__(self, path, output_headers=None, output_delimiter=';'): CsvReport constructor :param path: Path to CSV file :param output_headers: List of column headers to use in... | ae93d388fbb141c2e4d58b22904d50ddd1c07195 | <|skeleton|>
class CsvReport:
def __init__(self, path, output_headers=None, output_delimiter=';'):
"""CsvReport constructor :param path: Path to CSV file :param output_headers: List of column headers to use in output file :param output_delimiter: Delimiter to use in output file, defaults to ';'"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CsvReport:
def __init__(self, path, output_headers=None, output_delimiter=';'):
"""CsvReport constructor :param path: Path to CSV file :param output_headers: List of column headers to use in output file :param output_delimiter: Delimiter to use in output file, defaults to ';'"""
self._path = p... | the_stack_v2_python_sparse | src/utils/csv_wrapper.py | AlibekovMurad5202/openvino-dl-benchmark | train | 0 | |
63de4f194f0f856d17e80807a7c9c9ab2af1fcbf | [
"self.main_menu_map = {1: (self.query, 'Query'), 2: (quit, 'Exit')}\nself.output_map = Lab10Driver.generate_enum_menu_map(starwars_request.OutputMode)\nself.query_map = Lab10Driver.generate_enum_menu_map(starwars_request.RequestMode)",
"print(f' Star Wars Data Acquisition\\n --------------------------')\ntry:\n ... | <|body_start_0|>
self.main_menu_map = {1: (self.query, 'Query'), 2: (quit, 'Exit')}
self.output_map = Lab10Driver.generate_enum_menu_map(starwars_request.OutputMode)
self.query_map = Lab10Driver.generate_enum_menu_map(starwars_request.RequestMode)
<|end_body_0|>
<|body_start_1|>
print(f... | This class is responsible for driving the program. | Lab10Driver | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Lab10Driver:
"""This class is responsible for driving the program."""
def __init__(self):
"""Initialize the Driver with the main menu, query type and output type menu maps (dictionaries)."""
<|body_0|>
def prompt_main_menu(self):
"""Display a dynamically generate... | stack_v2_sparse_classes_36k_train_008012 | 3,979 | no_license | [
{
"docstring": "Initialize the Driver with the main menu, query type and output type menu maps (dictionaries).",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Display a dynamically generated menu from a dictionary that maps an integer to Enum entries. Exits the program... | 5 | null | Implement the Python class `Lab10Driver` described below.
Class description:
This class is responsible for driving the program.
Method signatures and docstrings:
- def __init__(self): Initialize the Driver with the main menu, query type and output type menu maps (dictionaries).
- def prompt_main_menu(self): Display a... | Implement the Python class `Lab10Driver` described below.
Class description:
This class is responsible for driving the program.
Method signatures and docstrings:
- def __init__(self): Initialize the Driver with the main menu, query type and output type menu maps (dictionaries).
- def prompt_main_menu(self): Display a... | e86956c69006f96221349fe9bd4925ad2255601e | <|skeleton|>
class Lab10Driver:
"""This class is responsible for driving the program."""
def __init__(self):
"""Initialize the Driver with the main menu, query type and output type menu maps (dictionaries)."""
<|body_0|>
def prompt_main_menu(self):
"""Display a dynamically generate... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Lab10Driver:
"""This class is responsible for driving the program."""
def __init__(self):
"""Initialize the Driver with the main menu, query type and output type menu maps (dictionaries)."""
self.main_menu_map = {1: (self.query, 'Query'), 2: (quit, 'Exit')}
self.output_map = Lab10... | the_stack_v2_python_sparse | lab-10-star-wars-encyclopedia-lizhiquan/lab10_driver.py | lizhiquan/learning-python | train | 0 |
77beaa7bd4c490cf4948c4ca25bb5d3c25483a9d | [
"super(VndProductDialog, self).__init__(parent=parent)\nself.setupUi(self)\nself.dbsession = Session()\nself.listing = listing\nself.titleLine.textChanged.connect(self.maybe_enable_ok)\nself.brandLine.textChanged.connect(self.maybe_enable_ok)\nself.modelLine.textChanged.connect(self.maybe_enable_ok)\nself.skuLine.t... | <|body_start_0|>
super(VndProductDialog, self).__init__(parent=parent)
self.setupUi(self)
self.dbsession = Session()
self.listing = listing
self.titleLine.textChanged.connect(self.maybe_enable_ok)
self.brandLine.textChanged.connect(self.maybe_enable_ok)
self.model... | A dialog for viewing/editing a single VendorListing. | VndProductDialog | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VndProductDialog:
"""A dialog for viewing/editing a single VendorListing."""
def __init__(self, listing=None, parent=None):
"""Initialize the widgets. Set the current widget to listing, if provided. If listing is None, assume that we are creating a new listing."""
<|body_0|>
... | stack_v2_sparse_classes_36k_train_008013 | 25,458 | no_license | [
{
"docstring": "Initialize the widgets. Set the current widget to listing, if provided. If listing is None, assume that we are creating a new listing.",
"name": "__init__",
"signature": "def __init__(self, listing=None, parent=None)"
},
{
"docstring": "Enable the OK button if the conditions are ... | 3 | stack_v2_sparse_classes_30k_train_011240 | Implement the Python class `VndProductDialog` described below.
Class description:
A dialog for viewing/editing a single VendorListing.
Method signatures and docstrings:
- def __init__(self, listing=None, parent=None): Initialize the widgets. Set the current widget to listing, if provided. If listing is None, assume t... | Implement the Python class `VndProductDialog` described below.
Class description:
A dialog for viewing/editing a single VendorListing.
Method signatures and docstrings:
- def __init__(self, listing=None, parent=None): Initialize the widgets. Set the current widget to listing, if provided. If listing is None, assume t... | 7d22707a1782125d86140c52d20eaadd2df6e4fc | <|skeleton|>
class VndProductDialog:
"""A dialog for viewing/editing a single VendorListing."""
def __init__(self, listing=None, parent=None):
"""Initialize the widgets. Set the current widget to listing, if provided. If listing is None, assume that we are creating a new listing."""
<|body_0|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VndProductDialog:
"""A dialog for viewing/editing a single VendorListing."""
def __init__(self, listing=None, parent=None):
"""Initialize the widgets. Set the current widget to listing, if provided. If listing is None, assume that we are creating a new listing."""
super(VndProductDialog, ... | the_stack_v2_python_sparse | dialogs.py | garrettmk/Prowler | train | 1 |
fd4bafce42215876a71cdb4e88ea676cb2b7455d | [
"super().__init__()\nself.freq = freq\nself.offset = offset\nself.amp = amplitude",
"def wrap(time: Union[float, np.ndarray]) -> Union[float, np.ndarray]:\n return self.amp * np.sin(2 * np.pi * self.freq * time + self.offset)\nreturn wrap"
] | <|body_start_0|>
super().__init__()
self.freq = freq
self.offset = offset
self.amp = amplitude
<|end_body_0|>
<|body_start_1|>
def wrap(time: Union[float, np.ndarray]) -> Union[float, np.ndarray]:
return self.amp * np.sin(2 * np.pi * self.freq * time + self.offset)
... | Represent a sine waveform to be attached to a source. | SineWaveform | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SineWaveform:
"""Represent a sine waveform to be attached to a source."""
def __init__(self, freq: float, offset: float, amplitude: float=1):
"""Represent a A*sin(2*pi*f*t+offset)function."""
<|body_0|>
def func(self):
"""Return a gaussian waveform function."""
... | stack_v2_sparse_classes_36k_train_008014 | 2,517 | permissive | [
{
"docstring": "Represent a A*sin(2*pi*f*t+offset)function.",
"name": "__init__",
"signature": "def __init__(self, freq: float, offset: float, amplitude: float=1)"
},
{
"docstring": "Return a gaussian waveform function.",
"name": "func",
"signature": "def func(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003769 | Implement the Python class `SineWaveform` described below.
Class description:
Represent a sine waveform to be attached to a source.
Method signatures and docstrings:
- def __init__(self, freq: float, offset: float, amplitude: float=1): Represent a A*sin(2*pi*f*t+offset)function.
- def func(self): Return a gaussian wa... | Implement the Python class `SineWaveform` described below.
Class description:
Represent a sine waveform to be attached to a source.
Method signatures and docstrings:
- def __init__(self, freq: float, offset: float, amplitude: float=1): Represent a A*sin(2*pi*f*t+offset)function.
- def func(self): Return a gaussian wa... | f2134cb3e36eabca1639b8ff4e428d3a268953bd | <|skeleton|>
class SineWaveform:
"""Represent a sine waveform to be attached to a source."""
def __init__(self, freq: float, offset: float, amplitude: float=1):
"""Represent a A*sin(2*pi*f*t+offset)function."""
<|body_0|>
def func(self):
"""Return a gaussian waveform function."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SineWaveform:
"""Represent a sine waveform to be attached to a source."""
def __init__(self, freq: float, offset: float, amplitude: float=1):
"""Represent a A*sin(2*pi*f*t+offset)function."""
super().__init__()
self.freq = freq
self.offset = offset
self.amp = ampli... | the_stack_v2_python_sparse | fdtd/waveforms.py | tiagovla/fdtd.py | train | 4 |
28682de5ca0d4a856b222640950801c7a81be634 | [
"super(Edge2Edge, self).__init__()\nself.channel = channel\nself.dim = dim\nself.filters = filters\nself.row_conv = nn.Conv2d(channel, filters, (1, dim))\nself.col_conv = nn.Conv2d(channel, filters, (dim, 1))",
"size = x.size()\nrow = self.row_conv(x)\ncol = self.col_conv(x)\nrow_ex = row.expand(size[0], self.fil... | <|body_start_0|>
super(Edge2Edge, self).__init__()
self.channel = channel
self.dim = dim
self.filters = filters
self.row_conv = nn.Conv2d(channel, filters, (1, dim))
self.col_conv = nn.Conv2d(channel, filters, (dim, 1))
<|end_body_0|>
<|body_start_1|>
size = x.si... | BrainNetCNN edge to edge (e2e) layer Attributes: channel (int): number of input channel col_conv (nn.Conv2d): column convolution dim (int): number of ROI for functional connectivity filters (int): number of output channel row_conv ((nn.Conv2d): row convolution | Edge2Edge | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Edge2Edge:
"""BrainNetCNN edge to edge (e2e) layer Attributes: channel (int): number of input channel col_conv (nn.Conv2d): column convolution dim (int): number of ROI for functional connectivity filters (int): number of output channel row_conv ((nn.Conv2d): row convolution"""
def __init__(s... | stack_v2_sparse_classes_36k_train_008015 | 12,068 | permissive | [
{
"docstring": "initialization function of e2e layer Args: channel (int): number of input channel dim (int): number of ROI for functional connectivity filters (int): number of output channel",
"name": "__init__",
"signature": "def __init__(self, channel, dim, filters)"
},
{
"docstring": "e2e by ... | 2 | stack_v2_sparse_classes_30k_val_001076 | Implement the Python class `Edge2Edge` described below.
Class description:
BrainNetCNN edge to edge (e2e) layer Attributes: channel (int): number of input channel col_conv (nn.Conv2d): column convolution dim (int): number of ROI for functional connectivity filters (int): number of output channel row_conv ((nn.Conv2d):... | Implement the Python class `Edge2Edge` described below.
Class description:
BrainNetCNN edge to edge (e2e) layer Attributes: channel (int): number of input channel col_conv (nn.Conv2d): column convolution dim (int): number of ROI for functional connectivity filters (int): number of output channel row_conv ((nn.Conv2d):... | c773720ad340dcb1d566b0b8de68b6acdf2ca505 | <|skeleton|>
class Edge2Edge:
"""BrainNetCNN edge to edge (e2e) layer Attributes: channel (int): number of input channel col_conv (nn.Conv2d): column convolution dim (int): number of ROI for functional connectivity filters (int): number of output channel row_conv ((nn.Conv2d): row convolution"""
def __init__(s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Edge2Edge:
"""BrainNetCNN edge to edge (e2e) layer Attributes: channel (int): number of input channel col_conv (nn.Conv2d): column convolution dim (int): number of ROI for functional connectivity filters (int): number of output channel row_conv ((nn.Conv2d): row convolution"""
def __init__(self, channel,... | the_stack_v2_python_sparse | stable_projects/predict_phenotypes/He2019_KRDNN/cbig/He2019/CBIG_model_pytorch.py | ThomasYeoLab/CBIG | train | 508 |
81065031a3f5302400e118a6183efdb2dda1ac34 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn TeleconferenceDeviceQuality()",
"from .teleconference_device_media_quality import TeleconferenceDeviceMediaQuality\nfrom .teleconference_device_media_quality import TeleconferenceDeviceMediaQuality\nfields: Dict[str, Callable[[Any], No... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return TeleconferenceDeviceQuality()
<|end_body_0|>
<|body_start_1|>
from .teleconference_device_media_quality import TeleconferenceDeviceMediaQuality
from .teleconference_device_media_quality ... | TeleconferenceDeviceQuality | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TeleconferenceDeviceQuality:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TeleconferenceDeviceQuality:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value a... | stack_v2_sparse_classes_36k_train_008016 | 6,036 | permissive | [
{
"docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: TeleconferenceDeviceQuality",
"name": "create_from_discriminator_value",
"signature": "def create_from_discr... | 3 | stack_v2_sparse_classes_30k_train_020316 | Implement the Python class `TeleconferenceDeviceQuality` described below.
Class description:
Implement the TeleconferenceDeviceQuality class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TeleconferenceDeviceQuality: Creates a new instance of the appr... | Implement the Python class `TeleconferenceDeviceQuality` described below.
Class description:
Implement the TeleconferenceDeviceQuality class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TeleconferenceDeviceQuality: Creates a new instance of the appr... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class TeleconferenceDeviceQuality:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TeleconferenceDeviceQuality:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value a... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TeleconferenceDeviceQuality:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TeleconferenceDeviceQuality:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the ... | the_stack_v2_python_sparse | msgraph/generated/models/teleconference_device_quality.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
2f5b0f76bfd9ad332fc0a652e74b06fd355e6433 | [
"if len(A) == 0:\n return A\nelse:\n return sortColors([c for c in A if c < A[0]]) + [c for c in A if c == A[0]] + sortColors([c for c in A if c > A[0]])",
"ret = [0, 0, 0]\nfor i in A:\n ret[i] += 1\nreturn [0] * ret[0] + [1] * ret[1] + [2] * ret[2]"
] | <|body_start_0|>
if len(A) == 0:
return A
else:
return sortColors([c for c in A if c < A[0]]) + [c for c in A if c == A[0]] + sortColors([c for c in A if c > A[0]])
<|end_body_0|>
<|body_start_1|>
ret = [0, 0, 0]
for i in A:
ret[i] += 1
return... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def sortColors(A):
"""Naive solution: implemented a Quicksort. Time complexity: O(nlgn) or O(n^2)"""
<|body_0|>
def sortColors2(A):
"""There are only 3 different values: 0, 1 and 2. We can count the occurrences of each value and get the resulting sorted arr... | stack_v2_sparse_classes_36k_train_008017 | 1,104 | no_license | [
{
"docstring": "Naive solution: implemented a Quicksort. Time complexity: O(nlgn) or O(n^2)",
"name": "sortColors",
"signature": "def sortColors(A)"
},
{
"docstring": "There are only 3 different values: 0, 1 and 2. We can count the occurrences of each value and get the resulting sorted array in ... | 2 | stack_v2_sparse_classes_30k_train_006585 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def sortColors(A): Naive solution: implemented a Quicksort. Time complexity: O(nlgn) or O(n^2)
- def sortColors2(A): There are only 3 different values: 0, 1 and 2. We can count t... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def sortColors(A): Naive solution: implemented a Quicksort. Time complexity: O(nlgn) or O(n^2)
- def sortColors2(A): There are only 3 different values: 0, 1 and 2. We can count t... | 6280203b0adaf6fc0770094deb2c0b6a88c5f64d | <|skeleton|>
class Solution:
def sortColors(A):
"""Naive solution: implemented a Quicksort. Time complexity: O(nlgn) or O(n^2)"""
<|body_0|>
def sortColors2(A):
"""There are only 3 different values: 0, 1 and 2. We can count the occurrences of each value and get the resulting sorted arr... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def sortColors(A):
"""Naive solution: implemented a Quicksort. Time complexity: O(nlgn) or O(n^2)"""
if len(A) == 0:
return A
else:
return sortColors([c for c in A if c < A[0]]) + [c for c in A if c == A[0]] + sortColors([c for c in A if c > A[0]])
... | the_stack_v2_python_sparse | Two_Pointers/sort_by_color.py | Zahidsqldba07/Interviewbit | train | 0 | |
b382f8ae1babd5929d7fed9ea426ef200a0c9a46 | [
"self.shape = (image_size, image_size)\nif min_pt is None:\n min_pt = [-self.shape[0] / 2, -self.shape[1] / 2]\nif max_pt is None:\n max_pt = [self.shape[0] / 2, self.shape[1] / 2]\nspace = uniform_discr(min_pt, max_pt, self.shape, dtype=np.float32)\nself.train_len = train_len\nself.validation_len = validatio... | <|body_start_0|>
self.shape = (image_size, image_size)
if min_pt is None:
min_pt = [-self.shape[0] / 2, -self.shape[1] / 2]
if max_pt is None:
max_pt = [self.shape[0] / 2, self.shape[1] / 2]
space = uniform_discr(min_pt, max_pt, self.shape, dtype=np.float32)
... | Dataset with images of multiple random ellipses. This dataset uses :meth:`odl.phantom.ellipsoid_phantom` to create the images. The images are normalized to have a value range of ``[0., 1.]`` with a background value of ``0.``. Attributes ---------- space ``odl.uniform_discr(min_pt, max_pt, (image_size, image_size), dtyp... | EllipsesDataset | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EllipsesDataset:
"""Dataset with images of multiple random ellipses. This dataset uses :meth:`odl.phantom.ellipsoid_phantom` to create the images. The images are normalized to have a value range of ``[0., 1.]`` with a background value of ``0.``. Attributes ---------- space ``odl.uniform_discr(min... | stack_v2_sparse_classes_36k_train_008018 | 4,893 | permissive | [
{
"docstring": "Parameters ---------- image_size : int, optional Number of pixels per image dimension. Default: ``128``. min_pt : [int, int], optional Minimum values of the lp space. Default: ``[-image_size/2, -image_size/2]``. max_pt : [int, int], optional Maximum values of the lp space. Default: ``[image_size... | 2 | stack_v2_sparse_classes_30k_train_010127 | Implement the Python class `EllipsesDataset` described below.
Class description:
Dataset with images of multiple random ellipses. This dataset uses :meth:`odl.phantom.ellipsoid_phantom` to create the images. The images are normalized to have a value range of ``[0., 1.]`` with a background value of ``0.``. Attributes -... | Implement the Python class `EllipsesDataset` described below.
Class description:
Dataset with images of multiple random ellipses. This dataset uses :meth:`odl.phantom.ellipsoid_phantom` to create the images. The images are normalized to have a value range of ``[0., 1.]`` with a background value of ``0.``. Attributes -... | 56d39aaab0c99a918dac832171ca4310a74a33a3 | <|skeleton|>
class EllipsesDataset:
"""Dataset with images of multiple random ellipses. This dataset uses :meth:`odl.phantom.ellipsoid_phantom` to create the images. The images are normalized to have a value range of ``[0., 1.]`` with a background value of ``0.``. Attributes ---------- space ``odl.uniform_discr(min... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EllipsesDataset:
"""Dataset with images of multiple random ellipses. This dataset uses :meth:`odl.phantom.ellipsoid_phantom` to create the images. The images are normalized to have a value range of ``[0., 1.]`` with a background value of ``0.``. Attributes ---------- space ``odl.uniform_discr(min_pt, max_pt, ... | the_stack_v2_python_sparse | dival/datasets/ellipses_dataset.py | jleuschn/dival | train | 65 |
1d77cf31fdf80bf753ec9d0c036c2ce001ae9b18 | [
"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... | ModelServiceServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModelServiceServicer:
def GetModel(self, request, context):
"""Gets the specified model resource by model ID."""
<|body_0|>
def ListModels(self, request, context):
"""Lists all models in the specified dataset. Requires the READER dataset role."""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_008019 | 4,840 | permissive | [
{
"docstring": "Gets the specified model resource by model ID.",
"name": "GetModel",
"signature": "def GetModel(self, request, context)"
},
{
"docstring": "Lists all models in the specified dataset. Requires the READER dataset role.",
"name": "ListModels",
"signature": "def ListModels(se... | 4 | stack_v2_sparse_classes_30k_train_003234 | Implement the Python class `ModelServiceServicer` described below.
Class description:
Implement the ModelServiceServicer class.
Method signatures and docstrings:
- def GetModel(self, request, context): Gets the specified model resource by model ID.
- def ListModels(self, request, context): Lists all models in the spe... | Implement the Python class `ModelServiceServicer` described below.
Class description:
Implement the ModelServiceServicer class.
Method signatures and docstrings:
- def GetModel(self, request, context): Gets the specified model resource by model ID.
- def ListModels(self, request, context): Lists all models in the spe... | d897d56bce03d1fda98b79afb08264e51d46c421 | <|skeleton|>
class ModelServiceServicer:
def GetModel(self, request, context):
"""Gets the specified model resource by model ID."""
<|body_0|>
def ListModels(self, request, context):
"""Lists all models in the specified dataset. Requires the READER dataset role."""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ModelServiceServicer:
def GetModel(self, request, context):
"""Gets the specified model resource by model ID."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def ListMode... | the_stack_v2_python_sparse | bigquery/google/cloud/bigquery_v2/proto/model_pb2_grpc.py | tswast/google-cloud-python | train | 1 | |
936086960960267a1b9a1a238c0b1fb0425f92f1 | [
"for x in args:\n assert isinstance(x, smat.csr_matrix), type(x)\nassert all((x.shape == args[0].shape for x in args))",
"CsrEnsembler.check_validlity(*args)\nret = sum(args)\nret = sorted_csr(ret)\nret.data /= len(args)\nreturn ret",
"CsrEnsembler.check_validlity(*args)\nmm = max(((x.indptr[1:] - x.indptr[:... | <|body_start_0|>
for x in args:
assert isinstance(x, smat.csr_matrix), type(x)
assert all((x.shape == args[0].shape for x in args))
<|end_body_0|>
<|body_start_1|>
CsrEnsembler.check_validlity(*args)
ret = sum(args)
ret = sorted_csr(ret)
ret.data /= len(args)... | A class implementing several ensemblers for a list sorted CSR predictions | CsrEnsembler | [
"BSD-3-Clause",
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CsrEnsembler:
"""A class implementing several ensemblers for a list sorted CSR predictions"""
def check_validlity(*args):
"""Check whether input CSR matrices are valid Args: args (iterable over csr_matrix): input CSR matrices"""
<|body_0|>
def average(*args):
"""... | stack_v2_sparse_classes_36k_train_008020 | 35,951 | permissive | [
{
"docstring": "Check whether input CSR matrices are valid Args: args (iterable over csr_matrix): input CSR matrices",
"name": "check_validlity",
"signature": "def check_validlity(*args)"
},
{
"docstring": "Ensemble predictions by averaging prediction values Args: args (iterable over csr_matrix)... | 5 | stack_v2_sparse_classes_30k_train_008679 | Implement the Python class `CsrEnsembler` described below.
Class description:
A class implementing several ensemblers for a list sorted CSR predictions
Method signatures and docstrings:
- def check_validlity(*args): Check whether input CSR matrices are valid Args: args (iterable over csr_matrix): input CSR matrices
-... | Implement the Python class `CsrEnsembler` described below.
Class description:
A class implementing several ensemblers for a list sorted CSR predictions
Method signatures and docstrings:
- def check_validlity(*args): Check whether input CSR matrices are valid Args: args (iterable over csr_matrix): input CSR matrices
-... | 9aefa13e1cc873cb68801cba49d4e9a48572eeb7 | <|skeleton|>
class CsrEnsembler:
"""A class implementing several ensemblers for a list sorted CSR predictions"""
def check_validlity(*args):
"""Check whether input CSR matrices are valid Args: args (iterable over csr_matrix): input CSR matrices"""
<|body_0|>
def average(*args):
"""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CsrEnsembler:
"""A class implementing several ensemblers for a list sorted CSR predictions"""
def check_validlity(*args):
"""Check whether input CSR matrices are valid Args: args (iterable over csr_matrix): input CSR matrices"""
for x in args:
assert isinstance(x, smat.csr_mat... | the_stack_v2_python_sparse | pecos/utils/smat_util.py | zusmani/pecos | train | 1 |
cb560ae1059e3bdaacc4d4ae195a7ee93ae505b9 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\ntry:\n mapping_value = parse_node.get_child_node('@odata.type').get_str_value()\nexcept AttributeError:\n mapping_value = None\nif mapping_value and mapping_value.casefold() == '#microsoft.graph.managedAndroidLobApp'.casefold():\n from... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
try:
mapping_value = parse_node.get_child_node('@odata.type').get_str_value()
except AttributeError:
mapping_value = None
if mapping_value and mapping_value.casefold() ==... | Abstract class that contains properties and inherited properties for apps that you can manage with an Intune app protection policy. | ManagedApp | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ManagedApp:
"""Abstract class that contains properties and inherited properties for apps that you can manage with an Intune app protection policy."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ManagedApp:
"""Creates a new instance of the appropriate ... | stack_v2_sparse_classes_36k_train_008021 | 4,851 | permissive | [
{
"docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: ManagedApp",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_value(pa... | 3 | null | Implement the Python class `ManagedApp` described below.
Class description:
Abstract class that contains properties and inherited properties for apps that you can manage with an Intune app protection policy.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) ... | Implement the Python class `ManagedApp` described below.
Class description:
Abstract class that contains properties and inherited properties for apps that you can manage with an Intune app protection policy.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) ... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class ManagedApp:
"""Abstract class that contains properties and inherited properties for apps that you can manage with an Intune app protection policy."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ManagedApp:
"""Creates a new instance of the appropriate ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ManagedApp:
"""Abstract class that contains properties and inherited properties for apps that you can manage with an Intune app protection policy."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ManagedApp:
"""Creates a new instance of the appropriate class based o... | the_stack_v2_python_sparse | msgraph/generated/models/managed_app.py | microsoftgraph/msgraph-sdk-python | train | 135 |
a0c5309e8c404c1809c1280e23cf1e0d84564861 | [
"self.ret = None\n\ndef dfs(node):\n if not node:\n return False\n l = dfs(node.left)\n r = dfs(node.right)\n z = node == p or node == q\n if l + r + z >= 2:\n self.ret = node\n return l or r or z\ndfs(root)\nreturn self.ret",
"stack = [root]\nparent = {root: None}\nwhile stack and... | <|body_start_0|>
self.ret = None
def dfs(node):
if not node:
return False
l = dfs(node.left)
r = dfs(node.right)
z = node == p or node == q
if l + r + z >= 2:
self.ret = node
return l or r or z
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lowestCommonAncestor(self, root, p, q):
""":type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode"""
<|body_0|>
def lowestCommonAncestor(self, root, p, q):
""":type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode""... | stack_v2_sparse_classes_36k_train_008022 | 1,451 | no_license | [
{
"docstring": ":type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode",
"name": "lowestCommonAncestor",
"signature": "def lowestCommonAncestor(self, root, p, q)"
},
{
"docstring": ":type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode",
"name": "lowest... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lowestCommonAncestor(self, root, p, q): :type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode
- def lowestCommonAncestor(self, root, p, q): :type root: Tr... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lowestCommonAncestor(self, root, p, q): :type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode
- def lowestCommonAncestor(self, root, p, q): :type root: Tr... | 3a7f20f79281fcaedb10696723dcb39c816ce258 | <|skeleton|>
class Solution:
def lowestCommonAncestor(self, root, p, q):
""":type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode"""
<|body_0|>
def lowestCommonAncestor(self, root, p, q):
""":type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def lowestCommonAncestor(self, root, p, q):
""":type root: TreeNode :type p: TreeNode :type q: TreeNode :rtype: TreeNode"""
self.ret = None
def dfs(node):
if not node:
return False
l = dfs(node.left)
r = dfs(node.right)
... | the_stack_v2_python_sparse | 236_lca.py | haohanz/Leetcode-Solution | train | 1 | |
9993e677e99b989c73404e03cd185f57ae8352b8 | [
"r = self.param\nsid = ''\nresult = rq_getScreenList(r, PageSize='100')\nfor li in result['data']['ScreenList']:\n if li['ScreenName'] == getConf('constant', 'led_name'):\n sid = li['Sid']\nif not sid:\n raise Exception('screen not exits')\n unittest.main(failfast=True)\nsetConf('data', 'sid', sid)\... | <|body_start_0|>
r = self.param
sid = ''
result = rq_getScreenList(r, PageSize='100')
for li in result['data']['ScreenList']:
if li['ScreenName'] == getConf('constant', 'led_name'):
sid = li['Sid']
if not sid:
raise Exception('screen not ex... | Test_getConstant | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test_getConstant:
def test_a(self):
"""获取并保存sid"""
<|body_0|>
def test_b(self):
"""make username and password for ftp"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
r = self.param
sid = ''
result = rq_getScreenList(r, PageSize='100'... | stack_v2_sparse_classes_36k_train_008023 | 1,550 | no_license | [
{
"docstring": "获取并保存sid",
"name": "test_a",
"signature": "def test_a(self)"
},
{
"docstring": "make username and password for ftp",
"name": "test_b",
"signature": "def test_b(self)"
}
] | 2 | stack_v2_sparse_classes_30k_test_001197 | Implement the Python class `Test_getConstant` described below.
Class description:
Implement the Test_getConstant class.
Method signatures and docstrings:
- def test_a(self): 获取并保存sid
- def test_b(self): make username and password for ftp | Implement the Python class `Test_getConstant` described below.
Class description:
Implement the Test_getConstant class.
Method signatures and docstrings:
- def test_a(self): 获取并保存sid
- def test_b(self): make username and password for ftp
<|skeleton|>
class Test_getConstant:
def test_a(self):
"""获取并保存sid... | 04369bc5ef3a2400a4b468a51b54259bd6afb878 | <|skeleton|>
class Test_getConstant:
def test_a(self):
"""获取并保存sid"""
<|body_0|>
def test_b(self):
"""make username and password for ftp"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Test_getConstant:
def test_a(self):
"""获取并保存sid"""
r = self.param
sid = ''
result = rq_getScreenList(r, PageSize='100')
for li in result['data']['ScreenList']:
if li['ScreenName'] == getConf('constant', 'led_name'):
sid = li['Sid']
if... | the_stack_v2_python_sparse | src/test_B_main/test_getConstant.py | linbossdegithub/autotest | train | 1 | |
ea32cb1d053c5690dd9270b1d86c815d056c4336 | [
"self.instance = instance\nself.schema = None\nif self.instance:\n self.schema = surveys.SurveySchema(self.instance.survey)",
"for name, field in self.fields.items():\n renderer = self.renderers.get(name)\n if renderer:\n value = renderer(self.instance)\n else:\n value = getattr(self.ins... | <|body_start_0|>
self.instance = instance
self.schema = None
if self.instance:
self.schema = surveys.SurveySchema(self.instance.survey)
<|end_body_0|>
<|body_start_1|>
for name, field in self.fields.items():
renderer = self.renderers.get(name)
if rend... | A base class that constructs the readonly template for given survey record. This uses the same notion that is used to build the model based readonly templates but the schema read from the survey schema rather than the model. | SurveyRecordReadOnlyTemplate | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SurveyRecordReadOnlyTemplate:
"""A base class that constructs the readonly template for given survey record. This uses the same notion that is used to build the model based readonly templates but the schema read from the survey schema rather than the model."""
def __init__(self, instance=Non... | stack_v2_sparse_classes_36k_train_008024 | 9,668 | permissive | [
{
"docstring": "Constructor to initialize the model instance. The readonly template will be rendered for the data in this model instance.",
"name": "__init__",
"signature": "def __init__(self, instance=None)"
},
{
"docstring": "Iterates through the fields that were declared for this template. Yi... | 4 | stack_v2_sparse_classes_30k_train_014177 | Implement the Python class `SurveyRecordReadOnlyTemplate` described below.
Class description:
A base class that constructs the readonly template for given survey record. This uses the same notion that is used to build the model based readonly templates but the schema read from the survey schema rather than the model.
... | Implement the Python class `SurveyRecordReadOnlyTemplate` described below.
Class description:
A base class that constructs the readonly template for given survey record. This uses the same notion that is used to build the model based readonly templates but the schema read from the survey schema rather than the model.
... | f581989f168189fa3a58c028eff327a16c03e438 | <|skeleton|>
class SurveyRecordReadOnlyTemplate:
"""A base class that constructs the readonly template for given survey record. This uses the same notion that is used to build the model based readonly templates but the schema read from the survey schema rather than the model."""
def __init__(self, instance=Non... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SurveyRecordReadOnlyTemplate:
"""A base class that constructs the readonly template for given survey record. This uses the same notion that is used to build the model based readonly templates but the schema read from the survey schema rather than the model."""
def __init__(self, instance=None):
"... | the_stack_v2_python_sparse | app/soc/views/readonly_template.py | sambitgaan/nupic.son | train | 0 |
cd7450fb2b34d314a912687de247a4d6a88447a4 | [
"n = len(nums)\ns = [0] * (n + 1)\nfor i in range(1, n + 1):\n s[i] = s[i - 1] + nums[i - 1]\nself.s = s",
"if j < i:\n return 0\nj += 1\nreturn self.s[j] - self.s[i]"
] | <|body_start_0|>
n = len(nums)
s = [0] * (n + 1)
for i in range(1, n + 1):
s[i] = s[i - 1] + nums[i - 1]
self.s = s
<|end_body_0|>
<|body_start_1|>
if j < i:
return 0
j += 1
return self.s[j] - self.s[i]
<|end_body_1|>
| NumArray | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NumArray:
def __init__(self, nums):
"""initialize your data structure here. :type nums: List[int]"""
<|body_0|>
def sumRange(self, i, j):
"""sum of elements nums[i..j], inclusive. :type i: int :type j: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_s... | stack_v2_sparse_classes_36k_train_008025 | 989 | no_license | [
{
"docstring": "initialize your data structure here. :type nums: List[int]",
"name": "__init__",
"signature": "def __init__(self, nums)"
},
{
"docstring": "sum of elements nums[i..j], inclusive. :type i: int :type j: int :rtype: int",
"name": "sumRange",
"signature": "def sumRange(self, ... | 2 | null | Implement the Python class `NumArray` described below.
Class description:
Implement the NumArray class.
Method signatures and docstrings:
- def __init__(self, nums): initialize your data structure here. :type nums: List[int]
- def sumRange(self, i, j): sum of elements nums[i..j], inclusive. :type i: int :type j: int ... | Implement the Python class `NumArray` described below.
Class description:
Implement the NumArray class.
Method signatures and docstrings:
- def __init__(self, nums): initialize your data structure here. :type nums: List[int]
- def sumRange(self, i, j): sum of elements nums[i..j], inclusive. :type i: int :type j: int ... | 588a86282b8cc74fa14d810eb3a532c5c3e6de81 | <|skeleton|>
class NumArray:
def __init__(self, nums):
"""initialize your data structure here. :type nums: List[int]"""
<|body_0|>
def sumRange(self, i, j):
"""sum of elements nums[i..j], inclusive. :type i: int :type j: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NumArray:
def __init__(self, nums):
"""initialize your data structure here. :type nums: List[int]"""
n = len(nums)
s = [0] * (n + 1)
for i in range(1, n + 1):
s[i] = s[i - 1] + nums[i - 1]
self.s = s
def sumRange(self, i, j):
"""sum of elements ... | the_stack_v2_python_sparse | solutions/RangeSumQueryImmutable.py | howardhe0329/leetcode | train | 0 | |
67290fa8affe0e3a87ae8e09aef44e35a78bcd11 | [
"all_node_names = set(config['nodes'])\nfor node_pool in config['node_pools'].itervalues():\n invalid_names = set(node_pool.nodes) - all_node_names\n if invalid_names:\n msg = 'NodePool %s contains other NodePools: ' % node_pool.name\n raise ConfigError(msg + ','.join(invalid_names))",
"node_n... | <|body_start_0|>
all_node_names = set(config['nodes'])
for node_pool in config['node_pools'].itervalues():
invalid_names = set(node_pool.nodes) - all_node_names
if invalid_names:
msg = 'NodePool %s contains other NodePools: ' % node_pool.name
raise... | Given a parsed config file (should be only basic literals and containers), return an immutable, fully populated series of namedtuples and FrozenDicts with all defaults filled in, all valid values, and no unused values. Throws a ConfigError if any part of the input dict is invalid. | ValidateConfig | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ValidateConfig:
"""Given a parsed config file (should be only basic literals and containers), return an immutable, fully populated series of namedtuples and FrozenDicts with all defaults filled in, all valid values, and no unused values. Throws a ConfigError if any part of the input dict is inval... | stack_v2_sparse_classes_36k_train_008026 | 22,923 | permissive | [
{
"docstring": "Validate that each node in a node_pool is in fact a node, and not another pool.",
"name": "validate_node_pool_nodes",
"signature": "def validate_node_pool_nodes(self, config)"
},
{
"docstring": "Validate a non-named config.",
"name": "post_validation",
"signature": "def p... | 2 | stack_v2_sparse_classes_30k_train_007549 | Implement the Python class `ValidateConfig` described below.
Class description:
Given a parsed config file (should be only basic literals and containers), return an immutable, fully populated series of namedtuples and FrozenDicts with all defaults filled in, all valid values, and no unused values. Throws a ConfigError... | Implement the Python class `ValidateConfig` described below.
Class description:
Given a parsed config file (should be only basic literals and containers), return an immutable, fully populated series of namedtuples and FrozenDicts with all defaults filled in, all valid values, and no unused values. Throws a ConfigError... | d7e9e843146e49b5499a176bfd65abb7b86bc416 | <|skeleton|>
class ValidateConfig:
"""Given a parsed config file (should be only basic literals and containers), return an immutable, fully populated series of namedtuples and FrozenDicts with all defaults filled in, all valid values, and no unused values. Throws a ConfigError if any part of the input dict is inval... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ValidateConfig:
"""Given a parsed config file (should be only basic literals and containers), return an immutable, fully populated series of namedtuples and FrozenDicts with all defaults filled in, all valid values, and no unused values. Throws a ConfigError if any part of the input dict is invalid."""
d... | the_stack_v2_python_sparse | tron/config/config_parse.py | todun/Tron | train | 0 |
940f96073b4be6f1cd26d60d650d699e43d1e099 | [
"for obj in queryset:\n obj.is_tracked = not obj.is_tracked\n if not obj.is_tracked:\n obj.is_visible = False\n obj.save()",
"for obj in queryset:\n obj.is_visible = not obj.is_visible\n if obj.is_visible:\n obj.is_tracked = True\n obj.save()"
] | <|body_start_0|>
for obj in queryset:
obj.is_tracked = not obj.is_tracked
if not obj.is_tracked:
obj.is_visible = False
obj.save()
<|end_body_0|>
<|body_start_1|>
for obj in queryset:
obj.is_visible = not obj.is_visible
if obj.... | A base ModelAdmin class. | ModelAdmin | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModelAdmin:
"""A base ModelAdmin class."""
def change_tracking(self, request, queryset):
"""Inverse tracking of the object."""
<|body_0|>
def change_visibility(self, request, queryset):
"""Inverse visibility of the object."""
<|body_1|>
<|end_skeleton|>
... | stack_v2_sparse_classes_36k_train_008027 | 939 | no_license | [
{
"docstring": "Inverse tracking of the object.",
"name": "change_tracking",
"signature": "def change_tracking(self, request, queryset)"
},
{
"docstring": "Inverse visibility of the object.",
"name": "change_visibility",
"signature": "def change_visibility(self, request, queryset)"
}
] | 2 | stack_v2_sparse_classes_30k_train_016410 | Implement the Python class `ModelAdmin` described below.
Class description:
A base ModelAdmin class.
Method signatures and docstrings:
- def change_tracking(self, request, queryset): Inverse tracking of the object.
- def change_visibility(self, request, queryset): Inverse visibility of the object. | Implement the Python class `ModelAdmin` described below.
Class description:
A base ModelAdmin class.
Method signatures and docstrings:
- def change_tracking(self, request, queryset): Inverse tracking of the object.
- def change_visibility(self, request, queryset): Inverse visibility of the object.
<|skeleton|>
class... | 606cb7d86c2ec0006e060de7b118323a2a9317d1 | <|skeleton|>
class ModelAdmin:
"""A base ModelAdmin class."""
def change_tracking(self, request, queryset):
"""Inverse tracking of the object."""
<|body_0|>
def change_visibility(self, request, queryset):
"""Inverse visibility of the object."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ModelAdmin:
"""A base ModelAdmin class."""
def change_tracking(self, request, queryset):
"""Inverse tracking of the object."""
for obj in queryset:
obj.is_tracked = not obj.is_tracked
if not obj.is_tracked:
obj.is_visible = False
obj.sav... | the_stack_v2_python_sparse | contributors/admin/base.py | slavarobotam/hexlet-friends | train | 0 |
5c866bd349b7a4a8093b3a7e714ac0b72e173c0d | [
"super().__init__()\nself.data_keys = data_keys\nkeys: list[str] = []\nfor key in data_keys:\n if key == 'image':\n keys.append('input')\n elif key == 'boxes':\n keys.append('bbox')\n else:\n keys.append(key)\nself.augs = K.AugmentationSequential(*args, data_keys=keys, **kwargs)",
"d... | <|body_start_0|>
super().__init__()
self.data_keys = data_keys
keys: list[str] = []
for key in data_keys:
if key == 'image':
keys.append('input')
elif key == 'boxes':
keys.append('bbox')
else:
keys.append... | Wrapper around kornia AugmentationSequential to handle input dicts. .. deprecated:: 0.4 Use :class:`kornia.augmentation.container.AugmentationSequential` instead. | AugmentationSequential | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AugmentationSequential:
"""Wrapper around kornia AugmentationSequential to handle input dicts. .. deprecated:: 0.4 Use :class:`kornia.augmentation.container.AugmentationSequential` instead."""
def __init__(self, *args: Union[K.base._AugmentationBase, K.ImageSequential], data_keys: list[str],... | stack_v2_sparse_classes_36k_train_008028 | 5,655 | permissive | [
{
"docstring": "Initialize a new augmentation sequential instance. Args: *args: Sequence of kornia augmentations data_keys: List of inputs to augment (e.g., [\"image\", \"mask\", \"boxes\"]) **kwargs: Keyword arguments passed to ``K.AugmentationSequential`` .. versionadded:: 0.5 The ``**kwargs`` parameter.",
... | 2 | null | Implement the Python class `AugmentationSequential` described below.
Class description:
Wrapper around kornia AugmentationSequential to handle input dicts. .. deprecated:: 0.4 Use :class:`kornia.augmentation.container.AugmentationSequential` instead.
Method signatures and docstrings:
- def __init__(self, *args: Union... | Implement the Python class `AugmentationSequential` described below.
Class description:
Wrapper around kornia AugmentationSequential to handle input dicts. .. deprecated:: 0.4 Use :class:`kornia.augmentation.container.AugmentationSequential` instead.
Method signatures and docstrings:
- def __init__(self, *args: Union... | 29985861614b3b93f9ef5389469ebb98570de7dd | <|skeleton|>
class AugmentationSequential:
"""Wrapper around kornia AugmentationSequential to handle input dicts. .. deprecated:: 0.4 Use :class:`kornia.augmentation.container.AugmentationSequential` instead."""
def __init__(self, *args: Union[K.base._AugmentationBase, K.ImageSequential], data_keys: list[str],... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AugmentationSequential:
"""Wrapper around kornia AugmentationSequential to handle input dicts. .. deprecated:: 0.4 Use :class:`kornia.augmentation.container.AugmentationSequential` instead."""
def __init__(self, *args: Union[K.base._AugmentationBase, K.ImageSequential], data_keys: list[str], **kwargs: An... | the_stack_v2_python_sparse | torchgeo/transforms/transforms.py | microsoft/torchgeo | train | 1,724 |
849ee7756b4a2a7a10b4f607728664cad457cc32 | [
"try:\n return get_app_name(i)\nexcept CatalogError as e:\n raise EntityNameError('Unable to find name for app id: {}'.format(i))",
"try:\n return get_app_names(ids)\nexcept CatalogError as e:\n raise EntityNameError('Unable to find app names: {}'.format(str(e)))",
"try:\n return get_app_name(i) ... | <|body_start_0|>
try:
return get_app_name(i)
except CatalogError as e:
raise EntityNameError('Unable to find name for app id: {}'.format(i))
<|end_body_0|>
<|body_start_1|>
try:
return get_app_names(ids)
except CatalogError as e:
raise Ent... | AppType | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AppType:
def get_name_from_id(i: str, token: str) -> str:
"""Should return the name as a str. If a fail happens, raise an EntityNameError"""
<|body_0|>
def get_names_from_ids(ids: List[str], token: str) -> Dict[str, str]:
"""Should return a dict with keys -> values =... | stack_v2_sparse_classes_36k_train_008029 | 1,266 | permissive | [
{
"docstring": "Should return the name as a str. If a fail happens, raise an EntityNameError",
"name": "get_name_from_id",
"signature": "def get_name_from_id(i: str, token: str) -> str"
},
{
"docstring": "Should return a dict with keys -> values = ids -> names. If any of them fail, set id -> Non... | 3 | stack_v2_sparse_classes_30k_train_001524 | Implement the Python class `AppType` described below.
Class description:
Implement the AppType class.
Method signatures and docstrings:
- def get_name_from_id(i: str, token: str) -> str: Should return the name as a str. If a fail happens, raise an EntityNameError
- def get_names_from_ids(ids: List[str], token: str) -... | Implement the Python class `AppType` described below.
Class description:
Implement the AppType class.
Method signatures and docstrings:
- def get_name_from_id(i: str, token: str) -> str: Should return the name as a str. If a fail happens, raise an EntityNameError
- def get_names_from_ids(ids: List[str], token: str) -... | a2ed4cb88120aeb10a295919cb0fba85e13d462d | <|skeleton|>
class AppType:
def get_name_from_id(i: str, token: str) -> str:
"""Should return the name as a str. If a fail happens, raise an EntityNameError"""
<|body_0|>
def get_names_from_ids(ids: List[str], token: str) -> Dict[str, str]:
"""Should return a dict with keys -> values =... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AppType:
def get_name_from_id(i: str, token: str) -> str:
"""Should return the name as a str. If a fail happens, raise an EntityNameError"""
try:
return get_app_name(i)
except CatalogError as e:
raise EntityNameError('Unable to find name for app id: {}'.format(i... | the_stack_v2_python_sparse | feeds/entity/types/app.py | kbase/feeds | train | 0 | |
948828e5464d4d07cb1299bb678291e4a74e6529 | [
"import Dice\nnumber = Dice.dice.Dicerolling(self)\nres = number\nexp = Dice.dice.rollGet(self)\nself.assertEqual(res, exp)",
"import Dice\nnumber = Dice.dice.Dicerolling(self)\nres = number\nexp = 1 <= res <= 6\nself.assertTrue(exp)"
] | <|body_start_0|>
import Dice
number = Dice.dice.Dicerolling(self)
res = number
exp = Dice.dice.rollGet(self)
self.assertEqual(res, exp)
<|end_body_0|>
<|body_start_1|>
import Dice
number = Dice.dice.Dicerolling(self)
res = number
exp = 1 <= res <=... | This is the unittest for the class Dice | dicetest | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class dicetest:
"""This is the unittest for the class Dice"""
def testdice1(self):
"""Tests if rollGet returns the correct number"""
<|body_0|>
def testdice2(self):
"""Tests if the dice rolling works, giving a number between 1-6"""
<|body_1|>
<|end_skeleton|>
... | stack_v2_sparse_classes_36k_train_008030 | 637 | permissive | [
{
"docstring": "Tests if rollGet returns the correct number",
"name": "testdice1",
"signature": "def testdice1(self)"
},
{
"docstring": "Tests if the dice rolling works, giving a number between 1-6",
"name": "testdice2",
"signature": "def testdice2(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_012405 | Implement the Python class `dicetest` described below.
Class description:
This is the unittest for the class Dice
Method signatures and docstrings:
- def testdice1(self): Tests if rollGet returns the correct number
- def testdice2(self): Tests if the dice rolling works, giving a number between 1-6 | Implement the Python class `dicetest` described below.
Class description:
This is the unittest for the class Dice
Method signatures and docstrings:
- def testdice1(self): Tests if rollGet returns the correct number
- def testdice2(self): Tests if the dice rolling works, giving a number between 1-6
<|skeleton|>
class... | 73a8962c762ff48da331c9212f10676f066ed940 | <|skeleton|>
class dicetest:
"""This is the unittest for the class Dice"""
def testdice1(self):
"""Tests if rollGet returns the correct number"""
<|body_0|>
def testdice2(self):
"""Tests if the dice rolling works, giving a number between 1-6"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class dicetest:
"""This is the unittest for the class Dice"""
def testdice1(self):
"""Tests if rollGet returns the correct number"""
import Dice
number = Dice.dice.Dicerolling(self)
res = number
exp = Dice.dice.rollGet(self)
self.assertEqual(res, exp)
def te... | the_stack_v2_python_sparse | methoddice/testdice.py | JohanK91/MethodDice | train | 0 |
55089e7c4de259b5df2a9b21b6e5455a3f038c63 | [
"self.heap = []\nself.reverse = [None] * total_models\nself.mapped = {}\nself.infinite = (float('inf'), 1)\nself.mapped[self.infinite] = set()\nself.epsilon = epsilon\nfor model in models:\n self.schedule(model)",
"try:\n self.mapped[model.time_next].add(model)\nexcept KeyError:\n self.mapped[model.time_... | <|body_start_0|>
self.heap = []
self.reverse = [None] * total_models
self.mapped = {}
self.infinite = (float('inf'), 1)
self.mapped[self.infinite] = set()
self.epsilon = epsilon
for model in models:
self.schedule(model)
<|end_body_0|>
<|body_start_1|>... | Scheduler class itself | SchedulerHS | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SchedulerHS:
"""Scheduler class itself"""
def __init__(self, models, epsilon, total_models):
"""Constructor :param models: all models in the simulation"""
<|body_0|>
def schedule(self, model):
"""Schedule a model :param model: the model to schedule"""
<|b... | stack_v2_sparse_classes_36k_train_008031 | 6,929 | permissive | [
{
"docstring": "Constructor :param models: all models in the simulation",
"name": "__init__",
"signature": "def __init__(self, models, epsilon, total_models)"
},
{
"docstring": "Schedule a model :param model: the model to schedule",
"name": "schedule",
"signature": "def schedule(self, mo... | 6 | null | Implement the Python class `SchedulerHS` described below.
Class description:
Scheduler class itself
Method signatures and docstrings:
- def __init__(self, models, epsilon, total_models): Constructor :param models: all models in the simulation
- def schedule(self, model): Schedule a model :param model: the model to sc... | Implement the Python class `SchedulerHS` described below.
Class description:
Scheduler class itself
Method signatures and docstrings:
- def __init__(self, models, epsilon, total_models): Constructor :param models: all models in the simulation
- def schedule(self, model): Schedule a model :param model: the model to sc... | 09692f8d2300172c41ce25331361875c56d0ba4a | <|skeleton|>
class SchedulerHS:
"""Scheduler class itself"""
def __init__(self, models, epsilon, total_models):
"""Constructor :param models: all models in the simulation"""
<|body_0|>
def schedule(self, model):
"""Schedule a model :param model: the model to schedule"""
<|b... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SchedulerHS:
"""Scheduler class itself"""
def __init__(self, models, epsilon, total_models):
"""Constructor :param models: all models in the simulation"""
self.heap = []
self.reverse = [None] * total_models
self.mapped = {}
self.infinite = (float('inf'), 1)
... | the_stack_v2_python_sparse | DEVS Modelling and Simulation/pythonpdevs/src/pypdevs/schedulers/schedulerHS.py | baturayo/Modeling-of-Software-Intensive-Systems | train | 2 |
c87919dc93fafaa2d8e584a99a9487bedd084d4f | [
"self._beta = beta\nself._center = np.array(center)\nself._velocity = np.array(velocity)",
"t = time\nif eos is None:\n eos = IdealSingleGas()\nvortex_loc = self._center + t * self._velocity\nx_rel = x_vec[0] - vortex_loc[0]\ny_rel = x_vec[1] - vortex_loc[1]\nactx = x_vec[0].array_context\ngamma = eos.gamma()\... | <|body_start_0|>
self._beta = beta
self._center = np.array(center)
self._velocity = np.array(velocity)
<|end_body_0|>
<|body_start_1|>
t = time
if eos is None:
eos = IdealSingleGas()
vortex_loc = self._center + t * self._velocity
x_rel = x_vec[0] - vo... | Initializer for the isentropic vortex solution. Implements the isentropic vortex after - [Zhou_2003]_ - [Hesthaven_2008]_, Section 6.6 The isentropic vortex is defined by: .. math:: u &= u_0 - \\beta\\exp^{(1-r^2)}\\frac{y - y_0}{2\\pi}\\\\ v &= v_0 + \\beta\\exp^{(1-r^2)}\\frac{x - x_0}{2\\pi}\\\\ \\rho &= ( 1 - (\\fr... | Vortex2D | [
"X11",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Vortex2D:
"""Initializer for the isentropic vortex solution. Implements the isentropic vortex after - [Zhou_2003]_ - [Hesthaven_2008]_, Section 6.6 The isentropic vortex is defined by: .. math:: u &= u_0 - \\beta\\exp^{(1-r^2)}\\frac{y - y_0}{2\\pi}\\\\ v &= v_0 + \\beta\\exp^{(1-r^2)}\\frac{x - ... | stack_v2_sparse_classes_36k_train_008032 | 32,800 | permissive | [
{
"docstring": "Initialize vortex parameters. Parameters ---------- beta: float vortex amplitude center: numpy.ndarray center of vortex, shape ``(2,)`` velocity: numpy.ndarray fixed flow velocity used for exact solution at t != 0, shape ``(2,)``",
"name": "__init__",
"signature": "def __init__(self, *, ... | 2 | stack_v2_sparse_classes_30k_train_002368 | Implement the Python class `Vortex2D` described below.
Class description:
Initializer for the isentropic vortex solution. Implements the isentropic vortex after - [Zhou_2003]_ - [Hesthaven_2008]_, Section 6.6 The isentropic vortex is defined by: .. math:: u &= u_0 - \\beta\\exp^{(1-r^2)}\\frac{y - y_0}{2\\pi}\\\\ v &=... | Implement the Python class `Vortex2D` described below.
Class description:
Initializer for the isentropic vortex solution. Implements the isentropic vortex after - [Zhou_2003]_ - [Hesthaven_2008]_, Section 6.6 The isentropic vortex is defined by: .. math:: u &= u_0 - \\beta\\exp^{(1-r^2)}\\frac{y - y_0}{2\\pi}\\\\ v &=... | 47f144782258eae2b1fb39520e96f414ae176ff4 | <|skeleton|>
class Vortex2D:
"""Initializer for the isentropic vortex solution. Implements the isentropic vortex after - [Zhou_2003]_ - [Hesthaven_2008]_, Section 6.6 The isentropic vortex is defined by: .. math:: u &= u_0 - \\beta\\exp^{(1-r^2)}\\frac{y - y_0}{2\\pi}\\\\ v &= v_0 + \\beta\\exp^{(1-r^2)}\\frac{x - ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Vortex2D:
"""Initializer for the isentropic vortex solution. Implements the isentropic vortex after - [Zhou_2003]_ - [Hesthaven_2008]_, Section 6.6 The isentropic vortex is defined by: .. math:: u &= u_0 - \\beta\\exp^{(1-r^2)}\\frac{y - y_0}{2\\pi}\\\\ v &= v_0 + \\beta\\exp^{(1-r^2)}\\frac{x - x_0}{2\\pi}\\... | the_stack_v2_python_sparse | mirgecom/initializers.py | kaushikcfd/mirgecom | train | 0 |
cfa910cbfe75fddba9f3619dd7ba5fd9b71fa631 | [
"super(ConvLSTMCell, self).__init__()\nself.input_channels = input_channels\nself.hidden_channels = hidden_channels\nkernel_size = utils._pair(kernel_size)\npadding = (kernel_size[0] // 2, kernel_size[1] // 2)\nself.conv = nn.Conv2d(in_channels=input_channels + hidden_channels, out_channels=4 * hidden_channels, ker... | <|body_start_0|>
super(ConvLSTMCell, self).__init__()
self.input_channels = input_channels
self.hidden_channels = hidden_channels
kernel_size = utils._pair(kernel_size)
padding = (kernel_size[0] // 2, kernel_size[1] // 2)
self.conv = nn.Conv2d(in_channels=input_channels +... | ConvLSTMCell | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConvLSTMCell:
def __init__(self, input_channels, hidden_channels, kernel_size=5, bias=True):
"""Construction of convolutional-LSTM cell. Arguments: ---------- (Hyper-parameters of input/output interfaces) input_channels: int Number of channels of the input tensor. hidden_channels: int Nu... | stack_v2_sparse_classes_36k_train_008033 | 9,867 | permissive | [
{
"docstring": "Construction of convolutional-LSTM cell. Arguments: ---------- (Hyper-parameters of input/output interfaces) input_channels: int Number of channels of the input tensor. hidden_channels: int Number of channels of the hidden/cell states. (Hyper-parameters of the convolutional opeations) kernel_siz... | 3 | null | Implement the Python class `ConvLSTMCell` described below.
Class description:
Implement the ConvLSTMCell class.
Method signatures and docstrings:
- def __init__(self, input_channels, hidden_channels, kernel_size=5, bias=True): Construction of convolutional-LSTM cell. Arguments: ---------- (Hyper-parameters of input/o... | Implement the Python class `ConvLSTMCell` described below.
Class description:
Implement the ConvLSTMCell class.
Method signatures and docstrings:
- def __init__(self, input_channels, hidden_channels, kernel_size=5, bias=True): Construction of convolutional-LSTM cell. Arguments: ---------- (Hyper-parameters of input/o... | baa19ee4e9f3422a052794e50791495632290b36 | <|skeleton|>
class ConvLSTMCell:
def __init__(self, input_channels, hidden_channels, kernel_size=5, bias=True):
"""Construction of convolutional-LSTM cell. Arguments: ---------- (Hyper-parameters of input/output interfaces) input_channels: int Number of channels of the input tensor. hidden_channels: int Nu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ConvLSTMCell:
def __init__(self, input_channels, hidden_channels, kernel_size=5, bias=True):
"""Construction of convolutional-LSTM cell. Arguments: ---------- (Hyper-parameters of input/output interfaces) input_channels: int Number of channels of the input tensor. hidden_channels: int Number of channe... | the_stack_v2_python_sparse | conv-tt-lstm/code/convlstmcell.py | usangbong/Data-Visualization-Lab-RND | train | 7 | |
55edd90db2356510dd7c9400203ecdbbf70ef464 | [
"fst_filename = './TestFiles/fst1'\nwith open(fst_filename, 'r') as fst_file:\n fst_rules = fst_file.readlines()\nexpected_output = '\"b\"'\nacceptor = FSTAcceptor(fst_rules)\nself.assertFalse(acceptor.can_accept_string(self.test_string1))\nself.assertTrue(acceptor.can_accept_string(self.test_string2))\nself.ass... | <|body_start_0|>
fst_filename = './TestFiles/fst1'
with open(fst_filename, 'r') as fst_file:
fst_rules = fst_file.readlines()
expected_output = '"b"'
acceptor = FSTAcceptor(fst_rules)
self.assertFalse(acceptor.can_accept_string(self.test_string1))
self.assertT... | This class contains tests for the FSTAcceptor class | TestFSTAcceptor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestFSTAcceptor:
"""This class contains tests for the FSTAcceptor class"""
def test_fst1(self):
"""Tests for FST1 :return: void"""
<|body_0|>
def test_fst2(self):
"""Tests for FST2 :return: void"""
<|body_1|>
def test_fst3(self):
"""Tests for... | stack_v2_sparse_classes_36k_train_008034 | 7,372 | no_license | [
{
"docstring": "Tests for FST1 :return: void",
"name": "test_fst1",
"signature": "def test_fst1(self)"
},
{
"docstring": "Tests for FST2 :return: void",
"name": "test_fst2",
"signature": "def test_fst2(self)"
},
{
"docstring": "Tests for FST3 :return: void",
"name": "test_fst... | 3 | stack_v2_sparse_classes_30k_train_015793 | Implement the Python class `TestFSTAcceptor` described below.
Class description:
This class contains tests for the FSTAcceptor class
Method signatures and docstrings:
- def test_fst1(self): Tests for FST1 :return: void
- def test_fst2(self): Tests for FST2 :return: void
- def test_fst3(self): Tests for FST3 :return: ... | Implement the Python class `TestFSTAcceptor` described below.
Class description:
This class contains tests for the FSTAcceptor class
Method signatures and docstrings:
- def test_fst1(self): Tests for FST1 :return: void
- def test_fst2(self): Tests for FST2 :return: void
- def test_fst3(self): Tests for FST3 :return: ... | 7af7b357347ed526de7a3d6f16652843d214dcbf | <|skeleton|>
class TestFSTAcceptor:
"""This class contains tests for the FSTAcceptor class"""
def test_fst1(self):
"""Tests for FST1 :return: void"""
<|body_0|>
def test_fst2(self):
"""Tests for FST2 :return: void"""
<|body_1|>
def test_fst3(self):
"""Tests for... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestFSTAcceptor:
"""This class contains tests for the FSTAcceptor class"""
def test_fst1(self):
"""Tests for FST1 :return: void"""
fst_filename = './TestFiles/fst1'
with open(fst_filename, 'r') as fst_file:
fst_rules = fst_file.readlines()
expected_output = '"b... | the_stack_v2_python_sparse | FiniteStateMachines/FSTAcceptor/fst_acceptor.py | zoew2/Projects | train | 0 |
ed6eb9de4292261311f07df761622b390711a0aa | [
"if id is not None:\n self.id = id\nelse:\n Base.__nb_objects += 1\n self.id = self.__nb_objects",
"if list_dictionaries is None:\n return '[]'\nelse:\n if type(list_dictionaries) is not list:\n raise TypeError('list_dictionaries must be a list')\n jsoned = json.dumps(list_dictionaries)\n... | <|body_start_0|>
if id is not None:
self.id = id
else:
Base.__nb_objects += 1
self.id = self.__nb_objects
<|end_body_0|>
<|body_start_1|>
if list_dictionaries is None:
return '[]'
else:
if type(list_dictionaries) is not list:
... | A Base class Attributes: __nb_objects: counter for the number of objects in class | Base | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Base:
"""A Base class Attributes: __nb_objects: counter for the number of objects in class"""
def __init__(self, id=None):
"""class constructor Args: id: memory id of object"""
<|body_0|>
def to_json_string(list_dictionaries):
"""Returns the JSON string represent... | stack_v2_sparse_classes_36k_train_008035 | 2,281 | no_license | [
{
"docstring": "class constructor Args: id: memory id of object",
"name": "__init__",
"signature": "def __init__(self, id=None)"
},
{
"docstring": "Returns the JSON string representation of list_dictionaries",
"name": "to_json_string",
"signature": "def to_json_string(list_dictionaries)"... | 6 | stack_v2_sparse_classes_30k_train_020150 | Implement the Python class `Base` described below.
Class description:
A Base class Attributes: __nb_objects: counter for the number of objects in class
Method signatures and docstrings:
- def __init__(self, id=None): class constructor Args: id: memory id of object
- def to_json_string(list_dictionaries): Returns the ... | Implement the Python class `Base` described below.
Class description:
A Base class Attributes: __nb_objects: counter for the number of objects in class
Method signatures and docstrings:
- def __init__(self, id=None): class constructor Args: id: memory id of object
- def to_json_string(list_dictionaries): Returns the ... | 2068b35a649d5b791937bd90c9992a0e36976a80 | <|skeleton|>
class Base:
"""A Base class Attributes: __nb_objects: counter for the number of objects in class"""
def __init__(self, id=None):
"""class constructor Args: id: memory id of object"""
<|body_0|>
def to_json_string(list_dictionaries):
"""Returns the JSON string represent... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Base:
"""A Base class Attributes: __nb_objects: counter for the number of objects in class"""
def __init__(self, id=None):
"""class constructor Args: id: memory id of object"""
if id is not None:
self.id = id
else:
Base.__nb_objects += 1
self.id... | the_stack_v2_python_sparse | 0x0C-python-almost_a_circle/models/base.py | abenetsol/holbertonschool-higher_level_programming | train | 0 |
b675dad499f071c9c8fc9c126aad4a5c344cb5a2 | [
"if Queen.safe_xy(x, y, available):\n if Queen.safe_diagonal(x, y, available):\n return (True, available)\nreturn (False, available)",
"if x in available.keys():\n available.pop(x)\nfor row, col in available.items():\n if y in col:\n col.pop(y)\n if len(col) == 0:\n return False\n... | <|body_start_0|>
if Queen.safe_xy(x, y, available):
if Queen.safe_diagonal(x, y, available):
return (True, available)
return (False, available)
<|end_body_0|>
<|body_start_1|>
if x in available.keys():
available.pop(x)
for row, col in available.it... | Queen class | Queen | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Queen:
"""Queen class"""
def attack(x, y, available):
"""Simulate attack * Validate if x and is safe * Validate if diagonal is safe * Delete posibilities in board"""
<|body_0|>
def safe_xy(x, y, available):
"""Validate x in y Delete positions in x Delete cols for... | stack_v2_sparse_classes_36k_train_008036 | 1,574 | permissive | [
{
"docstring": "Simulate attack * Validate if x and is safe * Validate if diagonal is safe * Delete posibilities in board",
"name": "attack",
"signature": "def attack(x, y, available)"
},
{
"docstring": "Validate x in y Delete positions in x Delete cols for y positions in n rows if one col will ... | 3 | stack_v2_sparse_classes_30k_train_001723 | Implement the Python class `Queen` described below.
Class description:
Queen class
Method signatures and docstrings:
- def attack(x, y, available): Simulate attack * Validate if x and is safe * Validate if diagonal is safe * Delete posibilities in board
- def safe_xy(x, y, available): Validate x in y Delete positions... | Implement the Python class `Queen` described below.
Class description:
Queen class
Method signatures and docstrings:
- def attack(x, y, available): Simulate attack * Validate if x and is safe * Validate if diagonal is safe * Delete posibilities in board
- def safe_xy(x, y, available): Validate x in y Delete positions... | 11a08a315dc76e7d2ddc9c742380dcfa9fd58e23 | <|skeleton|>
class Queen:
"""Queen class"""
def attack(x, y, available):
"""Simulate attack * Validate if x and is safe * Validate if diagonal is safe * Delete posibilities in board"""
<|body_0|>
def safe_xy(x, y, available):
"""Validate x in y Delete positions in x Delete cols for... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Queen:
"""Queen class"""
def attack(x, y, available):
"""Simulate attack * Validate if x and is safe * Validate if diagonal is safe * Delete posibilities in board"""
if Queen.safe_xy(x, y, available):
if Queen.safe_diagonal(x, y, available):
return (True, avail... | the_stack_v2_python_sparse | modules/queens/simulation/queen.py | eocode/Queens | train | 0 |
3a44fa07fb62a748a3b82bb4e4bff9c04474f37e | [
"self.universal_sentence_encoder = universal_sentence_encoder\nself.dense_1 = L.Dense(hid_size)\nself.dense_2 = L.Dense(output_size)\nself.dropout = L.Dropout(0.5)",
"x = self.universal_sentence_encoder(input_phrases)\nx = self.dropout(x)\nx = self.dense_1(x)\nx = self.dropout(x)\nx = self.dense_2(x)\nreturn x"
] | <|body_start_0|>
self.universal_sentence_encoder = universal_sentence_encoder
self.dense_1 = L.Dense(hid_size)
self.dense_2 = L.Dense(output_size)
self.dropout = L.Dropout(0.5)
<|end_body_0|>
<|body_start_1|>
x = self.universal_sentence_encoder(input_phrases)
x = self.dr... | Vectorizer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Vectorizer:
def __init__(self, output_size=256, hid_size=256, universal_sentence_encoder=universal_sentence_encoder):
"""A small feedforward network on top of universal sentence encoder. 2-3 layers should be enough"""
<|body_0|>
def __call__(self, input_phrases, is_train=Tru... | stack_v2_sparse_classes_36k_train_008037 | 8,658 | no_license | [
{
"docstring": "A small feedforward network on top of universal sentence encoder. 2-3 layers should be enough",
"name": "__init__",
"signature": "def __init__(self, output_size=256, hid_size=256, universal_sentence_encoder=universal_sentence_encoder)"
},
{
"docstring": "Apply vectorizer. Use dro... | 2 | stack_v2_sparse_classes_30k_train_001091 | Implement the Python class `Vectorizer` described below.
Class description:
Implement the Vectorizer class.
Method signatures and docstrings:
- def __init__(self, output_size=256, hid_size=256, universal_sentence_encoder=universal_sentence_encoder): A small feedforward network on top of universal sentence encoder. 2-... | Implement the Python class `Vectorizer` described below.
Class description:
Implement the Vectorizer class.
Method signatures and docstrings:
- def __init__(self, output_size=256, hid_size=256, universal_sentence_encoder=universal_sentence_encoder): A small feedforward network on top of universal sentence encoder. 2-... | c67ef4ed8fb152cf675c51eb2b4daac83ad954e5 | <|skeleton|>
class Vectorizer:
def __init__(self, output_size=256, hid_size=256, universal_sentence_encoder=universal_sentence_encoder):
"""A small feedforward network on top of universal sentence encoder. 2-3 layers should be enough"""
<|body_0|>
def __call__(self, input_phrases, is_train=Tru... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Vectorizer:
def __init__(self, output_size=256, hid_size=256, universal_sentence_encoder=universal_sentence_encoder):
"""A small feedforward network on top of universal sentence encoder. 2-3 layers should be enough"""
self.universal_sentence_encoder = universal_sentence_encoder
self.de... | the_stack_v2_python_sparse | ryan/ETC/dssm_test.py | modudeepnlp/SentenceSimiarity | train | 3 | |
fd5deef224cbfadccfbb717728d274c63c5c086a | [
"self.api_url = settings.ALEXIA_API['URL']\nself.api_user = settings.ALEXIA_API['USER']\nself.api_pass = settings.ALEXIA_API['PASSWORD']\nself.api_organization = settings.ALEXIA_API['ORGANIZATION']\nself.session = requests.Session()",
"headers = {'content-type': 'application/json'}\npayload = {'method': method, '... | <|body_start_0|>
self.api_url = settings.ALEXIA_API['URL']
self.api_user = settings.ALEXIA_API['USER']
self.api_pass = settings.ALEXIA_API['PASSWORD']
self.api_organization = settings.ALEXIA_API['ORGANIZATION']
self.session = requests.Session()
<|end_body_0|>
<|body_start_1|>
... | Interface to the Alexia API k.alberts | AlexiaInterface | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AlexiaInterface:
"""Interface to the Alexia API k.alberts"""
def __init__(self):
"""Get an interface to the Alexia API, which is not authenticated yet."""
<|body_0|>
def call_method(self, method, params):
"""Calls a method of the Alexia API :param method: The nam... | stack_v2_sparse_classes_36k_train_008038 | 3,669 | permissive | [
{
"docstring": "Get an interface to the Alexia API, which is not authenticated yet.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Calls a method of the Alexia API :param method: The name of the method to call :type method: str :param params: A dict of arguments to gi... | 2 | null | Implement the Python class `AlexiaInterface` described below.
Class description:
Interface to the Alexia API k.alberts
Method signatures and docstrings:
- def __init__(self): Get an interface to the Alexia API, which is not authenticated yet.
- def call_method(self, method, params): Calls a method of the Alexia API :... | Implement the Python class `AlexiaInterface` described below.
Class description:
Interface to the Alexia API k.alberts
Method signatures and docstrings:
- def __init__(self): Get an interface to the Alexia API, which is not authenticated yet.
- def call_method(self, method, params): Calls a method of the Alexia API :... | 5e46b82cab225b452eceffd4a5be6dadccceddd2 | <|skeleton|>
class AlexiaInterface:
"""Interface to the Alexia API k.alberts"""
def __init__(self):
"""Get an interface to the Alexia API, which is not authenticated yet."""
<|body_0|>
def call_method(self, method, params):
"""Calls a method of the Alexia API :param method: The nam... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AlexiaInterface:
"""Interface to the Alexia API k.alberts"""
def __init__(self):
"""Get an interface to the Alexia API, which is not authenticated yet."""
self.api_url = settings.ALEXIA_API['URL']
self.api_user = settings.ALEXIA_API['USER']
self.api_pass = settings.ALEXIA_... | the_stack_v2_python_sparse | amelie/personal_tab/alexia.py | Inter-Actief/amelie | train | 11 |
aa490c87a3bebd5e6f9b9527a9326b04b80e6f09 | [
"self._road_net = road_network\nself._max_drv = max_drivers\nself._exclude_prefix = exclude_prefix\nself._aux_id_prefix = aux_id_prefix\nself._num_drv = 0\nself._insertions = 0",
"num_veh = 0\nfor veh_id in traci.vehicle.getIDList():\n if self._exclude_prefix is None or self._exclude_prefix not in veh_id:\n ... | <|body_start_0|>
self._road_net = road_network
self._max_drv = max_drivers
self._exclude_prefix = exclude_prefix
self._aux_id_prefix = aux_id_prefix
self._num_drv = 0
self._insertions = 0
<|end_body_0|>
<|body_start_1|>
num_veh = 0
for veh_id in traci.veh... | Inserts vehicles in the simulation until the maximum allowed number of auxiliary vehicles is reached. New vehicles are inserted with random OD pairs. | DynamicLoadController | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DynamicLoadController:
"""Inserts vehicles in the simulation until the maximum allowed number of auxiliary vehicles is reached. New vehicles are inserted with random OD pairs."""
def __init__(self, road_network, max_drivers, aux_id_prefix='aux', exclude_prefix=None):
"""Initializes t... | stack_v2_sparse_classes_36k_train_008039 | 3,823 | no_license | [
{
"docstring": "Initializes the auxiliary load controller class :param road_network: the road network :type road_network: sumolib.net.Net :param max_drivers: the maximum allowed number of auxiliary drivers :type max_drivers: int :param aux_id_prefix: :type aux_id_prefix: str :param exclude_prefix: exclude these... | 2 | stack_v2_sparse_classes_30k_train_006440 | Implement the Python class `DynamicLoadController` described below.
Class description:
Inserts vehicles in the simulation until the maximum allowed number of auxiliary vehicles is reached. New vehicles are inserted with random OD pairs.
Method signatures and docstrings:
- def __init__(self, road_network, max_drivers,... | Implement the Python class `DynamicLoadController` described below.
Class description:
Inserts vehicles in the simulation until the maximum allowed number of auxiliary vehicles is reached. New vehicles are inserted with random OD pairs.
Method signatures and docstrings:
- def __init__(self, road_network, max_drivers,... | 773cae4d2e15b1b42ffddeb5eb0be6d158085a3b | <|skeleton|>
class DynamicLoadController:
"""Inserts vehicles in the simulation until the maximum allowed number of auxiliary vehicles is reached. New vehicles are inserted with random OD pairs."""
def __init__(self, road_network, max_drivers, aux_id_prefix='aux', exclude_prefix=None):
"""Initializes t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DynamicLoadController:
"""Inserts vehicles in the simulation until the maximum allowed number of auxiliary vehicles is reached. New vehicles are inserted with random OD pairs."""
def __init__(self, road_network, max_drivers, aux_id_prefix='aux', exclude_prefix=None):
"""Initializes the auxiliary ... | the_stack_v2_python_sparse | roadpricing/auxiliaryload.py | maslab-ufrgs/road-pricing | train | 1 |
24721ccdc741b7e95bd55e382d93b184749a3305 | [
"self.id = id\nself.base_url = base_url or self.DEFAULT_API_BASE_URL\nself.params = params or {}\nself._session = None",
"if self._session is None:\n _session = requests.Session()\n retry = Retry(total=5, read=5, connect=5, backoff_factor=0.3, status_forcelist=(500, 502, 504))\n adapter = HTTPAdapter(max... | <|body_start_0|>
self.id = id
self.base_url = base_url or self.DEFAULT_API_BASE_URL
self.params = params or {}
self._session = None
<|end_body_0|>
<|body_start_1|>
if self._session is None:
_session = requests.Session()
retry = Retry(total=5, read=5, conn... | Crossref Event Data harvester. | CrossrefHarvester | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CrossrefHarvester:
"""Crossref Event Data harvester."""
def __init__(self, *, id: str=None, base_url: str=None, params: dict=None):
"""."""
<|body_0|>
def session(self):
"""Create a session for making HTTP requests to the API."""
<|body_1|>
def _clea... | stack_v2_sparse_classes_36k_train_008040 | 5,641 | permissive | [
{
"docstring": ".",
"name": "__init__",
"signature": "def __init__(self, *, id: str=None, base_url: str=None, params: dict=None)"
},
{
"docstring": "Create a session for making HTTP requests to the API.",
"name": "session",
"signature": "def session(self)"
},
{
"docstring": "Clea... | 6 | stack_v2_sparse_classes_30k_train_001742 | Implement the Python class `CrossrefHarvester` described below.
Class description:
Crossref Event Data harvester.
Method signatures and docstrings:
- def __init__(self, *, id: str=None, base_url: str=None, params: dict=None): .
- def session(self): Create a session for making HTTP requests to the API.
- def _clean_sc... | Implement the Python class `CrossrefHarvester` described below.
Class description:
Crossref Event Data harvester.
Method signatures and docstrings:
- def __init__(self, *, id: str=None, base_url: str=None, params: dict=None): .
- def session(self): Create a session for making HTTP requests to the API.
- def _clean_sc... | e7d24f8723ab1dc16213a5797a15c57a3a453d3e | <|skeleton|>
class CrossrefHarvester:
"""Crossref Event Data harvester."""
def __init__(self, *, id: str=None, base_url: str=None, params: dict=None):
"""."""
<|body_0|>
def session(self):
"""Create a session for making HTTP requests to the API."""
<|body_1|>
def _clea... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CrossrefHarvester:
"""Crossref Event Data harvester."""
def __init__(self, *, id: str=None, base_url: str=None, params: dict=None):
"""."""
self.id = id
self.base_url = base_url or self.DEFAULT_API_BASE_URL
self.params = params or {}
self._session = None
def s... | the_stack_v2_python_sparse | asclepias_broker/harvester/crossref.py | asclepias/asclepias-broker | train | 11 |
6ef1aea382600d69f0fc82a1d2e209fcbc44be1c | [
"if server_ip == '' and server_port != 0 or (server_ip != '' and server_port == 0):\n raise Exception('server_ip和server_port必须同时指定')\nself._server_ip = server_ip\nself._server_port = server_port\nself._service_name = service_name\nself._host = host",
"headers = {'org': org, 'user': user}\nroute_name = ''\nserv... | <|body_start_0|>
if server_ip == '' and server_port != 0 or (server_ip != '' and server_port == 0):
raise Exception('server_ip和server_port必须同时指定')
self._server_ip = server_ip
self._server_port = server_port
self._service_name = service_name
self._host = host
<|end_bod... | TaskClient | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TaskClient:
def __init__(self, server_ip='', server_port=0, service_name='', host=''):
"""初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和service_... | stack_v2_sparse_classes_36k_train_008041 | 2,733 | permissive | [
{
"docstring": "初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和service_name同时设置,server_ip优先级更高 :param host: 指定sdk请求服务的host名称, 如cmdb.easyops-only.com",
"name": "__ini... | 2 | stack_v2_sparse_classes_30k_train_013257 | Implement the Python class `TaskClient` described below.
Class description:
Implement the TaskClient class.
Method signatures and docstrings:
- def __init__(self, server_ip='', server_port=0, service_name='', host=''): 初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与s... | Implement the Python class `TaskClient` described below.
Class description:
Implement the TaskClient class.
Method signatures and docstrings:
- def __init__(self, server_ip='', server_port=0, service_name='', host=''): 初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与s... | adf6e3bad33fa6266b5fa0a449dd4ac42f8447d0 | <|skeleton|>
class TaskClient:
def __init__(self, server_ip='', server_port=0, service_name='', host=''):
"""初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和service_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TaskClient:
def __init__(self, server_ip='', server_port=0, service_name='', host=''):
"""初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和service_name同时设置,serve... | the_stack_v2_python_sparse | webshell_sdk/api/task/task_client.py | easyopsapis/easyops-api-python | train | 5 | |
9b8820eec4dbf8634650d9bed86640a09eddf1cc | [
"if word not in before.wv.vocab or word not in after.wv.vocab:\n return 0\nvec1 = before.wv[word] / np.linalg.norm(before.wv[word])\nvec2 = after.wv[word] / np.linalg.norm(after.wv[word])\nsim = vec1.dot(vec2)\nreturn 1 - sim",
"if word not in before.wv.vocab or word not in after.wv.vocab:\n return 0\nnn1 =... | <|body_start_0|>
if word not in before.wv.vocab or word not in after.wv.vocab:
return 0
vec1 = before.wv[word] / np.linalg.norm(before.wv[word])
vec2 = after.wv[word] / np.linalg.norm(after.wv[word])
sim = vec1.dot(vec2)
return 1 - sim
<|end_body_0|>
<|body_start_1|>... | HamiltonMeasures | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HamiltonMeasures:
def linguistic_drift(before, after, word):
"""Hamilton et al. (2016) proposed a measure for linguistic drift, which is simply the cosine distance between the embeddings of a word before and after Parameters ---------- :before: gensim.models.Word2Vec embeddings model :af... | stack_v2_sparse_classes_36k_train_008042 | 2,166 | permissive | [
{
"docstring": "Hamilton et al. (2016) proposed a measure for linguistic drift, which is simply the cosine distance between the embeddings of a word before and after Parameters ---------- :before: gensim.models.Word2Vec embeddings model :after: gensim.models.Word2Vec embeddings model :word: str word for which t... | 2 | stack_v2_sparse_classes_30k_train_012053 | Implement the Python class `HamiltonMeasures` described below.
Class description:
Implement the HamiltonMeasures class.
Method signatures and docstrings:
- def linguistic_drift(before, after, word): Hamilton et al. (2016) proposed a measure for linguistic drift, which is simply the cosine distance between the embeddi... | Implement the Python class `HamiltonMeasures` described below.
Class description:
Implement the HamiltonMeasures class.
Method signatures and docstrings:
- def linguistic_drift(before, after, word): Hamilton et al. (2016) proposed a measure for linguistic drift, which is simply the cosine distance between the embeddi... | 824079b388d0eebc92b2197805b27ed320353f8f | <|skeleton|>
class HamiltonMeasures:
def linguistic_drift(before, after, word):
"""Hamilton et al. (2016) proposed a measure for linguistic drift, which is simply the cosine distance between the embeddings of a word before and after Parameters ---------- :before: gensim.models.Word2Vec embeddings model :af... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HamiltonMeasures:
def linguistic_drift(before, after, word):
"""Hamilton et al. (2016) proposed a measure for linguistic drift, which is simply the cosine distance between the embeddings of a word before and after Parameters ---------- :before: gensim.models.Word2Vec embeddings model :after: gensim.mo... | the_stack_v2_python_sparse | modules/semshift/measures.py | petershan1119/semantic-progressiveness | train | 0 | |
b944d90d4784de8c2f92b8ac1bae26e5718db186 | [
"super(rDecoderNet, self).__init__()\nif len(out_dim) == 2:\n c = 1\n self.reshape_ = (out_dim[0], out_dim[1])\nelse:\n c = out_dim[-1]\n self.reshape_ = (out_dim[0], out_dim[1], c)\nself.skip = skip\nself.coord_latent = coord_latent(latent_dim, hidden_dim, not skip)\nfc_decoder = []\nfor i in range(num... | <|body_start_0|>
super(rDecoderNet, self).__init__()
if len(out_dim) == 2:
c = 1
self.reshape_ = (out_dim[0], out_dim[1])
else:
c = out_dim[-1]
self.reshape_ = (out_dim[0], out_dim[1], c)
self.skip = skip
self.coord_latent = coord_l... | Spatial decoder network with (optional) skip connections Args: out_dim: output dimensions: (height, width) or (height, width, channels) latent_dim: number of latent dimensions associated with images content num_layers: number of fully connected layers hidden_dim: number of neurons in each fully connected layer skip: Us... | rDecoderNet | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class rDecoderNet:
"""Spatial decoder network with (optional) skip connections Args: out_dim: output dimensions: (height, width) or (height, width, channels) latent_dim: number of latent dimensions associated with images content num_layers: number of fully connected layers hidden_dim: number of neurons... | stack_v2_sparse_classes_36k_train_008043 | 28,462 | permissive | [
{
"docstring": "Initializes network parameters",
"name": "__init__",
"signature": "def __init__(self, out_dim: Tuple[int], latent_dim: int, num_layers: int, hidden_dim: int, skip: bool=False) -> None"
},
{
"docstring": "Forward pass",
"name": "forward",
"signature": "def forward(self, x_... | 2 | stack_v2_sparse_classes_30k_train_004945 | Implement the Python class `rDecoderNet` described below.
Class description:
Spatial decoder network with (optional) skip connections Args: out_dim: output dimensions: (height, width) or (height, width, channels) latent_dim: number of latent dimensions associated with images content num_layers: number of fully connect... | Implement the Python class `rDecoderNet` described below.
Class description:
Spatial decoder network with (optional) skip connections Args: out_dim: output dimensions: (height, width) or (height, width, channels) latent_dim: number of latent dimensions associated with images content num_layers: number of fully connect... | 6d187296074143d017ca8fc60302364cd946b180 | <|skeleton|>
class rDecoderNet:
"""Spatial decoder network with (optional) skip connections Args: out_dim: output dimensions: (height, width) or (height, width, channels) latent_dim: number of latent dimensions associated with images content num_layers: number of fully connected layers hidden_dim: number of neurons... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class rDecoderNet:
"""Spatial decoder network with (optional) skip connections Args: out_dim: output dimensions: (height, width) or (height, width, channels) latent_dim: number of latent dimensions associated with images content num_layers: number of fully connected layers hidden_dim: number of neurons in each full... | the_stack_v2_python_sparse | atomai/nets/ed.py | pycroscopy/atomai | train | 157 |
b2530147f2e24cfc0f6131f19773a863275754e5 | [
"super(Encoder, self).__init__()\nself.N = N\nself.dm = dm\nself.embedding = tf.keras.layers.Embedding(input_vocab, self.dm)\nself.positional_encoding = positional_encoding(max_seq_len, self.dm)\nself.blocks = [EncoderBlock(dm, h, hidden, drop_rate) for m in range(self.N)]\nself.dropout = tf.keras.layers.Dropout(dr... | <|body_start_0|>
super(Encoder, self).__init__()
self.N = N
self.dm = dm
self.embedding = tf.keras.layers.Embedding(input_vocab, self.dm)
self.positional_encoding = positional_encoding(max_seq_len, self.dm)
self.blocks = [EncoderBlock(dm, h, hidden, drop_rate) for m in ra... | Encoder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Encoder:
def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1):
"""Class Constructor param:: :N: number of blocks in the encoder param:: dm: dimensionality of the model param:: h: number of heads param:: hidden: number of hidden units in the fully connected layer ... | stack_v2_sparse_classes_36k_train_008044 | 2,487 | no_license | [
{
"docstring": "Class Constructor param:: :N: number of blocks in the encoder param:: dm: dimensionality of the model param:: h: number of heads param:: hidden: number of hidden units in the fully connected layer param:: input_vocab: size of the input vocabulary param:: max_seq_len: maximum sequence length poss... | 2 | stack_v2_sparse_classes_30k_train_010997 | Implement the Python class `Encoder` described below.
Class description:
Implement the Encoder class.
Method signatures and docstrings:
- def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): Class Constructor param:: :N: number of blocks in the encoder param:: dm: dimensionality of the model... | Implement the Python class `Encoder` described below.
Class description:
Implement the Encoder class.
Method signatures and docstrings:
- def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): Class Constructor param:: :N: number of blocks in the encoder param:: dm: dimensionality of the model... | 4ac942126918c7acaa9ef88d18efe299b2f726fe | <|skeleton|>
class Encoder:
def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1):
"""Class Constructor param:: :N: number of blocks in the encoder param:: dm: dimensionality of the model param:: h: number of heads param:: hidden: number of hidden units in the fully connected layer ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Encoder:
def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1):
"""Class Constructor param:: :N: number of blocks in the encoder param:: dm: dimensionality of the model param:: h: number of heads param:: hidden: number of hidden units in the fully connected layer param:: input_... | the_stack_v2_python_sparse | supervised_learning/0x11-attention/9-transformer_encoder.py | DracoMindz/holbertonschool-machine_learning | train | 2 | |
ea323a40e1a18d08974ed9dc7e44ef8a46fd45e6 | [
"super().__init__()\nself.momentum = momentum\nself.inv_momentum = 1.0 - momentum\nself.crops_for_assign = crops_for_assign\nself.is_distributed = False\nself.momentum_eval_mode_iter_start = momentum_eval_mode_iter_start",
"logging.info('Building momentum encoder - rank %s %s', *get_machine_local_and_dist_rank())... | <|body_start_0|>
super().__init__()
self.momentum = momentum
self.inv_momentum = 1.0 - momentum
self.crops_for_assign = crops_for_assign
self.is_distributed = False
self.momentum_eval_mode_iter_start = momentum_eval_mode_iter_start
<|end_body_0|>
<|body_start_1|>
... | This hook is for the extension of the SwAV loss proposed in paper https://arxiv.org/abs/2006.09882 by Caron et al. The loss combines the benefits of using the SwAV approach with the momentum encoder as used in MoCo. | SwAVMomentumHook | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SwAVMomentumHook:
"""This hook is for the extension of the SwAV loss proposed in paper https://arxiv.org/abs/2006.09882 by Caron et al. The loss combines the benefits of using the SwAV approach with the momentum encoder as used in MoCo."""
def __init__(self, momentum: float, momentum_eval_mo... | stack_v2_sparse_classes_36k_train_008045 | 7,963 | permissive | [
{
"docstring": "Args: momentum (float): for the momentum encoder momentum_eval_mode_iter_start (int): from what iteration should the momentum encoder network be in eval mode crops_for_assign (List[int]): what crops to use for assignment",
"name": "__init__",
"signature": "def __init__(self, momentum: fl... | 4 | stack_v2_sparse_classes_30k_train_005654 | Implement the Python class `SwAVMomentumHook` described below.
Class description:
This hook is for the extension of the SwAV loss proposed in paper https://arxiv.org/abs/2006.09882 by Caron et al. The loss combines the benefits of using the SwAV approach with the momentum encoder as used in MoCo.
Method signatures an... | Implement the Python class `SwAVMomentumHook` described below.
Class description:
This hook is for the extension of the SwAV loss proposed in paper https://arxiv.org/abs/2006.09882 by Caron et al. The loss combines the benefits of using the SwAV approach with the momentum encoder as used in MoCo.
Method signatures an... | b647c256447af7ea66655811849be1f642377db8 | <|skeleton|>
class SwAVMomentumHook:
"""This hook is for the extension of the SwAV loss proposed in paper https://arxiv.org/abs/2006.09882 by Caron et al. The loss combines the benefits of using the SwAV approach with the momentum encoder as used in MoCo."""
def __init__(self, momentum: float, momentum_eval_mo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SwAVMomentumHook:
"""This hook is for the extension of the SwAV loss proposed in paper https://arxiv.org/abs/2006.09882 by Caron et al. The loss combines the benefits of using the SwAV approach with the momentum encoder as used in MoCo."""
def __init__(self, momentum: float, momentum_eval_mode_iter_start... | the_stack_v2_python_sparse | vissl/hooks/swav_momentum_hooks.py | pzharrington/vissl | train | 1 |
4308db5d1331f7c667cfebb0ca2e08118d8105df | [
"if not l1:\n return l2\nif not l2:\n return l1\nnew_listnode = ListNode(0)\nnode = new_listnode\nwhile True:\n if l1.val < l2.val:\n node.val = l1.val\n l1 = l1.next\n else:\n node.val = l2.val\n l2 = l2.next\n if not l1:\n node.next = l2\n return new_listno... | <|body_start_0|>
if not l1:
return l2
if not l2:
return l1
new_listnode = ListNode(0)
node = new_listnode
while True:
if l1.val < l2.val:
node.val = l1.val
l1 = l1.next
else:
node.val ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def mergeTwoLists(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
<|body_0|>
def mergeKLists(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not l... | stack_v2_sparse_classes_36k_train_008046 | 2,390 | no_license | [
{
"docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode",
"name": "mergeTwoLists",
"signature": "def mergeTwoLists(self, l1, l2)"
},
{
"docstring": ":type lists: List[ListNode] :rtype: ListNode",
"name": "mergeKLists",
"signature": "def mergeKLists(self, lists)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001176 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode
- def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode
- def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode
<|skeleton|>... | 621c579c76e9f6b926354a9c25c0b0ed66890800 | <|skeleton|>
class Solution:
def mergeTwoLists(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
<|body_0|>
def mergeKLists(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def mergeTwoLists(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
if not l1:
return l2
if not l2:
return l1
new_listnode = ListNode(0)
node = new_listnode
while True:
if l1.val < l2.val:
... | the_stack_v2_python_sparse | leetcode_23.py | JayWu7/Code | train | 3 | |
c2ab659e0747f2e4c0343986496f389bf53dacaa | [
"im = Image.open(filename)\nwidth, height = im.size\nnew_im = Image.new('RGB', (260, height))\nim_list_upper = []\nim_list_lower = []\nfor location in self.location_list:\n if location['y'] == -58:\n im_list_upper.append(im.crop((abs(location['x']), height // 2, abs(location['x']) + 10, height)))\n if ... | <|body_start_0|>
im = Image.open(filename)
width, height = im.size
new_im = Image.new('RGB', (260, height))
im_list_upper = []
im_list_lower = []
for location in self.location_list:
if location['y'] == -58:
im_list_upper.append(im.crop((abs(loc... | ImgProcess | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImgProcess:
def get_merge_image(self, filename):
"""根据图片位置合并还原 :param filename: 图片 :return: 合并后的图片对象"""
<|body_0|>
def is_px_equal(self, img1, img2, x, y):
"""判断两个像素是否相同 :param img1: 图片1 :param img2:图片2 :param x:位置1 :param y:位置2 :return:像素是否相同"""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_008047 | 4,198 | permissive | [
{
"docstring": "根据图片位置合并还原 :param filename: 图片 :return: 合并后的图片对象",
"name": "get_merge_image",
"signature": "def get_merge_image(self, filename)"
},
{
"docstring": "判断两个像素是否相同 :param img1: 图片1 :param img2:图片2 :param x:位置1 :param y:位置2 :return:像素是否相同",
"name": "is_px_equal",
"signature": "... | 3 | null | Implement the Python class `ImgProcess` described below.
Class description:
Implement the ImgProcess class.
Method signatures and docstrings:
- def get_merge_image(self, filename): 根据图片位置合并还原 :param filename: 图片 :return: 合并后的图片对象
- def is_px_equal(self, img1, img2, x, y): 判断两个像素是否相同 :param img1: 图片1 :param img2:图片2 :... | Implement the Python class `ImgProcess` described below.
Class description:
Implement the ImgProcess class.
Method signatures and docstrings:
- def get_merge_image(self, filename): 根据图片位置合并还原 :param filename: 图片 :return: 合并后的图片对象
- def is_px_equal(self, img1, img2, x, y): 判断两个像素是否相同 :param img1: 图片1 :param img2:图片2 :... | 8cc8586107fecace4b71d0519cfbc760584171b1 | <|skeleton|>
class ImgProcess:
def get_merge_image(self, filename):
"""根据图片位置合并还原 :param filename: 图片 :return: 合并后的图片对象"""
<|body_0|>
def is_px_equal(self, img1, img2, x, y):
"""判断两个像素是否相同 :param img1: 图片1 :param img2:图片2 :param x:位置1 :param y:位置2 :return:像素是否相同"""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ImgProcess:
def get_merge_image(self, filename):
"""根据图片位置合并还原 :param filename: 图片 :return: 合并后的图片对象"""
im = Image.open(filename)
width, height = im.size
new_im = Image.new('RGB', (260, height))
im_list_upper = []
im_list_lower = []
for location in self.... | the_stack_v2_python_sparse | Funny_Js_Crack/54-geetest2/img_locate.py | sumerzhang/Func_Js_Crack | train | 22 | |
b63a1ae282b32d8411014d2d7f59eb25df2225bc | [
"if Seldom.base_url is not None and url.startswith('http') is False:\n url = Seldom.base_url + url\nurl = mock_url(url)\nkwargs.setdefault('allow_redirects', True)\nreturn self.request('GET', url, **kwargs)",
"if Seldom.base_url is not None and url.startswith('http') is False:\n url = Seldom.base_url + url\... | <|body_start_0|>
if Seldom.base_url is not None and url.startswith('http') is False:
url = Seldom.base_url + url
url = mock_url(url)
kwargs.setdefault('allow_redirects', True)
return self.request('GET', url, **kwargs)
<|end_body_0|>
<|body_start_1|>
if Seldom.base_ur... | Session | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Session:
def get(self, url, **kwargs):
"""Sends a GET request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \\*\\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response"""
<|body_0|>
def post(self, url, d... | stack_v2_sparse_classes_36k_train_008048 | 12,377 | permissive | [
{
"docstring": "Sends a GET request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \\\\*\\\\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response",
"name": "get",
"signature": "def get(self, url, **kwargs)"
},
{
"docstring":... | 4 | null | Implement the Python class `Session` described below.
Class description:
Implement the Session class.
Method signatures and docstrings:
- def get(self, url, **kwargs): Sends a GET request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \\*\\*kwargs: Optional arguments th... | Implement the Python class `Session` described below.
Class description:
Implement the Session class.
Method signatures and docstrings:
- def get(self, url, **kwargs): Sends a GET request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \\*\\*kwargs: Optional arguments th... | b3ad3da2ecfd5b3c56520179e431f9b34ba47c69 | <|skeleton|>
class Session:
def get(self, url, **kwargs):
"""Sends a GET request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \\*\\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response"""
<|body_0|>
def post(self, url, d... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Session:
def get(self, url, **kwargs):
"""Sends a GET request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \\*\\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response"""
if Seldom.base_url is not None and url.startswith('... | the_stack_v2_python_sparse | seldom/request.py | SeldomQA/seldom | train | 544 | |
71cfdc640497ea2f7bebdc7362eaa75b4c86c7f2 | [
"nombreStr = type(nombre) == str\npesoInt = type(peso) == int\nif nombreStr and pesoInt:\n nombreLongitud = 1 <= len(nombre) <= 100\n pesoPositivo = peso > 0\n if nombreLongitud and pesoPositivo:\n ultimoId = db.session.query(func.max(Categorias.identificador)).first()\n identificador = ultim... | <|body_start_0|>
nombreStr = type(nombre) == str
pesoInt = type(peso) == int
if nombreStr and pesoInt:
nombreLongitud = 1 <= len(nombre) <= 100
pesoPositivo = peso > 0
if nombreLongitud and pesoPositivo:
ultimoId = db.session.query(func.max(Cat... | clsCategoria | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class clsCategoria:
def insertar(self, nombre, peso):
"""@brief Función que permite insertar los datos de la categoria cuyo id sea "identificador". @param nombre: nombre de la categoria a insertar. @param peso : peso de la categoria. @return True si se inserto la tarea dada. De lo contrario re... | stack_v2_sparse_classes_36k_train_008049 | 4,805 | no_license | [
{
"docstring": "@brief Función que permite insertar los datos de la categoria cuyo id sea \"identificador\". @param nombre: nombre de la categoria a insertar. @param peso : peso de la categoria. @return True si se inserto la tarea dada. De lo contrario retorna False.",
"name": "insertar",
"signature": "... | 3 | stack_v2_sparse_classes_30k_train_001553 | Implement the Python class `clsCategoria` described below.
Class description:
Implement the clsCategoria class.
Method signatures and docstrings:
- def insertar(self, nombre, peso): @brief Función que permite insertar los datos de la categoria cuyo id sea "identificador". @param nombre: nombre de la categoria a inser... | Implement the Python class `clsCategoria` described below.
Class description:
Implement the clsCategoria class.
Method signatures and docstrings:
- def insertar(self, nombre, peso): @brief Función que permite insertar los datos de la categoria cuyo id sea "identificador". @param nombre: nombre de la categoria a inser... | ff183b654f72c0298171855b2db34874f656b7bd | <|skeleton|>
class clsCategoria:
def insertar(self, nombre, peso):
"""@brief Función que permite insertar los datos de la categoria cuyo id sea "identificador". @param nombre: nombre de la categoria a insertar. @param peso : peso de la categoria. @return True si se inserto la tarea dada. De lo contrario re... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class clsCategoria:
def insertar(self, nombre, peso):
"""@brief Función que permite insertar los datos de la categoria cuyo id sea "identificador". @param nombre: nombre de la categoria a insertar. @param peso : peso de la categoria. @return True si se inserto la tarea dada. De lo contrario retorna False.""... | the_stack_v2_python_sparse | app/scrum/funcCategoria.py | edanfersi94/SoftDev | train | 0 | |
414ee9c80cfdcba736853f476cf2d70934ddceaf | [
"products = Product.objects.all()\nserializer = ProductSerializer(products, many=True)\nreturn Response({'products': serializer.data})",
"product_id = request.data.get('id')\nsaved_product = get_object_or_404(Product.objects.all(), pk=product_id)\ndata = request.data.get('product')\nserializer = ProductSerializer... | <|body_start_0|>
products = Product.objects.all()
serializer = ProductSerializer(products, many=True)
return Response({'products': serializer.data})
<|end_body_0|>
<|body_start_1|>
product_id = request.data.get('id')
saved_product = get_object_or_404(Product.objects.all(), pk=pr... | Implementation CRUD api operation | ShopView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ShopView:
"""Implementation CRUD api operation"""
def get(self, request):
"""Returns the entire list of products as json"""
<|body_0|>
def post(self, request):
"""Updates product with the passed id"""
<|body_1|>
def put(self, request):
"""Add... | stack_v2_sparse_classes_36k_train_008050 | 1,874 | no_license | [
{
"docstring": "Returns the entire list of products as json",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "Updates product with the passed id",
"name": "post",
"signature": "def post(self, request)"
},
{
"docstring": "Adds a new product to the store",
... | 4 | stack_v2_sparse_classes_30k_train_001777 | Implement the Python class `ShopView` described below.
Class description:
Implementation CRUD api operation
Method signatures and docstrings:
- def get(self, request): Returns the entire list of products as json
- def post(self, request): Updates product with the passed id
- def put(self, request): Adds a new product... | Implement the Python class `ShopView` described below.
Class description:
Implementation CRUD api operation
Method signatures and docstrings:
- def get(self, request): Returns the entire list of products as json
- def post(self, request): Updates product with the passed id
- def put(self, request): Adds a new product... | 8e6f4134a4bfdf7b14da6de937123a29d159220e | <|skeleton|>
class ShopView:
"""Implementation CRUD api operation"""
def get(self, request):
"""Returns the entire list of products as json"""
<|body_0|>
def post(self, request):
"""Updates product with the passed id"""
<|body_1|>
def put(self, request):
"""Add... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ShopView:
"""Implementation CRUD api operation"""
def get(self, request):
"""Returns the entire list of products as json"""
products = Product.objects.all()
serializer = ProductSerializer(products, many=True)
return Response({'products': serializer.data})
def post(sel... | the_stack_v2_python_sparse | HW_6/mastersporta/shop/views.py | romko11l/Sphere-HW | train | 0 |
b527381986686f57533a45e83f1c5b10274dc8ea | [
"self.language = language\nif language is None:\n self.language = 'en'",
"max_length = kwargs.get('max_length', 10 ** 6)\ntry:\n nlp = spacy.load(self.language, max_length=max_length)\nexcept Exception:\n spacy.cli.download(self.language)\n nlp = spacy.load(self.language, max_length=max_length)\nspacy... | <|body_start_0|>
self.language = language
if language is None:
self.language = 'en'
<|end_body_0|>
<|body_start_1|>
max_length = kwargs.get('max_length', 10 ** 6)
try:
nlp = spacy.load(self.language, max_length=max_length)
except Exception:
sp... | Reader for raw text. | RawTextReader | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RawTextReader:
"""Reader for raw text."""
def __init__(self, language=None):
"""Constructor for RawTextReader. Args: language (str): language of text to process."""
<|body_0|>
def read(self, text, **kwargs):
"""Read the input file and use spacy to pre-process. Ar... | stack_v2_sparse_classes_36k_train_008051 | 3,076 | permissive | [
{
"docstring": "Constructor for RawTextReader. Args: language (str): language of text to process.",
"name": "__init__",
"signature": "def __init__(self, language=None)"
},
{
"docstring": "Read the input file and use spacy to pre-process. Args: text (str): raw text to pre-process. max_length (int... | 2 | null | Implement the Python class `RawTextReader` described below.
Class description:
Reader for raw text.
Method signatures and docstrings:
- def __init__(self, language=None): Constructor for RawTextReader. Args: language (str): language of text to process.
- def read(self, text, **kwargs): Read the input file and use spa... | Implement the Python class `RawTextReader` described below.
Class description:
Reader for raw text.
Method signatures and docstrings:
- def __init__(self, language=None): Constructor for RawTextReader. Args: language (str): language of text to process.
- def read(self, text, **kwargs): Read the input file and use spa... | d16bf09e21521a6854ff3c7fe6eb271412914960 | <|skeleton|>
class RawTextReader:
"""Reader for raw text."""
def __init__(self, language=None):
"""Constructor for RawTextReader. Args: language (str): language of text to process."""
<|body_0|>
def read(self, text, **kwargs):
"""Read the input file and use spacy to pre-process. Ar... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RawTextReader:
"""Reader for raw text."""
def __init__(self, language=None):
"""Constructor for RawTextReader. Args: language (str): language of text to process."""
self.language = language
if language is None:
self.language = 'en'
def read(self, text, **kwargs):
... | the_stack_v2_python_sparse | onmt/keyphrase/pke/readers.py | memray/OpenNMT-kpg-release | train | 222 |
c79d4ebc742e9ae72c8885a53feca9e0d6d19996 | [
"counterOne = counterTwo = 0\nfor i in range(len(nums)):\n counterOne = ~counterTwo & (counterOne ^ nums[i])\n counterTwo = ~counterOne & (counterTwo ^ nums[i])\nreturn counterOne",
"def singleNumberK(nums, k):\n count = [0] * 32\n ret = 0\n for i in range(32):\n for each in nums:\n ... | <|body_start_0|>
counterOne = counterTwo = 0
for i in range(len(nums)):
counterOne = ~counterTwo & (counterOne ^ nums[i])
counterTwo = ~counterOne & (counterTwo ^ nums[i])
return counterOne
<|end_body_0|>
<|body_start_1|>
def singleNumberK(nums, k):
c... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def singleNumber(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def singleNumber2(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
counterOne = counterTwo = 0
for i ... | stack_v2_sparse_classes_36k_train_008052 | 1,047 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "singleNumber",
"signature": "def singleNumber(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "singleNumber2",
"signature": "def singleNumber2(self, nums)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def singleNumber(self, nums): :type nums: List[int] :rtype: int
- def singleNumber2(self, nums): :type nums: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def singleNumber(self, nums): :type nums: List[int] :rtype: int
- def singleNumber2(self, nums): :type nums: List[int] :rtype: int
<|skeleton|>
class Solution:
def singleNu... | 3251198c4abee5c0ba3e0b535f7c573d909ff4b1 | <|skeleton|>
class Solution:
def singleNumber(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def singleNumber2(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def singleNumber(self, nums):
""":type nums: List[int] :rtype: int"""
counterOne = counterTwo = 0
for i in range(len(nums)):
counterOne = ~counterTwo & (counterOne ^ nums[i])
counterTwo = ~counterOne & (counterTwo ^ nums[i])
return counterOne
... | the_stack_v2_python_sparse | LeetCode/137.singleNumberII/singleNumberII.py | lzzhang212/PythonEx | train | 0 | |
69a4f3364c1ad2d09a7ba27c796ecf954358b061 | [
"super().__init__()\nself.parent = parent\nself.sq_gui = sq_gui",
"while True:\n data = self.sq_gui.get()\n self.gotData.emit((data,))\n self.sq_gui.task_done()"
] | <|body_start_0|>
super().__init__()
self.parent = parent
self.sq_gui = sq_gui
<|end_body_0|>
<|body_start_1|>
while True:
data = self.sq_gui.get()
self.gotData.emit((data,))
self.sq_gui.task_done()
<|end_body_1|>
| DataMonitor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataMonitor:
def __init__(self, parent, sq_gui: SelectableQueue):
"""monitor new messages from server backend :param parent: PyQT5 parent :param sq_gui: Queue for monitoring"""
<|body_0|>
def get_data(self):
"""get data from Queue"""
<|body_1|>
<|end_skeleto... | stack_v2_sparse_classes_36k_train_008053 | 4,893 | no_license | [
{
"docstring": "monitor new messages from server backend :param parent: PyQT5 parent :param sq_gui: Queue for monitoring",
"name": "__init__",
"signature": "def __init__(self, parent, sq_gui: SelectableQueue)"
},
{
"docstring": "get data from Queue",
"name": "get_data",
"signature": "def... | 2 | stack_v2_sparse_classes_30k_train_018498 | Implement the Python class `DataMonitor` described below.
Class description:
Implement the DataMonitor class.
Method signatures and docstrings:
- def __init__(self, parent, sq_gui: SelectableQueue): monitor new messages from server backend :param parent: PyQT5 parent :param sq_gui: Queue for monitoring
- def get_data... | Implement the Python class `DataMonitor` described below.
Class description:
Implement the DataMonitor class.
Method signatures and docstrings:
- def __init__(self, parent, sq_gui: SelectableQueue): monitor new messages from server backend :param parent: PyQT5 parent :param sq_gui: Queue for monitoring
- def get_data... | eaa56064aa2260df6448d9144adb99cc75fe27a2 | <|skeleton|>
class DataMonitor:
def __init__(self, parent, sq_gui: SelectableQueue):
"""monitor new messages from server backend :param parent: PyQT5 parent :param sq_gui: Queue for monitoring"""
<|body_0|>
def get_data(self):
"""get data from Queue"""
<|body_1|>
<|end_skeleto... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DataMonitor:
def __init__(self, parent, sq_gui: SelectableQueue):
"""monitor new messages from server backend :param parent: PyQT5 parent :param sq_gui: Queue for monitoring"""
super().__init__()
self.parent = parent
self.sq_gui = sq_gui
def get_data(self):
"""get ... | the_stack_v2_python_sparse | GeekChat/server/server_gui.py | OlegZhdanoff/ClientServerApp | train | 0 | |
2af45345eaf7ee58c03a72f6d3222caff1433bcc | [
"ctx = super().get_context_data(**kwargs)\nlookup = {reverse('supplier-index'): {'title': _('Suppliers'), 'button_text': _('New Supplier'), 'filters': {'is_supplier': 'true'}, 'pagetype': 'suppliers'}, reverse('manufacturer-index'): {'title': _('Manufacturers'), 'button_text': _('New Manufacturer'), 'filters': {'is... | <|body_start_0|>
ctx = super().get_context_data(**kwargs)
lookup = {reverse('supplier-index'): {'title': _('Suppliers'), 'button_text': _('New Supplier'), 'filters': {'is_supplier': 'true'}, 'pagetype': 'suppliers'}, reverse('manufacturer-index'): {'title': _('Manufacturers'), 'button_text': _('New Manu... | View for displaying list of companies. | CompanyIndex | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CompanyIndex:
"""View for displaying list of companies."""
def get_context_data(self, **kwargs):
"""Add extra context data to the company index page"""
<|body_0|>
def get_queryset(self):
"""Retrieve the Company queryset based on HTTP request parameters. - supplie... | stack_v2_sparse_classes_36k_train_008054 | 3,566 | permissive | [
{
"docstring": "Add extra context data to the company index page",
"name": "get_context_data",
"signature": "def get_context_data(self, **kwargs)"
},
{
"docstring": "Retrieve the Company queryset based on HTTP request parameters. - supplier: Filter by supplier - customer: Filter by customer",
... | 2 | null | Implement the Python class `CompanyIndex` described below.
Class description:
View for displaying list of companies.
Method signatures and docstrings:
- def get_context_data(self, **kwargs): Add extra context data to the company index page
- def get_queryset(self): Retrieve the Company queryset based on HTTP request ... | Implement the Python class `CompanyIndex` described below.
Class description:
View for displaying list of companies.
Method signatures and docstrings:
- def get_context_data(self, **kwargs): Add extra context data to the company index page
- def get_queryset(self): Retrieve the Company queryset based on HTTP request ... | e88a8e99a5f0b201c67a95cba097c729f090d5e2 | <|skeleton|>
class CompanyIndex:
"""View for displaying list of companies."""
def get_context_data(self, **kwargs):
"""Add extra context data to the company index page"""
<|body_0|>
def get_queryset(self):
"""Retrieve the Company queryset based on HTTP request parameters. - supplie... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CompanyIndex:
"""View for displaying list of companies."""
def get_context_data(self, **kwargs):
"""Add extra context data to the company index page"""
ctx = super().get_context_data(**kwargs)
lookup = {reverse('supplier-index'): {'title': _('Suppliers'), 'button_text': _('New Sup... | the_stack_v2_python_sparse | InvenTree/company/views.py | inventree/InvenTree | train | 3,077 |
33ef1fffcfec905b8f6068d382f5aeb94a0ad81a | [
"context = {}\ncotizacion = CotizacionOrdenDeTrabajo.objects.get(id=kwargs['pk'])\nif cotizacion.es_valida():\n info_repuestos_faltantes = self.verificar_inventario_sucursal(cotizacion)\n if info_repuestos_faltantes:\n self.cargar_mensajes_de_errores(info_repuestos_faltantes)\n return HttpRespon... | <|body_start_0|>
context = {}
cotizacion = CotizacionOrdenDeTrabajo.objects.get(id=kwargs['pk'])
if cotizacion.es_valida():
info_repuestos_faltantes = self.verificar_inventario_sucursal(cotizacion)
if info_repuestos_faltantes:
self.cargar_mensajes_de_error... | FacturaOrdenDeTrabajoCreateView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FacturaOrdenDeTrabajoCreateView:
def get(self, request, *args, **kwargs):
"""Documentacion get Permite generar la factura que es el paso siguiente a una cotización de una orden de trabajo, antes de generarse la factura, se comprueba si la cotización no esta vencida, luego se verifica que... | stack_v2_sparse_classes_36k_train_008055 | 7,599 | no_license | [
{
"docstring": "Documentacion get Permite generar la factura que es el paso siguiente a una cotización de una orden de trabajo, antes de generarse la factura, se comprueba si la cotización no esta vencida, luego se verifica que en inventario de la sucursal esten todos los repuestos necesarios para reparar el ve... | 4 | stack_v2_sparse_classes_30k_train_010334 | Implement the Python class `FacturaOrdenDeTrabajoCreateView` described below.
Class description:
Implement the FacturaOrdenDeTrabajoCreateView class.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Documentacion get Permite generar la factura que es el paso siguiente a una cotización de u... | Implement the Python class `FacturaOrdenDeTrabajoCreateView` described below.
Class description:
Implement the FacturaOrdenDeTrabajoCreateView class.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Documentacion get Permite generar la factura que es el paso siguiente a una cotización de u... | 3e74310b47c82d2dc420e6aaa743a2bc077fd635 | <|skeleton|>
class FacturaOrdenDeTrabajoCreateView:
def get(self, request, *args, **kwargs):
"""Documentacion get Permite generar la factura que es el paso siguiente a una cotización de una orden de trabajo, antes de generarse la factura, se comprueba si la cotización no esta vencida, luego se verifica que... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FacturaOrdenDeTrabajoCreateView:
def get(self, request, *args, **kwargs):
"""Documentacion get Permite generar la factura que es el paso siguiente a una cotización de una orden de trabajo, antes de generarse la factura, se comprueba si la cotización no esta vencida, luego se verifica que en inventario... | the_stack_v2_python_sparse | concesionario/apps/factura_orden_de_trabajo/forms.py | DonAurelio/SIGIA | train | 2 | |
14f229d21cf6ef1b3df5017db0273fd6874a0179 | [
"result = []\nif not root:\n return result\nqueue = collections.deque([root])\nwhile queue:\n root = queue.pop()\n if root:\n result.append(str(root.val))\n queue.appendleft(root.left)\n queue.appendleft(root.right)\n else:\n result.append('#')\nreturn ' '.join(result)",
"i... | <|body_start_0|>
result = []
if not root:
return result
queue = collections.deque([root])
while queue:
root = queue.pop()
if root:
result.append(str(root.val))
queue.appendleft(root.left)
queue.appendleft... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_36k_train_008056 | 3,899 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | stack_v2_sparse_classes_30k_train_000209 | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | d953abe2c9680f636563e76287d2f907e90ced63 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
result = []
if not root:
return result
queue = collections.deque([root])
while queue:
root = queue.pop()
if root:
... | the_stack_v2_python_sparse | Python_leetcode/297_serialize_and_deserialize.py | xiangcao/Leetcode | train | 0 | |
18f813b87be221e42c42be4e66a5679c4e28c469 | [
"if not isinstance(op_types, (list, tuple)):\n op_types = [op_types]\nself._op_types = op_types",
"if not callable(f):\n raise TypeError('conversion_func must be callable.')\nfor op_type in self._op_types:\n _node_converter_registry.register(f, op_type)\nreturn f"
] | <|body_start_0|>
if not isinstance(op_types, (list, tuple)):
op_types = [op_types]
self._op_types = op_types
<|end_body_0|>
<|body_start_1|>
if not callable(f):
raise TypeError('conversion_func must be callable.')
for op_type in self._op_types:
_node_... | A decorator for registering the convertion function that converts the framework's op to NNDCT's op. For example: ```python @RegisterNodeConverter("Conv2D") def parse_conv2d(attrs): ... return op ``` The decorator argument `op_type` is the string type of an op which corresponds to the `NodeDef.op` field in the proto def... | RegisterNodeConverter | [
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-generic-cla",
"BSD-3-Clause-Open-MPI",
"LicenseRef-scancode-free-unknown",
"Libtool-exception",
"GCC-exception-3.1",
"LicenseRef-scancode-mit-old-style",
"OFL-1.1",
"JSON",
"LGPL-2.1-only",
"LGPL-2.0-or-later",
"ICU",
"LicenseRef-scancode-... | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RegisterNodeConverter:
"""A decorator for registering the convertion function that converts the framework's op to NNDCT's op. For example: ```python @RegisterNodeConverter("Conv2D") def parse_conv2d(attrs): ... return op ``` The decorator argument `op_type` is the string type of an op which corre... | stack_v2_sparse_classes_36k_train_008057 | 25,455 | permissive | [
{
"docstring": "Creates a new decorator with `op_type` as the Operation type. Args: op_type: The type of an framework operation. Raises: TypeError: If `op_type` is not string or `f` is not callable.",
"name": "__init__",
"signature": "def __init__(self, op_types)"
},
{
"docstring": "Registers th... | 2 | stack_v2_sparse_classes_30k_train_017899 | Implement the Python class `RegisterNodeConverter` described below.
Class description:
A decorator for registering the convertion function that converts the framework's op to NNDCT's op. For example: ```python @RegisterNodeConverter("Conv2D") def parse_conv2d(attrs): ... return op ``` The decorator argument `op_type` ... | Implement the Python class `RegisterNodeConverter` described below.
Class description:
A decorator for registering the convertion function that converts the framework's op to NNDCT's op. For example: ```python @RegisterNodeConverter("Conv2D") def parse_conv2d(attrs): ... return op ``` The decorator argument `op_type` ... | f74ddc6ed086ba949b791626638717e21505dba2 | <|skeleton|>
class RegisterNodeConverter:
"""A decorator for registering the convertion function that converts the framework's op to NNDCT's op. For example: ```python @RegisterNodeConverter("Conv2D") def parse_conv2d(attrs): ... return op ``` The decorator argument `op_type` is the string type of an op which corre... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RegisterNodeConverter:
"""A decorator for registering the convertion function that converts the framework's op to NNDCT's op. For example: ```python @RegisterNodeConverter("Conv2D") def parse_conv2d(attrs): ... return op ``` The decorator argument `op_type` is the string type of an op which corresponds to the... | the_stack_v2_python_sparse | src/vai_optimizer/tensorflow/tf_nndct/graph/converter.py | Xilinx/Vitis-AI | train | 1,283 |
96ccb59b7a9e86b7f750a72256330297b7233353 | [
"params_dict = dict(self.initparams)\nparams_dict['email'] = ''\nstatus_error_code = CheckEmailReturnCodeEnum.FORMAT_ERROR.value\nreturn (params_dict, status_error_code)",
"params_dict = dict(self.initparams)\nparams_dict['email'] = '188881@188.com'\nstatus_error_code = CheckEmailReturnCodeEnum.NOT_EXISTS.value\n... | <|body_start_0|>
params_dict = dict(self.initparams)
params_dict['email'] = ''
status_error_code = CheckEmailReturnCodeEnum.FORMAT_ERROR.value
return (params_dict, status_error_code)
<|end_body_0|>
<|body_start_1|>
params_dict = dict(self.initparams)
params_dict['email']... | Check_Email | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Check_Email:
def email_empty(self):
"""邮箱为空"""
<|body_0|>
def email_not_exist(self):
"""email不存在"""
<|body_1|>
def email_exist(self):
"""email存在"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
params_dict = dict(self.initparams)... | stack_v2_sparse_classes_36k_train_008058 | 1,703 | no_license | [
{
"docstring": "邮箱为空",
"name": "email_empty",
"signature": "def email_empty(self)"
},
{
"docstring": "email不存在",
"name": "email_not_exist",
"signature": "def email_not_exist(self)"
},
{
"docstring": "email存在",
"name": "email_exist",
"signature": "def email_exist(self)"
... | 3 | stack_v2_sparse_classes_30k_train_001520 | Implement the Python class `Check_Email` described below.
Class description:
Implement the Check_Email class.
Method signatures and docstrings:
- def email_empty(self): 邮箱为空
- def email_not_exist(self): email不存在
- def email_exist(self): email存在 | Implement the Python class `Check_Email` described below.
Class description:
Implement the Check_Email class.
Method signatures and docstrings:
- def email_empty(self): 邮箱为空
- def email_not_exist(self): email不存在
- def email_exist(self): email存在
<|skeleton|>
class Check_Email:
def email_empty(self):
"""邮... | 7f5c78e083812b49d32a394dd81b55dc90ccf080 | <|skeleton|>
class Check_Email:
def email_empty(self):
"""邮箱为空"""
<|body_0|>
def email_not_exist(self):
"""email不存在"""
<|body_1|>
def email_exist(self):
"""email存在"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Check_Email:
def email_empty(self):
"""邮箱为空"""
params_dict = dict(self.initparams)
params_dict['email'] = ''
status_error_code = CheckEmailReturnCodeEnum.FORMAT_ERROR.value
return (params_dict, status_error_code)
def email_not_exist(self):
"""email不存在"""
... | the_stack_v2_python_sparse | testcase/Loginapi/Check_Email_test.py | gitchenping/apitest | train | 0 | |
eda3ef099dabdf548f6ed4effacb8186ffd86014 | [
"try:\n json_str = json.dumps(collection, default=default)\n return json_str\nexcept Exception as e:\n raise JSONParserException(e)",
"try:\n collection = json.loads(json_str, object_hook=object_hook)\n return collection\nexcept Exception as e:\n raise JSONParserException(e)"
] | <|body_start_0|>
try:
json_str = json.dumps(collection, default=default)
return json_str
except Exception as e:
raise JSONParserException(e)
<|end_body_0|>
<|body_start_1|>
try:
collection = json.loads(json_str, object_hook=object_hook)
... | Common JSON Parser http://api.mongodb.org/python/1.7/api/pymongo/json_util.html | JSONParser | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JSONParser:
"""Common JSON Parser http://api.mongodb.org/python/1.7/api/pymongo/json_util.html"""
def to_json(collection):
"""Serialize a Python Collection to a JSON String collection: Python Collection Returns: String"""
<|body_0|>
def to_collection(json_str):
"... | stack_v2_sparse_classes_36k_train_008059 | 1,006 | no_license | [
{
"docstring": "Serialize a Python Collection to a JSON String collection: Python Collection Returns: String",
"name": "to_json",
"signature": "def to_json(collection)"
},
{
"docstring": "Deserialize a JSON String into a Python Collection json_str: String Returns: Python Collection",
"name":... | 2 | stack_v2_sparse_classes_30k_train_004617 | Implement the Python class `JSONParser` described below.
Class description:
Common JSON Parser http://api.mongodb.org/python/1.7/api/pymongo/json_util.html
Method signatures and docstrings:
- def to_json(collection): Serialize a Python Collection to a JSON String collection: Python Collection Returns: String
- def to... | Implement the Python class `JSONParser` described below.
Class description:
Common JSON Parser http://api.mongodb.org/python/1.7/api/pymongo/json_util.html
Method signatures and docstrings:
- def to_json(collection): Serialize a Python Collection to a JSON String collection: Python Collection Returns: String
- def to... | e64631edbd49eb38f4520c25a9f6d08fae588bd8 | <|skeleton|>
class JSONParser:
"""Common JSON Parser http://api.mongodb.org/python/1.7/api/pymongo/json_util.html"""
def to_json(collection):
"""Serialize a Python Collection to a JSON String collection: Python Collection Returns: String"""
<|body_0|>
def to_collection(json_str):
"... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class JSONParser:
"""Common JSON Parser http://api.mongodb.org/python/1.7/api/pymongo/json_util.html"""
def to_json(collection):
"""Serialize a Python Collection to a JSON String collection: Python Collection Returns: String"""
try:
json_str = json.dumps(collection, default=default)... | the_stack_v2_python_sparse | utils/json_parser.py | wikilife-org/datadonor | train | 3 |
26c2ba4bbae3bfc813c1a0e97c7c435e9dfb8ff5 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"conte... | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | Proto file describing the BatchJobService. Service to manage batch jobs. | BatchJobServiceServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BatchJobServiceServicer:
"""Proto file describing the BatchJobService. Service to manage batch jobs."""
def MutateBatchJob(self, request, context):
"""Mutates a batch job."""
<|body_0|>
def GetBatchJob(self, request, context):
"""Returns the batch job."""
... | stack_v2_sparse_classes_36k_train_008060 | 11,564 | permissive | [
{
"docstring": "Mutates a batch job.",
"name": "MutateBatchJob",
"signature": "def MutateBatchJob(self, request, context)"
},
{
"docstring": "Returns the batch job.",
"name": "GetBatchJob",
"signature": "def GetBatchJob(self, request, context)"
},
{
"docstring": "Returns the resu... | 5 | stack_v2_sparse_classes_30k_train_012388 | Implement the Python class `BatchJobServiceServicer` described below.
Class description:
Proto file describing the BatchJobService. Service to manage batch jobs.
Method signatures and docstrings:
- def MutateBatchJob(self, request, context): Mutates a batch job.
- def GetBatchJob(self, request, context): Returns the ... | Implement the Python class `BatchJobServiceServicer` described below.
Class description:
Proto file describing the BatchJobService. Service to manage batch jobs.
Method signatures and docstrings:
- def MutateBatchJob(self, request, context): Mutates a batch job.
- def GetBatchJob(self, request, context): Returns the ... | 969eff5b6c3cec59d21191fa178cffb6270074c3 | <|skeleton|>
class BatchJobServiceServicer:
"""Proto file describing the BatchJobService. Service to manage batch jobs."""
def MutateBatchJob(self, request, context):
"""Mutates a batch job."""
<|body_0|>
def GetBatchJob(self, request, context):
"""Returns the batch job."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BatchJobServiceServicer:
"""Proto file describing the BatchJobService. Service to manage batch jobs."""
def MutateBatchJob(self, request, context):
"""Mutates a batch job."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
rai... | the_stack_v2_python_sparse | google/ads/google_ads/v6/proto/services/batch_job_service_pb2_grpc.py | VincentFritzsche/google-ads-python | train | 0 |
00b0482e9a5e0c4f432ce3f4e8665411a39057cc | [
"try:\n app_id_list = get_cc_app_id_by_user()\n data_result = machine_statistics(table_set=EsNodeInfo, field='ip', app_id_list=app_id_list)\n return JsonResponse({'result': True, 'code': 0, 'data': data_result, 'message': 'query success'})\nexcept Exception as err:\n logger.error(f'es机器查询汇总失败:{err}')\n ... | <|body_start_0|>
try:
app_id_list = get_cc_app_id_by_user()
data_result = machine_statistics(table_set=EsNodeInfo, field='ip', app_id_list=app_id_list)
return JsonResponse({'result': True, 'code': 0, 'data': data_result, 'message': 'query success'})
except Exception a... | es用户信息表视图 | EsNodeViewSet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EsNodeViewSet:
"""es用户信息表视图"""
def get_machine_statistics(self, request, *args, **kwargs):
"""POST /es/nodes/get_machine_statistics 统计es投入已使用的机器数量"""
<|body_0|>
def get_machine_statistics_top_five(self, request, *args, **kwargs):
"""POST /es/nodes/get_machine_sta... | stack_v2_sparse_classes_36k_train_008061 | 10,026 | no_license | [
{
"docstring": "POST /es/nodes/get_machine_statistics 统计es投入已使用的机器数量",
"name": "get_machine_statistics",
"signature": "def get_machine_statistics(self, request, *args, **kwargs)"
},
{
"docstring": "POST /es/nodes/get_machine_statistics_top_five 根据用户已有业务权限,查询每个业务的机器投入数量,输出TOP5",
"name": "get_... | 2 | stack_v2_sparse_classes_30k_train_015356 | Implement the Python class `EsNodeViewSet` described below.
Class description:
es用户信息表视图
Method signatures and docstrings:
- def get_machine_statistics(self, request, *args, **kwargs): POST /es/nodes/get_machine_statistics 统计es投入已使用的机器数量
- def get_machine_statistics_top_five(self, request, *args, **kwargs): POST /es/... | Implement the Python class `EsNodeViewSet` described below.
Class description:
es用户信息表视图
Method signatures and docstrings:
- def get_machine_statistics(self, request, *args, **kwargs): POST /es/nodes/get_machine_statistics 统计es投入已使用的机器数量
- def get_machine_statistics_top_five(self, request, *args, **kwargs): POST /es/... | 97cfac2ba94d67980d837f0b541caae70b68a595 | <|skeleton|>
class EsNodeViewSet:
"""es用户信息表视图"""
def get_machine_statistics(self, request, *args, **kwargs):
"""POST /es/nodes/get_machine_statistics 统计es投入已使用的机器数量"""
<|body_0|>
def get_machine_statistics_top_five(self, request, *args, **kwargs):
"""POST /es/nodes/get_machine_sta... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EsNodeViewSet:
"""es用户信息表视图"""
def get_machine_statistics(self, request, *args, **kwargs):
"""POST /es/nodes/get_machine_statistics 统计es投入已使用的机器数量"""
try:
app_id_list = get_cc_app_id_by_user()
data_result = machine_statistics(table_set=EsNodeInfo, field='ip', app_i... | the_stack_v2_python_sparse | apps/es/views.py | sdgdsffdsfff/bk-dop | train | 0 |
019dcaaa694527bce29e1f214ff406e195d526da | [
"if 'action' not in msg:\n self.msgSend({'code': 'Error', 'msg': 'Missing action.'})\n return\naction = msg['action']\nif action == 'ping':\n self.do_ping(msg)\n return\nelif action == 'check':\n self.do_check(msg)\n return\nelse:\n self.msgSend({'code': 'Error', 'msg': 'Unknown action.'})\n ... | <|body_start_0|>
if 'action' not in msg:
self.msgSend({'code': 'Error', 'msg': 'Missing action.'})
return
action = msg['action']
if action == 'ping':
self.do_ping(msg)
return
elif action == 'check':
self.do_check(msg)
... | CheckerProtocol | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CheckerProtocol:
def msgReceived(self, msg):
"""Process incoming messages"""
<|body_0|>
def do_ping(self, msg):
"""Responds to a ping to check connectivity."""
<|body_1|>
def do_check(self, msg):
"""Checks the transaction is valid."""
<|b... | stack_v2_sparse_classes_36k_train_008062 | 2,982 | permissive | [
{
"docstring": "Process incoming messages",
"name": "msgReceived",
"signature": "def msgReceived(self, msg)"
},
{
"docstring": "Responds to a ping to check connectivity.",
"name": "do_ping",
"signature": "def do_ping(self, msg)"
},
{
"docstring": "Checks the transaction is valid.... | 3 | stack_v2_sparse_classes_30k_train_006600 | Implement the Python class `CheckerProtocol` described below.
Class description:
Implement the CheckerProtocol class.
Method signatures and docstrings:
- def msgReceived(self, msg): Process incoming messages
- def do_ping(self, msg): Responds to a ping to check connectivity.
- def do_check(self, msg): Checks the tran... | Implement the Python class `CheckerProtocol` described below.
Class description:
Implement the CheckerProtocol class.
Method signatures and docstrings:
- def msgReceived(self, msg): Process incoming messages
- def do_ping(self, msg): Responds to a ping to check connectivity.
- def do_check(self, msg): Checks the tran... | 881fe3e9aac89f42eb7877b480498f910aa37d22 | <|skeleton|>
class CheckerProtocol:
def msgReceived(self, msg):
"""Process incoming messages"""
<|body_0|>
def do_ping(self, msg):
"""Responds to a ping to check connectivity."""
<|body_1|>
def do_check(self, msg):
"""Checks the transaction is valid."""
<|b... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CheckerProtocol:
def msgReceived(self, msg):
"""Process incoming messages"""
if 'action' not in msg:
self.msgSend({'code': 'Error', 'msg': 'Missing action.'})
return
action = msg['action']
if action == 'ping':
self.do_ping(msg)
re... | the_stack_v2_python_sparse | rousseau-package/attic/checker.py | FrancisPouliot/rousseau-chain | train | 0 | |
b4ce686aabb139152fde70ea6864da507ecbaaa9 | [
"size = len(nums)\nleft = 1\nright = size - 1\nwhile left < right:\n mid = left + (right - left) // 2\n cnt = 0\n for num in nums:\n if num <= mid:\n cnt += 1\n if cnt > mid:\n right = mid\n else:\n left = mid + 1\nreturn left",
"fast = nums[nums[0]]\nslow = nums[0]\... | <|body_start_0|>
size = len(nums)
left = 1
right = size - 1
while left < right:
mid = left + (right - left) // 2
cnt = 0
for num in nums:
if num <= mid:
cnt += 1
if cnt > mid:
right = mid
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findDuplicate(self, nums: List[int]) -> int:
"""二分查找"""
<|body_0|>
def findDuplicate2(self, nums: List[int]) -> int:
"""快慢指针 wise"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
size = len(nums)
left = 1
right = size - ... | stack_v2_sparse_classes_36k_train_008063 | 1,234 | no_license | [
{
"docstring": "二分查找",
"name": "findDuplicate",
"signature": "def findDuplicate(self, nums: List[int]) -> int"
},
{
"docstring": "快慢指针 wise",
"name": "findDuplicate2",
"signature": "def findDuplicate2(self, nums: List[int]) -> int"
}
] | 2 | stack_v2_sparse_classes_30k_train_000048 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findDuplicate(self, nums: List[int]) -> int: 二分查找
- def findDuplicate2(self, nums: List[int]) -> int: 快慢指针 wise | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findDuplicate(self, nums: List[int]) -> int: 二分查找
- def findDuplicate2(self, nums: List[int]) -> int: 快慢指针 wise
<|skeleton|>
class Solution:
def findDuplicate(self, num... | 40726506802d2d60028fdce206696b1df2f63ece | <|skeleton|>
class Solution:
def findDuplicate(self, nums: List[int]) -> int:
"""二分查找"""
<|body_0|>
def findDuplicate2(self, nums: List[int]) -> int:
"""快慢指针 wise"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findDuplicate(self, nums: List[int]) -> int:
"""二分查找"""
size = len(nums)
left = 1
right = size - 1
while left < right:
mid = left + (right - left) // 2
cnt = 0
for num in nums:
if num <= mid:
... | the_stack_v2_python_sparse | 二刷+题解/剑指offer/findDuplicate.py | 1oser5/LeetCode | train | 0 | |
909332cf615a35c18232bfc9f2b8c5920e3760f6 | [
"super(GLM, self).__init__(dim_param=len_filter + 1, seed=seed)\nself.duration = duration\nself.len_filter = len_filter\nself.seed_input = seed_input\nself.n_params = self.len_filter + 1\nself.dt = 1\nself.t = np.arange(0, self.duration, self.dt)\nif self.seed_input is None:\n new_seed = self.gen_newseed()\nelse... | <|body_start_0|>
super(GLM, self).__init__(dim_param=len_filter + 1, seed=seed)
self.duration = duration
self.len_filter = len_filter
self.seed_input = seed_input
self.n_params = self.len_filter + 1
self.dt = 1
self.t = np.arange(0, self.duration, self.dt)
... | GLM | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GLM:
def __init__(self, duration=100, len_filter=9, seed=None, seed_input=None):
"""GLM simulator Parameters ---------- duration : int Duration of traces in ms len_filter : int Length of filter seed : int or None If set, randomness across runs is disabled seed_input : int or None If set,... | stack_v2_sparse_classes_36k_train_008064 | 2,387 | permissive | [
{
"docstring": "GLM simulator Parameters ---------- duration : int Duration of traces in ms len_filter : int Length of filter seed : int or None If set, randomness across runs is disabled seed_input : int or None If set, randomness in input is controlled by seed_input rather than by seed",
"name": "__init__... | 2 | stack_v2_sparse_classes_30k_train_012797 | Implement the Python class `GLM` described below.
Class description:
Implement the GLM class.
Method signatures and docstrings:
- def __init__(self, duration=100, len_filter=9, seed=None, seed_input=None): GLM simulator Parameters ---------- duration : int Duration of traces in ms len_filter : int Length of filter se... | Implement the Python class `GLM` described below.
Class description:
Implement the GLM class.
Method signatures and docstrings:
- def __init__(self, duration=100, len_filter=9, seed=None, seed_input=None): GLM simulator Parameters ---------- duration : int Duration of traces in ms len_filter : int Length of filter se... | b93c90ec6156ae5f8afee6aaac7317373e9caf5e | <|skeleton|>
class GLM:
def __init__(self, duration=100, len_filter=9, seed=None, seed_input=None):
"""GLM simulator Parameters ---------- duration : int Duration of traces in ms len_filter : int Length of filter seed : int or None If set, randomness across runs is disabled seed_input : int or None If set,... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GLM:
def __init__(self, duration=100, len_filter=9, seed=None, seed_input=None):
"""GLM simulator Parameters ---------- duration : int Duration of traces in ms len_filter : int Length of filter seed : int or None If set, randomness across runs is disabled seed_input : int or None If set, randomness in... | the_stack_v2_python_sparse | 2_glm/model/GLM.py | daesungc/IdentifyMechanisticModels_2020 | train | 0 | |
9fa97f824ebc8f8112cd789c4ca375073e721fb0 | [
"model = ZEditImageModel(imageContext.getImageAttributes())\ndialog = ZImageDialog(parentWindow, model)\ndialog.CentreOnParent()\nif dialog.ShowModal() == wx.ID_OK:\n attrs = model.getImageAttributes()\n imageContext.setImageAttributes(attrs)\ndialog.Destroy()",
"file = None\nwildcard = u'Image files|*.gif;... | <|body_start_0|>
model = ZEditImageModel(imageContext.getImageAttributes())
dialog = ZImageDialog(parentWindow, model)
dialog.CentreOnParent()
if dialog.ShowModal() == wx.ID_OK:
attrs = model.getImageAttributes()
imageContext.setImageAttributes(attrs)
dial... | ZImageUiUtil | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ZImageUiUtil:
def editImage(self, parentWindow, imageContext):
"""editImage(wxWindow, IZXHTMLImageControlLinkContext) -> void Shows the create and edit image dialog."""
<|body_0|>
def insertImageFile(self, parentWindow, imageContext):
"""insertImageFile(wxWindow, IZX... | stack_v2_sparse_classes_36k_train_008065 | 9,326 | no_license | [
{
"docstring": "editImage(wxWindow, IZXHTMLImageControlLinkContext) -> void Shows the create and edit image dialog.",
"name": "editImage",
"signature": "def editImage(self, parentWindow, imageContext)"
},
{
"docstring": "insertImageFile(wxWindow, IZXHTMLEditControlImageContext) -> void Shows the... | 3 | null | Implement the Python class `ZImageUiUtil` described below.
Class description:
Implement the ZImageUiUtil class.
Method signatures and docstrings:
- def editImage(self, parentWindow, imageContext): editImage(wxWindow, IZXHTMLImageControlLinkContext) -> void Shows the create and edit image dialog.
- def insertImageFile... | Implement the Python class `ZImageUiUtil` described below.
Class description:
Implement the ZImageUiUtil class.
Method signatures and docstrings:
- def editImage(self, parentWindow, imageContext): editImage(wxWindow, IZXHTMLImageControlLinkContext) -> void Shows the create and edit image dialog.
- def insertImageFile... | f1096a02a3dbb25a79d5c4e6a2f71a3d469631eb | <|skeleton|>
class ZImageUiUtil:
def editImage(self, parentWindow, imageContext):
"""editImage(wxWindow, IZXHTMLImageControlLinkContext) -> void Shows the create and edit image dialog."""
<|body_0|>
def insertImageFile(self, parentWindow, imageContext):
"""insertImageFile(wxWindow, IZX... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ZImageUiUtil:
def editImage(self, parentWindow, imageContext):
"""editImage(wxWindow, IZXHTMLImageControlLinkContext) -> void Shows the create and edit image dialog."""
model = ZEditImageModel(imageContext.getImageAttributes())
dialog = ZImageDialog(parentWindow, model)
dialog.... | the_stack_v2_python_sparse | src/python/zoundry/blogapp/ui/util/editorutil.py | mpm2050/Raven | train | 1 | |
164ba62c9dc60bd13626d54f18daed0d6ba95688 | [
"print('get_company')\noptions = {'name': self.configurator.company_name, 'ruc': self.configurator.ticket_company_ruc, 'address': self.configurator.ticket_company_address, 'phone': self.configurator.company_phone, 'note': self.configurator.ticket_note, 'description': self.configurator.ticket_company_address, 'warni... | <|body_start_0|>
print('get_company')
options = {'name': self.configurator.company_name, 'ruc': self.configurator.ticket_company_ruc, 'address': self.configurator.ticket_company_address, 'phone': self.configurator.company_phone, 'note': self.configurator.ticket_note, 'description': self.configurator.tic... | Ticket tools Used by - print_ticket_receipt_electronic | Ticket | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Ticket:
"""Ticket tools Used by - print_ticket_receipt_electronic"""
def get_company(self, tag):
"""Used by Ticket openhealth.report_ticket_receipt_electronic"""
<|body_0|>
def get_items_header(self, tag):
"""Uses the Ticket class."""
<|body_1|>
def ... | stack_v2_sparse_classes_36k_train_008066 | 4,547 | no_license | [
{
"docstring": "Used by Ticket openhealth.report_ticket_receipt_electronic",
"name": "get_company",
"signature": "def get_company(self, tag)"
},
{
"docstring": "Uses the Ticket class.",
"name": "get_items_header",
"signature": "def get_items_header(self, tag)"
},
{
"docstring": "... | 6 | null | Implement the Python class `Ticket` described below.
Class description:
Ticket tools Used by - print_ticket_receipt_electronic
Method signatures and docstrings:
- def get_company(self, tag): Used by Ticket openhealth.report_ticket_receipt_electronic
- def get_items_header(self, tag): Uses the Ticket class.
- def get_... | Implement the Python class `Ticket` described below.
Class description:
Ticket tools Used by - print_ticket_receipt_electronic
Method signatures and docstrings:
- def get_company(self, tag): Used by Ticket openhealth.report_ticket_receipt_electronic
- def get_items_header(self, tag): Uses the Ticket class.
- def get_... | c15f8b146392d47a9040404a4ac8e45a1b062198 | <|skeleton|>
class Ticket:
"""Ticket tools Used by - print_ticket_receipt_electronic"""
def get_company(self, tag):
"""Used by Ticket openhealth.report_ticket_receipt_electronic"""
<|body_0|>
def get_items_header(self, tag):
"""Uses the Ticket class."""
<|body_1|>
def ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Ticket:
"""Ticket tools Used by - print_ticket_receipt_electronic"""
def get_company(self, tag):
"""Used by Ticket openhealth.report_ticket_receipt_electronic"""
print('get_company')
options = {'name': self.configurator.company_name, 'ruc': self.configurator.ticket_company_ruc, 'a... | the_stack_v2_python_sparse | models/order/ticket.py | gibil5/openhealth | train | 1 |
27a40b25dd1c8f68d8ddcdac4a5690ffdf46feb3 | [
"skill = self.skill_analyzer.extract(self.latest_voice_transcript)\nif skill:\n self.to_execute = {'voice_transcript': self.latest_voice_transcript, 'skill': skill}\nlogging.debug('to_execute : {0}'.format(self.to_execute))",
"try:\n if self.to_execute:\n skill = self.to_execute['skill']['skill']\n ... | <|body_start_0|>
skill = self.skill_analyzer.extract(self.latest_voice_transcript)
if skill:
self.to_execute = {'voice_transcript': self.latest_voice_transcript, 'skill': skill}
logging.debug('to_execute : {0}'.format(self.to_execute))
<|end_body_0|>
<|body_start_1|>
try:
... | SkillController | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SkillController:
def get_skills(self):
"""This method identifies the active skills from the voice transcript and updates the skills state. e.x. latest_voice_transcript='open youtube' Then, the to_execute will be the following: to_execute={'voice_transcript': 'open youtube', 'tag': 'open'... | stack_v2_sparse_classes_36k_train_008067 | 3,591 | permissive | [
{
"docstring": "This method identifies the active skills from the voice transcript and updates the skills state. e.x. latest_voice_transcript='open youtube' Then, the to_execute will be the following: to_execute={'voice_transcript': 'open youtube', 'tag': 'open', 'skill': Skills.open_website_in_browser}",
"... | 2 | stack_v2_sparse_classes_30k_train_004440 | Implement the Python class `SkillController` described below.
Class description:
Implement the SkillController class.
Method signatures and docstrings:
- def get_skills(self): This method identifies the active skills from the voice transcript and updates the skills state. e.x. latest_voice_transcript='open youtube' T... | Implement the Python class `SkillController` described below.
Class description:
Implement the SkillController class.
Method signatures and docstrings:
- def get_skills(self): This method identifies the active skills from the voice transcript and updates the skills state. e.x. latest_voice_transcript='open youtube' T... | c2983ce51c52641453fb1f6e0d7598bdd47ed66d | <|skeleton|>
class SkillController:
def get_skills(self):
"""This method identifies the active skills from the voice transcript and updates the skills state. e.x. latest_voice_transcript='open youtube' Then, the to_execute will be the following: to_execute={'voice_transcript': 'open youtube', 'tag': 'open'... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SkillController:
def get_skills(self):
"""This method identifies the active skills from the voice transcript and updates the skills state. e.x. latest_voice_transcript='open youtube' Then, the to_execute will be the following: to_execute={'voice_transcript': 'open youtube', 'tag': 'open', 'skill': Ski... | the_stack_v2_python_sparse | apollo/core/controller.py | heitorsampaio/ApolloAI | train | 0 | |
503c72178d8d2931ae0e3700e7ee3a0b5478a821 | [
"result = {'result': 'NG'}\ndata = request.get_json(force=True)\nif data:\n succsee, message = CtrlQuotations().feature_assign_group(data, quotation_id)\n if succsee:\n result = {'result': 'OK', 'content': message}\n else:\n result['error'] = message\nelse:\n result['error'] = '请不要传空数据'\nr... | <|body_start_0|>
result = {'result': 'NG'}
data = request.get_json(force=True)
if data:
succsee, message = CtrlQuotations().feature_assign_group(data, quotation_id)
if succsee:
result = {'result': 'OK', 'content': message}
else:
... | ApiFeatureAssign | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ApiFeatureAssign:
def post(self, quotation_id):
"""分配此报价下的feature :return:"""
<|body_0|>
def get(self, quotation_id):
"""获取此报价下的featureList历史 :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
result = {'result': 'NG'}
data = request.g... | stack_v2_sparse_classes_36k_train_008068 | 10,406 | no_license | [
{
"docstring": "分配此报价下的feature :return:",
"name": "post",
"signature": "def post(self, quotation_id)"
},
{
"docstring": "获取此报价下的featureList历史 :return:",
"name": "get",
"signature": "def get(self, quotation_id)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000726 | Implement the Python class `ApiFeatureAssign` described below.
Class description:
Implement the ApiFeatureAssign class.
Method signatures and docstrings:
- def post(self, quotation_id): 分配此报价下的feature :return:
- def get(self, quotation_id): 获取此报价下的featureList历史 :return: | Implement the Python class `ApiFeatureAssign` described below.
Class description:
Implement the ApiFeatureAssign class.
Method signatures and docstrings:
- def post(self, quotation_id): 分配此报价下的feature :return:
- def get(self, quotation_id): 获取此报价下的featureList历史 :return:
<|skeleton|>
class ApiFeatureAssign:
def ... | 64b31e7bdfcb8a4c95f0a8a607f0bcff576cec11 | <|skeleton|>
class ApiFeatureAssign:
def post(self, quotation_id):
"""分配此报价下的feature :return:"""
<|body_0|>
def get(self, quotation_id):
"""获取此报价下的featureList历史 :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ApiFeatureAssign:
def post(self, quotation_id):
"""分配此报价下的feature :return:"""
result = {'result': 'NG'}
data = request.get_json(force=True)
if data:
succsee, message = CtrlQuotations().feature_assign_group(data, quotation_id)
if succsee:
... | the_stack_v2_python_sparse | koala/koala_server/app/api_1_0/api_quotations.py | lsn1183/web_project | train | 0 | |
9e4081979f0c1b9fee7a41611d12b4be7c7f6921 | [
"super(QNetwork, self).__init__()\nself.seed = torch.manual_seed(seed)\nself.fc1 = nn.Linear(state_size, fc1_units)\nself.fc2 = nn.Linear(fc1_units, fc2_units)\nself.fc3 = nn.Linear(fc2_units, action_size)",
"x = F.relu(self.fc1(state))\nx = F.relu(self.fc2(x))\nreturn self.fc3(x)"
] | <|body_start_0|>
super(QNetwork, self).__init__()
self.seed = torch.manual_seed(seed)
self.fc1 = nn.Linear(state_size, fc1_units)
self.fc2 = nn.Linear(fc1_units, fc2_units)
self.fc3 = nn.Linear(fc2_units, action_size)
<|end_body_0|>
<|body_start_1|>
x = F.relu(self.fc1(s... | Actor (Policy) Model. | QNetwork | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QNetwork:
"""Actor (Policy) Model."""
def __init__(self, state_size, action_size, seed, fc1_units=64, fc2_units=64):
"""Initialize parameters and build model. Params ====== state_size (int): Dimension of each state action_size (int): Dimension of each action seed (int): Random seed f... | stack_v2_sparse_classes_36k_train_008069 | 2,152 | no_license | [
{
"docstring": "Initialize parameters and build model. Params ====== state_size (int): Dimension of each state action_size (int): Dimension of each action seed (int): Random seed fc1_units (int): Number of nodes in first hidden layer fc2_units (int): Number of nodes in second hidden layer",
"name": "__init_... | 2 | stack_v2_sparse_classes_30k_train_005988 | Implement the Python class `QNetwork` described below.
Class description:
Actor (Policy) Model.
Method signatures and docstrings:
- def __init__(self, state_size, action_size, seed, fc1_units=64, fc2_units=64): Initialize parameters and build model. Params ====== state_size (int): Dimension of each state action_size ... | Implement the Python class `QNetwork` described below.
Class description:
Actor (Policy) Model.
Method signatures and docstrings:
- def __init__(self, state_size, action_size, seed, fc1_units=64, fc2_units=64): Initialize parameters and build model. Params ====== state_size (int): Dimension of each state action_size ... | 0fc44b07789f7c585a5525841a0a7d9b62dc8002 | <|skeleton|>
class QNetwork:
"""Actor (Policy) Model."""
def __init__(self, state_size, action_size, seed, fc1_units=64, fc2_units=64):
"""Initialize parameters and build model. Params ====== state_size (int): Dimension of each state action_size (int): Dimension of each action seed (int): Random seed f... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class QNetwork:
"""Actor (Policy) Model."""
def __init__(self, state_size, action_size, seed, fc1_units=64, fc2_units=64):
"""Initialize parameters and build model. Params ====== state_size (int): Dimension of each state action_size (int): Dimension of each action seed (int): Random seed fc1_units (int... | the_stack_v2_python_sparse | discreteenv/discreteenv/model.py | MachengShen/robust_opponent_modeling | train | 3 |
a1f1bd251c00e0d0a305201824497f2a57718bcd | [
"hashmap = {}\nmax_len, dp = (0, 0)\nfor idx, x in enumerate(s):\n last_idx = hashmap.get(x, -1)\n hashmap[x] = idx\n if dp < idx - last_idx:\n dp += 1\n else:\n dp = idx - last_idx\n max_len = max(max_len, dp)\nreturn max_len",
"hashmap = {}\nstart, max_len = (0, 0)\nfor idx, x in en... | <|body_start_0|>
hashmap = {}
max_len, dp = (0, 0)
for idx, x in enumerate(s):
last_idx = hashmap.get(x, -1)
hashmap[x] = idx
if dp < idx - last_idx:
dp += 1
else:
dp = idx - last_idx
max_len = max(max_le... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
"""动态规划"""
<|body_0|>
def lengthOfLongestSubstringSlidingWindows(self, s: str) -> int:
"""滑动窗口"""
<|body_1|>
def lengthOfLongestSubstringSlidingWindows2(self, s: str) -> int:
"""滑动窗口(优化... | stack_v2_sparse_classes_36k_train_008070 | 3,304 | no_license | [
{
"docstring": "动态规划",
"name": "lengthOfLongestSubstring",
"signature": "def lengthOfLongestSubstring(self, s: str) -> int"
},
{
"docstring": "滑动窗口",
"name": "lengthOfLongestSubstringSlidingWindows",
"signature": "def lengthOfLongestSubstringSlidingWindows(self, s: str) -> int"
},
{
... | 3 | stack_v2_sparse_classes_30k_train_020008 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLongestSubstring(self, s: str) -> int: 动态规划
- def lengthOfLongestSubstringSlidingWindows(self, s: str) -> int: 滑动窗口
- def lengthOfLongestSubstringSlidingWindows2(self... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLongestSubstring(self, s: str) -> int: 动态规划
- def lengthOfLongestSubstringSlidingWindows(self, s: str) -> int: 滑动窗口
- def lengthOfLongestSubstringSlidingWindows2(self... | 52756b30e9d51794591aca030bc918e707f473f1 | <|skeleton|>
class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
"""动态规划"""
<|body_0|>
def lengthOfLongestSubstringSlidingWindows(self, s: str) -> int:
"""滑动窗口"""
<|body_1|>
def lengthOfLongestSubstringSlidingWindows2(self, s: str) -> int:
"""滑动窗口(优化... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
"""动态规划"""
hashmap = {}
max_len, dp = (0, 0)
for idx, x in enumerate(s):
last_idx = hashmap.get(x, -1)
hashmap[x] = idx
if dp < idx - last_idx:
dp += 1
e... | the_stack_v2_python_sparse | 3.无重复字符的最长子串/solution.py | QtTao/daily_leetcode | train | 0 | |
bef95ccd947e85384f056ee195038d4044a8bd60 | [
"cycles_per_bit = 4\nspi = self.dut.spi\nif hasattr(spi, 'sdi'):\n yield spi.sdi.eq(bit)\n yield from self.advance_cycles(cycles_per_bit)\nyield spi.sck.eq(1)\nyield from self.advance_cycles(cycles_per_bit)\nreturn_value = (yield spi.sdo)\nyield from self.advance_cycles(cycles_per_bit)\nyield spi.sck.eq(0)\ny... | <|body_start_0|>
cycles_per_bit = 4
spi = self.dut.spi
if hasattr(spi, 'sdi'):
yield spi.sdi.eq(bit)
yield from self.advance_cycles(cycles_per_bit)
yield spi.sck.eq(1)
yield from self.advance_cycles(cycles_per_bit)
return_value = (yield spi.sdo)
... | Extended version of the LunaGatewareTestCase. Adds three SPI-simulation methods: -spi_send_bit -spi_exchange_byte -spi_exchange_data | SPIGatewareTestCase | [
"BSD-3-Clause",
"CERN-OHL-P-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SPIGatewareTestCase:
"""Extended version of the LunaGatewareTestCase. Adds three SPI-simulation methods: -spi_send_bit -spi_exchange_byte -spi_exchange_data"""
def spi_send_bit(self, bit):
"""Sends a single bit over the SPI bus."""
<|body_0|>
def spi_exchange_byte(self, ... | stack_v2_sparse_classes_36k_train_008071 | 29,473 | permissive | [
{
"docstring": "Sends a single bit over the SPI bus.",
"name": "spi_send_bit",
"signature": "def spi_send_bit(self, bit)"
},
{
"docstring": "Sends a by over the virtual SPI bus.",
"name": "spi_exchange_byte",
"signature": "def spi_exchange_byte(self, datum, *, msb_first=True)"
},
{
... | 3 | null | Implement the Python class `SPIGatewareTestCase` described below.
Class description:
Extended version of the LunaGatewareTestCase. Adds three SPI-simulation methods: -spi_send_bit -spi_exchange_byte -spi_exchange_data
Method signatures and docstrings:
- def spi_send_bit(self, bit): Sends a single bit over the SPI bus... | Implement the Python class `SPIGatewareTestCase` described below.
Class description:
Extended version of the LunaGatewareTestCase. Adds three SPI-simulation methods: -spi_send_bit -spi_exchange_byte -spi_exchange_data
Method signatures and docstrings:
- def spi_send_bit(self, bit): Sends a single bit over the SPI bus... | 1d8e9cfa6a3e577f255ff3544384a1442b3b015b | <|skeleton|>
class SPIGatewareTestCase:
"""Extended version of the LunaGatewareTestCase. Adds three SPI-simulation methods: -spi_send_bit -spi_exchange_byte -spi_exchange_data"""
def spi_send_bit(self, bit):
"""Sends a single bit over the SPI bus."""
<|body_0|>
def spi_exchange_byte(self, ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SPIGatewareTestCase:
"""Extended version of the LunaGatewareTestCase. Adds three SPI-simulation methods: -spi_send_bit -spi_exchange_byte -spi_exchange_data"""
def spi_send_bit(self, bit):
"""Sends a single bit over the SPI bus."""
cycles_per_bit = 4
spi = self.dut.spi
if ... | the_stack_v2_python_sparse | luna/gateware/interface/spi.py | greatscottgadgets/luna | train | 842 |
0b4e70cd72a130822d9dae9ef9d13eaffb401c63 | [
"def helper(tree, lower=float('-inf'), upper=float('inf')):\n if not tree:\n return True\n val = tree.val\n if val <= lower or val >= upper:\n return False\n return helper(tree.left, lower, val) and helper(tree.right, val, upper)\nreturn helper(root)",
"if not root:\n return True\nsta... | <|body_start_0|>
def helper(tree, lower=float('-inf'), upper=float('inf')):
if not tree:
return True
val = tree.val
if val <= lower or val >= upper:
return False
return helper(tree.left, lower, val) and helper(tree.right, val, upper... | Solution | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isValidBST(self, root):
"""DFS (recursive)"""
<|body_0|>
def isValidBST2(self, root):
"""DFS (Iteration)"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
def helper(tree, lower=float('-inf'), upper=float('inf')):
if not tree... | stack_v2_sparse_classes_36k_train_008072 | 1,730 | permissive | [
{
"docstring": "DFS (recursive)",
"name": "isValidBST",
"signature": "def isValidBST(self, root)"
},
{
"docstring": "DFS (Iteration)",
"name": "isValidBST2",
"signature": "def isValidBST2(self, root)"
}
] | 2 | stack_v2_sparse_classes_30k_train_015970 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isValidBST(self, root): DFS (recursive)
- def isValidBST2(self, root): DFS (Iteration) | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isValidBST(self, root): DFS (recursive)
- def isValidBST2(self, root): DFS (Iteration)
<|skeleton|>
class Solution:
def isValidBST(self, root):
"""DFS (recursiv... | 49a0b03c55d8a702785888d473ef96539265ce9c | <|skeleton|>
class Solution:
def isValidBST(self, root):
"""DFS (recursive)"""
<|body_0|>
def isValidBST2(self, root):
"""DFS (Iteration)"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def isValidBST(self, root):
"""DFS (recursive)"""
def helper(tree, lower=float('-inf'), upper=float('inf')):
if not tree:
return True
val = tree.val
if val <= lower or val >= upper:
return False
return he... | the_stack_v2_python_sparse | leetcode/0098_validate_binary_search_tree.py | chaosWsF/Python-Practice | train | 1 | |
851a53927a9567eb93bfcd3652bb98e4d6f9042b | [
"super(ParameterGenerator, self).__init__(*args, **kwargs)\nself.parameters = parameters\nself._tree = None\nreturn",
"if self._tree is None:\n self._tree = ParameterTree(self.parameters)\nreturn self._tree",
"for parameters in self.tree.paths:\n yield parameters\nreturn"
] | <|body_start_0|>
super(ParameterGenerator, self).__init__(*args, **kwargs)
self.parameters = parameters
self._tree = None
return
<|end_body_0|>
<|body_start_1|>
if self._tree is None:
self._tree = ParameterTree(self.parameters)
return self._tree
<|end_body_1|... | A ParameterGenerator is an iterator that generates test-parameters. | ParameterGenerator | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ParameterGenerator:
"""A ParameterGenerator is an iterator that generates test-parameters."""
def __init__(self, parameters, *args, **kwargs):
""":param: - `parameters`: A list of parameter (namedtuple) lists"""
<|body_0|>
def tree(self):
""":return: parameter-tr... | stack_v2_sparse_classes_36k_train_008073 | 1,730 | permissive | [
{
"docstring": ":param: - `parameters`: A list of parameter (namedtuple) lists",
"name": "__init__",
"signature": "def __init__(self, parameters, *args, **kwargs)"
},
{
"docstring": ":return: parameter-tree populated with parameters (possibly)",
"name": "tree",
"signature": "def tree(sel... | 3 | stack_v2_sparse_classes_30k_train_003917 | Implement the Python class `ParameterGenerator` described below.
Class description:
A ParameterGenerator is an iterator that generates test-parameters.
Method signatures and docstrings:
- def __init__(self, parameters, *args, **kwargs): :param: - `parameters`: A list of parameter (namedtuple) lists
- def tree(self): ... | Implement the Python class `ParameterGenerator` described below.
Class description:
A ParameterGenerator is an iterator that generates test-parameters.
Method signatures and docstrings:
- def __init__(self, parameters, *args, **kwargs): :param: - `parameters`: A list of parameter (namedtuple) lists
- def tree(self): ... | b4d1c77e1d611fe2b30768b42bdc7493afb0ea95 | <|skeleton|>
class ParameterGenerator:
"""A ParameterGenerator is an iterator that generates test-parameters."""
def __init__(self, parameters, *args, **kwargs):
""":param: - `parameters`: A list of parameter (namedtuple) lists"""
<|body_0|>
def tree(self):
""":return: parameter-tr... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ParameterGenerator:
"""A ParameterGenerator is an iterator that generates test-parameters."""
def __init__(self, parameters, *args, **kwargs):
""":param: - `parameters`: A list of parameter (namedtuple) lists"""
super(ParameterGenerator, self).__init__(*args, **kwargs)
self.parame... | the_stack_v2_python_sparse | apetools/lexicographers/parametergenerator.py | russell-n/oldape | train | 0 |
5edd0eddc6e314516ac072b8925f44326668846d | [
"if id_ == 'monitor':\n return get_monitoring_service_account_response()\nreturn ('Currently getting a specific service account is not supported.', 400)",
"if id_ != '_dry_run':\n raise UserError('Cannot post with account id_.')\nuser_id = current_token['sub']\npayload = flask.request.get_json(silent=True) ... | <|body_start_0|>
if id_ == 'monitor':
return get_monitoring_service_account_response()
return ('Currently getting a specific service account is not supported.', 400)
<|end_body_0|>
<|body_start_1|>
if id_ != '_dry_run':
raise UserError('Cannot post with account id_.')
... | GoogleServiceAccount | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GoogleServiceAccount:
def get(self, id_):
"""Get registered service account(s) and their access expiration. Args: id_ (str): either "monitor" or a comma-delimited list of Google Project IDs to get list of service accounts for. Specifying "monitor" will return the service account email us... | stack_v2_sparse_classes_36k_train_008074 | 35,448 | permissive | [
{
"docstring": "Get registered service account(s) and their access expiration. Args: id_ (str): either \"monitor\" or a comma-delimited list of Google Project IDs to get list of service accounts for. Specifying \"monitor\" will return the service account email used for monitoring purposes.",
"name": "get",
... | 6 | stack_v2_sparse_classes_30k_train_013999 | Implement the Python class `GoogleServiceAccount` described below.
Class description:
Implement the GoogleServiceAccount class.
Method signatures and docstrings:
- def get(self, id_): Get registered service account(s) and their access expiration. Args: id_ (str): either "monitor" or a comma-delimited list of Google P... | Implement the Python class `GoogleServiceAccount` described below.
Class description:
Implement the GoogleServiceAccount class.
Method signatures and docstrings:
- def get(self, id_): Get registered service account(s) and their access expiration. Args: id_ (str): either "monitor" or a comma-delimited list of Google P... | ea885f0e882d8e6bb5db7670c4025bb8e282cdfc | <|skeleton|>
class GoogleServiceAccount:
def get(self, id_):
"""Get registered service account(s) and their access expiration. Args: id_ (str): either "monitor" or a comma-delimited list of Google Project IDs to get list of service accounts for. Specifying "monitor" will return the service account email us... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GoogleServiceAccount:
def get(self, id_):
"""Get registered service account(s) and their access expiration. Args: id_ (str): either "monitor" or a comma-delimited list of Google Project IDs to get list of service accounts for. Specifying "monitor" will return the service account email used for monitor... | the_stack_v2_python_sparse | fence/blueprints/google.py | uc-cdis/fence | train | 42 | |
1c47c205acca739eeda75b44066fa010a6fa8785 | [
"metadata = {'OriginalVolumeMetadataKey': 'OriginalVolumeMetadataValue'}\nsize = self.volumes.behaviors.get_configured_volume_type_property('min_size', id_=volume_type_id, name=volume_type_name)\nvolume = self.volumes.behaviors.create_available_volume(size, volume_type_id, self.random_volume_name(), metadata=metada... | <|body_start_0|>
metadata = {'OriginalVolumeMetadataKey': 'OriginalVolumeMetadataValue'}
size = self.volumes.behaviors.get_configured_volume_type_property('min_size', id_=volume_type_id, name=volume_type_name)
volume = self.volumes.behaviors.create_available_volume(size, volume_type_id, self.ran... | CBSVolumeCloneTests | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CBSVolumeCloneTests:
def ddtest_create_exact_clone_of_existing_volume_and_verify_attributes(self, volume_type_name, volume_type_id):
"""Verify that data written to a volume is intact and available on a clone of that volume"""
<|body_0|>
def ddtest_create_larger_clone_of_volu... | stack_v2_sparse_classes_36k_train_008075 | 5,836 | permissive | [
{
"docstring": "Verify that data written to a volume is intact and available on a clone of that volume",
"name": "ddtest_create_exact_clone_of_existing_volume_and_verify_attributes",
"signature": "def ddtest_create_exact_clone_of_existing_volume_and_verify_attributes(self, volume_type_name, volume_type_... | 2 | stack_v2_sparse_classes_30k_train_006111 | Implement the Python class `CBSVolumeCloneTests` described below.
Class description:
Implement the CBSVolumeCloneTests class.
Method signatures and docstrings:
- def ddtest_create_exact_clone_of_existing_volume_and_verify_attributes(self, volume_type_name, volume_type_id): Verify that data written to a volume is inta... | Implement the Python class `CBSVolumeCloneTests` described below.
Class description:
Implement the CBSVolumeCloneTests class.
Method signatures and docstrings:
- def ddtest_create_exact_clone_of_existing_volume_and_verify_attributes(self, volume_type_name, volume_type_id): Verify that data written to a volume is inta... | 30f0e64672676c3f90b4a582fe90fac6621475b3 | <|skeleton|>
class CBSVolumeCloneTests:
def ddtest_create_exact_clone_of_existing_volume_and_verify_attributes(self, volume_type_name, volume_type_id):
"""Verify that data written to a volume is intact and available on a clone of that volume"""
<|body_0|>
def ddtest_create_larger_clone_of_volu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CBSVolumeCloneTests:
def ddtest_create_exact_clone_of_existing_volume_and_verify_attributes(self, volume_type_name, volume_type_id):
"""Verify that data written to a volume is intact and available on a clone of that volume"""
metadata = {'OriginalVolumeMetadataKey': 'OriginalVolumeMetadataValu... | the_stack_v2_python_sparse | cloudroast/blockstorage/volumes_api/volumes/volume_cloning_tests.py | RULCSoft/cloudroast | train | 1 | |
13d9498715a8bda163701ffaea1954c796d7ebad | [
"specs = super().getInputSpecification()\nspecs.addSub(InputData.parameterInputFactory('bins', contentType=InputTypes.IntegerType))\nspecs.addSub(InputData.parameterInputFactory('variables', contentType=InputTypes.StringListType))\nspecs.addSub(InputData.parameterInputFactory('source', contentType=InputTypes.String... | <|body_start_0|>
specs = super().getInputSpecification()
specs.addSub(InputData.parameterInputFactory('bins', contentType=InputTypes.IntegerType))
specs.addSub(InputData.parameterInputFactory('variables', contentType=InputTypes.StringListType))
specs.addSub(InputData.parameterInputFactor... | Correlation | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-2-Clause",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Correlation:
def getInputSpecification(cls):
"""Define the acceptable user inputs for this class. @ In, None @ Out, specs, InputData.ParameterInput,"""
<|body_0|>
def __init__(self):
"""Constructor. @ In, None @ Out, None"""
<|body_1|>
def handleInput(se... | stack_v2_sparse_classes_36k_train_008076 | 3,441 | permissive | [
{
"docstring": "Define the acceptable user inputs for this class. @ In, None @ Out, specs, InputData.ParameterInput,",
"name": "getInputSpecification",
"signature": "def getInputSpecification(cls)"
},
{
"docstring": "Constructor. @ In, None @ Out, None",
"name": "__init__",
"signature": ... | 5 | stack_v2_sparse_classes_30k_val_000212 | Implement the Python class `Correlation` described below.
Class description:
Implement the Correlation class.
Method signatures and docstrings:
- def getInputSpecification(cls): Define the acceptable user inputs for this class. @ In, None @ Out, specs, InputData.ParameterInput,
- def __init__(self): Constructor. @ In... | Implement the Python class `Correlation` described below.
Class description:
Implement the Correlation class.
Method signatures and docstrings:
- def getInputSpecification(cls): Define the acceptable user inputs for this class. @ In, None @ Out, specs, InputData.ParameterInput,
- def __init__(self): Constructor. @ In... | 2b16e7aa3325fe84cab2477947a951414c635381 | <|skeleton|>
class Correlation:
def getInputSpecification(cls):
"""Define the acceptable user inputs for this class. @ In, None @ Out, specs, InputData.ParameterInput,"""
<|body_0|>
def __init__(self):
"""Constructor. @ In, None @ Out, None"""
<|body_1|>
def handleInput(se... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Correlation:
def getInputSpecification(cls):
"""Define the acceptable user inputs for this class. @ In, None @ Out, specs, InputData.ParameterInput,"""
specs = super().getInputSpecification()
specs.addSub(InputData.parameterInputFactory('bins', contentType=InputTypes.IntegerType))
... | the_stack_v2_python_sparse | plugins/ExamplePlugin/src/CorrelationPlot.py | idaholab/raven | train | 201 | |
9ddd9210290ca3746213f8d5cebdd2940ebb237d | [
"if not heights:\n return 0\nheights.append(0)\nmax_area = 0\nstack = []\nfor i, n in enumerate(heights):\n while stack and heights[i] < heights[stack[-1]]:\n index = stack.pop()\n max_area = max(max_area, heights[index] * (i - 1 - (stack[-1] if stack else -1)))\n stack.append(i)\nreturn max_... | <|body_start_0|>
if not heights:
return 0
heights.append(0)
max_area = 0
stack = []
for i, n in enumerate(heights):
while stack and heights[i] < heights[stack[-1]]:
index = stack.pop()
max_area = max(max_area, heights[index]... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def largestRectangleArea(self, heights):
""":type heights: List[int] :rtype: int"""
<|body_0|>
def largestRectangleArea_bruteforce(self, heights):
""":type heights: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if n... | stack_v2_sparse_classes_36k_train_008077 | 1,860 | no_license | [
{
"docstring": ":type heights: List[int] :rtype: int",
"name": "largestRectangleArea",
"signature": "def largestRectangleArea(self, heights)"
},
{
"docstring": ":type heights: List[int] :rtype: int",
"name": "largestRectangleArea_bruteforce",
"signature": "def largestRectangleArea_brutef... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def largestRectangleArea(self, heights): :type heights: List[int] :rtype: int
- def largestRectangleArea_bruteforce(self, heights): :type heights: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def largestRectangleArea(self, heights): :type heights: List[int] :rtype: int
- def largestRectangleArea_bruteforce(self, heights): :type heights: List[int] :rtype: int
<|skelet... | e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59 | <|skeleton|>
class Solution:
def largestRectangleArea(self, heights):
""":type heights: List[int] :rtype: int"""
<|body_0|>
def largestRectangleArea_bruteforce(self, heights):
""":type heights: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def largestRectangleArea(self, heights):
""":type heights: List[int] :rtype: int"""
if not heights:
return 0
heights.append(0)
max_area = 0
stack = []
for i, n in enumerate(heights):
while stack and heights[i] < heights[stack[-1... | the_stack_v2_python_sparse | src/lt_84.py | oxhead/CodingYourWay | train | 0 | |
977bd45708752a474a3ea77af47bdfcd0af8c460 | [
"from collections import defaultdict\nself.loc = defaultdict(list)\nfor idx, word in enumerate(words):\n self.loc[word].append(idx)",
"loc1 = self.loc[word1]\nloc2 = self.loc[word2]\nl1, l2 = (0, 0)\nmin_diff = float('inf')\nwhile l1 < len(loc1) and l2 < len(loc2):\n min_diff = min(min_diff, abs(loc1[l1] - ... | <|body_start_0|>
from collections import defaultdict
self.loc = defaultdict(list)
for idx, word in enumerate(words):
self.loc[word].append(idx)
<|end_body_0|>
<|body_start_1|>
loc1 = self.loc[word1]
loc2 = self.loc[word2]
l1, l2 = (0, 0)
min_diff = fl... | WordDistance_II | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WordDistance_II:
def __init__(self, words):
""":type words: List[str]"""
<|body_0|>
def shortest(self, word1, word2):
""":type word1: str :type word2: str :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
from collections import defaultdic... | stack_v2_sparse_classes_36k_train_008078 | 3,430 | no_license | [
{
"docstring": ":type words: List[str]",
"name": "__init__",
"signature": "def __init__(self, words)"
},
{
"docstring": ":type word1: str :type word2: str :rtype: int",
"name": "shortest",
"signature": "def shortest(self, word1, word2)"
}
] | 2 | stack_v2_sparse_classes_30k_train_020719 | Implement the Python class `WordDistance_II` described below.
Class description:
Implement the WordDistance_II class.
Method signatures and docstrings:
- def __init__(self, words): :type words: List[str]
- def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int | Implement the Python class `WordDistance_II` described below.
Class description:
Implement the WordDistance_II class.
Method signatures and docstrings:
- def __init__(self, words): :type words: List[str]
- def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int
<|skeleton|>
class WordDistance... | 86d97d4dccf628e95c4bb9cdce9dab0a1e9fdffd | <|skeleton|>
class WordDistance_II:
def __init__(self, words):
""":type words: List[str]"""
<|body_0|>
def shortest(self, word1, word2):
""":type word1: str :type word2: str :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WordDistance_II:
def __init__(self, words):
""":type words: List[str]"""
from collections import defaultdict
self.loc = defaultdict(list)
for idx, word in enumerate(words):
self.loc[word].append(idx)
def shortest(self, word1, word2):
""":type word1: str... | the_stack_v2_python_sparse | algo/array/shortest-word-distance.py | GreenMarch/datasciencecoursera | train | 0 | |
1fb6860eaf2621479bf6bd803381eea33bfc5503 | [
"SpokeLDAP.__init__(self)\nself.config = config.setup()\nself.log = logging.getLogger(__name__)\nself.search_scope = 2\nself.retrieve_attr = None\nself.base_dn = self.config.get('LDAP', 'basedn')\nself.org_class = self.config.get('ATTR_MAP', 'org_class', 'organization')\nself.user_class = self.config.get('ATTR_MAP'... | <|body_start_0|>
SpokeLDAP.__init__(self)
self.config = config.setup()
self.log = logging.getLogger(__name__)
self.search_scope = 2
self.retrieve_attr = None
self.base_dn = self.config.get('LDAP', 'basedn')
self.org_class = self.config.get('ATTR_MAP', 'org_class',... | Provide CRUD methods to LDAP organisation objects. | SpokeOrg | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SpokeOrg:
"""Provide CRUD methods to LDAP organisation objects."""
def __init__(self):
"""Get config, setup logging and LDAP connection."""
<|body_0|>
def create(self, org_name, org_children=None, suffix=None):
"""Create organisation (+containers); return organis... | stack_v2_sparse_classes_36k_train_008079 | 8,067 | permissive | [
{
"docstring": "Get config, setup logging and LDAP connection.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Create organisation (+containers); return organisation object.",
"name": "create",
"signature": "def create(self, org_name, org_children=None, suffix=... | 5 | stack_v2_sparse_classes_30k_val_000015 | Implement the Python class `SpokeOrg` described below.
Class description:
Provide CRUD methods to LDAP organisation objects.
Method signatures and docstrings:
- def __init__(self): Get config, setup logging and LDAP connection.
- def create(self, org_name, org_children=None, suffix=None): Create organisation (+contai... | Implement the Python class `SpokeOrg` described below.
Class description:
Provide CRUD methods to LDAP organisation objects.
Method signatures and docstrings:
- def __init__(self): Get config, setup logging and LDAP connection.
- def create(self, org_name, org_children=None, suffix=None): Create organisation (+contai... | 077d45750643a38b1062a9199800de9c9de900ae | <|skeleton|>
class SpokeOrg:
"""Provide CRUD methods to LDAP organisation objects."""
def __init__(self):
"""Get config, setup logging and LDAP connection."""
<|body_0|>
def create(self, org_name, org_children=None, suffix=None):
"""Create organisation (+containers); return organis... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SpokeOrg:
"""Provide CRUD methods to LDAP organisation objects."""
def __init__(self):
"""Get config, setup logging and LDAP connection."""
SpokeLDAP.__init__(self)
self.config = config.setup()
self.log = logging.getLogger(__name__)
self.search_scope = 2
se... | the_stack_v2_python_sparse | spoke/lib/org.py | KrisSaxton/spoke | train | 0 |
ba3fe3891cfaab36da0bf47caaf39ff4a5bf5e1f | [
"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. | DiscoveryServicer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DiscoveryServicer:
"""Missing associated documentation comment in .proto file."""
def ExchangeNode(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def Hello(self, request, context):
"""Missing associated document... | stack_v2_sparse_classes_36k_train_008080 | 24,581 | no_license | [
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "ExchangeNode",
"signature": "def ExchangeNode(self, request, context)"
},
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "Hello",
"signature": "def Hello(self, request,... | 4 | stack_v2_sparse_classes_30k_train_013129 | Implement the Python class `DiscoveryServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def ExchangeNode(self, request, context): Missing associated documentation comment in .proto file.
- def Hello(self, request, context): Missin... | Implement the Python class `DiscoveryServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def ExchangeNode(self, request, context): Missing associated documentation comment in .proto file.
- def Hello(self, request, context): Missin... | 345bf7df822c4ae5cd9988ffdedae2fa5c1ffd99 | <|skeleton|>
class DiscoveryServicer:
"""Missing associated documentation comment in .proto file."""
def ExchangeNode(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def Hello(self, request, context):
"""Missing associated document... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DiscoveryServicer:
"""Missing associated documentation comment in .proto file."""
def ExchangeNode(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')... | the_stack_v2_python_sparse | grpc_pb2_grpc.py | isSPDL/SPDL | train | 3 |
ef9b550b0fe9f6079f3753583178edb409ce9186 | [
"ds, _ = tfds.load('ted_hrlr_translate/pt_to_en', with_info=True, as_supervised=True)\nself.data_train = ds['train']\nself.data_valid = ds['validation']\nself.tokenizer_pt, self.tokenizer_en = self.tokenize_dataset(self.data_train)",
"SubwordTextEncoder = tfds.deprecated.text.SubwordTextEncoder\ntokenizer_en = Su... | <|body_start_0|>
ds, _ = tfds.load('ted_hrlr_translate/pt_to_en', with_info=True, as_supervised=True)
self.data_train = ds['train']
self.data_valid = ds['validation']
self.tokenizer_pt, self.tokenizer_en = self.tokenize_dataset(self.data_train)
<|end_body_0|>
<|body_start_1|>
Su... | Loads and preps a dataset for machine translation | Dataset | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Dataset:
"""Loads and preps a dataset for machine translation"""
def __init__(self):
"""Constructor"""
<|body_0|>
def tokenize_dataset(self, data):
"""Function that creates sub-word tokenizers for our dataset"""
<|body_1|>
<|end_skeleton|>
<|body_start_... | stack_v2_sparse_classes_36k_train_008081 | 1,000 | no_license | [
{
"docstring": "Constructor",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Function that creates sub-word tokenizers for our dataset",
"name": "tokenize_dataset",
"signature": "def tokenize_dataset(self, data)"
}
] | 2 | null | Implement the Python class `Dataset` described below.
Class description:
Loads and preps a dataset for machine translation
Method signatures and docstrings:
- def __init__(self): Constructor
- def tokenize_dataset(self, data): Function that creates sub-word tokenizers for our dataset | Implement the Python class `Dataset` described below.
Class description:
Loads and preps a dataset for machine translation
Method signatures and docstrings:
- def __init__(self): Constructor
- def tokenize_dataset(self, data): Function that creates sub-word tokenizers for our dataset
<|skeleton|>
class Dataset:
... | c7b6ea4c37b7c5dc41e63cdb8142b3cdfb3e1d23 | <|skeleton|>
class Dataset:
"""Loads and preps a dataset for machine translation"""
def __init__(self):
"""Constructor"""
<|body_0|>
def tokenize_dataset(self, data):
"""Function that creates sub-word tokenizers for our dataset"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Dataset:
"""Loads and preps a dataset for machine translation"""
def __init__(self):
"""Constructor"""
ds, _ = tfds.load('ted_hrlr_translate/pt_to_en', with_info=True, as_supervised=True)
self.data_train = ds['train']
self.data_valid = ds['validation']
self.tokeniz... | the_stack_v2_python_sparse | supervised_learning/0x12-transformer_apps/0-dataset.py | linkjavier/holbertonschool-machine_learning | train | 0 |
f96136f3452fb139fa3d6071624bce3d2108591b | [
"super(MRSLCI, self).__init__(verbose)\nself.nlay = nlay\nself.nx = len(profile)\nself.np = 3 * nlay - 1\nself.mesh2d = pg.createMesh2D(range(self.np + 1), range(self.nx + 1))\nself.mesh2d.rotate(pg.RVector3(0, 0, -np.pi / 2))\nself.setMesh(self.mesh2d)\nself.J = pg.RBlockMatrix()\nself.FOP1d = []\nipos = 0\nfor i,... | <|body_start_0|>
super(MRSLCI, self).__init__(verbose)
self.nlay = nlay
self.nx = len(profile)
self.np = 3 * nlay - 1
self.mesh2d = pg.createMesh2D(range(self.np + 1), range(self.nx + 1))
self.mesh2d.rotate(pg.RVector3(0, 0, -np.pi / 2))
self.setMesh(self.mesh2d)
... | MRS Laterally constrained modelling based on BlockMatrices. | MRSLCI | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MRSLCI:
"""MRS Laterally constrained modelling based on BlockMatrices."""
def __init__(self, profile, nlay=2, verbose=False):
"""Parameters: FDEM data class and number of layers"""
<|body_0|>
def response(self, model):
"""cut-together forward responses of all sou... | stack_v2_sparse_classes_36k_train_008082 | 17,204 | permissive | [
{
"docstring": "Parameters: FDEM data class and number of layers",
"name": "__init__",
"signature": "def __init__(self, profile, nlay=2, verbose=False)"
},
{
"docstring": "cut-together forward responses of all soundings",
"name": "response",
"signature": "def response(self, model)"
},
... | 3 | null | Implement the Python class `MRSLCI` described below.
Class description:
MRS Laterally constrained modelling based on BlockMatrices.
Method signatures and docstrings:
- def __init__(self, profile, nlay=2, verbose=False): Parameters: FDEM data class and number of layers
- def response(self, model): cut-together forward... | Implement the Python class `MRSLCI` described below.
Class description:
MRS Laterally constrained modelling based on BlockMatrices.
Method signatures and docstrings:
- def __init__(self, profile, nlay=2, verbose=False): Parameters: FDEM data class and number of layers
- def response(self, model): cut-together forward... | 9962fe882fad284e52858ba3aa5e87b2395d791d | <|skeleton|>
class MRSLCI:
"""MRS Laterally constrained modelling based on BlockMatrices."""
def __init__(self, profile, nlay=2, verbose=False):
"""Parameters: FDEM data class and number of layers"""
<|body_0|>
def response(self, model):
"""cut-together forward responses of all sou... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MRSLCI:
"""MRS Laterally constrained modelling based on BlockMatrices."""
def __init__(self, profile, nlay=2, verbose=False):
"""Parameters: FDEM data class and number of layers"""
super(MRSLCI, self).__init__(verbose)
self.nlay = nlay
self.nx = len(profile)
self.n... | the_stack_v2_python_sparse | python/pygimli/physics/sNMR/mrsprofile.py | Geophysics-OpenSource/gimli | train | 0 |
8d9a7f86bee9b0309bfd7cd6c30c87277f9f4843 | [
"self._cc_squares, self._ch_squares = ({2, 17, 33}, {7, 22, 36})\ncc_cards = [lambda x, tar=tar: tar for tar in ['STAY'] * 14 + [0, 10]]\nrandom.shuffle(cc_cards)\nself._cc_cards = itertools.cycle(cc_cards)\nch_cards = [lambda x, tar=tar: tar for tar in ['STAY'] * 6 + [0, 10, 11, 24, 39, 5]]\nnext_rr = lambda x: {7... | <|body_start_0|>
self._cc_squares, self._ch_squares = ({2, 17, 33}, {7, 22, 36})
cc_cards = [lambda x, tar=tar: tar for tar in ['STAY'] * 14 + [0, 10]]
random.shuffle(cc_cards)
self._cc_cards = itertools.cycle(cc_cards)
ch_cards = [lambda x, tar=tar: tar for tar in ['STAY'] * 6 +... | class finding the probabilities of a Monopoly turn ending on every square for given dice (through simulation) problem 84 | Monopoly | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Monopoly:
"""class finding the probabilities of a Monopoly turn ending on every square for given dice (through simulation) problem 84"""
def __init__(self, dice):
"""requires dice passed (see helper function get_n_sided_dice), designates spots w/ special actions, creates lambdas expe... | stack_v2_sparse_classes_36k_train_008083 | 3,658 | no_license | [
{
"docstring": "requires dice passed (see helper function get_n_sided_dice), designates spots w/ special actions, creates lambdas expecting current position for every significant card",
"name": "__init__",
"signature": "def __init__(self, dice)"
},
{
"docstring": "only real interface with logic ... | 5 | stack_v2_sparse_classes_30k_train_017506 | Implement the Python class `Monopoly` described below.
Class description:
class finding the probabilities of a Monopoly turn ending on every square for given dice (through simulation) problem 84
Method signatures and docstrings:
- def __init__(self, dice): requires dice passed (see helper function get_n_sided_dice), ... | Implement the Python class `Monopoly` described below.
Class description:
class finding the probabilities of a Monopoly turn ending on every square for given dice (through simulation) problem 84
Method signatures and docstrings:
- def __init__(self, dice): requires dice passed (see helper function get_n_sided_dice), ... | 5c0333fb240d0e8e75411c6301157c12d27758f4 | <|skeleton|>
class Monopoly:
"""class finding the probabilities of a Monopoly turn ending on every square for given dice (through simulation) problem 84"""
def __init__(self, dice):
"""requires dice passed (see helper function get_n_sided_dice), designates spots w/ special actions, creates lambdas expe... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Monopoly:
"""class finding the probabilities of a Monopoly turn ending on every square for given dice (through simulation) problem 84"""
def __init__(self, dice):
"""requires dice passed (see helper function get_n_sided_dice), designates spots w/ special actions, creates lambdas expecting current... | the_stack_v2_python_sparse | pe_80_89/problem_84.py | jwilner/project_euler | train | 0 |
e1808cce8a6863d47a29fe248bbb1c83441c54f9 | [
"if self.mode == 'toast':\n self.toaster.show_toast(title, content, icon_path='icons/jx3bla.ico')\nelse:\n print(title, content)",
"self.mode = mode\nif mode == 'toast':\n from win10toast import ToastNotifier\n self.toaster = ToastNotifier()\nelse:\n pass"
] | <|body_start_0|>
if self.mode == 'toast':
self.toaster.show_toast(title, content, icon_path='icons/jx3bla.ico')
else:
print(title, content)
<|end_body_0|>
<|body_start_1|>
self.mode = mode
if mode == 'toast':
from win10toast import ToastNotifier
... | 通知展示类。 | Notifier | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Notifier:
"""通知展示类。"""
def show(self, title, content):
"""展示一条消息。 params: - title: 标题。 - content: 内容。"""
<|body_0|>
def __init__(self, mode='toast'):
"""初始化."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if self.mode == 'toast':
se... | stack_v2_sparse_classes_36k_train_008084 | 709 | no_license | [
{
"docstring": "展示一条消息。 params: - title: 标题。 - content: 内容。",
"name": "show",
"signature": "def show(self, title, content)"
},
{
"docstring": "初始化.",
"name": "__init__",
"signature": "def __init__(self, mode='toast')"
}
] | 2 | null | Implement the Python class `Notifier` described below.
Class description:
通知展示类。
Method signatures and docstrings:
- def show(self, title, content): 展示一条消息。 params: - title: 标题。 - content: 内容。
- def __init__(self, mode='toast'): 初始化. | Implement the Python class `Notifier` described below.
Class description:
通知展示类。
Method signatures and docstrings:
- def show(self, title, content): 展示一条消息。 params: - title: 标题。 - content: 内容。
- def __init__(self, mode='toast'): 初始化.
<|skeleton|>
class Notifier:
"""通知展示类。"""
def show(self, title, content):
... | 29e0fb69d924a3abc8425526599ac586d452816c | <|skeleton|>
class Notifier:
"""通知展示类。"""
def show(self, title, content):
"""展示一条消息。 params: - title: 标题。 - content: 内容。"""
<|body_0|>
def __init__(self, mode='toast'):
"""初始化."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Notifier:
"""通知展示类。"""
def show(self, title, content):
"""展示一条消息。 params: - title: 标题。 - content: 内容。"""
if self.mode == 'toast':
self.toaster.show_toast(title, content, icon_path='icons/jx3bla.ico')
else:
print(title, content)
def __init__(self, mode=... | the_stack_v2_python_sparse | tools/Notifier.py | moeheart/jx3bla | train | 22 |
ac27b218798629efa8edde4ef04c34e8b5196df2 | [
"self.org = []\nfor i in xrange(len(matrix)):\n self.org.append([])\n for j in xrange(len(matrix[i])):\n self.org[-1].append(matrix[i][j])\nself.sum = []\nfor i in xrange(len(matrix)):\n self.sum.append([])\n for j in xrange(len(matrix[i])):\n self.sum[-1].append(matrix[i][j])\nfor i in xr... | <|body_start_0|>
self.org = []
for i in xrange(len(matrix)):
self.org.append([])
for j in xrange(len(matrix[i])):
self.org[-1].append(matrix[i][j])
self.sum = []
for i in xrange(len(matrix)):
self.sum.append([])
for j in xra... | NumMatrix | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NumMatrix:
def __init__(self, matrix):
""":type matrix: List[List[int]]"""
<|body_0|>
def update(self, row, col, val):
""":type row: int :type col: int :type val: int :rtype: void"""
<|body_1|>
def sumRegion(self, row1, col1, row2, col2):
""":typ... | stack_v2_sparse_classes_36k_train_008085 | 2,537 | permissive | [
{
"docstring": ":type matrix: List[List[int]]",
"name": "__init__",
"signature": "def __init__(self, matrix)"
},
{
"docstring": ":type row: int :type col: int :type val: int :rtype: void",
"name": "update",
"signature": "def update(self, row, col, val)"
},
{
"docstring": ":type r... | 3 | null | Implement the Python class `NumMatrix` described below.
Class description:
Implement the NumMatrix class.
Method signatures and docstrings:
- def __init__(self, matrix): :type matrix: List[List[int]]
- def update(self, row, col, val): :type row: int :type col: int :type val: int :rtype: void
- def sumRegion(self, row... | Implement the Python class `NumMatrix` described below.
Class description:
Implement the NumMatrix class.
Method signatures and docstrings:
- def __init__(self, matrix): :type matrix: List[List[int]]
- def update(self, row, col, val): :type row: int :type col: int :type val: int :rtype: void
- def sumRegion(self, row... | 6facec2a54d1d9f133f420c9bce1d1043f57ebc6 | <|skeleton|>
class NumMatrix:
def __init__(self, matrix):
""":type matrix: List[List[int]]"""
<|body_0|>
def update(self, row, col, val):
""":type row: int :type col: int :type val: int :rtype: void"""
<|body_1|>
def sumRegion(self, row1, col1, row2, col2):
""":typ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NumMatrix:
def __init__(self, matrix):
""":type matrix: List[List[int]]"""
self.org = []
for i in xrange(len(matrix)):
self.org.append([])
for j in xrange(len(matrix[i])):
self.org[-1].append(matrix[i][j])
self.sum = []
for i in x... | the_stack_v2_python_sparse | Range Sum Query 2D - Mutable.py | sugia/leetcode | train | 1 | |
76a96383261caff049dc38307b6483a154dde3c0 | [
"r2_score = sklearn.metrics.r2_score(ydata, preds)\nadj_r2 = 1 - (1 - r2_score) * (self.x_size[0] - 1) / (self.x_size[0] - self.x_size[1] - 1)\nreturn adj_r2",
"if hasattr(self, 'model'):\n preds = self.model.predict(xdata)\n scores = OrderedDict()\n scores['r2'] = sklearn.metrics.r2_score(ydata, preds)\... | <|body_start_0|>
r2_score = sklearn.metrics.r2_score(ydata, preds)
adj_r2 = 1 - (1 - r2_score) * (self.x_size[0] - 1) / (self.x_size[0] - self.x_size[1] - 1)
return adj_r2
<|end_body_0|>
<|body_start_1|>
if hasattr(self, 'model'):
preds = self.model.predict(xdata)
... | A parent class with some general methods for children ML classes. The children classes are specific ML models such random forest regressor, lightgbm regressor, etc. | BaseMLModel | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseMLModel:
"""A parent class with some general methods for children ML classes. The children classes are specific ML models such random forest regressor, lightgbm regressor, etc."""
def __adj_r2_score(self, ydata, preds):
"""Calc adjusted r^2. https://en.wikipedia.org/wiki/Coeffici... | stack_v2_sparse_classes_36k_train_008086 | 31,757 | no_license | [
{
"docstring": "Calc adjusted r^2. https://en.wikipedia.org/wiki/Coefficient_of_determination#Adjusted_R2 https://dziganto.github.io/data%20science/linear%20regression/machine%20learning/python/Linear-Regression-101-Metrics/ https://stats.stackexchange.com/questions/334004/can-r2-be-greater-than-1",
"name":... | 4 | stack_v2_sparse_classes_30k_train_004480 | Implement the Python class `BaseMLModel` described below.
Class description:
A parent class with some general methods for children ML classes. The children classes are specific ML models such random forest regressor, lightgbm regressor, etc.
Method signatures and docstrings:
- def __adj_r2_score(self, ydata, preds): ... | Implement the Python class `BaseMLModel` described below.
Class description:
A parent class with some general methods for children ML classes. The children classes are specific ML models such random forest regressor, lightgbm regressor, etc.
Method signatures and docstrings:
- def __adj_r2_score(self, ydata, preds): ... | c99f32052fab0de210fd200b43194b19088dc3a7 | <|skeleton|>
class BaseMLModel:
"""A parent class with some general methods for children ML classes. The children classes are specific ML models such random forest regressor, lightgbm regressor, etc."""
def __adj_r2_score(self, ydata, preds):
"""Calc adjusted r^2. https://en.wikipedia.org/wiki/Coeffici... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BaseMLModel:
"""A parent class with some general methods for children ML classes. The children classes are specific ML models such random forest regressor, lightgbm regressor, etc."""
def __adj_r2_score(self, ydata, preds):
"""Calc adjusted r^2. https://en.wikipedia.org/wiki/Coefficient_of_determ... | the_stack_v2_python_sparse | src/train/ml_models.py | adpartin/pilot1 | train | 1 |
28eb4480717626dbf1cba59b8a4fc991e099a71e | [
"m = {'(': [], '[': [], '{': []}\nb = {')': '(', ']': '[', '}': '{'}\nfor ch in s:\n if ch in m:\n m[ch].append(ch)\n elif len(m[b[ch]]) <= 0:\n return False\n else:\n m[b[ch]].pop()\nfor k in m:\n if len(m[k]) != 0:\n return False\nreturn True",
"m = []\nb = {')': '(', ']'... | <|body_start_0|>
m = {'(': [], '[': [], '{': []}
b = {')': '(', ']': '[', '}': '{'}
for ch in s:
if ch in m:
m[ch].append(ch)
elif len(m[b[ch]]) <= 0:
return False
else:
m[b[ch]].pop()
for k in m:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isValid(self, s):
""":type s: str :rtype: bool"""
<|body_0|>
def isValid(self, s):
""":type s: str :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
m = {'(': [], '[': [], '{': []}
b = {')': '(', ']': '[', '}': '{'}
... | stack_v2_sparse_classes_36k_train_008087 | 2,131 | no_license | [
{
"docstring": ":type s: str :rtype: bool",
"name": "isValid",
"signature": "def isValid(self, s)"
},
{
"docstring": ":type s: str :rtype: bool",
"name": "isValid",
"signature": "def isValid(self, s)"
}
] | 2 | stack_v2_sparse_classes_30k_train_009978 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isValid(self, s): :type s: str :rtype: bool
- def isValid(self, s): :type s: str :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isValid(self, s): :type s: str :rtype: bool
- def isValid(self, s): :type s: str :rtype: bool
<|skeleton|>
class Solution:
def isValid(self, s):
""":type s: str... | 860590239da0618c52967a55eda8d6bbe00bfa96 | <|skeleton|>
class Solution:
def isValid(self, s):
""":type s: str :rtype: bool"""
<|body_0|>
def isValid(self, s):
""":type s: str :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def isValid(self, s):
""":type s: str :rtype: bool"""
m = {'(': [], '[': [], '{': []}
b = {')': '(', ']': '[', '}': '{'}
for ch in s:
if ch in m:
m[ch].append(ch)
elif len(m[b[ch]]) <= 0:
return False
... | the_stack_v2_python_sparse | LeetCode/p0020/II/valid-parentheses.py | Ynjxsjmh/PracticeMakesPerfect | train | 0 | |
16d2159a79e1bf886a49d7db52e067aa0a2b22f3 | [
"self._caffe = kwargs.pop('caffe')\nself._creator = kwargs.pop('creator')\nkwargs.setdefault('label_suffix', '')\nsuper(ReportForm, self).__init__(*args, **kwargs)",
"report = super(ReportForm, self).save(commit=False)\nreport.caffe = self._caffe\nreport.creator = self._creator\nif commit:\n report.save()\nret... | <|body_start_0|>
self._caffe = kwargs.pop('caffe')
self._creator = kwargs.pop('creator')
kwargs.setdefault('label_suffix', '')
super(ReportForm, self).__init__(*args, **kwargs)
<|end_body_0|>
<|body_start_1|>
report = super(ReportForm, self).save(commit=False)
report.caf... | Responsible for setting up a Report. | ReportForm | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReportForm:
"""Responsible for setting up a Report."""
def __init__(self, *args, **kwargs):
"""Initialize all ReportForm's fields."""
<|body_0|>
def save(self, commit=True):
"""Override of save method, to add Caffe relation."""
<|body_1|>
<|end_skeleton|... | stack_v2_sparse_classes_36k_train_008088 | 5,569 | permissive | [
{
"docstring": "Initialize all ReportForm's fields.",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docstring": "Override of save method, to add Caffe relation.",
"name": "save",
"signature": "def save(self, commit=True)"
}
] | 2 | stack_v2_sparse_classes_30k_train_014662 | Implement the Python class `ReportForm` described below.
Class description:
Responsible for setting up a Report.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Initialize all ReportForm's fields.
- def save(self, commit=True): Override of save method, to add Caffe relation. | Implement the Python class `ReportForm` described below.
Class description:
Responsible for setting up a Report.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Initialize all ReportForm's fields.
- def save(self, commit=True): Override of save method, to add Caffe relation.
<|skeleton|>
cla... | cdb7f5edb29255c7e874eaa6231621063210a8b0 | <|skeleton|>
class ReportForm:
"""Responsible for setting up a Report."""
def __init__(self, *args, **kwargs):
"""Initialize all ReportForm's fields."""
<|body_0|>
def save(self, commit=True):
"""Override of save method, to add Caffe relation."""
<|body_1|>
<|end_skeleton|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ReportForm:
"""Responsible for setting up a Report."""
def __init__(self, *args, **kwargs):
"""Initialize all ReportForm's fields."""
self._caffe = kwargs.pop('caffe')
self._creator = kwargs.pop('creator')
kwargs.setdefault('label_suffix', '')
super(ReportForm, sel... | the_stack_v2_python_sparse | caffe/reports/forms.py | VirrageS/io-kawiarnie | train | 3 |
eb4ed989f04dcdce30a03f0b2cce08868ac1a1de | [
"super(Inception3c, self).__init__()\nself.branch1 = paddle.nn.Sequential(ConvBNLayer(num_channels=num_channels, num_filters=ch3x3reduced, filter_size=1, stride=1, padding=0), ConvBNLayer(num_channels=ch3x3reduced, num_filters=ch3x3, filter_size=3, stride=2, padding=1))\nself.branch2 = paddle.nn.Sequential(ConvBNLa... | <|body_start_0|>
super(Inception3c, self).__init__()
self.branch1 = paddle.nn.Sequential(ConvBNLayer(num_channels=num_channels, num_filters=ch3x3reduced, filter_size=1, stride=1, padding=0), ConvBNLayer(num_channels=ch3x3reduced, num_filters=ch3x3, filter_size=3, stride=2, padding=1))
self.branc... | Inception3c | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Inception3c:
def __init__(self, num_channels, ch3x3reduced, ch3x3, doublech3x3reduced, doublech3x3_1, doublech3x3_2):
"""@Brief `Inception3c` @Parameters num_channels : channel numbers of input tensor ch3x3reduced : channel numbers of 1x1 conv before 3x3 conv ch3x3 : output channel numbe... | stack_v2_sparse_classes_36k_train_008089 | 23,805 | permissive | [
{
"docstring": "@Brief `Inception3c` @Parameters num_channels : channel numbers of input tensor ch3x3reduced : channel numbers of 1x1 conv before 3x3 conv ch3x3 : output channel numbers of 3x3 conv doublech3x3reduced : channel numbers of 1x1 conv before the double 3x3 convs doublech3x3_1 : output channel number... | 2 | null | Implement the Python class `Inception3c` described below.
Class description:
Implement the Inception3c class.
Method signatures and docstrings:
- def __init__(self, num_channels, ch3x3reduced, ch3x3, doublech3x3reduced, doublech3x3_1, doublech3x3_2): @Brief `Inception3c` @Parameters num_channels : channel numbers of ... | Implement the Python class `Inception3c` described below.
Class description:
Implement the Inception3c class.
Method signatures and docstrings:
- def __init__(self, num_channels, ch3x3reduced, ch3x3, doublech3x3reduced, doublech3x3_1, doublech3x3_2): @Brief `Inception3c` @Parameters num_channels : channel numbers of ... | 78ff3c3ab3906012a0f4a612251347632aa493a7 | <|skeleton|>
class Inception3c:
def __init__(self, num_channels, ch3x3reduced, ch3x3, doublech3x3reduced, doublech3x3_1, doublech3x3_2):
"""@Brief `Inception3c` @Parameters num_channels : channel numbers of input tensor ch3x3reduced : channel numbers of 1x1 conv before 3x3 conv ch3x3 : output channel numbe... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Inception3c:
def __init__(self, num_channels, ch3x3reduced, ch3x3, doublech3x3reduced, doublech3x3_1, doublech3x3_2):
"""@Brief `Inception3c` @Parameters num_channels : channel numbers of input tensor ch3x3reduced : channel numbers of 1x1 conv before 3x3 conv ch3x3 : output channel numbers of 3x3 conv... | the_stack_v2_python_sparse | ECO/paddle2.0/model/ECO.py | thinkall/Contrib | train | 1 | |
2cde86e769029d77c3c23aaa75748afd5bd16409 | [
"bots = []\nwhitelist = ndb.Key('BotWhitelist', WHITELIST_KEY).get()\nif whitelist:\n bots = whitelist.bots\nself.RenderHtml('bot_whitelist.html', {'bot_whitelist': '\\n'.join(bots)})",
"bots = []\nwhitelist_text = self.request.get('bot_whitelist', '')\nif whitelist_text:\n bots = whitelist_text.strip().spl... | <|body_start_0|>
bots = []
whitelist = ndb.Key('BotWhitelist', WHITELIST_KEY).get()
if whitelist:
bots = whitelist.bots
self.RenderHtml('bot_whitelist.html', {'bot_whitelist': '\n'.join(bots)})
<|end_body_0|>
<|body_start_1|>
bots = []
whitelist_text = self.r... | URL endpoint to view/edit the external Bot whitelist for /add_point. | BotWhitelistHandler | [
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"MIT",
"Apache-2.0",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BotWhitelistHandler:
"""URL endpoint to view/edit the external Bot whitelist for /add_point."""
def get(self):
"""Lists the Bots in the whitelist."""
<|body_0|>
def post(self):
"""Updates the Bot names in the whitelist."""
<|body_1|>
<|end_skeleton|>
<|... | stack_v2_sparse_classes_36k_train_008090 | 1,383 | permissive | [
{
"docstring": "Lists the Bots in the whitelist.",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "Updates the Bot names in the whitelist.",
"name": "post",
"signature": "def post(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_015554 | Implement the Python class `BotWhitelistHandler` described below.
Class description:
URL endpoint to view/edit the external Bot whitelist for /add_point.
Method signatures and docstrings:
- def get(self): Lists the Bots in the whitelist.
- def post(self): Updates the Bot names in the whitelist. | Implement the Python class `BotWhitelistHandler` described below.
Class description:
URL endpoint to view/edit the external Bot whitelist for /add_point.
Method signatures and docstrings:
- def get(self): Lists the Bots in the whitelist.
- def post(self): Updates the Bot names in the whitelist.
<|skeleton|>
class Bo... | e71f21b9b4b9b839f5093301974a45545dad2691 | <|skeleton|>
class BotWhitelistHandler:
"""URL endpoint to view/edit the external Bot whitelist for /add_point."""
def get(self):
"""Lists the Bots in the whitelist."""
<|body_0|>
def post(self):
"""Updates the Bot names in the whitelist."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BotWhitelistHandler:
"""URL endpoint to view/edit the external Bot whitelist for /add_point."""
def get(self):
"""Lists the Bots in the whitelist."""
bots = []
whitelist = ndb.Key('BotWhitelist', WHITELIST_KEY).get()
if whitelist:
bots = whitelist.bots
... | the_stack_v2_python_sparse | third_party/catapult/dashboard/dashboard/bot_whitelist.py | zenoalbisser/chromium | train | 0 |
32aeff0b0b2c4dd6bf271769146a97a0e8cf5e40 | [
"trie = Trie()\ntrie.build_from_words(words)\nrslt = []\nfor w in words:\n if trie.is_concatenated_word(w, 0, 0):\n rslt.append(w)\nreturn rslt",
"memo, wordSet = ({}, set(words))\n\ndef is_concatenated_word(w: str) -> bool:\n if w in memo:\n return memo[w]\n for i in range(1, len(w)):\n ... | <|body_start_0|>
trie = Trie()
trie.build_from_words(words)
rslt = []
for w in words:
if trie.is_concatenated_word(w, 0, 0):
rslt.append(w)
return rslt
<|end_body_0|>
<|body_start_1|>
memo, wordSet = ({}, set(words))
def is_concatenat... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findAllConcatenatedWordsInADict(self, words: List[str]) -> List[str]:
"""1. First build a prefix tree based on the input words. 2. Then use prefix tree to determine if a long word is concatenated by the previous small words by counting the total word end in the trie for the... | stack_v2_sparse_classes_36k_train_008091 | 2,730 | no_license | [
{
"docstring": "1. First build a prefix tree based on the input words. 2. Then use prefix tree to determine if a long word is concatenated by the previous small words by counting the total word end in the trie for the current word.",
"name": "findAllConcatenatedWordsInADict",
"signature": "def findAllCo... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findAllConcatenatedWordsInADict(self, words: List[str]) -> List[str]: 1. First build a prefix tree based on the input words. 2. Then use prefix tree to determine if a long wo... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findAllConcatenatedWordsInADict(self, words: List[str]) -> List[str]: 1. First build a prefix tree based on the input words. 2. Then use prefix tree to determine if a long wo... | edb870f83f0c4568cce0cacec04ee70cf6b545bf | <|skeleton|>
class Solution:
def findAllConcatenatedWordsInADict(self, words: List[str]) -> List[str]:
"""1. First build a prefix tree based on the input words. 2. Then use prefix tree to determine if a long word is concatenated by the previous small words by counting the total word end in the trie for the... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findAllConcatenatedWordsInADict(self, words: List[str]) -> List[str]:
"""1. First build a prefix tree based on the input words. 2. Then use prefix tree to determine if a long word is concatenated by the previous small words by counting the total word end in the trie for the current word.... | the_stack_v2_python_sparse | 2020/concatenated_words.py | eronekogin/leetcode | train | 0 | |
28dc643f5c77e06797f8fc3f9bd49012f14d5607 | [
"if not os.path.exists(path):\n os.mkdir(path)\nelif trash:\n os.system('cp -rf {0} .Trash '.format(path))\n os.system('rm -rf {0} '.format(path))\n os.mkdir(path)\nif clear:\n try:\n os.system('rm -rf .Trash ')\n except:\n pass",
"if is_dir:\n os.system(' cp -rf {0} {1} ;'.f... | <|body_start_0|>
if not os.path.exists(path):
os.mkdir(path)
elif trash:
os.system('cp -rf {0} .Trash '.format(path))
os.system('rm -rf {0} '.format(path))
os.mkdir(path)
if clear:
try:
os.system('rm -rf .Trash ')
... | myTools | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class myTools:
def mkdir(path, trash=False, clear=True):
"""创建文件夹, :param trash: True, 表示,如果存在该文件夹,1、将该文件夹重命名为 .Trash 文件夹 2、在建立该文件夹"""
<|body_0|>
def cp(from_path, to_path, is_dir=False):
"""复制文件 :param from_path: 原文件 :param to_path: 复制后的文件"""
<|body_1|>
<|end_ske... | stack_v2_sparse_classes_36k_train_008092 | 10,564 | no_license | [
{
"docstring": "创建文件夹, :param trash: True, 表示,如果存在该文件夹,1、将该文件夹重命名为 .Trash 文件夹 2、在建立该文件夹",
"name": "mkdir",
"signature": "def mkdir(path, trash=False, clear=True)"
},
{
"docstring": "复制文件 :param from_path: 原文件 :param to_path: 复制后的文件",
"name": "cp",
"signature": "def cp(from_path, to_path,... | 2 | stack_v2_sparse_classes_30k_train_012507 | Implement the Python class `myTools` described below.
Class description:
Implement the myTools class.
Method signatures and docstrings:
- def mkdir(path, trash=False, clear=True): 创建文件夹, :param trash: True, 表示,如果存在该文件夹,1、将该文件夹重命名为 .Trash 文件夹 2、在建立该文件夹
- def cp(from_path, to_path, is_dir=False): 复制文件 :param from_path:... | Implement the Python class `myTools` described below.
Class description:
Implement the myTools class.
Method signatures and docstrings:
- def mkdir(path, trash=False, clear=True): 创建文件夹, :param trash: True, 表示,如果存在该文件夹,1、将该文件夹重命名为 .Trash 文件夹 2、在建立该文件夹
- def cp(from_path, to_path, is_dir=False): 复制文件 :param from_path:... | 32ba7b316a4945d062377a3cc37a926aa79b10b9 | <|skeleton|>
class myTools:
def mkdir(path, trash=False, clear=True):
"""创建文件夹, :param trash: True, 表示,如果存在该文件夹,1、将该文件夹重命名为 .Trash 文件夹 2、在建立该文件夹"""
<|body_0|>
def cp(from_path, to_path, is_dir=False):
"""复制文件 :param from_path: 原文件 :param to_path: 复制后的文件"""
<|body_1|>
<|end_ske... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class myTools:
def mkdir(path, trash=False, clear=True):
"""创建文件夹, :param trash: True, 表示,如果存在该文件夹,1、将该文件夹重命名为 .Trash 文件夹 2、在建立该文件夹"""
if not os.path.exists(path):
os.mkdir(path)
elif trash:
os.system('cp -rf {0} .Trash '.format(path))
os.system('rm -rf {... | the_stack_v2_python_sparse | longgb/Tools/multi/multi.py | longgb246/pythonstudy | train | 20 | |
0ca5a3845c3a2de45d9941f7d72bd5c137d3732c | [
"login_error = HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail='用户名或者密码错误', headers={'WWW-Authenticate': 'Bearer'})\nuser = UserModel.get_user_by_email(data.username, sc=self.session)\nif not user:\n user = UserModel.get_user_by_username(data.username, sc=self.session)\nif not user:\n user = Us... | <|body_start_0|>
login_error = HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail='用户名或者密码错误', headers={'WWW-Authenticate': 'Bearer'})
user = UserModel.get_user_by_email(data.username, sc=self.session)
if not user:
user = UserModel.get_user_by_username(data.username, sc=s... | UserView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserView:
async def login(self, data: OAuth2PasswordRequestForm=Depends(), session: Session=Depends(get_fast_api_db)):
"""登陆用的接口"""
<|body_0|>
async def create_user(self, data: schema.UserSchema) -> schema.UserSchema:
"""创建用户用的接口"""
<|body_1|>
async def ... | stack_v2_sparse_classes_36k_train_008093 | 8,560 | no_license | [
{
"docstring": "登陆用的接口",
"name": "login",
"signature": "async def login(self, data: OAuth2PasswordRequestForm=Depends(), session: Session=Depends(get_fast_api_db))"
},
{
"docstring": "创建用户用的接口",
"name": "create_user",
"signature": "async def create_user(self, data: schema.UserSchema) -> ... | 3 | null | Implement the Python class `UserView` described below.
Class description:
Implement the UserView class.
Method signatures and docstrings:
- async def login(self, data: OAuth2PasswordRequestForm=Depends(), session: Session=Depends(get_fast_api_db)): 登陆用的接口
- async def create_user(self, data: schema.UserSchema) -> sche... | Implement the Python class `UserView` described below.
Class description:
Implement the UserView class.
Method signatures and docstrings:
- async def login(self, data: OAuth2PasswordRequestForm=Depends(), session: Session=Depends(get_fast_api_db)): 登陆用的接口
- async def create_user(self, data: schema.UserSchema) -> sche... | a2c4a4d3bc71b767cfa9e99f0c8c2b2a1995a9f6 | <|skeleton|>
class UserView:
async def login(self, data: OAuth2PasswordRequestForm=Depends(), session: Session=Depends(get_fast_api_db)):
"""登陆用的接口"""
<|body_0|>
async def create_user(self, data: schema.UserSchema) -> schema.UserSchema:
"""创建用户用的接口"""
<|body_1|>
async def ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserView:
async def login(self, data: OAuth2PasswordRequestForm=Depends(), session: Session=Depends(get_fast_api_db)):
"""登陆用的接口"""
login_error = HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail='用户名或者密码错误', headers={'WWW-Authenticate': 'Bearer'})
user = UserModel.get_use... | the_stack_v2_python_sparse | web/users_api.py | webclinic017/aibitgo | train | 2 | |
7bd54e12039d188594d2ca0ff008b7c30e17a487 | [
"self.config = config\nInlineProcessor.__init__(self, pattern, md)\nself.md = md\nself.formatters = [{'name': 'inlinehilite', 'test': _test, 'formatter': self.highlight_code}]\ncustom_inline = self.config.get('custom_inline', [])\nfor custom in custom_inline:\n name = custom.get('name')\n class_name = custom.... | <|body_start_0|>
self.config = config
InlineProcessor.__init__(self, pattern, md)
self.md = md
self.formatters = [{'name': 'inlinehilite', 'test': _test, 'formatter': self.highlight_code}]
custom_inline = self.config.get('custom_inline', [])
for custom in custom_inline:
... | Handle the inline code patterns. | InlineHilitePattern | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InlineHilitePattern:
"""Handle the inline code patterns."""
def __init__(self, pattern, config, md):
"""Initialize."""
<|body_0|>
def extend_custom_inline(self, name, formatter):
"""Extend SuperFences with the given name, language, and formatter."""
<|bod... | stack_v2_sparse_classes_36k_train_008094 | 7,110 | permissive | [
{
"docstring": "Initialize.",
"name": "__init__",
"signature": "def __init__(self, pattern, config, md)"
},
{
"docstring": "Extend SuperFences with the given name, language, and formatter.",
"name": "extend_custom_inline",
"signature": "def extend_custom_inline(self, name, formatter)"
... | 6 | stack_v2_sparse_classes_30k_val_000836 | Implement the Python class `InlineHilitePattern` described below.
Class description:
Handle the inline code patterns.
Method signatures and docstrings:
- def __init__(self, pattern, config, md): Initialize.
- def extend_custom_inline(self, name, formatter): Extend SuperFences with the given name, language, and format... | Implement the Python class `InlineHilitePattern` described below.
Class description:
Handle the inline code patterns.
Method signatures and docstrings:
- def __init__(self, pattern, config, md): Initialize.
- def extend_custom_inline(self, name, formatter): Extend SuperFences with the given name, language, and format... | 0eed7cfcb43fe39b20a6be693adaa3ef03b0231e | <|skeleton|>
class InlineHilitePattern:
"""Handle the inline code patterns."""
def __init__(self, pattern, config, md):
"""Initialize."""
<|body_0|>
def extend_custom_inline(self, name, formatter):
"""Extend SuperFences with the given name, language, and formatter."""
<|bod... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InlineHilitePattern:
"""Handle the inline code patterns."""
def __init__(self, pattern, config, md):
"""Initialize."""
self.config = config
InlineProcessor.__init__(self, pattern, md)
self.md = md
self.formatters = [{'name': 'inlinehilite', 'test': _test, 'formatte... | the_stack_v2_python_sparse | st3/pymdownx/inlinehilite.py | facelessuser/sublime-pymdownx | train | 2 |
5716b5f02e9f550df441f371313598e695e5933e | [
"if 'username' in request.COOKIES:\n username = request.COOKIES.get('username')\n checked = 'checked'\nelse:\n username = ''\n checked = ''\nforget_form = ForgetPwdForm()\nreturn render(request, 'login.html', {'forget_form': forget_form, 'username': username, 'checked': checked})",
"username = request... | <|body_start_0|>
if 'username' in request.COOKIES:
username = request.COOKIES.get('username')
checked = 'checked'
else:
username = ''
checked = ''
forget_form = ForgetPwdForm()
return render(request, 'login.html', {'forget_form': forget_for... | login page | LoginView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoginView:
"""login page"""
def get(self, request):
"""show the login page"""
<|body_0|>
def post(self, request):
"""process the login"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if 'username' in request.COOKIES:
username = reque... | stack_v2_sparse_classes_36k_train_008095 | 28,206 | no_license | [
{
"docstring": "show the login page",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "process the login",
"name": "post",
"signature": "def post(self, request)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005844 | Implement the Python class `LoginView` described below.
Class description:
login page
Method signatures and docstrings:
- def get(self, request): show the login page
- def post(self, request): process the login | Implement the Python class `LoginView` described below.
Class description:
login page
Method signatures and docstrings:
- def get(self, request): show the login page
- def post(self, request): process the login
<|skeleton|>
class LoginView:
"""login page"""
def get(self, request):
"""show the login ... | 5efeebedd4695ef9d904beb707a1538ba049b187 | <|skeleton|>
class LoginView:
"""login page"""
def get(self, request):
"""show the login page"""
<|body_0|>
def post(self, request):
"""process the login"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LoginView:
"""login page"""
def get(self, request):
"""show the login page"""
if 'username' in request.COOKIES:
username = request.COOKIES.get('username')
checked = 'checked'
else:
username = ''
checked = ''
forget_form = For... | the_stack_v2_python_sparse | dbbus/apps/user/views.py | mofiebiger/DublinBus | train | 1 |
a12a0c712c864bd8596a7e8f56639fa4f05cf9da | [
"super().get(request, *args, **kwargs)\nthis_template = ConversationTemplate.objects.get(pk=self.kwargs['pk'])\nassignments = this_template.assignments.all()\nto_delete = []\nfor assignment in assignments:\n if assignment.conversation_templates.all().count() == 1:\n to_delete.append(assignment.name)\ncont... | <|body_start_0|>
super().get(request, *args, **kwargs)
this_template = ConversationTemplate.objects.get(pk=self.kwargs['pk'])
assignments = this_template.assignments.all()
to_delete = []
for assignment in assignments:
if assignment.conversation_templates.all().count()... | Deletes a template. Confirmation modal pops up to make sure the user wants to delete a template. | TemplateDeleteView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TemplateDeleteView:
"""Deletes a template. Confirmation modal pops up to make sure the user wants to delete a template."""
def get(self, request, *args, **kwargs):
"""Override post to send template name and name of assignment that will be removed as context to the template"""
... | stack_v2_sparse_classes_36k_train_008096 | 16,128 | no_license | [
{
"docstring": "Override post to send template name and name of assignment that will be removed as context to the template",
"name": "get",
"signature": "def get(self, request, *args, **kwargs)"
},
{
"docstring": "Override post to remove assignment if the template being deleted is the only one i... | 2 | stack_v2_sparse_classes_30k_test_000234 | Implement the Python class `TemplateDeleteView` described below.
Class description:
Deletes a template. Confirmation modal pops up to make sure the user wants to delete a template.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Override post to send template name and name of assignment t... | Implement the Python class `TemplateDeleteView` described below.
Class description:
Deletes a template. Confirmation modal pops up to make sure the user wants to delete a template.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Override post to send template name and name of assignment t... | 2127b5ac792f5a3a2ac499059470f08248cf062d | <|skeleton|>
class TemplateDeleteView:
"""Deletes a template. Confirmation modal pops up to make sure the user wants to delete a template."""
def get(self, request, *args, **kwargs):
"""Override post to send template name and name of assignment that will be removed as context to the template"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TemplateDeleteView:
"""Deletes a template. Confirmation modal pops up to make sure the user wants to delete a template."""
def get(self, request, *args, **kwargs):
"""Override post to send template name and name of assignment that will be removed as context to the template"""
super().get(... | the_stack_v2_python_sparse | simcon_project/conversation_templates/views/template_management.py | Likhovodov/Simulated-Conversations | train | 1 |
670931cf7f4f784c56c13a837e247cdd8e9f8565 | [
"self.certificate = certificate\nself.name = name\nself.date_of_birth = APIHelper.RFC3339DateTime(date_of_birth) if date_of_birth else None\nself.pid = pid\nself.ssn = ssn\nself.signed_timestamp = APIHelper.RFC3339DateTime(signed_timestamp) if signed_timestamp else None\nself.valid = valid\nself.ocsp = ocsp\nself.e... | <|body_start_0|>
self.certificate = certificate
self.name = name
self.date_of_birth = APIHelper.RFC3339DateTime(date_of_birth) if date_of_birth else None
self.pid = pid
self.ssn = ssn
self.signed_timestamp = APIHelper.RFC3339DateTime(signed_timestamp) if signed_timestamp ... | Implementation of the 'SDOSigners' model. TODO: type model description here. Attributes: certificate (Certificate): TODO: type description here. name (string): TODO: type description here. date_of_birth (datetime): TODO: type description here. pid (string): TODO: type description here. ssn (string): TODO: type descript... | SDOSigners | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SDOSigners:
"""Implementation of the 'SDOSigners' model. TODO: type model description here. Attributes: certificate (Certificate): TODO: type description here. name (string): TODO: type description here. date_of_birth (datetime): TODO: type description here. pid (string): TODO: type description h... | stack_v2_sparse_classes_36k_train_008097 | 4,143 | permissive | [
{
"docstring": "Constructor for the SDOSigners class",
"name": "__init__",
"signature": "def __init__(self, certificate=None, name=None, date_of_birth=None, pid=None, ssn=None, signed_timestamp=None, valid=None, ocsp=None, environment=None, additional_properties={})"
},
{
"docstring": "Creates a... | 2 | null | Implement the Python class `SDOSigners` described below.
Class description:
Implementation of the 'SDOSigners' model. TODO: type model description here. Attributes: certificate (Certificate): TODO: type description here. name (string): TODO: type description here. date_of_birth (datetime): TODO: type description here.... | Implement the Python class `SDOSigners` described below.
Class description:
Implementation of the 'SDOSigners' model. TODO: type model description here. Attributes: certificate (Certificate): TODO: type description here. name (string): TODO: type description here. date_of_birth (datetime): TODO: type description here.... | fa3918a6c54ea0eedb9146578645b7eb1755b642 | <|skeleton|>
class SDOSigners:
"""Implementation of the 'SDOSigners' model. TODO: type model description here. Attributes: certificate (Certificate): TODO: type description here. name (string): TODO: type description here. date_of_birth (datetime): TODO: type description here. pid (string): TODO: type description h... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SDOSigners:
"""Implementation of the 'SDOSigners' model. TODO: type model description here. Attributes: certificate (Certificate): TODO: type description here. name (string): TODO: type description here. date_of_birth (datetime): TODO: type description here. pid (string): TODO: type description here. ssn (str... | the_stack_v2_python_sparse | idfy_rest_client/models/sdo_signers.py | dealflowteam/Idfy | train | 0 |
876d1d26635d85f2f94a706ea78757ce80e3824d | [
"if 'odd' == 'odd':\n arrayextension = 5\nelse:\n arrayextension = 0\narraylength = 96 + arrayextension\nMaxVal = 255\nMinVal = 0\nself.gentest = bytearray([MaxVal // 2] * arraylength)",
"with self.assertRaises(TypeError):\n result = bytesfunc.bmin(1, nosimd=True)\nwith self.assertRaises(TypeError):\n ... | <|body_start_0|>
if 'odd' == 'odd':
arrayextension = 5
else:
arrayextension = 0
arraylength = 96 + arrayextension
MaxVal = 255
MinVal = 0
self.gentest = bytearray([MaxVal // 2] * arraylength)
<|end_body_0|>
<|body_start_1|>
with self.asser... | Test bmin for basic parameter tests. op_template_params | bmin_parameter_odd_arraysize_without_simd_bytearray | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class bmin_parameter_odd_arraysize_without_simd_bytearray:
"""Test bmin for basic parameter tests. op_template_params"""
def setUp(self):
"""Initialise."""
<|body_0|>
def test_bmin_param_function_01(self):
"""Test bmin - Sequence type bytearray. Test invalid parameter ... | stack_v2_sparse_classes_36k_train_008098 | 49,998 | permissive | [
{
"docstring": "Initialise.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Test bmin - Sequence type bytearray. Test invalid parameter type odd length array without SIMD.",
"name": "test_bmin_param_function_01",
"signature": "def test_bmin_param_function_01(self)"
... | 5 | stack_v2_sparse_classes_30k_train_015334 | Implement the Python class `bmin_parameter_odd_arraysize_without_simd_bytearray` described below.
Class description:
Test bmin for basic parameter tests. op_template_params
Method signatures and docstrings:
- def setUp(self): Initialise.
- def test_bmin_param_function_01(self): Test bmin - Sequence type bytearray. Te... | Implement the Python class `bmin_parameter_odd_arraysize_without_simd_bytearray` described below.
Class description:
Test bmin for basic parameter tests. op_template_params
Method signatures and docstrings:
- def setUp(self): Initialise.
- def test_bmin_param_function_01(self): Test bmin - Sequence type bytearray. Te... | 28fe0705fc59b0646a4d44e539c919173e8e8b99 | <|skeleton|>
class bmin_parameter_odd_arraysize_without_simd_bytearray:
"""Test bmin for basic parameter tests. op_template_params"""
def setUp(self):
"""Initialise."""
<|body_0|>
def test_bmin_param_function_01(self):
"""Test bmin - Sequence type bytearray. Test invalid parameter ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class bmin_parameter_odd_arraysize_without_simd_bytearray:
"""Test bmin for basic parameter tests. op_template_params"""
def setUp(self):
"""Initialise."""
if 'odd' == 'odd':
arrayextension = 5
else:
arrayextension = 0
arraylength = 96 + arrayextension
... | the_stack_v2_python_sparse | unittest/test_bmin.py | m1griffin/bytesfunc | train | 2 |
aecee5f9bae18ad0f128a71e540248490e5499d9 | [
"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. | AmericanBanksServicer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AmericanBanksServicer:
"""Missing associated documentation comment in .proto file."""
def table(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def get_all(self, request, context):
"""Missing associated documenta... | stack_v2_sparse_classes_36k_train_008099 | 11,544 | no_license | [
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "table",
"signature": "def table(self, request, context)"
},
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "get_all",
"signature": "def get_all(self, request, context)"... | 6 | stack_v2_sparse_classes_30k_train_018165 | Implement the Python class `AmericanBanksServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def table(self, request, context): Missing associated documentation comment in .proto file.
- def get_all(self, request, context): Missing... | Implement the Python class `AmericanBanksServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def table(self, request, context): Missing associated documentation comment in .proto file.
- def get_all(self, request, context): Missing... | 47d57bda959afa0b53d65e996b08e2f3b650c1a8 | <|skeleton|>
class AmericanBanksServicer:
"""Missing associated documentation comment in .proto file."""
def table(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def get_all(self, request, context):
"""Missing associated documenta... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AmericanBanksServicer:
"""Missing associated documentation comment in .proto file."""
def table(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
... | the_stack_v2_python_sparse | pix/bank_client/protos/american_banks_pb2_grpc.py | thecodeworkers/testing-clients | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.