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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2e275413053787a633f19bf3ead54ea946b1275c | [
"self.parent_view: Union[Subview, View] = parent_view\nself.base_view: View = self._get_base_view(parent_view)\nself.data: np.ndarray = parent_view.data[data_slice]\nself.array = kokkos.unmanaged_array(self.data, parent_view.dtype.value, parent_view.space.value)\nself.shape: List[int] = list(self.data.shape)\nself.... | <|body_start_0|>
self.parent_view: Union[Subview, View] = parent_view
self.base_view: View = self._get_base_view(parent_view)
self.data: np.ndarray = parent_view.data[data_slice]
self.array = kokkos.unmanaged_array(self.data, parent_view.dtype.value, parent_view.space.value)
self... | A Subview wraps the "data" member of a View (or Subview) and references a slice of that data. Subviews are passed to C++ as unmanaged views. This class contains the Python implementation of a subview. The user is not meant to call the constructor directly, instead they should slice the original View object. | Subview | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Subview:
"""A Subview wraps the "data" member of a View (or Subview) and references a slice of that data. Subviews are passed to C++ as unmanaged views. This class contains the Python implementation of a subview. The user is not meant to call the constructor directly, instead they should slice th... | stack_v2_sparse_classes_36k_train_010900 | 12,649 | no_license | [
{
"docstring": "Subview constructor. :param parent_view: the View or Subview that is meant to be sliced :param data_slice: the slice of the parent_view",
"name": "__init__",
"signature": "def __init__(self, parent_view: Union[Subview, View], data_slice: Union[slice, Tuple])"
},
{
"docstring": "T... | 3 | stack_v2_sparse_classes_30k_train_015054 | Implement the Python class `Subview` described below.
Class description:
A Subview wraps the "data" member of a View (or Subview) and references a slice of that data. Subviews are passed to C++ as unmanaged views. This class contains the Python implementation of a subview. The user is not meant to call the constructor... | Implement the Python class `Subview` described below.
Class description:
A Subview wraps the "data" member of a View (or Subview) and references a slice of that data. Subviews are passed to C++ as unmanaged views. This class contains the Python implementation of a subview. The user is not meant to call the constructor... | f4c96b66d25d03a5c12bb2aef993273647a6f463 | <|skeleton|>
class Subview:
"""A Subview wraps the "data" member of a View (or Subview) and references a slice of that data. Subviews are passed to C++ as unmanaged views. This class contains the Python implementation of a subview. The user is not meant to call the constructor directly, instead they should slice th... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Subview:
"""A Subview wraps the "data" member of a View (or Subview) and references a slice of that data. Subviews are passed to C++ as unmanaged views. This class contains the Python implementation of a subview. The user is not meant to call the constructor directly, instead they should slice the original Vi... | the_stack_v2_python_sparse | pykokkos/interface/views.py | yiorgb/pykokkos | train | 0 |
5b8478f0ac501bdf3f94f2e665ab5bb3fe3f8a04 | [
"self.length = k\nself.data = []\nfor num in nums:\n self.add(num)",
"if len(self.data) < self.length:\n heapq.heappush(self.data, val)\nelse:\n min_val = self.data[0]\n if val > min_val:\n heapq.heappop(self.data)\n heapq.heappush(self.data, val)\nreturn self.data[0]"
] | <|body_start_0|>
self.length = k
self.data = []
for num in nums:
self.add(num)
<|end_body_0|>
<|body_start_1|>
if len(self.data) < self.length:
heapq.heappush(self.data, val)
else:
min_val = self.data[0]
if val > min_val:
... | KthLargest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
<|body_0|>
def add(self, val):
""":type val: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.length = k
self.data = []
for num in ... | stack_v2_sparse_classes_36k_train_010901 | 840 | no_license | [
{
"docstring": ":type k: int :type nums: List[int]",
"name": "__init__",
"signature": "def __init__(self, k, nums)"
},
{
"docstring": ":type val: int :rtype: int",
"name": "add",
"signature": "def add(self, val)"
}
] | 2 | stack_v2_sparse_classes_30k_train_015264 | Implement the Python class `KthLargest` described below.
Class description:
Implement the KthLargest class.
Method signatures and docstrings:
- def __init__(self, k, nums): :type k: int :type nums: List[int]
- def add(self, val): :type val: int :rtype: int | Implement the Python class `KthLargest` described below.
Class description:
Implement the KthLargest class.
Method signatures and docstrings:
- def __init__(self, k, nums): :type k: int :type nums: List[int]
- def add(self, val): :type val: int :rtype: int
<|skeleton|>
class KthLargest:
def __init__(self, k, nu... | ca71572677d2b2a2aed94bb60d6ec88cc486a7f3 | <|skeleton|>
class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
<|body_0|>
def add(self, val):
""":type val: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
self.length = k
self.data = []
for num in nums:
self.add(num)
def add(self, val):
""":type val: int :rtype: int"""
if len(self.data) < self.length:
hea... | the_stack_v2_python_sparse | Leetcode/703.py | syzdemonhunter/Coding_Exercises | train | 1 | |
94c5e5d36fa96932bfe32d6337b7f0b143dd4cdf | [
"max_area = 0\nfor i in range(len(heights)):\n min_height = heights[i]\n for j in range(i, -1, -1):\n min_height = min(min_height, heights[j])\n area = min_height * (i - j + 1)\n if area > max_area:\n max_area = area\nreturn max_area",
"max_area = 0\nfor i in range(len(height... | <|body_start_0|>
max_area = 0
for i in range(len(heights)):
min_height = heights[i]
for j in range(i, -1, -1):
min_height = min(min_height, heights[j])
area = min_height * (i - j + 1)
if area > max_area:
max_area... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def largestRectangleArea1(self, heights):
"""暴力搜索: 对于每个矩形,从左往右遍历计算面积取最大值 时间复杂度 O(n^2) :type heights: List[int] :rtype: int"""
<|body_0|>
def largestRectangleArea2(self, heights):
"""优化暴力搜索: 对于每个矩形,从左往右遍历计算面积取最大值,对于右边比当前还大的,不需要遍历 只对合适的右边界(峰顶),往左遍历面积 时间复杂度 O(... | stack_v2_sparse_classes_36k_train_010902 | 2,519 | no_license | [
{
"docstring": "暴力搜索: 对于每个矩形,从左往右遍历计算面积取最大值 时间复杂度 O(n^2) :type heights: List[int] :rtype: int",
"name": "largestRectangleArea1",
"signature": "def largestRectangleArea1(self, heights)"
},
{
"docstring": "优化暴力搜索: 对于每个矩形,从左往右遍历计算面积取最大值,对于右边比当前还大的,不需要遍历 只对合适的右边界(峰顶),往左遍历面积 时间复杂度 O(n^2) :type height... | 3 | stack_v2_sparse_classes_30k_train_003416 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def largestRectangleArea1(self, heights): 暴力搜索: 对于每个矩形,从左往右遍历计算面积取最大值 时间复杂度 O(n^2) :type heights: List[int] :rtype: int
- def largestRectangleArea2(self, heights): 优化暴力搜索: 对于每个矩形... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def largestRectangleArea1(self, heights): 暴力搜索: 对于每个矩形,从左往右遍历计算面积取最大值 时间复杂度 O(n^2) :type heights: List[int] :rtype: int
- def largestRectangleArea2(self, heights): 优化暴力搜索: 对于每个矩形... | 852fad258f5070c7b93c35252f7404e85e709ea6 | <|skeleton|>
class Solution:
def largestRectangleArea1(self, heights):
"""暴力搜索: 对于每个矩形,从左往右遍历计算面积取最大值 时间复杂度 O(n^2) :type heights: List[int] :rtype: int"""
<|body_0|>
def largestRectangleArea2(self, heights):
"""优化暴力搜索: 对于每个矩形,从左往右遍历计算面积取最大值,对于右边比当前还大的,不需要遍历 只对合适的右边界(峰顶),往左遍历面积 时间复杂度 O(... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def largestRectangleArea1(self, heights):
"""暴力搜索: 对于每个矩形,从左往右遍历计算面积取最大值 时间复杂度 O(n^2) :type heights: List[int] :rtype: int"""
max_area = 0
for i in range(len(heights)):
min_height = heights[i]
for j in range(i, -1, -1):
min_height = min... | the_stack_v2_python_sparse | 1-100/84. Largest Rectangle in Histogram.py | SunnyMarkLiu/LeetCode | train | 1 | |
b09f5b6ac8541bdbcf6f101213fc90d4c782f7b1 | [
"self.root = rootnode\nself.disable = 0\nself.emittedNoHandlerWarning = 0\nself.loggerDict = {}",
"rv = None\nif name in self.loggerDict:\n rv = self.loggerDict[name]\n if isinstance(rv, PlaceHolder):\n ph = rv\n rv = Logger(name)\n rv.manager = self\n self.loggerDict[name] = rv\... | <|body_start_0|>
self.root = rootnode
self.disable = 0
self.emittedNoHandlerWarning = 0
self.loggerDict = {}
<|end_body_0|>
<|body_start_1|>
rv = None
if name in self.loggerDict:
rv = self.loggerDict[name]
if isinstance(rv, PlaceHolder):
... | Manager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Manager:
def __init__(self, rootnode):
"""Initialize the manager with the root node of the logger hierarchy."""
<|body_0|>
def getLogger(self, name):
"""Get a logger with the specified name (channel name), creating it if it doesn't yet exist. This name is a dot-separ... | stack_v2_sparse_classes_36k_train_010903 | 9,892 | no_license | [
{
"docstring": "Initialize the manager with the root node of the logger hierarchy.",
"name": "__init__",
"signature": "def __init__(self, rootnode)"
},
{
"docstring": "Get a logger with the specified name (channel name), creating it if it doesn't yet exist. This name is a dot-separated hierarchi... | 4 | stack_v2_sparse_classes_30k_test_000689 | Implement the Python class `Manager` described below.
Class description:
Implement the Manager class.
Method signatures and docstrings:
- def __init__(self, rootnode): Initialize the manager with the root node of the logger hierarchy.
- def getLogger(self, name): Get a logger with the specified name (channel name), c... | Implement the Python class `Manager` described below.
Class description:
Implement the Manager class.
Method signatures and docstrings:
- def __init__(self, rootnode): Initialize the manager with the root node of the logger hierarchy.
- def getLogger(self, name): Get a logger with the specified name (channel name), c... | 0d4f142e72238c7919e665f071536990d820c7c3 | <|skeleton|>
class Manager:
def __init__(self, rootnode):
"""Initialize the manager with the root node of the logger hierarchy."""
<|body_0|>
def getLogger(self, name):
"""Get a logger with the specified name (channel name), creating it if it doesn't yet exist. This name is a dot-separ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Manager:
def __init__(self, rootnode):
"""Initialize the manager with the root node of the logger hierarchy."""
self.root = rootnode
self.disable = 0
self.emittedNoHandlerWarning = 0
self.loggerDict = {}
def getLogger(self, name):
"""Get a logger with the s... | the_stack_v2_python_sparse | OOP-pattern/behavior.py | huxt2014/python-examples | train | 0 | |
9d0f70910315893647676aa2ba88d8e3fe8a5d89 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn TeamsAppDefinition()",
"from .entity import Entity\nfrom .identity_set import IdentitySet\nfrom .teams_app_authorization import TeamsAppAuthorization\nfrom .teams_app_publishing_state import TeamsAppPublishingState\nfrom .teamwork_bot ... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return TeamsAppDefinition()
<|end_body_0|>
<|body_start_1|>
from .entity import Entity
from .identity_set import IdentitySet
from .teams_app_authorization import TeamsAppAuthorization
... | TeamsAppDefinition | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TeamsAppDefinition:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TeamsAppDefinition:
"""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 obje... | stack_v2_sparse_classes_36k_train_010904 | 5,407 | 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: TeamsAppDefinition",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_... | 3 | stack_v2_sparse_classes_30k_train_007972 | Implement the Python class `TeamsAppDefinition` described below.
Class description:
Implement the TeamsAppDefinition class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TeamsAppDefinition: Creates a new instance of the appropriate class based on disc... | Implement the Python class `TeamsAppDefinition` described below.
Class description:
Implement the TeamsAppDefinition class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TeamsAppDefinition: Creates a new instance of the appropriate class based on disc... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class TeamsAppDefinition:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TeamsAppDefinition:
"""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 obje... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TeamsAppDefinition:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TeamsAppDefinition:
"""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: Te... | the_stack_v2_python_sparse | msgraph/generated/models/teams_app_definition.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
919a3cd74aa220e6f25a708c95e3cbe0304b537e | [
"arr = []\nans = 0\nfor i in range(len(A)):\n if A[i] == 1:\n arr.append(i)\nif len(arr) < S:\n return 0\n\ndef helper(i):\n return (1 + i) * i // 2\nif S == 0:\n if not arr:\n return helper(len(A))\n ans += helper(arr[0])\n for i in range(1, len(arr)):\n ans += helper(arr[i] ... | <|body_start_0|>
arr = []
ans = 0
for i in range(len(A)):
if A[i] == 1:
arr.append(i)
if len(arr) < S:
return 0
def helper(i):
return (1 + i) * i // 2
if S == 0:
if not arr:
return helper(len... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def numSubarraysWithSum(self, A, S):
""":type A: List[int] :type S: int :rtype: int 100100"""
<|body_0|>
def numSubarraysWithSum2(self, A, S):
""":type A: List[int] :type S: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
a... | stack_v2_sparse_classes_36k_train_010905 | 1,770 | no_license | [
{
"docstring": ":type A: List[int] :type S: int :rtype: int 100100",
"name": "numSubarraysWithSum",
"signature": "def numSubarraysWithSum(self, A, S)"
},
{
"docstring": ":type A: List[int] :type S: int :rtype: int",
"name": "numSubarraysWithSum2",
"signature": "def numSubarraysWithSum2(s... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numSubarraysWithSum(self, A, S): :type A: List[int] :type S: int :rtype: int 100100
- def numSubarraysWithSum2(self, A, S): :type A: List[int] :type S: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numSubarraysWithSum(self, A, S): :type A: List[int] :type S: int :rtype: int 100100
- def numSubarraysWithSum2(self, A, S): :type A: List[int] :type S: int :rtype: int
<|ske... | 85128e7d26157b3c36eb43868269de42ea2fcb98 | <|skeleton|>
class Solution:
def numSubarraysWithSum(self, A, S):
""":type A: List[int] :type S: int :rtype: int 100100"""
<|body_0|>
def numSubarraysWithSum2(self, A, S):
""":type A: List[int] :type S: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def numSubarraysWithSum(self, A, S):
""":type A: List[int] :type S: int :rtype: int 100100"""
arr = []
ans = 0
for i in range(len(A)):
if A[i] == 1:
arr.append(i)
if len(arr) < S:
return 0
def helper(i):
... | the_stack_v2_python_sparse | src/Binary Subarrays With Sum.py | jsdiuf/leetcode | train | 1 | |
704f59c75802644e80f29a34cc802267e9c3f88c | [
"if last == 0:\n if not s:\n self.ret.add(ans[1:])\nelif s and len(s) >= last:\n if s[0] == '0':\n self.buffer(s[1:], last - 1, ans + '.0')\n else:\n for i in range(1, 4):\n if int(s[:i]) < 256:\n self.buffer(s[i:], last - 1, ans + '.' + s[:i])",
"self.ret =... | <|body_start_0|>
if last == 0:
if not s:
self.ret.add(ans[1:])
elif s and len(s) >= last:
if s[0] == '0':
self.buffer(s[1:], last - 1, ans + '.0')
else:
for i in range(1, 4):
if int(s[:i]) < 256:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def buffer(self, s, last, ans):
""":type s: str :type last:int :type ans: str :rtype"""
<|body_0|>
def restoreIpAddresses(self, s):
""":type s: str :rtype: List[str]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if last == 0:
... | stack_v2_sparse_classes_36k_train_010906 | 1,197 | no_license | [
{
"docstring": ":type s: str :type last:int :type ans: str :rtype",
"name": "buffer",
"signature": "def buffer(self, s, last, ans)"
},
{
"docstring": ":type s: str :rtype: List[str]",
"name": "restoreIpAddresses",
"signature": "def restoreIpAddresses(self, s)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def buffer(self, s, last, ans): :type s: str :type last:int :type ans: str :rtype
- def restoreIpAddresses(self, s): :type s: str :rtype: List[str] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def buffer(self, s, last, ans): :type s: str :type last:int :type ans: str :rtype
- def restoreIpAddresses(self, s): :type s: str :rtype: List[str]
<|skeleton|>
class Solution:
... | 70bdd75b6af2e1811c1beab22050c01d28d7373e | <|skeleton|>
class Solution:
def buffer(self, s, last, ans):
""":type s: str :type last:int :type ans: str :rtype"""
<|body_0|>
def restoreIpAddresses(self, s):
""":type s: str :rtype: List[str]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def buffer(self, s, last, ans):
""":type s: str :type last:int :type ans: str :rtype"""
if last == 0:
if not s:
self.ret.add(ans[1:])
elif s and len(s) >= last:
if s[0] == '0':
self.buffer(s[1:], last - 1, ans + '.0')
... | the_stack_v2_python_sparse | python/leetcode/93_Restore_IP_Addresses.py | bobcaoge/my-code | train | 0 | |
1afe15ba0c3e8a7c41a271f36d286b1c433e55cf | [
"self.n = len(nums)\nself.dp = defaultdict(int)\n\ndef construct(i, j):\n if i > j:\n return\n if i == j:\n self.dp[i, j] = nums[i]\n return\n mid = i + (j - i) / 2\n construct(i, mid)\n construct(mid + 1, j)\n self.dp[i, j] = self.dp[i, mid] + self.dp[mid + 1, j]\nconstruct(0... | <|body_start_0|>
self.n = len(nums)
self.dp = defaultdict(int)
def construct(i, j):
if i > j:
return
if i == j:
self.dp[i, j] = nums[i]
return
mid = i + (j - i) / 2
construct(i, mid)
cons... | NumArray | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NumArray:
def __init__(self, nums):
""":type nums: List[int]"""
<|body_0|>
def update(self, i, val):
""":type i: int :type val: int :rtype: void"""
<|body_1|>
def sumRange(self, i, j):
""":type i: int :type j: int :rtype: int"""
<|body_2|... | stack_v2_sparse_classes_36k_train_010907 | 1,742 | no_license | [
{
"docstring": ":type nums: List[int]",
"name": "__init__",
"signature": "def __init__(self, nums)"
},
{
"docstring": ":type i: int :type val: int :rtype: void",
"name": "update",
"signature": "def update(self, i, val)"
},
{
"docstring": ":type i: int :type j: int :rtype: int",
... | 3 | null | Implement the Python class `NumArray` described below.
Class description:
Implement the NumArray class.
Method signatures and docstrings:
- def __init__(self, nums): :type nums: List[int]
- def update(self, i, val): :type i: int :type val: int :rtype: void
- def sumRange(self, i, j): :type i: int :type j: int :rtype:... | Implement the Python class `NumArray` described below.
Class description:
Implement the NumArray class.
Method signatures and docstrings:
- def __init__(self, nums): :type nums: List[int]
- def update(self, i, val): :type i: int :type val: int :rtype: void
- def sumRange(self, i, j): :type i: int :type j: int :rtype:... | 7c443f85217ab96ceac717ece7fc472271e1d3ab | <|skeleton|>
class NumArray:
def __init__(self, nums):
""":type nums: List[int]"""
<|body_0|>
def update(self, i, val):
""":type i: int :type val: int :rtype: void"""
<|body_1|>
def sumRange(self, i, j):
""":type i: int :type j: int :rtype: int"""
<|body_2|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NumArray:
def __init__(self, nums):
""":type nums: List[int]"""
self.n = len(nums)
self.dp = defaultdict(int)
def construct(i, j):
if i > j:
return
if i == j:
self.dp[i, j] = nums[i]
return
mid... | the_stack_v2_python_sparse | zemiao/307.py | Zichuanyun/go-shuati | train | 9 | |
e3280eafe34f4376ec79dd91c230aeb9a3f54539 | [
"super(CampaignFormTests, self).setUp()\nself.office = Office.objects.first()\nself.party = PoliticalParty.objects.first()",
"data = {'name': 'Sprout for POTUS', 'is_active': True, 'is_electoral': True, 'election_date': date.today(), 'office': self.office.pk, 'district': None, 'party': self.party.pk, 'phone_numbe... | <|body_start_0|>
super(CampaignFormTests, self).setUp()
self.office = Office.objects.first()
self.party = PoliticalParty.objects.first()
<|end_body_0|>
<|body_start_1|>
data = {'name': 'Sprout for POTUS', 'is_active': True, 'is_electoral': True, 'election_date': date.today(), 'office': ... | Tests for the campaign.forms.CampaignForm. | CampaignFormTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CampaignFormTests:
"""Tests for the campaign.forms.CampaignForm."""
def setUp(self):
"""Store one Office instance and one PoliticalParty instance."""
<|body_0|>
def testIsElectoralInterlocks(self):
"""If is_electoral is True, the election_date field cannot be bla... | stack_v2_sparse_classes_36k_train_010908 | 9,818 | no_license | [
{
"docstring": "Store one Office instance and one PoliticalParty instance.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "If is_electoral is True, the election_date field cannot be blank. 'office' can be blank to indicate 'other'.",
"name": "testIsElectoralInterlocks",
... | 2 | stack_v2_sparse_classes_30k_train_003506 | Implement the Python class `CampaignFormTests` described below.
Class description:
Tests for the campaign.forms.CampaignForm.
Method signatures and docstrings:
- def setUp(self): Store one Office instance and one PoliticalParty instance.
- def testIsElectoralInterlocks(self): If is_electoral is True, the election_dat... | Implement the Python class `CampaignFormTests` described below.
Class description:
Tests for the campaign.forms.CampaignForm.
Method signatures and docstrings:
- def setUp(self): Store one Office instance and one PoliticalParty instance.
- def testIsElectoralInterlocks(self): If is_electoral is True, the election_dat... | 18583f88f396b600e73f24dc16d2c24a89c8f924 | <|skeleton|>
class CampaignFormTests:
"""Tests for the campaign.forms.CampaignForm."""
def setUp(self):
"""Store one Office instance and one PoliticalParty instance."""
<|body_0|>
def testIsElectoralInterlocks(self):
"""If is_electoral is True, the election_date field cannot be bla... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CampaignFormTests:
"""Tests for the campaign.forms.CampaignForm."""
def setUp(self):
"""Store one Office instance and one PoliticalParty instance."""
super(CampaignFormTests, self).setUp()
self.office = Office.objects.first()
self.party = PoliticalParty.objects.first()
... | the_stack_v2_python_sparse | campaign/tests.py | kalbfled/Turnkey-Campaign-Solutions | train | 4 |
11e6fe728794e8cb4910e5c8b8e0a769d5ee1951 | [
"transform = self.transform\nif transform.a < 0 or transform.e > 0:\n raise NotImplementedError\nx_min = transform.xoff\nx_max = x_min + self.cols * self.resolution\ny_max = transform.yoff\ny_min = y_max - self.rows * self.resolution\nx_range, y_range = rasterio.transform.xy(self.transform, [0, self.rows - 1], [... | <|body_start_0|>
transform = self.transform
if transform.a < 0 or transform.e > 0:
raise NotImplementedError
x_min = transform.xoff
x_max = x_min + self.cols * self.resolution
y_max = transform.yoff
y_min = y_max - self.rows * self.resolution
x_range, ... | Container for storing model grid related variables. | ModelGrid | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModelGrid:
"""Container for storing model grid related variables."""
def prepare_coordinates(self):
"""Prepare a range of variables related to the grid coordinates: - xs, ys: 1d-arrays containing the x and y coordinates in the grid CRS. - X, Y, 2d-arrays containing the x and y coordi... | stack_v2_sparse_classes_36k_train_010909 | 6,138 | permissive | [
{
"docstring": "Prepare a range of variables related to the grid coordinates: - xs, ys: 1d-arrays containing the x and y coordinates in the grid CRS. - X, Y, 2d-arrays containing the x and y coordinates for each grid point. - all_points: (N, 2)-array containing (x, y) coordinates of all grid points. - roi_point... | 2 | stack_v2_sparse_classes_30k_train_008034 | Implement the Python class `ModelGrid` described below.
Class description:
Container for storing model grid related variables.
Method signatures and docstrings:
- def prepare_coordinates(self): Prepare a range of variables related to the grid coordinates: - xs, ys: 1d-arrays containing the x and y coordinates in the ... | Implement the Python class `ModelGrid` described below.
Class description:
Container for storing model grid related variables.
Method signatures and docstrings:
- def prepare_coordinates(self): Prepare a range of variables related to the grid coordinates: - xs, ys: 1d-arrays containing the x and y coordinates in the ... | c124c289f609cc5ab7751b3cbc8d14e52594ee1d | <|skeleton|>
class ModelGrid:
"""Container for storing model grid related variables."""
def prepare_coordinates(self):
"""Prepare a range of variables related to the grid coordinates: - xs, ys: 1d-arrays containing the x and y coordinates in the grid CRS. - X, Y, 2d-arrays containing the x and y coordi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ModelGrid:
"""Container for storing model grid related variables."""
def prepare_coordinates(self):
"""Prepare a range of variables related to the grid coordinates: - xs, ys: 1d-arrays containing the x and y coordinates in the grid CRS. - X, Y, 2d-arrays containing the x and y coordinates for eac... | the_stack_v2_python_sparse | openamundsen/util.py | ripertio/openamundsen | train | 0 |
c122d5f9933eb92bbca53d85f538f5d5c5ebb8f8 | [
"oq = self.oqparam\nif oq.insured_losses:\n raise ValueError('insured_losses are not supported for classical_risk')\nif 'hazard_curves' in oq.inputs:\n haz_sitecol = readinput.get_site_collection(oq)\n self.datastore['poes/grp-00'] = readinput.pmap\n self.save_params()\n self.read_exposure(haz_siteco... | <|body_start_0|>
oq = self.oqparam
if oq.insured_losses:
raise ValueError('insured_losses are not supported for classical_risk')
if 'hazard_curves' in oq.inputs:
haz_sitecol = readinput.get_site_collection(oq)
self.datastore['poes/grp-00'] = readinput.pmap
... | Classical Risk calculator | ClassicalRiskCalculator | [
"BSD-3-Clause",
"AGPL-3.0-only"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClassicalRiskCalculator:
"""Classical Risk calculator"""
def pre_execute(self):
"""Associate the assets to the sites and build the riskinputs."""
<|body_0|>
def post_execute(self, result):
"""Saving loss curves in the datastore. :param result: aggregated result o... | stack_v2_sparse_classes_36k_train_010910 | 6,965 | permissive | [
{
"docstring": "Associate the assets to the sites and build the riskinputs.",
"name": "pre_execute",
"signature": "def pre_execute(self)"
},
{
"docstring": "Saving loss curves in the datastore. :param result: aggregated result of the task classical_risk",
"name": "post_execute",
"signatu... | 2 | null | Implement the Python class `ClassicalRiskCalculator` described below.
Class description:
Classical Risk calculator
Method signatures and docstrings:
- def pre_execute(self): Associate the assets to the sites and build the riskinputs.
- def post_execute(self, result): Saving loss curves in the datastore. :param result... | Implement the Python class `ClassicalRiskCalculator` described below.
Class description:
Classical Risk calculator
Method signatures and docstrings:
- def pre_execute(self): Associate the assets to the sites and build the riskinputs.
- def post_execute(self, result): Saving loss curves in the datastore. :param result... | 0da9ba5a575360081715e8b90c71d4b16c6687c8 | <|skeleton|>
class ClassicalRiskCalculator:
"""Classical Risk calculator"""
def pre_execute(self):
"""Associate the assets to the sites and build the riskinputs."""
<|body_0|>
def post_execute(self, result):
"""Saving loss curves in the datastore. :param result: aggregated result o... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ClassicalRiskCalculator:
"""Classical Risk calculator"""
def pre_execute(self):
"""Associate the assets to the sites and build the riskinputs."""
oq = self.oqparam
if oq.insured_losses:
raise ValueError('insured_losses are not supported for classical_risk')
if ... | the_stack_v2_python_sparse | openquake/calculators/classical_risk.py | GFZ-Centre-for-Early-Warning/shakyground | train | 1 |
57de9a46dfbf33b117c2dfbb534a5020e019d520 | [
"ret = [0]\nfor i in range(1, len(pattern)):\n j = ret[i - 1]\n while j > 0 and pattern[j] != pattern[i]:\n j = ret[j - 1]\n ret.append(j + 1 if pattern[j] == pattern[i] else j)\nreturn ret",
"partial, j = (self.partial(P), 0)\nfor i in range(len(T)):\n while j > 0 and T[i] != P[j]:\n j ... | <|body_start_0|>
ret = [0]
for i in range(1, len(pattern)):
j = ret[i - 1]
while j > 0 and pattern[j] != pattern[i]:
j = ret[j - 1]
ret.append(j + 1 if pattern[j] == pattern[i] else j)
return ret
<|end_body_0|>
<|body_start_1|>
partial... | KMP | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KMP:
def partial(self, pattern):
"""Calculate partial match table: String -> [Int]"""
<|body_0|>
def search(self, T, P):
"""KMP search main algorithm: String -> String -> [Int] Return all the matching position of pattern string P in T"""
<|body_1|>
<|end_ske... | stack_v2_sparse_classes_36k_train_010911 | 45,905 | no_license | [
{
"docstring": "Calculate partial match table: String -> [Int]",
"name": "partial",
"signature": "def partial(self, pattern)"
},
{
"docstring": "KMP search main algorithm: String -> String -> [Int] Return all the matching position of pattern string P in T",
"name": "search",
"signature":... | 2 | stack_v2_sparse_classes_30k_train_016130 | Implement the Python class `KMP` described below.
Class description:
Implement the KMP class.
Method signatures and docstrings:
- def partial(self, pattern): Calculate partial match table: String -> [Int]
- def search(self, T, P): KMP search main algorithm: String -> String -> [Int] Return all the matching position o... | Implement the Python class `KMP` described below.
Class description:
Implement the KMP class.
Method signatures and docstrings:
- def partial(self, pattern): Calculate partial match table: String -> [Int]
- def search(self, T, P): KMP search main algorithm: String -> String -> [Int] Return all the matching position o... | 7e9f47e1dc7c79802ad7ff692514f1314815515a | <|skeleton|>
class KMP:
def partial(self, pattern):
"""Calculate partial match table: String -> [Int]"""
<|body_0|>
def search(self, T, P):
"""KMP search main algorithm: String -> String -> [Int] Return all the matching position of pattern string P in T"""
<|body_1|>
<|end_ske... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class KMP:
def partial(self, pattern):
"""Calculate partial match table: String -> [Int]"""
ret = [0]
for i in range(1, len(pattern)):
j = ret[i - 1]
while j > 0 and pattern[j] != pattern[i]:
j = ret[j - 1]
ret.append(j + 1 if pattern[j] ==... | the_stack_v2_python_sparse | python/820. Short Encoding of Words.py | forrest0402/leetcode | train | 0 | |
b59fbdcefde1b5a3c4a255060a8be99d1b588fec | [
"url = 'https://zhxg.peoplus.cn/pull_api/get_employees_t_with_zone'\nheaders = {'Content-Type': 'application/json'}\ndata = {'data': {'lang': 'zh_CN'}}\ndata = json.dumps(data)\nresult = requests.post(url, data=data, headers=headers)\nreturn json.loads(result.text)",
"url = 'https://zhxg.peoplus.cn/pull_api/get_d... | <|body_start_0|>
url = 'https://zhxg.peoplus.cn/pull_api/get_employees_t_with_zone'
headers = {'Content-Type': 'application/json'}
data = {'data': {'lang': 'zh_CN'}}
data = json.dumps(data)
result = requests.post(url, data=data, headers=headers)
return json.loads(result.t... | 易路蓝图数据接口类 | HR | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HR:
"""易路蓝图数据接口类"""
def get_employees_t_with_zone(self):
"""人员信息接口"""
<|body_0|>
def get_departments_with_zone(self):
"""组织信息接口"""
<|body_1|>
def get_positions_with_zone(self):
"""岗位信息接口"""
<|body_2|>
<|end_skeleton|>
<|body_start_0... | stack_v2_sparse_classes_36k_train_010912 | 5,998 | no_license | [
{
"docstring": "人员信息接口",
"name": "get_employees_t_with_zone",
"signature": "def get_employees_t_with_zone(self)"
},
{
"docstring": "组织信息接口",
"name": "get_departments_with_zone",
"signature": "def get_departments_with_zone(self)"
},
{
"docstring": "岗位信息接口",
"name": "get_positi... | 3 | stack_v2_sparse_classes_30k_train_008959 | Implement the Python class `HR` described below.
Class description:
易路蓝图数据接口类
Method signatures and docstrings:
- def get_employees_t_with_zone(self): 人员信息接口
- def get_departments_with_zone(self): 组织信息接口
- def get_positions_with_zone(self): 岗位信息接口 | Implement the Python class `HR` described below.
Class description:
易路蓝图数据接口类
Method signatures and docstrings:
- def get_employees_t_with_zone(self): 人员信息接口
- def get_departments_with_zone(self): 组织信息接口
- def get_positions_with_zone(self): 岗位信息接口
<|skeleton|>
class HR:
"""易路蓝图数据接口类"""
def get_employees_t_w... | c2f34ad6c613ab91e67af196dd9a9ea1af82cd8b | <|skeleton|>
class HR:
"""易路蓝图数据接口类"""
def get_employees_t_with_zone(self):
"""人员信息接口"""
<|body_0|>
def get_departments_with_zone(self):
"""组织信息接口"""
<|body_1|>
def get_positions_with_zone(self):
"""岗位信息接口"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HR:
"""易路蓝图数据接口类"""
def get_employees_t_with_zone(self):
"""人员信息接口"""
url = 'https://zhxg.peoplus.cn/pull_api/get_employees_t_with_zone'
headers = {'Content-Type': 'application/json'}
data = {'data': {'lang': 'zh_CN'}}
data = json.dumps(data)
result = reque... | the_stack_v2_python_sparse | script/ehr_data.py | niuyb/cloudcc_api | train | 0 |
ae5dfa7fa6a0d7349d6ae29aeac819903facb48f | [
"rsa_ca_priv_file, rsa_priv_file, rsa_cert_file = range(3)\nap = APInfo(port_id=1, ip='2.2.2.2', mac='bb:bb:bb:bb:bb:bb', radio_mac='bb:bb:bb:bb:bb:00', udp_port=12345, wlc_ip='1.1.1.1', gateway_ip='1.1.1.2', ap_mode=APMode.LOCAL, rsa_ca_priv_file=rsa_ca_priv_file, rsa_priv_file=rsa_priv_file, rsa_cert_file=rsa_cer... | <|body_start_0|>
rsa_ca_priv_file, rsa_priv_file, rsa_cert_file = range(3)
ap = APInfo(port_id=1, ip='2.2.2.2', mac='bb:bb:bb:bb:bb:bb', radio_mac='bb:bb:bb:bb:bb:00', udp_port=12345, wlc_ip='1.1.1.1', gateway_ip='1.1.1.2', ap_mode=APMode.LOCAL, rsa_ca_priv_file=rsa_ca_priv_file, rsa_priv_file=rsa_priv_... | Tests methods for the APInfo class. | APInfoTest | [
"Apache-2.0",
"GPL-1.0-or-later",
"GPL-2.0-or-later",
"GPL-2.0-only"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class APInfoTest:
"""Tests methods for the APInfo class."""
def test_init_correct(self):
"""Test the __init__ method when parameters are correct."""
<|body_0|>
def test_init_no_mac(self):
"""Test the __init__ method when parameter 'mac' is None. Should raise an Attribu... | stack_v2_sparse_classes_36k_train_010913 | 4,398 | permissive | [
{
"docstring": "Test the __init__ method when parameters are correct.",
"name": "test_init_correct",
"signature": "def test_init_correct(self)"
},
{
"docstring": "Test the __init__ method when parameter 'mac' is None. Should raise an AttributeError.",
"name": "test_init_no_mac",
"signatu... | 4 | stack_v2_sparse_classes_30k_train_012944 | Implement the Python class `APInfoTest` described below.
Class description:
Tests methods for the APInfo class.
Method signatures and docstrings:
- def test_init_correct(self): Test the __init__ method when parameters are correct.
- def test_init_no_mac(self): Test the __init__ method when parameter 'mac' is None. Sh... | Implement the Python class `APInfoTest` described below.
Class description:
Tests methods for the APInfo class.
Method signatures and docstrings:
- def test_init_correct(self): Test the __init__ method when parameters are correct.
- def test_init_no_mac(self): Test the __init__ method when parameter 'mac' is None. Sh... | 3a6d63af1ff468f94887a091e3a408a8449cf832 | <|skeleton|>
class APInfoTest:
"""Tests methods for the APInfo class."""
def test_init_correct(self):
"""Test the __init__ method when parameters are correct."""
<|body_0|>
def test_init_no_mac(self):
"""Test the __init__ method when parameter 'mac' is None. Should raise an Attribu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class APInfoTest:
"""Tests methods for the APInfo class."""
def test_init_correct(self):
"""Test the __init__ method when parameters are correct."""
rsa_ca_priv_file, rsa_priv_file, rsa_cert_file = range(3)
ap = APInfo(port_id=1, ip='2.2.2.2', mac='bb:bb:bb:bb:bb:bb', radio_mac='bb:bb:b... | the_stack_v2_python_sparse | scripts/automation/trex_control_plane/interactive/trex/wireless/unit_tests/trex_wireless_manager_private_test.py | elados93/trex-core | train | 1 |
4dc8b4ffd74e7820e31c62b863b4d643876ba8f5 | [
"self.srcLang = NAME_YAPPN_MAPPINGS[sourceLang]\nself.srcLocale = sourceLocale if sourceLocale else re.sub('-', '_', CULTURE_CODES[sourceLang][0])\nself.tgtLocale = targetLocale if targetLocale else re.sub('-', '_', CULTURE_CODES[targetLang][0])\nself._fullmatch = fullmatch\nself.srcDecimalSymbol = numbers.get_deci... | <|body_start_0|>
self.srcLang = NAME_YAPPN_MAPPINGS[sourceLang]
self.srcLocale = sourceLocale if sourceLocale else re.sub('-', '_', CULTURE_CODES[sourceLang][0])
self.tgtLocale = targetLocale if targetLocale else re.sub('-', '_', CULTURE_CODES[targetLang][0])
self._fullmatch = fullmatch
... | Rule-based number translation | NumberTranslator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NumberTranslator:
"""Rule-based number translation"""
def __init__(self, sourceLang, targetLang, sourceLocale, targetLocale, fullmatch=False):
"""Initialize a NumberTranslator instance Args: sourceLang (str): source language in full spelling, e.g., 'English' ignored if sourceLocale i... | stack_v2_sparse_classes_36k_train_010914 | 21,856 | no_license | [
{
"docstring": "Initialize a NumberTranslator instance Args: sourceLang (str): source language in full spelling, e.g., 'English' ignored if sourceLocale is provided sourceLocale (str): source locale identifier targetLang (str): target language in full spelling, e.g., 'French' ignored if targetLocale is provided... | 3 | stack_v2_sparse_classes_30k_train_015568 | Implement the Python class `NumberTranslator` described below.
Class description:
Rule-based number translation
Method signatures and docstrings:
- def __init__(self, sourceLang, targetLang, sourceLocale, targetLocale, fullmatch=False): Initialize a NumberTranslator instance Args: sourceLang (str): source language in... | Implement the Python class `NumberTranslator` described below.
Class description:
Rule-based number translation
Method signatures and docstrings:
- def __init__(self, sourceLang, targetLang, sourceLocale, targetLocale, fullmatch=False): Initialize a NumberTranslator instance Args: sourceLang (str): source language in... | 3db60d54f076ea26d45cdbbe194d1cd357f8f1a3 | <|skeleton|>
class NumberTranslator:
"""Rule-based number translation"""
def __init__(self, sourceLang, targetLang, sourceLocale, targetLocale, fullmatch=False):
"""Initialize a NumberTranslator instance Args: sourceLang (str): source language in full spelling, e.g., 'English' ignored if sourceLocale i... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NumberTranslator:
"""Rule-based number translation"""
def __init__(self, sourceLang, targetLang, sourceLocale, targetLocale, fullmatch=False):
"""Initialize a NumberTranslator instance Args: sourceLang (str): source language in full spelling, e.g., 'English' ignored if sourceLocale is provided so... | the_stack_v2_python_sparse | tb_utils/rules.py | EthannyDing/text_mining | train | 0 |
56ba4a33a842cfedb21b752c31b4dfaeeca1e292 | [
"super(DeclarativeNameError, self).__init__(name)\nself.name = name\nself.filename = filename\nself.lineno = lineno\nself.block = block",
"text = '%s\\n\\n' % self.name\ntext += _format_source_error(self.filename, self.lineno, self.block)\ntext += \"\\n\\nNameError: global name '%s' is not defined\" % self.name\n... | <|body_start_0|>
super(DeclarativeNameError, self).__init__(name)
self.name = name
self.filename = filename
self.lineno = lineno
self.block = block
<|end_body_0|>
<|body_start_1|>
text = '%s\n\n' % self.name
text += _format_source_error(self.filename, self.lineno... | A NameError subclass which nicely formats the exception. This class is intended for used by Declarative and its subclasses to report errors for failed global lookups when building out the object tree. | DeclarativeNameError | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DeclarativeNameError:
"""A NameError subclass which nicely formats the exception. This class is intended for used by Declarative and its subclasses to report errors for failed global lookups when building out the object tree."""
def __init__(self, name, filename, lineno, block):
"""I... | stack_v2_sparse_classes_36k_train_010915 | 4,784 | permissive | [
{
"docstring": "Initialize a DeclarativeNameError. Parameters ---------- name : str The name of global symbol which was not found. filename : str The filename where the lookup failed. lineno : int The line number of the error. block : str The name of the lexical block in which the lookup failed.",
"name": "... | 2 | stack_v2_sparse_classes_30k_train_011284 | Implement the Python class `DeclarativeNameError` described below.
Class description:
A NameError subclass which nicely formats the exception. This class is intended for used by Declarative and its subclasses to report errors for failed global lookups when building out the object tree.
Method signatures and docstring... | Implement the Python class `DeclarativeNameError` described below.
Class description:
A NameError subclass which nicely formats the exception. This class is intended for used by Declarative and its subclasses to report errors for failed global lookups when building out the object tree.
Method signatures and docstring... | 424bba29219de58fe9e47196de6763de8b2009f2 | <|skeleton|>
class DeclarativeNameError:
"""A NameError subclass which nicely formats the exception. This class is intended for used by Declarative and its subclasses to report errors for failed global lookups when building out the object tree."""
def __init__(self, name, filename, lineno, block):
"""I... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DeclarativeNameError:
"""A NameError subclass which nicely formats the exception. This class is intended for used by Declarative and its subclasses to report errors for failed global lookups when building out the object tree."""
def __init__(self, name, filename, lineno, block):
"""Initialize a D... | the_stack_v2_python_sparse | enaml/core/exceptions.py | enthought/enaml | train | 17 |
9c365802ea8c9fbfd3d46dc861325ebb9bc5d98b | [
"if self.context_object_name:\n return self.context_object_name\nmodel = self.get_model()\nreturn model.__name__.lower()",
"context = {}\nif self.object:\n context['object'] = self.object\n context_object_name = self.get_context_object_name(self.object)\n if context_object_name:\n context[conte... | <|body_start_0|>
if self.context_object_name:
return self.context_object_name
model = self.get_model()
return model.__name__.lower()
<|end_body_0|>
<|body_start_1|>
context = {}
if self.object:
context['object'] = self.object
context_object_na... | Provide the ability to retrieve a single object for further manipulation. | SingleObjectMixin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SingleObjectMixin:
"""Provide the ability to retrieve a single object for further manipulation."""
def get_context_object_name(self, obj):
"""Get the name to use for the object."""
<|body_0|>
def get_context_data(self, **kwargs):
"""Insert the single object into ... | stack_v2_sparse_classes_36k_train_010916 | 2,496 | permissive | [
{
"docstring": "Get the name to use for the object.",
"name": "get_context_object_name",
"signature": "def get_context_object_name(self, obj)"
},
{
"docstring": "Insert the single object into the context dict.",
"name": "get_context_data",
"signature": "def get_context_data(self, **kwarg... | 2 | stack_v2_sparse_classes_30k_train_002038 | Implement the Python class `SingleObjectMixin` described below.
Class description:
Provide the ability to retrieve a single object for further manipulation.
Method signatures and docstrings:
- def get_context_object_name(self, obj): Get the name to use for the object.
- def get_context_data(self, **kwargs): Insert th... | Implement the Python class `SingleObjectMixin` described below.
Class description:
Provide the ability to retrieve a single object for further manipulation.
Method signatures and docstrings:
- def get_context_object_name(self, obj): Get the name to use for the object.
- def get_context_data(self, **kwargs): Insert th... | 0ed1d0018bebabacf925215779d0c500cdce7282 | <|skeleton|>
class SingleObjectMixin:
"""Provide the ability to retrieve a single object for further manipulation."""
def get_context_object_name(self, obj):
"""Get the name to use for the object."""
<|body_0|>
def get_context_data(self, **kwargs):
"""Insert the single object into ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SingleObjectMixin:
"""Provide the ability to retrieve a single object for further manipulation."""
def get_context_object_name(self, obj):
"""Get the name to use for the object."""
if self.context_object_name:
return self.context_object_name
model = self.get_model()
... | the_stack_v2_python_sparse | django_sorcery/views/detail.py | shosca/django-sorcery | train | 81 |
876d1d26635d85f2f94a706ea78757ce80e3824d | [
"if 'even' == '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 'even' == '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.asse... | Test bmin for basic parameter tests. op_template_params | bmin_parameter_even_arraysize_without_simd_bytearray | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class bmin_parameter_even_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_010917 | 49,998 | permissive | [
{
"docstring": "Initialise.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Test bmin - Sequence type bytearray. Test invalid parameter type even 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_012264 | Implement the Python class `bmin_parameter_even_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. T... | Implement the Python class `bmin_parameter_even_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. T... | 28fe0705fc59b0646a4d44e539c919173e8e8b99 | <|skeleton|>
class bmin_parameter_even_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_even_arraysize_without_simd_bytearray:
"""Test bmin for basic parameter tests. op_template_params"""
def setUp(self):
"""Initialise."""
if 'even' == 'odd':
arrayextension = 5
else:
arrayextension = 0
arraylength = 96 + arrayextension
... | the_stack_v2_python_sparse | unittest/test_bmin.py | m1griffin/bytesfunc | train | 2 |
0838fe0644dbea49ad40052a6fd8d130db3c8c01 | [
"hashmap = db_api.get_instance()\ntry:\n group_db = hashmap.get_group_from_threshold(uuid=threshold_id)\n return group_models.Group(**group_db.export_model())\nexcept db_api.ThresholdHasNoGroup as e:\n pecan.abort(404, e.args[0])",
"hashmap = db_api.get_instance()\nthreshold_list = []\nsearch_opts = dict... | <|body_start_0|>
hashmap = db_api.get_instance()
try:
group_db = hashmap.get_group_from_threshold(uuid=threshold_id)
return group_models.Group(**group_db.export_model())
except db_api.ThresholdHasNoGroup as e:
pecan.abort(404, e.args[0])
<|end_body_0|>
<|body... | Controller responsible of thresholds management. | HashMapThresholdsController | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HashMapThresholdsController:
"""Controller responsible of thresholds management."""
def group(self, threshold_id):
"""Get the group attached to the threshold. :param threshold_id: UUID of the threshold to filter on."""
<|body_0|>
def get_all(self, service_id=None, field_... | stack_v2_sparse_classes_36k_train_010918 | 6,844 | permissive | [
{
"docstring": "Get the group attached to the threshold. :param threshold_id: UUID of the threshold to filter on.",
"name": "group",
"signature": "def group(self, threshold_id)"
},
{
"docstring": "Get the threshold list :param service_id: Service UUID to filter on. :param field_id: Field UUID to... | 6 | stack_v2_sparse_classes_30k_test_000217 | Implement the Python class `HashMapThresholdsController` described below.
Class description:
Controller responsible of thresholds management.
Method signatures and docstrings:
- def group(self, threshold_id): Get the group attached to the threshold. :param threshold_id: UUID of the threshold to filter on.
- def get_a... | Implement the Python class `HashMapThresholdsController` described below.
Class description:
Controller responsible of thresholds management.
Method signatures and docstrings:
- def group(self, threshold_id): Get the group attached to the threshold. :param threshold_id: UUID of the threshold to filter on.
- def get_a... | 94630b97cd1fb4bdd9a638070ffbbe3625de8aa2 | <|skeleton|>
class HashMapThresholdsController:
"""Controller responsible of thresholds management."""
def group(self, threshold_id):
"""Get the group attached to the threshold. :param threshold_id: UUID of the threshold to filter on."""
<|body_0|>
def get_all(self, service_id=None, field_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HashMapThresholdsController:
"""Controller responsible of thresholds management."""
def group(self, threshold_id):
"""Get the group attached to the threshold. :param threshold_id: UUID of the threshold to filter on."""
hashmap = db_api.get_instance()
try:
group_db = ha... | the_stack_v2_python_sparse | cloudkitty/rating/hash/controllers/threshold.py | openstack/cloudkitty | train | 103 |
4548e1c0fe6c628e7c36ab45d0f481c0217dda27 | [
"def pre_order(root):\n if not root:\n return []\n lefts = pre_order(root.left)\n rights = pre_order(root.right)\n return [root.val] + lefts + rights\ninorder = pre_order(root)\nreturn ' '.join((str(val) for val in inorder))",
"vals = [int(x) for x in data.split()]\n\ndef helper(vals):\n if ... | <|body_start_0|>
def pre_order(root):
if not root:
return []
lefts = pre_order(root.left)
rights = pre_order(root.right)
return [root.val] + lefts + rights
inorder = pre_order(root)
return ' '.join((str(val) for val in inorder))
<|e... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root: TreeNode) -> str:
"""Encodes a tree to a single string."""
<|body_0|>
def deserialize(self, data: str) -> TreeNode:
"""Decodes your encoded data to tree."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
def pre_order(... | stack_v2_sparse_classes_36k_train_010919 | 1,747 | no_license | [
{
"docstring": "Encodes a tree to a single string.",
"name": "serialize",
"signature": "def serialize(self, root: TreeNode) -> str"
},
{
"docstring": "Decodes your encoded data to tree.",
"name": "deserialize",
"signature": "def deserialize(self, data: str) -> TreeNode"
}
] | 2 | null | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string.
- def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string.
- def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree.
<|skeleton|>
class Co... | 3f5ad6164c147e7b51b7850dcd279150fa8a7600 | <|skeleton|>
class Codec:
def serialize(self, root: TreeNode) -> str:
"""Encodes a tree to a single string."""
<|body_0|>
def deserialize(self, data: str) -> TreeNode:
"""Decodes your encoded data to tree."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root: TreeNode) -> str:
"""Encodes a tree to a single string."""
def pre_order(root):
if not root:
return []
lefts = pre_order(root.left)
rights = pre_order(root.right)
return [root.val] + lefts + rights... | the_stack_v2_python_sparse | Round_1/449. Serialize and Deserialize BST/solution_1.py | buptwxd2/leetcode | train | 0 | |
9f4187c92f7bb91162f0f26b7aab242d6188eae4 | [
"self.outlook_mailbox_list = outlook_mailbox_list\nself.pst_params = pst_params\nself.target_folder_path = target_folder_path\nself.target_mailbox = target_mailbox",
"if dictionary is None:\n return None\noutlook_mailbox_list = None\nif dictionary.get('outlookMailboxList') != None:\n outlook_mailbox_list = ... | <|body_start_0|>
self.outlook_mailbox_list = outlook_mailbox_list
self.pst_params = pst_params
self.target_folder_path = target_folder_path
self.target_mailbox = target_mailbox
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
outlook_mailbox... | Implementation of the 'OutlookRestoreParameters' model. Specifies information needed for recovering Mailboxes in O365Outlook environment. Attributes: outlook_mailbox_list (list of OutlookMailbox): Specifies the list of mailboxes to be restored. pst_params (PstParameters): Specifies the PST conversion specific parameter... | OutlookRestoreParameters | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OutlookRestoreParameters:
"""Implementation of the 'OutlookRestoreParameters' model. Specifies information needed for recovering Mailboxes in O365Outlook environment. Attributes: outlook_mailbox_list (list of OutlookMailbox): Specifies the list of mailboxes to be restored. pst_params (PstParamete... | stack_v2_sparse_classes_36k_train_010920 | 3,440 | permissive | [
{
"docstring": "Constructor for the OutlookRestoreParameters class",
"name": "__init__",
"signature": "def __init__(self, outlook_mailbox_list=None, pst_params=None, target_folder_path=None, target_mailbox=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictio... | 2 | null | Implement the Python class `OutlookRestoreParameters` described below.
Class description:
Implementation of the 'OutlookRestoreParameters' model. Specifies information needed for recovering Mailboxes in O365Outlook environment. Attributes: outlook_mailbox_list (list of OutlookMailbox): Specifies the list of mailboxes ... | Implement the Python class `OutlookRestoreParameters` described below.
Class description:
Implementation of the 'OutlookRestoreParameters' model. Specifies information needed for recovering Mailboxes in O365Outlook environment. Attributes: outlook_mailbox_list (list of OutlookMailbox): Specifies the list of mailboxes ... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class OutlookRestoreParameters:
"""Implementation of the 'OutlookRestoreParameters' model. Specifies information needed for recovering Mailboxes in O365Outlook environment. Attributes: outlook_mailbox_list (list of OutlookMailbox): Specifies the list of mailboxes to be restored. pst_params (PstParamete... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OutlookRestoreParameters:
"""Implementation of the 'OutlookRestoreParameters' model. Specifies information needed for recovering Mailboxes in O365Outlook environment. Attributes: outlook_mailbox_list (list of OutlookMailbox): Specifies the list of mailboxes to be restored. pst_params (PstParameters): Specifie... | the_stack_v2_python_sparse | cohesity_management_sdk/models/outlook_restore_parameters.py | cohesity/management-sdk-python | train | 24 |
c897a6eb1bc88a63047e7afbc1a349e53973ec1d | [
"self.parent_can_read = Event()\nself.comm_queue = Queue()\nself.child_can_read = Event()\nself.x0 = x0.copy()\nself.f0 = f0.copy()\nif grad0 is not None:\n self.grad0 = grad0.copy()\nelse:\n self.grad0 = None\nif user_specs['localopt_method'] in ['LN_SBPLX', 'LN_BOBYQA', 'LN_COBYLA', 'LN_NEWUOA', 'LN_NELDERM... | <|body_start_0|>
self.parent_can_read = Event()
self.comm_queue = Queue()
self.child_can_read = Event()
self.x0 = x0.copy()
self.f0 = f0.copy()
if grad0 is not None:
self.grad0 = grad0.copy()
else:
self.grad0 = None
if user_specs['l... | This class defines the APOSMM interface to various local optimization routines. Currently supported routines are - NLopt routines ['LN_SBPLX', 'LN_BOBYQA', 'LN_COBYLA', 'LN_NEWUOA', 'LN_NELDERMEAD', 'LD_MMA'] - PETSc/TAO routines ['pounders', 'blmvm', 'nm'] - SciPy routines ['scipy_Nelder-Mead', 'scipy_COBYLA', 'scipy_... | LocalOptInterfacer | [
"BSD-3-Clause",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LocalOptInterfacer:
"""This class defines the APOSMM interface to various local optimization routines. Currently supported routines are - NLopt routines ['LN_SBPLX', 'LN_BOBYQA', 'LN_COBYLA', 'LN_NEWUOA', 'LN_NELDERMEAD', 'LD_MMA'] - PETSc/TAO routines ['pounders', 'blmvm', 'nm'] - SciPy routines... | stack_v2_sparse_classes_36k_train_010921 | 22,231 | permissive | [
{
"docstring": ":param x0: A numpy array of the initial guess solution. This guess should be scaled to a unit cube. :param f0: A numpy array of the initial function value. .. warning:: In order to have correct functioning of the local optimization child processes. ~self.iterate~ should be called immediately aft... | 4 | stack_v2_sparse_classes_30k_test_000082 | Implement the Python class `LocalOptInterfacer` described below.
Class description:
This class defines the APOSMM interface to various local optimization routines. Currently supported routines are - NLopt routines ['LN_SBPLX', 'LN_BOBYQA', 'LN_COBYLA', 'LN_NEWUOA', 'LN_NELDERMEAD', 'LD_MMA'] - PETSc/TAO routines ['pou... | Implement the Python class `LocalOptInterfacer` described below.
Class description:
This class defines the APOSMM interface to various local optimization routines. Currently supported routines are - NLopt routines ['LN_SBPLX', 'LN_BOBYQA', 'LN_COBYLA', 'LN_NEWUOA', 'LN_NELDERMEAD', 'LD_MMA'] - PETSc/TAO routines ['pou... | 0ffcc5f88f693ebf60ba125a7cae6a44d2c98c6f | <|skeleton|>
class LocalOptInterfacer:
"""This class defines the APOSMM interface to various local optimization routines. Currently supported routines are - NLopt routines ['LN_SBPLX', 'LN_BOBYQA', 'LN_COBYLA', 'LN_NEWUOA', 'LN_NELDERMEAD', 'LD_MMA'] - PETSc/TAO routines ['pounders', 'blmvm', 'nm'] - SciPy routines... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LocalOptInterfacer:
"""This class defines the APOSMM interface to various local optimization routines. Currently supported routines are - NLopt routines ['LN_SBPLX', 'LN_BOBYQA', 'LN_COBYLA', 'LN_NEWUOA', 'LN_NELDERMEAD', 'LD_MMA'] - PETSc/TAO routines ['pounders', 'blmvm', 'nm'] - SciPy routines ['scipy_Neld... | the_stack_v2_python_sparse | libensemble/gen_funcs/aposmm_localopt_support.py | Libensemble/libensemble | train | 69 |
33877387d239c5187c3c488966a988c31ad0b71a | [
"psi = np.sqrt(q ** 2 * (s ** 2 + x ** 2) + y ** 2)\nPhi = (psi + s) ** 2 + (1 - q ** 2) * x ** 2\nphi = q / (2 * s) * np.log(Phi) - q / s * np.log((1 + q) * s)\nreturn a * phi",
"psi = np.sqrt(q ** 2 * (s ** 2 + x ** 2) + y ** 2)\nPhi = (psi + s) ** 2 + (1 - q ** 2) * x ** 2\nf_x = q * x * (psi + q ** 2 * s) / (... | <|body_start_0|>
psi = np.sqrt(q ** 2 * (s ** 2 + x ** 2) + y ** 2)
Phi = (psi + s) ** 2 + (1 - q ** 2) * x ** 2
phi = q / (2 * s) * np.log(Phi) - q / s * np.log((1 + q) * s)
return a * phi
<|end_body_0|>
<|body_start_1|>
psi = np.sqrt(q ** 2 * (s ** 2 + x ** 2) + y ** 2)
... | Cored steep ellipsoid (CSE) along the major axis source: Keeton and Kochanek (1998) Oguri 2021: https://arxiv.org/pdf/2106.11464.pdf .. math:: \\kappa(u;s) = \\frac{A}{2(s^2 + \\xi^2)^{3/2}} with .. math:: \\xi(x, y) = \\sqrt{x^2 + \\frac{y^2}{q^2}} | CSEMajorAxis | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CSEMajorAxis:
"""Cored steep ellipsoid (CSE) along the major axis source: Keeton and Kochanek (1998) Oguri 2021: https://arxiv.org/pdf/2106.11464.pdf .. math:: \\kappa(u;s) = \\frac{A}{2(s^2 + \\xi^2)^{3/2}} with .. math:: \\xi(x, y) = \\sqrt{x^2 + \\frac{y^2}{q^2}}"""
def function(self, x, ... | stack_v2_sparse_classes_36k_train_010922 | 13,346 | permissive | [
{
"docstring": ":param x: coordinate in image plane (angle) :param y: coordinate in image plane (angle) :param a: lensing strength :param s: core radius :param q: axis ratio :return: lensing potential",
"name": "function",
"signature": "def function(self, x, y, a, s, q)"
},
{
"docstring": ":para... | 3 | null | Implement the Python class `CSEMajorAxis` described below.
Class description:
Cored steep ellipsoid (CSE) along the major axis source: Keeton and Kochanek (1998) Oguri 2021: https://arxiv.org/pdf/2106.11464.pdf .. math:: \\kappa(u;s) = \\frac{A}{2(s^2 + \\xi^2)^{3/2}} with .. math:: \\xi(x, y) = \\sqrt{x^2 + \\frac{y^... | Implement the Python class `CSEMajorAxis` described below.
Class description:
Cored steep ellipsoid (CSE) along the major axis source: Keeton and Kochanek (1998) Oguri 2021: https://arxiv.org/pdf/2106.11464.pdf .. math:: \\kappa(u;s) = \\frac{A}{2(s^2 + \\xi^2)^{3/2}} with .. math:: \\xi(x, y) = \\sqrt{x^2 + \\frac{y^... | 73c9645f26f6983fe7961104075ebe8bf7a4b54c | <|skeleton|>
class CSEMajorAxis:
"""Cored steep ellipsoid (CSE) along the major axis source: Keeton and Kochanek (1998) Oguri 2021: https://arxiv.org/pdf/2106.11464.pdf .. math:: \\kappa(u;s) = \\frac{A}{2(s^2 + \\xi^2)^{3/2}} with .. math:: \\xi(x, y) = \\sqrt{x^2 + \\frac{y^2}{q^2}}"""
def function(self, x, ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CSEMajorAxis:
"""Cored steep ellipsoid (CSE) along the major axis source: Keeton and Kochanek (1998) Oguri 2021: https://arxiv.org/pdf/2106.11464.pdf .. math:: \\kappa(u;s) = \\frac{A}{2(s^2 + \\xi^2)^{3/2}} with .. math:: \\xi(x, y) = \\sqrt{x^2 + \\frac{y^2}{q^2}}"""
def function(self, x, y, a, s, q):
... | the_stack_v2_python_sparse | lenstronomy/LensModel/Profiles/cored_steep_ellipsoid.py | lenstronomy/lenstronomy | train | 41 |
10f4e30ee07d0a9a9a3741e18f3ea963d89d1122 | [
"built = 0\nwall_offsets = []\nif above:\n wall_offsets.append([0, 1])\nif left:\n wall_offsets.append([-1, 0])\nif right:\n wall_offsets.append([1, 0])\nif not game_state.can_spawn(unit_enum_map['TURRET'], turret_location):\n return built\nfor wo in wall_offsets:\n if not game_state.can_spawn(unit_e... | <|body_start_0|>
built = 0
wall_offsets = []
if above:
wall_offsets.append([0, 1])
if left:
wall_offsets.append([-1, 0])
if right:
wall_offsets.append([1, 0])
if not game_state.can_spawn(unit_enum_map['TURRET'], turret_location):
... | Contains builder/simulator for a turret paired with 1 or more walls | DefensiveTurretWallStrat | [
"LicenseRef-scancode-warranty-disclaimer"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DefensiveTurretWallStrat:
"""Contains builder/simulator for a turret paired with 1 or more walls"""
def build_turret_wall_pair(self, game_state: GameState, unit_enum_map: dict, turret_location: (int, int) or [[int]], above: bool=True, left: bool=False, right: bool=False) -> int:
"""B... | stack_v2_sparse_classes_36k_train_010923 | 6,790 | no_license | [
{
"docstring": "Builds a turret/wall pair at the given location and the wall(s) at the given bool offset(s). Args: game_state (GameState): The current game state object unit_enum_map (dict): Maps NAME to unit enum turret_location ((int, int) or [[int]]): The turret's location above (bool): Whether to build a wa... | 2 | stack_v2_sparse_classes_30k_train_008772 | Implement the Python class `DefensiveTurretWallStrat` described below.
Class description:
Contains builder/simulator for a turret paired with 1 or more walls
Method signatures and docstrings:
- def build_turret_wall_pair(self, game_state: GameState, unit_enum_map: dict, turret_location: (int, int) or [[int]], above: ... | Implement the Python class `DefensiveTurretWallStrat` described below.
Class description:
Contains builder/simulator for a turret paired with 1 or more walls
Method signatures and docstrings:
- def build_turret_wall_pair(self, game_state: GameState, unit_enum_map: dict, turret_location: (int, int) or [[int]], above: ... | e9439191d44f644c55752abadda6882eeb75671f | <|skeleton|>
class DefensiveTurretWallStrat:
"""Contains builder/simulator for a turret paired with 1 or more walls"""
def build_turret_wall_pair(self, game_state: GameState, unit_enum_map: dict, turret_location: (int, int) or [[int]], above: bool=True, left: bool=False, right: bool=False) -> int:
"""B... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DefensiveTurretWallStrat:
"""Contains builder/simulator for a turret paired with 1 or more walls"""
def build_turret_wall_pair(self, game_state: GameState, unit_enum_map: dict, turret_location: (int, int) or [[int]], above: bool=True, left: bool=False, right: bool=False) -> int:
"""Builds a turre... | the_stack_v2_python_sparse | algos/bruh_moment/defensive_building_functions.py | echudov/terminal | train | 0 |
b9cc3c939efb3892e7fd9018ebecfaeda662dc62 | [
"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 reach plan service. Reach Plan Service gives users information about audience size that can be reached through advertisement on YouTube. In particular, GenerateReachForecast provides estimated number of people of specified demographics that can be reached by an ad in a given market by a campai... | ReachPlanServiceServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReachPlanServiceServicer:
"""Proto file describing the reach plan service. Reach Plan Service gives users information about audience size that can be reached through advertisement on YouTube. In particular, GenerateReachForecast provides estimated number of people of specified demographics that c... | stack_v2_sparse_classes_36k_train_010924 | 6,480 | permissive | [
{
"docstring": "Returns the list of plannable locations (for example, countries & DMAs).",
"name": "ListPlannableLocations",
"signature": "def ListPlannableLocations(self, request, context)"
},
{
"docstring": "Returns the list of per-location plannable YouTube ad formats with allowed targeting."... | 4 | stack_v2_sparse_classes_30k_train_020016 | Implement the Python class `ReachPlanServiceServicer` described below.
Class description:
Proto file describing the reach plan service. Reach Plan Service gives users information about audience size that can be reached through advertisement on YouTube. In particular, GenerateReachForecast provides estimated number of ... | Implement the Python class `ReachPlanServiceServicer` described below.
Class description:
Proto file describing the reach plan service. Reach Plan Service gives users information about audience size that can be reached through advertisement on YouTube. In particular, GenerateReachForecast provides estimated number of ... | a5b6cede64f4d9912ae6ad26927a54e40448c9fe | <|skeleton|>
class ReachPlanServiceServicer:
"""Proto file describing the reach plan service. Reach Plan Service gives users information about audience size that can be reached through advertisement on YouTube. In particular, GenerateReachForecast provides estimated number of people of specified demographics that c... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ReachPlanServiceServicer:
"""Proto file describing the reach plan service. Reach Plan Service gives users information about audience size that can be reached through advertisement on YouTube. In particular, GenerateReachForecast provides estimated number of people of specified demographics that can be reached... | the_stack_v2_python_sparse | google/ads/google_ads/v3/proto/services/reach_plan_service_pb2_grpc.py | fiboknacky/google-ads-python | train | 0 |
f8ea328f433fe36d1db25150d79869a8c6a18b82 | [
"Parametre.__init__(self, 'installer', 'install')\nself.schema = '<nom_objet> sur/on <bh_emplacement> de/of <element_observable>'\nself.aide_courte = 'installe un élément sur un bonhomme'\nself.aide_longue = \"Cette commande permet d'installer un élément sur un bonhomme de neige. Vous devez préciser le nom de l'obj... | <|body_start_0|>
Parametre.__init__(self, 'installer', 'install')
self.schema = '<nom_objet> sur/on <bh_emplacement> de/of <element_observable>'
self.aide_courte = 'installe un élément sur un bonhomme'
self.aide_longue = "Cette commande permet d'installer un élément sur un bonhomme de ne... | Commande 'neige installer' | PrmInstaller | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PrmInstaller:
"""Commande 'neige installer'"""
def __init__(self):
"""Constructeur du paramètre."""
<|body_0|>
def ajouter(self):
"""Méthode appelée lors de l'ajout de la commande à l'interpréteur"""
<|body_1|>
def interpreter(self, personnage, dic_m... | stack_v2_sparse_classes_36k_train_010925 | 5,206 | permissive | [
{
"docstring": "Constructeur du paramètre.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Méthode appelée lors de l'ajout de la commande à l'interpréteur",
"name": "ajouter",
"signature": "def ajouter(self)"
},
{
"docstring": "Méthode d'interprétation ... | 3 | null | Implement the Python class `PrmInstaller` described below.
Class description:
Commande 'neige installer'
Method signatures and docstrings:
- def __init__(self): Constructeur du paramètre.
- def ajouter(self): Méthode appelée lors de l'ajout de la commande à l'interpréteur
- def interpreter(self, personnage, dic_masqu... | Implement the Python class `PrmInstaller` described below.
Class description:
Commande 'neige installer'
Method signatures and docstrings:
- def __init__(self): Constructeur du paramètre.
- def ajouter(self): Méthode appelée lors de l'ajout de la commande à l'interpréteur
- def interpreter(self, personnage, dic_masqu... | 7e93bff08cdf891352efba587e89c40f3b4a2301 | <|skeleton|>
class PrmInstaller:
"""Commande 'neige installer'"""
def __init__(self):
"""Constructeur du paramètre."""
<|body_0|>
def ajouter(self):
"""Méthode appelée lors de l'ajout de la commande à l'interpréteur"""
<|body_1|>
def interpreter(self, personnage, dic_m... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PrmInstaller:
"""Commande 'neige installer'"""
def __init__(self):
"""Constructeur du paramètre."""
Parametre.__init__(self, 'installer', 'install')
self.schema = '<nom_objet> sur/on <bh_emplacement> de/of <element_observable>'
self.aide_courte = 'installe un élément sur u... | the_stack_v2_python_sparse | src/primaires/salle/commandes/neige/installer.py | vincent-lg/tsunami | train | 5 |
491cbf8ea3311426a1fb67864055ba6da09395de | [
"size: tuple\nsize = settings.get_size()\nself._screen = pygame.display.set_mode(size)\npygame.display.set_caption('Press keys to move the picture')\nself._background = pygame.Surface(size)\nself._keys = settings.get_keys()\nself._picture = picture",
"user_quit: bool = False\nclock: pygame.time.Clock = pygame.tim... | <|body_start_0|>
size: tuple
size = settings.get_size()
self._screen = pygame.display.set_mode(size)
pygame.display.set_caption('Press keys to move the picture')
self._background = pygame.Surface(size)
self._keys = settings.get_keys()
self._picture = picture
<|end... | PictureMover | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PictureMover:
def __init__(self, settings: Settings, picture: MoveablePicture) -> None:
"""Initialize from settings, create window."""
<|body_0|>
def go(self) -> None:
"""Create a window with an image that can be moved."""
<|body_1|>
<|end_skeleton|>
<|body... | stack_v2_sparse_classes_36k_train_010926 | 5,822 | no_license | [
{
"docstring": "Initialize from settings, create window.",
"name": "__init__",
"signature": "def __init__(self, settings: Settings, picture: MoveablePicture) -> None"
},
{
"docstring": "Create a window with an image that can be moved.",
"name": "go",
"signature": "def go(self) -> None"
... | 2 | null | Implement the Python class `PictureMover` described below.
Class description:
Implement the PictureMover class.
Method signatures and docstrings:
- def __init__(self, settings: Settings, picture: MoveablePicture) -> None: Initialize from settings, create window.
- def go(self) -> None: Create a window with an image t... | Implement the Python class `PictureMover` described below.
Class description:
Implement the PictureMover class.
Method signatures and docstrings:
- def __init__(self, settings: Settings, picture: MoveablePicture) -> None: Initialize from settings, create window.
- def go(self) -> None: Create a window with an image t... | 0fe17edf6ffcb35265032c6449d866b9434fda00 | <|skeleton|>
class PictureMover:
def __init__(self, settings: Settings, picture: MoveablePicture) -> None:
"""Initialize from settings, create window."""
<|body_0|>
def go(self) -> None:
"""Create a window with an image that can be moved."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PictureMover:
def __init__(self, settings: Settings, picture: MoveablePicture) -> None:
"""Initialize from settings, create window."""
size: tuple
size = settings.get_size()
self._screen = pygame.display.set_mode(size)
pygame.display.set_caption('Press keys to move the ... | the_stack_v2_python_sparse | Chapter6VideoFiles/MoveablePicturePickle.py | ProfessorBurke/PythonObjectsGames | train | 3 | |
036eb65eab187f24c3a0afce04a68894b7aff1c7 | [
"super(MenuBarsUi, self).__init__()\nself.menu_bar = menu_bar\nself.file_menu = menu_bar.addMenu('&File')\nself.edit_menu = menu_bar.addMenu('&Edit')\nself.help_menu = menu_bar.addMenu('&Help')",
"file_sysprefs = QAction('&Open VPN System Prefs', self.menu_bar)\nfile_sysprefs.setShortcut('Ctrl+O')\nfile_quit = QA... | <|body_start_0|>
super(MenuBarsUi, self).__init__()
self.menu_bar = menu_bar
self.file_menu = menu_bar.addMenu('&File')
self.edit_menu = menu_bar.addMenu('&Edit')
self.help_menu = menu_bar.addMenu('&Help')
<|end_body_0|>
<|body_start_1|>
file_sysprefs = QAction('&Open VP... | Menubars of the GUI. This class contains mostly boilerplate Qt UI. Attributes: menu_bar (QMenuBar): The Main Window's built-in menu bar object file_menu (QAction): File menu edit_menu (QAction): Edit menu help_menu (QAction): Help menu | MenuBarsUi | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MenuBarsUi:
"""Menubars of the GUI. This class contains mostly boilerplate Qt UI. Attributes: menu_bar (QMenuBar): The Main Window's built-in menu bar object file_menu (QAction): File menu edit_menu (QAction): Edit menu help_menu (QAction): Help menu"""
def __init__(self, menu_bar):
... | stack_v2_sparse_classes_36k_train_010927 | 4,494 | permissive | [
{
"docstring": "Initialize all of the program menus.",
"name": "__init__",
"signature": "def __init__(self, menu_bar)"
},
{
"docstring": "Create each of the menu bars. NOTE: Some of the menu additions here are planned features",
"name": "generate_menu_bars",
"signature": "def generate_me... | 5 | stack_v2_sparse_classes_30k_train_005297 | Implement the Python class `MenuBarsUi` described below.
Class description:
Menubars of the GUI. This class contains mostly boilerplate Qt UI. Attributes: menu_bar (QMenuBar): The Main Window's built-in menu bar object file_menu (QAction): File menu edit_menu (QAction): Edit menu help_menu (QAction): Help menu
Method... | Implement the Python class `MenuBarsUi` described below.
Class description:
Menubars of the GUI. This class contains mostly boilerplate Qt UI. Attributes: menu_bar (QMenuBar): The Main Window's built-in menu bar object file_menu (QAction): File menu edit_menu (QAction): Edit menu help_menu (QAction): Help menu
Method... | bdb33b047b0a71b69c199db399c59ac5bfecd64c | <|skeleton|>
class MenuBarsUi:
"""Menubars of the GUI. This class contains mostly boilerplate Qt UI. Attributes: menu_bar (QMenuBar): The Main Window's built-in menu bar object file_menu (QAction): File menu edit_menu (QAction): Edit menu help_menu (QAction): Help menu"""
def __init__(self, menu_bar):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MenuBarsUi:
"""Menubars of the GUI. This class contains mostly boilerplate Qt UI. Attributes: menu_bar (QMenuBar): The Main Window's built-in menu bar object file_menu (QAction): File menu edit_menu (QAction): Edit menu help_menu (QAction): Help menu"""
def __init__(self, menu_bar):
"""Initialize... | the_stack_v2_python_sparse | merlink/qt/menu_bars.py | pocc/merlink | train | 4 |
d9624171e5e21d14b41f4a7a85193907d649f149 | [
"if not root:\n return []\nstack = []\nres = []\nwhile root or stack:\n if root:\n stack.append(root)\n root = root.left\n else:\n root = stack.pop()\n res.append(root.val)\n root = root.right\nreturn res",
"if not root:\n return []\nstack = [root]\nres = []\nwhile s... | <|body_start_0|>
if not root:
return []
stack = []
res = []
while root or stack:
if root:
stack.append(root)
root = root.left
else:
root = stack.pop()
res.append(root.val)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def in_order_traversal(self, root):
""":param root: TreeNode :return:"""
<|body_0|>
def preorderTraversal(self, root):
""":type root: TreeNode :rtype: List[int]"""
<|body_1|>
def preorderTraversal2(self, root):
""":type root: TreeNode :... | stack_v2_sparse_classes_36k_train_010928 | 1,394 | no_license | [
{
"docstring": ":param root: TreeNode :return:",
"name": "in_order_traversal",
"signature": "def in_order_traversal(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: List[int]",
"name": "preorderTraversal",
"signature": "def preorderTraversal(self, root)"
},
{
"docstri... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def in_order_traversal(self, root): :param root: TreeNode :return:
- def preorderTraversal(self, root): :type root: TreeNode :rtype: List[int]
- def preorderTraversal2(self, root... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def in_order_traversal(self, root): :param root: TreeNode :return:
- def preorderTraversal(self, root): :type root: TreeNode :rtype: List[int]
- def preorderTraversal2(self, root... | 11d6bf2ba7b50c07e048df37c4e05c8f46b92241 | <|skeleton|>
class Solution:
def in_order_traversal(self, root):
""":param root: TreeNode :return:"""
<|body_0|>
def preorderTraversal(self, root):
""":type root: TreeNode :rtype: List[int]"""
<|body_1|>
def preorderTraversal2(self, root):
""":type root: TreeNode :... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def in_order_traversal(self, root):
""":param root: TreeNode :return:"""
if not root:
return []
stack = []
res = []
while root or stack:
if root:
stack.append(root)
root = root.left
else:
... | the_stack_v2_python_sparse | LeetCodes/Trees/TreeTraversal.py | chutianwen/LeetCodes | train | 0 | |
16e13c5fef5a89b52f3ef953cae96a66512aac74 | [
"context = super(HostNamesView, self).get_context_data(**kwargs)\ndevicesdata = list()\nfor row in HostNames.objects.all():\n dd = dict()\n dd['url'] = row.url\n dd['hostname'] = row.hostname\n dd['is_online'] = row.is_online\n dd['is_healthy'] = row.is_healthy\n dd['username'] = row.username\n ... | <|body_start_0|>
context = super(HostNamesView, self).get_context_data(**kwargs)
devicesdata = list()
for row in HostNames.objects.all():
dd = dict()
dd['url'] = row.url
dd['hostname'] = row.hostname
dd['is_online'] = row.is_online
dd['... | Home Page View with a popup Login Form | HostNamesView | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HostNamesView:
"""Home Page View with a popup Login Form"""
def get_context_data(self, **kwargs):
"""Overriding get_context_data to add data for filling up Nexus Dashboard Table Template (in index.html)"""
<|body_0|>
def post(self, request, *args, **kwargs):
"""O... | stack_v2_sparse_classes_36k_train_010929 | 2,197 | permissive | [
{
"docstring": "Overriding get_context_data to add data for filling up Nexus Dashboard Table Template (in index.html)",
"name": "get_context_data",
"signature": "def get_context_data(self, **kwargs)"
},
{
"docstring": "Overrides FormView.post in order to return JSON data for JS Validation (/js/l... | 2 | stack_v2_sparse_classes_30k_train_010214 | Implement the Python class `HostNamesView` described below.
Class description:
Home Page View with a popup Login Form
Method signatures and docstrings:
- def get_context_data(self, **kwargs): Overriding get_context_data to add data for filling up Nexus Dashboard Table Template (in index.html)
- def post(self, request... | Implement the Python class `HostNamesView` described below.
Class description:
Home Page View with a popup Login Form
Method signatures and docstrings:
- def get_context_data(self, **kwargs): Overriding get_context_data to add data for filling up Nexus Dashboard Table Template (in index.html)
- def post(self, request... | 244912e10f4d0e17e29e9b6cf5182f14d554f25d | <|skeleton|>
class HostNamesView:
"""Home Page View with a popup Login Form"""
def get_context_data(self, **kwargs):
"""Overriding get_context_data to add data for filling up Nexus Dashboard Table Template (in index.html)"""
<|body_0|>
def post(self, request, *args, **kwargs):
"""O... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HostNamesView:
"""Home Page View with a popup Login Form"""
def get_context_data(self, **kwargs):
"""Overriding get_context_data to add data for filling up Nexus Dashboard Table Template (in index.html)"""
context = super(HostNamesView, self).get_context_data(**kwargs)
devicesdata... | the_stack_v2_python_sparse | nexusdash/hostnames/views.py | datacenter/nexus9000 | train | 201 |
bc05bd0b36dbe5416c7371340719c386255a58ac | [
"if root is None:\n return\nself.stack.append(root)\nl = root.left\nwhile l:\n self.stack.append(l)\n l = l.left",
"if len(self.stack) > 0:\n return True\nreturn False",
"smallest = self.stack.pop()\nr = smallest.right\nif r is not None:\n self.stack.append(r)\n l = r.left\n while l:\n ... | <|body_start_0|>
if root is None:
return
self.stack.append(root)
l = root.left
while l:
self.stack.append(l)
l = l.left
<|end_body_0|>
<|body_start_1|>
if len(self.stack) > 0:
return True
return False
<|end_body_1|>
<|body... | BSTIterator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BSTIterator:
def __init__(self, root):
""":type root: TreeNode"""
<|body_0|>
def hasNext(self):
""":rtype: bool"""
<|body_1|>
def next(self):
""":rtype: int"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
if root is None:
... | stack_v2_sparse_classes_36k_train_010930 | 1,487 | no_license | [
{
"docstring": ":type root: TreeNode",
"name": "__init__",
"signature": "def __init__(self, root)"
},
{
"docstring": ":rtype: bool",
"name": "hasNext",
"signature": "def hasNext(self)"
},
{
"docstring": ":rtype: int",
"name": "next",
"signature": "def next(self)"
}
] | 3 | stack_v2_sparse_classes_30k_train_011115 | Implement the Python class `BSTIterator` described below.
Class description:
Implement the BSTIterator class.
Method signatures and docstrings:
- def __init__(self, root): :type root: TreeNode
- def hasNext(self): :rtype: bool
- def next(self): :rtype: int | Implement the Python class `BSTIterator` described below.
Class description:
Implement the BSTIterator class.
Method signatures and docstrings:
- def __init__(self, root): :type root: TreeNode
- def hasNext(self): :rtype: bool
- def next(self): :rtype: int
<|skeleton|>
class BSTIterator:
def __init__(self, root... | dd268af242d18bc2fd9527661c71d2e51af1039d | <|skeleton|>
class BSTIterator:
def __init__(self, root):
""":type root: TreeNode"""
<|body_0|>
def hasNext(self):
""":rtype: bool"""
<|body_1|>
def next(self):
""":rtype: int"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BSTIterator:
def __init__(self, root):
""":type root: TreeNode"""
if root is None:
return
self.stack.append(root)
l = root.left
while l:
self.stack.append(l)
l = l.left
def hasNext(self):
""":rtype: bool"""
if len... | the_stack_v2_python_sparse | DS/Tree/Medium/R__173.Binary_Search_Tree_Iterator.py | HotsauceLee/Leetcode | train | 2 | |
4b7dbc37ca1193edfd9c28576acc69bafc348d05 | [
"if self._context is None:\n self._context = {}\nactive_id = self._context and self._context.get('active_id', False) or False\nif not active_id:\n return False\nlead_brw = self.env['crm.lead'].browse(active_id)\nlead = lead_brw.read(['partner_id'])[0]\nreturn lead['partner_id'][0] if lead['partner_id'] else F... | <|body_start_0|>
if self._context is None:
self._context = {}
active_id = self._context and self._context.get('active_id', False) or False
if not active_id:
return False
lead_brw = self.env['crm.lead'].browse(active_id)
lead = lead_brw.read(['partner_id'])... | Make contract order for crm | crm_make_contract | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class crm_make_contract:
"""Make contract order for crm"""
def _selectPartner(self):
"""This function gets default value for partner_id field. @param self: The object pointer @return: default value of partner_id field."""
<|body_0|>
def makecontract(self):
"""This func... | stack_v2_sparse_classes_36k_train_010931 | 6,484 | no_license | [
{
"docstring": "This function gets default value for partner_id field. @param self: The object pointer @return: default value of partner_id field.",
"name": "_selectPartner",
"signature": "def _selectPartner(self)"
},
{
"docstring": "This function create Quotation on given case. @param self: The... | 2 | stack_v2_sparse_classes_30k_train_011490 | Implement the Python class `crm_make_contract` described below.
Class description:
Make contract order for crm
Method signatures and docstrings:
- def _selectPartner(self): This function gets default value for partner_id field. @param self: The object pointer @return: default value of partner_id field.
- def makecont... | Implement the Python class `crm_make_contract` described below.
Class description:
Make contract order for crm
Method signatures and docstrings:
- def _selectPartner(self): This function gets default value for partner_id field. @param self: The object pointer @return: default value of partner_id field.
- def makecont... | faf6dfa178c869ba660b86bf0efb307985250c76 | <|skeleton|>
class crm_make_contract:
"""Make contract order for crm"""
def _selectPartner(self):
"""This function gets default value for partner_id field. @param self: The object pointer @return: default value of partner_id field."""
<|body_0|>
def makecontract(self):
"""This func... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class crm_make_contract:
"""Make contract order for crm"""
def _selectPartner(self):
"""This function gets default value for partner_id field. @param self: The object pointer @return: default value of partner_id field."""
if self._context is None:
self._context = {}
active_i... | the_stack_v2_python_sparse | realestate/models/crm_lead.py | eman000tahaz/arc-s | train | 0 |
d4a01b7d588c872cf7c6a7bab3e582df08739fe5 | [
"self.transport = transport\nclient_address, client_port = self.transport.get_extra_info('peername')\nprint('New client: {0}:{1}'.format(client_address, client_port))",
"client_address, client_port = self.transport.get_extra_info('peername')\nprint('Recv: {0} to {1}:{2}'.format(data, client_address, client_port))... | <|body_start_0|>
self.transport = transport
client_address, client_port = self.transport.get_extra_info('peername')
print('New client: {0}:{1}'.format(client_address, client_port))
<|end_body_0|>
<|body_start_1|>
client_address, client_port = self.transport.get_extra_info('peername')
... | EchoServer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EchoServer:
def connection_made(self, transport):
"""クライアントからの接続があったときに呼ばれるイベントハンドラ"""
<|body_0|>
def data_received(self, data):
"""クライアントからデータを受信したときに呼ばれるイベントハンドラ"""
<|body_1|>
def connection_lost(self, exc):
"""クライアントとの接続が切れたときに呼ばれるイベントハンドラ"""
... | stack_v2_sparse_classes_36k_train_010932 | 2,217 | no_license | [
{
"docstring": "クライアントからの接続があったときに呼ばれるイベントハンドラ",
"name": "connection_made",
"signature": "def connection_made(self, transport)"
},
{
"docstring": "クライアントからデータを受信したときに呼ばれるイベントハンドラ",
"name": "data_received",
"signature": "def data_received(self, data)"
},
{
"docstring": "クライアントとの接続... | 3 | stack_v2_sparse_classes_30k_train_021625 | Implement the Python class `EchoServer` described below.
Class description:
Implement the EchoServer class.
Method signatures and docstrings:
- def connection_made(self, transport): クライアントからの接続があったときに呼ばれるイベントハンドラ
- def data_received(self, data): クライアントからデータを受信したときに呼ばれるイベントハンドラ
- def connection_lost(self, exc): クライアント... | Implement the Python class `EchoServer` described below.
Class description:
Implement the EchoServer class.
Method signatures and docstrings:
- def connection_made(self, transport): クライアントからの接続があったときに呼ばれるイベントハンドラ
- def data_received(self, data): クライアントからデータを受信したときに呼ばれるイベントハンドラ
- def connection_lost(self, exc): クライアント... | 46b1842befb0bf1b6e55582721990f4fe2cd6d7f | <|skeleton|>
class EchoServer:
def connection_made(self, transport):
"""クライアントからの接続があったときに呼ばれるイベントハンドラ"""
<|body_0|>
def data_received(self, data):
"""クライアントからデータを受信したときに呼ばれるイベントハンドラ"""
<|body_1|>
def connection_lost(self, exc):
"""クライアントとの接続が切れたときに呼ばれるイベントハンドラ"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EchoServer:
def connection_made(self, transport):
"""クライアントからの接続があったときに呼ばれるイベントハンドラ"""
self.transport = transport
client_address, client_port = self.transport.get_extra_info('peername')
print('New client: {0}:{1}'.format(client_address, client_port))
def data_received(self... | the_stack_v2_python_sparse | python_sample/sochet2/asyncioserver.py | rotace/sample | train | 0 | |
2cf39ae831a923e80197608352057a8860df9d28 | [
"s, stack = ('', deque([root]))\nif root:\n while stack:\n node = stack.popleft()\n if node:\n s += str(node.val) + ','\n stack.append(node.left)\n stack.append(node.right)\n else:\n s += ' ,'\nreturn s[:-1]",
"x = deque(data.split(','))\nv = x.p... | <|body_start_0|>
s, stack = ('', deque([root]))
if root:
while stack:
node = stack.popleft()
if node:
s += str(node.val) + ','
stack.append(node.left)
stack.append(node.right)
else:
... | Q0297, check out listToTreeNode in @/src/config/treenode.py, which is exactly how deserialize work. | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
"""Q0297, check out listToTreeNode in @/src/config/treenode.py, which is exactly how deserialize work."""
def serialize(self, root: TreeNode) -> str:
"""Encodes a tree to a single string."""
<|body_0|>
def deserialize(self, data: str) -> TreeNode:
"""Decod... | stack_v2_sparse_classes_36k_train_010933 | 2,340 | no_license | [
{
"docstring": "Encodes a tree to a single string.",
"name": "serialize",
"signature": "def serialize(self, root: TreeNode) -> str"
},
{
"docstring": "Decodes your encoded data to tree.",
"name": "deserialize",
"signature": "def deserialize(self, data: str) -> TreeNode"
}
] | 2 | stack_v2_sparse_classes_30k_train_006753 | Implement the Python class `Codec` described below.
Class description:
Q0297, check out listToTreeNode in @/src/config/treenode.py, which is exactly how deserialize work.
Method signatures and docstrings:
- def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string.
- def deserialize(self, data: st... | Implement the Python class `Codec` described below.
Class description:
Q0297, check out listToTreeNode in @/src/config/treenode.py, which is exactly how deserialize work.
Method signatures and docstrings:
- def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string.
- def deserialize(self, data: st... | 6043134736452a6f4704b62857d0aed2e9571164 | <|skeleton|>
class Codec:
"""Q0297, check out listToTreeNode in @/src/config/treenode.py, which is exactly how deserialize work."""
def serialize(self, root: TreeNode) -> str:
"""Encodes a tree to a single string."""
<|body_0|>
def deserialize(self, data: str) -> TreeNode:
"""Decod... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
"""Q0297, check out listToTreeNode in @/src/config/treenode.py, which is exactly how deserialize work."""
def serialize(self, root: TreeNode) -> str:
"""Encodes a tree to a single string."""
s, stack = ('', deque([root]))
if root:
while stack:
no... | the_stack_v2_python_sparse | src/0400-0499/0449.serialize.deserialize.bst.py | gyang274/leetcode | train | 1 |
abe83dfa747012538f6ffa7f9edb6151d7f55ddc | [
"cursor = cnx.cursor(buffered=True)\ncommand = '\\n INSERT INTO `ordersystem_db`.`sub_cat`\\n (`subcat_name`,`upper_cat`)\\n VALUES(%s,%s);\\n '\ncursor.execute(command, (object.sub_category, object.upper_category))\ncursor.execute('SELECT MAX(id) FROM upper_cat')\nmax_id = cursor.fetcho... | <|body_start_0|>
cursor = cnx.cursor(buffered=True)
command = '\n INSERT INTO `ordersystem_db`.`sub_cat`\n (`subcat_name`,`upper_cat`)\n VALUES(%s,%s);\n '
cursor.execute(command, (object.sub_category, object.upper_category))
cursor.execute('SELECT MAX(id) FRO... | SubCatMapper | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SubCatMapper:
def insert(cnx: db_connector, object: SubCatObject) -> SubCatObject:
"""Creates a new Upper Category."""
<|body_0|>
def find_all(cnx: db_connector, upperCat: int) -> SubCatObject:
"""Get All Upper Categories."""
<|body_1|>
def delete(cnx: d... | stack_v2_sparse_classes_36k_train_010934 | 2,310 | no_license | [
{
"docstring": "Creates a new Upper Category.",
"name": "insert",
"signature": "def insert(cnx: db_connector, object: SubCatObject) -> SubCatObject"
},
{
"docstring": "Get All Upper Categories.",
"name": "find_all",
"signature": "def find_all(cnx: db_connector, upperCat: int) -> SubCatOb... | 4 | stack_v2_sparse_classes_30k_train_014159 | Implement the Python class `SubCatMapper` described below.
Class description:
Implement the SubCatMapper class.
Method signatures and docstrings:
- def insert(cnx: db_connector, object: SubCatObject) -> SubCatObject: Creates a new Upper Category.
- def find_all(cnx: db_connector, upperCat: int) -> SubCatObject: Get A... | Implement the Python class `SubCatMapper` described below.
Class description:
Implement the SubCatMapper class.
Method signatures and docstrings:
- def insert(cnx: db_connector, object: SubCatObject) -> SubCatObject: Creates a new Upper Category.
- def find_all(cnx: db_connector, upperCat: int) -> SubCatObject: Get A... | 960bd09661623a353936f0f11e2c8bc3ca49c1b6 | <|skeleton|>
class SubCatMapper:
def insert(cnx: db_connector, object: SubCatObject) -> SubCatObject:
"""Creates a new Upper Category."""
<|body_0|>
def find_all(cnx: db_connector, upperCat: int) -> SubCatObject:
"""Get All Upper Categories."""
<|body_1|>
def delete(cnx: d... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SubCatMapper:
def insert(cnx: db_connector, object: SubCatObject) -> SubCatObject:
"""Creates a new Upper Category."""
cursor = cnx.cursor(buffered=True)
command = '\n INSERT INTO `ordersystem_db`.`sub_cat`\n (`subcat_name`,`upper_cat`)\n VALUES(%s,%s);\n '
... | the_stack_v2_python_sparse | Backend/subcat/SubCatMapper.py | AtaullahShinwari/Ordersystem | train | 0 | |
a1720898ccca12b23b30a4148f82f0940245e57a | [
"s_new = [char for char in s.lower() if char.isalnum()]\nprint(s_new)\nres = s_new == s_new[::-1]\nprint(res)\nreturn res",
"s_new = list(filter(str.isalnum, s.lower()))\nprint(s_new)\nres = s_new == s_new[::-1]\nprint(res)\nreturn res"
] | <|body_start_0|>
s_new = [char for char in s.lower() if char.isalnum()]
print(s_new)
res = s_new == s_new[::-1]
print(res)
return res
<|end_body_0|>
<|body_start_1|>
s_new = list(filter(str.isalnum, s.lower()))
print(s_new)
res = s_new == s_new[::-1]
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isPalindrome(self, s):
""":type s:str :rtype: bool"""
<|body_0|>
def isPalindrome_2(self, s):
""":type s:str :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
s_new = [char for char in s.lower() if char.isalnum()]
pr... | stack_v2_sparse_classes_36k_train_010935 | 1,208 | no_license | [
{
"docstring": ":type s:str :rtype: bool",
"name": "isPalindrome",
"signature": "def isPalindrome(self, s)"
},
{
"docstring": ":type s:str :rtype: bool",
"name": "isPalindrome_2",
"signature": "def isPalindrome_2(self, s)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isPalindrome(self, s): :type s:str :rtype: bool
- def isPalindrome_2(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 isPalindrome(self, s): :type s:str :rtype: bool
- def isPalindrome_2(self, s): :type s:str :rtype: bool
<|skeleton|>
class Solution:
def isPalindrome(self, s):
... | 4f2802d4773eddd2a2e06e61c51463056886b730 | <|skeleton|>
class Solution:
def isPalindrome(self, s):
""":type s:str :rtype: bool"""
<|body_0|>
def isPalindrome_2(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 isPalindrome(self, s):
""":type s:str :rtype: bool"""
s_new = [char for char in s.lower() if char.isalnum()]
print(s_new)
res = s_new == s_new[::-1]
print(res)
return res
def isPalindrome_2(self, s):
""":type s:str :rtype: bool"""
... | the_stack_v2_python_sparse | leetcode/16_isPalindrome.py | Yara7L/python_algorithm | train | 0 | |
ce9ddbb1786210c4309bc6e1117c55dd914641b1 | [
"if not self.args.unlock:\n return\nformatting.print_title('Unlocking tests for {}'.format(self.assignment['name']))\nprint('At each \"{}\",'.format(UnlockConsole.PROMPT) + ' type in what you would expect the output to be.')\nprint('Type {} to quit'.format(UnlockConsole.EXIT_INPUTS[0]))\nfor test in self._filter... | <|body_start_0|>
if not self.args.unlock:
return
formatting.print_title('Unlocking tests for {}'.format(self.assignment['name']))
print('At each "{}",'.format(UnlockConsole.PROMPT) + ' type in what you would expect the output to be.')
print('Type {} to quit'.format(UnlockCons... | Unlocking protocol that wraps that mechanism. | UnlockProtocol | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UnlockProtocol:
"""Unlocking protocol that wraps that mechanism."""
def on_interact(self):
"""Responsible for unlocking each test."""
<|body_0|>
def _filter_tests(self):
"""Filter out tests based on command line options passed in by the student."""
<|body... | stack_v2_sparse_classes_36k_train_010936 | 11,408 | permissive | [
{
"docstring": "Responsible for unlocking each test.",
"name": "on_interact",
"signature": "def on_interact(self)"
},
{
"docstring": "Filter out tests based on command line options passed in by the student.",
"name": "_filter_tests",
"signature": "def _filter_tests(self)"
}
] | 2 | stack_v2_sparse_classes_30k_val_000428 | Implement the Python class `UnlockProtocol` described below.
Class description:
Unlocking protocol that wraps that mechanism.
Method signatures and docstrings:
- def on_interact(self): Responsible for unlocking each test.
- def _filter_tests(self): Filter out tests based on command line options passed in by the stude... | Implement the Python class `UnlockProtocol` described below.
Class description:
Unlocking protocol that wraps that mechanism.
Method signatures and docstrings:
- def on_interact(self): Responsible for unlocking each test.
- def _filter_tests(self): Filter out tests based on command line options passed in by the stude... | 492a077a06a36644177092f26c3a003fd86c2595 | <|skeleton|>
class UnlockProtocol:
"""Unlocking protocol that wraps that mechanism."""
def on_interact(self):
"""Responsible for unlocking each test."""
<|body_0|>
def _filter_tests(self):
"""Filter out tests based on command line options passed in by the student."""
<|body... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UnlockProtocol:
"""Unlocking protocol that wraps that mechanism."""
def on_interact(self):
"""Responsible for unlocking each test."""
if not self.args.unlock:
return
formatting.print_title('Unlocking tests for {}'.format(self.assignment['name']))
print('At each... | the_stack_v2_python_sparse | client/protocols/unlock.py | hpec/ok | train | 0 |
83b3e9b3555759b67953a7957bbe65c18c01cf18 | [
"self.language = constant.LANGUAGE_NAME_DICT[args.language[0]]\nself.ide_name = constant.IDE_NAME_DICT[args.ide[0]]\nself.is_launch_ide = not args.no_launch\nself.depth = args.depth\nself.full_repo = args.android_tree\nself.is_skip_build = args.skip_build\nself.targets = args.targets.copy()\nself.verbose = args.ver... | <|body_start_0|>
self.language = constant.LANGUAGE_NAME_DICT[args.language[0]]
self.ide_name = constant.IDE_NAME_DICT[args.ide[0]]
self.is_launch_ide = not args.no_launch
self.depth = args.depth
self.full_repo = args.android_tree
self.is_skip_build = args.skip_build
... | A singleton class manages AIDEGen's configurations. ProjectConfig is a singleton class that can be accessed in other modules. Usage: 1. Main module should do it once by instantiating a ProjectConfig with users' input arguments and calling init_environment(). args = aidegen_main.main(sys.argv[1:]) project_config.Project... | ProjectConfig | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProjectConfig:
"""A singleton class manages AIDEGen's configurations. ProjectConfig is a singleton class that can be accessed in other modules. Usage: 1. Main module should do it once by instantiating a ProjectConfig with users' input arguments and calling init_environment(). args = aidegen_main.... | stack_v2_sparse_classes_36k_train_010937 | 7,145 | no_license | [
{
"docstring": "ProjectConfig initialize. Args: An argparse.Namespace object holds parsed args.",
"name": "__init__",
"signature": "def __init__(self, args)"
},
{
"docstring": "Initialize the environment settings for the whole project.",
"name": "init_environment",
"signature": "def init... | 4 | null | Implement the Python class `ProjectConfig` described below.
Class description:
A singleton class manages AIDEGen's configurations. ProjectConfig is a singleton class that can be accessed in other modules. Usage: 1. Main module should do it once by instantiating a ProjectConfig with users' input arguments and calling i... | Implement the Python class `ProjectConfig` described below.
Class description:
A singleton class manages AIDEGen's configurations. ProjectConfig is a singleton class that can be accessed in other modules. Usage: 1. Main module should do it once by instantiating a ProjectConfig with users' input arguments and calling i... | 78a61ca023cbf1a0cecfef8b97df2b274ac3a988 | <|skeleton|>
class ProjectConfig:
"""A singleton class manages AIDEGen's configurations. ProjectConfig is a singleton class that can be accessed in other modules. Usage: 1. Main module should do it once by instantiating a ProjectConfig with users' input arguments and calling init_environment(). args = aidegen_main.... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProjectConfig:
"""A singleton class manages AIDEGen's configurations. ProjectConfig is a singleton class that can be accessed in other modules. Usage: 1. Main module should do it once by instantiating a ProjectConfig with users' input arguments and calling init_environment(). args = aidegen_main.main(sys.argv... | the_stack_v2_python_sparse | tools/asuite/aidegen/lib/project_config.py | ZYHGOD-1/Aosp11 | train | 0 |
8cf674751267d44cf351aceabd5876b3ab491a2a | [
"if x < 0:\n return False\nx_reversed = self.reverse_num(x)\nreturn x == x_reversed",
"reversed = 0\nwhile x > 0:\n reversed += x % 10\n x //= 10\n reversed *= 10\nreturn reversed // 10"
] | <|body_start_0|>
if x < 0:
return False
x_reversed = self.reverse_num(x)
return x == x_reversed
<|end_body_0|>
<|body_start_1|>
reversed = 0
while x > 0:
reversed += x % 10
x //= 10
reversed *= 10
return reversed // 10
<|en... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isPalindrome(self, x: int) -> bool:
"""(Solution, int) -> bool Return True iff x is a palindrome. A negative number is not a palindrome. >>> soln = Solution() >>> soln.isPalindrome(121) True >>> soln.isPalindrome(-121) False >>> soln.isPalindrome(10) False"""
<|body... | stack_v2_sparse_classes_36k_train_010938 | 1,923 | no_license | [
{
"docstring": "(Solution, int) -> bool Return True iff x is a palindrome. A negative number is not a palindrome. >>> soln = Solution() >>> soln.isPalindrome(121) True >>> soln.isPalindrome(-121) False >>> soln.isPalindrome(10) False",
"name": "isPalindrome",
"signature": "def isPalindrome(self, x: int)... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isPalindrome(self, x: int) -> bool: (Solution, int) -> bool Return True iff x is a palindrome. A negative number is not a palindrome. >>> soln = Solution() >>> soln.isPalindr... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isPalindrome(self, x: int) -> bool: (Solution, int) -> bool Return True iff x is a palindrome. A negative number is not a palindrome. >>> soln = Solution() >>> soln.isPalindr... | 6812253b90bdd5a35c6bfba8eac54da9be26d56c | <|skeleton|>
class Solution:
def isPalindrome(self, x: int) -> bool:
"""(Solution, int) -> bool Return True iff x is a palindrome. A negative number is not a palindrome. >>> soln = Solution() >>> soln.isPalindrome(121) True >>> soln.isPalindrome(-121) False >>> soln.isPalindrome(10) False"""
<|body... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def isPalindrome(self, x: int) -> bool:
"""(Solution, int) -> bool Return True iff x is a palindrome. A negative number is not a palindrome. >>> soln = Solution() >>> soln.isPalindrome(121) True >>> soln.isPalindrome(-121) False >>> soln.isPalindrome(10) False"""
if x < 0:
... | the_stack_v2_python_sparse | python3/palindromeNum.py | yichuanma95/leetcode-solns | train | 2 | |
15f9d452e064101b1fde0c39eefa8b647d11f618 | [
"silent_cfg_names_map = None\nif LooseVersion(self.version) < LooseVersion('2013_sp1'):\n silent_cfg_names_map = {'activation_name': ACTIVATION_NAME_2012, 'license_file_name': LICENSE_FILE_NAME_2012}\nsuper(EB_icc, self).install_step(silent_cfg_names_map=silent_cfg_names_map)",
"binprefix = 'bin/intel64'\nlibp... | <|body_start_0|>
silent_cfg_names_map = None
if LooseVersion(self.version) < LooseVersion('2013_sp1'):
silent_cfg_names_map = {'activation_name': ACTIVATION_NAME_2012, 'license_file_name': LICENSE_FILE_NAME_2012}
super(EB_icc, self).install_step(silent_cfg_names_map=silent_cfg_names_... | Support for installing icc - tested with 11.1.046 - will fail for all older versions (due to newer silent installer) | EB_icc | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EB_icc:
"""Support for installing icc - tested with 11.1.046 - will fail for all older versions (due to newer silent installer)"""
def install_step(self):
"""Actual installation - create silent cfg file - execute command"""
<|body_0|>
def sanity_check_step(self):
... | stack_v2_sparse_classes_36k_train_010939 | 5,994 | no_license | [
{
"docstring": "Actual installation - create silent cfg file - execute command",
"name": "install_step",
"signature": "def install_step(self)"
},
{
"docstring": "Custom sanity check paths for icc.",
"name": "sanity_check_step",
"signature": "def sanity_check_step(self)"
},
{
"doc... | 4 | stack_v2_sparse_classes_30k_train_008539 | Implement the Python class `EB_icc` described below.
Class description:
Support for installing icc - tested with 11.1.046 - will fail for all older versions (due to newer silent installer)
Method signatures and docstrings:
- def install_step(self): Actual installation - create silent cfg file - execute command
- def ... | Implement the Python class `EB_icc` described below.
Class description:
Support for installing icc - tested with 11.1.046 - will fail for all older versions (due to newer silent installer)
Method signatures and docstrings:
- def install_step(self): Actual installation - create silent cfg file - execute command
- def ... | 3c5434f9a4193fbe4cf8107327faadda83d798ae | <|skeleton|>
class EB_icc:
"""Support for installing icc - tested with 11.1.046 - will fail for all older versions (due to newer silent installer)"""
def install_step(self):
"""Actual installation - create silent cfg file - execute command"""
<|body_0|>
def sanity_check_step(self):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EB_icc:
"""Support for installing icc - tested with 11.1.046 - will fail for all older versions (due to newer silent installer)"""
def install_step(self):
"""Actual installation - create silent cfg file - execute command"""
silent_cfg_names_map = None
if LooseVersion(self.version)... | the_stack_v2_python_sparse | 1.11.1/easyblock/easyblocks/i/icc.py | lsuhpchelp/easybuild_smic | train | 0 |
2e4fc1df6c8477fca0febcc0652485ae5da19d34 | [
"if not username or not password:\n logger.error('Attempted to authenticate HTTP Digest user without supplying either a username or password parameter! This may be a bug in Review Board. Please report it.')\n return None\nusername = username.strip()\nfilename = settings.DIGEST_FILE_LOCATION\ndigest_text = '%s... | <|body_start_0|>
if not username or not password:
logger.error('Attempted to authenticate HTTP Digest user without supplying either a username or password parameter! This may be a bug in Review Board. Please report it.')
return None
username = username.strip()
filename = ... | Authenticate against a user in a digest password file. This is controlled by the following Django settings: .. setting:: DIGEST_FILE_LOCATION ``DIGEST_FILE_LOCATION``: The local file path on the server containing an HTTP password (:file:`htpasswd`) file. This is ``auth_digest_file_location`` in the site configuration. ... | HTTPDigestBackend | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HTTPDigestBackend:
"""Authenticate against a user in a digest password file. This is controlled by the following Django settings: .. setting:: DIGEST_FILE_LOCATION ``DIGEST_FILE_LOCATION``: The local file path on the server containing an HTTP password (:file:`htpasswd`) file. This is ``auth_diges... | stack_v2_sparse_classes_36k_train_010940 | 5,413 | permissive | [
{
"docstring": "Authenticate a user against the HTTP password file. This will attempt to authenticate the user against the digest password file. If the username and password are valid, a user will be returned, and added to the database if it doesn't already exist. Version Changed: 6.0: * ``request`` is now opti... | 2 | null | Implement the Python class `HTTPDigestBackend` described below.
Class description:
Authenticate against a user in a digest password file. This is controlled by the following Django settings: .. setting:: DIGEST_FILE_LOCATION ``DIGEST_FILE_LOCATION``: The local file path on the server containing an HTTP password (:file... | Implement the Python class `HTTPDigestBackend` described below.
Class description:
Authenticate against a user in a digest password file. This is controlled by the following Django settings: .. setting:: DIGEST_FILE_LOCATION ``DIGEST_FILE_LOCATION``: The local file path on the server containing an HTTP password (:file... | c3a991f1e9d7682239a1ab0e8661cee6da01d537 | <|skeleton|>
class HTTPDigestBackend:
"""Authenticate against a user in a digest password file. This is controlled by the following Django settings: .. setting:: DIGEST_FILE_LOCATION ``DIGEST_FILE_LOCATION``: The local file path on the server containing an HTTP password (:file:`htpasswd`) file. This is ``auth_diges... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HTTPDigestBackend:
"""Authenticate against a user in a digest password file. This is controlled by the following Django settings: .. setting:: DIGEST_FILE_LOCATION ``DIGEST_FILE_LOCATION``: The local file path on the server containing an HTTP password (:file:`htpasswd`) file. This is ``auth_digest_file_locati... | the_stack_v2_python_sparse | reviewboard/accounts/backends/http_digest.py | reviewboard/reviewboard | train | 1,141 |
17444676425aa38fa2ba6e1826514c1bad11e7ec | [
"self.functions = functions\nself.cutoffs = cutoffs\nif len(functions) != len(cutoffs) + 1:\n raise InconsistentValueError('len(functions)', 'len(cutoffs)', len(functions), len(cutoffs), 'there should be one more function that cutoff.')",
"for function, cutoff in zip(self.functions, self.cutoffs):\n if x < ... | <|body_start_0|>
self.functions = functions
self.cutoffs = cutoffs
if len(functions) != len(cutoffs) + 1:
raise InconsistentValueError('len(functions)', 'len(cutoffs)', len(functions), len(cutoffs), 'there should be one more function that cutoff.')
<|end_body_0|>
<|body_start_1|>
... | Implementation of DistributionFunction that describes a piecewise distribution. | PiecewiseDistributionFunction | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PiecewiseDistributionFunction:
"""Implementation of DistributionFunction that describes a piecewise distribution."""
def __init__(self, functions, cutoffs):
"""Constructs a new PiecewiseDistributionFunction. A PiecewiseDistributionFunction describes a function that behaves differentl... | stack_v2_sparse_classes_36k_train_010941 | 13,051 | no_license | [
{
"docstring": "Constructs a new PiecewiseDistributionFunction. A PiecewiseDistributionFunction describes a function that behaves differently depending on where in the domain we look. The value returned by self.get_value(x) will func.get_value(x) where func is functions[-1] if x > cutoffs[-1], otherwise functio... | 3 | null | Implement the Python class `PiecewiseDistributionFunction` described below.
Class description:
Implementation of DistributionFunction that describes a piecewise distribution.
Method signatures and docstrings:
- def __init__(self, functions, cutoffs): Constructs a new PiecewiseDistributionFunction. A PiecewiseDistribu... | Implement the Python class `PiecewiseDistributionFunction` described below.
Class description:
Implementation of DistributionFunction that describes a piecewise distribution.
Method signatures and docstrings:
- def __init__(self, functions, cutoffs): Constructs a new PiecewiseDistributionFunction. A PiecewiseDistribu... | eb413191f865968f6d6e76292bca09a94e08bef7 | <|skeleton|>
class PiecewiseDistributionFunction:
"""Implementation of DistributionFunction that describes a piecewise distribution."""
def __init__(self, functions, cutoffs):
"""Constructs a new PiecewiseDistributionFunction. A PiecewiseDistributionFunction describes a function that behaves differentl... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PiecewiseDistributionFunction:
"""Implementation of DistributionFunction that describes a piecewise distribution."""
def __init__(self, functions, cutoffs):
"""Constructs a new PiecewiseDistributionFunction. A PiecewiseDistributionFunction describes a function that behaves differently depending o... | the_stack_v2_python_sparse | mbfit/utils/distribution_function/distribution_function.py | agoetz/MB-Fit | train | 1 |
2b87bdb7e046bea0f67f39bf64152ee972a4f9de | [
"args2 = []\nfor arg in args:\n if isinstance(arg, str) or (isinstance(arg, list) and arg[0] in ('!', '|', '&')):\n args2.append(arg)\n continue\n if arg[0] in ['tender_call_supplier', 'supplier_call_tender']:\n arg[0] = 'id'\n ids = []\n if arg[-1] and isinstance(arg[-1], l... | <|body_start_0|>
args2 = []
for arg in args:
if isinstance(arg, str) or (isinstance(arg, list) and arg[0] in ('!', '|', '&')):
args2.append(arg)
continue
if arg[0] in ['tender_call_supplier', 'supplier_call_tender']:
arg[0] = 'id'
... | res_partner | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class res_partner:
def compute_tender_call_domain_args(self, args):
"""Domaine des partenaires afin de n'afficher que ceux qui ont été sélectionnés dans l'appel d'offre"""
<|body_0|>
def search(self, args=None, offset=0, limit=None, order=None, count=None):
"""Fonction sea... | stack_v2_sparse_classes_36k_train_010942 | 30,862 | no_license | [
{
"docstring": "Domaine des partenaires afin de n'afficher que ceux qui ont été sélectionnés dans l'appel d'offre",
"name": "compute_tender_call_domain_args",
"signature": "def compute_tender_call_domain_args(self, args)"
},
{
"docstring": "Fonction search des partenaires",
"name": "search",... | 2 | null | Implement the Python class `res_partner` described below.
Class description:
Implement the res_partner class.
Method signatures and docstrings:
- def compute_tender_call_domain_args(self, args): Domaine des partenaires afin de n'afficher que ceux qui ont été sélectionnés dans l'appel d'offre
- def search(self, args=N... | Implement the Python class `res_partner` described below.
Class description:
Implement the res_partner class.
Method signatures and docstrings:
- def compute_tender_call_domain_args(self, args): Domaine des partenaires afin de n'afficher que ceux qui ont été sélectionnés dans l'appel d'offre
- def search(self, args=N... | eb394e1f79ba1995da2dcd81adfdd511c22caff9 | <|skeleton|>
class res_partner:
def compute_tender_call_domain_args(self, args):
"""Domaine des partenaires afin de n'afficher que ceux qui ont été sélectionnés dans l'appel d'offre"""
<|body_0|>
def search(self, args=None, offset=0, limit=None, order=None, count=None):
"""Fonction sea... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class res_partner:
def compute_tender_call_domain_args(self, args):
"""Domaine des partenaires afin de n'afficher que ceux qui ont été sélectionnés dans l'appel d'offre"""
args2 = []
for arg in args:
if isinstance(arg, str) or (isinstance(arg, list) and arg[0] in ('!', '|', '&'))... | the_stack_v2_python_sparse | OpenPROD/openprod-addons/call_tender/call_tender.py | kazacube-mziouadi/ceci | train | 0 | |
4924dfc0bd70d24198126be8eaa0209b859a2696 | [
"from mitre.securingai.restapi.models import Experiment\n\ndef slugify(text: str) -> str:\n return text.lower().strip().replace(' ', '-')\nstandardized_name: str = slugify(field.data)\nif Experiment.query.filter_by(name=standardized_name, is_deleted=False).first() is None:\n raise ValidationError(f'Bad Reques... | <|body_start_0|>
from mitre.securingai.restapi.models import Experiment
def slugify(text: str) -> str:
return text.lower().strip().replace(' ', '-')
standardized_name: str = slugify(field.data)
if Experiment.query.filter_by(name=standardized_name, is_deleted=False).first() i... | The job submission form. Attributes: experiment_name: The name of a registered experiment. queue: The name of an active queue. timeout: The maximum alloted time for a job before it times out and is stopped. If omitted, the job timeout will default to 24 hours. entry_point: The name of the entry point in the MLproject f... | JobForm | [
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JobForm:
"""The job submission form. Attributes: experiment_name: The name of a registered experiment. queue: The name of an active queue. timeout: The maximum alloted time for a job before it times out and is stopped. If omitted, the job timeout will default to 24 hours. entry_point: The name of... | stack_v2_sparse_classes_36k_train_010943 | 10,183 | permissive | [
{
"docstring": "Validates that the experiment is registered and not deleted. Args: field: The form field for `experiment_name`.",
"name": "validate_experiment_name",
"signature": "def validate_experiment_name(self, field)"
},
{
"docstring": "Validates that the queue is registered, active and not... | 2 | stack_v2_sparse_classes_30k_train_005621 | Implement the Python class `JobForm` described below.
Class description:
The job submission form. Attributes: experiment_name: The name of a registered experiment. queue: The name of an active queue. timeout: The maximum alloted time for a job before it times out and is stopped. If omitted, the job timeout will defaul... | Implement the Python class `JobForm` described below.
Class description:
The job submission form. Attributes: experiment_name: The name of a registered experiment. queue: The name of an active queue. timeout: The maximum alloted time for a job before it times out and is stopped. If omitted, the job timeout will defaul... | 639940e64e0a92fbcb7ec7f6588d0dfaaf9f0b1d | <|skeleton|>
class JobForm:
"""The job submission form. Attributes: experiment_name: The name of a registered experiment. queue: The name of an active queue. timeout: The maximum alloted time for a job before it times out and is stopped. If omitted, the job timeout will default to 24 hours. entry_point: The name of... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class JobForm:
"""The job submission form. Attributes: experiment_name: The name of a registered experiment. queue: The name of an active queue. timeout: The maximum alloted time for a job before it times out and is stopped. If omitted, the job timeout will default to 24 hours. entry_point: The name of the entry po... | the_stack_v2_python_sparse | src/mitre/securingai/restapi/job/model.py | hhuangMITRE/dioptra | train | 0 |
659e76d7cc15a90d9bf1c77124d5ccd7c88c70d6 | [
"self.endpoint = endpoint\nself.private_key = private_key\nself.contract_address = contract_address\nself.endpoint.connect()\nself.acc = self.endpoint.web3.eth.account.from_key(self.private_key)\nself.contract = self.endpoint.web3.eth.contract(self.contract_address, abi=tellor_playground_abi)",
"nonce = self.cont... | <|body_start_0|>
self.endpoint = endpoint
self.private_key = private_key
self.contract_address = contract_address
self.endpoint.connect()
self.acc = self.endpoint.web3.eth.account.from_key(self.private_key)
self.contract = self.endpoint.web3.eth.contract(self.contract_add... | Submits BTC on testnet. Submits BTC price data in USD to the TellorX playground on the Rinkeby test network. | Submitter | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Submitter:
"""Submits BTC on testnet. Submits BTC price data in USD to the TellorX playground on the Rinkeby test network."""
def __init__(self, endpoint: RPCEndpoint, private_key: str, contract_address: str, abi: Sequence[Mapping[str, Any]]) -> None:
"""Reads user private key and no... | stack_v2_sparse_classes_36k_train_010944 | 3,467 | permissive | [
{
"docstring": "Reads user private key and node endpoint from `.env` file to set up `Web3` client for interacting with the TellorX playground smart contract.",
"name": "__init__",
"signature": "def __init__(self, endpoint: RPCEndpoint, private_key: str, contract_address: str, abi: Sequence[Mapping[str, ... | 3 | stack_v2_sparse_classes_30k_train_000076 | Implement the Python class `Submitter` described below.
Class description:
Submits BTC on testnet. Submits BTC price data in USD to the TellorX playground on the Rinkeby test network.
Method signatures and docstrings:
- def __init__(self, endpoint: RPCEndpoint, private_key: str, contract_address: str, abi: Sequence[M... | Implement the Python class `Submitter` described below.
Class description:
Submits BTC on testnet. Submits BTC price data in USD to the TellorX playground on the Rinkeby test network.
Method signatures and docstrings:
- def __init__(self, endpoint: RPCEndpoint, private_key: str, contract_address: str, abi: Sequence[M... | 8c62c206897a2b14aea39331d75b160161e7efd6 | <|skeleton|>
class Submitter:
"""Submits BTC on testnet. Submits BTC price data in USD to the TellorX playground on the Rinkeby test network."""
def __init__(self, endpoint: RPCEndpoint, private_key: str, contract_address: str, abi: Sequence[Mapping[str, Any]]) -> None:
"""Reads user private key and no... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Submitter:
"""Submits BTC on testnet. Submits BTC price data in USD to the TellorX playground on the Rinkeby test network."""
def __init__(self, endpoint: RPCEndpoint, private_key: str, contract_address: str, abi: Sequence[Mapping[str, Any]]) -> None:
"""Reads user private key and node endpoint f... | the_stack_v2_python_sparse | src/telliot/submitter/base.py | imaginebeingatcomputers/pytelliot | train | 0 |
a90cecb701a31ab1ca98757f4f608f116f3d9316 | [
"if n == 0:\n return 0\nt0 = 0\nt1 = 1\nt2 = 1\nfor i in range(0, n - 2):\n t0, t1, t2 = (t1, t2, t0 + t1 + t2)\nreturn t2",
"if n == 0:\n return 0\nif n == 1 or n == 2:\n return 1\nm = [[1, 1, 1], [1, 0, 0], [0, 1, 0]]\nans = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]\nk = n - 2\nwhile k:\n if k & 1:\n ... | <|body_start_0|>
if n == 0:
return 0
t0 = 0
t1 = 1
t2 = 1
for i in range(0, n - 2):
t0, t1, t2 = (t1, t2, t0 + t1 + t2)
return t2
<|end_body_0|>
<|body_start_1|>
if n == 0:
return 0
if n == 1 or n == 2:
retu... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def tribonacci(self, n: int) -> int:
"""动态规划法 :param n: :return:"""
<|body_0|>
def tribonacci2(self, n: int) -> int:
"""矩阵快速幂算法,参考 https://leetcode-cn.com/circle/article/8uRHgu/ :param n: :return:"""
<|body_1|>
def matrix_mltiply(self, m, n):
... | stack_v2_sparse_classes_36k_train_010945 | 1,664 | no_license | [
{
"docstring": "动态规划法 :param n: :return:",
"name": "tribonacci",
"signature": "def tribonacci(self, n: int) -> int"
},
{
"docstring": "矩阵快速幂算法,参考 https://leetcode-cn.com/circle/article/8uRHgu/ :param n: :return:",
"name": "tribonacci2",
"signature": "def tribonacci2(self, n: int) -> int"... | 3 | stack_v2_sparse_classes_30k_train_006715 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def tribonacci(self, n: int) -> int: 动态规划法 :param n: :return:
- def tribonacci2(self, n: int) -> int: 矩阵快速幂算法,参考 https://leetcode-cn.com/circle/article/8uRHgu/ :param n: :return:... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def tribonacci(self, n: int) -> int: 动态规划法 :param n: :return:
- def tribonacci2(self, n: int) -> int: 矩阵快速幂算法,参考 https://leetcode-cn.com/circle/article/8uRHgu/ :param n: :return:... | 19d55737ffe1bc4813c9bae95f636fd227b57346 | <|skeleton|>
class Solution:
def tribonacci(self, n: int) -> int:
"""动态规划法 :param n: :return:"""
<|body_0|>
def tribonacci2(self, n: int) -> int:
"""矩阵快速幂算法,参考 https://leetcode-cn.com/circle/article/8uRHgu/ :param n: :return:"""
<|body_1|>
def matrix_mltiply(self, m, n):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def tribonacci(self, n: int) -> int:
"""动态规划法 :param n: :return:"""
if n == 0:
return 0
t0 = 0
t1 = 1
t2 = 1
for i in range(0, n - 2):
t0, t1, t2 = (t1, t2, t0 + t1 + t2)
return t2
def tribonacci2(self, n: int) -> i... | the_stack_v2_python_sparse | dynamic/tribonacci.py | originalMemory/algorithmPython | train | 0 | |
5b36f06d50dff9aaf385698d12895458086fce17 | [
"file_contents = '# Blink API owners are responsible for ...\\n#\\n# See https://www.chromium.org/blink#new-features for details.\\nowner1@example.com\\nowner2@example.com\\nowner3@example.com\\n\\n'\nencoded = base64.b64encode(file_contents.encode())\nmock_get.return_value = testing_config.Blank(status_code=200, c... | <|body_start_0|>
file_contents = '# Blink API owners are responsible for ...\n#\n# See https://www.chromium.org/blink#new-features for details.\nowner1@example.com\nowner2@example.com\nowner3@example.com\n\n'
encoded = base64.b64encode(file_contents.encode())
mock_get.return_value = testing_conf... | FetchOwnersTest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FetchOwnersTest:
def test__normal(self, mock_get):
"""We can fetch and parse an OWNERS file. And reuse cached value."""
<|body_0|>
def test__error(self, mock_get, mock_err):
"""If we can't read the OWNER file, raise an exception."""
<|body_1|>
<|end_skeleton... | stack_v2_sparse_classes_36k_train_010946 | 18,561 | permissive | [
{
"docstring": "We can fetch and parse an OWNERS file. And reuse cached value.",
"name": "test__normal",
"signature": "def test__normal(self, mock_get)"
},
{
"docstring": "If we can't read the OWNER file, raise an exception.",
"name": "test__error",
"signature": "def test__error(self, mo... | 2 | null | Implement the Python class `FetchOwnersTest` described below.
Class description:
Implement the FetchOwnersTest class.
Method signatures and docstrings:
- def test__normal(self, mock_get): We can fetch and parse an OWNERS file. And reuse cached value.
- def test__error(self, mock_get, mock_err): If we can't read the O... | Implement the Python class `FetchOwnersTest` described below.
Class description:
Implement the FetchOwnersTest class.
Method signatures and docstrings:
- def test__normal(self, mock_get): We can fetch and parse an OWNERS file. And reuse cached value.
- def test__error(self, mock_get, mock_err): If we can't read the O... | 17f9886d064da5bda84006d5866077727646fff2 | <|skeleton|>
class FetchOwnersTest:
def test__normal(self, mock_get):
"""We can fetch and parse an OWNERS file. And reuse cached value."""
<|body_0|>
def test__error(self, mock_get, mock_err):
"""If we can't read the OWNER file, raise an exception."""
<|body_1|>
<|end_skeleton... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FetchOwnersTest:
def test__normal(self, mock_get):
"""We can fetch and parse an OWNERS file. And reuse cached value."""
file_contents = '# Blink API owners are responsible for ...\n#\n# See https://www.chromium.org/blink#new-features for details.\nowner1@example.com\nowner2@example.com\nowner3... | the_stack_v2_python_sparse | internals/approval_defs_test.py | GoogleChrome/chromium-dashboard | train | 574 | |
1327a25e3eae0a349688b1d10620a282c3f28424 | [
"self.driver = get_driver()\nself.login_driver = LoginPage.login(self.driver)\nyield\nself.driver.quit()",
"service_page = ServicesPage(self.login_driver)\nservice_page.enter_create()\naz_list = [{'可用分区名称': '38KVM', '镜像': ['cirros_xen'], '配置列表': [('配置1', '1', '1')], '应用列表': ['tomcat'], '磁盘服务': 'zhh云硬盘服务'}, {'可用分区... | <|body_start_0|>
self.driver = get_driver()
self.login_driver = LoginPage.login(self.driver)
yield
self.driver.quit()
<|end_body_0|>
<|body_start_1|>
service_page = ServicesPage(self.login_driver)
service_page.enter_create()
az_list = [{'可用分区名称': '38KVM', '镜像': [... | 服务管理case | TestService | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestService:
"""服务管理case"""
def init(self):
"""获取和退出浏览器"""
<|body_0|>
def test_create_vm(self, init):
"""创建云主机服务"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.driver = get_driver()
self.login_driver = LoginPage.login(self.driver)
... | stack_v2_sparse_classes_36k_train_010947 | 2,162 | no_license | [
{
"docstring": "获取和退出浏览器",
"name": "init",
"signature": "def init(self)"
},
{
"docstring": "创建云主机服务",
"name": "test_create_vm",
"signature": "def test_create_vm(self, init)"
}
] | 2 | stack_v2_sparse_classes_30k_train_021588 | Implement the Python class `TestService` described below.
Class description:
服务管理case
Method signatures and docstrings:
- def init(self): 获取和退出浏览器
- def test_create_vm(self, init): 创建云主机服务 | Implement the Python class `TestService` described below.
Class description:
服务管理case
Method signatures and docstrings:
- def init(self): 获取和退出浏览器
- def test_create_vm(self, init): 创建云主机服务
<|skeleton|>
class TestService:
"""服务管理case"""
def init(self):
"""获取和退出浏览器"""
<|body_0|>
def test_... | 65f4315987443903b87e0764f36e8d6b5c9bbc0d | <|skeleton|>
class TestService:
"""服务管理case"""
def init(self):
"""获取和退出浏览器"""
<|body_0|>
def test_create_vm(self, init):
"""创建云主机服务"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestService:
"""服务管理case"""
def init(self):
"""获取和退出浏览器"""
self.driver = get_driver()
self.login_driver = LoginPage.login(self.driver)
yield
self.driver.quit()
def test_create_vm(self, init):
"""创建云主机服务"""
service_page = ServicesPage(self.login... | the_stack_v2_python_sparse | workspace/testcase/test_service.py | haiya2016/pytest-CSC | train | 0 |
156b8e8d0514351b9a8cfa17116d8c256e5a9a78 | [
"num_of_samples = container.shape[0]\nif 12 <= num_of_samples < 20:\n window_size = 3\nelif 20 <= num_of_samples < 50:\n window_size = 6\nelif 50 <= num_of_samples < 120:\n window_size = 12\nelif 120 <= num_of_samples < 300:\n window_size = 30\nelif 300 <= num_of_samples < 500:\n window_size = 75\nel... | <|body_start_0|>
num_of_samples = container.shape[0]
if 12 <= num_of_samples < 20:
window_size = 3
elif 20 <= num_of_samples < 50:
window_size = 6
elif 50 <= num_of_samples < 120:
window_size = 12
elif 120 <= num_of_samples < 300:
w... | Class for estimating parameters of rolling windows. | RollingWindowsEstimator | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RollingWindowsEstimator:
"""Class for estimating parameters of rolling windows."""
def estimate_rolling_window_size(cls, container: Union[QFDataFrame, QFSeries]) -> int:
"""Estimates the size of the rolling window based on the number of samples. Parameters ---------- container contai... | stack_v2_sparse_classes_36k_train_010948 | 2,801 | permissive | [
{
"docstring": "Estimates the size of the rolling window based on the number of samples. Parameters ---------- container container with data analysed using rolling window Returns ------- window_size the calculated size of the rolling window",
"name": "estimate_rolling_window_size",
"signature": "def est... | 2 | stack_v2_sparse_classes_30k_train_006911 | Implement the Python class `RollingWindowsEstimator` described below.
Class description:
Class for estimating parameters of rolling windows.
Method signatures and docstrings:
- def estimate_rolling_window_size(cls, container: Union[QFDataFrame, QFSeries]) -> int: Estimates the size of the rolling window based on the ... | Implement the Python class `RollingWindowsEstimator` described below.
Class description:
Class for estimating parameters of rolling windows.
Method signatures and docstrings:
- def estimate_rolling_window_size(cls, container: Union[QFDataFrame, QFSeries]) -> int: Estimates the size of the rolling window based on the ... | f707e51bc2ff45f6e46dcdd24d59d83ce7dc4f94 | <|skeleton|>
class RollingWindowsEstimator:
"""Class for estimating parameters of rolling windows."""
def estimate_rolling_window_size(cls, container: Union[QFDataFrame, QFSeries]) -> int:
"""Estimates the size of the rolling window based on the number of samples. Parameters ---------- container contai... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RollingWindowsEstimator:
"""Class for estimating parameters of rolling windows."""
def estimate_rolling_window_size(cls, container: Union[QFDataFrame, QFSeries]) -> int:
"""Estimates the size of the rolling window based on the number of samples. Parameters ---------- container container with data... | the_stack_v2_python_sparse | qf_lib/common/utils/factorization/data_models/rolling_window_estimation.py | quarkfin/qf-lib | train | 379 |
42e91eefdf8259dff980748fbd4ee4c6839dd70d | [
"self.debug = debug\nself.rules_registry = rules_registry\nif self.debug:\n print('ProfileLoader - init' + lineno())",
"if self.debug:\n print('load' + lineno())\n print('vars: ' + str(vars(profile_definition)) + lineno())\nif not profile_definition:\n raise ParserError('Empty profile')\nnew_profile =... | <|body_start_0|>
self.debug = debug
self.rules_registry = rules_registry
if self.debug:
print('ProfileLoader - init' + lineno())
<|end_body_0|>
<|body_start_1|>
if self.debug:
print('load' + lineno())
print('vars: ' + str(vars(profile_definition)) + l... | Profile loader | ProfileLoader | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProfileLoader:
"""Profile loader"""
def __init__(self, rules_registry, debug=False):
"""Initialize the ProfileLoader :param rules_registry: :param debug:"""
<|body_0|>
def load(self, profile_definition):
"""Load rules from a profile definition :param profile_defi... | stack_v2_sparse_classes_36k_train_010949 | 3,196 | permissive | [
{
"docstring": "Initialize the ProfileLoader :param rules_registry: :param debug:",
"name": "__init__",
"signature": "def __init__(self, rules_registry, debug=False)"
},
{
"docstring": "Load rules from a profile definition :param profile_definition: :return:",
"name": "load",
"signature"... | 5 | null | Implement the Python class `ProfileLoader` described below.
Class description:
Profile loader
Method signatures and docstrings:
- def __init__(self, rules_registry, debug=False): Initialize the ProfileLoader :param rules_registry: :param debug:
- def load(self, profile_definition): Load rules from a profile definitio... | Implement the Python class `ProfileLoader` described below.
Class description:
Profile loader
Method signatures and docstrings:
- def __init__(self, rules_registry, debug=False): Initialize the ProfileLoader :param rules_registry: :param debug:
- def load(self, profile_definition): Load rules from a profile definitio... | a9d0335a532acdb4070e5537155b03b34915b73e | <|skeleton|>
class ProfileLoader:
"""Profile loader"""
def __init__(self, rules_registry, debug=False):
"""Initialize the ProfileLoader :param rules_registry: :param debug:"""
<|body_0|>
def load(self, profile_definition):
"""Load rules from a profile definition :param profile_defi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProfileLoader:
"""Profile loader"""
def __init__(self, rules_registry, debug=False):
"""Initialize the ProfileLoader :param rules_registry: :param debug:"""
self.debug = debug
self.rules_registry = rules_registry
if self.debug:
print('ProfileLoader - init' + li... | the_stack_v2_python_sparse | terraform_validator/ProfileLoader.py | rubelw/terraform-validator | train | 7 |
3f590307c4e50d1541efba93db3325a8e347bd33 | [
"exist_networks = self.os_conn.list_networks()['networks']\next_network = [x for x in exist_networks if x.get('router:external')][0]\nself.zone = self.os_conn.nova.availability_zones.find(zoneName='nova')\nself.hosts = self.zone.hosts.keys()\nself.instance_keypair = self.os_conn.create_key(key_name='instancekey')\n... | <|body_start_0|>
exist_networks = self.os_conn.list_networks()['networks']
ext_network = [x for x in exist_networks if x.get('router:external')][0]
self.zone = self.os_conn.nova.availability_zones.find(zoneName='nova')
self.hosts = self.zone.hosts.keys()
self.instance_keypair = s... | TestOVSRestartsOneNetwork | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestOVSRestartsOneNetwork:
def _prepare_openstack(self):
"""Prepare OpenStack for scenarios run Steps: 1. Create network1 2. Create router1 and connect it with network1 and external net 3. Boot vm1 in network1 and associate floating ip 4. Boot vm2 in network2 5. Add rules for ping 6. pin... | stack_v2_sparse_classes_36k_train_010950 | 41,546 | no_license | [
{
"docstring": "Prepare OpenStack for scenarios run Steps: 1. Create network1 2. Create router1 and connect it with network1 and external net 3. Boot vm1 in network1 and associate floating ip 4. Boot vm2 in network2 5. Add rules for ping 6. ping 8.8.8.8 from vm2 7. ping vm1 from vm2 and vm1 from vm2",
"name... | 2 | stack_v2_sparse_classes_30k_train_016085 | Implement the Python class `TestOVSRestartsOneNetwork` described below.
Class description:
Implement the TestOVSRestartsOneNetwork class.
Method signatures and docstrings:
- def _prepare_openstack(self): Prepare OpenStack for scenarios run Steps: 1. Create network1 2. Create router1 and connect it with network1 and e... | Implement the Python class `TestOVSRestartsOneNetwork` described below.
Class description:
Implement the TestOVSRestartsOneNetwork class.
Method signatures and docstrings:
- def _prepare_openstack(self): Prepare OpenStack for scenarios run Steps: 1. Create network1 2. Create router1 and connect it with network1 and e... | 8aced2855b78b5f123195d188c80e27b43888a2e | <|skeleton|>
class TestOVSRestartsOneNetwork:
def _prepare_openstack(self):
"""Prepare OpenStack for scenarios run Steps: 1. Create network1 2. Create router1 and connect it with network1 and external net 3. Boot vm1 in network1 and associate floating ip 4. Boot vm2 in network2 5. Add rules for ping 6. pin... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestOVSRestartsOneNetwork:
def _prepare_openstack(self):
"""Prepare OpenStack for scenarios run Steps: 1. Create network1 2. Create router1 and connect it with network1 and external net 3. Boot vm1 in network1 and associate floating ip 4. Boot vm2 in network2 5. Add rules for ping 6. ping 8.8.8.8 from... | the_stack_v2_python_sparse | mos_tests/neutron/python_tests/test_ovs_restart.py | Mirantis/mos-integration-tests | train | 16 | |
ba5b4781e62679d8b2608528a9f9bcd02f6a6e50 | [
"if not root:\n return 0\ndepth = list(map(self.minDepth, (root.left, root.right)))\nreturn 1 + (min(depth) or max(depth))",
"if not root:\n return 0\nmin_depth, stack = (0, deque([(1, root)]))\nwhile stack:\n min_depth, root = stack.pop()\n if root:\n if not (root.left or root.right):\n ... | <|body_start_0|>
if not root:
return 0
depth = list(map(self.minDepth, (root.left, root.right)))
return 1 + (min(depth) or max(depth))
<|end_body_0|>
<|body_start_1|>
if not root:
return 0
min_depth, stack = (0, deque([(1, root)]))
while stack:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minDepth1(self, root: TreeNode) -> int:
"""DFS 优雅的光头哥"""
<|body_0|>
def minDepth(self, root: TreeNode) -> int:
"""用deque效率会不会好点"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not root:
return 0
depth = list(map(... | stack_v2_sparse_classes_36k_train_010951 | 1,186 | no_license | [
{
"docstring": "DFS 优雅的光头哥",
"name": "minDepth1",
"signature": "def minDepth1(self, root: TreeNode) -> int"
},
{
"docstring": "用deque效率会不会好点",
"name": "minDepth",
"signature": "def minDepth(self, root: TreeNode) -> int"
}
] | 2 | stack_v2_sparse_classes_30k_train_013002 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minDepth1(self, root: TreeNode) -> int: DFS 优雅的光头哥
- def minDepth(self, root: TreeNode) -> int: 用deque效率会不会好点 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minDepth1(self, root: TreeNode) -> int: DFS 优雅的光头哥
- def minDepth(self, root: TreeNode) -> int: 用deque效率会不会好点
<|skeleton|>
class Solution:
def minDepth1(self, root: Tre... | bc895124817aa1341d15ac85e1c6d670a9420dec | <|skeleton|>
class Solution:
def minDepth1(self, root: TreeNode) -> int:
"""DFS 优雅的光头哥"""
<|body_0|>
def minDepth(self, root: TreeNode) -> int:
"""用deque效率会不会好点"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def minDepth1(self, root: TreeNode) -> int:
"""DFS 优雅的光头哥"""
if not root:
return 0
depth = list(map(self.minDepth, (root.left, root.right)))
return 1 + (min(depth) or max(depth))
def minDepth(self, root: TreeNode) -> int:
"""用deque效率会不会好点"""
... | the_stack_v2_python_sparse | leetcode/111MinimumDepthOfBinaryTree.py | qilaidi/leetcode_problems | train | 0 | |
404c365ca76351cc003db56b9be4e101cc26bc70 | [
"self.translate_proxy_addr = 'ws://' + translate_host + ':' + translate_port + '/' + translate_path\nself.tokenizer = Tokenizer({'lowercase': True, 'moses_escape': True})\nself.preprocess = preprocess_cmd\nself.postprocess = postprocess_cmd",
"dodetok = _convert_boolean(task.get('detokenize', ''), True)\ndotok = ... | <|body_start_0|>
self.translate_proxy_addr = 'ws://' + translate_host + ':' + translate_port + '/' + translate_path
self.tokenizer = Tokenizer({'lowercase': True, 'moses_escape': True})
self.preprocess = preprocess_cmd
self.postprocess = postprocess_cmd
<|end_body_0|>
<|body_start_1|>
... | Handles the 'translate' task for MTMonkeyWorkers using Moses XML-RPC servers and built-in segmentation, tokenization, and detokenization. | MarianTranslator | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MarianTranslator:
"""Handles the 'translate' task for MTMonkeyWorkers using Moses XML-RPC servers and built-in segmentation, tokenization, and detokenization."""
def __init__(self, translate_host, translate_port, translate_path, source_lang, target_lang, preprocess_cmd, postprocess_cmd):
... | stack_v2_sparse_classes_36k_train_010952 | 4,971 | permissive | [
{
"docstring": "Initialize a MosesTranslator object according to the given configuration settings. @param translate_port: the port at which the Moses translator operates @param recase_port: the port at which the recaser operates @param source_lang: source language (ISO-639-1 ID) @param target_lang: target langu... | 3 | stack_v2_sparse_classes_30k_train_000461 | Implement the Python class `MarianTranslator` described below.
Class description:
Handles the 'translate' task for MTMonkeyWorkers using Moses XML-RPC servers and built-in segmentation, tokenization, and detokenization.
Method signatures and docstrings:
- def __init__(self, translate_host, translate_port, translate_p... | Implement the Python class `MarianTranslator` described below.
Class description:
Handles the 'translate' task for MTMonkeyWorkers using Moses XML-RPC servers and built-in segmentation, tokenization, and detokenization.
Method signatures and docstrings:
- def __init__(self, translate_host, translate_port, translate_p... | fcc78d62e1fa145b1c5c5782fbf0aa625bad761a | <|skeleton|>
class MarianTranslator:
"""Handles the 'translate' task for MTMonkeyWorkers using Moses XML-RPC servers and built-in segmentation, tokenization, and detokenization."""
def __init__(self, translate_host, translate_port, translate_path, source_lang, target_lang, preprocess_cmd, postprocess_cmd):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MarianTranslator:
"""Handles the 'translate' task for MTMonkeyWorkers using Moses XML-RPC servers and built-in segmentation, tokenization, and detokenization."""
def __init__(self, translate_host, translate_port, translate_path, source_lang, target_lang, preprocess_cmd, postprocess_cmd):
"""Initi... | the_stack_v2_python_sparse | worker/src/tasks/marian_translate.py | ufal/mtmonkey | train | 32 |
bf32540dffb5eb5aae65074f232bb4e3bc3e726b | [
"assert 'nvars' in cparams\nassert 'cs' in cparams\nassert 'cadv' in cparams\nassert 'order_adv' in cparams\nassert 'multiscale' in cparams\nfor k, v in cparams.items():\n setattr(self, k, v)\nsuper(acoustic_1d_imex, self).__init__(self.nvars, dtype_u, dtype_f)\nself.mesh = np.linspace(0.0, 1.0, self.nvars[1], e... | <|body_start_0|>
assert 'nvars' in cparams
assert 'cs' in cparams
assert 'cadv' in cparams
assert 'order_adv' in cparams
assert 'multiscale' in cparams
for k, v in cparams.items():
setattr(self, k, v)
super(acoustic_1d_imex, self).__init__(self.nvars, ... | Example implementing the forced 1D heat equation with Dirichlet-0 BC in [0,1] Attributes: solver: Sharpclaw solver state: Sharclaw state domain: Sharpclaw domain | acoustic_1d_imex | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class acoustic_1d_imex:
"""Example implementing the forced 1D heat equation with Dirichlet-0 BC in [0,1] Attributes: solver: Sharpclaw solver state: Sharclaw state domain: Sharpclaw domain"""
def __init__(self, cparams, dtype_u, dtype_f):
"""Initialization routine Args: cparams: custom par... | stack_v2_sparse_classes_36k_train_010953 | 4,640 | permissive | [
{
"docstring": "Initialization routine Args: cparams: custom parameters for the example dtype_u: particle data type (will be passed parent class) dtype_f: acceleration data type (will be passed parent class)",
"name": "__init__",
"signature": "def __init__(self, cparams, dtype_u, dtype_f)"
},
{
... | 6 | null | Implement the Python class `acoustic_1d_imex` described below.
Class description:
Example implementing the forced 1D heat equation with Dirichlet-0 BC in [0,1] Attributes: solver: Sharpclaw solver state: Sharclaw state domain: Sharpclaw domain
Method signatures and docstrings:
- def __init__(self, cparams, dtype_u, d... | Implement the Python class `acoustic_1d_imex` described below.
Class description:
Example implementing the forced 1D heat equation with Dirichlet-0 BC in [0,1] Attributes: solver: Sharpclaw solver state: Sharclaw state domain: Sharpclaw domain
Method signatures and docstrings:
- def __init__(self, cparams, dtype_u, d... | 1a51834bedffd4472e344bed28f4d766614b1537 | <|skeleton|>
class acoustic_1d_imex:
"""Example implementing the forced 1D heat equation with Dirichlet-0 BC in [0,1] Attributes: solver: Sharpclaw solver state: Sharclaw state domain: Sharpclaw domain"""
def __init__(self, cparams, dtype_u, dtype_f):
"""Initialization routine Args: cparams: custom par... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class acoustic_1d_imex:
"""Example implementing the forced 1D heat equation with Dirichlet-0 BC in [0,1] Attributes: solver: Sharpclaw solver state: Sharclaw state domain: Sharpclaw domain"""
def __init__(self, cparams, dtype_u, dtype_f):
"""Initialization routine Args: cparams: custom parameters for t... | the_stack_v2_python_sparse | pySDC/playgrounds/deprecated/acoustic_1d_imex/ProblemClass_multiscale.py | Parallel-in-Time/pySDC | train | 30 |
95e53c99e3077602c8adb551ccd832927332399b | [
"if not people:\n return -1\nres = 0\npeople.sort()\nstart = 0\nend = len(people) - 1\nwhile start <= end:\n s = people[start]\n e = people[end]\n if s + e <= limit:\n start += 1\n end -= 1\n res += 1\nreturn res",
"if not people:\n return -1\nres = 0\nfor p in people:\n max_p = max... | <|body_start_0|>
if not people:
return -1
res = 0
people.sort()
start = 0
end = len(people) - 1
while start <= end:
s = people[start]
e = people[end]
if s + e <= limit:
start += 1
end -= 1
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def numRescueBoats(self, people, limit):
""":type people: List[int] :type limit: int :rtype: int 算法 先把数组排序 令 people[i] 指向当前最轻的人,而 people[j] 指向最重的那位。 然后,如上所述,如果最重的人可以与最轻的人共用一条船(即 people[j] + people[i] <= limit),那么就这样做;否则,最重的人自己独自坐在船上。"""
<|body_0|>
def numRescueBoat... | stack_v2_sparse_classes_36k_train_010954 | 2,207 | no_license | [
{
"docstring": ":type people: List[int] :type limit: int :rtype: int 算法 先把数组排序 令 people[i] 指向当前最轻的人,而 people[j] 指向最重的那位。 然后,如上所述,如果最重的人可以与最轻的人共用一条船(即 people[j] + people[i] <= limit),那么就这样做;否则,最重的人自己独自坐在船上。",
"name": "numRescueBoats",
"signature": "def numRescueBoats(self, people, limit)"
},
{
"d... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numRescueBoats(self, people, limit): :type people: List[int] :type limit: int :rtype: int 算法 先把数组排序 令 people[i] 指向当前最轻的人,而 people[j] 指向最重的那位。 然后,如上所述,如果最重的人可以与最轻的人共用一条船(即 peo... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numRescueBoats(self, people, limit): :type people: List[int] :type limit: int :rtype: int 算法 先把数组排序 令 people[i] 指向当前最轻的人,而 people[j] 指向最重的那位。 然后,如上所述,如果最重的人可以与最轻的人共用一条船(即 peo... | a3a1556abc5adb9325de54d64f9814e64b96db0f | <|skeleton|>
class Solution:
def numRescueBoats(self, people, limit):
""":type people: List[int] :type limit: int :rtype: int 算法 先把数组排序 令 people[i] 指向当前最轻的人,而 people[j] 指向最重的那位。 然后,如上所述,如果最重的人可以与最轻的人共用一条船(即 people[j] + people[i] <= limit),那么就这样做;否则,最重的人自己独自坐在船上。"""
<|body_0|>
def numRescueBoat... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def numRescueBoats(self, people, limit):
""":type people: List[int] :type limit: int :rtype: int 算法 先把数组排序 令 people[i] 指向当前最轻的人,而 people[j] 指向最重的那位。 然后,如上所述,如果最重的人可以与最轻的人共用一条船(即 people[j] + people[i] <= limit),那么就这样做;否则,最重的人自己独自坐在船上。"""
if not people:
return -1
re... | the_stack_v2_python_sparse | leetcode/numRescueBoats.py | BigerWANG/geek_algorithm | train | 0 | |
d940e1ef644fdf8c16cf526da914e615149da224 | [
"if self.value is None:\n return None\nelse:\n return self.value * 180.0 / np.pi",
"if degree_val is None:\n self.value = None\nelse:\n self.value = degree_val * np.pi / 180.0"
] | <|body_start_0|>
if self.value is None:
return None
else:
return self.value * 180.0 / np.pi
<|end_body_0|>
<|body_start_1|>
if degree_val is None:
self.value = None
else:
self.value = degree_val * np.pi / 180.0
<|end_body_1|>
| Subclass of UVParameter for Angle type parameters. Adds extra methods for conversion to & from degrees (used by UVBase objects for _degrees properties associated with these parameters). Parameters ---------- name : str The name of the attribute. Used as the associated property name in classes based on UVBase. required ... | AngleParameter | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AngleParameter:
"""Subclass of UVParameter for Angle type parameters. Adds extra methods for conversion to & from degrees (used by UVBase objects for _degrees properties associated with these parameters). Parameters ---------- name : str The name of the attribute. Used as the associated property ... | stack_v2_sparse_classes_36k_train_010955 | 42,209 | permissive | [
{
"docstring": "Get value in degrees.",
"name": "degrees",
"signature": "def degrees(self)"
},
{
"docstring": "Set value in degrees. Parameters ---------- degree_val : float Value in degrees to use to set the value attribute.",
"name": "set_degrees",
"signature": "def set_degrees(self, d... | 2 | stack_v2_sparse_classes_30k_test_000957 | Implement the Python class `AngleParameter` described below.
Class description:
Subclass of UVParameter for Angle type parameters. Adds extra methods for conversion to & from degrees (used by UVBase objects for _degrees properties associated with these parameters). Parameters ---------- name : str The name of the attr... | Implement the Python class `AngleParameter` described below.
Class description:
Subclass of UVParameter for Angle type parameters. Adds extra methods for conversion to & from degrees (used by UVBase objects for _degrees properties associated with these parameters). Parameters ---------- name : str The name of the attr... | 4ff6808aabd330c9ad33985fc74a9f42cae5920a | <|skeleton|>
class AngleParameter:
"""Subclass of UVParameter for Angle type parameters. Adds extra methods for conversion to & from degrees (used by UVBase objects for _degrees properties associated with these parameters). Parameters ---------- name : str The name of the attribute. Used as the associated property ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AngleParameter:
"""Subclass of UVParameter for Angle type parameters. Adds extra methods for conversion to & from degrees (used by UVBase objects for _degrees properties associated with these parameters). Parameters ---------- name : str The name of the attribute. Used as the associated property name in class... | the_stack_v2_python_sparse | pyuvdata/parameter.py | RadioAstronomySoftwareGroup/pyuvdata | train | 58 |
1d725c2f8dc8632c5a3e0dfb6280aadf508a9fbe | [
"from collections import deque\nself.size = size\nself.windowLen = 0\nself.windowSum = 0\nself.windowQue = deque()",
"self.windowLen += 1\nself.windowQue.append(val)\nself.windowSum += val\nif self.windowLen > self.size:\n self.windowLen -= 1\n self.windowSum -= self.windowQue.popleft()\nreturn float(self.w... | <|body_start_0|>
from collections import deque
self.size = size
self.windowLen = 0
self.windowSum = 0
self.windowQue = deque()
<|end_body_0|>
<|body_start_1|>
self.windowLen += 1
self.windowQue.append(val)
self.windowSum += val
if self.windowLen >... | MovingAverage | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MovingAverage:
def __init__(self, size):
"""Initialize your data structure here. :type size: int"""
<|body_0|>
def next(self, val):
""":type val: int :rtype: float"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
from collections import deque
... | stack_v2_sparse_classes_36k_train_010956 | 808 | no_license | [
{
"docstring": "Initialize your data structure here. :type size: int",
"name": "__init__",
"signature": "def __init__(self, size)"
},
{
"docstring": ":type val: int :rtype: float",
"name": "next",
"signature": "def next(self, val)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007725 | Implement the Python class `MovingAverage` described below.
Class description:
Implement the MovingAverage class.
Method signatures and docstrings:
- def __init__(self, size): Initialize your data structure here. :type size: int
- def next(self, val): :type val: int :rtype: float | Implement the Python class `MovingAverage` described below.
Class description:
Implement the MovingAverage class.
Method signatures and docstrings:
- def __init__(self, size): Initialize your data structure here. :type size: int
- def next(self, val): :type val: int :rtype: float
<|skeleton|>
class MovingAverage:
... | 6e051eb554d9cf6f424f1e0a77f3072adf7f64c4 | <|skeleton|>
class MovingAverage:
def __init__(self, size):
"""Initialize your data structure here. :type size: int"""
<|body_0|>
def next(self, val):
""":type val: int :rtype: float"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MovingAverage:
def __init__(self, size):
"""Initialize your data structure here. :type size: int"""
from collections import deque
self.size = size
self.windowLen = 0
self.windowSum = 0
self.windowQue = deque()
def next(self, val):
""":type val: int ... | the_stack_v2_python_sparse | 346. Moving Average from Data Stream.py | vincent-kangzhou/LeetCode-Python | train | 0 | |
b45c54f00a29c74ae5f76c572052b7f80c19fa3e | [
"self.attack = attack\nself.x_test = x_test\nself.y_test = y_test\nself.source_class = source_class\nself.target_class = target_class\nself.trigger_index = trigger_index\nself.data_filepath = data_filepath",
"if len(x_train) != len(y_train):\n raise ValueError('Sizes of x and y do not match')\nif None in self.... | <|body_start_0|>
self.attack = attack
self.x_test = x_test
self.y_test = y_test
self.source_class = source_class
self.target_class = target_class
self.trigger_index = trigger_index
self.data_filepath = data_filepath
<|end_body_0|>
<|body_start_1|>
if len(... | DatasetPoisonerWitchesBrew | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DatasetPoisonerWitchesBrew:
def __init__(self, attack, x_test, y_test, source_class, target_class, trigger_index, data_filepath):
"""Individual source-class triggers are chosen from x_test. At poison time, the train set is modified to induce misclassification of the triggers as target_cl... | stack_v2_sparse_classes_36k_train_010957 | 18,241 | permissive | [
{
"docstring": "Individual source-class triggers are chosen from x_test. At poison time, the train set is modified to induce misclassification of the triggers as target_class.",
"name": "__init__",
"signature": "def __init__(self, attack, x_test, y_test, source_class, target_class, trigger_index, data_f... | 2 | stack_v2_sparse_classes_30k_train_017512 | Implement the Python class `DatasetPoisonerWitchesBrew` described below.
Class description:
Implement the DatasetPoisonerWitchesBrew class.
Method signatures and docstrings:
- def __init__(self, attack, x_test, y_test, source_class, target_class, trigger_index, data_filepath): Individual source-class triggers are cho... | Implement the Python class `DatasetPoisonerWitchesBrew` described below.
Class description:
Implement the DatasetPoisonerWitchesBrew class.
Method signatures and docstrings:
- def __init__(self, attack, x_test, y_test, source_class, target_class, trigger_index, data_filepath): Individual source-class triggers are cho... | 3efd21652cfdc8cd192681e9daf58a4b08e82db4 | <|skeleton|>
class DatasetPoisonerWitchesBrew:
def __init__(self, attack, x_test, y_test, source_class, target_class, trigger_index, data_filepath):
"""Individual source-class triggers are chosen from x_test. At poison time, the train set is modified to induce misclassification of the triggers as target_cl... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DatasetPoisonerWitchesBrew:
def __init__(self, attack, x_test, y_test, source_class, target_class, trigger_index, data_filepath):
"""Individual source-class triggers are chosen from x_test. At poison time, the train set is modified to induce misclassification of the triggers as target_class."""
... | the_stack_v2_python_sparse | armory/scenarios/poisoning_witches_brew.py | twosixlabs/armory | train | 153 | |
8dcc3baccc3c3c0ee09ff4cb2ece986542565f06 | [
"self.q1 = queue.deque()\nself.q2 = queue.deque()\nself.last = None",
"if self.last is None:\n self.last = x\n return\nself.q1.append(self.last)\nself.last = x",
"if self.last:\n temp = self.last\n self.last = None\n return temp\nwhile len(self.q1) > 1:\n self.q2.append(self.q1.popleft())\nsel... | <|body_start_0|>
self.q1 = queue.deque()
self.q2 = queue.deque()
self.last = None
<|end_body_0|>
<|body_start_1|>
if self.last is None:
self.last = x
return
self.q1.append(self.last)
self.last = x
<|end_body_1|>
<|body_start_2|>
if self.l... | MyStack | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyStack:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def push(self, x: int) -> None:
"""Push element x onto stack."""
<|body_1|>
def pop(self) -> int:
"""Removes the element on top of the stack and returns that eleme... | stack_v2_sparse_classes_36k_train_010958 | 1,590 | no_license | [
{
"docstring": "Initialize your data structure here.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Push element x onto stack.",
"name": "push",
"signature": "def push(self, x: int) -> None"
},
{
"docstring": "Removes the element on top of the stack an... | 5 | null | Implement the Python class `MyStack` described below.
Class description:
Implement the MyStack class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def push(self, x: int) -> None: Push element x onto stack.
- def pop(self) -> int: Removes the element on top of the stac... | Implement the Python class `MyStack` described below.
Class description:
Implement the MyStack class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def push(self, x: int) -> None: Push element x onto stack.
- def pop(self) -> int: Removes the element on top of the stac... | c82d375f8d9d4feeaba243eb5c990c1ba3ec73d2 | <|skeleton|>
class MyStack:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def push(self, x: int) -> None:
"""Push element x onto stack."""
<|body_1|>
def pop(self) -> int:
"""Removes the element on top of the stack and returns that eleme... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MyStack:
def __init__(self):
"""Initialize your data structure here."""
self.q1 = queue.deque()
self.q2 = queue.deque()
self.last = None
def push(self, x: int) -> None:
"""Push element x onto stack."""
if self.last is None:
self.last = x
... | the_stack_v2_python_sparse | 225_MyStack.py | 0as1s/leetcode | train | 0 | |
398cc0464ae134b189eb486282ad073a23f3e85b | [
"stack = []\nif not head:\n return head\nwhile head:\n stack.append(head.val)\n head = head.next\ncur = ListNode(stack.pop())\nres = cur\nwhile stack:\n res.next = ListNode(stack.pop())\n res = res.next\nreturn cur",
"pre = head\ncur = None\nwhile pre:\n t = pre.next\n pre.next = cur\n cur... | <|body_start_0|>
stack = []
if not head:
return head
while head:
stack.append(head.val)
head = head.next
cur = ListNode(stack.pop())
res = cur
while stack:
res.next = ListNode(stack.pop())
res = res.next
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def reverseList(self, head):
"""最渣渣的单指针,但是需要堆栈做值存储,其实没有改变之前的链表 :param head: :return:"""
<|body_0|>
def reverseList_2(self, head):
"""双指针 pre 和 cur,pre者把pre.next指向cur,每次向前移动 :param head: :return:"""
<|body_1|>
def reverseList_2(self, head):
... | stack_v2_sparse_classes_36k_train_010959 | 2,497 | no_license | [
{
"docstring": "最渣渣的单指针,但是需要堆栈做值存储,其实没有改变之前的链表 :param head: :return:",
"name": "reverseList",
"signature": "def reverseList(self, head)"
},
{
"docstring": "双指针 pre 和 cur,pre者把pre.next指向cur,每次向前移动 :param head: :return:",
"name": "reverseList_2",
"signature": "def reverseList_2(self, head)... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverseList(self, head): 最渣渣的单指针,但是需要堆栈做值存储,其实没有改变之前的链表 :param head: :return:
- def reverseList_2(self, head): 双指针 pre 和 cur,pre者把pre.next指向cur,每次向前移动 :param head: :return:
-... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverseList(self, head): 最渣渣的单指针,但是需要堆栈做值存储,其实没有改变之前的链表 :param head: :return:
- def reverseList_2(self, head): 双指针 pre 和 cur,pre者把pre.next指向cur,每次向前移动 :param head: :return:
-... | e12ead66d28175d34b51eac4ccdd6de06eb4d92d | <|skeleton|>
class Solution:
def reverseList(self, head):
"""最渣渣的单指针,但是需要堆栈做值存储,其实没有改变之前的链表 :param head: :return:"""
<|body_0|>
def reverseList_2(self, head):
"""双指针 pre 和 cur,pre者把pre.next指向cur,每次向前移动 :param head: :return:"""
<|body_1|>
def reverseList_2(self, head):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def reverseList(self, head):
"""最渣渣的单指针,但是需要堆栈做值存储,其实没有改变之前的链表 :param head: :return:"""
stack = []
if not head:
return head
while head:
stack.append(head.val)
head = head.next
cur = ListNode(stack.pop())
res = cur
... | the_stack_v2_python_sparse | ListNode_24_reverseList.py | zhenglinghan/leetcode_jianzhi_Offer | train | 2 | |
d1f2df7098596232a0f05e2aed5ddd3027b94ccc | [
"if not root:\n return 'X'\nleft = self.serialize(root.left)\nright = self.serialize(root.right)\nreturn str(root.val) + ',' + left + ',' + right",
"data_lst = data.split(',')\nroot = self.build_tree(data_lst)\nreturn root",
"root_val = data_lst.pop(0)\nif root_val == 'X':\n return None\nroot = TreeNode(r... | <|body_start_0|>
if not root:
return 'X'
left = self.serialize(root.left)
right = self.serialize(root.right)
return str(root.val) + ',' + left + ',' + right
<|end_body_0|>
<|body_start_1|>
data_lst = data.split(',')
root = self.build_tree(data_lst)
re... | 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|>
def build_tree(self, ... | stack_v2_sparse_classes_36k_train_010960 | 1,247 | 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... | 3 | null | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :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:... | a75310a96d2b165b15d5ee10ec409a17cdc880ba | <|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|>
def build_tree(self, ... | 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"""
if not root:
return 'X'
left = self.serialize(root.left)
right = self.serialize(root.right)
return str(root.val) + ',' + left + ',' + right
def d... | the_stack_v2_python_sparse | leetcode/tree/code/sz.py | skyxyz-lang/CS_Note | train | 0 | |
aa97a846ddb2d59e07ed7fcd8bff805b59b50010 | [
"menu_item.MenuItem.__init__(self, main_menu, frame)\nself.create_menu_item_button('New Challenge')\nself.menu_item_button['command'] = self.get_new_challenge_window",
"self.gui.active_window.hide()\nself.associated_window = start_challenge_window.StartChallengeWindow(self.gui)\nself.gui.active_window = self.asso... | <|body_start_0|>
menu_item.MenuItem.__init__(self, main_menu, frame)
self.create_menu_item_button('New Challenge')
self.menu_item_button['command'] = self.get_new_challenge_window
<|end_body_0|>
<|body_start_1|>
self.gui.active_window.hide()
self.associated_window = start_challe... | This class is used to create a button that will bring the user to the new challenge menu. | NewChallengeMenuItem | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NewChallengeMenuItem:
"""This class is used to create a button that will bring the user to the new challenge menu."""
def __init__(self, main_menu, frame):
"""Args: main_menu ([]): this class must know about the main menu because it knows about the GUI, and we need to alter the GUI's... | stack_v2_sparse_classes_36k_train_010961 | 1,081 | no_license | [
{
"docstring": "Args: main_menu ([]): this class must know about the main menu because it knows about the GUI, and we need to alter the GUI's active window",
"name": "__init__",
"signature": "def __init__(self, main_menu, frame)"
},
{
"docstring": "This function will hide everything on the activ... | 2 | stack_v2_sparse_classes_30k_train_011939 | Implement the Python class `NewChallengeMenuItem` described below.
Class description:
This class is used to create a button that will bring the user to the new challenge menu.
Method signatures and docstrings:
- def __init__(self, main_menu, frame): Args: main_menu ([]): this class must know about the main menu becau... | Implement the Python class `NewChallengeMenuItem` described below.
Class description:
This class is used to create a button that will bring the user to the new challenge menu.
Method signatures and docstrings:
- def __init__(self, main_menu, frame): Args: main_menu ([]): this class must know about the main menu becau... | e26d9450b98fa0f372bcdf6eaf251a2c9dcba44e | <|skeleton|>
class NewChallengeMenuItem:
"""This class is used to create a button that will bring the user to the new challenge menu."""
def __init__(self, main_menu, frame):
"""Args: main_menu ([]): this class must know about the main menu because it knows about the GUI, and we need to alter the GUI's... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NewChallengeMenuItem:
"""This class is used to create a button that will bring the user to the new challenge menu."""
def __init__(self, main_menu, frame):
"""Args: main_menu ([]): this class must know about the main menu because it knows about the GUI, and we need to alter the GUI's active windo... | the_stack_v2_python_sparse | user_interface/menu_items/new_challenge_menu_item.py | pucheng-tan/WordFlow | train | 0 |
1e55d11f7f6251f54d630d3c1c092b78cc24c576 | [
"kwargs = {}\nkwargs.setdefault('method', 'POST')\nkwargs.setdefault('url', '/ime-container/imeKittingManage/bomKitting.action')\nkwargs.setdefault('data', data)\nreq = nr(**kwargs)\nreturn req",
"kwargs = {}\nkwargs.setdefault('method', 'POST')\nkwargs.setdefault('url', '/ime-container/imeKittingManage/routLineK... | <|body_start_0|>
kwargs = {}
kwargs.setdefault('method', 'POST')
kwargs.setdefault('url', '/ime-container/imeKittingManage/bomKitting.action')
kwargs.setdefault('data', data)
req = nr(**kwargs)
return req
<|end_body_0|>
<|body_start_1|>
kwargs = {}
kwargs... | 齐套类 | Kitting | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Kitting:
"""齐套类"""
def kitting_bom(self, data):
"""BOM齐套接口 :param data: :return:"""
<|body_0|>
def kitting_routeLine(self, data):
"""工艺齐套接口 :param data: :return:"""
<|body_1|>
def kitting_material(self, data):
"""物料齐套接口 :param data: :return:"... | stack_v2_sparse_classes_36k_train_010962 | 5,334 | no_license | [
{
"docstring": "BOM齐套接口 :param data: :return:",
"name": "kitting_bom",
"signature": "def kitting_bom(self, data)"
},
{
"docstring": "工艺齐套接口 :param data: :return:",
"name": "kitting_routeLine",
"signature": "def kitting_routeLine(self, data)"
},
{
"docstring": "物料齐套接口 :param data:... | 6 | stack_v2_sparse_classes_30k_val_000020 | Implement the Python class `Kitting` described below.
Class description:
齐套类
Method signatures and docstrings:
- def kitting_bom(self, data): BOM齐套接口 :param data: :return:
- def kitting_routeLine(self, data): 工艺齐套接口 :param data: :return:
- def kitting_material(self, data): 物料齐套接口 :param data: :return:
- def kitting_q... | Implement the Python class `Kitting` described below.
Class description:
齐套类
Method signatures and docstrings:
- def kitting_bom(self, data): BOM齐套接口 :param data: :return:
- def kitting_routeLine(self, data): 工艺齐套接口 :param data: :return:
- def kitting_material(self, data): 物料齐套接口 :param data: :return:
- def kitting_q... | 2c3b0f5667c9526130a57c5ce2f0865e8f97302f | <|skeleton|>
class Kitting:
"""齐套类"""
def kitting_bom(self, data):
"""BOM齐套接口 :param data: :return:"""
<|body_0|>
def kitting_routeLine(self, data):
"""工艺齐套接口 :param data: :return:"""
<|body_1|>
def kitting_material(self, data):
"""物料齐套接口 :param data: :return:"... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Kitting:
"""齐套类"""
def kitting_bom(self, data):
"""BOM齐套接口 :param data: :return:"""
kwargs = {}
kwargs.setdefault('method', 'POST')
kwargs.setdefault('url', '/ime-container/imeKittingManage/bomKitting.action')
kwargs.setdefault('data', data)
req = nr(**kwar... | the_stack_v2_python_sparse | 测试用例/接口自动化/接口自动化_V2/接口管理/生产管理/齐套.py | liuzhengxing/NeuSoftEEP_API_Test | train | 0 |
577eb196c3276f295ebedc1f5c19e609252708f6 | [
"collection = self._get_collection()\nserializer = serializers.CollectionSerializer(collection, context={'request': request})\nreturn Response(serializer.data)",
"pk = self.kwargs.get('pk', None)\nns_name = self.kwargs.get('namespace', None)\nname = self.kwargs.get('name', None)\nif pk:\n return get_object_or_... | <|body_start_0|>
collection = self._get_collection()
serializer = serializers.CollectionSerializer(collection, context={'request': request})
return Response(serializer.data)
<|end_body_0|>
<|body_start_1|>
pk = self.kwargs.get('pk', None)
ns_name = self.kwargs.get('namespace', N... | CollectionDetailView | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CollectionDetailView:
def get(self, request, *args, **kwargs):
"""Return a collection."""
<|body_0|>
def _get_collection(self):
"""Get collection from either id, or namespace and name."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
collection = sel... | stack_v2_sparse_classes_36k_train_010963 | 9,693 | permissive | [
{
"docstring": "Return a collection.",
"name": "get",
"signature": "def get(self, request, *args, **kwargs)"
},
{
"docstring": "Get collection from either id, or namespace and name.",
"name": "_get_collection",
"signature": "def _get_collection(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006437 | Implement the Python class `CollectionDetailView` described below.
Class description:
Implement the CollectionDetailView class.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Return a collection.
- def _get_collection(self): Get collection from either id, or namespace and name. | Implement the Python class `CollectionDetailView` described below.
Class description:
Implement the CollectionDetailView class.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Return a collection.
- def _get_collection(self): Get collection from either id, or namespace and name.
<|skelet... | 6a374cacdf0f04de94486913bba5285e24e178d3 | <|skeleton|>
class CollectionDetailView:
def get(self, request, *args, **kwargs):
"""Return a collection."""
<|body_0|>
def _get_collection(self):
"""Get collection from either id, or namespace and name."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CollectionDetailView:
def get(self, request, *args, **kwargs):
"""Return a collection."""
collection = self._get_collection()
serializer = serializers.CollectionSerializer(collection, context={'request': request})
return Response(serializer.data)
def _get_collection(self):... | the_stack_v2_python_sparse | galaxy/api/v2/views/collection.py | ansible/galaxy | train | 972 | |
a85891022c8cdfd09669a63e385ea4605b86089b | [
"database.clear_all()\nimport_test_one = database.import_data(PATH, 'DNE_products.csv', 'DNE_customers.csv', 'DNE_rentals.csv')\nimport_test_two = database.import_data(PATH, 'products.csv', 'customers.csv', 'rentals.csv')\nself.assertEqual(list(import_test_one), [(0, 0, 0), (1, 1, 1)])\nself.assertEqual(list(import... | <|body_start_0|>
database.clear_all()
import_test_one = database.import_data(PATH, 'DNE_products.csv', 'DNE_customers.csv', 'DNE_rentals.csv')
import_test_two = database.import_data(PATH, 'products.csv', 'customers.csv', 'rentals.csv')
self.assertEqual(list(import_test_one), [(0, 0, 0), ... | test the basic functions in database.py | TestDatabase | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestDatabase:
"""test the basic functions in database.py"""
def test_import_data(self):
"""Test import_data function"""
<|body_0|>
def test_show_available_products(self):
"""Test show_available_products function"""
<|body_1|>
def test_show_rentals(se... | stack_v2_sparse_classes_36k_train_010964 | 3,319 | no_license | [
{
"docstring": "Test import_data function",
"name": "test_import_data",
"signature": "def test_import_data(self)"
},
{
"docstring": "Test show_available_products function",
"name": "test_show_available_products",
"signature": "def test_show_available_products(self)"
},
{
"docstri... | 3 | null | Implement the Python class `TestDatabase` described below.
Class description:
test the basic functions in database.py
Method signatures and docstrings:
- def test_import_data(self): Test import_data function
- def test_show_available_products(self): Test show_available_products function
- def test_show_rentals(self):... | Implement the Python class `TestDatabase` described below.
Class description:
test the basic functions in database.py
Method signatures and docstrings:
- def test_import_data(self): Test import_data function
- def test_show_available_products(self): Test show_available_products function
- def test_show_rentals(self):... | 5dac60f39e3909ff05b26721d602ed20f14d6be3 | <|skeleton|>
class TestDatabase:
"""test the basic functions in database.py"""
def test_import_data(self):
"""Test import_data function"""
<|body_0|>
def test_show_available_products(self):
"""Test show_available_products function"""
<|body_1|>
def test_show_rentals(se... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestDatabase:
"""test the basic functions in database.py"""
def test_import_data(self):
"""Test import_data function"""
database.clear_all()
import_test_one = database.import_data(PATH, 'DNE_products.csv', 'DNE_customers.csv', 'DNE_rentals.csv')
import_test_two = database.... | the_stack_v2_python_sparse | students/chelsea_nayan/lesson05/test_database.py | JavaRod/SP_Python220B_2019 | train | 1 |
47921352b292566538139f7103437ecc181235c5 | [
"threading.Thread.__init__(self)\nself.__sockDictionary = {}\nself.__sockets = []\nself.timeout = 0.1\nself.running = True\nself.daemon = True",
"if sock not in self.__sockets:\n self.__sockets.append(sock)\nself.__sockDictionary[sock] = manager\noutput.dbg('Adding ' + str(sock) + ' to select list', self.__cla... | <|body_start_0|>
threading.Thread.__init__(self)
self.__sockDictionary = {}
self.__sockets = []
self.timeout = 0.1
self.running = True
self.daemon = True
<|end_body_0|>
<|body_start_1|>
if sock not in self.__sockets:
self.__sockets.append(sock)
... | Receiver for messages Stores connections and poll them for messages @author ykk @date Oct 2010 | receivethread | [
"LicenseRef-scancode-x11-stanford"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class receivethread:
"""Receiver for messages Stores connections and poll them for messages @author ykk @date Oct 2010"""
def __init__(self):
"""Initialize"""
<|body_0|>
def addconnection(self, sock, manager):
"""Add socket and manager"""
<|body_1|>
def re... | stack_v2_sparse_classes_36k_train_010965 | 4,453 | permissive | [
{
"docstring": "Initialize",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Add socket and manager",
"name": "addconnection",
"signature": "def addconnection(self, sock, manager)"
},
{
"docstring": "Remove socket",
"name": "removeconnection",
"si... | 5 | null | Implement the Python class `receivethread` described below.
Class description:
Receiver for messages Stores connections and poll them for messages @author ykk @date Oct 2010
Method signatures and docstrings:
- def __init__(self): Initialize
- def addconnection(self, sock, manager): Add socket and manager
- def remove... | Implement the Python class `receivethread` described below.
Class description:
Receiver for messages Stores connections and poll them for messages @author ykk @date Oct 2010
Method signatures and docstrings:
- def __init__(self): Initialize
- def addconnection(self, sock, manager): Add socket and manager
- def remove... | c3f5a31b74d5587671329eea9582ac8aed0c58a4 | <|skeleton|>
class receivethread:
"""Receiver for messages Stores connections and poll them for messages @author ykk @date Oct 2010"""
def __init__(self):
"""Initialize"""
<|body_0|>
def addconnection(self, sock, manager):
"""Add socket and manager"""
<|body_1|>
def re... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class receivethread:
"""Receiver for messages Stores connections and poll them for messages @author ykk @date Oct 2010"""
def __init__(self):
"""Initialize"""
threading.Thread.__init__(self)
self.__sockDictionary = {}
self.__sockets = []
self.timeout = 0.1
self.r... | the_stack_v2_python_sparse | yapc/comm/core.py | yapkke/yapc | train | 1 |
0101cb4e170a8d168a24134fee231c0d44274d44 | [
"LOG.debug('Plug or unplug networks for amphora id: %s', amphora[constants.ID])\nif not delta:\n LOG.debug('No network deltas for amphora id: %s', amphora[constants.ID])\n return\nfor nic in delta[constants.ADD_NICS]:\n self.network_driver.plug_network(amphora[constants.COMPUTE_ID], nic[constants.NETWORK_I... | <|body_start_0|>
LOG.debug('Plug or unplug networks for amphora id: %s', amphora[constants.ID])
if not delta:
LOG.debug('No network deltas for amphora id: %s', amphora[constants.ID])
return
for nic in delta[constants.ADD_NICS]:
self.network_driver.plug_network... | Task to plug the networks. This uses the delta to add all missing networks/nics | PlugNetworks | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PlugNetworks:
"""Task to plug the networks. This uses the delta to add all missing networks/nics"""
def execute(self, amphora, delta):
"""Update the amphora networks for the delta."""
<|body_0|>
def revert(self, amphora, delta, *args, **kwargs):
"""Handle a faile... | stack_v2_sparse_classes_36k_train_010966 | 44,034 | permissive | [
{
"docstring": "Update the amphora networks for the delta.",
"name": "execute",
"signature": "def execute(self, amphora, delta)"
},
{
"docstring": "Handle a failed network plug by removing all nics added.",
"name": "revert",
"signature": "def revert(self, amphora, delta, *args, **kwargs)... | 2 | stack_v2_sparse_classes_30k_train_006223 | Implement the Python class `PlugNetworks` described below.
Class description:
Task to plug the networks. This uses the delta to add all missing networks/nics
Method signatures and docstrings:
- def execute(self, amphora, delta): Update the amphora networks for the delta.
- def revert(self, amphora, delta, *args, **kw... | Implement the Python class `PlugNetworks` described below.
Class description:
Task to plug the networks. This uses the delta to add all missing networks/nics
Method signatures and docstrings:
- def execute(self, amphora, delta): Update the amphora networks for the delta.
- def revert(self, amphora, delta, *args, **kw... | 0426285a41464a5015494584f109eed35a0d44db | <|skeleton|>
class PlugNetworks:
"""Task to plug the networks. This uses the delta to add all missing networks/nics"""
def execute(self, amphora, delta):
"""Update the amphora networks for the delta."""
<|body_0|>
def revert(self, amphora, delta, *args, **kwargs):
"""Handle a faile... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PlugNetworks:
"""Task to plug the networks. This uses the delta to add all missing networks/nics"""
def execute(self, amphora, delta):
"""Update the amphora networks for the delta."""
LOG.debug('Plug or unplug networks for amphora id: %s', amphora[constants.ID])
if not delta:
... | the_stack_v2_python_sparse | octavia/controller/worker/v2/tasks/network_tasks.py | openstack/octavia | train | 147 |
1756ea43dc98dc035a6c13be858c9d6390111b92 | [
"from math import sqrt\nself.min_instances = min_instances\nself.drift_level = float(drift_level)\nself.i = None\nself.pi = None\nself.si = None\nself.pi_min = None\nself.si_min = None\nself.sqrt = sqrt\nself.reset()",
"self.i = 0\nself.pi = 1.0\nself.si = 0.0\nself.pi_min = float('inf')\nself.si_min = float('inf... | <|body_start_0|>
from math import sqrt
self.min_instances = min_instances
self.drift_level = float(drift_level)
self.i = None
self.pi = None
self.si = None
self.pi_min = None
self.si_min = None
self.sqrt = sqrt
self.reset()
<|end_body_0|>
... | Implements the DDM drift detection method. This drift detector is based on the paper on the DDM Paper (João Gama, Pedro Medas, Gladys Castillo, Pedro Pereira Rodrigues: Learning with Drift Detection. SBIA 2004: 286-295). We keep the highest alarm level of drift detection (out of control), leaving out warning level. Att... | DDM | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DDM:
"""Implements the DDM drift detection method. This drift detector is based on the paper on the DDM Paper (João Gama, Pedro Medas, Gladys Castillo, Pedro Pereira Rodrigues: Learning with Drift Detection. SBIA 2004: 286-295). We keep the highest alarm level of drift detection (out of control),... | stack_v2_sparse_classes_36k_train_010967 | 3,161 | no_license | [
{
"docstring": "Initialize the DDM Drift Detector Initialize the DDM Drift detector. Default parameters are provided as well. Args: min_instances: INT. Minimum number of instances for Detector to return a result. drift_level: Alarm level for drift detector. 3.0 is from the DDM paper. 2.0 would be for drift warn... | 3 | stack_v2_sparse_classes_30k_train_001659 | Implement the Python class `DDM` described below.
Class description:
Implements the DDM drift detection method. This drift detector is based on the paper on the DDM Paper (João Gama, Pedro Medas, Gladys Castillo, Pedro Pereira Rodrigues: Learning with Drift Detection. SBIA 2004: 286-295). We keep the highest alarm lev... | Implement the Python class `DDM` described below.
Class description:
Implements the DDM drift detection method. This drift detector is based on the paper on the DDM Paper (João Gama, Pedro Medas, Gladys Castillo, Pedro Pereira Rodrigues: Learning with Drift Detection. SBIA 2004: 286-295). We keep the highest alarm lev... | 4938936dbf08b5331275d4413dbad51acbaf7da9 | <|skeleton|>
class DDM:
"""Implements the DDM drift detection method. This drift detector is based on the paper on the DDM Paper (João Gama, Pedro Medas, Gladys Castillo, Pedro Pereira Rodrigues: Learning with Drift Detection. SBIA 2004: 286-295). We keep the highest alarm level of drift detection (out of control),... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DDM:
"""Implements the DDM drift detection method. This drift detector is based on the paper on the DDM Paper (João Gama, Pedro Medas, Gladys Castillo, Pedro Pereira Rodrigues: Learning with Drift Detection. SBIA 2004: 286-295). We keep the highest alarm level of drift detection (out of control), leaving out ... | the_stack_v2_python_sparse | mlep_odin_main/mlep/mlep/drift_detector/LabeledDriftDetector/DDM.py | asuprem/ODIN | train | 7 |
93815847430abce6873358c37b12feb81b4db241 | [
"logger = logging.getLogger('AllInOneJsonLogCoordinator')\nlogger.setLevel(logging.INFO)\nlogging.basicConfig()\nself.logger = logger\nself.logger.info('init starts')\nself.src_paths = src_paths\nself.user_log_validator = UserLogValidator()\nself.app_log_validator = AppLogValidator()\nself.logger.info('init finishe... | <|body_start_0|>
logger = logging.getLogger('AllInOneJsonLogCoordinator')
logger.setLevel(logging.INFO)
logging.basicConfig()
self.logger = logger
self.logger.info('init starts')
self.src_paths = src_paths
self.user_log_validator = UserLogValidator()
self.... | Coordinator coordinates all_in_one json log to all_in_one_validated json log from two aspects, validating user and validating application. see Validator Class in more detail for validation process. | AllInOneJsonLogCoordinator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AllInOneJsonLogCoordinator:
"""Coordinator coordinates all_in_one json log to all_in_one_validated json log from two aspects, validating user and validating application. see Validator Class in more detail for validation process."""
def __init__(self, src_paths=src_paths):
"""- `src_p... | stack_v2_sparse_classes_36k_train_010968 | 2,848 | no_license | [
{
"docstring": "- `src_path`: src path in which all_in_one json log for a user is coordinated with validator.",
"name": "__init__",
"signature": "def __init__(self, src_paths=src_paths)"
},
{
"docstring": "coordinate all_in_one json file with (app, user)-validator",
"name": "coordinate",
... | 2 | stack_v2_sparse_classes_30k_train_001895 | Implement the Python class `AllInOneJsonLogCoordinator` described below.
Class description:
Coordinator coordinates all_in_one json log to all_in_one_validated json log from two aspects, validating user and validating application. see Validator Class in more detail for validation process.
Method signatures and docstr... | Implement the Python class `AllInOneJsonLogCoordinator` described below.
Class description:
Coordinator coordinates all_in_one json log to all_in_one_validated json log from two aspects, validating user and validating application. see Validator Class in more detail for validation process.
Method signatures and docstr... | e3268f0f7ff4f5a4a68931e28c483184bbf8e926 | <|skeleton|>
class AllInOneJsonLogCoordinator:
"""Coordinator coordinates all_in_one json log to all_in_one_validated json log from two aspects, validating user and validating application. see Validator Class in more detail for validation process."""
def __init__(self, src_paths=src_paths):
"""- `src_p... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AllInOneJsonLogCoordinator:
"""Coordinator coordinates all_in_one json log to all_in_one_validated json log from two aspects, validating user and validating application. see Validator Class in more detail for validation process."""
def __init__(self, src_paths=src_paths):
"""- `src_path`: src pat... | the_stack_v2_python_sparse | external_attachements/src/data_management/coordinator/all_in_one_json_log_coordinator.py | khalilhajji/discovering_user_habbits_from_smartphone_logs | train | 0 |
4fef2df2ad62e22aa7ebc7701e3b5b05540b9bd6 | [
"membership = self.getMembershipDirect(M)\nindirect = self.getMembershipIndirect(membership)\ncount = 0\nfor i in set(indirect):\n count += 1\nreturn count",
"groups_dict = {}\nfor i, node in enumerate(M):\n groups_dict[i] = [j for j, val in enumerate(node) if val == 1]\nreturn groups_dict",
"all_connecti... | <|body_start_0|>
membership = self.getMembershipDirect(M)
indirect = self.getMembershipIndirect(membership)
count = 0
for i in set(indirect):
count += 1
return count
<|end_body_0|>
<|body_start_1|>
groups_dict = {}
for i, node in enumerate(M):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findCircleNum(self, M):
"""Find number of unconnected networks. Connected if directly or transtively share i,j (i.e., if 0 and 2 share 1, 0-2 connected). :type M: List[List[int]] :rtype: int"""
<|body_0|>
def getMembershipDirect(self, M):
"""Returns dic... | stack_v2_sparse_classes_36k_train_010969 | 3,283 | no_license | [
{
"docstring": "Find number of unconnected networks. Connected if directly or transtively share i,j (i.e., if 0 and 2 share 1, 0-2 connected). :type M: List[List[int]] :rtype: int",
"name": "findCircleNum",
"signature": "def findCircleNum(self, M)"
},
{
"docstring": "Returns dictionary showing d... | 4 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findCircleNum(self, M): Find number of unconnected networks. Connected if directly or transtively share i,j (i.e., if 0 and 2 share 1, 0-2 connected). :type M: List[List[int]... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findCircleNum(self, M): Find number of unconnected networks. Connected if directly or transtively share i,j (i.e., if 0 and 2 share 1, 0-2 connected). :type M: List[List[int]... | 308889e57e71c369aa8516fba8a2064f6a26abee | <|skeleton|>
class Solution:
def findCircleNum(self, M):
"""Find number of unconnected networks. Connected if directly or transtively share i,j (i.e., if 0 and 2 share 1, 0-2 connected). :type M: List[List[int]] :rtype: int"""
<|body_0|>
def getMembershipDirect(self, M):
"""Returns dic... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findCircleNum(self, M):
"""Find number of unconnected networks. Connected if directly or transtively share i,j (i.e., if 0 and 2 share 1, 0-2 connected). :type M: List[List[int]] :rtype: int"""
membership = self.getMembershipDirect(M)
indirect = self.getMembershipIndirect... | the_stack_v2_python_sparse | leet_547.py | mike-jolliffe/Learning | train | 0 | |
1791a5b66b7f48158d92b7d16f7503fcd046f075 | [
"self.level = level\nself.HP = self.level * 200\nself.max_HP = self.level * 200\nself.AD = self.level * 25\nself.name = name\nself.gold = gold\nself.items = items",
"dmg = int(self.AD * (0.75 + 0.5 * random()))\npf5(f'{self.name} attacks.......{opp.name} takes {dmg} damage', 0)\nopp.HP -= dmg\nif opp.HP < 0:\n ... | <|body_start_0|>
self.level = level
self.HP = self.level * 200
self.max_HP = self.level * 200
self.AD = self.level * 25
self.name = name
self.gold = gold
self.items = items
<|end_body_0|>
<|body_start_1|>
dmg = int(self.AD * (0.75 + 0.5 * random()))
... | A class that summarizes general character attributes ... Arguments ---------- :param level: character strength level - determines HP, AD :type level: int :param name: chosen name for character (default = "No Name") :type name: str :param gold: Currency used in game (default = 0) :type gold: int :param items: Items carr... | character | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class character:
"""A class that summarizes general character attributes ... Arguments ---------- :param level: character strength level - determines HP, AD :type level: int :param name: chosen name for character (default = "No Name") :type name: str :param gold: Currency used in game (default = 0) :ty... | stack_v2_sparse_classes_36k_train_010970 | 2,416 | no_license | [
{
"docstring": "Constructor ... Parameters ---------- :param level: character strength level - determines HP, AD :type level: int :param name: chosen name for character (default = \"No Name\") :type name: str :param gold: Currency used in game (default = 0) :type gold: int :param items: Items carried by user (d... | 2 | stack_v2_sparse_classes_30k_train_013134 | Implement the Python class `character` described below.
Class description:
A class that summarizes general character attributes ... Arguments ---------- :param level: character strength level - determines HP, AD :type level: int :param name: chosen name for character (default = "No Name") :type name: str :param gold: ... | Implement the Python class `character` described below.
Class description:
A class that summarizes general character attributes ... Arguments ---------- :param level: character strength level - determines HP, AD :type level: int :param name: chosen name for character (default = "No Name") :type name: str :param gold: ... | e80109af7a441d5e59d84c429325bf660d4d5910 | <|skeleton|>
class character:
"""A class that summarizes general character attributes ... Arguments ---------- :param level: character strength level - determines HP, AD :type level: int :param name: chosen name for character (default = "No Name") :type name: str :param gold: Currency used in game (default = 0) :ty... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class character:
"""A class that summarizes general character attributes ... Arguments ---------- :param level: character strength level - determines HP, AD :type level: int :param name: chosen name for character (default = "No Name") :type name: str :param gold: Currency used in game (default = 0) :type gold: int ... | the_stack_v2_python_sparse | character.py | djagpal02/python-adventure-game | train | 0 |
0c74fc732b5c2b97987dcd6c17dab425dde3599e | [
"*independent, T, D = y.shape\nassert cp.iscomplexobj(y), y.dtype\nassert y.shape[-1] > 1\ny = normalize_observation(y)\nif saliency is None:\n quadratic_form = cp.ones(*independent, T)\nelse:\n raise NotImplementedError\nassert iterations > 0, iterations\nfor _ in range(iterations):\n model = self._fit(y=... | <|body_start_0|>
*independent, T, D = y.shape
assert cp.iscomplexobj(y), y.dtype
assert y.shape[-1] > 1
y = normalize_observation(y)
if saliency is None:
quadratic_form = cp.ones(*independent, T)
else:
raise NotImplementedError
assert itera... | ComplexAngularCentralGaussianTrainer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ComplexAngularCentralGaussianTrainer:
def fit(self, y, saliency=None, hermitize=True, covariance_norm='eigenvalue', eigenvalue_floor=1e-10, iterations=10):
"""Args: y: Should be normalized to unit norm. We normalize it anyway again. Shape (..., D, T), e.g. (1, D, T) for mixture models sa... | stack_v2_sparse_classes_36k_train_010971 | 4,240 | permissive | [
{
"docstring": "Args: y: Should be normalized to unit norm. We normalize it anyway again. Shape (..., D, T), e.g. (1, D, T) for mixture models saliency: Shape (..., T), e.g. (K, T) for mixture models hermitize: eigenvalue_floor: iterations: Returns:",
"name": "fit",
"signature": "def fit(self, y, salien... | 2 | stack_v2_sparse_classes_30k_train_014261 | Implement the Python class `ComplexAngularCentralGaussianTrainer` described below.
Class description:
Implement the ComplexAngularCentralGaussianTrainer class.
Method signatures and docstrings:
- def fit(self, y, saliency=None, hermitize=True, covariance_norm='eigenvalue', eigenvalue_floor=1e-10, iterations=10): Args... | Implement the Python class `ComplexAngularCentralGaussianTrainer` described below.
Class description:
Implement the ComplexAngularCentralGaussianTrainer class.
Method signatures and docstrings:
- def fit(self, y, saliency=None, hermitize=True, covariance_norm='eigenvalue', eigenvalue_floor=1e-10, iterations=10): Args... | 9594ccb0efc72ad591504bfe195c82aeafd397b8 | <|skeleton|>
class ComplexAngularCentralGaussianTrainer:
def fit(self, y, saliency=None, hermitize=True, covariance_norm='eigenvalue', eigenvalue_floor=1e-10, iterations=10):
"""Args: y: Should be normalized to unit norm. We normalize it anyway again. Shape (..., D, T), e.g. (1, D, T) for mixture models sa... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ComplexAngularCentralGaussianTrainer:
def fit(self, y, saliency=None, hermitize=True, covariance_norm='eigenvalue', eigenvalue_floor=1e-10, iterations=10):
"""Args: y: Should be normalized to unit norm. We normalize it anyway again. Shape (..., D, T), e.g. (1, D, T) for mixture models saliency: Shape ... | the_stack_v2_python_sparse | gss/cacgmm/cacg_trainer.py | desh2608/gss | train | 62 | |
97839c4a0211583f49985afdbfdc22c4ef83e76e | [
"radius = StdSettings.cursor_radius\ntry:\n frame = replay_data[replay_data['time'] <= time].iloc[-1]\nexcept IndexError:\n return\npos_x = (frame['x'] - radius) * ratio_x\npos_y = (frame['y'] - radius) * ratio_y\npainter.drawEllipse(pos_x, pos_y, 2 * radius, 2 * radius)",
"start_time = time - StdSettings.v... | <|body_start_0|>
radius = StdSettings.cursor_radius
try:
frame = replay_data[replay_data['time'] <= time].iloc[-1]
except IndexError:
return
pos_x = (frame['x'] - radius) * ratio_x
pos_y = (frame['y'] - radius) * ratio_y
painter.drawEllipse(pos_x, ... | Class used for time dependent visualization in central display. Sample use case: ``add_std_layer('layer group', 'layer name', replay_data, StdLayers.StdReplayCursorLayer)`` | StdLayers | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StdLayers:
"""Class used for time dependent visualization in central display. Sample use case: ``add_std_layer('layer group', 'layer name', replay_data, StdLayers.StdReplayCursorLayer)``"""
def StdReplayCursorLayer(painter, ratio_x, ratio_y, time, replay_data):
"""Displays player's c... | stack_v2_sparse_classes_36k_train_010972 | 4,491 | permissive | [
{
"docstring": "Displays player's cursor movement in replays",
"name": "StdReplayCursorLayer",
"signature": "def StdReplayCursorLayer(painter, ratio_x, ratio_y, time, replay_data)"
},
{
"docstring": "Displays held keys in replay",
"name": "StdReplayScatterLayer",
"signature": "def StdRep... | 5 | stack_v2_sparse_classes_30k_train_009307 | Implement the Python class `StdLayers` described below.
Class description:
Class used for time dependent visualization in central display. Sample use case: ``add_std_layer('layer group', 'layer name', replay_data, StdLayers.StdReplayCursorLayer)``
Method signatures and docstrings:
- def StdReplayCursorLayer(painter, ... | Implement the Python class `StdLayers` described below.
Class description:
Class used for time dependent visualization in central display. Sample use case: ``add_std_layer('layer group', 'layer name', replay_data, StdLayers.StdReplayCursorLayer)``
Method signatures and docstrings:
- def StdReplayCursorLayer(painter, ... | 8b211a01c2364d51b8bf08e045e9280ec3a04242 | <|skeleton|>
class StdLayers:
"""Class used for time dependent visualization in central display. Sample use case: ``add_std_layer('layer group', 'layer name', replay_data, StdLayers.StdReplayCursorLayer)``"""
def StdReplayCursorLayer(painter, ratio_x, ratio_y, time, replay_data):
"""Displays player's c... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StdLayers:
"""Class used for time dependent visualization in central display. Sample use case: ``add_std_layer('layer group', 'layer name', replay_data, StdLayers.StdReplayCursorLayer)``"""
def StdReplayCursorLayer(painter, ratio_x, ratio_y, time, replay_data):
"""Displays player's cursor movemen... | the_stack_v2_python_sparse | analysis/osu/std/std_layers.py | abraker95/ultimate_osu_analyzer | train | 30 |
9a122ff0becb83acc80741eee0198875bb0e4008 | [
"params = super().get_default_params(with_embedding=True)\nparams.add(Param(name='filters', value=128, desc='The filter size in the convolution layer.'))\nparams.add(Param(name='conv_activation_func', value='relu', desc='The activation function in the convolution layer.'))\nparams.add(Param(name='max_ngram', value=... | <|body_start_0|>
params = super().get_default_params(with_embedding=True)
params.add(Param(name='filters', value=128, desc='The filter size in the convolution layer.'))
params.add(Param(name='conv_activation_func', value='relu', desc='The activation function in the convolution layer.'))
... | ConvKNRM Model. Examples: >>> model = ConvKNRM() >>> model.params['filters'] = 128 >>> model.params['conv_activation_func'] = 'tanh' >>> model.params['max_ngram'] = 3 >>> model.params['use_crossmatch'] = True >>> model.params['kernel_num'] = 11 >>> model.params['sigma'] = 0.1 >>> model.params['exact_sigma'] = 0.001 >>>... | ConvKNRM | [
"MIT",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-unknown-license-reference",
"LGPL-2.1-or-later",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConvKNRM:
"""ConvKNRM Model. Examples: >>> model = ConvKNRM() >>> model.params['filters'] = 128 >>> model.params['conv_activation_func'] = 'tanh' >>> model.params['max_ngram'] = 3 >>> model.params['use_crossmatch'] = True >>> model.params['kernel_num'] = 11 >>> model.params['sigma'] = 0.1 >>> mod... | stack_v2_sparse_classes_36k_train_010973 | 4,913 | permissive | [
{
"docstring": ":return: model default parameters.",
"name": "get_default_params",
"signature": "def get_default_params(cls) -> ParamTable"
},
{
"docstring": "Build model structure.",
"name": "build",
"signature": "def build(self)"
},
{
"docstring": "Forward.",
"name": "forwa... | 3 | null | Implement the Python class `ConvKNRM` described below.
Class description:
ConvKNRM Model. Examples: >>> model = ConvKNRM() >>> model.params['filters'] = 128 >>> model.params['conv_activation_func'] = 'tanh' >>> model.params['max_ngram'] = 3 >>> model.params['use_crossmatch'] = True >>> model.params['kernel_num'] = 11 ... | Implement the Python class `ConvKNRM` described below.
Class description:
ConvKNRM Model. Examples: >>> model = ConvKNRM() >>> model.params['filters'] = 128 >>> model.params['conv_activation_func'] = 'tanh' >>> model.params['max_ngram'] = 3 >>> model.params['use_crossmatch'] = True >>> model.params['kernel_num'] = 11 ... | 4198ebce942f4afe7ddca6a96ab6f4464ade4518 | <|skeleton|>
class ConvKNRM:
"""ConvKNRM Model. Examples: >>> model = ConvKNRM() >>> model.params['filters'] = 128 >>> model.params['conv_activation_func'] = 'tanh' >>> model.params['max_ngram'] = 3 >>> model.params['use_crossmatch'] = True >>> model.params['kernel_num'] = 11 >>> model.params['sigma'] = 0.1 >>> mod... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ConvKNRM:
"""ConvKNRM Model. Examples: >>> model = ConvKNRM() >>> model.params['filters'] = 128 >>> model.params['conv_activation_func'] = 'tanh' >>> model.params['max_ngram'] = 3 >>> model.params['use_crossmatch'] = True >>> model.params['kernel_num'] = 11 >>> model.params['sigma'] = 0.1 >>> model.params['ex... | the_stack_v2_python_sparse | poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/models/conv_knrm.py | microsoft/ContextualSP | train | 332 |
930c590d982543f0ea637904f1f0e876f8c3ea01 | [
"def walk_zipped_assets(static_module_name, static_path, asset_path, temp_dir):\n for asset in resource_listdir(static_module_name, asset_path):\n if not asset:\n continue\n asset_target = os.path.normpath(os.path.join(os.path.relpath(asset_path, static_path), asset))\n if resourc... | <|body_start_0|>
def walk_zipped_assets(static_module_name, static_path, asset_path, temp_dir):
for asset in resource_listdir(static_module_name, asset_path):
if not asset:
continue
asset_target = os.path.normpath(os.path.join(os.path.relpath(asset... | DistributionHelper | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DistributionHelper:
def access_zipped_assets(cls, static_module_name, static_path, dir_location=None):
"""Create a copy of static resource files as we can't serve them from within the pex file. :param static_module_name: Module name containing module to cache in a tempdir :param static_p... | stack_v2_sparse_classes_36k_train_010974 | 12,314 | permissive | [
{
"docstring": "Create a copy of static resource files as we can't serve them from within the pex file. :param static_module_name: Module name containing module to cache in a tempdir :param static_path: Module name, for example 'serverset' :param dir_location: create a new temporary directory inside, or None to... | 2 | stack_v2_sparse_classes_30k_test_000160 | Implement the Python class `DistributionHelper` described below.
Class description:
Implement the DistributionHelper class.
Method signatures and docstrings:
- def access_zipped_assets(cls, static_module_name, static_path, dir_location=None): Create a copy of static resource files as we can't serve them from within t... | Implement the Python class `DistributionHelper` described below.
Class description:
Implement the DistributionHelper class.
Method signatures and docstrings:
- def access_zipped_assets(cls, static_module_name, static_path, dir_location=None): Create a copy of static resource files as we can't serve them from within t... | e43b9da471a79ab11d905956a40583a420992b28 | <|skeleton|>
class DistributionHelper:
def access_zipped_assets(cls, static_module_name, static_path, dir_location=None):
"""Create a copy of static resource files as we can't serve them from within the pex file. :param static_module_name: Module name containing module to cache in a tempdir :param static_p... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DistributionHelper:
def access_zipped_assets(cls, static_module_name, static_path, dir_location=None):
"""Create a copy of static resource files as we can't serve them from within the pex file. :param static_module_name: Module name containing module to cache in a tempdir :param static_path: Module na... | the_stack_v2_python_sparse | pex/util.py | thuythai/pex | train | 1 | |
0e75294380d0bc2bb9663169123bb09648ec7a93 | [
"item = get_object_or_404(Item, pk=kwargs['item_id'])\ncontext = {}\ncontext['form'] = ItemForm(instance=item)\nreturn render(self.request, self.template_name, context)",
"item = get_object_or_404(Item, pk=kwargs['item_id'])\nform = ItemForm(self.request.POST, instance=item)\nif form.is_valid():\n item = form.... | <|body_start_0|>
item = get_object_or_404(Item, pk=kwargs['item_id'])
context = {}
context['form'] = ItemForm(instance=item)
return render(self.request, self.template_name, context)
<|end_body_0|>
<|body_start_1|>
item = get_object_or_404(Item, pk=kwargs['item_id'])
form... | Editing invoice | ItemEditView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ItemEditView:
"""Editing invoice"""
def get(self, *args, **kwargs):
"""Display invoice form"""
<|body_0|>
def post(self, *args, **kwargs):
"""Get filled invoice form and create invoice"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
item = get_o... | stack_v2_sparse_classes_36k_train_010975 | 4,064 | no_license | [
{
"docstring": "Display invoice form",
"name": "get",
"signature": "def get(self, *args, **kwargs)"
},
{
"docstring": "Get filled invoice form and create invoice",
"name": "post",
"signature": "def post(self, *args, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_013364 | Implement the Python class `ItemEditView` described below.
Class description:
Editing invoice
Method signatures and docstrings:
- def get(self, *args, **kwargs): Display invoice form
- def post(self, *args, **kwargs): Get filled invoice form and create invoice | Implement the Python class `ItemEditView` described below.
Class description:
Editing invoice
Method signatures and docstrings:
- def get(self, *args, **kwargs): Display invoice form
- def post(self, *args, **kwargs): Get filled invoice form and create invoice
<|skeleton|>
class ItemEditView:
"""Editing invoice"... | 17615ea9bfb1edebe41d60dbf2e977f0018d5339 | <|skeleton|>
class ItemEditView:
"""Editing invoice"""
def get(self, *args, **kwargs):
"""Display invoice form"""
<|body_0|>
def post(self, *args, **kwargs):
"""Get filled invoice form and create invoice"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ItemEditView:
"""Editing invoice"""
def get(self, *args, **kwargs):
"""Display invoice form"""
item = get_object_or_404(Item, pk=kwargs['item_id'])
context = {}
context['form'] = ItemForm(instance=item)
return render(self.request, self.template_name, context)
... | the_stack_v2_python_sparse | items/views.py | Swiftkind/invoice | train | 0 |
0f6eb8b441a10bc1e945d4223b6915bf44e43fa4 | [
"context = context or {}\nres = {}\nall_process_moves_ids = context and context.get('all_process_moves_ids', False) or False\nnext_stage_workorder_id = context and context.get('next_stage_workorder_id', False) or False\nif 'all_process_moves_ids' in fields:\n res.update({'all_process_moves_ids': all_process_move... | <|body_start_0|>
context = context or {}
res = {}
all_process_moves_ids = context and context.get('all_process_moves_ids', False) or False
next_stage_workorder_id = context and context.get('next_stage_workorder_id', False) or False
if 'all_process_moves_ids' in fields:
... | all_in_once_qty_to_finished | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class all_in_once_qty_to_finished:
def default_get(self, cr, uid, fields, context=None):
"""-Process -Set one2many for all draft or in_progress moves"""
<|body_0|>
def onchange_workorder_id(self, cr, uid, ids, workorder_id, production_id, context=None):
"""-Process -to set... | stack_v2_sparse_classes_36k_train_010976 | 6,775 | no_license | [
{
"docstring": "-Process -Set one2many for all draft or in_progress moves",
"name": "default_get",
"signature": "def default_get(self, cr, uid, fields, context=None)"
},
{
"docstring": "-Process -to set domain for workorder_id which is coming from only current production order",
"name": "onc... | 3 | null | Implement the Python class `all_in_once_qty_to_finished` described below.
Class description:
Implement the all_in_once_qty_to_finished class.
Method signatures and docstrings:
- def default_get(self, cr, uid, fields, context=None): -Process -Set one2many for all draft or in_progress moves
- def onchange_workorder_id(... | Implement the Python class `all_in_once_qty_to_finished` described below.
Class description:
Implement the all_in_once_qty_to_finished class.
Method signatures and docstrings:
- def default_get(self, cr, uid, fields, context=None): -Process -Set one2many for all draft or in_progress moves
- def onchange_workorder_id(... | d3daac105636ac4e146816232c616298dc5bb742 | <|skeleton|>
class all_in_once_qty_to_finished:
def default_get(self, cr, uid, fields, context=None):
"""-Process -Set one2many for all draft or in_progress moves"""
<|body_0|>
def onchange_workorder_id(self, cr, uid, ids, workorder_id, production_id, context=None):
"""-Process -to set... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class all_in_once_qty_to_finished:
def default_get(self, cr, uid, fields, context=None):
"""-Process -Set one2many for all draft or in_progress moves"""
context = context or {}
res = {}
all_process_moves_ids = context and context.get('all_process_moves_ids', False) or False
n... | the_stack_v2_python_sparse | l10n_in_mrp_subcontract/wizard/all_in_once_qty_to_finished.py | Odoo-India/odoo-india | train | 10 | |
aef84ae33dce75ec795635e6de0c426818fee2f0 | [
"print(response.status)\nTags = response.xpath('//div[@class=\"Taright\"]/a')\nfor Tag in Tags:\n Tag_items = ChinazTagItem()\n Tag_items['TagName'] = Tag.xpath('./text()')[0].extract()\n Tag_items['FirstUrl'] = Tag.xpath('./@href').extract()[0]\n yield Tag_items\n yield scrapy.Request(Tag_items['Fir... | <|body_start_0|>
print(response.status)
Tags = response.xpath('//div[@class="Taright"]/a')
for Tag in Tags:
Tag_items = ChinazTagItem()
Tag_items['TagName'] = Tag.xpath('./text()')[0].extract()
Tag_items['FirstUrl'] = Tag.xpath('./@href').extract()[0]
... | ChinazSpider | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChinazSpider:
def parse(self, response):
"""在parse回调方法中 step1:提取目标数据 step2:获取新的目标url :param response: 请求的响应结果 :return:"""
<|body_0|>
def parser_tags_page(self, response):
"""解析分类网页的网站信息 :param response: 响应结果 :return:"""
<|body_1|>
<|end_skeleton|>
<|body_st... | stack_v2_sparse_classes_36k_train_010977 | 3,371 | no_license | [
{
"docstring": "在parse回调方法中 step1:提取目标数据 step2:获取新的目标url :param response: 请求的响应结果 :return:",
"name": "parse",
"signature": "def parse(self, response)"
},
{
"docstring": "解析分类网页的网站信息 :param response: 响应结果 :return:",
"name": "parser_tags_page",
"signature": "def parser_tags_page(self, resp... | 2 | stack_v2_sparse_classes_30k_val_001166 | Implement the Python class `ChinazSpider` described below.
Class description:
Implement the ChinazSpider class.
Method signatures and docstrings:
- def parse(self, response): 在parse回调方法中 step1:提取目标数据 step2:获取新的目标url :param response: 请求的响应结果 :return:
- def parser_tags_page(self, response): 解析分类网页的网站信息 :param response:... | Implement the Python class `ChinazSpider` described below.
Class description:
Implement the ChinazSpider class.
Method signatures and docstrings:
- def parse(self, response): 在parse回调方法中 step1:提取目标数据 step2:获取新的目标url :param response: 请求的响应结果 :return:
- def parser_tags_page(self, response): 解析分类网页的网站信息 :param response:... | 841cad4bf84c6e3af98a32f4f33ebda62055680c | <|skeleton|>
class ChinazSpider:
def parse(self, response):
"""在parse回调方法中 step1:提取目标数据 step2:获取新的目标url :param response: 请求的响应结果 :return:"""
<|body_0|>
def parser_tags_page(self, response):
"""解析分类网页的网站信息 :param response: 响应结果 :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ChinazSpider:
def parse(self, response):
"""在parse回调方法中 step1:提取目标数据 step2:获取新的目标url :param response: 请求的响应结果 :return:"""
print(response.status)
Tags = response.xpath('//div[@class="Taright"]/a')
for Tag in Tags:
Tag_items = ChinazTagItem()
Tag_items['Ta... | the_stack_v2_python_sparse | scrapy_Spider/Chinaz/Chinaz/spiders/chinaz.py | aini626204777/spider | train | 0 | |
14fde0250dfc6981f0b3dc30776c02b3f551f677 | [
"self.loan_number = loan_number\nself.loan_payment_number = loan_payment_number\nself.loan_payment_address = loan_payment_address\nself.additional_properties = additional_properties",
"if dictionary is None:\n return None\nloan_number = dictionary.get('loanNumber')\nloan_payment_number = dictionary.get('loanPa... | <|body_start_0|>
self.loan_number = loan_number
self.loan_payment_number = loan_payment_number
self.loan_payment_address = loan_payment_address
self.additional_properties = additional_properties
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
... | Implementation of the 'Loan Payment Details' model. The loan payment details for the customer account Attributes: loan_number (string): The number of the specific loan under the account. loan_payment_number (string): The payment number given by the institution. This number is typically for manual payments. This is not ... | LoanPaymentDetails | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoanPaymentDetails:
"""Implementation of the 'Loan Payment Details' model. The loan payment details for the customer account Attributes: loan_number (string): The number of the specific loan under the account. loan_payment_number (string): The payment number given by the institution. This number ... | stack_v2_sparse_classes_36k_train_010978 | 2,572 | permissive | [
{
"docstring": "Constructor for the LoanPaymentDetails class",
"name": "__init__",
"signature": "def __init__(self, loan_number=None, loan_payment_number=None, loan_payment_address=None, additional_properties={})"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dicti... | 2 | stack_v2_sparse_classes_30k_train_005477 | Implement the Python class `LoanPaymentDetails` described below.
Class description:
Implementation of the 'Loan Payment Details' model. The loan payment details for the customer account Attributes: loan_number (string): The number of the specific loan under the account. loan_payment_number (string): The payment number... | Implement the Python class `LoanPaymentDetails` described below.
Class description:
Implementation of the 'Loan Payment Details' model. The loan payment details for the customer account Attributes: loan_number (string): The number of the specific loan under the account. loan_payment_number (string): The payment number... | b2ab1ded435db75c78d42261f5e4acd2a3061487 | <|skeleton|>
class LoanPaymentDetails:
"""Implementation of the 'Loan Payment Details' model. The loan payment details for the customer account Attributes: loan_number (string): The number of the specific loan under the account. loan_payment_number (string): The payment number given by the institution. This number ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LoanPaymentDetails:
"""Implementation of the 'Loan Payment Details' model. The loan payment details for the customer account Attributes: loan_number (string): The number of the specific loan under the account. loan_payment_number (string): The payment number given by the institution. This number is typically ... | the_stack_v2_python_sparse | finicityapi/models/loan_payment_details.py | monarchmoney/finicity-python | train | 0 |
92d5740071e72a44dbf6f3a588bf8a7a6317ff51 | [
"base_vars = self._get_base_variables()\npublisher, offer, sku = utils.get_azure_image_info(self._heat_resource.properties['image'])\nbase_vars.update({'vmSize_%s' % self._heat_resource_name: utils.get_azure_flavor(self._heat_resource.properties['flavor']), 'imgPublisher_%s' % self._heat_resource_name: publisher, '... | <|body_start_0|>
base_vars = self._get_base_variables()
publisher, offer, sku = utils.get_azure_image_info(self._heat_resource.properties['image'])
base_vars.update({'vmSize_%s' % self._heat_resource_name: utils.get_azure_flavor(self._heat_resource.properties['flavor']), 'imgPublisher_%s' % self... | NovaServerARMTranslator is the translator associated to a Nova server. It processes the fields and parameters of a Nova server defined in Heat. | NovaServerARMTranslator | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NovaServerARMTranslator:
"""NovaServerARMTranslator is the translator associated to a Nova server. It processes the fields and parameters of a Nova server defined in Heat."""
def get_variables(self):
"""get_variables returns the dict of ARM template variables associated with the Heat... | stack_v2_sparse_classes_36k_train_010979 | 2,930 | permissive | [
{
"docstring": "get_variables returns the dict of ARM template variables associated with the Heat template's resource translation.",
"name": "get_variables",
"signature": "def get_variables(self)"
},
{
"docstring": "_get_ref_port_resource_names is a helper method which returns a list containing ... | 3 | null | Implement the Python class `NovaServerARMTranslator` described below.
Class description:
NovaServerARMTranslator is the translator associated to a Nova server. It processes the fields and parameters of a Nova server defined in Heat.
Method signatures and docstrings:
- def get_variables(self): get_variables returns th... | Implement the Python class `NovaServerARMTranslator` described below.
Class description:
NovaServerARMTranslator is the translator associated to a Nova server. It processes the fields and parameters of a Nova server defined in Heat.
Method signatures and docstrings:
- def get_variables(self): get_variables returns th... | 83472c7a4af3496e28c1b7b4021e31c373f37784 | <|skeleton|>
class NovaServerARMTranslator:
"""NovaServerARMTranslator is the translator associated to a Nova server. It processes the fields and parameters of a Nova server defined in Heat."""
def get_variables(self):
"""get_variables returns the dict of ARM template variables associated with the Heat... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NovaServerARMTranslator:
"""NovaServerARMTranslator is the translator associated to a Nova server. It processes the fields and parameters of a Nova server defined in Heat."""
def get_variables(self):
"""get_variables returns the dict of ARM template variables associated with the Heat template's r... | the_stack_v2_python_sparse | heat2arm/translators/instances/nova_server.py | travlaw/heat2arm | train | 0 |
92dcf28ece8ce3ab0ed3d398c7f534ede15ba32a | [
"module_name = self.__module__\nclass_name = type(self).__name__\nmethod_name = inspect.stack()[1][3]\nmsg = u'The %s method has not yet been implemented for the %s.%s class.' % (method_name, module_name, class_name)\nraise NotImplementedError(msg)",
"module_name = self.__module__\nclass_name = type(self).__name_... | <|body_start_0|>
module_name = self.__module__
class_name = type(self).__name__
method_name = inspect.stack()[1][3]
msg = u'The %s method has not yet been implemented for the %s.%s class.' % (method_name, module_name, class_name)
raise NotImplementedError(msg)
<|end_body_0|>
<|b... | A base class that can be subclassed to create other base classes. It provides a way to raise informative NotImplementedErrors. This allows developers to easily identify the module and class in which a method needs to be implemented. Classes derived from BaseClass (e.g., |Engine|) are intended to be subclassed by other ... | BaseClass | [
"LicenseRef-scancode-proprietary-license",
"GPL-3.0-only",
"LicenseRef-scancode-unknown-license-reference",
"GPL-1.0-or-later",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-other-copyleft",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseClass:
"""A base class that can be subclassed to create other base classes. It provides a way to raise informative NotImplementedErrors. This allows developers to easily identify the module and class in which a method needs to be implemented. Classes derived from BaseClass (e.g., |Engine|) ar... | stack_v2_sparse_classes_36k_train_010980 | 2,377 | permissive | [
{
"docstring": "Raises a |NotImplementedError| with a message that specifies the module and class in which the error was raised.",
"name": "raise_method_not_implemented",
"signature": "def raise_method_not_implemented(self)"
},
{
"docstring": "Takes a string representing an attribute that has no... | 2 | null | Implement the Python class `BaseClass` described below.
Class description:
A base class that can be subclassed to create other base classes. It provides a way to raise informative NotImplementedErrors. This allows developers to easily identify the module and class in which a method needs to be implemented. Classes der... | Implement the Python class `BaseClass` described below.
Class description:
A base class that can be subclassed to create other base classes. It provides a way to raise informative NotImplementedErrors. This allows developers to easily identify the module and class in which a method needs to be implemented. Classes der... | a379a134c0c5af14df4ed2afa066c1626506b754 | <|skeleton|>
class BaseClass:
"""A base class that can be subclassed to create other base classes. It provides a way to raise informative NotImplementedErrors. This allows developers to easily identify the module and class in which a method needs to be implemented. Classes derived from BaseClass (e.g., |Engine|) ar... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BaseClass:
"""A base class that can be subclassed to create other base classes. It provides a way to raise informative NotImplementedErrors. This allows developers to easily identify the module and class in which a method needs to be implemented. Classes derived from BaseClass (e.g., |Engine|) are intended to... | the_stack_v2_python_sparse | Incident-Response/Tools/cyphon/cyphon/cyphon/baseclass.py | foss2cyber/Incident-Playbook | train | 1 |
66566ab3618fd3c6379d57a75c35dbcb253b8207 | [
"self.src_type = source.type\nself.n_bits = source.n_bits\nself.received_text = None",
"if len(received_bits) < self.n_bits:\n sys.stderr.write('Warning: Received fewer bits than expected\\n')\nelse:\n received_bits = received_bits[:self.n_bits]\nif self.src_type == Source.TEXT:\n self.received_text = se... | <|body_start_0|>
self.src_type = source.type
self.n_bits = source.n_bits
self.received_text = None
<|end_body_0|>
<|body_start_1|>
if len(received_bits) < self.n_bits:
sys.stderr.write('Warning: Received fewer bits than expected\n')
else:
received_bits = ... | Sink | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Sink:
def __init__(self, source):
"""Source that this Sink is based on."""
<|body_0|>
def process(self, received_bits):
"""Process the received bits."""
<|body_1|>
def get_text(self, bits):
"""Returns the text represented by the array of bits (as... | stack_v2_sparse_classes_36k_train_010981 | 1,754 | no_license | [
{
"docstring": "Source that this Sink is based on.",
"name": "__init__",
"signature": "def __init__(self, source)"
},
{
"docstring": "Process the received bits.",
"name": "process",
"signature": "def process(self, received_bits)"
},
{
"docstring": "Returns the text represented by... | 4 | stack_v2_sparse_classes_30k_train_004035 | Implement the Python class `Sink` described below.
Class description:
Implement the Sink class.
Method signatures and docstrings:
- def __init__(self, source): Source that this Sink is based on.
- def process(self, received_bits): Process the received bits.
- def get_text(self, bits): Returns the text represented by ... | Implement the Python class `Sink` described below.
Class description:
Implement the Sink class.
Method signatures and docstrings:
- def __init__(self, source): Source that this Sink is based on.
- def process(self, received_bits): Process the received bits.
- def get_text(self, bits): Returns the text represented by ... | 3f672177be94ba98f65abd3b95df810573ceb9bb | <|skeleton|>
class Sink:
def __init__(self, source):
"""Source that this Sink is based on."""
<|body_0|>
def process(self, received_bits):
"""Process the received bits."""
<|body_1|>
def get_text(self, bits):
"""Returns the text represented by the array of bits (as... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Sink:
def __init__(self, source):
"""Source that this Sink is based on."""
self.src_type = source.type
self.n_bits = source.n_bits
self.received_text = None
def process(self, received_bits):
"""Process the received bits."""
if len(received_bits) < self.n_bi... | the_stack_v2_python_sparse | Psets/PS5/sink.py | fabatef/6.02 | train | 0 | |
ab42a93423a8d8e1a0a15092c669dd567b5fa27b | [
"request_user = None\nif hasattr(request, 'user') and request.user and request.user.is_authenticated:\n request_user = request.user\nif not request_user and (not user or not user.is_authenticated):\n return None\nsession_user = user if user else request_user\ntunnistamo_session_id = request.session.get('tunni... | <|body_start_0|>
request_user = None
if hasattr(request, 'user') and request.user and request.user.is_authenticated:
request_user = request.user
if not request_user and (not user or not user.is_authenticated):
return None
session_user = user if user else request_u... | TunnistamoSessionManager | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TunnistamoSessionManager:
def get_or_create_from_request(self, request, user=None):
"""Get or create Tunnistamo Session Tries to find a tunnistamo_session_id in the Django session. Creates a new session if session id is not found. Current user is read from the request or can be passed as... | stack_v2_sparse_classes_36k_train_010982 | 11,271 | permissive | [
{
"docstring": "Get or create Tunnistamo Session Tries to find a tunnistamo_session_id in the Django session. Creates a new session if session id is not found. Current user is read from the request or can be passed as an argument. e.g. in social auth pipeline where the user is not yet logged in but exists.",
... | 2 | stack_v2_sparse_classes_30k_train_010906 | Implement the Python class `TunnistamoSessionManager` described below.
Class description:
Implement the TunnistamoSessionManager class.
Method signatures and docstrings:
- def get_or_create_from_request(self, request, user=None): Get or create Tunnistamo Session Tries to find a tunnistamo_session_id in the Django ses... | Implement the Python class `TunnistamoSessionManager` described below.
Class description:
Implement the TunnistamoSessionManager class.
Method signatures and docstrings:
- def get_or_create_from_request(self, request, user=None): Get or create Tunnistamo Session Tries to find a tunnistamo_session_id in the Django ses... | 508116944aa8583d374763ad1e35e1c845010c8b | <|skeleton|>
class TunnistamoSessionManager:
def get_or_create_from_request(self, request, user=None):
"""Get or create Tunnistamo Session Tries to find a tunnistamo_session_id in the Django session. Creates a new session if session id is not found. Current user is read from the request or can be passed as... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TunnistamoSessionManager:
def get_or_create_from_request(self, request, user=None):
"""Get or create Tunnistamo Session Tries to find a tunnistamo_session_id in the Django session. Creates a new session if session id is not found. Current user is read from the request or can be passed as an argument. ... | the_stack_v2_python_sparse | users/models.py | City-of-Helsinki/tunnistamo | train | 9 | |
e02e71f9e401cdf7b672aaafc2683904ce55c5de | [
"if k == 0:\n return True\nif cur == target:\n return self.backtracking(nums, k - 1, target, 0, 0, used, ans)\nfor i in range(start, len(nums)):\n if not used[i] and cur + nums[i] <= target:\n used[i] = True\n ans[len(ans) - k].append(nums[i])\n if self.backtracking(nums, k, target, i ... | <|body_start_0|>
if k == 0:
return True
if cur == target:
return self.backtracking(nums, k - 1, target, 0, 0, used, ans)
for i in range(start, len(nums)):
if not used[i] and cur + nums[i] <= target:
used[i] = True
ans[len(ans) -... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def backtracking(self, nums, k, target, start, cur, used, ans):
"""使用回溯法对所有可能的情况进行遍历,但不满足条件时可以马上进行剪枝 基线条件: if k == 0: return True if cur == target: backtracking(nums, k-1, target, start=0, cur=0, used) :param nums: :param k: :param target: 需要凑的和 :param start: 起始位置索引 :param cur:... | stack_v2_sparse_classes_36k_train_010983 | 2,390 | no_license | [
{
"docstring": "使用回溯法对所有可能的情况进行遍历,但不满足条件时可以马上进行剪枝 基线条件: if k == 0: return True if cur == target: backtracking(nums, k-1, target, start=0, cur=0, used) :param nums: :param k: :param target: 需要凑的和 :param start: 起始位置索引 :param cur: 当前的值 :param used: 搜索路径中已经使用的值 :return:",
"name": "backtracking",
"signature"... | 2 | stack_v2_sparse_classes_30k_train_014782 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def backtracking(self, nums, k, target, start, cur, used, ans): 使用回溯法对所有可能的情况进行遍历,但不满足条件时可以马上进行剪枝 基线条件: if k == 0: return True if cur == target: backtracking(nums, k-1, target, s... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def backtracking(self, nums, k, target, start, cur, used, ans): 使用回溯法对所有可能的情况进行遍历,但不满足条件时可以马上进行剪枝 基线条件: if k == 0: return True if cur == target: backtracking(nums, k-1, target, s... | 84bd4a00160e6b2a723a57e149474c6bb38bcce2 | <|skeleton|>
class Solution:
def backtracking(self, nums, k, target, start, cur, used, ans):
"""使用回溯法对所有可能的情况进行遍历,但不满足条件时可以马上进行剪枝 基线条件: if k == 0: return True if cur == target: backtracking(nums, k-1, target, start=0, cur=0, used) :param nums: :param k: :param target: 需要凑的和 :param start: 起始位置索引 :param cur:... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def backtracking(self, nums, k, target, start, cur, used, ans):
"""使用回溯法对所有可能的情况进行遍历,但不满足条件时可以马上进行剪枝 基线条件: if k == 0: return True if cur == target: backtracking(nums, k-1, target, start=0, cur=0, used) :param nums: :param k: :param target: 需要凑的和 :param start: 起始位置索引 :param cur: 当前的值 :param u... | the_stack_v2_python_sparse | recursion/divide_k.py | yanghongkai/yhkleetcode | train | 0 | |
08f1e53a604334dca670ce7230514f5ad3e77fce | [
"if not force:\n data_available = True\n warn_about_field = False\n try:\n self.get_path\n except FieldNotSetError:\n data_available = False\n except FileDoesNotExistError:\n data_available = False\n warn_about_field = True\n if data_available:\n return\n if w... | <|body_start_0|>
if not force:
data_available = True
warn_about_field = False
try:
self.get_path
except FieldNotSetError:
data_available = False
except FileDoesNotExistError:
data_available = False
... | TacHandler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TacHandler:
def calculate(self, force=False, verbose=True, **kwargs):
"""Wrapper around calculate_contacts"""
<|body_0|>
def set_manual_params_if_needed(self, force=False, n_frames=4, interactive=True, **kwargs):
"""Display a subset of video frames to set fol_x and f... | stack_v2_sparse_classes_36k_train_010984 | 11,535 | no_license | [
{
"docstring": "Wrapper around calculate_contacts",
"name": "calculate",
"signature": "def calculate(self, force=False, verbose=True, **kwargs)"
},
{
"docstring": "Display a subset of video frames to set fol_x and fol_y",
"name": "set_manual_params_if_needed",
"signature": "def set_manua... | 3 | stack_v2_sparse_classes_30k_val_000655 | Implement the Python class `TacHandler` described below.
Class description:
Implement the TacHandler class.
Method signatures and docstrings:
- def calculate(self, force=False, verbose=True, **kwargs): Wrapper around calculate_contacts
- def set_manual_params_if_needed(self, force=False, n_frames=4, interactive=True,... | Implement the Python class `TacHandler` described below.
Class description:
Implement the TacHandler class.
Method signatures and docstrings:
- def calculate(self, force=False, verbose=True, **kwargs): Wrapper around calculate_contacts
- def set_manual_params_if_needed(self, force=False, n_frames=4, interactive=True,... | a04ca4c663649549a78c857252a98d8acf8faf31 | <|skeleton|>
class TacHandler:
def calculate(self, force=False, verbose=True, **kwargs):
"""Wrapper around calculate_contacts"""
<|body_0|>
def set_manual_params_if_needed(self, force=False, n_frames=4, interactive=True, **kwargs):
"""Display a subset of video frames to set fol_x and f... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TacHandler:
def calculate(self, force=False, verbose=True, **kwargs):
"""Wrapper around calculate_contacts"""
if not force:
data_available = True
warn_about_field = False
try:
self.get_path
except FieldNotSetError:
... | the_stack_v2_python_sparse | Handlers/TacHandler.py | cxrodgers/whiskvid | train | 0 | |
a572a6505e0973011bf3c2169011008272e87236 | [
"self.tpname = tpname\nself.fields = fields\nself.inherit = inherit",
"def get_tp():\n \"\"\" Iterator generating lines for struct definition. \"\"\"\n decl = 'struct '\n if self.tpname is not None:\n decl += self.tpname\n if self.inherit is not None:\n decl += ' : ' + self.inher... | <|body_start_0|>
self.tpname = tpname
self.fields = fields
self.inherit = inherit
<|end_body_0|>
<|body_start_1|>
def get_tp():
""" Iterator generating lines for struct definition. """
decl = 'struct '
if self.tpname is not None:
decl ... | A structure declarator. Attributes ---------- tpname : str Name of the structure. (None for unnamed struct) fields : [Declarator] Content of the structure. inherit : str Parent class of current structure. | Struct | [
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Struct:
"""A structure declarator. Attributes ---------- tpname : str Name of the structure. (None for unnamed struct) fields : [Declarator] Content of the structure. inherit : str Parent class of current structure."""
def __init__(self, tpname, fields, inherit=None):
"""Initialize t... | stack_v2_sparse_classes_36k_train_010985 | 23,080 | permissive | [
{
"docstring": "Initialize the structure declarator.",
"name": "__init__",
"signature": "def __init__(self, tpname, fields, inherit=None)"
},
{
"docstring": "See Declarator.get_decl_pair.",
"name": "get_decl_pair",
"signature": "def get_decl_pair(self)"
}
] | 2 | null | Implement the Python class `Struct` described below.
Class description:
A structure declarator. Attributes ---------- tpname : str Name of the structure. (None for unnamed struct) fields : [Declarator] Content of the structure. inherit : str Parent class of current structure.
Method signatures and docstrings:
- def _... | Implement the Python class `Struct` described below.
Class description:
A structure declarator. Attributes ---------- tpname : str Name of the structure. (None for unnamed struct) fields : [Declarator] Content of the structure. inherit : str Parent class of current structure.
Method signatures and docstrings:
- def _... | f5042e35b945aded77b23470ead62d7eacefde92 | <|skeleton|>
class Struct:
"""A structure declarator. Attributes ---------- tpname : str Name of the structure. (None for unnamed struct) fields : [Declarator] Content of the structure. inherit : str Parent class of current structure."""
def __init__(self, tpname, fields, inherit=None):
"""Initialize t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Struct:
"""A structure declarator. Attributes ---------- tpname : str Name of the structure. (None for unnamed struct) fields : [Declarator] Content of the structure. inherit : str Parent class of current structure."""
def __init__(self, tpname, fields, inherit=None):
"""Initialize the structure ... | the_stack_v2_python_sparse | contrib/python/pythran/pythran/cxxgen.py | catboost/catboost | train | 8,012 |
8b90673fadbf0769ae31562713cfacc0af321f2e | [
"self.prefix = defaultdict(list)\nself.count = defaultdict(int)\nn = len(sentences)\nfor i in range(n):\n self.count[sentences[i]] = times[i]\n for j in range(1, len(sentences[i]) + 1):\n self.prefix[sentences[i][:j]].append(sentences[i])\nself.word = ''",
"if c == '#':\n if self.count.get(self.wo... | <|body_start_0|>
self.prefix = defaultdict(list)
self.count = defaultdict(int)
n = len(sentences)
for i in range(n):
self.count[sentences[i]] = times[i]
for j in range(1, len(sentences[i]) + 1):
self.prefix[sentences[i][:j]].append(sentences[i])
... | AutocompleteSystem | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AutocompleteSystem:
def __init__(self, sentences, times):
""":type sentences: List[str] :type times: List[int]"""
<|body_0|>
def input(self, c):
""":type c: str :rtype: List[str]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.prefix = defaultd... | stack_v2_sparse_classes_36k_train_010986 | 1,412 | no_license | [
{
"docstring": ":type sentences: List[str] :type times: List[int]",
"name": "__init__",
"signature": "def __init__(self, sentences, times)"
},
{
"docstring": ":type c: str :rtype: List[str]",
"name": "input",
"signature": "def input(self, c)"
}
] | 2 | stack_v2_sparse_classes_30k_train_016142 | Implement the Python class `AutocompleteSystem` described below.
Class description:
Implement the AutocompleteSystem class.
Method signatures and docstrings:
- def __init__(self, sentences, times): :type sentences: List[str] :type times: List[int]
- def input(self, c): :type c: str :rtype: List[str] | Implement the Python class `AutocompleteSystem` described below.
Class description:
Implement the AutocompleteSystem class.
Method signatures and docstrings:
- def __init__(self, sentences, times): :type sentences: List[str] :type times: List[int]
- def input(self, c): :type c: str :rtype: List[str]
<|skeleton|>
cla... | 5e9d8d998973e02f2914d9bfc5837f1734867eaf | <|skeleton|>
class AutocompleteSystem:
def __init__(self, sentences, times):
""":type sentences: List[str] :type times: List[int]"""
<|body_0|>
def input(self, c):
""":type c: str :rtype: List[str]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AutocompleteSystem:
def __init__(self, sentences, times):
""":type sentences: List[str] :type times: List[int]"""
self.prefix = defaultdict(list)
self.count = defaultdict(int)
n = len(sentences)
for i in range(n):
self.count[sentences[i]] = times[i]
... | the_stack_v2_python_sparse | python/AutocompleteSystem.py | Strideradu/leetcode | train | 2 | |
0f712b96ba8c6b625c63fd2b5d0c5c8df48228bb | [
"super(Conv2dSubsampling, self).__init__()\nself.dropout = dropout\nwith self.init_scope():\n n = 1 * 3 * 3\n stvd = 1.0 / np.sqrt(n)\n self.conv1 = L.Convolution2D(1, channels, 3, stride=2, pad=1, initialW=initialW(scale=stvd), initial_bias=initial_bias(scale=stvd))\n n = channels * 3 * 3\n stvd = 1... | <|body_start_0|>
super(Conv2dSubsampling, self).__init__()
self.dropout = dropout
with self.init_scope():
n = 1 * 3 * 3
stvd = 1.0 / np.sqrt(n)
self.conv1 = L.Convolution2D(1, channels, 3, stride=2, pad=1, initialW=initialW(scale=stvd), initial_bias=initial_bi... | Convolutional 2D subsampling (to 1/4 length). :param int idim: input dim :param int odim: output dim :param flaot dropout_rate: dropout rate | Conv2dSubsampling | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Conv2dSubsampling:
"""Convolutional 2D subsampling (to 1/4 length). :param int idim: input dim :param int odim: output dim :param flaot dropout_rate: dropout rate"""
def __init__(self, channels, idim, dims, dropout=0.1, initialW=None, initial_bias=None):
"""Initialize Conv2dSubsampli... | stack_v2_sparse_classes_36k_train_010987 | 3,464 | permissive | [
{
"docstring": "Initialize Conv2dSubsampling.",
"name": "__init__",
"signature": "def __init__(self, channels, idim, dims, dropout=0.1, initialW=None, initial_bias=None)"
},
{
"docstring": "Subsample x. :param chainer.Variable x: input tensor :return: subsampled x and mask",
"name": "forward... | 2 | null | Implement the Python class `Conv2dSubsampling` described below.
Class description:
Convolutional 2D subsampling (to 1/4 length). :param int idim: input dim :param int odim: output dim :param flaot dropout_rate: dropout rate
Method signatures and docstrings:
- def __init__(self, channels, idim, dims, dropout=0.1, init... | Implement the Python class `Conv2dSubsampling` described below.
Class description:
Convolutional 2D subsampling (to 1/4 length). :param int idim: input dim :param int odim: output dim :param flaot dropout_rate: dropout rate
Method signatures and docstrings:
- def __init__(self, channels, idim, dims, dropout=0.1, init... | bcd20948db7846ee523443ef9fd78c7a1248c95e | <|skeleton|>
class Conv2dSubsampling:
"""Convolutional 2D subsampling (to 1/4 length). :param int idim: input dim :param int odim: output dim :param flaot dropout_rate: dropout rate"""
def __init__(self, channels, idim, dims, dropout=0.1, initialW=None, initial_bias=None):
"""Initialize Conv2dSubsampli... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Conv2dSubsampling:
"""Convolutional 2D subsampling (to 1/4 length). :param int idim: input dim :param int odim: output dim :param flaot dropout_rate: dropout rate"""
def __init__(self, channels, idim, dims, dropout=0.1, initialW=None, initial_bias=None):
"""Initialize Conv2dSubsampling."""
... | the_stack_v2_python_sparse | espnet/nets/chainer_backend/transformer/subsampling.py | espnet/espnet | train | 7,242 |
da86104ed431189255bcad26bfeee2527f32c1cf | [
"mixins = []\nfor m in self.__class__.mro():\n if m == CrispyFilterMixin:\n break\n mixins.append(m.__name__)\nreturn mixins",
"mixins = self.get_mixin_names()\nres = []\nfor m in mixins:\n try:\n tmp = self.__getattribute__('_' + m + '__' + attr)\n res.append(tmp)\n except Attrib... | <|body_start_0|>
mixins = []
for m in self.__class__.mro():
if m == CrispyFilterMixin:
break
mixins.append(m.__name__)
return mixins
<|end_body_0|>
<|body_start_1|>
mixins = self.get_mixin_names()
res = []
for m in mixins:
... | A specific Form mixin, specialiced for filters (common case). It tries to be smart in constructing the layout object. It looks at the __layout attributes of all the current class and all the mixins, up to this base class. In that order, it patches together the layout object itself. | CrispyFilterMixin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CrispyFilterMixin:
"""A specific Form mixin, specialiced for filters (common case). It tries to be smart in constructing the layout object. It looks at the __layout attributes of all the current class and all the mixins, up to this base class. In that order, it patches together the layout object ... | stack_v2_sparse_classes_36k_train_010988 | 20,411 | permissive | [
{
"docstring": "Get all the mixins standing between the current class and this base class, in mro order. We need the names later on, not the class object.",
"name": "get_mixin_names",
"signature": "def get_mixin_names(self)"
},
{
"docstring": "Assuming that the current class has several mixings ... | 3 | stack_v2_sparse_classes_30k_train_014239 | Implement the Python class `CrispyFilterMixin` described below.
Class description:
A specific Form mixin, specialiced for filters (common case). It tries to be smart in constructing the layout object. It looks at the __layout attributes of all the current class and all the mixins, up to this base class. In that order,... | Implement the Python class `CrispyFilterMixin` described below.
Class description:
A specific Form mixin, specialiced for filters (common case). It tries to be smart in constructing the layout object. It looks at the __layout attributes of all the current class and all the mixins, up to this base class. In that order,... | 29aab0065ff69c7c4d52812508167514d635cab9 | <|skeleton|>
class CrispyFilterMixin:
"""A specific Form mixin, specialiced for filters (common case). It tries to be smart in constructing the layout object. It looks at the __layout attributes of all the current class and all the mixins, up to this base class. In that order, it patches together the layout object ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CrispyFilterMixin:
"""A specific Form mixin, specialiced for filters (common case). It tries to be smart in constructing the layout object. It looks at the __layout attributes of all the current class and all the mixins, up to this base class. In that order, it patches together the layout object itself."""
... | the_stack_v2_python_sparse | arbeitsplan/forms.py | hkarl/svpb | train | 3 |
46f324c5e26717807963c5ebe1bd34e28eacbc0e | [
"language = Language.objects.all()\nserializer = LanguageSerializer(language, many=True)\nreturn Response(serializer.data)",
"queryset = Language.objects.all()\nlanguage = get_object_or_404(queryset, pk=pk)\nserializer = LanguageSerializer(language)\nreturn Response(serializer.data)"
] | <|body_start_0|>
language = Language.objects.all()
serializer = LanguageSerializer(language, many=True)
return Response(serializer.data)
<|end_body_0|>
<|body_start_1|>
queryset = Language.objects.all()
language = get_object_or_404(queryset, pk=pk)
serializer = LanguageS... | LanguageView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LanguageView:
def list(self, request):
"""Получение списка языков"""
<|body_0|>
def retrieve(self, request, pk=None):
"""Получение языка по идентификатору pk - идентификатор языка"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
language = Language.o... | stack_v2_sparse_classes_36k_train_010989 | 12,404 | no_license | [
{
"docstring": "Получение списка языков",
"name": "list",
"signature": "def list(self, request)"
},
{
"docstring": "Получение языка по идентификатору pk - идентификатор языка",
"name": "retrieve",
"signature": "def retrieve(self, request, pk=None)"
}
] | 2 | stack_v2_sparse_classes_30k_train_020999 | Implement the Python class `LanguageView` described below.
Class description:
Implement the LanguageView class.
Method signatures and docstrings:
- def list(self, request): Получение списка языков
- def retrieve(self, request, pk=None): Получение языка по идентификатору pk - идентификатор языка | Implement the Python class `LanguageView` described below.
Class description:
Implement the LanguageView class.
Method signatures and docstrings:
- def list(self, request): Получение списка языков
- def retrieve(self, request, pk=None): Получение языка по идентификатору pk - идентификатор языка
<|skeleton|>
class La... | be47a0a6f50bf8680b22e0b9cae3e3b34a198a3d | <|skeleton|>
class LanguageView:
def list(self, request):
"""Получение списка языков"""
<|body_0|>
def retrieve(self, request, pk=None):
"""Получение языка по идентификатору pk - идентификатор языка"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LanguageView:
def list(self, request):
"""Получение списка языков"""
language = Language.objects.all()
serializer = LanguageSerializer(language, many=True)
return Response(serializer.data)
def retrieve(self, request, pk=None):
"""Получение языка по идентификатору p... | the_stack_v2_python_sparse | StarfinderBack/starfinder/views.py | Skirgus/StarfinderMasterAssistant | train | 0 | |
a0ce0633e62c741c62d1a8b146f5f5c77e000e68 | [
"l_obj = IrrigationZoneData()\nXmlConfigTools.read_base_object_xml(l_obj, p_xml)\nl_obj.Comment = PutGetXML.get_text_from_xml(p_xml, 'Comment')\nl_obj.Duration = PutGetXML.get_int_from_xml(p_xml, 'Duration', 0)\nreturn l_obj",
"l_sys = IrrigationSystemData()\nl_count = 0\nXmlConfigTools.read_base_object_xml(l_sys... | <|body_start_0|>
l_obj = IrrigationZoneData()
XmlConfigTools.read_base_object_xml(l_obj, p_xml)
l_obj.Comment = PutGetXML.get_text_from_xml(p_xml, 'Comment')
l_obj.Duration = PutGetXML.get_int_from_xml(p_xml, 'Duration', 0)
return l_obj
<|end_body_0|>
<|body_start_1|>
l_... | Xml | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Xml:
def _read_one_zone(p_xml):
"""@param p_xml: XML information for one Zone. @return: an IrrigationZone object filled in with data from the XML passed in"""
<|body_0|>
def _read_one_irrigation_system(p_xml):
"""May contain zero or more zones. In general each zone i... | stack_v2_sparse_classes_36k_train_010990 | 4,994 | permissive | [
{
"docstring": "@param p_xml: XML information for one Zone. @return: an IrrigationZone object filled in with data from the XML passed in",
"name": "_read_one_zone",
"signature": "def _read_one_zone(p_xml)"
},
{
"docstring": "May contain zero or more zones. In general each zone is controlled by a... | 6 | null | Implement the Python class `Xml` described below.
Class description:
Implement the Xml class.
Method signatures and docstrings:
- def _read_one_zone(p_xml): @param p_xml: XML information for one Zone. @return: an IrrigationZone object filled in with data from the XML passed in
- def _read_one_irrigation_system(p_xml)... | Implement the Python class `Xml` described below.
Class description:
Implement the Xml class.
Method signatures and docstrings:
- def _read_one_zone(p_xml): @param p_xml: XML information for one Zone. @return: an IrrigationZone object filled in with data from the XML passed in
- def _read_one_irrigation_system(p_xml)... | 6444ed0b4c38ab59b9e419e4d54d65d598e6a54e | <|skeleton|>
class Xml:
def _read_one_zone(p_xml):
"""@param p_xml: XML information for one Zone. @return: an IrrigationZone object filled in with data from the XML passed in"""
<|body_0|>
def _read_one_irrigation_system(p_xml):
"""May contain zero or more zones. In general each zone i... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Xml:
def _read_one_zone(p_xml):
"""@param p_xml: XML information for one Zone. @return: an IrrigationZone object filled in with data from the XML passed in"""
l_obj = IrrigationZoneData()
XmlConfigTools.read_base_object_xml(l_obj, p_xml)
l_obj.Comment = PutGetXML.get_text_from_... | the_stack_v2_python_sparse | src/Modules/Irrigation/irrigation_xml.py | bopopescu/PyHouse_1 | train | 0 | |
0bbb4bb944817aae58064d26b3668e31b914da70 | [
"self.starturl = 'http://www.kuaidaili.com/free/inha/'\nself.urls = self.get_urls()\nself.proxylist = self.get_proxy_list(self.urls)\nself.filename = 'proxy.txt'\nself.saveFile(self.filename, self.proxylist)",
"urls = []\nfor i in range(1, 2):\n url = self.starturl + str(i)\n urls.append(url)\nreturn urls",... | <|body_start_0|>
self.starturl = 'http://www.kuaidaili.com/free/inha/'
self.urls = self.get_urls()
self.proxylist = self.get_proxy_list(self.urls)
self.filename = 'proxy.txt'
self.saveFile(self.filename, self.proxylist)
<|end_body_0|>
<|body_start_1|>
urls = []
f... | 获取代理的类 | GetProxy | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GetProxy:
"""获取代理的类"""
def __init__(self):
"""初始化整个类"""
<|body_0|>
def get_urls(self):
"""返回一个代理url的列表 :return:"""
<|body_1|>
def get_proxy_list(self, urls):
"""返回抓去到代理的列表 整个爬虫的关键 :param urls: :return:"""
<|body_2|>
def saveFile(... | stack_v2_sparse_classes_36k_train_010991 | 2,798 | no_license | [
{
"docstring": "初始化整个类",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "返回一个代理url的列表 :return:",
"name": "get_urls",
"signature": "def get_urls(self)"
},
{
"docstring": "返回抓去到代理的列表 整个爬虫的关键 :param urls: :return:",
"name": "get_proxy_list",
"signatu... | 4 | stack_v2_sparse_classes_30k_val_001020 | Implement the Python class `GetProxy` described below.
Class description:
获取代理的类
Method signatures and docstrings:
- def __init__(self): 初始化整个类
- def get_urls(self): 返回一个代理url的列表 :return:
- def get_proxy_list(self, urls): 返回抓去到代理的列表 整个爬虫的关键 :param urls: :return:
- def saveFile(self, filename, proxy_list): 将爬取到的代理写到文件... | Implement the Python class `GetProxy` described below.
Class description:
获取代理的类
Method signatures and docstrings:
- def __init__(self): 初始化整个类
- def get_urls(self): 返回一个代理url的列表 :return:
- def get_proxy_list(self, urls): 返回抓去到代理的列表 整个爬虫的关键 :param urls: :return:
- def saveFile(self, filename, proxy_list): 将爬取到的代理写到文件... | 06d1a652d7238081708e56be87edb4d4abc8f066 | <|skeleton|>
class GetProxy:
"""获取代理的类"""
def __init__(self):
"""初始化整个类"""
<|body_0|>
def get_urls(self):
"""返回一个代理url的列表 :return:"""
<|body_1|>
def get_proxy_list(self, urls):
"""返回抓去到代理的列表 整个爬虫的关键 :param urls: :return:"""
<|body_2|>
def saveFile(... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GetProxy:
"""获取代理的类"""
def __init__(self):
"""初始化整个类"""
self.starturl = 'http://www.kuaidaili.com/free/inha/'
self.urls = self.get_urls()
self.proxylist = self.get_proxy_list(self.urls)
self.filename = 'proxy.txt'
self.saveFile(self.filename, self.proxylist... | the_stack_v2_python_sparse | spyder/selenium_demo/kuaiproxy.py | 1019350030wfj/python_demo | train | 0 |
24e9c16067d785ce00fc3635b61bc37e503ff3d9 | [
"self.path_ref = _ref\nself.params = []\nif not _ref is None:\n self.read(_ref, _skip_header)\npass",
"if not isfile(_ref):\n print(f'[info] file not exist. :{_ref}')\n return False\nself.params = []\nwith open(_ref, 'r', encoding=_enc) as f:\n csv_reader = csv.reader(f, delimiter=',', quotechar='\"')... | <|body_start_0|>
self.path_ref = _ref
self.params = []
if not _ref is None:
self.read(_ref, _skip_header)
pass
<|end_body_0|>
<|body_start_1|>
if not isfile(_ref):
print(f'[info] file not exist. :{_ref}')
return False
self.params = []
... | CsvLoader | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CsvLoader:
def __init__(self, _ref: str=None, _enc='utf-8', _skip_header=False) -> None:
"""read file Parameters ---------- _ref : str csv file path _enc : str encoder 'utf-8' or 'shift_jis' or 'euc_jp' _skip_header : str csv file path"""
<|body_0|>
def read(self, _ref: str,... | stack_v2_sparse_classes_36k_train_010992 | 2,273 | no_license | [
{
"docstring": "read file Parameters ---------- _ref : str csv file path _enc : str encoder 'utf-8' or 'shift_jis' or 'euc_jp' _skip_header : str csv file path",
"name": "__init__",
"signature": "def __init__(self, _ref: str=None, _enc='utf-8', _skip_header=False) -> None"
},
{
"docstring": "rea... | 4 | stack_v2_sparse_classes_30k_train_015268 | Implement the Python class `CsvLoader` described below.
Class description:
Implement the CsvLoader class.
Method signatures and docstrings:
- def __init__(self, _ref: str=None, _enc='utf-8', _skip_header=False) -> None: read file Parameters ---------- _ref : str csv file path _enc : str encoder 'utf-8' or 'shift_jis'... | Implement the Python class `CsvLoader` described below.
Class description:
Implement the CsvLoader class.
Method signatures and docstrings:
- def __init__(self, _ref: str=None, _enc='utf-8', _skip_header=False) -> None: read file Parameters ---------- _ref : str csv file path _enc : str encoder 'utf-8' or 'shift_jis'... | a47f4f4c6192f26e68a433c1067e97993092012e | <|skeleton|>
class CsvLoader:
def __init__(self, _ref: str=None, _enc='utf-8', _skip_header=False) -> None:
"""read file Parameters ---------- _ref : str csv file path _enc : str encoder 'utf-8' or 'shift_jis' or 'euc_jp' _skip_header : str csv file path"""
<|body_0|>
def read(self, _ref: str,... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CsvLoader:
def __init__(self, _ref: str=None, _enc='utf-8', _skip_header=False) -> None:
"""read file Parameters ---------- _ref : str csv file path _enc : str encoder 'utf-8' or 'shift_jis' or 'euc_jp' _skip_header : str csv file path"""
self.path_ref = _ref
self.params = []
i... | the_stack_v2_python_sparse | loader/csv_loader.py | twintee/modpy | train | 0 | |
dad74fa89cfd44bb2bcf7fa17afb49328662d2df | [
"file_presets = FilePreset.objects.filter(input_template=input_template)\nfile_preset_files = [x for x in project.files if FilePreset.match_any(x.filename, file_presets)]\nif len(file_preset_files) == 1 and input_template.unique:\n return [FileSetting.objects.get_or_create(file=x, input_template=input_template) ... | <|body_start_0|>
file_presets = FilePreset.objects.filter(input_template=input_template)
file_preset_files = [x for x in project.files if FilePreset.match_any(x.filename, file_presets)]
if len(file_preset_files) == 1 and input_template.unique:
return [FileSetting.objects.get_or_creat... | Class for adding Files to InputTemplates. | FileSetting | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FileSetting:
"""Class for adding Files to InputTemplates."""
def create_for_file_presets(input_template: InputTemplate, project: Project):
"""Create file settings automatically for the input template using the file presets."""
<|body_0|>
def create_for_input_template(inp... | stack_v2_sparse_classes_36k_train_010993 | 25,346 | no_license | [
{
"docstring": "Create file settings automatically for the input template using the file presets.",
"name": "create_for_file_presets",
"signature": "def create_for_file_presets(input_template: InputTemplate, project: Project)"
},
{
"docstring": "Create file settings automatically for the input t... | 2 | stack_v2_sparse_classes_30k_train_000116 | Implement the Python class `FileSetting` described below.
Class description:
Class for adding Files to InputTemplates.
Method signatures and docstrings:
- def create_for_file_presets(input_template: InputTemplate, project: Project): Create file settings automatically for the input template using the file presets.
- d... | Implement the Python class `FileSetting` described below.
Class description:
Class for adding Files to InputTemplates.
Method signatures and docstrings:
- def create_for_file_presets(input_template: InputTemplate, project: Project): Create file settings automatically for the input template using the file presets.
- d... | dfa60c9a812e52fa44f0d3cf1c201943574976df | <|skeleton|>
class FileSetting:
"""Class for adding Files to InputTemplates."""
def create_for_file_presets(input_template: InputTemplate, project: Project):
"""Create file settings automatically for the input template using the file presets."""
<|body_0|>
def create_for_input_template(inp... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FileSetting:
"""Class for adding Files to InputTemplates."""
def create_for_file_presets(input_template: InputTemplate, project: Project):
"""Create file settings automatically for the input template using the file presets."""
file_presets = FilePreset.objects.filter(input_template=input_... | the_stack_v2_python_sparse | equestria/processes/models.py | KiOui/CLST-2020 | train | 0 |
5523041fdc891a576efd7aac8eb3da3ba61fc5ea | [
"product = ProductModel.query.filter_by(id=product_id).first()\nif not product:\n product_api.abort(404, 'Product {} not found'.format(product_id))\nelse:\n return product",
"product = ProductModel.query.filter_by(id=product_id).first()\nif not product:\n product_api.abort(404, 'Product {} not found'.for... | <|body_start_0|>
product = ProductModel.query.filter_by(id=product_id).first()
if not product:
product_api.abort(404, 'Product {} not found'.format(product_id))
else:
return product
<|end_body_0|>
<|body_start_1|>
product = ProductModel.query.filter_by(id=product... | Product | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Product:
def get(self, product_id):
"""Get a product given its identifier"""
<|body_0|>
def delete(self, product_id):
"""Delete a product given its identifier"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
product = ProductModel.query.filter_by(id=... | stack_v2_sparse_classes_36k_train_010994 | 2,095 | no_license | [
{
"docstring": "Get a product given its identifier",
"name": "get",
"signature": "def get(self, product_id)"
},
{
"docstring": "Delete a product given its identifier",
"name": "delete",
"signature": "def delete(self, product_id)"
}
] | 2 | stack_v2_sparse_classes_30k_train_018204 | Implement the Python class `Product` described below.
Class description:
Implement the Product class.
Method signatures and docstrings:
- def get(self, product_id): Get a product given its identifier
- def delete(self, product_id): Delete a product given its identifier | Implement the Python class `Product` described below.
Class description:
Implement the Product class.
Method signatures and docstrings:
- def get(self, product_id): Get a product given its identifier
- def delete(self, product_id): Delete a product given its identifier
<|skeleton|>
class Product:
def get(self, ... | f380164e92b70874042364ad4b5b20c5793d6921 | <|skeleton|>
class Product:
def get(self, product_id):
"""Get a product given its identifier"""
<|body_0|>
def delete(self, product_id):
"""Delete a product given its identifier"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Product:
def get(self, product_id):
"""Get a product given its identifier"""
product = ProductModel.query.filter_by(id=product_id).first()
if not product:
product_api.abort(404, 'Product {} not found'.format(product_id))
else:
return product
def del... | the_stack_v2_python_sparse | project/app/main/controllers/product.py | ArielVilleda/docker-flask-postgres | train | 0 | |
a10bcaeec6ab1d0db5624810b75b64b16fa5857e | [
"order = get_object_or_404(Order, id=order_id)\nform = TaskForm()\nreturn render(request, 'task/add-task.html', {'form': form, 'func': 'Add', 'order': order})",
"form = TaskForm(request.POST)\norder = get_object_or_404(Order, id=order_id)\nif form.is_valid():\n new_task = form.save(commit=False)\n new_task.... | <|body_start_0|>
order = get_object_or_404(Order, id=order_id)
form = TaskForm()
return render(request, 'task/add-task.html', {'form': form, 'func': 'Add', 'order': order})
<|end_body_0|>
<|body_start_1|>
form = TaskForm(request.POST)
order = get_object_or_404(Order, id=order_id... | Class based view for adding new task. | TaskAddView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TaskAddView:
"""Class based view for adding new task."""
def get(self, request, order_id):
"""Return add new task form."""
<|body_0|>
def post(self, request, order_id):
"""Save task and redirect to task list."""
<|body_1|>
<|end_skeleton|>
<|body_start_... | stack_v2_sparse_classes_36k_train_010995 | 3,296 | no_license | [
{
"docstring": "Return add new task form.",
"name": "get",
"signature": "def get(self, request, order_id)"
},
{
"docstring": "Save task and redirect to task list.",
"name": "post",
"signature": "def post(self, request, order_id)"
}
] | 2 | stack_v2_sparse_classes_30k_train_010136 | Implement the Python class `TaskAddView` described below.
Class description:
Class based view for adding new task.
Method signatures and docstrings:
- def get(self, request, order_id): Return add new task form.
- def post(self, request, order_id): Save task and redirect to task list. | Implement the Python class `TaskAddView` described below.
Class description:
Class based view for adding new task.
Method signatures and docstrings:
- def get(self, request, order_id): Return add new task form.
- def post(self, request, order_id): Save task and redirect to task list.
<|skeleton|>
class TaskAddView:
... | 93c3106ab90fb9aed85658f93f51686ba4734091 | <|skeleton|>
class TaskAddView:
"""Class based view for adding new task."""
def get(self, request, order_id):
"""Return add new task form."""
<|body_0|>
def post(self, request, order_id):
"""Save task and redirect to task list."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TaskAddView:
"""Class based view for adding new task."""
def get(self, request, order_id):
"""Return add new task form."""
order = get_object_or_404(Order, id=order_id)
form = TaskForm()
return render(request, 'task/add-task.html', {'form': form, 'func': 'Add', 'order': or... | the_stack_v2_python_sparse | order/views/task_views.py | saadali5997/tms | train | 0 |
e125e655a8febcb816ca069eaaa3bbd2076ae4e7 | [
"super(Decoder, self).__init__()\nself.filter_widths = [N // 2 ** (l + 1) for l in range(layers)]\ntotal_input_width = np.array(self.filter_widths).sum()\nself.bottleneck = nn.Sequential(nn.ConvTranspose1d(N, total_input_width, kernel_size=1, stride=1, bias=False), nn.ReLU())\nself.filters = nn.ModuleList([])\nfor ... | <|body_start_0|>
super(Decoder, self).__init__()
self.filter_widths = [N // 2 ** (l + 1) for l in range(layers)]
total_input_width = np.array(self.filter_widths).sum()
self.bottleneck = nn.Sequential(nn.ConvTranspose1d(N, total_input_width, kernel_size=1, stride=1, bias=False), nn.ReLU()... | Decodes the latent representation back to waveforms | Decoder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Decoder:
"""Decodes the latent representation back to waveforms"""
def __init__(self, N, kernel_size, stride, layers):
"""Arguments: N {int} -- Dimension of the input latent representation kernel_size {int} -- Base convolutional kernel size stride {int} -- Stride of the transposed co... | stack_v2_sparse_classes_36k_train_010996 | 37,269 | no_license | [
{
"docstring": "Arguments: N {int} -- Dimension of the input latent representation kernel_size {int} -- Base convolutional kernel size stride {int} -- Stride of the transposed covolutions layers {int} -- Number of parallel convolutions with different kernel sizes",
"name": "__init__",
"signature": "def ... | 2 | stack_v2_sparse_classes_30k_train_019097 | Implement the Python class `Decoder` described below.
Class description:
Decodes the latent representation back to waveforms
Method signatures and docstrings:
- def __init__(self, N, kernel_size, stride, layers): Arguments: N {int} -- Dimension of the input latent representation kernel_size {int} -- Base convolutiona... | Implement the Python class `Decoder` described below.
Class description:
Decodes the latent representation back to waveforms
Method signatures and docstrings:
- def __init__(self, N, kernel_size, stride, layers): Arguments: N {int} -- Dimension of the input latent representation kernel_size {int} -- Base convolutiona... | 7e55a422588c1d1e00f35a3d3a3ff896cce59e18 | <|skeleton|>
class Decoder:
"""Decodes the latent representation back to waveforms"""
def __init__(self, N, kernel_size, stride, layers):
"""Arguments: N {int} -- Dimension of the input latent representation kernel_size {int} -- Base convolutional kernel size stride {int} -- Stride of the transposed co... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Decoder:
"""Decodes the latent representation back to waveforms"""
def __init__(self, N, kernel_size, stride, layers):
"""Arguments: N {int} -- Dimension of the input latent representation kernel_size {int} -- Base convolutional kernel size stride {int} -- Stride of the transposed covolutions lay... | the_stack_v2_python_sparse | generated/test_pfnet_research_meta_tasnet.py | jansel/pytorch-jit-paritybench | train | 35 |
1923a27c2be1c4052b36a1c2736d7d15a07027f4 | [
"login_client(self.client)\ndata = {'name': 'service1', 'description': 'this is a service', 'rate': '0.5'}\nresponse = self.client.post('/regions/loc1/services/', data, format='json')\nself.assertEqual(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED)",
"data = {'name': 'service1', 'description': 'this is... | <|body_start_0|>
login_client(self.client)
data = {'name': 'service1', 'description': 'this is a service', 'rate': '0.5'}
response = self.client.post('/regions/loc1/services/', data, format='json')
self.assertEqual(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED)
<|end_body_0|>
... | Service_List_Tests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Service_List_Tests:
def test_post_services_list_fail_1(self):
"""Should return a 405 code even when logged in."""
<|body_0|>
def test_post_services_list_permission_denied(self):
"""Checks that post attempt is denied."""
<|body_1|>
def test_get_services_l... | stack_v2_sparse_classes_36k_train_010997 | 24,881 | no_license | [
{
"docstring": "Should return a 405 code even when logged in.",
"name": "test_post_services_list_fail_1",
"signature": "def test_post_services_list_fail_1(self)"
},
{
"docstring": "Checks that post attempt is denied.",
"name": "test_post_services_list_permission_denied",
"signature": "de... | 3 | stack_v2_sparse_classes_30k_train_015844 | Implement the Python class `Service_List_Tests` described below.
Class description:
Implement the Service_List_Tests class.
Method signatures and docstrings:
- def test_post_services_list_fail_1(self): Should return a 405 code even when logged in.
- def test_post_services_list_permission_denied(self): Checks that pos... | Implement the Python class `Service_List_Tests` described below.
Class description:
Implement the Service_List_Tests class.
Method signatures and docstrings:
- def test_post_services_list_fail_1(self): Should return a 405 code even when logged in.
- def test_post_services_list_permission_denied(self): Checks that pos... | d6b288e632ccfcd7c8e88ff1e5f496fb8e525710 | <|skeleton|>
class Service_List_Tests:
def test_post_services_list_fail_1(self):
"""Should return a 405 code even when logged in."""
<|body_0|>
def test_post_services_list_permission_denied(self):
"""Checks that post attempt is denied."""
<|body_1|>
def test_get_services_l... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Service_List_Tests:
def test_post_services_list_fail_1(self):
"""Should return a 405 code even when logged in."""
login_client(self.client)
data = {'name': 'service1', 'description': 'this is a service', 'rate': '0.5'}
response = self.client.post('/regions/loc1/services/', data... | the_stack_v2_python_sparse | clerk-vagrant-test/Clerk/clerk/tests_api.py | unexceptable/clerk | train | 0 | |
948465607d5d900b53e50bf6d6c5af150c9f8456 | [
"super(DiscreteConvGenerator, self).__init__()\nself.design_shape = design_shape\nself.latent_size = latent_size\nself.embed_0 = tfkl.Dense(hidden)\nself.embed_0.build((None, 1))\nself.dense_0 = tfkl.Conv1D(hidden, 3, strides=1, padding='same')\nself.dense_0.build((None, None, latent_size + hidden))\nself.ln_0 = tf... | <|body_start_0|>
super(DiscreteConvGenerator, self).__init__()
self.design_shape = design_shape
self.latent_size = latent_size
self.embed_0 = tfkl.Dense(hidden)
self.embed_0.build((None, 1))
self.dense_0 = tfkl.Conv1D(hidden, 3, strides=1, padding='same')
self.den... | A Fully Connected Network conditioned on a score | DiscreteConvGenerator | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DiscreteConvGenerator:
"""A Fully Connected Network conditioned on a score"""
def __init__(self, design_shape, latent_size, hidden=50):
"""Create a fully connected architecture using keras that can process several parallel streams of weights and biases Args: design_shape: List[int] a... | stack_v2_sparse_classes_36k_train_010998 | 30,757 | permissive | [
{
"docstring": "Create a fully connected architecture using keras that can process several parallel streams of weights and biases Args: design_shape: List[int] a list of tuple of integers that represents the shape of a float design for a particular task latent_size: int the number of hidden units in the latent ... | 2 | stack_v2_sparse_classes_30k_train_003424 | Implement the Python class `DiscreteConvGenerator` described below.
Class description:
A Fully Connected Network conditioned on a score
Method signatures and docstrings:
- def __init__(self, design_shape, latent_size, hidden=50): Create a fully connected architecture using keras that can process several parallel stre... | Implement the Python class `DiscreteConvGenerator` described below.
Class description:
A Fully Connected Network conditioned on a score
Method signatures and docstrings:
- def __init__(self, design_shape, latent_size, hidden=50): Create a fully connected architecture using keras that can process several parallel stre... | d46ff40d8b665953afb64a3332ddf1953b8a0766 | <|skeleton|>
class DiscreteConvGenerator:
"""A Fully Connected Network conditioned on a score"""
def __init__(self, design_shape, latent_size, hidden=50):
"""Create a fully connected architecture using keras that can process several parallel streams of weights and biases Args: design_shape: List[int] a... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DiscreteConvGenerator:
"""A Fully Connected Network conditioned on a score"""
def __init__(self, design_shape, latent_size, hidden=50):
"""Create a fully connected architecture using keras that can process several parallel streams of weights and biases Args: design_shape: List[int] a list of tupl... | the_stack_v2_python_sparse | design_baselines/mins/nets.py | stjordanis/design-baselines | train | 0 |
412f56d37953828168a990f05e663165e334e00e | [
"current_user_reviews = request.user.reviews.all()\nserializer = self.get_serializer(instance=current_user_reviews, many=True)\nreturn Response(serializer.data, status=status.HTTP_200_OK)",
"current_user_reviews = request.user.reviews_of.all()\nserializer = self.get_serializer(instance=current_user_reviews, many=... | <|body_start_0|>
current_user_reviews = request.user.reviews.all()
serializer = self.get_serializer(instance=current_user_reviews, many=True)
return Response(serializer.data, status=status.HTTP_200_OK)
<|end_body_0|>
<|body_start_1|>
current_user_reviews = request.user.reviews_of.all()
... | ViewSet for viewing reviews. | UserReviewViewSet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserReviewViewSet:
"""ViewSet for viewing reviews."""
def from_me(self, request, *args, **kwargs):
"""Return list of reviews from current user."""
<|body_0|>
def to_me(self, request, *args, **kwargs):
"""Return list of reviews about current user."""
<|bod... | stack_v2_sparse_classes_36k_train_010999 | 3,759 | no_license | [
{
"docstring": "Return list of reviews from current user.",
"name": "from_me",
"signature": "def from_me(self, request, *args, **kwargs)"
},
{
"docstring": "Return list of reviews about current user.",
"name": "to_me",
"signature": "def to_me(self, request, *args, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004019 | Implement the Python class `UserReviewViewSet` described below.
Class description:
ViewSet for viewing reviews.
Method signatures and docstrings:
- def from_me(self, request, *args, **kwargs): Return list of reviews from current user.
- def to_me(self, request, *args, **kwargs): Return list of reviews about current u... | Implement the Python class `UserReviewViewSet` described below.
Class description:
ViewSet for viewing reviews.
Method signatures and docstrings:
- def from_me(self, request, *args, **kwargs): Return list of reviews from current user.
- def to_me(self, request, *args, **kwargs): Return list of reviews about current u... | 0879ade24685b628624dce06698f8a0afd042000 | <|skeleton|>
class UserReviewViewSet:
"""ViewSet for viewing reviews."""
def from_me(self, request, *args, **kwargs):
"""Return list of reviews from current user."""
<|body_0|>
def to_me(self, request, *args, **kwargs):
"""Return list of reviews about current user."""
<|bod... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserReviewViewSet:
"""ViewSet for viewing reviews."""
def from_me(self, request, *args, **kwargs):
"""Return list of reviews from current user."""
current_user_reviews = request.user.reviews.all()
serializer = self.get_serializer(instance=current_user_reviews, many=True)
r... | the_stack_v2_python_sparse | camp-python-2021-find-me-develop/apps/users/api/views.py | rhanmar/oi_projects_summer_2021 | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.