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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
be56379db7c2b6cd3f43763ecd014f3aac1c99b8 | [
"first = head\nsecond = first\nwhile n:\n n -= 1\n first = first.next\nif not first:\n return head.next\nwhile first.next:\n first = first.next\n second = second.next\nsecond.next = second.next.next\nreturn head",
"length = 0\ndummy = ListNode(0)\ndummy.next = head\nfirst = head\nwhile first:\n ... | <|body_start_0|>
first = head
second = first
while n:
n -= 1
first = first.next
if not first:
return head.next
while first.next:
first = first.next
second = second.next
second.next = second.next.next
retu... | LinkedList | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LinkedList:
def remove_nth_node(self, head: 'ListNode', n: int) -> 'ListNode':
"""Approach: One Pass Time Complexity: O(L) Space Complexity: O(1) :param head: :param n: :return:"""
<|body_0|>
def remove_nth_node_(self, head: 'ListNode', n: int) -> 'ListNode':
"""Appr... | stack_v2_sparse_classes_36k_train_002800 | 1,277 | no_license | [
{
"docstring": "Approach: One Pass Time Complexity: O(L) Space Complexity: O(1) :param head: :param n: :return:",
"name": "remove_nth_node",
"signature": "def remove_nth_node(self, head: 'ListNode', n: int) -> 'ListNode'"
},
{
"docstring": "Approach: Two Pass Time Complexity: O(L) Space Complexi... | 2 | null | Implement the Python class `LinkedList` described below.
Class description:
Implement the LinkedList class.
Method signatures and docstrings:
- def remove_nth_node(self, head: 'ListNode', n: int) -> 'ListNode': Approach: One Pass Time Complexity: O(L) Space Complexity: O(1) :param head: :param n: :return:
- def remov... | Implement the Python class `LinkedList` described below.
Class description:
Implement the LinkedList class.
Method signatures and docstrings:
- def remove_nth_node(self, head: 'ListNode', n: int) -> 'ListNode': Approach: One Pass Time Complexity: O(L) Space Complexity: O(1) :param head: :param n: :return:
- def remov... | 65cc78b5afa0db064f9fe8f06597e3e120f7363d | <|skeleton|>
class LinkedList:
def remove_nth_node(self, head: 'ListNode', n: int) -> 'ListNode':
"""Approach: One Pass Time Complexity: O(L) Space Complexity: O(1) :param head: :param n: :return:"""
<|body_0|>
def remove_nth_node_(self, head: 'ListNode', n: int) -> 'ListNode':
"""Appr... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LinkedList:
def remove_nth_node(self, head: 'ListNode', n: int) -> 'ListNode':
"""Approach: One Pass Time Complexity: O(L) Space Complexity: O(1) :param head: :param n: :return:"""
first = head
second = first
while n:
n -= 1
first = first.next
if... | the_stack_v2_python_sparse | revisited_2021/linked_list/remove_nth_node.py | Shiv2157k/leet_code | train | 1 | |
0cabedfadb79d035c5e8bbd8a8b5155911fe6fe4 | [
"self.set_animation(score)\nsuper().__init__(img=self.coin_img, x=x, y=y)\nself.score = score\nself.speed = 400\nself.visible = True\nself.point(150, 0)",
"image = silver_coin_img if score <= 20 else gold_coin_img\ncoin_seq = pyglet.image.ImageGrid(image, 10, 1)\nself.coin_img = Animation.from_image_sequence(coin... | <|body_start_0|>
self.set_animation(score)
super().__init__(img=self.coin_img, x=x, y=y)
self.score = score
self.speed = 400
self.visible = True
self.point(150, 0)
<|end_body_0|>
<|body_start_1|>
image = silver_coin_img if score <= 20 else gold_coin_img
c... | 硬币精灵 | CoinSprite | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CoinSprite:
"""硬币精灵"""
def __init__(self, x=0, y=0, score=0):
"""初始化"""
<|body_0|>
def set_animation(self, score):
"""设置动画"""
<|body_1|>
def move_down(self, dt):
"""移动硬币"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
self.s... | stack_v2_sparse_classes_36k_train_002801 | 4,509 | no_license | [
{
"docstring": "初始化",
"name": "__init__",
"signature": "def __init__(self, x=0, y=0, score=0)"
},
{
"docstring": "设置动画",
"name": "set_animation",
"signature": "def set_animation(self, score)"
},
{
"docstring": "移动硬币",
"name": "move_down",
"signature": "def move_down(self,... | 3 | null | Implement the Python class `CoinSprite` described below.
Class description:
硬币精灵
Method signatures and docstrings:
- def __init__(self, x=0, y=0, score=0): 初始化
- def set_animation(self, score): 设置动画
- def move_down(self, dt): 移动硬币 | Implement the Python class `CoinSprite` described below.
Class description:
硬币精灵
Method signatures and docstrings:
- def __init__(self, x=0, y=0, score=0): 初始化
- def set_animation(self, score): 设置动画
- def move_down(self, dt): 移动硬币
<|skeleton|>
class CoinSprite:
"""硬币精灵"""
def __init__(self, x=0, y=0, score=... | 941e29d5f39092b02f8486a435e61c7ec2bdcdb6 | <|skeleton|>
class CoinSprite:
"""硬币精灵"""
def __init__(self, x=0, y=0, score=0):
"""初始化"""
<|body_0|>
def set_animation(self, score):
"""设置动画"""
<|body_1|>
def move_down(self, dt):
"""移动硬币"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CoinSprite:
"""硬币精灵"""
def __init__(self, x=0, y=0, score=0):
"""初始化"""
self.set_animation(score)
super().__init__(img=self.coin_img, x=x, y=y)
self.score = score
self.speed = 400
self.visible = True
self.point(150, 0)
def set_animation(self, s... | the_stack_v2_python_sparse | Python趣味编程:从入门到人工智能/第31课_捕鱼达人/示例程序/version3/game_sprites.py | zhy0313/children-python | train | 0 |
72a8f8cf816b6702816bb86c24104ee5941fc19a | [
"ans = []\nif root.left:\n ans += self.binaryTreePathsHelper(root.left, s + '->' + str(root.left.val))\nif root.right:\n ans += self.binaryTreePathsHelper(root.right, s + '->' + str(root.right.val))\nif root.left is None and root.right is None:\n ans = [s]\nreturn ans",
"if root is None:\n return []\n... | <|body_start_0|>
ans = []
if root.left:
ans += self.binaryTreePathsHelper(root.left, s + '->' + str(root.left.val))
if root.right:
ans += self.binaryTreePathsHelper(root.right, s + '->' + str(root.right.val))
if root.left is None and root.right is None:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def binaryTreePathsHelper(self, root, s):
""":type root: TreeNode :rtype: List[str]"""
<|body_0|>
def binaryTreePaths(self, root):
""":type root: TreeNode :rtype: List[str]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
ans = []
i... | stack_v2_sparse_classes_36k_train_002802 | 932 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: List[str]",
"name": "binaryTreePathsHelper",
"signature": "def binaryTreePathsHelper(self, root, s)"
},
{
"docstring": ":type root: TreeNode :rtype: List[str]",
"name": "binaryTreePaths",
"signature": "def binaryTreePaths(self, root)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def binaryTreePathsHelper(self, root, s): :type root: TreeNode :rtype: List[str]
- def binaryTreePaths(self, root): :type root: TreeNode :rtype: List[str] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def binaryTreePathsHelper(self, root, s): :type root: TreeNode :rtype: List[str]
- def binaryTreePaths(self, root): :type root: TreeNode :rtype: List[str]
<|skeleton|>
class Sol... | c9a53ef2fc1fd1fea7377c3633689fa87601dba6 | <|skeleton|>
class Solution:
def binaryTreePathsHelper(self, root, s):
""":type root: TreeNode :rtype: List[str]"""
<|body_0|>
def binaryTreePaths(self, root):
""":type root: TreeNode :rtype: List[str]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def binaryTreePathsHelper(self, root, s):
""":type root: TreeNode :rtype: List[str]"""
ans = []
if root.left:
ans += self.binaryTreePathsHelper(root.left, s + '->' + str(root.left.val))
if root.right:
ans += self.binaryTreePathsHelper(root.righ... | the_stack_v2_python_sparse | leetcode257.py | yuchien302/LeetCode | train | 2 | |
2c6248d15f6e826b54efdc24b94d6134a0146782 | [
"if not heights:\n return 0\nminl = []\nminh = float('inf')\nfor i in range(len(heights)):\n if heights[i] < minh:\n minh = heights[i]\n minl = [i]\n elif heights[i] == minh:\n minl.append(i)\narea_list = [minh * len(heights), self.largestRectangleArea(heights[:minl[0]]), self.largestR... | <|body_start_0|>
if not heights:
return 0
minl = []
minh = float('inf')
for i in range(len(heights)):
if heights[i] < minh:
minh = heights[i]
minl = [i]
elif heights[i] == minh:
minl.append(i)
are... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def largestRectangleArea1(self, heights) -> int:
""":param heights: :return: int 用小数分割递归求解,OT"""
<|body_0|>
def largestRectangleArea(self, heights):
""":type heights: List[int] :rtype: int 利用栈构造升序序列,若下一个数是升序则进栈,否则开始退栈,直到出现小于等于当前数的元素。注意栈内是升序序列, 这就找到了介于两个小数之间... | stack_v2_sparse_classes_36k_train_002803 | 2,140 | no_license | [
{
"docstring": ":param heights: :return: int 用小数分割递归求解,OT",
"name": "largestRectangleArea1",
"signature": "def largestRectangleArea1(self, heights) -> int"
},
{
"docstring": ":type heights: List[int] :rtype: int 利用栈构造升序序列,若下一个数是升序则进栈,否则开始退栈,直到出现小于等于当前数的元素。注意栈内是升序序列, 这就找到了介于两个小数之间的一个序列,计算这个序列的面积,... | 2 | stack_v2_sparse_classes_30k_train_001693 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def largestRectangleArea1(self, heights) -> int: :param heights: :return: int 用小数分割递归求解,OT
- def largestRectangleArea(self, heights): :type heights: List[int] :rtype: int 利用栈构造升序... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def largestRectangleArea1(self, heights) -> int: :param heights: :return: int 用小数分割递归求解,OT
- def largestRectangleArea(self, heights): :type heights: List[int] :rtype: int 利用栈构造升序... | 2306c494ea8f754aa4b954732f1331f3922235c1 | <|skeleton|>
class Solution:
def largestRectangleArea1(self, heights) -> int:
""":param heights: :return: int 用小数分割递归求解,OT"""
<|body_0|>
def largestRectangleArea(self, heights):
""":type heights: List[int] :rtype: int 利用栈构造升序序列,若下一个数是升序则进栈,否则开始退栈,直到出现小于等于当前数的元素。注意栈内是升序序列, 这就找到了介于两个小数之间... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def largestRectangleArea1(self, heights) -> int:
""":param heights: :return: int 用小数分割递归求解,OT"""
if not heights:
return 0
minl = []
minh = float('inf')
for i in range(len(heights)):
if heights[i] < minh:
minh = heights[i... | the_stack_v2_python_sparse | 84_LargestRectangleInHistogram.py | ZhangNANPy/LeetCode | train | 0 | |
b0045d2decbf1a95ab9575ea369b4a04f1fff945 | [
"request = pecan.request\ncontext = request.environ['context']\nrrset = self.central_api.get_recordset(context, None, recordset_id)\nLOG.info('Retrieved %(recordset)s', {'recordset': rrset})\ncanonical_loc = common.get_rrset_canonical_location(request, rrset.zone_id, recordset_id)\npecan.core.redirect(location=cano... | <|body_start_0|>
request = pecan.request
context = request.environ['context']
rrset = self.central_api.get_recordset(context, None, recordset_id)
LOG.info('Retrieved %(recordset)s', {'recordset': rrset})
canonical_loc = common.get_rrset_canonical_location(request, rrset.zone_id, ... | RecordSetsViewController | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RecordSetsViewController:
def get_one(self, recordset_id):
"""Get RecordSet"""
<|body_0|>
def get_all(self, **params):
"""List RecordSets"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
request = pecan.request
context = request.environ['cont... | stack_v2_sparse_classes_36k_train_002804 | 2,253 | permissive | [
{
"docstring": "Get RecordSet",
"name": "get_one",
"signature": "def get_one(self, recordset_id)"
},
{
"docstring": "List RecordSets",
"name": "get_all",
"signature": "def get_all(self, **params)"
}
] | 2 | stack_v2_sparse_classes_30k_train_009417 | Implement the Python class `RecordSetsViewController` described below.
Class description:
Implement the RecordSetsViewController class.
Method signatures and docstrings:
- def get_one(self, recordset_id): Get RecordSet
- def get_all(self, **params): List RecordSets | Implement the Python class `RecordSetsViewController` described below.
Class description:
Implement the RecordSetsViewController class.
Method signatures and docstrings:
- def get_one(self, recordset_id): Get RecordSet
- def get_all(self, **params): List RecordSets
<|skeleton|>
class RecordSetsViewController:
d... | 360433b38b449d1c53ab1357fdb0c4608c09efa5 | <|skeleton|>
class RecordSetsViewController:
def get_one(self, recordset_id):
"""Get RecordSet"""
<|body_0|>
def get_all(self, **params):
"""List RecordSets"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RecordSetsViewController:
def get_one(self, recordset_id):
"""Get RecordSet"""
request = pecan.request
context = request.environ['context']
rrset = self.central_api.get_recordset(context, None, recordset_id)
LOG.info('Retrieved %(recordset)s', {'recordset': rrset})
... | the_stack_v2_python_sparse | designate/api/v2/controllers/recordsets.py | openstack/designate | train | 156 | |
d05f400552ebf568250df561dea2196126921694 | [
"super().__init__()\nself.pref_model = pref_model\nif isinstance(pref_model, DeterministicModel):\n assert sampler is None\n self.sampler = None\nelif sampler is None:\n self.sampler = IIDNormalSampler(sample_shape=torch.Size([1]))\nelse:\n self.sampler = sampler",
"post = self.pref_model.posterior(sa... | <|body_start_0|>
super().__init__()
self.pref_model = pref_model
if isinstance(pref_model, DeterministicModel):
assert sampler is None
self.sampler = None
elif sampler is None:
self.sampler = IIDNormalSampler(sample_shape=torch.Size([1]))
else:... | Learned preference objective constructed from a preference model. For input `samples`, it samples each individual sample again from the latent preference posterior distribution using `pref_model` and return the posterior mean. Example: >>> train_X = torch.rand(2, 2) >>> train_comps = torch.LongTensor([[0, 1]]) >>> pref... | LearnedObjective | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LearnedObjective:
"""Learned preference objective constructed from a preference model. For input `samples`, it samples each individual sample again from the latent preference posterior distribution using `pref_model` and return the posterior mean. Example: >>> train_X = torch.rand(2, 2) >>> train... | stack_v2_sparse_classes_36k_train_002805 | 22,827 | permissive | [
{
"docstring": "Args: pref_model: A BoTorch model, which models the latent preference/utility function. Given an input tensor of size `sample_size x batch_shape x N x d`, its `posterior` method should return a `Posterior` object with single outcome representing the utility values of the input. sampler: Sampler ... | 2 | stack_v2_sparse_classes_30k_train_005299 | Implement the Python class `LearnedObjective` described below.
Class description:
Learned preference objective constructed from a preference model. For input `samples`, it samples each individual sample again from the latent preference posterior distribution using `pref_model` and return the posterior mean. Example: >... | Implement the Python class `LearnedObjective` described below.
Class description:
Learned preference objective constructed from a preference model. For input `samples`, it samples each individual sample again from the latent preference posterior distribution using `pref_model` and return the posterior mean. Example: >... | 4cc5ed59b2e8a9c780f786830c548e05cc74d53c | <|skeleton|>
class LearnedObjective:
"""Learned preference objective constructed from a preference model. For input `samples`, it samples each individual sample again from the latent preference posterior distribution using `pref_model` and return the posterior mean. Example: >>> train_X = torch.rand(2, 2) >>> train... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LearnedObjective:
"""Learned preference objective constructed from a preference model. For input `samples`, it samples each individual sample again from the latent preference posterior distribution using `pref_model` and return the posterior mean. Example: >>> train_X = torch.rand(2, 2) >>> train_comps = torc... | the_stack_v2_python_sparse | botorch/acquisition/objective.py | pytorch/botorch | train | 2,891 |
7c9c7c0f46469cd613145f619274e4bf3ddfa473 | [
"self.image_pause_not_mouseover = pygame.image.load('images/pause_not_mouseover.png')\nself.image_pause_mouseover = pygame.image.load('images/pause_mouseover.png')\nself.image_resume_not_mouseover = pygame.image.load('images/resume_not_mouseover.png')\nself.image_resume_mouseover = pygame.image.load('images/resume_... | <|body_start_0|>
self.image_pause_not_mouseover = pygame.image.load('images/pause_not_mouseover.png')
self.image_pause_mouseover = pygame.image.load('images/pause_mouseover.png')
self.image_resume_not_mouseover = pygame.image.load('images/resume_not_mouseover.png')
self.image_resume_mous... | 暂停按钮类 | PauseButton | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PauseButton:
"""暂停按钮类"""
def __init__(self, window):
"""初始化暂停按钮"""
<|body_0|>
def switch_image(self, event):
"""切换暂停按钮的图片"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.image_pause_not_mouseover = pygame.image.load('images/pause_not_mouseo... | stack_v2_sparse_classes_36k_train_002806 | 2,550 | no_license | [
{
"docstring": "初始化暂停按钮",
"name": "__init__",
"signature": "def __init__(self, window)"
},
{
"docstring": "切换暂停按钮的图片",
"name": "switch_image",
"signature": "def switch_image(self, event)"
}
] | 2 | stack_v2_sparse_classes_30k_train_018183 | Implement the Python class `PauseButton` described below.
Class description:
暂停按钮类
Method signatures and docstrings:
- def __init__(self, window): 初始化暂停按钮
- def switch_image(self, event): 切换暂停按钮的图片 | Implement the Python class `PauseButton` described below.
Class description:
暂停按钮类
Method signatures and docstrings:
- def __init__(self, window): 初始化暂停按钮
- def switch_image(self, event): 切换暂停按钮的图片
<|skeleton|>
class PauseButton:
"""暂停按钮类"""
def __init__(self, window):
"""初始化暂停按钮"""
<|body_0... | 66f7f801e1395207778484e1543ea26309d4b354 | <|skeleton|>
class PauseButton:
"""暂停按钮类"""
def __init__(self, window):
"""初始化暂停按钮"""
<|body_0|>
def switch_image(self, event):
"""切换暂停按钮的图片"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PauseButton:
"""暂停按钮类"""
def __init__(self, window):
"""初始化暂停按钮"""
self.image_pause_not_mouseover = pygame.image.load('images/pause_not_mouseover.png')
self.image_pause_mouseover = pygame.image.load('images/pause_mouseover.png')
self.image_resume_not_mouseover = pygame.ima... | the_stack_v2_python_sparse | python/practise/PlaneWar/pause_button.py | anzhihe/learning | train | 1,443 |
e8daa0bacbab67f1791047339a2d592fc52dd95a | [
"command = 'msiexec.exe /norestart /q /i \"{0}\" /l! \"{1}\" ALLUSERS=1'.format(filename, log_path)\nif optional_parameters:\n for k, v in optional_parameters.items():\n if v and v != '':\n command += ' {0}=\"{1}\"'.format(k, v)\nexit_code = Core.get_instance().api.os.shell.cmd(command, ignore_... | <|body_start_0|>
command = 'msiexec.exe /norestart /q /i "{0}" /l! "{1}" ALLUSERS=1'.format(filename, log_path)
if optional_parameters:
for k, v in optional_parameters.items():
if v and v != '':
command += ' {0}="{1}"'.format(k, v)
exit_code = Core... | Api to install or uninstall MSI | MsiManager | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MsiManager:
"""Api to install or uninstall MSI"""
def install(filename, log_path, optional_parameters: dict=None, ignore_exit_code=False, no_wait=False):
"""Install MSI with options :param filename: :param log_path: :param optional_parameters: :param ignore_exit_code: :param no_wait:... | stack_v2_sparse_classes_36k_train_002807 | 3,389 | permissive | [
{
"docstring": "Install MSI with options :param filename: :param log_path: :param optional_parameters: :param ignore_exit_code: :param no_wait:",
"name": "install",
"signature": "def install(filename, log_path, optional_parameters: dict=None, ignore_exit_code=False, no_wait=False)"
},
{
"docstri... | 3 | null | Implement the Python class `MsiManager` described below.
Class description:
Api to install or uninstall MSI
Method signatures and docstrings:
- def install(filename, log_path, optional_parameters: dict=None, ignore_exit_code=False, no_wait=False): Install MSI with options :param filename: :param log_path: :param opti... | Implement the Python class `MsiManager` described below.
Class description:
Api to install or uninstall MSI
Method signatures and docstrings:
- def install(filename, log_path, optional_parameters: dict=None, ignore_exit_code=False, no_wait=False): Install MSI with options :param filename: :param log_path: :param opti... | a33ba547f553bcce415f7a54bd89c444f82e48ee | <|skeleton|>
class MsiManager:
"""Api to install or uninstall MSI"""
def install(filename, log_path, optional_parameters: dict=None, ignore_exit_code=False, no_wait=False):
"""Install MSI with options :param filename: :param log_path: :param optional_parameters: :param ignore_exit_code: :param no_wait:... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MsiManager:
"""Api to install or uninstall MSI"""
def install(filename, log_path, optional_parameters: dict=None, ignore_exit_code=False, no_wait=False):
"""Install MSI with options :param filename: :param log_path: :param optional_parameters: :param ignore_exit_code: :param no_wait:"""
c... | the_stack_v2_python_sparse | Zoocmd/core/api/windows/msi_manager.py | worriy/zoo | train | 0 |
46848f3765cf026e7c289c263b3b11a48f0032b9 | [
"if not email:\n raise ValueError('Users must have a institutional email address')\nuser = self.model(first_name=first_name, middle_initial=middle_initial, last_name=last_name, email=self.normalize_email(email), contact=contact, role=role, college=college, program=program)\nuser.set_password(password)\nuser.save... | <|body_start_0|>
if not email:
raise ValueError('Users must have a institutional email address')
user = self.model(first_name=first_name, middle_initial=middle_initial, last_name=last_name, email=self.normalize_email(email), contact=contact, role=role, college=college, program=program)
... | MyUserManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyUserManager:
def create_user(self, first_name, middle_initial, last_name, college, email, contact, role, program, password=None):
"""Creates and saves a User with the given email, favorite color and password."""
<|body_0|>
def create_superuser(self, first_name, middle_init... | stack_v2_sparse_classes_36k_train_002808 | 4,458 | no_license | [
{
"docstring": "Creates and saves a User with the given email, favorite color and password.",
"name": "create_user",
"signature": "def create_user(self, first_name, middle_initial, last_name, college, email, contact, role, program, password=None)"
},
{
"docstring": "Creates and saves a superuser... | 2 | stack_v2_sparse_classes_30k_train_010019 | Implement the Python class `MyUserManager` described below.
Class description:
Implement the MyUserManager class.
Method signatures and docstrings:
- def create_user(self, first_name, middle_initial, last_name, college, email, contact, role, program, password=None): Creates and saves a User with the given email, favo... | Implement the Python class `MyUserManager` described below.
Class description:
Implement the MyUserManager class.
Method signatures and docstrings:
- def create_user(self, first_name, middle_initial, last_name, college, email, contact, role, program, password=None): Creates and saves a User with the given email, favo... | 9b7a441d4a315b3da7cefb6c7a0daad18167341a | <|skeleton|>
class MyUserManager:
def create_user(self, first_name, middle_initial, last_name, college, email, contact, role, program, password=None):
"""Creates and saves a User with the given email, favorite color and password."""
<|body_0|>
def create_superuser(self, first_name, middle_init... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MyUserManager:
def create_user(self, first_name, middle_initial, last_name, college, email, contact, role, program, password=None):
"""Creates and saves a User with the given email, favorite color and password."""
if not email:
raise ValueError('Users must have a institutional emai... | the_stack_v2_python_sparse | geo/members/models.py | RadySonabu/Accreditation-and-Content-Management-System-Applciation | train | 0 | |
ff5ae2769106a5a11c261c4c881275dcd3c98ce2 | [
"logger.debug(subscription)\nself.send(subscription)\nreply = self.get_response(err='Timeout on notifications subscription.')\nif '<ok/>' not in reply:\n raise HoneycombError('Notifications subscription failed with message: {0}'.format(reply))\nlogger.debug('Notifications subscription successful.')",
"logger.d... | <|body_start_0|>
logger.debug(subscription)
self.send(subscription)
reply = self.get_response(err='Timeout on notifications subscription.')
if '<ok/>' not in reply:
raise HoneycombError('Notifications subscription failed with message: {0}'.format(reply))
logger.debug(... | Implements keywords for receiving Honeycomb notifications. The keywords implemented in this class make it possible to: - receive notifications from Honeycomb - read received notifications | Notifications | [
"CC-BY-4.0",
"Apache-2.0",
"LicenseRef-scancode-dco-1.1"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Notifications:
"""Implements keywords for receiving Honeycomb notifications. The keywords implemented in this class make it possible to: - receive notifications from Honeycomb - read received notifications"""
def add_notification_listener(self, subscription):
"""Open a new channel on... | stack_v2_sparse_classes_36k_train_002809 | 2,391 | permissive | [
{
"docstring": "Open a new channel on the SSH session, connect to Netconf subsystem and subscribe to receive Honeycomb notifications. :param subscription: RPC for subscription to notifications. :type subscription: str :raises HoneycombError: If subscription to notifications fails.",
"name": "add_notificatio... | 2 | null | Implement the Python class `Notifications` described below.
Class description:
Implements keywords for receiving Honeycomb notifications. The keywords implemented in this class make it possible to: - receive notifications from Honeycomb - read received notifications
Method signatures and docstrings:
- def add_notific... | Implement the Python class `Notifications` described below.
Class description:
Implements keywords for receiving Honeycomb notifications. The keywords implemented in this class make it possible to: - receive notifications from Honeycomb - read received notifications
Method signatures and docstrings:
- def add_notific... | 3151c98618c78e3782e48bbe4d9c8f906c126f69 | <|skeleton|>
class Notifications:
"""Implements keywords for receiving Honeycomb notifications. The keywords implemented in this class make it possible to: - receive notifications from Honeycomb - read received notifications"""
def add_notification_listener(self, subscription):
"""Open a new channel on... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Notifications:
"""Implements keywords for receiving Honeycomb notifications. The keywords implemented in this class make it possible to: - receive notifications from Honeycomb - read received notifications"""
def add_notification_listener(self, subscription):
"""Open a new channel on the SSH sess... | the_stack_v2_python_sparse | resources/libraries/python/honeycomb/Notifications.py | preym17/csit | train | 0 |
25038af93dabe7ca6f16dddaa390b8bb905c6899 | [
"if not args_lateral:\n args_lateral = {'K_P': 0.3, 'K_D': 0.0, 'K_I': 0.0}\nif not args_longitudinal:\n args_longitudinal = {'K_P': 40.0, 'K_D': 0.1, 'K_I': 4}\nself._vehicle = vehicle\nself._lon_controller = PIDLongitudinalController(self._vehicle, **args_longitudinal)\nself._lat_controller = PIDLateralCont... | <|body_start_0|>
if not args_lateral:
args_lateral = {'K_P': 0.3, 'K_D': 0.0, 'K_I': 0.0}
if not args_longitudinal:
args_longitudinal = {'K_P': 40.0, 'K_D': 0.1, 'K_I': 4}
self._vehicle = vehicle
self._lon_controller = PIDLongitudinalController(self._vehicle, **ar... | VehiclePIDController is the combination of two PID controllers (lateral and longitudinal) to perform the low level control a vehicle from client side | VehiclePIDController | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VehiclePIDController:
"""VehiclePIDController is the combination of two PID controllers (lateral and longitudinal) to perform the low level control a vehicle from client side"""
def __init__(self, vehicle, args_lateral=None, args_longitudinal=None):
""":param vehicle: actor to apply ... | stack_v2_sparse_classes_36k_train_002810 | 18,045 | permissive | [
{
"docstring": ":param vehicle: actor to apply to local planner logic onto :param args_lateral: dictionary of arguments to set the lateral PID controller using the following semantics: K_P -- Proportional term K_D -- Differential term K_I -- Integral term :param args_longitudinal: dictionary of arguments to set... | 2 | stack_v2_sparse_classes_30k_train_004544 | Implement the Python class `VehiclePIDController` described below.
Class description:
VehiclePIDController is the combination of two PID controllers (lateral and longitudinal) to perform the low level control a vehicle from client side
Method signatures and docstrings:
- def __init__(self, vehicle, args_lateral=None,... | Implement the Python class `VehiclePIDController` described below.
Class description:
VehiclePIDController is the combination of two PID controllers (lateral and longitudinal) to perform the low level control a vehicle from client side
Method signatures and docstrings:
- def __init__(self, vehicle, args_lateral=None,... | 9eb522358fa4c253d74bca185b654522fc63f7f7 | <|skeleton|>
class VehiclePIDController:
"""VehiclePIDController is the combination of two PID controllers (lateral and longitudinal) to perform the low level control a vehicle from client side"""
def __init__(self, vehicle, args_lateral=None, args_longitudinal=None):
""":param vehicle: actor to apply ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VehiclePIDController:
"""VehiclePIDController is the combination of two PID controllers (lateral and longitudinal) to perform the low level control a vehicle from client side"""
def __init__(self, vehicle, args_lateral=None, args_longitudinal=None):
""":param vehicle: actor to apply to local plan... | the_stack_v2_python_sparse | car_chasing/dynamic_frenet.py | DevGlitch/delamain | train | 3 |
c861396ad766887d4c8613df582d09c5647972f7 | [
"self.key = key\nself.in_degree = 0\nself.out_degree = 0\nself.weight_list = []\nself.adjust_list = []\nself.backup_in_degree = self.in_degree\nself.backup_out_degree = self.out_degree\nself.dist = 0",
"self.adjust_list.append(to_vertex)\nself.out_degree += 1\nself.backup_out_degree += 1"
] | <|body_start_0|>
self.key = key
self.in_degree = 0
self.out_degree = 0
self.weight_list = []
self.adjust_list = []
self.backup_in_degree = self.in_degree
self.backup_out_degree = self.out_degree
self.dist = 0
<|end_body_0|>
<|body_start_1|>
self.a... | vertex | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class vertex:
def __init__(self, key, weight=None):
""":param key: :param weight:"""
<|body_0|>
def add_adjust(self, to_vertex):
"""给节点添加邻接节点 :param to_vertex: 本节点邻接的另一个节点 :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.key = key
sel... | stack_v2_sparse_classes_36k_train_002811 | 699 | no_license | [
{
"docstring": ":param key: :param weight:",
"name": "__init__",
"signature": "def __init__(self, key, weight=None)"
},
{
"docstring": "给节点添加邻接节点 :param to_vertex: 本节点邻接的另一个节点 :return:",
"name": "add_adjust",
"signature": "def add_adjust(self, to_vertex)"
}
] | 2 | stack_v2_sparse_classes_30k_val_000468 | Implement the Python class `vertex` described below.
Class description:
Implement the vertex class.
Method signatures and docstrings:
- def __init__(self, key, weight=None): :param key: :param weight:
- def add_adjust(self, to_vertex): 给节点添加邻接节点 :param to_vertex: 本节点邻接的另一个节点 :return: | Implement the Python class `vertex` described below.
Class description:
Implement the vertex class.
Method signatures and docstrings:
- def __init__(self, key, weight=None): :param key: :param weight:
- def add_adjust(self, to_vertex): 给节点添加邻接节点 :param to_vertex: 本节点邻接的另一个节点 :return:
<|skeleton|>
class vertex:
... | d59f9b3940647548f92ca2819dd5dd2699ea7cbe | <|skeleton|>
class vertex:
def __init__(self, key, weight=None):
""":param key: :param weight:"""
<|body_0|>
def add_adjust(self, to_vertex):
"""给节点添加邻接节点 :param to_vertex: 本节点邻接的另一个节点 :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class vertex:
def __init__(self, key, weight=None):
""":param key: :param weight:"""
self.key = key
self.in_degree = 0
self.out_degree = 0
self.weight_list = []
self.adjust_list = []
self.backup_in_degree = self.in_degree
self.backup_out_degree = self.... | the_stack_v2_python_sparse | algorithm/graph/vertex.py | LX2010JY/py_new | train | 0 | |
249d5eff3aec6b89f4452556bf9be895ff8e6d87 | [
"if len(num) == 1:\n return num[0]\nmajority_count = len(num) / 2 + 1\nmajority = dict()\nfor n in num:\n if majority.has_key(n):\n majority[n] += 1\n if majority[n] == majority_count:\n return n\n else:\n majority[n] = 1",
"current_candidate = None\ncounter = 0\nfor n in ... | <|body_start_0|>
if len(num) == 1:
return num[0]
majority_count = len(num) / 2 + 1
majority = dict()
for n in num:
if majority.has_key(n):
majority[n] += 1
if majority[n] == majority_count:
return n
e... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def hashtable(num):
"""Find the element that appears more the n/2 times Args: num: a list of integers Returns: an integer"""
<|body_0|>
def Boyer_Moore_Majority_Voting(num):
"""O(n) runtime"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
i... | stack_v2_sparse_classes_36k_train_002812 | 1,153 | no_license | [
{
"docstring": "Find the element that appears more the n/2 times Args: num: a list of integers Returns: an integer",
"name": "hashtable",
"signature": "def hashtable(num)"
},
{
"docstring": "O(n) runtime",
"name": "Boyer_Moore_Majority_Voting",
"signature": "def Boyer_Moore_Majority_Voti... | 2 | stack_v2_sparse_classes_30k_train_017695 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hashtable(num): Find the element that appears more the n/2 times Args: num: a list of integers Returns: an integer
- def Boyer_Moore_Majority_Voting(num): O(n) runtime | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hashtable(num): Find the element that appears more the n/2 times Args: num: a list of integers Returns: an integer
- def Boyer_Moore_Majority_Voting(num): O(n) runtime
<|ske... | 5fb1808d234f41e531e189b8d87db50ccac3f99f | <|skeleton|>
class Solution:
def hashtable(num):
"""Find the element that appears more the n/2 times Args: num: a list of integers Returns: an integer"""
<|body_0|>
def Boyer_Moore_Majority_Voting(num):
"""O(n) runtime"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def hashtable(num):
"""Find the element that appears more the n/2 times Args: num: a list of integers Returns: an integer"""
if len(num) == 1:
return num[0]
majority_count = len(num) / 2 + 1
majority = dict()
for n in num:
if majority.h... | the_stack_v2_python_sparse | leetcode/Majority_Element/solution.py | derek-dchu/Python | train | 0 | |
188be7d96b629cb1d84f258e7279114230ae4b49 | [
"self.pat = 'Waldo'\nself.text = text\nobservedStart, observedEnd = matchMaker(self.pat, self.text)\nself.assertEqual(observedStart, None)\nself.assertEqual(observedEnd, None)",
"self.pat = 'Thompson'\nself.text = text\nobservedStart, observedEnd = matchMaker(self.pat, self.text)\nself.assertNotEqual(observedStar... | <|body_start_0|>
self.pat = 'Waldo'
self.text = text
observedStart, observedEnd = matchMaker(self.pat, self.text)
self.assertEqual(observedStart, None)
self.assertEqual(observedEnd, None)
<|end_body_0|>
<|body_start_1|>
self.pat = 'Thompson'
self.text = text
... | regexTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class regexTest:
def testBogusPattern(self):
"""Shouldn't be able to find Waldo in this one"""
<|body_0|>
def testWrongAddress(self):
"""Shoudn't get the right 231, 250 values"""
<|body_1|>
def testRegex(self):
"""Okay, this should work out"""
... | stack_v2_sparse_classes_36k_train_002813 | 1,603 | no_license | [
{
"docstring": "Shouldn't be able to find Waldo in this one",
"name": "testBogusPattern",
"signature": "def testBogusPattern(self)"
},
{
"docstring": "Shoudn't get the right 231, 250 values",
"name": "testWrongAddress",
"signature": "def testWrongAddress(self)"
},
{
"docstring": ... | 3 | null | Implement the Python class `regexTest` described below.
Class description:
Implement the regexTest class.
Method signatures and docstrings:
- def testBogusPattern(self): Shouldn't be able to find Waldo in this one
- def testWrongAddress(self): Shoudn't get the right 231, 250 values
- def testRegex(self): Okay, this s... | Implement the Python class `regexTest` described below.
Class description:
Implement the regexTest class.
Method signatures and docstrings:
- def testBogusPattern(self): Shouldn't be able to find Waldo in this one
- def testWrongAddress(self): Shoudn't get the right 231, 250 values
- def testRegex(self): Okay, this s... | 049c654ed626e97d7fe2f8dc61d84c60f10d7558 | <|skeleton|>
class regexTest:
def testBogusPattern(self):
"""Shouldn't be able to find Waldo in this one"""
<|body_0|>
def testWrongAddress(self):
"""Shoudn't get the right 231, 250 values"""
<|body_1|>
def testRegex(self):
"""Okay, this should work out"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class regexTest:
def testBogusPattern(self):
"""Shouldn't be able to find Waldo in this one"""
self.pat = 'Waldo'
self.text = text
observedStart, observedEnd = matchMaker(self.pat, self.text)
self.assertEqual(observedStart, None)
self.assertEqual(observedEnd, None)
... | the_stack_v2_python_sparse | workspace/Python3_Homework04/src/test_find_regex.py | paulrefalo/Python-2---4 | train | 0 | |
1d47be557f70f7d32c8a19155413ff945f364c3b | [
"self.user_id = str(user_id)\nself.click_data = None\nself.recall_data = []\nself.recommend_newsid = []\nself.n_article = n_article",
"sql = 'select newsid from user_click where userid=%s limit 1 ' % self.user_id\nfor item1 in MYSQL_CLIENT.execute_query(sql):\n newsid = item1['newsid']\n sql = 'select conte... | <|body_start_0|>
self.user_id = str(user_id)
self.click_data = None
self.recall_data = []
self.recommend_newsid = []
self.n_article = n_article
<|end_body_0|>
<|body_start_1|>
sql = 'select newsid from user_click where userid=%s limit 1 ' % self.user_id
for item1... | RecommendEngine | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RecommendEngine:
def __init__(self, user_id, n_article=3):
""":param user_id: 用户ID :param n_article:int, 推荐n_article新闻"""
<|body_0|>
def _get_user_action(self):
"""从msyql获取用户的用户点击行为 :return:"""
<|body_1|>
def _recall(self):
"""召回模块 :return:"""
... | stack_v2_sparse_classes_36k_train_002814 | 3,487 | no_license | [
{
"docstring": ":param user_id: 用户ID :param n_article:int, 推荐n_article新闻",
"name": "__init__",
"signature": "def __init__(self, user_id, n_article=3)"
},
{
"docstring": "从msyql获取用户的用户点击行为 :return:",
"name": "_get_user_action",
"signature": "def _get_user_action(self)"
},
{
"docst... | 5 | stack_v2_sparse_classes_30k_train_013474 | Implement the Python class `RecommendEngine` described below.
Class description:
Implement the RecommendEngine class.
Method signatures and docstrings:
- def __init__(self, user_id, n_article=3): :param user_id: 用户ID :param n_article:int, 推荐n_article新闻
- def _get_user_action(self): 从msyql获取用户的用户点击行为 :return:
- def _r... | Implement the Python class `RecommendEngine` described below.
Class description:
Implement the RecommendEngine class.
Method signatures and docstrings:
- def __init__(self, user_id, n_article=3): :param user_id: 用户ID :param n_article:int, 推荐n_article新闻
- def _get_user_action(self): 从msyql获取用户的用户点击行为 :return:
- def _r... | b5389f4bf3ced1496a00a5263cd94cdc1f29aad8 | <|skeleton|>
class RecommendEngine:
def __init__(self, user_id, n_article=3):
""":param user_id: 用户ID :param n_article:int, 推荐n_article新闻"""
<|body_0|>
def _get_user_action(self):
"""从msyql获取用户的用户点击行为 :return:"""
<|body_1|>
def _recall(self):
"""召回模块 :return:"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RecommendEngine:
def __init__(self, user_id, n_article=3):
""":param user_id: 用户ID :param n_article:int, 推荐n_article新闻"""
self.user_id = str(user_id)
self.click_data = None
self.recall_data = []
self.recommend_newsid = []
self.n_article = n_article
def _get... | the_stack_v2_python_sparse | 11-Recommender_System/recommend.py | GAOYANGAU/AIBigdata | train | 5 | |
b1a4a7a04e6869c2cebf9c0df40c341a272a1505 | [
"wb = load_workbook(excel_path)\nsheetnames = wb.get_sheet_names()\nself.ws = wb.get_sheet_by_name(sheetnames[0])",
"id_list = []\nfor i in range(2, self.ws.max_row + 1):\n if self.ws.cell(i, 1).value not in id_list:\n if i - 1 != self.ws.cell(i, 1).value:\n print('ID自增错误!! 行数:{}'.format(i + ... | <|body_start_0|>
wb = load_workbook(excel_path)
sheetnames = wb.get_sheet_names()
self.ws = wb.get_sheet_by_name(sheetnames[0])
<|end_body_0|>
<|body_start_1|>
id_list = []
for i in range(2, self.ws.max_row + 1):
if self.ws.cell(i, 1).value not in id_list:
... | Csvcheck | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Csvcheck:
def __init__(self, excel_path: str):
"""打开一个excel文件 :param excel_path: :return:"""
<|body_0|>
def check_id(self):
"""检查ID是否重复 是否连续 默认ID在第一列 默认ID从1开始自增 :return:"""
<|body_1|>
def check_lua(self, column_num: int):
"""检查lua数据列 是否存在中文标点符号 是... | stack_v2_sparse_classes_36k_train_002815 | 1,513 | permissive | [
{
"docstring": "打开一个excel文件 :param excel_path: :return:",
"name": "__init__",
"signature": "def __init__(self, excel_path: str)"
},
{
"docstring": "检查ID是否重复 是否连续 默认ID在第一列 默认ID从1开始自增 :return:",
"name": "check_id",
"signature": "def check_id(self)"
},
{
"docstring": "检查lua数据列 是否存在中... | 3 | stack_v2_sparse_classes_30k_train_006317 | Implement the Python class `Csvcheck` described below.
Class description:
Implement the Csvcheck class.
Method signatures and docstrings:
- def __init__(self, excel_path: str): 打开一个excel文件 :param excel_path: :return:
- def check_id(self): 检查ID是否重复 是否连续 默认ID在第一列 默认ID从1开始自增 :return:
- def check_lua(self, column_num: in... | Implement the Python class `Csvcheck` described below.
Class description:
Implement the Csvcheck class.
Method signatures and docstrings:
- def __init__(self, excel_path: str): 打开一个excel文件 :param excel_path: :return:
- def check_id(self): 检查ID是否重复 是否连续 默认ID在第一列 默认ID从1开始自增 :return:
- def check_lua(self, column_num: in... | 9d9ff9fb0dc4f1b63cdd31d6bbc12f9cd467eb81 | <|skeleton|>
class Csvcheck:
def __init__(self, excel_path: str):
"""打开一个excel文件 :param excel_path: :return:"""
<|body_0|>
def check_id(self):
"""检查ID是否重复 是否连续 默认ID在第一列 默认ID从1开始自增 :return:"""
<|body_1|>
def check_lua(self, column_num: int):
"""检查lua数据列 是否存在中文标点符号 是... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Csvcheck:
def __init__(self, excel_path: str):
"""打开一个excel文件 :param excel_path: :return:"""
wb = load_workbook(excel_path)
sheetnames = wb.get_sheet_names()
self.ws = wb.get_sheet_by_name(sheetnames[0])
def check_id(self):
"""检查ID是否重复 是否连续 默认ID在第一列 默认ID从1开始自增 :ret... | the_stack_v2_python_sparse | code/kagamimoe/008/csv_check.py | jianbing/python-practice-for-game-tester | train | 42 | |
5525744c8bc7861366e5a1fdf55b62c3a8210f52 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn DeviceManagementExchangeConnector()",
"from .device_management_exchange_connector_status import DeviceManagementExchangeConnectorStatus\nfrom .device_management_exchange_connector_type import DeviceManagementExchangeConnectorType\nfrom... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return DeviceManagementExchangeConnector()
<|end_body_0|>
<|body_start_1|>
from .device_management_exchange_connector_status import DeviceManagementExchangeConnectorStatus
from .device_manageme... | Entity which represents a connection to an Exchange environment. | DeviceManagementExchangeConnector | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DeviceManagementExchangeConnector:
"""Entity which represents a connection to an Exchange environment."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DeviceManagementExchangeConnector:
"""Creates a new instance of the appropriate class based on discri... | stack_v2_sparse_classes_36k_train_002816 | 5,059 | 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: DeviceManagementExchangeConnector",
"name": "create_from_discriminator_value",
"signature": "def create_from... | 3 | null | Implement the Python class `DeviceManagementExchangeConnector` described below.
Class description:
Entity which represents a connection to an Exchange environment.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DeviceManagementExchangeConnector: Create... | Implement the Python class `DeviceManagementExchangeConnector` described below.
Class description:
Entity which represents a connection to an Exchange environment.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DeviceManagementExchangeConnector: Create... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class DeviceManagementExchangeConnector:
"""Entity which represents a connection to an Exchange environment."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DeviceManagementExchangeConnector:
"""Creates a new instance of the appropriate class based on discri... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DeviceManagementExchangeConnector:
"""Entity which represents a connection to an Exchange environment."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DeviceManagementExchangeConnector:
"""Creates a new instance of the appropriate class based on discriminator value... | the_stack_v2_python_sparse | msgraph/generated/models/device_management_exchange_connector.py | microsoftgraph/msgraph-sdk-python | train | 135 |
93f8196e89dc792c428eacb9d398044c35f58451 | [
"super().__init__()\nself.logger = logging.getLogger(RandomForestDetector.__name__)\nself._n_estimators = n_estimators\nself._criterion = criterion\nself._max_depth = max_depth\nself._min_samples_split = min_samples_split\nself._min_samples_leaf = min_samples_leaf\nself._min_weight_fraction_leaf = min_weight_fracti... | <|body_start_0|>
super().__init__()
self.logger = logging.getLogger(RandomForestDetector.__name__)
self._n_estimators = n_estimators
self._criterion = criterion
self._max_depth = max_depth
self._min_samples_split = min_samples_split
self._min_samples_leaf = min_sa... | RandomForestDetector | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandomForestDetector:
def __init__(self, max_depth=None, n_estimators=100, criterion='gini', min_samples_split=2, min_samples_leaf=1, min_weight_fraction_leaf=0.0, max_features='auto', max_leaf_nodes=None, min_impurity_decrease=0.0, min_impurity_split=None, bootstrap=True, random_state=None, ver... | stack_v2_sparse_classes_36k_train_002817 | 6,292 | permissive | [
{
"docstring": "A random forest is a meta estimator that fits a number of decision tree classifiers on various sub-samples of the dataset and uses averaging to improve the predictive accuracy and control over-fitting. Parameters ---------- :param max_depth: int, default=None The maximum depth of the tree. If No... | 4 | stack_v2_sparse_classes_30k_train_007988 | Implement the Python class `RandomForestDetector` described below.
Class description:
Implement the RandomForestDetector class.
Method signatures and docstrings:
- def __init__(self, max_depth=None, n_estimators=100, criterion='gini', min_samples_split=2, min_samples_leaf=1, min_weight_fraction_leaf=0.0, max_features... | Implement the Python class `RandomForestDetector` described below.
Class description:
Implement the RandomForestDetector class.
Method signatures and docstrings:
- def __init__(self, max_depth=None, n_estimators=100, criterion='gini', min_samples_split=2, min_samples_leaf=1, min_weight_fraction_leaf=0.0, max_features... | 9346979b9a3723349a8248389cc9ca0cf01ded0f | <|skeleton|>
class RandomForestDetector:
def __init__(self, max_depth=None, n_estimators=100, criterion='gini', min_samples_split=2, min_samples_leaf=1, min_weight_fraction_leaf=0.0, max_features='auto', max_leaf_nodes=None, min_impurity_decrease=0.0, min_impurity_split=None, bootstrap=True, random_state=None, ver... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RandomForestDetector:
def __init__(self, max_depth=None, n_estimators=100, criterion='gini', min_samples_split=2, min_samples_leaf=1, min_weight_fraction_leaf=0.0, max_features='auto', max_leaf_nodes=None, min_impurity_decrease=0.0, min_impurity_split=None, bootstrap=True, random_state=None, verbose=0, warm_s... | the_stack_v2_python_sparse | talpa/classifiers/random_forest.py | proy3189/coding_challenge | train | 0 | |
eab19dcb4d3eb51e99a20b1c070ce5d77d702652 | [
"self._num_speakers = num_speakers\nself._num_utterance = num_utterance\nself._loss_type = loss_type\nsuper(Ge2e_loss, self).__init__(**kwargs)",
"if self._loss_type == 'softmax':\n softmax_similarities = -(inputs - tf.math.log(tf.reduce_sum(tf.exp(inputs), axis=-1, keepdims=True) + 1e-06))\n softmax_losses... | <|body_start_0|>
self._num_speakers = num_speakers
self._num_utterance = num_utterance
self._loss_type = loss_type
super(Ge2e_loss, self).__init__(**kwargs)
<|end_body_0|>
<|body_start_1|>
if self._loss_type == 'softmax':
softmax_similarities = -(inputs - tf.math.log... | Note: Compute the loss of ge2e in two ways; softmax, contrast Attributes: __init__: constructs Ge2e_loss class call: compute the ge2e loss | Ge2e_loss | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Ge2e_loss:
"""Note: Compute the loss of ge2e in two ways; softmax, contrast Attributes: __init__: constructs Ge2e_loss class call: compute the ge2e loss"""
def __init__(self, num_speakers, num_utterance, loss_type='softmax', **kwargs):
"""Note: set up the loss configurations; No. spe... | stack_v2_sparse_classes_36k_train_002818 | 2,744 | permissive | [
{
"docstring": "Note: set up the loss configurations; No. speakers, No. utterances, loss_type Args: num_speakers: the number of speakers num_utterance: the number of utterances loss_type: \"softmax\" or \"contrast\" Returns:",
"name": "__init__",
"signature": "def __init__(self, num_speakers, num_uttera... | 2 | stack_v2_sparse_classes_30k_train_006885 | Implement the Python class `Ge2e_loss` described below.
Class description:
Note: Compute the loss of ge2e in two ways; softmax, contrast Attributes: __init__: constructs Ge2e_loss class call: compute the ge2e loss
Method signatures and docstrings:
- def __init__(self, num_speakers, num_utterance, loss_type='softmax',... | Implement the Python class `Ge2e_loss` described below.
Class description:
Note: Compute the loss of ge2e in two ways; softmax, contrast Attributes: __init__: constructs Ge2e_loss class call: compute the ge2e loss
Method signatures and docstrings:
- def __init__(self, num_speakers, num_utterance, loss_type='softmax',... | a4a53ac0c209a283cab4969d61305f056a99b6c3 | <|skeleton|>
class Ge2e_loss:
"""Note: Compute the loss of ge2e in two ways; softmax, contrast Attributes: __init__: constructs Ge2e_loss class call: compute the ge2e loss"""
def __init__(self, num_speakers, num_utterance, loss_type='softmax', **kwargs):
"""Note: set up the loss configurations; No. spe... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Ge2e_loss:
"""Note: Compute the loss of ge2e in two ways; softmax, contrast Attributes: __init__: constructs Ge2e_loss class call: compute the ge2e loss"""
def __init__(self, num_speakers, num_utterance, loss_type='softmax', **kwargs):
"""Note: set up the loss configurations; No. speakers, No. ut... | the_stack_v2_python_sparse | Speaker_Verification/src/layers/ge2e_loss.py | TaeYoon2/KerasSpeakerEmbedding | train | 5 |
989793b27ec9800cdbe94db42a5741762ab44729 | [
"super().__init__(fl_model, data_handler, hyperparams, **kwargs)\ntrain_data, test_data = data_handler.get_data() or (None, None)\nenv_class_ref = data_handler.get_env_class_ref()\nif not inspect.isclass(env_class_ref):\n raise ValueError('Environment reference should be a class reference and not an instance')\n... | <|body_start_0|>
super().__init__(fl_model, data_handler, hyperparams, **kwargs)
train_data, test_data = data_handler.get_data() or (None, None)
env_class_ref = data_handler.get_env_class_ref()
if not inspect.isclass(env_class_ref):
raise ValueError('Environment reference sho... | Local training handler for RL | RLLocalTrainingHandler | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RLLocalTrainingHandler:
"""Local training handler for RL"""
def __init__(self, fl_model, data_handler, hyperparams=None, **kwargs):
"""Initialize LocalTrainingHandler with fl_model, data_handler :param fl_model: model to be trained :type fl_model: `model.FLModel` :param data_handler:... | stack_v2_sparse_classes_36k_train_002819 | 3,100 | permissive | [
{
"docstring": "Initialize LocalTrainingHandler with fl_model, data_handler :param fl_model: model to be trained :type fl_model: `model.FLModel` :param data_handler: data handler that will be used to obtain data and environment reference :type data_handler: `DataHandler` :param hyperparams: Hyperparameters used... | 3 | null | Implement the Python class `RLLocalTrainingHandler` described below.
Class description:
Local training handler for RL
Method signatures and docstrings:
- def __init__(self, fl_model, data_handler, hyperparams=None, **kwargs): Initialize LocalTrainingHandler with fl_model, data_handler :param fl_model: model to be tra... | Implement the Python class `RLLocalTrainingHandler` described below.
Class description:
Local training handler for RL
Method signatures and docstrings:
- def __init__(self, fl_model, data_handler, hyperparams=None, **kwargs): Initialize LocalTrainingHandler with fl_model, data_handler :param fl_model: model to be tra... | 64ffa2ee2e906b1bd6b3dd6aabcf6fc3de862608 | <|skeleton|>
class RLLocalTrainingHandler:
"""Local training handler for RL"""
def __init__(self, fl_model, data_handler, hyperparams=None, **kwargs):
"""Initialize LocalTrainingHandler with fl_model, data_handler :param fl_model: model to be trained :type fl_model: `model.FLModel` :param data_handler:... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RLLocalTrainingHandler:
"""Local training handler for RL"""
def __init__(self, fl_model, data_handler, hyperparams=None, **kwargs):
"""Initialize LocalTrainingHandler with fl_model, data_handler :param fl_model: model to be trained :type fl_model: `model.FLModel` :param data_handler: data handler... | the_stack_v2_python_sparse | debugging-constructs/ibmfl/party/training/rl_local_training_handler.py | SEED-VT/FedDebug | train | 8 |
2243e98d8ce9a4d87d085016f13bf7a18b7cb757 | [
"super().__init__(data_service.coordinator)\nself.platform_name = platform_name\nself.entity_description = description\nself.data_service = data_service\nself._attr_name = f'{platform_name} ({description.name})'",
"if not self.data_service.site_id:\n return None\nreturn f'{self.data_service.site_id}_{self.enti... | <|body_start_0|>
super().__init__(data_service.coordinator)
self.platform_name = platform_name
self.entity_description = description
self.data_service = data_service
self._attr_name = f'{platform_name} ({description.name})'
<|end_body_0|>
<|body_start_1|>
if not self.dat... | Abstract class for a solaredge sensor. | SolarEdgeSensorEntity | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SolarEdgeSensorEntity:
"""Abstract class for a solaredge sensor."""
def __init__(self, platform_name: str, description: SolarEdgeSensorEntityDescription, data_service: SolarEdgeDataService) -> None:
"""Initialize the sensor."""
<|body_0|>
def unique_id(self) -> str | Non... | stack_v2_sparse_classes_36k_train_002820 | 14,385 | permissive | [
{
"docstring": "Initialize the sensor.",
"name": "__init__",
"signature": "def __init__(self, platform_name: str, description: SolarEdgeSensorEntityDescription, data_service: SolarEdgeDataService) -> None"
},
{
"docstring": "Return a unique ID.",
"name": "unique_id",
"signature": "def un... | 2 | null | Implement the Python class `SolarEdgeSensorEntity` described below.
Class description:
Abstract class for a solaredge sensor.
Method signatures and docstrings:
- def __init__(self, platform_name: str, description: SolarEdgeSensorEntityDescription, data_service: SolarEdgeDataService) -> None: Initialize the sensor.
- ... | Implement the Python class `SolarEdgeSensorEntity` described below.
Class description:
Abstract class for a solaredge sensor.
Method signatures and docstrings:
- def __init__(self, platform_name: str, description: SolarEdgeSensorEntityDescription, data_service: SolarEdgeDataService) -> None: Initialize the sensor.
- ... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class SolarEdgeSensorEntity:
"""Abstract class for a solaredge sensor."""
def __init__(self, platform_name: str, description: SolarEdgeSensorEntityDescription, data_service: SolarEdgeDataService) -> None:
"""Initialize the sensor."""
<|body_0|>
def unique_id(self) -> str | Non... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SolarEdgeSensorEntity:
"""Abstract class for a solaredge sensor."""
def __init__(self, platform_name: str, description: SolarEdgeSensorEntityDescription, data_service: SolarEdgeDataService) -> None:
"""Initialize the sensor."""
super().__init__(data_service.coordinator)
self.platf... | the_stack_v2_python_sparse | homeassistant/components/solaredge/sensor.py | home-assistant/core | train | 35,501 |
d90c2497610bba657059a5a1266b11d49b6d085e | [
"super().visit_ClassDef(node)\ntry:\n cls = self.builder.current.contents[node.name]\nexcept KeyError:\n return\ngetDeprecated(cls, cls.raw_decorators)",
"super().visit_FunctionDef(node)\ntry:\n func = self.builder.current.contents[node.name]\nexcept KeyError:\n return\nif func.decorators:\n getDep... | <|body_start_0|>
super().visit_ClassDef(node)
try:
cls = self.builder.current.contents[node.name]
except KeyError:
return
getDeprecated(cls, cls.raw_decorators)
<|end_body_0|>
<|body_start_1|>
super().visit_FunctionDef(node)
try:
func ... | TwistedModuleVisitor | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TwistedModuleVisitor:
def visit_ClassDef(self, node):
"""Called when a class definition is visited."""
<|body_0|>
def visit_FunctionDef(self, node):
"""Called when a function definition is visited."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
sup... | stack_v2_sparse_classes_36k_train_002821 | 6,652 | permissive | [
{
"docstring": "Called when a class definition is visited.",
"name": "visit_ClassDef",
"signature": "def visit_ClassDef(self, node)"
},
{
"docstring": "Called when a function definition is visited.",
"name": "visit_FunctionDef",
"signature": "def visit_FunctionDef(self, node)"
}
] | 2 | null | Implement the Python class `TwistedModuleVisitor` described below.
Class description:
Implement the TwistedModuleVisitor class.
Method signatures and docstrings:
- def visit_ClassDef(self, node): Called when a class definition is visited.
- def visit_FunctionDef(self, node): Called when a function definition is visit... | Implement the Python class `TwistedModuleVisitor` described below.
Class description:
Implement the TwistedModuleVisitor class.
Method signatures and docstrings:
- def visit_ClassDef(self, node): Called when a class definition is visited.
- def visit_FunctionDef(self, node): Called when a function definition is visit... | 5cee0a8c4180a3108538b4e4ce945a18726595a6 | <|skeleton|>
class TwistedModuleVisitor:
def visit_ClassDef(self, node):
"""Called when a class definition is visited."""
<|body_0|>
def visit_FunctionDef(self, node):
"""Called when a function definition is visited."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TwistedModuleVisitor:
def visit_ClassDef(self, node):
"""Called when a class definition is visited."""
super().visit_ClassDef(node)
try:
cls = self.builder.current.contents[node.name]
except KeyError:
return
getDeprecated(cls, cls.raw_decorators)... | the_stack_v2_python_sparse | venv/Lib/site-packages/twisted/python/_pydoctor.py | zoelesv/Smathchat | train | 9 | |
0771a500e6be94c6cad7590142c69783f7fe5c7f | [
"for i in range(len(matrix)):\n for j in range(len(matrix[i])):\n matrix[i][j] = int(matrix[i][j])\n if matrix[i][j] and i and j:\n matrix[i][j] = min(matrix[i - 1][j], matrix[i - 1][j - 1], matrix[i][j - 1]) + 1\nreturn len(matrix) and max(map(max, matrix)) ** 2",
"area = 0\nif A:\n ... | <|body_start_0|>
for i in range(len(matrix)):
for j in range(len(matrix[i])):
matrix[i][j] = int(matrix[i][j])
if matrix[i][j] and i and j:
matrix[i][j] = min(matrix[i - 1][j], matrix[i - 1][j - 1], matrix[i][j - 1]) + 1
return len(matrix) ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maximalSquare(self, matrix):
""":type matrix: List[List[str]] :rtype: int beats 47.64%"""
<|body_0|>
def maximalSquare1(self, A):
""":type matrix: List[List[str]] :rtype: int beats 54.25%"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_002822 | 951 | no_license | [
{
"docstring": ":type matrix: List[List[str]] :rtype: int beats 47.64%",
"name": "maximalSquare",
"signature": "def maximalSquare(self, matrix)"
},
{
"docstring": ":type matrix: List[List[str]] :rtype: int beats 54.25%",
"name": "maximalSquare1",
"signature": "def maximalSquare1(self, A)... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maximalSquare(self, matrix): :type matrix: List[List[str]] :rtype: int beats 47.64%
- def maximalSquare1(self, A): :type matrix: List[List[str]] :rtype: int beats 54.25% | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maximalSquare(self, matrix): :type matrix: List[List[str]] :rtype: int beats 47.64%
- def maximalSquare1(self, A): :type matrix: List[List[str]] :rtype: int beats 54.25%
<|s... | 7e0e917c15d3e35f49da3a00ef395bd5ff180d79 | <|skeleton|>
class Solution:
def maximalSquare(self, matrix):
""":type matrix: List[List[str]] :rtype: int beats 47.64%"""
<|body_0|>
def maximalSquare1(self, A):
""":type matrix: List[List[str]] :rtype: int beats 54.25%"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maximalSquare(self, matrix):
""":type matrix: List[List[str]] :rtype: int beats 47.64%"""
for i in range(len(matrix)):
for j in range(len(matrix[i])):
matrix[i][j] = int(matrix[i][j])
if matrix[i][j] and i and j:
mat... | the_stack_v2_python_sparse | LeetCode/221_maximal_square.py | yao23/Machine_Learning_Playground | train | 12 | |
e850f0f5ed94b8e71f1c70ee3729418739f3090a | [
"data = {'name': 'consumername', 'URL': 'consumerURL'}\nmodel = consumer_model.ConsumerModel(**data)\nresp, consumer_dat = self.consumer_behaviors.create_consumer(model, self.generic_container_ref, use_auth=True)\nself.assertEqual(200, resp.status_code)",
"data = {'URL': 'consumerURL'}\nmodel = consumer_model.Con... | <|body_start_0|>
data = {'name': 'consumername', 'URL': 'consumerURL'}
model = consumer_model.ConsumerModel(**data)
resp, consumer_dat = self.consumer_behaviors.create_consumer(model, self.generic_container_ref, use_auth=True)
self.assertEqual(200, resp.status_code)
<|end_body_0|>
<|bod... | ConsumersValidationTestCase | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConsumersValidationTestCase:
def test_consumer_create_pass(self):
"""Create a valid consumer Should return 200"""
<|body_0|>
def test_consumer_create_fail_no_name(self):
"""Attempt to create invalid consumer (Missing name) Should return 400"""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_002823 | 15,131 | permissive | [
{
"docstring": "Create a valid consumer Should return 200",
"name": "test_consumer_create_pass",
"signature": "def test_consumer_create_pass(self)"
},
{
"docstring": "Attempt to create invalid consumer (Missing name) Should return 400",
"name": "test_consumer_create_fail_no_name",
"signa... | 5 | null | Implement the Python class `ConsumersValidationTestCase` described below.
Class description:
Implement the ConsumersValidationTestCase class.
Method signatures and docstrings:
- def test_consumer_create_pass(self): Create a valid consumer Should return 200
- def test_consumer_create_fail_no_name(self): Attempt to cre... | Implement the Python class `ConsumersValidationTestCase` described below.
Class description:
Implement the ConsumersValidationTestCase class.
Method signatures and docstrings:
- def test_consumer_create_pass(self): Create a valid consumer Should return 200
- def test_consumer_create_fail_no_name(self): Attempt to cre... | c8e3dc14e6225f1d400131434e8afec0aa410ae7 | <|skeleton|>
class ConsumersValidationTestCase:
def test_consumer_create_pass(self):
"""Create a valid consumer Should return 200"""
<|body_0|>
def test_consumer_create_fail_no_name(self):
"""Attempt to create invalid consumer (Missing name) Should return 400"""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ConsumersValidationTestCase:
def test_consumer_create_pass(self):
"""Create a valid consumer Should return 200"""
data = {'name': 'consumername', 'URL': 'consumerURL'}
model = consumer_model.ConsumerModel(**data)
resp, consumer_dat = self.consumer_behaviors.create_consumer(mode... | the_stack_v2_python_sparse | functionaltests/api/v1/functional/test_consumers.py | openstack/barbican | train | 189 | |
3528ff428c0a31b0596cffee2372e38c3c8a6796 | [
"super().__init__(filters=filters, events=events, channels=channels, baseline=baseline, resample=resample, tmin=tmin, tmax=tmax)\nself.n_classes = n_classes\nif self.events is None:\n log.warning('Choosing the first ' + str(n_classes) + ' classes' + ' from all possible events')\nelse:\n assert n_classes <= le... | <|body_start_0|>
super().__init__(filters=filters, events=events, channels=channels, baseline=baseline, resample=resample, tmin=tmin, tmax=tmax)
self.n_classes = n_classes
if self.events is None:
log.warning('Choosing the first ' + str(n_classes) + ' classes' + ' from all possible ev... | Base SSVEP Paradigm. Parameters ---------- filters: list of list | None (default [7, 45]) Bank of bandpass filter to apply. events: list of str | None (default None) List of stimulation frequencies. If None, use all stimulus found in the dataset. n_classes: int or None (default None) Number of classes each dataset must... | BaseSSVEP | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseSSVEP:
"""Base SSVEP Paradigm. Parameters ---------- filters: list of list | None (default [7, 45]) Bank of bandpass filter to apply. events: list of str | None (default None) List of stimulation frequencies. If None, use all stimulus found in the dataset. n_classes: int or None (default None... | stack_v2_sparse_classes_36k_train_002824 | 10,267 | permissive | [
{
"docstring": "Init the BaseSSVEP function.",
"name": "__init__",
"signature": "def __init__(self, filters=((7, 45),), events=None, n_classes=None, tmin=0.0, tmax=None, baseline=None, channels=None, resample=None)"
},
{
"docstring": "Check if dataset is valid for the SSVEP paradigm.",
"name... | 6 | null | Implement the Python class `BaseSSVEP` described below.
Class description:
Base SSVEP Paradigm. Parameters ---------- filters: list of list | None (default [7, 45]) Bank of bandpass filter to apply. events: list of str | None (default None) List of stimulation frequencies. If None, use all stimulus found in the datase... | Implement the Python class `BaseSSVEP` described below.
Class description:
Base SSVEP Paradigm. Parameters ---------- filters: list of list | None (default [7, 45]) Bank of bandpass filter to apply. events: list of str | None (default None) List of stimulation frequencies. If None, use all stimulus found in the datase... | 2024d50eb20eb83b94d6d6ea0401d77383748edc | <|skeleton|>
class BaseSSVEP:
"""Base SSVEP Paradigm. Parameters ---------- filters: list of list | None (default [7, 45]) Bank of bandpass filter to apply. events: list of str | None (default None) List of stimulation frequencies. If None, use all stimulus found in the dataset. n_classes: int or None (default None... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BaseSSVEP:
"""Base SSVEP Paradigm. Parameters ---------- filters: list of list | None (default [7, 45]) Bank of bandpass filter to apply. events: list of str | None (default None) List of stimulation frequencies. If None, use all stimulus found in the dataset. n_classes: int or None (default None) Number of c... | the_stack_v2_python_sparse | moabb/paradigms/ssvep.py | NeuroTechX/moabb | train | 489 |
71a810cc41888af9f1a02120311a7f030ae636a0 | [
"Parametre.__init__(self, 'global', 'global')\nself.aide_courte = 'consulte le trésor global'\nself.aide_longue = \"Cette commande pdonne des informations statistiques sur l'argent en jeu et des idées quant à sa répartition globale. Il peut être utile de suivre l'évolution du marché, pour savoir notamment ce que po... | <|body_start_0|>
Parametre.__init__(self, 'global', 'global')
self.aide_courte = 'consulte le trésor global'
self.aide_longue = "Cette commande pdonne des informations statistiques sur l'argent en jeu et des idées quant à sa répartition globale. Il peut être utile de suivre l'évolution du marché... | Commande 'tresor global' | PrmGlobal | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PrmGlobal:
"""Commande 'tresor global'"""
def __init__(self):
"""Constructeur du paramètre."""
<|body_0|>
def interpreter(self, personnage, dic_masques):
"""Méthode d'interprétation de commande"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
Par... | stack_v2_sparse_classes_36k_train_002825 | 3,432 | permissive | [
{
"docstring": "Constructeur du paramètre.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Méthode d'interprétation de commande",
"name": "interpreter",
"signature": "def interpreter(self, personnage, dic_masques)"
}
] | 2 | null | Implement the Python class `PrmGlobal` described below.
Class description:
Commande 'tresor global'
Method signatures and docstrings:
- def __init__(self): Constructeur du paramètre.
- def interpreter(self, personnage, dic_masques): Méthode d'interprétation de commande | Implement the Python class `PrmGlobal` described below.
Class description:
Commande 'tresor global'
Method signatures and docstrings:
- def __init__(self): Constructeur du paramètre.
- def interpreter(self, personnage, dic_masques): Méthode d'interprétation de commande
<|skeleton|>
class PrmGlobal:
"""Commande '... | 7e93bff08cdf891352efba587e89c40f3b4a2301 | <|skeleton|>
class PrmGlobal:
"""Commande 'tresor global'"""
def __init__(self):
"""Constructeur du paramètre."""
<|body_0|>
def interpreter(self, personnage, dic_masques):
"""Méthode d'interprétation de commande"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PrmGlobal:
"""Commande 'tresor global'"""
def __init__(self):
"""Constructeur du paramètre."""
Parametre.__init__(self, 'global', 'global')
self.aide_courte = 'consulte le trésor global'
self.aide_longue = "Cette commande pdonne des informations statistiques sur l'argent e... | the_stack_v2_python_sparse | src/primaires/tresor/commandes/tresor/glob.py | vincent-lg/tsunami | train | 5 |
3ef2fa290d4c27dcd1517c1dbad1356382573242 | [
"super().__init__(config)\nself.collector_host = config.get('collector_host')\nself.schedds = config.get('schedds', [None])\nself.condor_config = config.get('condor_config')\nself.constraint = config.get('constraint', True)\nself.classad_attrs = config.get('classad_attrs')\nself.correction_map = config.get('correct... | <|body_start_0|>
super().__init__(config)
self.collector_host = config.get('collector_host')
self.schedds = config.get('schedds', [None])
self.condor_config = config.get('condor_config')
self.constraint = config.get('constraint', True)
self.classad_attrs = config.get('cla... | JobQ | [
"BSD-3-Clause",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JobQ:
def __init__(self, config):
"""In config files such as job_classification.jsonnet or Nersc.jsonnet, put a dictionary named correction_map with keys corresponding to classad_attrs and values that the operators want to be default values for the classad_attrs."""
<|body_0|>
... | stack_v2_sparse_classes_36k_train_002826 | 3,265 | permissive | [
{
"docstring": "In config files such as job_classification.jsonnet or Nersc.jsonnet, put a dictionary named correction_map with keys corresponding to classad_attrs and values that the operators want to be default values for the classad_attrs.",
"name": "__init__",
"signature": "def __init__(self, config... | 2 | stack_v2_sparse_classes_30k_train_005849 | Implement the Python class `JobQ` described below.
Class description:
Implement the JobQ class.
Method signatures and docstrings:
- def __init__(self, config): In config files such as job_classification.jsonnet or Nersc.jsonnet, put a dictionary named correction_map with keys corresponding to classad_attrs and values... | Implement the Python class `JobQ` described below.
Class description:
Implement the JobQ class.
Method signatures and docstrings:
- def __init__(self, config): In config files such as job_classification.jsonnet or Nersc.jsonnet, put a dictionary named correction_map with keys corresponding to classad_attrs and values... | 842fdc91a31879084906d71a7d0c317e5035a925 | <|skeleton|>
class JobQ:
def __init__(self, config):
"""In config files such as job_classification.jsonnet or Nersc.jsonnet, put a dictionary named correction_map with keys corresponding to classad_attrs and values that the operators want to be default values for the classad_attrs."""
<|body_0|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class JobQ:
def __init__(self, config):
"""In config files such as job_classification.jsonnet or Nersc.jsonnet, put a dictionary named correction_map with keys corresponding to classad_attrs and values that the operators want to be default values for the classad_attrs."""
super().__init__(config)
... | the_stack_v2_python_sparse | src/decisionengine_modules/htcondor/sources/job_q.py | HEPCloud/decisionengine_modules | train | 2 | |
036165f39d29e81fa40e4bc19ae866ddb7b23259 | [
"snap = super(FlowItem, self).snapshot()\nsnap['preferred_size'] = self.preferred_size\nsnap['align'] = self.align\nsnap['stretch'] = self.stretch\nsnap['ortho_stretch'] = self.ortho_stretch\nreturn snap",
"super(FlowItem, self).bind()\nattrs = ('preferred_size', 'align', 'stretch', 'ortho_stretch')\nself.publish... | <|body_start_0|>
snap = super(FlowItem, self).snapshot()
snap['preferred_size'] = self.preferred_size
snap['align'] = self.align
snap['stretch'] = self.stretch
snap['ortho_stretch'] = self.ortho_stretch
return snap
<|end_body_0|>
<|body_start_1|>
super(FlowItem, ... | A widget which can be used as an item in a FlowArea. A FlowItem is a widget which can be used as a child of a FlowArea widget. It can have at most a single child widget which is an instance of Container. | FlowItem | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FlowItem:
"""A widget which can be used as an item in a FlowArea. A FlowItem is a widget which can be used as a child of a FlowArea widget. It can have at most a single child widget which is an instance of Container."""
def snapshot(self):
"""Returns the snapshot dict for the FlowIte... | stack_v2_sparse_classes_36k_train_002827 | 3,170 | permissive | [
{
"docstring": "Returns the snapshot dict for the FlowItem.",
"name": "snapshot",
"signature": "def snapshot(self)"
},
{
"docstring": "Bind the change handler for the FlowItem.",
"name": "bind",
"signature": "def bind(self)"
},
{
"docstring": "The getter for the 'flow_widget' pro... | 3 | stack_v2_sparse_classes_30k_train_013568 | Implement the Python class `FlowItem` described below.
Class description:
A widget which can be used as an item in a FlowArea. A FlowItem is a widget which can be used as a child of a FlowArea widget. It can have at most a single child widget which is an instance of Container.
Method signatures and docstrings:
- def ... | Implement the Python class `FlowItem` described below.
Class description:
A widget which can be used as an item in a FlowArea. A FlowItem is a widget which can be used as a child of a FlowArea widget. It can have at most a single child widget which is an instance of Container.
Method signatures and docstrings:
- def ... | 424bba29219de58fe9e47196de6763de8b2009f2 | <|skeleton|>
class FlowItem:
"""A widget which can be used as an item in a FlowArea. A FlowItem is a widget which can be used as a child of a FlowArea widget. It can have at most a single child widget which is an instance of Container."""
def snapshot(self):
"""Returns the snapshot dict for the FlowIte... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FlowItem:
"""A widget which can be used as an item in a FlowArea. A FlowItem is a widget which can be used as a child of a FlowArea widget. It can have at most a single child widget which is an instance of Container."""
def snapshot(self):
"""Returns the snapshot dict for the FlowItem."""
... | the_stack_v2_python_sparse | enaml/widgets/flow_item.py | enthought/enaml | train | 17 |
7d10070dfcb460bc2f4be5b053b6bf7388e59914 | [
"if comments[4][70:76] != 'COMVER':\n return (-1, -1)\ntry:\n return (int(comments[4][76:78]), int(comments[4][78:80]))\nexcept ValueError:\n return (-1, -1)",
"sdt_md = {}\nfor minor in range(version[1] + 1):\n try:\n cmt = __class__.comment_fields[version[0], minor]\n except KeyError:\n ... | <|body_start_0|>
if comments[4][70:76] != 'COMVER':
return (-1, -1)
try:
return (int(comments[4][76:78]), int(comments[4][78:80]))
except ValueError:
return (-1, -1)
<|end_body_0|>
<|body_start_1|>
sdt_md = {}
for minor in range(version[1] + 1... | Extract metadata written by the SDT-control software Some of it is encoded in the comment strings (see :py:meth:`parse_comments`). Also, date and time are encoded in a peculiar way (see :py:meth:`get_datetime`). Use :py:meth:`extract_metadata` to update the metadata dict. | SDTControlSpec | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SDTControlSpec:
"""Extract metadata written by the SDT-control software Some of it is encoded in the comment strings (see :py:meth:`parse_comments`). Also, date and time are encoded in a peculiar way (see :py:meth:`get_datetime`). Use :py:meth:`extract_metadata` to update the metadata dict."""
... | stack_v2_sparse_classes_36k_train_002828 | 32,172 | permissive | [
{
"docstring": "Get the version of SDT-control metadata encoded in the comments Parameters ---------- comments List of SPE file comments, typically ``metadata[\"comments\"]``. Returns ------- Major and minor version. ``-1, -1`` if detection failed.",
"name": "get_comment_version",
"signature": "def get_... | 4 | stack_v2_sparse_classes_30k_train_021567 | Implement the Python class `SDTControlSpec` described below.
Class description:
Extract metadata written by the SDT-control software Some of it is encoded in the comment strings (see :py:meth:`parse_comments`). Also, date and time are encoded in a peculiar way (see :py:meth:`get_datetime`). Use :py:meth:`extract_metad... | Implement the Python class `SDTControlSpec` described below.
Class description:
Extract metadata written by the SDT-control software Some of it is encoded in the comment strings (see :py:meth:`parse_comments`). Also, date and time are encoded in a peculiar way (see :py:meth:`get_datetime`). Use :py:meth:`extract_metad... | a0091371dd42442ca3fae0fc0e8a4f0925757ac7 | <|skeleton|>
class SDTControlSpec:
"""Extract metadata written by the SDT-control software Some of it is encoded in the comment strings (see :py:meth:`parse_comments`). Also, date and time are encoded in a peculiar way (see :py:meth:`get_datetime`). Use :py:meth:`extract_metadata` to update the metadata dict."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SDTControlSpec:
"""Extract metadata written by the SDT-control software Some of it is encoded in the comment strings (see :py:meth:`parse_comments`). Also, date and time are encoded in a peculiar way (see :py:meth:`get_datetime`). Use :py:meth:`extract_metadata` to update the metadata dict."""
def get_co... | the_stack_v2_python_sparse | imageio/plugins/spe.py | imageio/imageio | train | 1,332 |
70126b46623a972aef6c2521d99e89f61095442e | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"conte... | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | Missing associated documentation comment in .proto file | RDAPServicer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RDAPServicer:
"""Missing associated documentation comment in .proto file"""
def DomainLookup(self, request, context):
"""Missing associated documentation comment in .proto file"""
<|body_0|>
def EntityLookup(self, request, context):
"""Missing associated document... | stack_v2_sparse_classes_36k_train_002829 | 9,591 | no_license | [
{
"docstring": "Missing associated documentation comment in .proto file",
"name": "DomainLookup",
"signature": "def DomainLookup(self, request, context)"
},
{
"docstring": "Missing associated documentation comment in .proto file",
"name": "EntityLookup",
"signature": "def EntityLookup(se... | 6 | stack_v2_sparse_classes_30k_train_018662 | Implement the Python class `RDAPServicer` described below.
Class description:
Missing associated documentation comment in .proto file
Method signatures and docstrings:
- def DomainLookup(self, request, context): Missing associated documentation comment in .proto file
- def EntityLookup(self, request, context): Missin... | Implement the Python class `RDAPServicer` described below.
Class description:
Missing associated documentation comment in .proto file
Method signatures and docstrings:
- def DomainLookup(self, request, context): Missing associated documentation comment in .proto file
- def EntityLookup(self, request, context): Missin... | eaf76d8a8215e5f43d25f4cd6aa5b178d26da549 | <|skeleton|>
class RDAPServicer:
"""Missing associated documentation comment in .proto file"""
def DomainLookup(self, request, context):
"""Missing associated documentation comment in .proto file"""
<|body_0|>
def EntityLookup(self, request, context):
"""Missing associated document... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RDAPServicer:
"""Missing associated documentation comment in .proto file"""
def DomainLookup(self, request, context):
"""Missing associated documentation comment in .proto file"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
... | the_stack_v2_python_sparse | domains/rdap_grpc/rdap_pb2_grpc.py | 8nty/domains | train | 0 |
8cd8ce312de00f82e14f3c2c7518b1cd03990471 | [
"dic = {}\nfor i, num in enumerate(nums):\n c = target - num\n if dic.get(c) is not None:\n return [nums.index(c), i]\n else:\n dic[num] = i\nraise Exception('No two sum solution')",
"for i, num in enumerate(nums):\n c = target - num\n if c in nums and nums.index(c) != i:\n ret... | <|body_start_0|>
dic = {}
for i, num in enumerate(nums):
c = target - num
if dic.get(c) is not None:
return [nums.index(c), i]
else:
dic[num] = i
raise Exception('No two sum solution')
<|end_body_0|>
<|body_start_1|>
fo... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def twoSum(self, nums: list, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def twoSum1(self, nums: list, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|b... | stack_v2_sparse_classes_36k_train_002830 | 2,376 | permissive | [
{
"docstring": ":type nums: List[int] :type target: int :rtype: List[int]",
"name": "twoSum",
"signature": "def twoSum(self, nums: list, target)"
},
{
"docstring": ":type nums: List[int] :type target: int :rtype: List[int]",
"name": "twoSum1",
"signature": "def twoSum1(self, nums: list, ... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum(self, nums: list, target): :type nums: List[int] :type target: int :rtype: List[int]
- def twoSum1(self, nums: list, target): :type nums: List[int] :type target: int :... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum(self, nums: list, target): :type nums: List[int] :type target: int :rtype: List[int]
- def twoSum1(self, nums: list, target): :type nums: List[int] :type target: int :... | 6731e128be0fd3c0bdfe885c1a409ac54b929597 | <|skeleton|>
class Solution:
def twoSum(self, nums: list, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def twoSum1(self, nums: list, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def twoSum(self, nums: list, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
dic = {}
for i, num in enumerate(nums):
c = target - num
if dic.get(c) is not None:
return [nums.index(c), i]
else:
... | the_stack_v2_python_sparse | python3/1.Two Sum(两数之和).py | lishulongVI/leetcode | train | 0 | |
dfb6dffb0f177d15b329a7ec41cdbdf6521be772 | [
"try:\n serializer = RadiologistReportFilesSerializers(RadiologistReportFiles.objects.all(), many=True)\n return JsonResponse({'message': 'listed all', 'data': serializer.data}, status=200)\nexcept Exception as e:\n info_message = 'Internal Server Error'\n logger.error(info_message, e)\n return JsonR... | <|body_start_0|>
try:
serializer = RadiologistReportFilesSerializers(RadiologistReportFiles.objects.all(), many=True)
return JsonResponse({'message': 'listed all', 'data': serializer.data}, status=200)
except Exception as e:
info_message = 'Internal Server Error'
... | RadiologistReportFilesView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RadiologistReportFilesView:
def get(self, request):
"""Get all sellers"""
<|body_0|>
def post(self, request):
"""Save seller data"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
try:
serializer = RadiologistReportFilesSerializers(Radiolo... | stack_v2_sparse_classes_36k_train_002831 | 31,833 | no_license | [
{
"docstring": "Get all sellers",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "Save seller data",
"name": "post",
"signature": "def post(self, request)"
}
] | 2 | stack_v2_sparse_classes_30k_train_019576 | Implement the Python class `RadiologistReportFilesView` described below.
Class description:
Implement the RadiologistReportFilesView class.
Method signatures and docstrings:
- def get(self, request): Get all sellers
- def post(self, request): Save seller data | Implement the Python class `RadiologistReportFilesView` described below.
Class description:
Implement the RadiologistReportFilesView class.
Method signatures and docstrings:
- def get(self, request): Get all sellers
- def post(self, request): Save seller data
<|skeleton|>
class RadiologistReportFilesView:
def g... | b63849983a592fd6a1f654191020fd86aa0787ae | <|skeleton|>
class RadiologistReportFilesView:
def get(self, request):
"""Get all sellers"""
<|body_0|>
def post(self, request):
"""Save seller data"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RadiologistReportFilesView:
def get(self, request):
"""Get all sellers"""
try:
serializer = RadiologistReportFilesSerializers(RadiologistReportFiles.objects.all(), many=True)
return JsonResponse({'message': 'listed all', 'data': serializer.data}, status=200)
exc... | the_stack_v2_python_sparse | radiologist/views.py | RupeshKurlekar/biocare | train | 1 | |
04164599d53bdbebca30700f26d746cfa9a95deb | [
"Element.__init__(self)\nself.sname = sname\nl = len(xy)\nif l > 1:\n raise Exception('too many points provided\\ninstance should only be located at one point')\nelif l < 1:\n raise Exception('no point provided\\ninstance should be located at a point')\nself.xy = list(xy[0])\nElement.set_transform_parameters(... | <|body_start_0|>
Element.__init__(self)
self.sname = sname
l = len(xy)
if l > 1:
raise Exception('too many points provided\ninstance should only be located at one point')
elif l < 1:
raise Exception('no point provided\ninstance should be located at a point... | Instance object for GDSIO | Instance | [
"BSD-3-Clause",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Instance:
"""Instance object for GDSIO"""
def __init__(self, sname, xy, transform='R0'):
"""initialize Instance object Parameters ---------- sname : str Instance name xy : array xy coordinate of Instance Object transform : str transform parameter, 'R0' : default, no transform, 'R90' ... | stack_v2_sparse_classes_36k_train_002832 | 18,791 | permissive | [
{
"docstring": "initialize Instance object Parameters ---------- sname : str Instance name xy : array xy coordinate of Instance Object transform : str transform parameter, 'R0' : default, no transform, 'R90' : rotate by 90-degree, 'R180' : rotate by 180-degree, 'R270' : rotate by 270-degree, 'MX' : mirror acros... | 2 | null | Implement the Python class `Instance` described below.
Class description:
Instance object for GDSIO
Method signatures and docstrings:
- def __init__(self, sname, xy, transform='R0'): initialize Instance object Parameters ---------- sname : str Instance name xy : array xy coordinate of Instance Object transform : str ... | Implement the Python class `Instance` described below.
Class description:
Instance object for GDSIO
Method signatures and docstrings:
- def __init__(self, sname, xy, transform='R0'): initialize Instance object Parameters ---------- sname : str Instance name xy : array xy coordinate of Instance Object transform : str ... | 8f62ec1971480cb27cb592421fd97f590379cff9 | <|skeleton|>
class Instance:
"""Instance object for GDSIO"""
def __init__(self, sname, xy, transform='R0'):
"""initialize Instance object Parameters ---------- sname : str Instance name xy : array xy coordinate of Instance Object transform : str transform parameter, 'R0' : default, no transform, 'R90' ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Instance:
"""Instance object for GDSIO"""
def __init__(self, sname, xy, transform='R0'):
"""initialize Instance object Parameters ---------- sname : str Instance name xy : array xy coordinate of Instance Object transform : str transform parameter, 'R0' : default, no transform, 'R90' : rotate by 9... | the_stack_v2_python_sparse | GDSIO.py | ucb-art/laygo | train | 24 |
a6c53500d7c4a8c3ca60da77dee6bbd3a0bfaa94 | [
"self.capacity_gib = capacity_gib\nself.expiry_time = expiry_time\nself.feature_name = feature_name\nself.license_type = license_type\nself.num_vm = num_vm\nself.product_description = product_description\nself.product_info = product_info",
"if dictionary is None:\n return None\ncapacity_gib = dictionary.get('c... | <|body_start_0|>
self.capacity_gib = capacity_gib
self.expiry_time = expiry_time
self.feature_name = feature_name
self.license_type = license_type
self.num_vm = num_vm
self.product_description = product_description
self.product_info = product_info
<|end_body_0|>
... | Implementation of the 'LicensedUsage' model. TODO: type description here. Attributes: capacity_gib (long|int): Feature usage by the cluster. expiry_time (long|int): Expiry time(epoch) of each feature. There could be multiple expiry time for the given SKU. feature_name (string): Name of feature. license_type (string): T... | LicensedUsage | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LicensedUsage:
"""Implementation of the 'LicensedUsage' model. TODO: type description here. Attributes: capacity_gib (long|int): Feature usage by the cluster. expiry_time (long|int): Expiry time(epoch) of each feature. There could be multiple expiry time for the given SKU. feature_name (string): ... | stack_v2_sparse_classes_36k_train_002833 | 2,906 | permissive | [
{
"docstring": "Constructor for the LicensedUsage class",
"name": "__init__",
"signature": "def __init__(self, capacity_gib=None, expiry_time=None, feature_name=None, license_type=None, num_vm=None, product_description=None, product_info=None)"
},
{
"docstring": "Creates an instance of this mode... | 2 | stack_v2_sparse_classes_30k_train_015331 | Implement the Python class `LicensedUsage` described below.
Class description:
Implementation of the 'LicensedUsage' model. TODO: type description here. Attributes: capacity_gib (long|int): Feature usage by the cluster. expiry_time (long|int): Expiry time(epoch) of each feature. There could be multiple expiry time for... | Implement the Python class `LicensedUsage` described below.
Class description:
Implementation of the 'LicensedUsage' model. TODO: type description here. Attributes: capacity_gib (long|int): Feature usage by the cluster. expiry_time (long|int): Expiry time(epoch) of each feature. There could be multiple expiry time for... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class LicensedUsage:
"""Implementation of the 'LicensedUsage' model. TODO: type description here. Attributes: capacity_gib (long|int): Feature usage by the cluster. expiry_time (long|int): Expiry time(epoch) of each feature. There could be multiple expiry time for the given SKU. feature_name (string): ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LicensedUsage:
"""Implementation of the 'LicensedUsage' model. TODO: type description here. Attributes: capacity_gib (long|int): Feature usage by the cluster. expiry_time (long|int): Expiry time(epoch) of each feature. There could be multiple expiry time for the given SKU. feature_name (string): Name of featu... | the_stack_v2_python_sparse | cohesity_management_sdk/models/licensed_usage.py | cohesity/management-sdk-python | train | 24 |
9596e639c0134c1d7b9729800a712ba6c60ac25c | [
"n = len(w)\nself.sums = [0] * n\nself.sums[0] = w[0]\nfor i in range(1, n):\n self.sums[i] = self.sums[i - 1] + w[i]",
"p = random.randint(1, self.sums[-1])\nl, r = (0, len(self.sums) - 1)\nwhile l < r:\n mid = l + r >> 1\n if self.sums[mid] >= p:\n r = mid\n else:\n l = mid + 1\nreturn... | <|body_start_0|>
n = len(w)
self.sums = [0] * n
self.sums[0] = w[0]
for i in range(1, n):
self.sums[i] = self.sums[i - 1] + w[i]
<|end_body_0|>
<|body_start_1|>
p = random.randint(1, self.sums[-1])
l, r = (0, len(self.sums) - 1)
while l < r:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def __init__(self, w):
""":type w: List[int]"""
<|body_0|>
def pickIndex(self):
""":rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
n = len(w)
self.sums = [0] * n
self.sums[0] = w[0]
for i in range(1, n):... | stack_v2_sparse_classes_36k_train_002834 | 1,013 | no_license | [
{
"docstring": ":type w: List[int]",
"name": "__init__",
"signature": "def __init__(self, w)"
},
{
"docstring": ":rtype: int",
"name": "pickIndex",
"signature": "def pickIndex(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006259 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, w): :type w: List[int]
- def pickIndex(self): :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, w): :type w: List[int]
- def pickIndex(self): :rtype: int
<|skeleton|>
class Solution:
def __init__(self, w):
""":type w: List[int]"""
<|... | 692bf0e5aab402d55463274e99ab4d0ed56ce64c | <|skeleton|>
class Solution:
def __init__(self, w):
""":type w: List[int]"""
<|body_0|>
def pickIndex(self):
""":rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def __init__(self, w):
""":type w: List[int]"""
n = len(w)
self.sums = [0] * n
self.sums[0] = w[0]
for i in range(1, n):
self.sums[i] = self.sums[i - 1] + w[i]
def pickIndex(self):
""":rtype: int"""
p = random.randint(1, self.s... | the_stack_v2_python_sparse | 528-random_pick_with_weight.py | WweiL/LeetCode | train | 0 | |
4c9ddc920fa1098aa98105789cdcbdd77a00f072 | [
"self.driver.get(url)\ntime.sleep(1)\nself.driver.find_element_by_xpath(clean_close).click()\ntime.sleep(1)\nself.driver.find_element_by_xpath(add_data).click()\nwindows = self.driver.window_handles\nself.driver.switch_to_window(windows[-1])\ntime.sleep(1)\nvalue = self.driver.find_element_by_id(requiredDom).is_ena... | <|body_start_0|>
self.driver.get(url)
time.sleep(1)
self.driver.find_element_by_xpath(clean_close).click()
time.sleep(1)
self.driver.find_element_by_xpath(add_data).click()
windows = self.driver.window_handles
self.driver.switch_to_window(windows[-1])
time... | DataCleaningTrigger | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataCleaningTrigger:
def get_datacleaning_trigger_jumpetl_id(self, url, requiredDom):
"""数据源—触发器,打开浏览器,访问url获取元素值 :param url: 触发器请求接口后,访问url地址 :param requiredDom: Dom树中id值 新增数据:'__data_source_jumpetl' :return: 布尔,True/False;存在/不存在"""
<|body_0|>
def get_datacleaning_trigger_p... | stack_v2_sparse_classes_36k_train_002835 | 2,612 | no_license | [
{
"docstring": "数据源—触发器,打开浏览器,访问url获取元素值 :param url: 触发器请求接口后,访问url地址 :param requiredDom: Dom树中id值 新增数据:'__data_source_jumpetl' :return: 布尔,True/False;存在/不存在",
"name": "get_datacleaning_trigger_jumpetl_id",
"signature": "def get_datacleaning_trigger_jumpetl_id(self, url, requiredDom)"
},
{
"docs... | 3 | stack_v2_sparse_classes_30k_train_020026 | Implement the Python class `DataCleaningTrigger` described below.
Class description:
Implement the DataCleaningTrigger class.
Method signatures and docstrings:
- def get_datacleaning_trigger_jumpetl_id(self, url, requiredDom): 数据源—触发器,打开浏览器,访问url获取元素值 :param url: 触发器请求接口后,访问url地址 :param requiredDom: Dom树中id值 新增数据:'__... | Implement the Python class `DataCleaningTrigger` described below.
Class description:
Implement the DataCleaningTrigger class.
Method signatures and docstrings:
- def get_datacleaning_trigger_jumpetl_id(self, url, requiredDom): 数据源—触发器,打开浏览器,访问url获取元素值 :param url: 触发器请求接口后,访问url地址 :param requiredDom: Dom树中id值 新增数据:'__... | 22927e1101efa219e526dcd9b70f519bb6bd9553 | <|skeleton|>
class DataCleaningTrigger:
def get_datacleaning_trigger_jumpetl_id(self, url, requiredDom):
"""数据源—触发器,打开浏览器,访问url获取元素值 :param url: 触发器请求接口后,访问url地址 :param requiredDom: Dom树中id值 新增数据:'__data_source_jumpetl' :return: 布尔,True/False;存在/不存在"""
<|body_0|>
def get_datacleaning_trigger_p... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DataCleaningTrigger:
def get_datacleaning_trigger_jumpetl_id(self, url, requiredDom):
"""数据源—触发器,打开浏览器,访问url获取元素值 :param url: 触发器请求接口后,访问url地址 :param requiredDom: Dom树中id值 新增数据:'__data_source_jumpetl' :return: 布尔,True/False;存在/不存在"""
self.driver.get(url)
time.sleep(1)
self.driv... | the_stack_v2_python_sparse | apm_modules/data_cleaning_trigger.py | mentgmery/interface_testing | train | 0 | |
2e31d4668d6585438bb138dcb7487535291e8345 | [
"if not data:\n return None\nattribute_name = data['attribute_name']\nparameter_name = data['parameter_name']\nhelp_text = data['help']\ncompletion_id_field = data.get('completion_id_field', None)\ncompletion_request_params_list = data.get('completion_request_params', [])\ncompletion_request_params = {param.get(... | <|body_start_0|>
if not data:
return None
attribute_name = data['attribute_name']
parameter_name = data['parameter_name']
help_text = data['help']
completion_id_field = data.get('completion_id_field', None)
completion_request_params_list = data.get('completion... | Configuration used to create attributes from resource parameters. | ResourceParameterAttributeConfig | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResourceParameterAttributeConfig:
"""Configuration used to create attributes from resource parameters."""
def FromData(cls, data):
"""Constructs an attribute config from data defined in the yaml file. Args: data: {}, the dict of data from the YAML file for this single attribute. Retu... | stack_v2_sparse_classes_36k_train_002836 | 31,588 | permissive | [
{
"docstring": "Constructs an attribute config from data defined in the yaml file. Args: data: {}, the dict of data from the YAML file for this single attribute. Returns: ResourceParameterAttributeConfig",
"name": "FromData",
"signature": "def FromData(cls, data)"
},
{
"docstring": "Create a res... | 2 | stack_v2_sparse_classes_30k_train_008686 | Implement the Python class `ResourceParameterAttributeConfig` described below.
Class description:
Configuration used to create attributes from resource parameters.
Method signatures and docstrings:
- def FromData(cls, data): Constructs an attribute config from data defined in the yaml file. Args: data: {}, the dict o... | Implement the Python class `ResourceParameterAttributeConfig` described below.
Class description:
Configuration used to create attributes from resource parameters.
Method signatures and docstrings:
- def FromData(cls, data): Constructs an attribute config from data defined in the yaml file. Args: data: {}, the dict o... | 85bb264e273568b5a0408f733b403c56373e2508 | <|skeleton|>
class ResourceParameterAttributeConfig:
"""Configuration used to create attributes from resource parameters."""
def FromData(cls, data):
"""Constructs an attribute config from data defined in the yaml file. Args: data: {}, the dict of data from the YAML file for this single attribute. Retu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ResourceParameterAttributeConfig:
"""Configuration used to create attributes from resource parameters."""
def FromData(cls, data):
"""Constructs an attribute config from data defined in the yaml file. Args: data: {}, the dict of data from the YAML file for this single attribute. Returns: Resource... | the_stack_v2_python_sparse | google-cloud-sdk/lib/googlecloudsdk/calliope/concepts/concepts.py | bopopescu/socialliteapp | train | 0 |
ff1d191f3fd8493ab554084a811247d7d83ce5d0 | [
"addresses = addresses or list(utils.generate_mac_addresses(count=count))\nports = []\n_port_addresses = {}\nfor address in addresses:\n port = self._client.port.create(address=address, node_uuid=node.uuid, **kwargs)\n _port_addresses[port.uuid] = address\n ports.append(port)\nif check:\n self.check_por... | <|body_start_0|>
addresses = addresses or list(utils.generate_mac_addresses(count=count))
ports = []
_port_addresses = {}
for address in addresses:
port = self._client.port.create(address=address, node_uuid=node.uuid, **kwargs)
_port_addresses[port.uuid] = address... | Ironic port steps. | IronicPortSteps | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IronicPortSteps:
"""Ironic port steps."""
def create_ports(self, node, addresses=None, count=1, check=True, **kwargs):
"""Step to create ironic ports with kwargs dictionary of attributes. Args: addresses (list): MAC addresses for ports node (object): node of the ports should be assoc... | stack_v2_sparse_classes_36k_train_002837 | 4,813 | no_license | [
{
"docstring": "Step to create ironic ports with kwargs dictionary of attributes. Args: addresses (list): MAC addresses for ports node (object): node of the ports should be associated with count (int): count of created ports check (bool): For checking ports were created correct with correct addresses kwargs: Op... | 4 | stack_v2_sparse_classes_30k_train_017487 | Implement the Python class `IronicPortSteps` described below.
Class description:
Ironic port steps.
Method signatures and docstrings:
- def create_ports(self, node, addresses=None, count=1, check=True, **kwargs): Step to create ironic ports with kwargs dictionary of attributes. Args: addresses (list): MAC addresses f... | Implement the Python class `IronicPortSteps` described below.
Class description:
Ironic port steps.
Method signatures and docstrings:
- def create_ports(self, node, addresses=None, count=1, check=True, **kwargs): Step to create ironic ports with kwargs dictionary of attributes. Args: addresses (list): MAC addresses f... | e7583444cd24893ec6ae237b47db7c605b99b0c5 | <|skeleton|>
class IronicPortSteps:
"""Ironic port steps."""
def create_ports(self, node, addresses=None, count=1, check=True, **kwargs):
"""Step to create ironic ports with kwargs dictionary of attributes. Args: addresses (list): MAC addresses for ports node (object): node of the ports should be assoc... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IronicPortSteps:
"""Ironic port steps."""
def create_ports(self, node, addresses=None, count=1, check=True, **kwargs):
"""Step to create ironic ports with kwargs dictionary of attributes. Args: addresses (list): MAC addresses for ports node (object): node of the ports should be associated with co... | the_stack_v2_python_sparse | stepler/baremetal/steps/port.py | Mirantis/stepler | train | 16 |
146659f63d3690b47d02d12ff2d70764a4026972 | [
"self.num_ends = {}\nself.milestones = []\nif A:\n size = 0\n for i in xrange(0, len(A), 2):\n if A[i] > 0:\n size += A[i]\n self.num_ends[size] = A[i + 1]\n self.milestones.append(size)\nself.start = 0\nself.milestone = 0",
"self.start += n\nif self.start > self.mile... | <|body_start_0|>
self.num_ends = {}
self.milestones = []
if A:
size = 0
for i in xrange(0, len(A), 2):
if A[i] > 0:
size += A[i]
self.num_ends[size] = A[i + 1]
self.milestones.append(size)
... | RLEIterator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RLEIterator:
def __init__(self, A):
""":type A: List[int]"""
<|body_0|>
def next(self, n):
""":type n: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.num_ends = {}
self.milestones = []
if A:
size = 0... | stack_v2_sparse_classes_36k_train_002838 | 997 | no_license | [
{
"docstring": ":type A: List[int]",
"name": "__init__",
"signature": "def __init__(self, A)"
},
{
"docstring": ":type n: int :rtype: int",
"name": "next",
"signature": "def next(self, n)"
}
] | 2 | null | Implement the Python class `RLEIterator` described below.
Class description:
Implement the RLEIterator class.
Method signatures and docstrings:
- def __init__(self, A): :type A: List[int]
- def next(self, n): :type n: int :rtype: int | Implement the Python class `RLEIterator` described below.
Class description:
Implement the RLEIterator class.
Method signatures and docstrings:
- def __init__(self, A): :type A: List[int]
- def next(self, n): :type n: int :rtype: int
<|skeleton|>
class RLEIterator:
def __init__(self, A):
""":type A: Lis... | ea10ce7fe465431399e444c6ecb0b7560b17e1e4 | <|skeleton|>
class RLEIterator:
def __init__(self, A):
""":type A: List[int]"""
<|body_0|>
def next(self, n):
""":type n: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RLEIterator:
def __init__(self, A):
""":type A: List[int]"""
self.num_ends = {}
self.milestones = []
if A:
size = 0
for i in xrange(0, len(A), 2):
if A[i] > 0:
size += A[i]
self.num_ends[size] = A[i... | the_stack_v2_python_sparse | leetcode_python2/lc900_RLE_iterator.py | garderobin/Leetcode | train | 0 | |
769c3a66ce6a95e7a332e75240a327f9198ed6f6 | [
"Feature.__init__(self, feature_id, organism_id, name, uniquename, feature_type, analysis, obsolete)\nself.hgnc_id_list = None\nself.mod_id_list = None\nself.agr_gene_id = None\nself.promoted_gene_type = None",
"self.agr_gene_id = 'FB:{}'.format(self.uniquename)\nif type(self.hgnc_id_list) != list:\n log.warni... | <|body_start_0|>
Feature.__init__(self, feature_id, organism_id, name, uniquename, feature_type, analysis, obsolete)
self.hgnc_id_list = None
self.mod_id_list = None
self.agr_gene_id = None
self.promoted_gene_type = None
<|end_body_0|>
<|body_start_1|>
self.agr_gene_id =... | Define a FlyBase Gene object. | Gene | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Gene:
"""Define a FlyBase Gene object."""
def __init__(self, feature_id, organism_id, name, uniquename, feature_type, analysis, obsolete):
"""Initialize a FlyBase Gene class object. See Feature for details."""
<|body_0|>
def pick_gene_id(self):
"""Pick between FB... | stack_v2_sparse_classes_36k_train_002839 | 26,965 | permissive | [
{
"docstring": "Initialize a FlyBase Gene class object. See Feature for details.",
"name": "__init__",
"signature": "def __init__(self, feature_id, organism_id, name, uniquename, feature_type, analysis, obsolete)"
},
{
"docstring": "Pick between FB, HGNC or other MOD ID to report.",
"name": ... | 3 | stack_v2_sparse_classes_30k_train_013225 | Implement the Python class `Gene` described below.
Class description:
Define a FlyBase Gene object.
Method signatures and docstrings:
- def __init__(self, feature_id, organism_id, name, uniquename, feature_type, analysis, obsolete): Initialize a FlyBase Gene class object. See Feature for details.
- def pick_gene_id(s... | Implement the Python class `Gene` described below.
Class description:
Define a FlyBase Gene object.
Method signatures and docstrings:
- def __init__(self, feature_id, organism_id, name, uniquename, feature_type, analysis, obsolete): Initialize a FlyBase Gene class object. See Feature for details.
- def pick_gene_id(s... | 4ca26874eaa7e10c474d9d5036af50d52e75976d | <|skeleton|>
class Gene:
"""Define a FlyBase Gene object."""
def __init__(self, feature_id, organism_id, name, uniquename, feature_type, analysis, obsolete):
"""Initialize a FlyBase Gene class object. See Feature for details."""
<|body_0|>
def pick_gene_id(self):
"""Pick between FB... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Gene:
"""Define a FlyBase Gene object."""
def __init__(self, feature_id, organism_id, name, uniquename, feature_type, analysis, obsolete):
"""Initialize a FlyBase Gene class object. See Feature for details."""
Feature.__init__(self, feature_id, organism_id, name, uniquename, feature_type,... | the_stack_v2_python_sparse | harvdev_utils/psycopg_functions/fb_feature_classes.py | FlyBase/harvdev-utils | train | 2 |
fcd28400a292e2ebc9466e17a30d1df5ba5bc547 | [
"uom = self._node.uom\nif isinstance(uom, list):\n return UOM_FRIENDLY_NAME.get(uom[0], uom[0])\nisy_states = UOM_TO_STATES.get(uom)\nif isy_states:\n return isy_states\nif uom in [UOM_ON_OFF, UOM_INDEX]:\n return uom\nreturn UOM_FRIENDLY_NAME.get(uom)",
"value = self._node.status\nif value == ISY_VALUE_... | <|body_start_0|>
uom = self._node.uom
if isinstance(uom, list):
return UOM_FRIENDLY_NAME.get(uom[0], uom[0])
isy_states = UOM_TO_STATES.get(uom)
if isy_states:
return isy_states
if uom in [UOM_ON_OFF, UOM_INDEX]:
return uom
return UOM_F... | Representation of an ISY994 sensor device. | ISYSensorEntity | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ISYSensorEntity:
"""Representation of an ISY994 sensor device."""
def raw_unit_of_measurement(self) -> dict | str:
"""Get the raw unit of measurement for the ISY994 sensor device."""
<|body_0|>
def state(self) -> str:
"""Get the state of the ISY994 sensor device.... | stack_v2_sparse_classes_36k_train_002840 | 4,390 | permissive | [
{
"docstring": "Get the raw unit of measurement for the ISY994 sensor device.",
"name": "raw_unit_of_measurement",
"signature": "def raw_unit_of_measurement(self) -> dict | str"
},
{
"docstring": "Get the state of the ISY994 sensor device.",
"name": "state",
"signature": "def state(self)... | 3 | null | Implement the Python class `ISYSensorEntity` described below.
Class description:
Representation of an ISY994 sensor device.
Method signatures and docstrings:
- def raw_unit_of_measurement(self) -> dict | str: Get the raw unit of measurement for the ISY994 sensor device.
- def state(self) -> str: Get the state of the ... | Implement the Python class `ISYSensorEntity` described below.
Class description:
Representation of an ISY994 sensor device.
Method signatures and docstrings:
- def raw_unit_of_measurement(self) -> dict | str: Get the raw unit of measurement for the ISY994 sensor device.
- def state(self) -> str: Get the state of the ... | 2fee32fce03bc49e86cf2e7b741a15621a97cce5 | <|skeleton|>
class ISYSensorEntity:
"""Representation of an ISY994 sensor device."""
def raw_unit_of_measurement(self) -> dict | str:
"""Get the raw unit of measurement for the ISY994 sensor device."""
<|body_0|>
def state(self) -> str:
"""Get the state of the ISY994 sensor device.... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ISYSensorEntity:
"""Representation of an ISY994 sensor device."""
def raw_unit_of_measurement(self) -> dict | str:
"""Get the raw unit of measurement for the ISY994 sensor device."""
uom = self._node.uom
if isinstance(uom, list):
return UOM_FRIENDLY_NAME.get(uom[0], uo... | the_stack_v2_python_sparse | homeassistant/components/isy994/sensor.py | BenWoodford/home-assistant | train | 11 |
32581d6d4a692abf945cb3198599ef06ef15b76a | [
"l, r = (0, 0)\nlookup = set()\nmaxLen = 0\nwhile r < len(s):\n if s[r] not in lookup:\n lookup.add(s[r])\n maxLen = max(maxLen, r - l + 1)\n r += 1\n else:\n lookup.remove(s[l])\n l += 1\nreturn maxLen",
"l, r = (0, 0)\nlookup = {}\nmaxLen = 0\nwhile r < len(s):\n if s... | <|body_start_0|>
l, r = (0, 0)
lookup = set()
maxLen = 0
while r < len(s):
if s[r] not in lookup:
lookup.add(s[r])
maxLen = max(maxLen, r - l + 1)
r += 1
else:
lookup.remove(s[l])
l +=... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lengthOfLongestSubstring1(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def lengthOfLongestSubstring(self, s):
""":type s: str :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
l, r = (0, 0)
lookup = set()
... | stack_v2_sparse_classes_36k_train_002841 | 915 | no_license | [
{
"docstring": ":type s: str :rtype: int",
"name": "lengthOfLongestSubstring1",
"signature": "def lengthOfLongestSubstring1(self, s)"
},
{
"docstring": ":type s: str :rtype: int",
"name": "lengthOfLongestSubstring",
"signature": "def lengthOfLongestSubstring(self, s)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLongestSubstring1(self, s): :type s: str :rtype: int
- def lengthOfLongestSubstring(self, s): :type s: str :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLongestSubstring1(self, s): :type s: str :rtype: int
- def lengthOfLongestSubstring(self, s): :type s: str :rtype: int
<|skeleton|>
class Solution:
def lengthOf... | d953abe2c9680f636563e76287d2f907e90ced63 | <|skeleton|>
class Solution:
def lengthOfLongestSubstring1(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def lengthOfLongestSubstring(self, s):
""":type s: str :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def lengthOfLongestSubstring1(self, s):
""":type s: str :rtype: int"""
l, r = (0, 0)
lookup = set()
maxLen = 0
while r < len(s):
if s[r] not in lookup:
lookup.add(s[r])
maxLen = max(maxLen, r - l + 1)
... | the_stack_v2_python_sparse | python_leetcode_2020/Python_Leetcode_2020/3_longest_substring_no_repeating.py | xiangcao/Leetcode | train | 0 | |
a184c10bc5a33f14401a45ca96bc88c0ee033b86 | [
"try:\n json_data = api.payload\n resp = Node().register(json_data)\n return masked_json_template(resp, 200)\nexcept:\n abort(400, 'Input unrecognizable.')",
"try:\n try:\n get_args = {'filter': request.args.get('filter', default='', type=str), 'range': request.args.get('range', default='', ... | <|body_start_0|>
try:
json_data = api.payload
resp = Node().register(json_data)
return masked_json_template(resp, 200)
except:
abort(400, 'Input unrecognizable.')
<|end_body_0|>
<|body_start_1|>
try:
try:
get_args = {'f... | NodeRoute | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NodeRoute:
def post(self):
"""Add new node"""
<|body_0|>
def get(self):
"""Get Node data"""
<|body_1|>
def delete(self):
"""Delete all existing Nodes"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
try:
json_data = a... | stack_v2_sparse_classes_36k_train_002842 | 4,218 | permissive | [
{
"docstring": "Add new node",
"name": "post",
"signature": "def post(self)"
},
{
"docstring": "Get Node data",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "Delete all existing Nodes",
"name": "delete",
"signature": "def delete(self)"
}
] | 3 | stack_v2_sparse_classes_30k_train_009397 | Implement the Python class `NodeRoute` described below.
Class description:
Implement the NodeRoute class.
Method signatures and docstrings:
- def post(self): Add new node
- def get(self): Get Node data
- def delete(self): Delete all existing Nodes | Implement the Python class `NodeRoute` described below.
Class description:
Implement the NodeRoute class.
Method signatures and docstrings:
- def post(self): Add new node
- def get(self): Get Node data
- def delete(self): Delete all existing Nodes
<|skeleton|>
class NodeRoute:
def post(self):
"""Add new... | 100fca0d2dd9b0b2ab2fa5974d8126af35ddcfd1 | <|skeleton|>
class NodeRoute:
def post(self):
"""Add new node"""
<|body_0|>
def get(self):
"""Get Node data"""
<|body_1|>
def delete(self):
"""Delete all existing Nodes"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NodeRoute:
def post(self):
"""Add new node"""
try:
json_data = api.payload
resp = Node().register(json_data)
return masked_json_template(resp, 200)
except:
abort(400, 'Input unrecognizable.')
def get(self):
"""Get Node data""... | the_stack_v2_python_sparse | app/controllers/api/node/node.py | ardihikaru/api-dashboard-5g-dive | train | 0 | |
a59092f9fc1fb7f0b222ae9428d736b7c01f31ed | [
"target_hid = request.POST.get('target_hid')\nupstream = self.get_upstream_for_user(request, target_hid=target_hid)\nif not self.viewer_logged_in(upstream):\n return self.render_error(request, code='login_required', status=401)\nelif not upstream['target_user']:\n return self.render_error(request, code='nonex... | <|body_start_0|>
target_hid = request.POST.get('target_hid')
upstream = self.get_upstream_for_user(request, target_hid=target_hid)
if not self.viewer_logged_in(upstream):
return self.render_error(request, code='login_required', status=401)
elif not upstream['target_user']:
... | UserRetrieve | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserRetrieve:
def post(self, request, **kwargs):
"""Retrieves the "recommend" view for multiple User profile. The recommend view is used when a User Request a recommendations for profiles to match with. :param request: HTTP request containing .. code-block:: javascript { "target_hid": "b... | stack_v2_sparse_classes_36k_train_002843 | 6,693 | permissive | [
{
"docstring": "Retrieves the \"recommend\" view for multiple User profile. The recommend view is used when a User Request a recommendations for profiles to match with. :param request: HTTP request containing .. code-block:: javascript { \"target_hid\": \"b3665ea5\" } :return: JSON object .. code-block:: javasc... | 2 | null | Implement the Python class `UserRetrieve` described below.
Class description:
Implement the UserRetrieve class.
Method signatures and docstrings:
- def post(self, request, **kwargs): Retrieves the "recommend" view for multiple User profile. The recommend view is used when a User Request a recommendations for profiles... | Implement the Python class `UserRetrieve` described below.
Class description:
Implement the UserRetrieve class.
Method signatures and docstrings:
- def post(self, request, **kwargs): Retrieves the "recommend" view for multiple User profile. The recommend view is used when a User Request a recommendations for profiles... | ae2d8db3c723773b94202bfed9d4943f15264026 | <|skeleton|>
class UserRetrieve:
def post(self, request, **kwargs):
"""Retrieves the "recommend" view for multiple User profile. The recommend view is used when a User Request a recommendations for profiles to match with. :param request: HTTP request containing .. code-block:: javascript { "target_hid": "b... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserRetrieve:
def post(self, request, **kwargs):
"""Retrieves the "recommend" view for multiple User profile. The recommend view is used when a User Request a recommendations for profiles to match with. :param request: HTTP request containing .. code-block:: javascript { "target_hid": "b3665ea5" } :re... | the_stack_v2_python_sparse | helios/api_helios/user/retrieve_recommend.py | kairathmann/dating | train | 0 | |
c2db422cc7a9bb4ec61ea1f37c28c02e9da345ff | [
"try:\n with datastore_services.get_ndb_context():\n question_summary = question_services.get_question_summary_from_model(question_summary_model)\n question_summary.version = question_version\n question_summary.validate()\nexcept Exception as e:\n logging.exception(e)\n return result.Err((ques... | <|body_start_0|>
try:
with datastore_services.get_ndb_context():
question_summary = question_services.get_question_summary_from_model(question_summary_model)
question_summary.version = question_version
question_summary.validate()
except Exception as e:... | Job that adds a version field to QuestionSummary models. | PopulateQuestionSummaryVersionOneOffJob | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PopulateQuestionSummaryVersionOneOffJob:
"""Job that adds a version field to QuestionSummary models."""
def _update_and_validate_summary_model(question_version: int, question_summary_model: question_models.QuestionSummaryModel) -> result.Result[Tuple[str, question_models.QuestionSummaryModel... | stack_v2_sparse_classes_36k_train_002844 | 12,101 | permissive | [
{
"docstring": "Transform question summary model into question summary object, add a version field and return the populated summary model. Args: question_version: int. The version number in the corresponding question domain object. question_summary_model: QuestionSummaryModel. The question summary model to migr... | 2 | stack_v2_sparse_classes_30k_train_020363 | Implement the Python class `PopulateQuestionSummaryVersionOneOffJob` described below.
Class description:
Job that adds a version field to QuestionSummary models.
Method signatures and docstrings:
- def _update_and_validate_summary_model(question_version: int, question_summary_model: question_models.QuestionSummaryMod... | Implement the Python class `PopulateQuestionSummaryVersionOneOffJob` described below.
Class description:
Job that adds a version field to QuestionSummary models.
Method signatures and docstrings:
- def _update_and_validate_summary_model(question_version: int, question_summary_model: question_models.QuestionSummaryMod... | d16fdf23d790eafd63812bd7239532256e30a21d | <|skeleton|>
class PopulateQuestionSummaryVersionOneOffJob:
"""Job that adds a version field to QuestionSummary models."""
def _update_and_validate_summary_model(question_version: int, question_summary_model: question_models.QuestionSummaryModel) -> result.Result[Tuple[str, question_models.QuestionSummaryModel... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PopulateQuestionSummaryVersionOneOffJob:
"""Job that adds a version field to QuestionSummary models."""
def _update_and_validate_summary_model(question_version: int, question_summary_model: question_models.QuestionSummaryModel) -> result.Result[Tuple[str, question_models.QuestionSummaryModel], Tuple[str,... | the_stack_v2_python_sparse | core/jobs/batch_jobs/question_migration_jobs.py | oppia/oppia | train | 6,172 |
30133262e180c6b51f848246bbeec47bda57960a | [
"output_file = open(output_path, 'w')\noutput_file.write('Initializing task log\\n')\noutput_file.flush()\nroot_logger = logging.getLogger()\nroot_logger.setLevel(logging.DEBUG)\nhandler = logging.StreamHandler(output_file)\nroot_logger.addHandler(handler)\n\ndef handle_sigterm(_: Any, __: Any) -> None:\n \"\"\"... | <|body_start_0|>
output_file = open(output_path, 'w')
output_file.write('Initializing task log\n')
output_file.flush()
root_logger = logging.getLogger()
root_logger.setLevel(logging.DEBUG)
handler = logging.StreamHandler(output_file)
root_logger.addHandler(handler... | Version of TaskRunner that just runs tasks with Multiprocessing. Can't use threading because there's no way to send a cancel signal or exception to a Python thread, if loops in the task (i.e. ToilWorkflowRunner) don't poll for it. | MultiprocessingTaskRunner | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiprocessingTaskRunner:
"""Version of TaskRunner that just runs tasks with Multiprocessing. Can't use threading because there's no way to send a cancel signal or exception to a Python thread, if loops in the task (i.e. ToilWorkflowRunner) don't poll for it."""
def set_up_and_run_task(outp... | stack_v2_sparse_classes_36k_train_002845 | 24,420 | permissive | [
{
"docstring": "Set up logging for the process into the given file and then call run_wes_task with the given arguments. If the process finishes successfully, it will clean up the log, but if the process crashes, the caller must clean up the log.",
"name": "set_up_and_run_task",
"signature": "def set_up_... | 4 | stack_v2_sparse_classes_30k_train_013772 | Implement the Python class `MultiprocessingTaskRunner` described below.
Class description:
Version of TaskRunner that just runs tasks with Multiprocessing. Can't use threading because there's no way to send a cancel signal or exception to a Python thread, if loops in the task (i.e. ToilWorkflowRunner) don't poll for i... | Implement the Python class `MultiprocessingTaskRunner` described below.
Class description:
Version of TaskRunner that just runs tasks with Multiprocessing. Can't use threading because there's no way to send a cancel signal or exception to a Python thread, if loops in the task (i.e. ToilWorkflowRunner) don't poll for i... | 87f858d693518d0f0f23cbb4f898cd14b824d843 | <|skeleton|>
class MultiprocessingTaskRunner:
"""Version of TaskRunner that just runs tasks with Multiprocessing. Can't use threading because there's no way to send a cancel signal or exception to a Python thread, if loops in the task (i.e. ToilWorkflowRunner) don't poll for it."""
def set_up_and_run_task(outp... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MultiprocessingTaskRunner:
"""Version of TaskRunner that just runs tasks with Multiprocessing. Can't use threading because there's no way to send a cancel signal or exception to a Python thread, if loops in the task (i.e. ToilWorkflowRunner) don't poll for it."""
def set_up_and_run_task(output_path: str,... | the_stack_v2_python_sparse | src/toil/server/wes/tasks.py | DataBiosphere/toil | train | 416 |
e612a9431dc0052f2269acc6a46d67041eb602ff | [
"super(ReferenceTransformationDataset, self).__init__(dim, datasources, data_generators, data_generator_sources, iterator, all_generators_post_processing, debug_image_folder, debug_image_type)\nself.reference_datasource_keys = reference_datasource_keys\nself.reference_transformation = reference_transformation\nself... | <|body_start_0|>
super(ReferenceTransformationDataset, self).__init__(dim, datasources, data_generators, data_generator_sources, iterator, all_generators_post_processing, debug_image_folder, debug_image_type)
self.reference_datasource_keys = reference_datasource_keys
self.reference_transformatio... | Dataset consisting of multiple datasources, datagenerators a reference spatial transformation and an iterator. The reference transformation is used for all datagenerators. Usually image to image networks need this dataset. This dataset is used for segmentation/localization tasks, where the generated outputs must have t... | ReferenceTransformationDataset | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReferenceTransformationDataset:
"""Dataset consisting of multiple datasources, datagenerators a reference spatial transformation and an iterator. The reference transformation is used for all datagenerators. Usually image to image networks need this dataset. This dataset is used for segmentation/l... | stack_v2_sparse_classes_36k_train_002846 | 7,259 | no_license | [
{
"docstring": "Initializer. Example: reference_datasource_keys = {'image': 'image_datasource'} data_sources = {'image_datasource': ImageDataSource(...), 'segmentation_datasource': ImageDataSource(...)} data_generators = {'image_generator': ImageGenerator(...), 'segmentation_generator': ImageGenerator(...)} dat... | 3 | null | Implement the Python class `ReferenceTransformationDataset` described below.
Class description:
Dataset consisting of multiple datasources, datagenerators a reference spatial transformation and an iterator. The reference transformation is used for all datagenerators. Usually image to image networks need this dataset. ... | Implement the Python class `ReferenceTransformationDataset` described below.
Class description:
Dataset consisting of multiple datasources, datagenerators a reference spatial transformation and an iterator. The reference transformation is used for all datagenerators. Usually image to image networks need this dataset. ... | ef6cee91264ba1fe6b40d9823a07647b95bcc2c4 | <|skeleton|>
class ReferenceTransformationDataset:
"""Dataset consisting of multiple datasources, datagenerators a reference spatial transformation and an iterator. The reference transformation is used for all datagenerators. Usually image to image networks need this dataset. This dataset is used for segmentation/l... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ReferenceTransformationDataset:
"""Dataset consisting of multiple datasources, datagenerators a reference spatial transformation and an iterator. The reference transformation is used for all datagenerators. Usually image to image networks need this dataset. This dataset is used for segmentation/localization t... | the_stack_v2_python_sparse | datasets/reference_image_transformation_dataset.py | XiaoweiXu/MedicalDataAugmentationTool | train | 1 |
80b2c664bf95039f3f1c8abb460ba7dc04c81b88 | [
"self.water_aug = ops.Water(device='gpu', ampl_x=ampl_x, ampl_y=ampl_y, freq_x=freq_x, freq_y=freq_y, phase_x=phase_x, phase_y=phase_y, fill_value=fill_value)\nself.rng = ops.CoinFlip(probability=p)\nself.bool = ops.Cast(dtype=types.DALIDataType.BOOL)",
"data = EasyDict(data)\naug_images = self.water_aug(data.ima... | <|body_start_0|>
self.water_aug = ops.Water(device='gpu', ampl_x=ampl_x, ampl_y=ampl_y, freq_x=freq_x, freq_y=freq_y, phase_x=phase_x, phase_y=phase_y, fill_value=fill_value)
self.rng = ops.CoinFlip(probability=p)
self.bool = ops.Cast(dtype=types.DALIDataType.BOOL)
<|end_body_0|>
<|body_start_1... | Randomly perform a water augmentation (make image appear to be underwater) Currently not support coordinates sensitive labels | RandomWater | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandomWater:
"""Randomly perform a water augmentation (make image appear to be underwater) Currently not support coordinates sensitive labels"""
def __init__(self, p: float=0.5, ampl_x: float=10.0, ampl_y: float=10.0, freq_x: float=0.049087, freq_y: float=0.049087, phase_x: float=0.0, phase_... | stack_v2_sparse_classes_36k_train_002847 | 22,608 | no_license | [
{
"docstring": "Initialization Args: p (float, optional): Probability to apply this transformation. Defaults to .5. ampl_x (float, optional): Amplitude of the wave in x direction.. Defaults to 10.0. ampl_y (float, optional): Amplitude of the wave in y direction.. Defaults to 10.0. freq_x (float, optional): Freq... | 2 | stack_v2_sparse_classes_30k_train_006742 | Implement the Python class `RandomWater` described below.
Class description:
Randomly perform a water augmentation (make image appear to be underwater) Currently not support coordinates sensitive labels
Method signatures and docstrings:
- def __init__(self, p: float=0.5, ampl_x: float=10.0, ampl_y: float=10.0, freq_x... | Implement the Python class `RandomWater` described below.
Class description:
Randomly perform a water augmentation (make image appear to be underwater) Currently not support coordinates sensitive labels
Method signatures and docstrings:
- def __init__(self, p: float=0.5, ampl_x: float=10.0, ampl_y: float=10.0, freq_x... | 1532db8447d03e75d5ec26f93111270a4ccb7a7e | <|skeleton|>
class RandomWater:
"""Randomly perform a water augmentation (make image appear to be underwater) Currently not support coordinates sensitive labels"""
def __init__(self, p: float=0.5, ampl_x: float=10.0, ampl_y: float=10.0, freq_x: float=0.049087, freq_y: float=0.049087, phase_x: float=0.0, phase_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RandomWater:
"""Randomly perform a water augmentation (make image appear to be underwater) Currently not support coordinates sensitive labels"""
def __init__(self, p: float=0.5, ampl_x: float=10.0, ampl_y: float=10.0, freq_x: float=0.049087, freq_y: float=0.049087, phase_x: float=0.0, phase_y: float=0.0,... | the_stack_v2_python_sparse | src/development/vortex/development/utils/data/augment/modules/nvidia_dali/modules.py | jesslynsepthiaa/vortex | train | 0 |
52a2bd0cc75c2c61cd9a54f6e5a6d28376c08871 | [
"logger.info('Overriding class: Optimizer -> SOS.')\nsuper(SOS, self).__init__()\nself.build(params)\nlogger.info('Class overrided.')",
"a = copy.deepcopy(agent_i)\nb = copy.deepcopy(agent_j)\nmutual_vector = (agent_i.position + agent_j.position) / 2\nBF_1, BF_2 = np.random.choice([1, 2], 2, replace=False)\nr1 = ... | <|body_start_0|>
logger.info('Overriding class: Optimizer -> SOS.')
super(SOS, self).__init__()
self.build(params)
logger.info('Class overrided.')
<|end_body_0|>
<|body_start_1|>
a = copy.deepcopy(agent_i)
b = copy.deepcopy(agent_j)
mutual_vector = (agent_i.posit... | An SOS class, inherited from Optimizer. This is the designed class to define SOS-related variables and methods. References: M.-Y. Cheng and D. Prayogo. Symbiotic Organisms Search: A new metaheuristic optimization algorithm. Computers & Structures (2014). | SOS | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SOS:
"""An SOS class, inherited from Optimizer. This is the designed class to define SOS-related variables and methods. References: M.-Y. Cheng and D. Prayogo. Symbiotic Organisms Search: A new metaheuristic optimization algorithm. Computers & Structures (2014)."""
def __init__(self, params:... | stack_v2_sparse_classes_36k_train_002848 | 4,786 | permissive | [
{
"docstring": "Initialization method. Args: params: Contains key-value parameters to the meta-heuristics.",
"name": "__init__",
"signature": "def __init__(self, params: Optional[Dict[str, Any]]=None) -> None"
},
{
"docstring": "Performs the mutualism operation. Args: agent_i: Selected `i` agent... | 5 | null | Implement the Python class `SOS` described below.
Class description:
An SOS class, inherited from Optimizer. This is the designed class to define SOS-related variables and methods. References: M.-Y. Cheng and D. Prayogo. Symbiotic Organisms Search: A new metaheuristic optimization algorithm. Computers & Structures (20... | Implement the Python class `SOS` described below.
Class description:
An SOS class, inherited from Optimizer. This is the designed class to define SOS-related variables and methods. References: M.-Y. Cheng and D. Prayogo. Symbiotic Organisms Search: A new metaheuristic optimization algorithm. Computers & Structures (20... | 7326a887ed8e3858bc99c8815048d56d02edf88c | <|skeleton|>
class SOS:
"""An SOS class, inherited from Optimizer. This is the designed class to define SOS-related variables and methods. References: M.-Y. Cheng and D. Prayogo. Symbiotic Organisms Search: A new metaheuristic optimization algorithm. Computers & Structures (2014)."""
def __init__(self, params:... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SOS:
"""An SOS class, inherited from Optimizer. This is the designed class to define SOS-related variables and methods. References: M.-Y. Cheng and D. Prayogo. Symbiotic Organisms Search: A new metaheuristic optimization algorithm. Computers & Structures (2014)."""
def __init__(self, params: Optional[Dic... | the_stack_v2_python_sparse | opytimizer/optimizers/swarm/sos.py | gugarosa/opytimizer | train | 602 |
d738cce63d6ca0f4ca3f955416c1b13e25e66c39 | [
"new_headers = dict(((k, v) for k, v in request.headers.items() if k.lower() not in REMOVE_ON_REDIRECT))\norig_method = request.get_method()\nmethod = orig_method if orig_method in GET_HEAD else 'GET'\nnew_request = HTTPRequest(new_url_obj, headers=new_headers, origin_req_host=request.get_origin_req_host(), method=... | <|body_start_0|>
new_headers = dict(((k, v) for k, v in request.headers.items() if k.lower() not in REMOVE_ON_REDIRECT))
orig_method = request.get_method()
method = orig_method if orig_method in GET_HEAD else 'GET'
new_request = HTTPRequest(new_url_obj, headers=new_headers, origin_req_ho... | A simple handler that handles 30x HTTP responses when the request has `follow_redirects` set to True. The handler follows the redirect to the next URL, keeping track of redirect loops. Most plugins don't care about redirects and thus the default follow_redirect setting is False. In cases such as the web_spider.py this ... | HTTP30XHandler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HTTP30XHandler:
"""A simple handler that handles 30x HTTP responses when the request has `follow_redirects` set to True. The handler follows the redirect to the next URL, keeping track of redirect loops. Most plugins don't care about redirects and thus the default follow_redirect setting is False... | stack_v2_sparse_classes_36k_train_002849 | 7,326 | no_license | [
{
"docstring": "Create a new HTTP request inheriting all the attributes from the original object and setting the target URL to the one received in the 30x response.",
"name": "create_redirect_request",
"signature": "def create_redirect_request(self, request, response, new_url_obj)"
},
{
"docstri... | 4 | null | Implement the Python class `HTTP30XHandler` described below.
Class description:
A simple handler that handles 30x HTTP responses when the request has `follow_redirects` set to True. The handler follows the redirect to the next URL, keeping track of redirect loops. Most plugins don't care about redirects and thus the d... | Implement the Python class `HTTP30XHandler` described below.
Class description:
A simple handler that handles 30x HTTP responses when the request has `follow_redirects` set to True. The handler follows the redirect to the next URL, keeping track of redirect loops. Most plugins don't care about redirects and thus the d... | 5548a6f36f04108ac1a6ed8e707930f9821f0bd9 | <|skeleton|>
class HTTP30XHandler:
"""A simple handler that handles 30x HTTP responses when the request has `follow_redirects` set to True. The handler follows the redirect to the next URL, keeping track of redirect loops. Most plugins don't care about redirects and thus the default follow_redirect setting is False... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HTTP30XHandler:
"""A simple handler that handles 30x HTTP responses when the request has `follow_redirects` set to True. The handler follows the redirect to the next URL, keeping track of redirect loops. Most plugins don't care about redirects and thus the default follow_redirect setting is False. In cases su... | the_stack_v2_python_sparse | venv/Lib/site-packages/w3af/core/data/url/handlers/redirect.py | AravindChan96/Vulcan | train | 1 |
3a377116f924dce27a51fa9b958a61a83f1a148a | [
"@lru_cache(None)\ndef dfs(index: int, remain: int) -> int:\n if remain == 0 or index >= n:\n return 0\n res = dfs(index + 1, remain)\n _, end, score = events[index]\n nextPos = bisect_right(events, end, key=lambda x: x[0])\n nextRes = dfs(nextPos, remain - 1) + score\n return res if res > ... | <|body_start_0|>
@lru_cache(None)
def dfs(index: int, remain: int) -> int:
if remain == 0 or index >= n:
return 0
res = dfs(index + 1, remain)
_, end, score = events[index]
nextPos = bisect_right(events, end, key=lambda x: x[0])
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxValue(self, events: List[List[int]], k: int) -> int:
"""记忆化dfs"""
<|body_0|>
def maxValue2(self, events: List[List[int]], k: int) -> int:
"""dp"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
@lru_cache(None)
def dfs(index: ... | stack_v2_sparse_classes_36k_train_002850 | 1,574 | no_license | [
{
"docstring": "记忆化dfs",
"name": "maxValue",
"signature": "def maxValue(self, events: List[List[int]], k: int) -> int"
},
{
"docstring": "dp",
"name": "maxValue2",
"signature": "def maxValue2(self, events: List[List[int]], k: int) -> int"
}
] | 2 | stack_v2_sparse_classes_30k_test_000676 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxValue(self, events: List[List[int]], k: int) -> int: 记忆化dfs
- def maxValue2(self, events: List[List[int]], k: int) -> int: dp | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxValue(self, events: List[List[int]], k: int) -> int: 记忆化dfs
- def maxValue2(self, events: List[List[int]], k: int) -> int: dp
<|skeleton|>
class Solution:
def maxVal... | 7e79e26bb8f641868561b186e34c1127ed63c9e0 | <|skeleton|>
class Solution:
def maxValue(self, events: List[List[int]], k: int) -> int:
"""记忆化dfs"""
<|body_0|>
def maxValue2(self, events: List[List[int]], k: int) -> int:
"""dp"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxValue(self, events: List[List[int]], k: int) -> int:
"""记忆化dfs"""
@lru_cache(None)
def dfs(index: int, remain: int) -> int:
if remain == 0 or index >= n:
return 0
res = dfs(index + 1, remain)
_, end, score = events[in... | the_stack_v2_python_sparse | 9_排序和搜索/二分/参加会议/1751. 最多可以参加的会议数目 II.py | 981377660LMT/algorithm-study | train | 225 | |
04df25279e921b7364b345e089441379c0573d05 | [
"if not s:\n return 0\nstr_list = s.split()\nwhile str_list:\n if str_list[-1]:\n return len(str_list[-1])\n else:\n str_list.pop()\nelse:\n return 0",
"if not s:\n return 0\ni = len(s) - 1\nwhile i >= 0:\n if s[i] == ' ':\n i -= 1\n else:\n sub_len = 1\n wh... | <|body_start_0|>
if not s:
return 0
str_list = s.split()
while str_list:
if str_list[-1]:
return len(str_list[-1])
else:
str_list.pop()
else:
return 0
<|end_body_0|>
<|body_start_1|>
if not s:
... | Solution | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lengthOfLastWord1(self, s):
"""split string first"""
<|body_0|>
def lengthOfLastWord2(self, s):
"""two pointers (reverse)"""
<|body_1|>
def lengthOfLastWord3(self, s):
"""use str.rstrip"""
<|body_2|>
<|end_skeleton|>
<|bod... | stack_v2_sparse_classes_36k_train_002851 | 1,427 | permissive | [
{
"docstring": "split string first",
"name": "lengthOfLastWord1",
"signature": "def lengthOfLastWord1(self, s)"
},
{
"docstring": "two pointers (reverse)",
"name": "lengthOfLastWord2",
"signature": "def lengthOfLastWord2(self, s)"
},
{
"docstring": "use str.rstrip",
"name": "... | 3 | stack_v2_sparse_classes_30k_train_001586 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLastWord1(self, s): split string first
- def lengthOfLastWord2(self, s): two pointers (reverse)
- def lengthOfLastWord3(self, s): use str.rstrip | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLastWord1(self, s): split string first
- def lengthOfLastWord2(self, s): two pointers (reverse)
- def lengthOfLastWord3(self, s): use str.rstrip
<|skeleton|>
class S... | 49a0b03c55d8a702785888d473ef96539265ce9c | <|skeleton|>
class Solution:
def lengthOfLastWord1(self, s):
"""split string first"""
<|body_0|>
def lengthOfLastWord2(self, s):
"""two pointers (reverse)"""
<|body_1|>
def lengthOfLastWord3(self, s):
"""use str.rstrip"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def lengthOfLastWord1(self, s):
"""split string first"""
if not s:
return 0
str_list = s.split()
while str_list:
if str_list[-1]:
return len(str_list[-1])
else:
str_list.pop()
else:
... | the_stack_v2_python_sparse | leetcode/0058_length_of_last_word.py | chaosWsF/Python-Practice | train | 1 | |
d3ba69cf99f8d6f4c5db23fd3981b17527fede81 | [
"with open(path, 'r') as raw:\n text = raw.readlines()\nres = []\nk = []\nfor line in text:\n if ':' not in line:\n res.append(k + line.strip('\\n').split(','))\n else:\n k = [line.strip(':\\n')]\nreturn res",
"lista = self.combined_to_list(path)\ndf = pd.DataFrame(lista, columns=['netflix_... | <|body_start_0|>
with open(path, 'r') as raw:
text = raw.readlines()
res = []
k = []
for line in text:
if ':' not in line:
res.append(k + line.strip('\n').split(','))
else:
k = [line.strip(':\n')]
return res
<|en... | NetCleaner | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NetCleaner:
def combined_to_list(self, path):
"""Function which transforms Netflix's 'Combined.text' files for later operations. - Args: - path: filepath where 'combined_data_x.txt' is located. -Returns: - List of dictionaries"""
<|body_0|>
def combined_to_csv(self, path, nu... | stack_v2_sparse_classes_36k_train_002852 | 20,000 | no_license | [
{
"docstring": "Function which transforms Netflix's 'Combined.text' files for later operations. - Args: - path: filepath where 'combined_data_x.txt' is located. -Returns: - List of dictionaries",
"name": "combined_to_list",
"signature": "def combined_to_list(self, path)"
},
{
"docstring": "Funct... | 4 | stack_v2_sparse_classes_30k_train_000885 | Implement the Python class `NetCleaner` described below.
Class description:
Implement the NetCleaner class.
Method signatures and docstrings:
- def combined_to_list(self, path): Function which transforms Netflix's 'Combined.text' files for later operations. - Args: - path: filepath where 'combined_data_x.txt' is loca... | Implement the Python class `NetCleaner` described below.
Class description:
Implement the NetCleaner class.
Method signatures and docstrings:
- def combined_to_list(self, path): Function which transforms Netflix's 'Combined.text' files for later operations. - Args: - path: filepath where 'combined_data_x.txt' is loca... | b63e72213d77ad885e356a995c27626d58a6e996 | <|skeleton|>
class NetCleaner:
def combined_to_list(self, path):
"""Function which transforms Netflix's 'Combined.text' files for later operations. - Args: - path: filepath where 'combined_data_x.txt' is located. -Returns: - List of dictionaries"""
<|body_0|>
def combined_to_csv(self, path, nu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NetCleaner:
def combined_to_list(self, path):
"""Function which transforms Netflix's 'Combined.text' files for later operations. - Args: - path: filepath where 'combined_data_x.txt' is located. -Returns: - List of dictionaries"""
with open(path, 'r') as raw:
text = raw.readlines()
... | the_stack_v2_python_sparse | EDA_FINAL/src/utils/mining_data_tb.py | leosanchezsoler/bridge_datascience_JorgeGarcia | train | 0 | |
c4610280f2ce00745ac13d3ffa85ea5f72849e64 | [
"self.half_connection = half_connection\nself.send_packet = []\nself.sleep_time = 3",
"print('start check half connection')\nself.__send_half_connection()\nif len(self.half_connection) > 0:\n time.sleep(self.sleep_time)\nreturn self.__get_half_connection_result()",
"start_time = time.time()\nresults = []\nfo... | <|body_start_0|>
self.half_connection = half_connection
self.send_packet = []
self.sleep_time = 3
<|end_body_0|>
<|body_start_1|>
print('start check half connection')
self.__send_half_connection()
if len(self.half_connection) > 0:
time.sleep(self.sleep_time)
... | ping check | HalfConnectionCheck | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HalfConnectionCheck:
"""ping check"""
def __init__(self, half_connection):
"""init"""
<|body_0|>
def get_half_connection_result(self):
"""get ping result :return:"""
<|body_1|>
def __send_half_connection(self):
"""get ping result :return:"""
... | stack_v2_sparse_classes_36k_train_002853 | 3,162 | no_license | [
{
"docstring": "init",
"name": "__init__",
"signature": "def __init__(self, half_connection)"
},
{
"docstring": "get ping result :return:",
"name": "get_half_connection_result",
"signature": "def get_half_connection_result(self)"
},
{
"docstring": "get ping result :return:",
... | 4 | stack_v2_sparse_classes_30k_train_016543 | Implement the Python class `HalfConnectionCheck` described below.
Class description:
ping check
Method signatures and docstrings:
- def __init__(self, half_connection): init
- def get_half_connection_result(self): get ping result :return:
- def __send_half_connection(self): get ping result :return:
- def __get_half_c... | Implement the Python class `HalfConnectionCheck` described below.
Class description:
ping check
Method signatures and docstrings:
- def __init__(self, half_connection): init
- def get_half_connection_result(self): get ping result :return:
- def __send_half_connection(self): get ping result :return:
- def __get_half_c... | 649d1a61ac15182b55c17e47c126d98d9b956b44 | <|skeleton|>
class HalfConnectionCheck:
"""ping check"""
def __init__(self, half_connection):
"""init"""
<|body_0|>
def get_half_connection_result(self):
"""get ping result :return:"""
<|body_1|>
def __send_half_connection(self):
"""get ping result :return:"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HalfConnectionCheck:
"""ping check"""
def __init__(self, half_connection):
"""init"""
self.half_connection = half_connection
self.send_packet = []
self.sleep_time = 3
def get_half_connection_result(self):
"""get ping result :return:"""
print('start che... | the_stack_v2_python_sparse | server/network_monitor_web_server/check_network/monitor/half_connection_check.py | JasonBourne-sxy/host-web | train | 1 |
0c6590629ced55d961965231a659573fc186914a | [
"if not isinstance(self, ElkCounter):\n raise HomeAssistantError('supported only on ElkM1 Counter sensors')\nself._element.get()",
"if not isinstance(self, ElkCounter):\n raise HomeAssistantError('supported only on ElkM1 Counter sensors')\nif value is not None:\n self._element.set(value)",
"if not isin... | <|body_start_0|>
if not isinstance(self, ElkCounter):
raise HomeAssistantError('supported only on ElkM1 Counter sensors')
self._element.get()
<|end_body_0|>
<|body_start_1|>
if not isinstance(self, ElkCounter):
raise HomeAssistantError('supported only on ElkM1 Counter se... | Base representation of Elk-M1 sensor. | ElkSensor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ElkSensor:
"""Base representation of Elk-M1 sensor."""
async def async_counter_refresh(self) -> None:
"""Refresh the value of a counter from the panel."""
<|body_0|>
async def async_counter_set(self, value: int | None=None) -> None:
"""Set the value of a counter ... | stack_v2_sparse_classes_36k_train_002854 | 9,711 | permissive | [
{
"docstring": "Refresh the value of a counter from the panel.",
"name": "async_counter_refresh",
"signature": "async def async_counter_refresh(self) -> None"
},
{
"docstring": "Set the value of a counter on the panel.",
"name": "async_counter_set",
"signature": "async def async_counter_... | 4 | null | Implement the Python class `ElkSensor` described below.
Class description:
Base representation of Elk-M1 sensor.
Method signatures and docstrings:
- async def async_counter_refresh(self) -> None: Refresh the value of a counter from the panel.
- async def async_counter_set(self, value: int | None=None) -> None: Set th... | Implement the Python class `ElkSensor` described below.
Class description:
Base representation of Elk-M1 sensor.
Method signatures and docstrings:
- async def async_counter_refresh(self) -> None: Refresh the value of a counter from the panel.
- async def async_counter_set(self, value: int | None=None) -> None: Set th... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class ElkSensor:
"""Base representation of Elk-M1 sensor."""
async def async_counter_refresh(self) -> None:
"""Refresh the value of a counter from the panel."""
<|body_0|>
async def async_counter_set(self, value: int | None=None) -> None:
"""Set the value of a counter ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ElkSensor:
"""Base representation of Elk-M1 sensor."""
async def async_counter_refresh(self) -> None:
"""Refresh the value of a counter from the panel."""
if not isinstance(self, ElkCounter):
raise HomeAssistantError('supported only on ElkM1 Counter sensors')
self._ele... | the_stack_v2_python_sparse | homeassistant/components/elkm1/sensor.py | home-assistant/core | train | 35,501 |
c8adafcda5ef3e7f21d0c04ce38a6c5398eef95a | [
"super(Start_transmitting, self).__init__(time, 'Start_transmitting')\nself.node = node\nself.arrival_time = arrival_time\nself.bw = bw",
"self.node.start_transmitting(self.bw)\nevq.add_event(Stop_transmitting(self.arrival_time, self.node, self.bw))\nreturn None"
] | <|body_start_0|>
super(Start_transmitting, self).__init__(time, 'Start_transmitting')
self.node = node
self.arrival_time = arrival_time
self.bw = bw
<|end_body_0|>
<|body_start_1|>
self.node.start_transmitting(self.bw)
evq.add_event(Stop_transmitting(self.arrival_time, s... | Start_transmitting is an event that sets the transmission flag up Attributes: node: Fog_node - the fog node which is transmitting arrival_time: float - when the task will arrive and the node will stop transmitting bw: int - the bandwidth used for this transmission | Start_transmitting | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Start_transmitting:
"""Start_transmitting is an event that sets the transmission flag up Attributes: node: Fog_node - the fog node which is transmitting arrival_time: float - when the task will arrive and the node will stop transmitting bw: int - the bandwidth used for this transmission"""
d... | stack_v2_sparse_classes_36k_train_002855 | 1,257 | no_license | [
{
"docstring": "Parameters: (super) time: float - the time in which the event will run node: Fog_node - the fog node which is transmitting arrival_time: float - when the task will arrive and the node will stop transmitting bw: int - the bandwidth used for this transmission",
"name": "__init__",
"signatu... | 2 | stack_v2_sparse_classes_30k_train_009709 | Implement the Python class `Start_transmitting` described below.
Class description:
Start_transmitting is an event that sets the transmission flag up Attributes: node: Fog_node - the fog node which is transmitting arrival_time: float - when the task will arrive and the node will stop transmitting bw: int - the bandwid... | Implement the Python class `Start_transmitting` described below.
Class description:
Start_transmitting is an event that sets the transmission flag up Attributes: node: Fog_node - the fog node which is transmitting arrival_time: float - when the task will arrive and the node will stop transmitting bw: int - the bandwid... | a16291d34269a206f98a663fa7dacf48292e1aa8 | <|skeleton|>
class Start_transmitting:
"""Start_transmitting is an event that sets the transmission flag up Attributes: node: Fog_node - the fog node which is transmitting arrival_time: float - when the task will arrive and the node will stop transmitting bw: int - the bandwidth used for this transmission"""
d... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Start_transmitting:
"""Start_transmitting is an event that sets the transmission flag up Attributes: node: Fog_node - the fog node which is transmitting arrival_time: float - when the task will arrive and the node will stop transmitting bw: int - the bandwidth used for this transmission"""
def __init__(s... | the_stack_v2_python_sparse | sim_env/events/start_transmitting.py | luisferreira32/fog-computing-orchestration | train | 1 |
f71346cc3729b9f1d6e06f9d76d112c68d550e05 | [
"parent = getattr(context.aq_inner, 'getECParent', None)\nif parent:\n return parent()\nelse:\n return context.portal_url",
"full_title = ''\nid = brain.getCourseId\nif id:\n full_title = '%s - ' % id\nfull_title += brain.Title\nterm = brain.getTerm\nif term:\n full_title += ', %s' % term\nreturn full... | <|body_start_0|>
parent = getattr(context.aq_inner, 'getECParent', None)
if parent:
return parent()
else:
return context.portal_url
<|end_body_0|>
<|body_start_1|>
full_title = ''
id = brain.getCourseId
if id:
full_title = '%s - ' % id... | Content Licensing Utility | eduCommonsUtility | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class eduCommonsUtility:
"""Content Licensing Utility"""
def FindECParent(self, context):
"""return titles and ids for the supported licenses."""
<|body_0|>
def getFullCourseTitle(self, brain):
"""Returns the Title with Term and ID information"""
<|body_1|>
<|... | stack_v2_sparse_classes_36k_train_002856 | 2,592 | no_license | [
{
"docstring": "return titles and ids for the supported licenses.",
"name": "FindECParent",
"signature": "def FindECParent(self, context)"
},
{
"docstring": "Returns the Title with Term and ID information",
"name": "getFullCourseTitle",
"signature": "def getFullCourseTitle(self, brain)"
... | 2 | stack_v2_sparse_classes_30k_test_000283 | Implement the Python class `eduCommonsUtility` described below.
Class description:
Content Licensing Utility
Method signatures and docstrings:
- def FindECParent(self, context): return titles and ids for the supported licenses.
- def getFullCourseTitle(self, brain): Returns the Title with Term and ID information | Implement the Python class `eduCommonsUtility` described below.
Class description:
Content Licensing Utility
Method signatures and docstrings:
- def FindECParent(self, context): return titles and ids for the supported licenses.
- def getFullCourseTitle(self, brain): Returns the Title with Term and ID information
<|s... | 099887aea21ee46350971eadc4bd7d32b362774c | <|skeleton|>
class eduCommonsUtility:
"""Content Licensing Utility"""
def FindECParent(self, context):
"""return titles and ids for the supported licenses."""
<|body_0|>
def getFullCourseTitle(self, brain):
"""Returns the Title with Term and ID information"""
<|body_1|>
<|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class eduCommonsUtility:
"""Content Licensing Utility"""
def FindECParent(self, context):
"""return titles and ids for the supported licenses."""
parent = getattr(context.aq_inner, 'getECParent', None)
if parent:
return parent()
else:
return context.porta... | the_stack_v2_python_sparse | eduCommons/utilities/utils.py | dtgit/ecec | train | 2 |
aaab82149b0f00287a29b9afb8cda85599dcd5df | [
"mock_input = MockInputApi()\nmock_input.files = [MockFile('path/One.java', ['new AlertDialog.Builder()']), MockFile('path/Two.java', ['new AlertDialog.Builder(context);'])]\nerrors = PRESUBMIT._CheckAlertDialogBuilder(mock_input, MockOutputApi())\nself.assertEqual(1, len(errors))\nself.assertEqual(2, len(errors[0]... | <|body_start_0|>
mock_input = MockInputApi()
mock_input.files = [MockFile('path/One.java', ['new AlertDialog.Builder()']), MockFile('path/Two.java', ['new AlertDialog.Builder(context);'])]
errors = PRESUBMIT._CheckAlertDialogBuilder(mock_input, MockOutputApi())
self.assertEqual(1, len(er... | Test the _CheckAlertDialogBuilder presubmit check. | CheckAlertDialogBuilder | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CheckAlertDialogBuilder:
"""Test the _CheckAlertDialogBuilder presubmit check."""
def testTruePositives(self):
"""Examples of when AlertDialog.Builder use is correctly flagged."""
<|body_0|>
def testFalsePositives(self):
"""Examples of when AlertDialog.Builder sh... | stack_v2_sparse_classes_36k_train_002857 | 4,016 | permissive | [
{
"docstring": "Examples of when AlertDialog.Builder use is correctly flagged.",
"name": "testTruePositives",
"signature": "def testTruePositives(self)"
},
{
"docstring": "Examples of when AlertDialog.Builder should not be flagged.",
"name": "testFalsePositives",
"signature": "def testFa... | 2 | null | Implement the Python class `CheckAlertDialogBuilder` described below.
Class description:
Test the _CheckAlertDialogBuilder presubmit check.
Method signatures and docstrings:
- def testTruePositives(self): Examples of when AlertDialog.Builder use is correctly flagged.
- def testFalsePositives(self): Examples of when A... | Implement the Python class `CheckAlertDialogBuilder` described below.
Class description:
Test the _CheckAlertDialogBuilder presubmit check.
Method signatures and docstrings:
- def testTruePositives(self): Examples of when AlertDialog.Builder use is correctly flagged.
- def testFalsePositives(self): Examples of when A... | d92465f71fb8e4345e27bd889532339204b26f1e | <|skeleton|>
class CheckAlertDialogBuilder:
"""Test the _CheckAlertDialogBuilder presubmit check."""
def testTruePositives(self):
"""Examples of when AlertDialog.Builder use is correctly flagged."""
<|body_0|>
def testFalsePositives(self):
"""Examples of when AlertDialog.Builder sh... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CheckAlertDialogBuilder:
"""Test the _CheckAlertDialogBuilder presubmit check."""
def testTruePositives(self):
"""Examples of when AlertDialog.Builder use is correctly flagged."""
mock_input = MockInputApi()
mock_input.files = [MockFile('path/One.java', ['new AlertDialog.Builder()... | the_stack_v2_python_sparse | chromium/chrome/android/java/src/PRESUBMIT_test.py | Csineneo/Vivaldi | train | 5 |
f222acfe93830767f59d96fe76d4f917d3e71e7b | [
"self.session = session\nself.genepanel = genepanel\nself.acmgconfig = acmgconfig\nself._ad_hgnc_ids_cache = None\nself._ar_hgnc_ids_cache = None",
"frequency_config = copy.deepcopy(self.acmgconfig['frequency'])\nper_gene_config = copy.deepcopy(self.acmgconfig.get('genes', {}))\nfor hgnc_id, override in per_gene_... | <|body_start_0|>
self.session = session
self.genepanel = genepanel
self.acmgconfig = acmgconfig
self._ad_hgnc_ids_cache = None
self._ar_hgnc_ids_cache = None
<|end_body_0|>
<|body_start_1|>
frequency_config = copy.deepcopy(self.acmgconfig['frequency'])
per_gene_c... | Find parameters needed for rule engine. | AcmgConfig | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AcmgConfig:
"""Find parameters needed for rule engine."""
def __init__(self, session, acmgconfig, genepanel=None):
""":param acmgconfig: Config for ACMG rule engine. Normally set in user(group) config. :param genepanel: Genepanel for checking inheritance mode. :type genepanel: vardb.... | stack_v2_sparse_classes_36k_train_002858 | 7,709 | permissive | [
{
"docstring": ":param acmgconfig: Config for ACMG rule engine. Normally set in user(group) config. :param genepanel: Genepanel for checking inheritance mode. :type genepanel: vardb.datamodel.gene.Genepanel",
"name": "__init__",
"signature": "def __init__(self, session, acmgconfig, genepanel=None)"
},... | 3 | null | Implement the Python class `AcmgConfig` described below.
Class description:
Find parameters needed for rule engine.
Method signatures and docstrings:
- def __init__(self, session, acmgconfig, genepanel=None): :param acmgconfig: Config for ACMG rule engine. Normally set in user(group) config. :param genepanel: Genepan... | Implement the Python class `AcmgConfig` described below.
Class description:
Find parameters needed for rule engine.
Method signatures and docstrings:
- def __init__(self, session, acmgconfig, genepanel=None): :param acmgconfig: Config for ACMG rule engine. Normally set in user(group) config. :param genepanel: Genepan... | e38631d302611a143c9baaa684bcbd014d9734e4 | <|skeleton|>
class AcmgConfig:
"""Find parameters needed for rule engine."""
def __init__(self, session, acmgconfig, genepanel=None):
""":param acmgconfig: Config for ACMG rule engine. Normally set in user(group) config. :param genepanel: Genepanel for checking inheritance mode. :type genepanel: vardb.... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AcmgConfig:
"""Find parameters needed for rule engine."""
def __init__(self, session, acmgconfig, genepanel=None):
""":param acmgconfig: Config for ACMG rule engine. Normally set in user(group) config. :param genepanel: Genepanel for checking inheritance mode. :type genepanel: vardb.datamodel.gen... | the_stack_v2_python_sparse | src/datalayer/acmgconfig.py | dabble-of-devops-consulting/ella | train | 0 |
bba0f763e8adc7361f08598f99432434e706b4b9 | [
"likes = Like.filter(trip_id, checkpoint_id, photo_id, comment_id)\nif not likes:\n return HttpResponse(status=204)\nall_likes = [like.to_dict() for like in likes][::-1]\nlast_5_users = [{'user_id': i['user'], 'user_name': i['user_name'], 'avatar': i['avatar']} for i in all_likes[:5]]\nliked = False\nif Like.fil... | <|body_start_0|>
likes = Like.filter(trip_id, checkpoint_id, photo_id, comment_id)
if not likes:
return HttpResponse(status=204)
all_likes = [like.to_dict() for like in likes][::-1]
last_5_users = [{'user_id': i['user'], 'user_name': i['user_name'], 'avatar': i['avatar']} for... | LikeView view handles GET and POST requests for LikeView model. | LikeView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LikeView:
"""LikeView view handles GET and POST requests for LikeView model."""
def get(self, request, trip_id=None, checkpoint_id=None, photo_id=None, comment_id=None):
"""Handles GET request, that return JSON response with HTTP status 200, if exception: HTTP status 204."""
... | stack_v2_sparse_classes_36k_train_002859 | 2,417 | no_license | [
{
"docstring": "Handles GET request, that return JSON response with HTTP status 200, if exception: HTTP status 204.",
"name": "get",
"signature": "def get(self, request, trip_id=None, checkpoint_id=None, photo_id=None, comment_id=None)"
},
{
"docstring": "Handles POST request, that return HTTP r... | 2 | stack_v2_sparse_classes_30k_train_019802 | Implement the Python class `LikeView` described below.
Class description:
LikeView view handles GET and POST requests for LikeView model.
Method signatures and docstrings:
- def get(self, request, trip_id=None, checkpoint_id=None, photo_id=None, comment_id=None): Handles GET request, that return JSON response with HT... | Implement the Python class `LikeView` described below.
Class description:
LikeView view handles GET and POST requests for LikeView model.
Method signatures and docstrings:
- def get(self, request, trip_id=None, checkpoint_id=None, photo_id=None, comment_id=None): Handles GET request, that return JSON response with HT... | 6a26f1381447747cec943333e7b787893adf2117 | <|skeleton|>
class LikeView:
"""LikeView view handles GET and POST requests for LikeView model."""
def get(self, request, trip_id=None, checkpoint_id=None, photo_id=None, comment_id=None):
"""Handles GET request, that return JSON response with HTTP status 200, if exception: HTTP status 204."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LikeView:
"""LikeView view handles GET and POST requests for LikeView model."""
def get(self, request, trip_id=None, checkpoint_id=None, photo_id=None, comment_id=None):
"""Handles GET request, that return JSON response with HTTP status 200, if exception: HTTP status 204."""
likes = Like.... | the_stack_v2_python_sparse | myTrip/like/views.py | Lv-246Python/myTrip | train | 0 |
f2574cdff829c35b966d5a960426aaf591d565ff | [
"if files is None:\n files = ['meta.yaml', 'build.sh']\nchanged = set()\nfor path in self.list_changed_files(ref, other):\n if not path.startswith(self.recipes_folder):\n continue\n for fname in files:\n if os.path.basename(path) == fname:\n changed.add(os.path.dirname(path))\nretu... | <|body_start_0|>
if files is None:
files = ['meta.yaml', 'build.sh']
changed = set()
for path in self.list_changed_files(ref, other):
if not path.startswith(self.recipes_folder):
continue
for fname in files:
if os.path.basename(... | Githandler with logic specific to Bioconda Repo | BiocondaRepoMixin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BiocondaRepoMixin:
"""Githandler with logic specific to Bioconda Repo"""
def get_changed_recipes(self, ref=None, other=None, files=None):
"""Returns list of modified recipes Args: ref: See `get_merge_base`. Defaults to HEAD other: See `get_merge_base`. Defaults to origin/master files... | stack_v2_sparse_classes_36k_train_002860 | 25,216 | permissive | [
{
"docstring": "Returns list of modified recipes Args: ref: See `get_merge_base`. Defaults to HEAD other: See `get_merge_base`. Defaults to origin/master files: List of files to consider. Defaults to ``meta.yaml`` and ``build.sh`` Result: List of unique recipe folders with changes. Path is from repo root (e.g. ... | 4 | stack_v2_sparse_classes_30k_train_014324 | Implement the Python class `BiocondaRepoMixin` described below.
Class description:
Githandler with logic specific to Bioconda Repo
Method signatures and docstrings:
- def get_changed_recipes(self, ref=None, other=None, files=None): Returns list of modified recipes Args: ref: See `get_merge_base`. Defaults to HEAD oth... | Implement the Python class `BiocondaRepoMixin` described below.
Class description:
Githandler with logic specific to Bioconda Repo
Method signatures and docstrings:
- def get_changed_recipes(self, ref=None, other=None, files=None): Returns list of modified recipes Args: ref: See `get_merge_base`. Defaults to HEAD oth... | 9a85115ae306f58c8b4e65e5f92f6cbdb5b68f04 | <|skeleton|>
class BiocondaRepoMixin:
"""Githandler with logic specific to Bioconda Repo"""
def get_changed_recipes(self, ref=None, other=None, files=None):
"""Returns list of modified recipes Args: ref: See `get_merge_base`. Defaults to HEAD other: See `get_merge_base`. Defaults to origin/master files... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BiocondaRepoMixin:
"""Githandler with logic specific to Bioconda Repo"""
def get_changed_recipes(self, ref=None, other=None, files=None):
"""Returns list of modified recipes Args: ref: See `get_merge_base`. Defaults to HEAD other: See `get_merge_base`. Defaults to origin/master files: List of fil... | the_stack_v2_python_sparse | bioconda_utils/githandler.py | bioconda/bioconda-utils | train | 106 |
82a6f75f39a075c2939f394af03a9c02140ff45c | [
"self.results = results\nself.logger = logger\nself.push_vals = dict()\nself.generate_response()\nself.push_results()",
"body = {'project_name': 'cirv', 'scenario': 'none', 'start_date': START_TIME, 'stop_date': STOP_TIME, 'case_name': TC_NAME, 'pod_name': POD_NAME, 'installer': INSTALLER, 'version': VERSION, 'bu... | <|body_start_0|>
self.results = results
self.logger = logger
self.push_vals = dict()
self.generate_response()
self.push_results()
<|end_body_0|>
<|body_start_1|>
body = {'project_name': 'cirv', 'scenario': 'none', 'start_date': START_TIME, 'stop_date': STOP_TIME, 'case_n... | Push results to opnfv test api | PushResults | [
"Apache-2.0",
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PushResults:
"""Push results to opnfv test api"""
def __init__(self, results, logger):
"""constructor"""
<|body_0|>
def generate_response(self):
"""generate json output to be pushed"""
<|body_1|>
def push_results(self):
"""push results to tes... | stack_v2_sparse_classes_36k_train_002861 | 1,867 | permissive | [
{
"docstring": "constructor",
"name": "__init__",
"signature": "def __init__(self, results, logger)"
},
{
"docstring": "generate json output to be pushed",
"name": "generate_response",
"signature": "def generate_response(self)"
},
{
"docstring": "push results to testapi",
"na... | 3 | stack_v2_sparse_classes_30k_train_001510 | Implement the Python class `PushResults` described below.
Class description:
Push results to opnfv test api
Method signatures and docstrings:
- def __init__(self, results, logger): constructor
- def generate_response(self): generate json output to be pushed
- def push_results(self): push results to testapi | Implement the Python class `PushResults` described below.
Class description:
Push results to opnfv test api
Method signatures and docstrings:
- def __init__(self, results, logger): constructor
- def generate_response(self): generate json output to be pushed
- def push_results(self): push results to testapi
<|skeleto... | 2d145d4f1fd231def2c9d52a71267031b938c0ac | <|skeleton|>
class PushResults:
"""Push results to opnfv test api"""
def __init__(self, results, logger):
"""constructor"""
<|body_0|>
def generate_response(self):
"""generate json output to be pushed"""
<|body_1|>
def push_results(self):
"""push results to tes... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PushResults:
"""Push results to opnfv test api"""
def __init__(self, results, logger):
"""constructor"""
self.results = results
self.logger = logger
self.push_vals = dict()
self.generate_response()
self.push_results()
def generate_response(self):
... | the_stack_v2_python_sparse | hdv/redfish/test_api.py | opnfv/cirv-hdv | train | 0 |
69257baa6ec94cc909e964e9fdcc2439051c77d1 | [
"query = self.__CYPHER_CREATE_INDEX.format(label=label, property_name=property_name)\ntry:\n result = self.graph.evaluate(query)\n return result\nexcept Exception:\n traceback.print_exc()\n print('create index fail for %s' % query)\n return None",
"query = self.__CYPHER_DROP_INDEX.format(label=labe... | <|body_start_0|>
query = self.__CYPHER_CREATE_INDEX.format(label=label, property_name=property_name)
try:
result = self.graph.evaluate(query)
return result
except Exception:
traceback.print_exc()
print('create index fail for %s' % query)
... | IndexGraphAccessor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IndexGraphAccessor:
def create_index(self, label, property_name):
"""create an index in one specific property with one label :param label: the label name to create index with :param property_name: the property name to index with :return:"""
<|body_0|>
def drop_index(self, la... | stack_v2_sparse_classes_36k_train_002862 | 1,435 | no_license | [
{
"docstring": "create an index in one specific property with one label :param label: the label name to create index with :param property_name: the property name to index with :return:",
"name": "create_index",
"signature": "def create_index(self, label, property_name)"
},
{
"docstring": "drop a... | 2 | null | Implement the Python class `IndexGraphAccessor` described below.
Class description:
Implement the IndexGraphAccessor class.
Method signatures and docstrings:
- def create_index(self, label, property_name): create an index in one specific property with one label :param label: the label name to create index with :param... | Implement the Python class `IndexGraphAccessor` described below.
Class description:
Implement the IndexGraphAccessor class.
Method signatures and docstrings:
- def create_index(self, label, property_name): create an index in one specific property with one label :param label: the label name to create index with :param... | a9401c0603ba675c522078e0ec02a6439e0d6af8 | <|skeleton|>
class IndexGraphAccessor:
def create_index(self, label, property_name):
"""create an index in one specific property with one label :param label: the label name to create index with :param property_name: the property name to index with :return:"""
<|body_0|>
def drop_index(self, la... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IndexGraphAccessor:
def create_index(self, label, property_name):
"""create an index in one specific property with one label :param label: the label name to create index with :param property_name: the property name to index with :return:"""
query = self.__CYPHER_CREATE_INDEX.format(label=label... | the_stack_v2_python_sparse | venv/Lib/site-packages/sekg/graph/index_accessor.py | bopopescu/APITutorialSearch | train | 0 | |
62a06265a899f1d422031d38480e05ed3b650020 | [
"item_id = self.data.grant_item_id or -1\nquery = Query(Item.collection, service_id=self._client.service_id)\nquery.add_term(field=Item.id_field, value=item_id)\nreturn InstanceProxy(Item, query, self._client)",
"query = Query(SkillLine.collection, service_id=self._client.service_id)\nquery.add_term(field=SkillLi... | <|body_start_0|>
item_id = self.data.grant_item_id or -1
query = Query(Item.collection, service_id=self._client.service_id)
query.add_term(field=Item.id_field, value=item_id)
return InstanceProxy(Item, query, self._client)
<|end_body_0|>
<|body_start_1|>
query = Query(SkillLine.... | A skill or certification unlockable by a character. .. attribute:: id :type: int The unique ID of this skill. In the API payload, this field is called ``skill_id``. .. attribute:: name :type: auraxium.types.LocaleData Localised name of the skill. .. attribute:: skill_line_id :type: int The ID of the associated :class:`... | Skill | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Skill:
"""A skill or certification unlockable by a character. .. attribute:: id :type: int The unique ID of this skill. In the API payload, this field is called ``skill_id``. .. attribute:: name :type: auraxium.types.LocaleData Localised name of the skill. .. attribute:: skill_line_id :type: int ... | stack_v2_sparse_classes_36k_train_002863 | 11,338 | permissive | [
{
"docstring": "Return the item unlocked by this skill. This returns an :class:`auraxium.InstanceProxy`.",
"name": "grant_item",
"signature": "def grant_item(self) -> InstanceProxy[Item]"
},
{
"docstring": "Return the skill line containing this skill. This returns an :class:`auraxium.InstancePro... | 2 | null | Implement the Python class `Skill` described below.
Class description:
A skill or certification unlockable by a character. .. attribute:: id :type: int The unique ID of this skill. In the API payload, this field is called ``skill_id``. .. attribute:: name :type: auraxium.types.LocaleData Localised name of the skill. .... | Implement the Python class `Skill` described below.
Class description:
A skill or certification unlockable by a character. .. attribute:: id :type: int The unique ID of this skill. In the API payload, this field is called ``skill_id``. .. attribute:: name :type: auraxium.types.LocaleData Localised name of the skill. .... | 23dcf927a199c8d7c917d89fe96b470a34cf4bba | <|skeleton|>
class Skill:
"""A skill or certification unlockable by a character. .. attribute:: id :type: int The unique ID of this skill. In the API payload, this field is called ``skill_id``. .. attribute:: name :type: auraxium.types.LocaleData Localised name of the skill. .. attribute:: skill_line_id :type: int ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Skill:
"""A skill or certification unlockable by a character. .. attribute:: id :type: int The unique ID of this skill. In the API payload, this field is called ``skill_id``. .. attribute:: name :type: auraxium.types.LocaleData Localised name of the skill. .. attribute:: skill_line_id :type: int The ID of the... | the_stack_v2_python_sparse | auraxium/ps2/_skill.py | leonhard-s/auraxium | train | 29 |
2c2ed6b3ecf3f7c5520dbffc7630954c2b37d7f4 | [
"if self.evidence_type == 'Publication' and self.paper == None:\n raise ValidationError('Enter a paper for evidence from a publication')\n'This validates that evidence with an experiment has a experiment.'\nif self.evidence_type == 'Experiment' and self.experiment == None:\n raise ValidationError('Select an e... | <|body_start_0|>
if self.evidence_type == 'Publication' and self.paper == None:
raise ValidationError('Enter a paper for evidence from a publication')
'This validates that evidence with an experiment has a experiment.'
if self.evidence_type == 'Experiment' and self.experiment == None... | Evidence instances are supporting or dissenting experiments, papers or communications regarding a hypothesis. The required fields for a piece of evidence are the evidence_type, the citation_type and whether it is public (which is set to False as a default). There are optional fields for paper or contact. The clean meth... | Evidence | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Evidence:
"""Evidence instances are supporting or dissenting experiments, papers or communications regarding a hypothesis. The required fields for a piece of evidence are the evidence_type, the citation_type and whether it is public (which is set to False as a default). There are optional fields ... | stack_v2_sparse_classes_36k_train_002864 | 19,270 | no_license | [
{
"docstring": "This validates that evidence with a paper has a reference.",
"name": "clean",
"signature": "def clean(self)"
},
{
"docstring": "The unicode representation of a context is its evidence_type and its experiment.",
"name": "__unicode__",
"signature": "def __unicode__(self)"
... | 3 | null | Implement the Python class `Evidence` described below.
Class description:
Evidence instances are supporting or dissenting experiments, papers or communications regarding a hypothesis. The required fields for a piece of evidence are the evidence_type, the citation_type and whether it is public (which is set to False as... | Implement the Python class `Evidence` described below.
Class description:
Evidence instances are supporting or dissenting experiments, papers or communications regarding a hypothesis. The required fields for a piece of evidence are the evidence_type, the citation_type and whether it is public (which is set to False as... | e2718e8def826c2927e258d01763040290077f16 | <|skeleton|>
class Evidence:
"""Evidence instances are supporting or dissenting experiments, papers or communications regarding a hypothesis. The required fields for a piece of evidence are the evidence_type, the citation_type and whether it is public (which is set to False as a default). There are optional fields ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Evidence:
"""Evidence instances are supporting or dissenting experiments, papers or communications regarding a hypothesis. The required fields for a piece of evidence are the evidence_type, the citation_type and whether it is public (which is set to False as a default). There are optional fields for paper or ... | the_stack_v2_python_sparse | hypotheses/models.py | BridgesLab/ExperimentDB | train | 0 |
44ede86acf9a53b15995d2ab334bdd3ac589bf30 | [
"if not root:\n return ''\nqueue = deque([root])\nres = []\nwhile queue:\n node = queue.popleft()\n if node != SEPERATOR:\n res.append(str(node.val))\n for child in node.children:\n queue.append(child)\n queue.append(SEPERATOR)\n else:\n res.append(SEPERATOR)\nretu... | <|body_start_0|>
if not root:
return ''
queue = deque([root])
res = []
while queue:
node = queue.popleft()
if node != SEPERATOR:
res.append(str(node.val))
for child in node.children:
queue.append(chil... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root: 'Node') -> str:
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
<|body_0|>
def deserialize(self, data: str) -> 'Node':
"""Decodes your encoded data to tree. :type data: str :rtype: Node"""
<|body_1|>
<|e... | stack_v2_sparse_classes_36k_train_002865 | 1,652 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: Node :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root: 'Node') -> str"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: Node",
"name": "deserialize",
"signature": "def des... | 2 | stack_v2_sparse_classes_30k_train_016400 | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: 'Node') -> str: Encodes a tree to a single string. :type root: Node :rtype: str
- def deserialize(self, data: str) -> 'Node': Decodes your encoded data to tre... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: 'Node') -> str: Encodes a tree to a single string. :type root: Node :rtype: str
- def deserialize(self, data: str) -> 'Node': Decodes your encoded data to tre... | fdb6bcb4c721e03e853890dd89122f2c4196a1ea | <|skeleton|>
class Codec:
def serialize(self, root: 'Node') -> str:
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
<|body_0|>
def deserialize(self, data: str) -> 'Node':
"""Decodes your encoded data to tree. :type data: str :rtype: Node"""
<|body_1|>
<|e... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root: 'Node') -> str:
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
if not root:
return ''
queue = deque([root])
res = []
while queue:
node = queue.popleft()
if node != SEPERATOR:
... | the_stack_v2_python_sparse | python/tree/SerializeAndDeserializeNaryTree.py | XifeiNi/LeetCode-Traversal | train | 2 | |
359b15ff803de97b0aeb235956aee0ab54090d39 | [
"self.bond_readout = bond_readout\nself.atom_readout = atom_readout\nself.include_states = include_states\nself.merge = merge or tf.keras.layers.Concatenate(axis=-1)\nsuper().__init__(**kwargs)",
"features = []\nif self.bond_readout is not None:\n features.append(self.bond_readout(graph))\nif self.atom_readout... | <|body_start_0|>
self.bond_readout = bond_readout
self.atom_readout = atom_readout
self.include_states = include_states
self.merge = merge or tf.keras.layers.Concatenate(axis=-1)
super().__init__(**kwargs)
<|end_body_0|>
<|body_start_1|>
features = []
if self.bon... | Read both bond and atom | MultiFieldReadout | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiFieldReadout:
"""Read both bond and atom"""
def __init__(self, bond_readout: Optional[ReadOut]=None, atom_readout: Optional[ReadOut]=None, include_states: bool=True, merge: Optional[tf.keras.layers.Layer]=None, **kwargs):
"""Args: bond_readout (ReadOut): the bond readout instanc... | stack_v2_sparse_classes_36k_train_002866 | 8,087 | permissive | [
{
"docstring": "Args: bond_readout (ReadOut): the bond readout instance atom_readout (ReadOut: the atom readout instance include_states (bool): whether to include states merge (tf.keras.layers.Layer): method to merge different readout **kwargs:",
"name": "__init__",
"signature": "def __init__(self, bond... | 3 | stack_v2_sparse_classes_30k_train_018190 | Implement the Python class `MultiFieldReadout` described below.
Class description:
Read both bond and atom
Method signatures and docstrings:
- def __init__(self, bond_readout: Optional[ReadOut]=None, atom_readout: Optional[ReadOut]=None, include_states: bool=True, merge: Optional[tf.keras.layers.Layer]=None, **kwargs... | Implement the Python class `MultiFieldReadout` described below.
Class description:
Read both bond and atom
Method signatures and docstrings:
- def __init__(self, bond_readout: Optional[ReadOut]=None, atom_readout: Optional[ReadOut]=None, include_states: bool=True, merge: Optional[tf.keras.layers.Layer]=None, **kwargs... | 1f89ecb564b2691c810cd106c3476b15a8699bb7 | <|skeleton|>
class MultiFieldReadout:
"""Read both bond and atom"""
def __init__(self, bond_readout: Optional[ReadOut]=None, atom_readout: Optional[ReadOut]=None, include_states: bool=True, merge: Optional[tf.keras.layers.Layer]=None, **kwargs):
"""Args: bond_readout (ReadOut): the bond readout instanc... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MultiFieldReadout:
"""Read both bond and atom"""
def __init__(self, bond_readout: Optional[ReadOut]=None, atom_readout: Optional[ReadOut]=None, include_states: bool=True, merge: Optional[tf.keras.layers.Layer]=None, **kwargs):
"""Args: bond_readout (ReadOut): the bond readout instance atom_readou... | the_stack_v2_python_sparse | m3gnet/layers/_readout.py | materialsvirtuallab/m3gnet | train | 175 |
37ec1f1c7ace71e9e7e1b4c4c729243443feb238 | [
"if not root:\n return 0\nqueue = [[root, 0]]\ndepth = 1\nwhile len(queue) > 0:\n current_item = queue.pop(0)\n current_node = current_item[0]\n current_node_level = current_item[1]\n if current_node.left or current_node.right:\n if current_node.left:\n queue.append([current_node.le... | <|body_start_0|>
if not root:
return 0
queue = [[root, 0]]
depth = 1
while len(queue) > 0:
current_item = queue.pop(0)
current_node = current_item[0]
current_node_level = current_item[1]
if current_node.left or current_node.righ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxDepth(self, root):
"""给定一个二叉树,找出其最大深度。 二叉树的深度为根节点到最远叶子节点的最长路径上的节点数。 :type root: TreeNode :rtype: int"""
<|body_0|>
def maxDepth2(self, root):
"""更优解法,使用递归,因为当前root节点的深度=max(左子树的深度, 右子树) + 1 :param root: :return:"""
<|body_1|>
<|end_skeleton|... | stack_v2_sparse_classes_36k_train_002867 | 1,327 | no_license | [
{
"docstring": "给定一个二叉树,找出其最大深度。 二叉树的深度为根节点到最远叶子节点的最长路径上的节点数。 :type root: TreeNode :rtype: int",
"name": "maxDepth",
"signature": "def maxDepth(self, root)"
},
{
"docstring": "更优解法,使用递归,因为当前root节点的深度=max(左子树的深度, 右子树) + 1 :param root: :return:",
"name": "maxDepth2",
"signature": "def maxD... | 2 | stack_v2_sparse_classes_30k_train_010949 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxDepth(self, root): 给定一个二叉树,找出其最大深度。 二叉树的深度为根节点到最远叶子节点的最长路径上的节点数。 :type root: TreeNode :rtype: int
- def maxDepth2(self, root): 更优解法,使用递归,因为当前root节点的深度=max(左子树的深度, 右子树) + 1... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxDepth(self, root): 给定一个二叉树,找出其最大深度。 二叉树的深度为根节点到最远叶子节点的最长路径上的节点数。 :type root: TreeNode :rtype: int
- def maxDepth2(self, root): 更优解法,使用递归,因为当前root节点的深度=max(左子树的深度, 右子树) + 1... | 97cc61fefe0bedf5161687aab92fb09b0df990e2 | <|skeleton|>
class Solution:
def maxDepth(self, root):
"""给定一个二叉树,找出其最大深度。 二叉树的深度为根节点到最远叶子节点的最长路径上的节点数。 :type root: TreeNode :rtype: int"""
<|body_0|>
def maxDepth2(self, root):
"""更优解法,使用递归,因为当前root节点的深度=max(左子树的深度, 右子树) + 1 :param root: :return:"""
<|body_1|>
<|end_skeleton|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxDepth(self, root):
"""给定一个二叉树,找出其最大深度。 二叉树的深度为根节点到最远叶子节点的最长路径上的节点数。 :type root: TreeNode :rtype: int"""
if not root:
return 0
queue = [[root, 0]]
depth = 1
while len(queue) > 0:
current_item = queue.pop(0)
current_nod... | the_stack_v2_python_sparse | code/tree/max_depth.py | JiaXingBinggan/For_work | train | 0 | |
7b982aa2d89c4863922a845486d87a8dd74a0055 | [
"res_list = []\nif root is None:\n return res_list\nres_list.append(root.val)\nres_left_list = self.preorderTraversal(root.left)\nres_list = res_list + res_left_list\nres_right_list = self.preorderTraversal(root.right)\nres_list = res_list + res_right_list\nreturn res_list",
"res_list = []\nif root is None:\n ... | <|body_start_0|>
res_list = []
if root is None:
return res_list
res_list.append(root.val)
res_left_list = self.preorderTraversal(root.left)
res_list = res_list + res_left_list
res_right_list = self.preorderTraversal(root.right)
res_list = res_list + re... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def preorderTraversal(self, root):
"""递归 :type root: TreeNode :rtype: List[int]"""
<|body_0|>
def preorderTraversal2(self, root):
"""迭代,利用队列 :type root: TreeNode :rtype: List[int]"""
<|body_1|>
def preorderTraversal3(self, root):
"""迭代,... | stack_v2_sparse_classes_36k_train_002868 | 2,391 | no_license | [
{
"docstring": "递归 :type root: TreeNode :rtype: List[int]",
"name": "preorderTraversal",
"signature": "def preorderTraversal(self, root)"
},
{
"docstring": "迭代,利用队列 :type root: TreeNode :rtype: List[int]",
"name": "preorderTraversal2",
"signature": "def preorderTraversal2(self, root)"
... | 3 | stack_v2_sparse_classes_30k_train_013318 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def preorderTraversal(self, root): 递归 :type root: TreeNode :rtype: List[int]
- def preorderTraversal2(self, root): 迭代,利用队列 :type root: TreeNode :rtype: List[int]
- def preorderTr... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def preorderTraversal(self, root): 递归 :type root: TreeNode :rtype: List[int]
- def preorderTraversal2(self, root): 迭代,利用队列 :type root: TreeNode :rtype: List[int]
- def preorderTr... | f564806bd8e18831eeb20f2fd4bdd2d4aaa829ce | <|skeleton|>
class Solution:
def preorderTraversal(self, root):
"""递归 :type root: TreeNode :rtype: List[int]"""
<|body_0|>
def preorderTraversal2(self, root):
"""迭代,利用队列 :type root: TreeNode :rtype: List[int]"""
<|body_1|>
def preorderTraversal3(self, root):
"""迭代,... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def preorderTraversal(self, root):
"""递归 :type root: TreeNode :rtype: List[int]"""
res_list = []
if root is None:
return res_list
res_list.append(root.val)
res_left_list = self.preorderTraversal(root.left)
res_list = res_list + res_left_lis... | the_stack_v2_python_sparse | Week 02/id_684/LeetCode_144_684.py | cboopen/algorithm004-04 | train | 2 | |
7bc28d0684a3ef5b67bc15ab54e18df9a8d5f4a6 | [
"old_prefix = 'unix://'\nnew_prefix = 'http+unix://'\nif old_uri.startswith(old_prefix):\n stripped_uri = old_uri[len(old_prefix):]\n if stripped_uri.endswith('/'):\n stripped_uri = stripped_uri[:-1]\n new_uri = new_prefix + urllib.parse.quote(stripped_uri, safe='')\nelse:\n new_uri = old_uri\nif... | <|body_start_0|>
old_prefix = 'unix://'
new_prefix = 'http+unix://'
if old_uri.startswith(old_prefix):
stripped_uri = old_uri[len(old_prefix):]
if stripped_uri.endswith('/'):
stripped_uri = stripped_uri[:-1]
new_uri = new_prefix + urllib.parse.... | Constructor for instantiating a iot hsm object. This is an object that communicates with the Azure IoT Edge HSM in order to get connection credentials for an Azure IoT Edge module. The credentials that this object return come in two forms: 1. The trust bundle, which is a certificate that can be used as a trusted cert t... | IotEdgeHsm | [
"MIT",
"LicenseRef-scancode-generic-cla"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IotEdgeHsm:
"""Constructor for instantiating a iot hsm object. This is an object that communicates with the Azure IoT Edge HSM in order to get connection credentials for an Azure IoT Edge module. The credentials that this object return come in two forms: 1. The trust bundle, which is a certificat... | stack_v2_sparse_classes_36k_train_002869 | 4,693 | permissive | [
{
"docstring": "This function takes a socket URI in one form and converts it into another form. The source form is based on what we receive inside the IOTEDGE_WORKLOADURI environment variable, and it looks like this: \"unix:///var/run/iotedge/workload.sock\" The destination form is based on what the requests_un... | 4 | stack_v2_sparse_classes_30k_train_020935 | Implement the Python class `IotEdgeHsm` described below.
Class description:
Constructor for instantiating a iot hsm object. This is an object that communicates with the Azure IoT Edge HSM in order to get connection credentials for an Azure IoT Edge module. The credentials that this object return come in two forms: 1. ... | Implement the Python class `IotEdgeHsm` described below.
Class description:
Constructor for instantiating a iot hsm object. This is an object that communicates with the Azure IoT Edge HSM in order to get connection credentials for an Azure IoT Edge module. The credentials that this object return come in two forms: 1. ... | f51733e9d3424c33ed86d51e214b20c843716763 | <|skeleton|>
class IotEdgeHsm:
"""Constructor for instantiating a iot hsm object. This is an object that communicates with the Azure IoT Edge HSM in order to get connection credentials for an Azure IoT Edge module. The credentials that this object return come in two forms: 1. The trust bundle, which is a certificat... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IotEdgeHsm:
"""Constructor for instantiating a iot hsm object. This is an object that communicates with the Azure IoT Edge HSM in order to get connection credentials for an Azure IoT Edge module. The credentials that this object return come in two forms: 1. The trust bundle, which is a certificate that can be... | the_stack_v2_python_sparse | azure-iot-hub-devicesdk/azure/iot/hub/devicesdk/auth/iotedge_hsm.py | noopkat/azure-iot-sdk-python-preview | train | 6 |
e17fdc0ec56dcb586588f3a61ced43e06225dfb8 | [
"if not strs:\n return ''\nmin_str = min(strs)\nmax_str = max(strs)\nfor index, letter in enumerate(min_str):\n if letter != max_str[index]:\n return min_str[:index]\nreturn min_str",
"if not strs:\n return ''\nmin_len_str = min(strs, key=len)\nleft, right = (0, len(min_len_str))\nwhile left <= ri... | <|body_start_0|>
if not strs:
return ''
min_str = min(strs)
max_str = max(strs)
for index, letter in enumerate(min_str):
if letter != max_str[index]:
return min_str[:index]
return min_str
<|end_body_0|>
<|body_start_1|>
if not strs... | Prefix | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Prefix:
def get_longest_common(self, strs: List[str]) -> str:
"""Approach: Min and Max Time Complexity: O(N) Space Complexity: O(1) :param strs: :return:"""
<|body_0|>
def get_longest_common_(self, strs: List[str]) -> str:
"""Approach: Binary Search Time Complexity: ... | stack_v2_sparse_classes_36k_train_002870 | 1,937 | no_license | [
{
"docstring": "Approach: Min and Max Time Complexity: O(N) Space Complexity: O(1) :param strs: :return:",
"name": "get_longest_common",
"signature": "def get_longest_common(self, strs: List[str]) -> str"
},
{
"docstring": "Approach: Binary Search Time Complexity: O(S log m) Space Complexity: O(... | 2 | null | Implement the Python class `Prefix` described below.
Class description:
Implement the Prefix class.
Method signatures and docstrings:
- def get_longest_common(self, strs: List[str]) -> str: Approach: Min and Max Time Complexity: O(N) Space Complexity: O(1) :param strs: :return:
- def get_longest_common_(self, strs: L... | Implement the Python class `Prefix` described below.
Class description:
Implement the Prefix class.
Method signatures and docstrings:
- def get_longest_common(self, strs: List[str]) -> str: Approach: Min and Max Time Complexity: O(N) Space Complexity: O(1) :param strs: :return:
- def get_longest_common_(self, strs: L... | 65cc78b5afa0db064f9fe8f06597e3e120f7363d | <|skeleton|>
class Prefix:
def get_longest_common(self, strs: List[str]) -> str:
"""Approach: Min and Max Time Complexity: O(N) Space Complexity: O(1) :param strs: :return:"""
<|body_0|>
def get_longest_common_(self, strs: List[str]) -> str:
"""Approach: Binary Search Time Complexity: ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Prefix:
def get_longest_common(self, strs: List[str]) -> str:
"""Approach: Min and Max Time Complexity: O(N) Space Complexity: O(1) :param strs: :return:"""
if not strs:
return ''
min_str = min(strs)
max_str = max(strs)
for index, letter in enumerate(min_str... | the_stack_v2_python_sparse | revisited/math_and_strings/strings/longest_common_prefix.py | Shiv2157k/leet_code | train | 1 | |
29e32bb79ac5d3fbb0fb25efc09feffc0c48a8ce | [
"for att in self.browse(cr, uid, ids, context=context):\n if att.action == 'action' or att.action == 'sign_in' or att.action == 'sign_out':\n return True\n else:\n return super(HrAttendance, self)._altern_si_so(cr, uid, ids, context)",
"local = pytz.timezone(self._context['tz'])\ndate_from = d... | <|body_start_0|>
for att in self.browse(cr, uid, ids, context=context):
if att.action == 'action' or att.action == 'sign_in' or att.action == 'sign_out':
return True
else:
return super(HrAttendance, self)._altern_si_so(cr, uid, ids, context)
<|end_body_0|>... | HrAttendance | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HrAttendance:
def _altern_si_so(self, cr, uid, ids, context=None):
"""Implementing this logic must be in old api. Using new api will not overide inheritance method"""
<|body_0|>
def get_attendance(self, employee, att_date, action='sign_in'):
"""Return attendance reco... | stack_v2_sparse_classes_36k_train_002871 | 3,236 | no_license | [
{
"docstring": "Implementing this logic must be in old api. Using new api will not overide inheritance method",
"name": "_altern_si_so",
"signature": "def _altern_si_so(self, cr, uid, ids, context=None)"
},
{
"docstring": "Return attendance record based on action Args: employee: employee att_dat... | 2 | stack_v2_sparse_classes_30k_train_006093 | Implement the Python class `HrAttendance` described below.
Class description:
Implement the HrAttendance class.
Method signatures and docstrings:
- def _altern_si_so(self, cr, uid, ids, context=None): Implementing this logic must be in old api. Using new api will not overide inheritance method
- def get_attendance(se... | Implement the Python class `HrAttendance` described below.
Class description:
Implement the HrAttendance class.
Method signatures and docstrings:
- def _altern_si_so(self, cr, uid, ids, context=None): Implementing this logic must be in old api. Using new api will not overide inheritance method
- def get_attendance(se... | 2e40d5f3260b3cdd7d64fd98bcf14d8d5ec6edd1 | <|skeleton|>
class HrAttendance:
def _altern_si_so(self, cr, uid, ids, context=None):
"""Implementing this logic must be in old api. Using new api will not overide inheritance method"""
<|body_0|>
def get_attendance(self, employee, att_date, action='sign_in'):
"""Return attendance reco... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HrAttendance:
def _altern_si_so(self, cr, uid, ids, context=None):
"""Implementing this logic must be in old api. Using new api will not overide inheritance method"""
for att in self.browse(cr, uid, ids, context=context):
if att.action == 'action' or att.action == 'sign_in' or att.... | the_stack_v2_python_sparse | hr_fingerprint_ams/models/inherited_hr_attendance.py | rkhalil1990/hr_indonesia_odoo | train | 0 | |
e1e04b0521fbfa40d4fe5c1d49e2575dca0c59e3 | [
"goal_as_string = _theorem_to_string(goal)\nif goal_as_string in self.nodes_map:\n node = self.nodes[self.nodes_map[goal_as_string]]\n assert len(node.goal.hypotheses) == len(goal.hypotheses)\n for i, hyp in enumerate(goal.hypotheses):\n assert hyp == node.goal.hypotheses[i]\n assert goal.conclus... | <|body_start_0|>
goal_as_string = _theorem_to_string(goal)
if goal_as_string in self.nodes_map:
node = self.nodes[self.nodes_map[goal_as_string]]
assert len(node.goal.hypotheses) == len(goal.hypotheses)
for i, hyp in enumerate(goal.hypotheses):
assert ... | Container object to represent the whole search tree. This object maintains: - A list of nodes, where the first node corresponds to the root goal. (Which should be in the theorem database now, for premise selection purposes). - A map of theorems to nodes in order to allow subgoal-sharing. It is unclear if this ever happ... | ProofSearchTree | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProofSearchTree:
"""Container object to represent the whole search tree. This object maintains: - A list of nodes, where the first node corresponds to the root goal. (Which should be in the theorem database now, for premise selection purposes). - A map of theorems to nodes in order to allow subgo... | stack_v2_sparse_classes_36k_train_002872 | 25,964 | permissive | [
{
"docstring": "Append a new node to the tree.",
"name": "add_node",
"signature": "def add_node(self, goal: proof_assistant_pb2.Theorem, parent: Optional[SubGoalRef])"
},
{
"docstring": "Constructor for a proof search tree. Args: proof_assistant_obj: An interface to the proof assistant. goal: Th... | 3 | null | Implement the Python class `ProofSearchTree` described below.
Class description:
Container object to represent the whole search tree. This object maintains: - A list of nodes, where the first node corresponds to the root goal. (Which should be in the theorem database now, for premise selection purposes). - A map of th... | Implement the Python class `ProofSearchTree` described below.
Class description:
Container object to represent the whole search tree. This object maintains: - A list of nodes, where the first node corresponds to the root goal. (Which should be in the theorem database now, for premise selection purposes). - A map of th... | c526cc957be0f6067ef9de1ea18f3e8bbc3be0e8 | <|skeleton|>
class ProofSearchTree:
"""Container object to represent the whole search tree. This object maintains: - A list of nodes, where the first node corresponds to the root goal. (Which should be in the theorem database now, for premise selection purposes). - A map of theorems to nodes in order to allow subgo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProofSearchTree:
"""Container object to represent the whole search tree. This object maintains: - A list of nodes, where the first node corresponds to the root goal. (Which should be in the theorem database now, for premise selection purposes). - A map of theorems to nodes in order to allow subgoal-sharing. I... | the_stack_v2_python_sparse | deepmath/deephol/proof_search_tree.py | magualas/deepmath | train | 1 |
d565910d68cffc62b4548fa3136756275666f185 | [
"self.max_document_length = max_document_length\nself.min_frequency = min_frequency\nself.vocabulary = {'__PADDING__': 0, '__UNK__': 1}\nself.reverse_vocab = {0: '__PADDING__', 1: '__UNK__'}\nself.length = 2\nself.tokenizer_fn = tokenizer_fn\nself.word_freq = {'__PADDING__': -1, '__UNK__': 0}",
"for line in strs:... | <|body_start_0|>
self.max_document_length = max_document_length
self.min_frequency = min_frequency
self.vocabulary = {'__PADDING__': 0, '__UNK__': 1}
self.reverse_vocab = {0: '__PADDING__', 1: '__UNK__'}
self.length = 2
self.tokenizer_fn = tokenizer_fn
self.word_f... | 词表处理器 | TFVocabProcessor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TFVocabProcessor:
"""词表处理器"""
def __init__(self, max_document_length, min_frequency=0, tokenizer_fn=None):
"""初始化 Args: max_document_length: 最长序列长度,不足长度自动padding min_frequency: 最小频次,小于等于该值词语抛弃,用UNK替代 tokenize_fn: 切分函数,输入是字符串,输出是list,yield方式返回"""
<|body_0|>
def _tokenizer... | stack_v2_sparse_classes_36k_train_002873 | 3,309 | permissive | [
{
"docstring": "初始化 Args: max_document_length: 最长序列长度,不足长度自动padding min_frequency: 最小频次,小于等于该值词语抛弃,用UNK替代 tokenize_fn: 切分函数,输入是字符串,输出是list,yield方式返回",
"name": "__init__",
"signature": "def __init__(self, max_document_length, min_frequency=0, tokenizer_fn=None)"
},
{
"docstring": "按空格切分,语料需要事先处理好... | 6 | stack_v2_sparse_classes_30k_train_012096 | Implement the Python class `TFVocabProcessor` described below.
Class description:
词表处理器
Method signatures and docstrings:
- def __init__(self, max_document_length, min_frequency=0, tokenizer_fn=None): 初始化 Args: max_document_length: 最长序列长度,不足长度自动padding min_frequency: 最小频次,小于等于该值词语抛弃,用UNK替代 tokenize_fn: 切分函数,输入是字符串,输出... | Implement the Python class `TFVocabProcessor` described below.
Class description:
词表处理器
Method signatures and docstrings:
- def __init__(self, max_document_length, min_frequency=0, tokenizer_fn=None): 初始化 Args: max_document_length: 最长序列长度,不足长度自动padding min_frequency: 最小频次,小于等于该值词语抛弃,用UNK替代 tokenize_fn: 切分函数,输入是字符串,输出... | c4423c2625c398f5a93c747f3516f378b31ece46 | <|skeleton|>
class TFVocabProcessor:
"""词表处理器"""
def __init__(self, max_document_length, min_frequency=0, tokenizer_fn=None):
"""初始化 Args: max_document_length: 最长序列长度,不足长度自动padding min_frequency: 最小频次,小于等于该值词语抛弃,用UNK替代 tokenize_fn: 切分函数,输入是字符串,输出是list,yield方式返回"""
<|body_0|>
def _tokenizer... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TFVocabProcessor:
"""词表处理器"""
def __init__(self, max_document_length, min_frequency=0, tokenizer_fn=None):
"""初始化 Args: max_document_length: 最长序列长度,不足长度自动padding min_frequency: 最小频次,小于等于该值词语抛弃,用UNK替代 tokenize_fn: 切分函数,输入是字符串,输出是list,yield方式返回"""
self.max_document_length = max_document_len... | the_stack_v2_python_sparse | utils/tf_vocab_processor.py | snowhws/deeplearning | train | 10 |
88b86f06eff3356c2bbaf533ee0de77ab424ad72 | [
"text = [_ for _ in self.request.POST.getlist('label_text') if _]\nquantities = [int(_) for _ in self.request.POST.getlist('quantity')]\nreturn self.parse_label_data(text, quantities)",
"data = []\nfor i, line in enumerate(text):\n label_text = line.split('\\r\\n')\n for _ in range(quantities[i]):\n ... | <|body_start_0|>
text = [_ for _ in self.request.POST.getlist('label_text') if _]
quantities = [int(_) for _ in self.request.POST.getlist('quantity')]
return self.parse_label_data(text, quantities)
<|end_body_0|>
<|body_start_1|>
data = []
for i, line in enumerate(text):
... | View for address label PDF creation. | SmallLabelPDF | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SmallLabelPDF:
"""View for address label PDF creation."""
def get_label_data(self, *args, **kwargs):
"""Return list containing lists of lines of text for each label."""
<|body_0|>
def parse_label_data(self, text, quantities):
"""Return the label text as a list of... | stack_v2_sparse_classes_36k_train_002874 | 10,560 | no_license | [
{
"docstring": "Return list containing lists of lines of text for each label.",
"name": "get_label_data",
"signature": "def get_label_data(self, *args, **kwargs)"
},
{
"docstring": "Return the label text as a list of lines.",
"name": "parse_label_data",
"signature": "def parse_label_data... | 2 | null | Implement the Python class `SmallLabelPDF` described below.
Class description:
View for address label PDF creation.
Method signatures and docstrings:
- def get_label_data(self, *args, **kwargs): Return list containing lists of lines of text for each label.
- def parse_label_data(self, text, quantities): Return the la... | Implement the Python class `SmallLabelPDF` described below.
Class description:
View for address label PDF creation.
Method signatures and docstrings:
- def get_label_data(self, *args, **kwargs): Return list containing lists of lines of text for each label.
- def parse_label_data(self, text, quantities): Return the la... | ba51d4e304b1aeb296fa2fe16611c892fcdbd471 | <|skeleton|>
class SmallLabelPDF:
"""View for address label PDF creation."""
def get_label_data(self, *args, **kwargs):
"""Return list containing lists of lines of text for each label."""
<|body_0|>
def parse_label_data(self, text, quantities):
"""Return the label text as a list of... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SmallLabelPDF:
"""View for address label PDF creation."""
def get_label_data(self, *args, **kwargs):
"""Return list containing lists of lines of text for each label."""
text = [_ for _ in self.request.POST.getlist('label_text') if _]
quantities = [int(_) for _ in self.request.POST... | the_stack_v2_python_sparse | labelmaker/views.py | stcstores/stcadmin | train | 0 |
76f32816b81a2645b48c5f143d13198f86ec11e7 | [
"if isinstance(value, (str, unicode)):\n try:\n value = int(value)\n except (ValueError, TypeError) as err:\n if value.lower() == 'true':\n value = True\n elif value.lower() == 'false':\n value = False\nif value:\n return 1\nelse:\n return 0",
"if value in (0... | <|body_start_0|>
if isinstance(value, (str, unicode)):
try:
value = int(value)
except (ValueError, TypeError) as err:
if value.lower() == 'true':
value = True
elif value.lower() == 'false':
value = Fa... | SFBool field/event type base-class | _SFBool | [
"GPL-1.0-or-later",
"MIT",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-other-copyleft",
"LGPL-2.1-or-later",
"GPL-3.0-only",
"LGPL-2.0-or-later",
"GPL-3.0-or-later"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _SFBool:
"""SFBool field/event type base-class"""
def coerce(self, value):
"""Coerce the given value to our type Allowable types: any object with true/false protocol"""
<|body_0|>
def check(self, value):
"""Check that the given value is of exactly expected type""... | stack_v2_sparse_classes_36k_train_002875 | 34,853 | permissive | [
{
"docstring": "Coerce the given value to our type Allowable types: any object with true/false protocol",
"name": "coerce",
"signature": "def coerce(self, value)"
},
{
"docstring": "Check that the given value is of exactly expected type",
"name": "check",
"signature": "def check(self, va... | 3 | stack_v2_sparse_classes_30k_train_005622 | Implement the Python class `_SFBool` described below.
Class description:
SFBool field/event type base-class
Method signatures and docstrings:
- def coerce(self, value): Coerce the given value to our type Allowable types: any object with true/false protocol
- def check(self, value): Check that the given value is of ex... | Implement the Python class `_SFBool` described below.
Class description:
SFBool field/event type base-class
Method signatures and docstrings:
- def coerce(self, value): Coerce the given value to our type Allowable types: any object with true/false protocol
- def check(self, value): Check that the given value is of ex... | 7f600ad153270feff12aa7aa86d7ed0a49ebc71c | <|skeleton|>
class _SFBool:
"""SFBool field/event type base-class"""
def coerce(self, value):
"""Coerce the given value to our type Allowable types: any object with true/false protocol"""
<|body_0|>
def check(self, value):
"""Check that the given value is of exactly expected type""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _SFBool:
"""SFBool field/event type base-class"""
def coerce(self, value):
"""Coerce the given value to our type Allowable types: any object with true/false protocol"""
if isinstance(value, (str, unicode)):
try:
value = int(value)
except (ValueError... | the_stack_v2_python_sparse | pythonAnimations/pyOpenGLChess/engineDirectory/oglc-env/lib/python2.7/site-packages/vrml/fieldtypes.py | alexus37/AugmentedRealityChess | train | 1 |
6aeabeb6179cb86fb2947996f1fbf77e9b453f8a | [
"super().__init__(embed_dim, hidden_dim, num_embeddings, num_max_positions, num_heads, num_layers, dropout, causal)\nself.adapters_1 = nn.ModuleList()\nself.adapters_2 = nn.ModuleList()\nfor _ in range(num_layers):\n self.adapters_1.append(nn.Sequential(nn.Linear(embed_dim, adapters_dim), nn.ReLU(), nn.Linear(ad... | <|body_start_0|>
super().__init__(embed_dim, hidden_dim, num_embeddings, num_max_positions, num_heads, num_layers, dropout, causal)
self.adapters_1 = nn.ModuleList()
self.adapters_2 = nn.ModuleList()
for _ in range(num_layers):
self.adapters_1.append(nn.Sequential(nn.Linear(e... | TransformerWithAdapters | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TransformerWithAdapters:
def __init__(self, adapters_dim, embed_dim, hidden_dim, num_embeddings, num_max_positions, num_heads, num_layers, dropout, causal):
"""Transformer with adapters (small bottleneck layers)"""
<|body_0|>
def forward(self, x, padding_mask=None):
... | stack_v2_sparse_classes_36k_train_002876 | 7,258 | no_license | [
{
"docstring": "Transformer with adapters (small bottleneck layers)",
"name": "__init__",
"signature": "def __init__(self, adapters_dim, embed_dim, hidden_dim, num_embeddings, num_max_positions, num_heads, num_layers, dropout, causal)"
},
{
"docstring": "x has shape [seq length, batch], padding_... | 2 | null | Implement the Python class `TransformerWithAdapters` described below.
Class description:
Implement the TransformerWithAdapters class.
Method signatures and docstrings:
- def __init__(self, adapters_dim, embed_dim, hidden_dim, num_embeddings, num_max_positions, num_heads, num_layers, dropout, causal): Transformer with... | Implement the Python class `TransformerWithAdapters` described below.
Class description:
Implement the TransformerWithAdapters class.
Method signatures and docstrings:
- def __init__(self, adapters_dim, embed_dim, hidden_dim, num_embeddings, num_max_positions, num_heads, num_layers, dropout, causal): Transformer with... | 7e55a422588c1d1e00f35a3d3a3ff896cce59e18 | <|skeleton|>
class TransformerWithAdapters:
def __init__(self, adapters_dim, embed_dim, hidden_dim, num_embeddings, num_max_positions, num_heads, num_layers, dropout, causal):
"""Transformer with adapters (small bottleneck layers)"""
<|body_0|>
def forward(self, x, padding_mask=None):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TransformerWithAdapters:
def __init__(self, adapters_dim, embed_dim, hidden_dim, num_embeddings, num_max_positions, num_heads, num_layers, dropout, causal):
"""Transformer with adapters (small bottleneck layers)"""
super().__init__(embed_dim, hidden_dim, num_embeddings, num_max_positions, num_... | the_stack_v2_python_sparse | generated/test_prrao87_fine_grained_sentiment.py | jansel/pytorch-jit-paritybench | train | 35 | |
513e4526011d00b9bec7d5d0a5f412a93d5fb920 | [
"email = self.cleaned_data.get('email')\nif not email:\n return email\nusers = User.objects.filter(email=email).exclude(id=self.instance.user.id)\nif len(users) > 0:\n raise forms.ValidationError(_('That e-mail is already used.'))\nelse:\n return email",
"display_name = self.cleaned_data.get('display_nam... | <|body_start_0|>
email = self.cleaned_data.get('email')
if not email:
return email
users = User.objects.filter(email=email).exclude(id=self.instance.user.id)
if len(users) > 0:
raise forms.ValidationError(_('That e-mail is already used.'))
else:
... | Profile Form. Composed by Profile, User and LocalizedProfile fields | ProfileForm | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProfileForm:
"""Profile Form. Composed by Profile, User and LocalizedProfile fields"""
def clean_email(self):
"""Verify that the email is unique for user"""
<|body_0|>
def clean_display_name(self):
"""Verify that the display name is unique for user"""
<|b... | stack_v2_sparse_classes_36k_train_002877 | 8,128 | no_license | [
{
"docstring": "Verify that the email is unique for user",
"name": "clean_email",
"signature": "def clean_email(self)"
},
{
"docstring": "Verify that the display name is unique for user",
"name": "clean_display_name",
"signature": "def clean_display_name(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_014990 | Implement the Python class `ProfileForm` described below.
Class description:
Profile Form. Composed by Profile, User and LocalizedProfile fields
Method signatures and docstrings:
- def clean_email(self): Verify that the email is unique for user
- def clean_display_name(self): Verify that the display name is unique fo... | Implement the Python class `ProfileForm` described below.
Class description:
Profile Form. Composed by Profile, User and LocalizedProfile fields
Method signatures and docstrings:
- def clean_email(self): Verify that the email is unique for user
- def clean_display_name(self): Verify that the display name is unique fo... | dd6a2ee5a4951b2397170d5086c000169bf91350 | <|skeleton|>
class ProfileForm:
"""Profile Form. Composed by Profile, User and LocalizedProfile fields"""
def clean_email(self):
"""Verify that the email is unique for user"""
<|body_0|>
def clean_display_name(self):
"""Verify that the display name is unique for user"""
<|b... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProfileForm:
"""Profile Form. Composed by Profile, User and LocalizedProfile fields"""
def clean_email(self):
"""Verify that the email is unique for user"""
email = self.cleaned_data.get('email')
if not email:
return email
users = User.objects.filter(email=emai... | the_stack_v2_python_sparse | film20/usersettings/forms.py | thuvh/filmmaster | train | 0 |
d6b7024ca1ea424ceefc9bf26e934ebec152892b | [
"super().__init__(screen, x, y, vx, vy)\nself.live = live\nself.screen = screen",
"global points\nif obj == guns[0]:\n points[0] += 1\nelif obj == guns[1]:\n points[1] += 1\nself.live -= 1\nif self.live == 0:\n self.new_target()"
] | <|body_start_0|>
super().__init__(screen, x, y, vx, vy)
self.live = live
self.screen = screen
<|end_body_0|>
<|body_start_1|>
global points
if obj == guns[0]:
points[0] += 1
elif obj == guns[1]:
points[1] += 1
self.live -= 1
if sel... | Target | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Target:
def __init__(self, screen: pygame.Surface, x: int, y: int, vx: int, vy: int, live: int):
"""Конструктор класса Target Args: screen - экран, на котором отрисовывается объект x - начальное положение объекта по горизонтали y - начальное положение объекта по вертикали vx - стартовая ... | stack_v2_sparse_classes_36k_train_002878 | 25,132 | no_license | [
{
"docstring": "Конструктор класса Target Args: screen - экран, на котором отрисовывается объект x - начальное положение объекта по горизонтали y - начальное положение объекта по вертикали vx - стартовая скорость по горизонтальной оси vy - стартовая скорость по вертикальной оси live - количество жизней мишени",... | 2 | stack_v2_sparse_classes_30k_train_009580 | Implement the Python class `Target` described below.
Class description:
Implement the Target class.
Method signatures and docstrings:
- def __init__(self, screen: pygame.Surface, x: int, y: int, vx: int, vy: int, live: int): Конструктор класса Target Args: screen - экран, на котором отрисовывается объект x - начально... | Implement the Python class `Target` described below.
Class description:
Implement the Target class.
Method signatures and docstrings:
- def __init__(self, screen: pygame.Surface, x: int, y: int, vx: int, vy: int, live: int): Конструктор класса Target Args: screen - экран, на котором отрисовывается объект x - начально... | e9c955c890a9775431e9a27a494bea774fe2bbb2 | <|skeleton|>
class Target:
def __init__(self, screen: pygame.Surface, x: int, y: int, vx: int, vy: int, live: int):
"""Конструктор класса Target Args: screen - экран, на котором отрисовывается объект x - начальное положение объекта по горизонтали y - начальное положение объекта по вертикали vx - стартовая ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Target:
def __init__(self, screen: pygame.Surface, x: int, y: int, vx: int, vy: int, live: int):
"""Конструктор класса Target Args: screen - экран, на котором отрисовывается объект x - начальное положение объекта по горизонтали y - начальное положение объекта по вертикали vx - стартовая скорость по го... | the_stack_v2_python_sparse | lab 9/guns.py | GenosseBlaackberry/MIPT_B02-113 | train | 0 | |
9024dc519f35e012efea0c32ca91e6a0d35439c5 | [
"super(Copy, self).__init__(*args, **kwargs)\nself.setMetadata('dispatch.split', True)\nself.setMetadata('dispatch.splitSize', 20)",
"for crawler in self.crawlers():\n filePath = self.target(crawler)\n try:\n os.makedirs(os.path.dirname(filePath))\n except OSError:\n pass\n sourceFilePat... | <|body_start_0|>
super(Copy, self).__init__(*args, **kwargs)
self.setMetadata('dispatch.split', True)
self.setMetadata('dispatch.splitSize', 20)
<|end_body_0|>
<|body_start_1|>
for crawler in self.crawlers():
filePath = self.target(crawler)
try:
o... | Copies a file to the filePath. | Copy | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Copy:
"""Copies a file to the filePath."""
def __init__(self, *args, **kwargs):
"""Create a Copy task."""
<|body_0|>
def _perform(self):
"""Perform the task."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super(Copy, self).__init__(*args, **kwa... | stack_v2_sparse_classes_36k_train_002879 | 1,643 | permissive | [
{
"docstring": "Create a Copy task.",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docstring": "Perform the task.",
"name": "_perform",
"signature": "def _perform(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_017214 | Implement the Python class `Copy` described below.
Class description:
Copies a file to the filePath.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Create a Copy task.
- def _perform(self): Perform the task. | Implement the Python class `Copy` described below.
Class description:
Copies a file to the filePath.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Create a Copy task.
- def _perform(self): Perform the task.
<|skeleton|>
class Copy:
"""Copies a file to the filePath."""
def __init__... | 0b1dc1f17b025f6b37c9a3cf5753a46cbbcd36ba | <|skeleton|>
class Copy:
"""Copies a file to the filePath."""
def __init__(self, *args, **kwargs):
"""Create a Copy task."""
<|body_0|>
def _perform(self):
"""Perform the task."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Copy:
"""Copies a file to the filePath."""
def __init__(self, *args, **kwargs):
"""Create a Copy task."""
super(Copy, self).__init__(*args, **kwargs)
self.setMetadata('dispatch.split', True)
self.setMetadata('dispatch.splitSize', 20)
def _perform(self):
"""Per... | the_stack_v2_python_sparse | src/lib/centipede/Task/Fs/Copy.py | ramgopal99/centipede | train | 0 |
a271bb62547ed8c8c3afaf762fc91cddb17a2e5d | [
"islands = 0\nfor row in range(len(grid)):\n for col in range(len(grid[0])):\n if grid[row][col] == '1':\n self._dfs(row, col, grid)\n islands += 1\n if grid[row][col] == '00':\n grid[row][col] = '1'\nreturn islands",
"grid[row][col] = '00'\nif row < len(grid) - 1... | <|body_start_0|>
islands = 0
for row in range(len(grid)):
for col in range(len(grid[0])):
if grid[row][col] == '1':
self._dfs(row, col, grid)
islands += 1
if grid[row][col] == '00':
grid[row][col] = '... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def numIslands(self, grid: List[List[str]]) -> int:
"""Returns the number of islands in a given list of list of '1's and '0's. A '1' represents land while a '0' represents water. An island is any number of '1's connected vertically and horizontally. Grid spaces that would be ou... | stack_v2_sparse_classes_36k_train_002880 | 2,318 | no_license | [
{
"docstring": "Returns the number of islands in a given list of list of '1's and '0's. A '1' represents land while a '0' represents water. An island is any number of '1's connected vertically and horizontally. Grid spaces that would be out of bounds are considered water. Params: grid - A list of lists containi... | 2 | stack_v2_sparse_classes_30k_train_000077 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numIslands(self, grid: List[List[str]]) -> int: Returns the number of islands in a given list of list of '1's and '0's. A '1' represents land while a '0' represents water. An... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numIslands(self, grid: List[List[str]]) -> int: Returns the number of islands in a given list of list of '1's and '0's. A '1' represents land while a '0' represents water. An... | c6d600bc74afd14e00d4f0ffed40696192b229c3 | <|skeleton|>
class Solution:
def numIslands(self, grid: List[List[str]]) -> int:
"""Returns the number of islands in a given list of list of '1's and '0's. A '1' represents land while a '0' represents water. An island is any number of '1's connected vertically and horizontally. Grid spaces that would be ou... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def numIslands(self, grid: List[List[str]]) -> int:
"""Returns the number of islands in a given list of list of '1's and '0's. A '1' represents land while a '0' represents water. An island is any number of '1's connected vertically and horizontally. Grid spaces that would be out of bounds ar... | the_stack_v2_python_sparse | python/Top Interview Questions - Medium/Trees and Graphs/islandcount.py | Hilldrupca/LeetCode | train | 0 | |
956f9e60f465d4f1a98167191b3b818c37ad776d | [
"super().__init__(*args, **kwargs)\nif ext_args == {}:\n self._freq = 1\nelse:\n self._freq = ext_args.freq",
"if engine.rank != 0:\n for k in engine.log_buffer:\n engine.log_buffer[k].clear()\n return\nfor k, v in engine.log_buffer['scalar'].items():\n setattr(engine.monitor, k, v)\nengine.... | <|body_start_0|>
super().__init__(*args, **kwargs)
if ext_args == {}:
self._freq = 1
else:
self._freq = ext_args.freq
<|end_body_0|>
<|body_start_1|>
if engine.rank != 0:
for k in engine.log_buffer:
engine.log_buffer[k].clear()
... | Overview: Hook to show log Interfaces: __init__, __call__ Property: name, priority, position | LogShowHook | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LogShowHook:
"""Overview: Hook to show log Interfaces: __init__, __call__ Property: name, priority, position"""
def __init__(self, *args, ext_args: EasyDict=EasyDict(), **kwargs) -> None:
"""Overview: init LogShowHook Arguments: - ext_args (:obj:`EasyDict`): extended_args, use ext_ar... | stack_v2_sparse_classes_36k_train_002881 | 15,244 | permissive | [
{
"docstring": "Overview: init LogShowHook Arguments: - ext_args (:obj:`EasyDict`): extended_args, use ext_args.freq to set freq",
"name": "__init__",
"signature": "def __init__(self, *args, ext_args: EasyDict=EasyDict(), **kwargs) -> None"
},
{
"docstring": "Overview: Show log, update record an... | 2 | stack_v2_sparse_classes_30k_train_000904 | Implement the Python class `LogShowHook` described below.
Class description:
Overview: Hook to show log Interfaces: __init__, __call__ Property: name, priority, position
Method signatures and docstrings:
- def __init__(self, *args, ext_args: EasyDict=EasyDict(), **kwargs) -> None: Overview: init LogShowHook Arguments... | Implement the Python class `LogShowHook` described below.
Class description:
Overview: Hook to show log Interfaces: __init__, __call__ Property: name, priority, position
Method signatures and docstrings:
- def __init__(self, *args, ext_args: EasyDict=EasyDict(), **kwargs) -> None: Overview: init LogShowHook Arguments... | eb483fa6e46602d58c8e7d2ca1e566adca28e703 | <|skeleton|>
class LogShowHook:
"""Overview: Hook to show log Interfaces: __init__, __call__ Property: name, priority, position"""
def __init__(self, *args, ext_args: EasyDict=EasyDict(), **kwargs) -> None:
"""Overview: init LogShowHook Arguments: - ext_args (:obj:`EasyDict`): extended_args, use ext_ar... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LogShowHook:
"""Overview: Hook to show log Interfaces: __init__, __call__ Property: name, priority, position"""
def __init__(self, *args, ext_args: EasyDict=EasyDict(), **kwargs) -> None:
"""Overview: init LogShowHook Arguments: - ext_args (:obj:`EasyDict`): extended_args, use ext_args.freq to se... | the_stack_v2_python_sparse | ding/worker/learner/learner_hook.py | shengxuesun/DI-engine | train | 1 |
4375233cd6112a00a439957a36db8a63bc881ecf | [
"self.mol = mol\nself.mints = mints\nself.V_nuc = mol.nuclear_repulsion_energy()\nself.T = np.matrix(mints.ao_kinetic())\nself.S = np.matrix(mints.ao_overlap())\nself.V = np.matrix(mints.ao_potential())\nself.g = np.array(mints.ao_eri())\nself.nelec = -mol.molecular_charge()\nfor A in range(mol.natom()):\n self.... | <|body_start_0|>
self.mol = mol
self.mints = mints
self.V_nuc = mol.nuclear_repulsion_energy()
self.T = np.matrix(mints.ao_kinetic())
self.S = np.matrix(mints.ao_overlap())
self.V = np.matrix(mints.ao_potential())
self.g = np.array(mints.ao_eri())
self.nel... | Restricted Hartree-Fock class for obtaining the restricted Hartree-Fock energy | RHF | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RHF:
"""Restricted Hartree-Fock class for obtaining the restricted Hartree-Fock energy"""
def __init__(self, mol, mints):
"""Initialize the rhf :param mol: a psi4 molecule object :param mints: a molecular integrals object (from MintsHelper)"""
<|body_0|>
def compute_ener... | stack_v2_sparse_classes_36k_train_002882 | 3,213 | no_license | [
{
"docstring": "Initialize the rhf :param mol: a psi4 molecule object :param mints: a molecular integrals object (from MintsHelper)",
"name": "__init__",
"signature": "def __init__(self, mol, mints)"
},
{
"docstring": "Compute the rhf energy :return: energy",
"name": "compute_energy",
"s... | 3 | null | Implement the Python class `RHF` described below.
Class description:
Restricted Hartree-Fock class for obtaining the restricted Hartree-Fock energy
Method signatures and docstrings:
- def __init__(self, mol, mints): Initialize the rhf :param mol: a psi4 molecule object :param mints: a molecular integrals object (from... | Implement the Python class `RHF` described below.
Class description:
Restricted Hartree-Fock class for obtaining the restricted Hartree-Fock energy
Method signatures and docstrings:
- def __init__(self, mol, mints): Initialize the rhf :param mol: a psi4 molecule object :param mints: a molecular integrals object (from... | 2e8255ea548f13de6c492f649c4f2c4156f9995f | <|skeleton|>
class RHF:
"""Restricted Hartree-Fock class for obtaining the restricted Hartree-Fock energy"""
def __init__(self, mol, mints):
"""Initialize the rhf :param mol: a psi4 molecule object :param mints: a molecular integrals object (from MintsHelper)"""
<|body_0|>
def compute_ener... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RHF:
"""Restricted Hartree-Fock class for obtaining the restricted Hartree-Fock energy"""
def __init__(self, mol, mints):
"""Initialize the rhf :param mol: a psi4 molecule object :param mints: a molecular integrals object (from MintsHelper)"""
self.mol = mol
self.mints = mints
... | the_stack_v2_python_sparse | 3/jevandezande/module/rhf.py | CCQC/summer-program | train | 35 |
7a750896863041bc18c7ea6ec66c5cbee677d88b | [
"avLst = self.avLst\nif avLst is None:\n return []\nreturn avLst.gd_lst",
"self._remove_avLst()\navLst = self._add_avLst()\nfor name, val in guides:\n gd = avLst._add_gd()\n gd.name = name\n gd.fmla = 'val %d' % val"
] | <|body_start_0|>
avLst = self.avLst
if avLst is None:
return []
return avLst.gd_lst
<|end_body_0|>
<|body_start_1|>
self._remove_avLst()
avLst = self._add_avLst()
for name, val in guides:
gd = avLst._add_gd()
gd.name = name
... | <a:prstGeom> custom element class | CT_PresetGeometry2D | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CT_PresetGeometry2D:
"""<a:prstGeom> custom element class"""
def gd_lst(self):
"""Sequence containing the ``gd`` element children of ``<a:avLst>`` child element, empty if none are present."""
<|body_0|>
def rewrite_guides(self, guides):
"""Remove any ``<a:gd>`` e... | stack_v2_sparse_classes_36k_train_002883 | 8,406 | permissive | [
{
"docstring": "Sequence containing the ``gd`` element children of ``<a:avLst>`` child element, empty if none are present.",
"name": "gd_lst",
"signature": "def gd_lst(self)"
},
{
"docstring": "Remove any ``<a:gd>`` element children of ``<a:avLst>`` and replace them with ones having (name, val) ... | 2 | null | Implement the Python class `CT_PresetGeometry2D` described below.
Class description:
<a:prstGeom> custom element class
Method signatures and docstrings:
- def gd_lst(self): Sequence containing the ``gd`` element children of ``<a:avLst>`` child element, empty if none are present.
- def rewrite_guides(self, guides): Re... | Implement the Python class `CT_PresetGeometry2D` described below.
Class description:
<a:prstGeom> custom element class
Method signatures and docstrings:
- def gd_lst(self): Sequence containing the ``gd`` element children of ``<a:avLst>`` child element, empty if none are present.
- def rewrite_guides(self, guides): Re... | cabf6e4f1970dc14302f87414f170de19944bac2 | <|skeleton|>
class CT_PresetGeometry2D:
"""<a:prstGeom> custom element class"""
def gd_lst(self):
"""Sequence containing the ``gd`` element children of ``<a:avLst>`` child element, empty if none are present."""
<|body_0|>
def rewrite_guides(self, guides):
"""Remove any ``<a:gd>`` e... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CT_PresetGeometry2D:
"""<a:prstGeom> custom element class"""
def gd_lst(self):
"""Sequence containing the ``gd`` element children of ``<a:avLst>`` child element, empty if none are present."""
avLst = self.avLst
if avLst is None:
return []
return avLst.gd_lst
... | the_stack_v2_python_sparse | Pdf_docx_pptx_xlsx_epub_png/source/pptx/oxml/shapes/autoshape.py | ryfeus/lambda-packs | train | 1,283 |
7aeb7533bb92ff775eea2a3c740feefa316ff12a | [
"assert isinstance(block_string, str)\nops = block_string.split('_')\noptions = {}\nfor op_ in ops:\n splits = re.split('(\\\\d.*)', op_)\n if len(splits) >= 2:\n key, value = splits[:2]\n options[key] = value\nassert 's' in options and len(options['s']) == 1 or (len(options['s']) == 2 and optio... | <|body_start_0|>
assert isinstance(block_string, str)
ops = block_string.split('_')
options = {}
for op_ in ops:
splits = re.split('(\\d.*)', op_)
if len(splits) >= 2:
key, value = splits[:2]
options[key] = value
assert 's' ... | Block Decoder | BlockDecoder | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BlockDecoder:
"""Block Decoder"""
def _decode_block_string(block_string):
"""Gets a block through a string notation of arguments."""
<|body_0|>
def _encode_block_string(block):
"""Encodes a block to a string."""
<|body_1|>
def decode(string_list):
... | stack_v2_sparse_classes_36k_train_002884 | 7,179 | permissive | [
{
"docstring": "Gets a block through a string notation of arguments.",
"name": "_decode_block_string",
"signature": "def _decode_block_string(block_string)"
},
{
"docstring": "Encodes a block to a string.",
"name": "_encode_block_string",
"signature": "def _encode_block_string(block)"
... | 4 | null | Implement the Python class `BlockDecoder` described below.
Class description:
Block Decoder
Method signatures and docstrings:
- def _decode_block_string(block_string): Gets a block through a string notation of arguments.
- def _encode_block_string(block): Encodes a block to a string.
- def decode(string_list): Decode... | Implement the Python class `BlockDecoder` described below.
Class description:
Block Decoder
Method signatures and docstrings:
- def _decode_block_string(block_string): Gets a block through a string notation of arguments.
- def _encode_block_string(block): Encodes a block to a string.
- def decode(string_list): Decode... | eab643f51336dbf7d711f02d27e6516e5affee59 | <|skeleton|>
class BlockDecoder:
"""Block Decoder"""
def _decode_block_string(block_string):
"""Gets a block through a string notation of arguments."""
<|body_0|>
def _encode_block_string(block):
"""Encodes a block to a string."""
<|body_1|>
def decode(string_list):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BlockDecoder:
"""Block Decoder"""
def _decode_block_string(block_string):
"""Gets a block through a string notation of arguments."""
assert isinstance(block_string, str)
ops = block_string.split('_')
options = {}
for op_ in ops:
splits = re.split('(\\d.... | the_stack_v2_python_sparse | research/cv/EfficientDet_d0/src/efficientnet/utils.py | mindspore-ai/models | train | 301 |
1459eecb5a295d88bd9bed55bd2d87cf3723ae26 | [
"self.envs = envs\nsuper().__init__()\nself._setup(*args, **kwargs)",
"cursor = dbapi_connection.cursor()\ncursor.execute('PRAGMA synchronous = 0')\ncursor.execute('PRAGMA mmap_size = 268435456')\ncursor.execute('PRAGMA cache_size = 20480')\ncursor.close()",
"try:\n db_settings = settings.get(f'DATABASES.{se... | <|body_start_0|>
self.envs = envs
super().__init__()
self._setup(*args, **kwargs)
<|end_body_0|>
<|body_start_1|>
cursor = dbapi_connection.cursor()
cursor.execute('PRAGMA synchronous = 0')
cursor.execute('PRAGMA mmap_size = 268435456')
cursor.execute('PRAGMA cac... | Менеджер инициатор БД. | DBManager | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DBManager:
"""Менеджер инициатор БД."""
def __init__(self, envs, *args, **kwargs):
"""Инициализация. Args: envs: имя области БД *args: доп. параметры **kwargs: доп. параметры"""
<|body_0|>
def set_sqlite_pragma(dbapi_connection, connection_record=None):
"""Параме... | stack_v2_sparse_classes_36k_train_002885 | 23,603 | permissive | [
{
"docstring": "Инициализация. Args: envs: имя области БД *args: доп. параметры **kwargs: доп. параметры",
"name": "__init__",
"signature": "def __init__(self, envs, *args, **kwargs)"
},
{
"docstring": "Параметры подключения к БД. Пока не знаю как от этого отделаться при других бекэндах Args: db... | 3 | stack_v2_sparse_classes_30k_train_013015 | Implement the Python class `DBManager` described below.
Class description:
Менеджер инициатор БД.
Method signatures and docstrings:
- def __init__(self, envs, *args, **kwargs): Инициализация. Args: envs: имя области БД *args: доп. параметры **kwargs: доп. параметры
- def set_sqlite_pragma(dbapi_connection, connection... | Implement the Python class `DBManager` described below.
Class description:
Менеджер инициатор БД.
Method signatures and docstrings:
- def __init__(self, envs, *args, **kwargs): Инициализация. Args: envs: имя области БД *args: доп. параметры **kwargs: доп. параметры
- def set_sqlite_pragma(dbapi_connection, connection... | d83fe60bc20535adb969d72f52aaca5cf4b00c6b | <|skeleton|>
class DBManager:
"""Менеджер инициатор БД."""
def __init__(self, envs, *args, **kwargs):
"""Инициализация. Args: envs: имя области БД *args: доп. параметры **kwargs: доп. параметры"""
<|body_0|>
def set_sqlite_pragma(dbapi_connection, connection_record=None):
"""Параме... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DBManager:
"""Менеджер инициатор БД."""
def __init__(self, envs, *args, **kwargs):
"""Инициализация. Args: envs: имя области БД *args: доп. параметры **kwargs: доп. параметры"""
self.envs = envs
super().__init__()
self._setup(*args, **kwargs)
def set_sqlite_pragma(dba... | the_stack_v2_python_sparse | talkative_client/talkative_client/db.py | mom1/messager | train | 0 |
b81427190f2ee73e567955c8754d9e06138c1766 | [
"description = {'status': self.status_type, 'sectionCount': self.number_of_sections, 'baseInformation': {'make': '', 'model': '', 'circa': False}}\nif self.csa_number:\n description['csaNumber'] = self.csa_number\nif self.csa_standard:\n description['csaStandard'] = self.csa_standard\nif self.square_feet:\n ... | <|body_start_0|>
description = {'status': self.status_type, 'sectionCount': self.number_of_sections, 'baseInformation': {'make': '', 'model': '', 'circa': False}}
if self.csa_number:
description['csaNumber'] = self.csa_number
if self.csa_standard:
description['csaStandard... | This class manages all of the MHR description information. | MhrDescription | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MhrDescription:
"""This class manages all of the MHR description information."""
def json(self) -> dict:
"""Return the description as a json object."""
<|body_0|>
def find_by_id(cls, description_id: int=None):
"""Return a description object by location ID."""
... | stack_v2_sparse_classes_36k_train_002886 | 7,291 | permissive | [
{
"docstring": "Return the description as a json object.",
"name": "json",
"signature": "def json(self) -> dict"
},
{
"docstring": "Return a description object by location ID.",
"name": "find_by_id",
"signature": "def find_by_id(cls, description_id: int=None)"
},
{
"docstring": "... | 5 | null | Implement the Python class `MhrDescription` described below.
Class description:
This class manages all of the MHR description information.
Method signatures and docstrings:
- def json(self) -> dict: Return the description as a json object.
- def find_by_id(cls, description_id: int=None): Return a description object b... | Implement the Python class `MhrDescription` described below.
Class description:
This class manages all of the MHR description information.
Method signatures and docstrings:
- def json(self) -> dict: Return the description as a json object.
- def find_by_id(cls, description_id: int=None): Return a description object b... | af1a4458bb78c16ecca484514d4bd0d1d8c24b5d | <|skeleton|>
class MhrDescription:
"""This class manages all of the MHR description information."""
def json(self) -> dict:
"""Return the description as a json object."""
<|body_0|>
def find_by_id(cls, description_id: int=None):
"""Return a description object by location ID."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MhrDescription:
"""This class manages all of the MHR description information."""
def json(self) -> dict:
"""Return the description as a json object."""
description = {'status': self.status_type, 'sectionCount': self.number_of_sections, 'baseInformation': {'make': '', 'model': '', 'circa':... | the_stack_v2_python_sparse | mhr_api/src/mhr_api/models/mhr_description.py | bcgov/ppr | train | 4 |
49fd6e411b5dda115987c3e7258bc1bb48dd2347 | [
"if exclude_paths is not None:\n self.__exclude_paths = exclude_paths\nelse:\n self.__exclude_paths = []",
"ret = None\nfor ex in self.__exclude_paths:\n if path.startswith(ex):\n ret = ex\n break\nreturn ret"
] | <|body_start_0|>
if exclude_paths is not None:
self.__exclude_paths = exclude_paths
else:
self.__exclude_paths = []
<|end_body_0|>
<|body_start_1|>
ret = None
for ex in self.__exclude_paths:
if path.startswith(ex):
ret = ex
... | Helper class to tell if a certain path is to be excluded from the scan. | PyExcludes | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PyExcludes:
"""Helper class to tell if a certain path is to be excluded from the scan."""
def __init__(self, exclude_paths=[]):
"""Constructor. :param exclude_paths: List of exclude paths."""
<|body_0|>
def exclude_path(self, path):
"""Return relevant exclude pat... | stack_v2_sparse_classes_36k_train_002887 | 11,671 | no_license | [
{
"docstring": "Constructor. :param exclude_paths: List of exclude paths.",
"name": "__init__",
"signature": "def __init__(self, exclude_paths=[])"
},
{
"docstring": "Return relevant exclude path or None. :param path: Path to match against the exclude paths. :return: Matching exclude path or Non... | 2 | null | Implement the Python class `PyExcludes` described below.
Class description:
Helper class to tell if a certain path is to be excluded from the scan.
Method signatures and docstrings:
- def __init__(self, exclude_paths=[]): Constructor. :param exclude_paths: List of exclude paths.
- def exclude_path(self, path): Return... | Implement the Python class `PyExcludes` described below.
Class description:
Helper class to tell if a certain path is to be excluded from the scan.
Method signatures and docstrings:
- def __init__(self, exclude_paths=[]): Constructor. :param exclude_paths: List of exclude paths.
- def exclude_path(self, path): Return... | 33bf532b397f21290d6f85631466d90964aab4ad | <|skeleton|>
class PyExcludes:
"""Helper class to tell if a certain path is to be excluded from the scan."""
def __init__(self, exclude_paths=[]):
"""Constructor. :param exclude_paths: List of exclude paths."""
<|body_0|>
def exclude_path(self, path):
"""Return relevant exclude pat... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PyExcludes:
"""Helper class to tell if a certain path is to be excluded from the scan."""
def __init__(self, exclude_paths=[]):
"""Constructor. :param exclude_paths: List of exclude paths."""
if exclude_paths is not None:
self.__exclude_paths = exclude_paths
else:
... | the_stack_v2_python_sparse | ass13/countcode.py | deadbok/eal_programming | train | 1 |
ca22dfd51b35f33ad9fce95942d9d774abd8cbda | [
"res = []\nstack = []\ncur = root\nwhile cur or stack:\n while cur:\n stack.append(cur)\n cur = cur.left\n cur = stack.pop()\n if cur:\n res.append(cur.val)\n cur = cur.right\nreturn res[len(res) - k]",
"res = []\nstack = []\ncur = root\nwhile cur or stack:\n if cur:\n ... | <|body_start_0|>
res = []
stack = []
cur = root
while cur or stack:
while cur:
stack.append(cur)
cur = cur.left
cur = stack.pop()
if cur:
res.append(cur.val)
cur = cur.right
return... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def kthLargest0(self, root, k):
""":type root: TreeNode :type k: int :rtype: int"""
<|body_0|>
def kthLargest1(self, root, k):
""":type root: TreeNode :type k: int :rtype: int"""
<|body_1|>
def kthLargest1(self, root, k):
""":type root:... | stack_v2_sparse_classes_36k_train_002888 | 1,990 | no_license | [
{
"docstring": ":type root: TreeNode :type k: int :rtype: int",
"name": "kthLargest0",
"signature": "def kthLargest0(self, root, k)"
},
{
"docstring": ":type root: TreeNode :type k: int :rtype: int",
"name": "kthLargest1",
"signature": "def kthLargest1(self, root, k)"
},
{
"docst... | 3 | stack_v2_sparse_classes_30k_train_012667 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def kthLargest0(self, root, k): :type root: TreeNode :type k: int :rtype: int
- def kthLargest1(self, root, k): :type root: TreeNode :type k: int :rtype: int
- def kthLargest1(se... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def kthLargest0(self, root, k): :type root: TreeNode :type k: int :rtype: int
- def kthLargest1(self, root, k): :type root: TreeNode :type k: int :rtype: int
- def kthLargest1(se... | 6e18c5d257840489cc3fb1079ae3804c743982a4 | <|skeleton|>
class Solution:
def kthLargest0(self, root, k):
""":type root: TreeNode :type k: int :rtype: int"""
<|body_0|>
def kthLargest1(self, root, k):
""":type root: TreeNode :type k: int :rtype: int"""
<|body_1|>
def kthLargest1(self, root, k):
""":type root:... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def kthLargest0(self, root, k):
""":type root: TreeNode :type k: int :rtype: int"""
res = []
stack = []
cur = root
while cur or stack:
while cur:
stack.append(cur)
cur = cur.left
cur = stack.pop()
... | the_stack_v2_python_sparse | 剑指 Offer 54. 二叉搜索树的第k大节点.py | yangyuxiang1996/leetcode | train | 0 | |
7875b0d5b87a2512c7e6a412374a0f5493696e11 | [
"instance = self.create_instance(parameters, tree=tree, fail_if_exists=True)\nentries = self.model.objects.all()\nself.assertEqual(entries.count(), 1)\nself.assertEqual(entries.first(), instance)\nreturn instance",
"for parameter_updates in self.consistency_check_changes:\n pars = self.parse_args(self.paramete... | <|body_start_0|>
instance = self.create_instance(parameters, tree=tree, fail_if_exists=True)
entries = self.model.objects.all()
self.assertEqual(entries.count(), 1)
self.assertEqual(entries.first(), instance)
return instance
<|end_body_0|>
<|body_start_1|>
for parameter_... | Class which runs default creation tests Todo: Include * Better description * Example | BaseTest | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseTest:
"""Class which runs default creation tests Todo: Include * Better description * Example"""
def test_default_creation(self, parameters: Optional[Dict[str, Any]]=None, tree: Optional[Dict[str, Any]]=None) -> Base:
"""Tests if creation of model works with default entries. Argu... | stack_v2_sparse_classes_36k_train_002889 | 5,077 | permissive | [
{
"docstring": "Tests if creation of model works with default entries. Arguments: parameters: Parameters used to construct the whole tree. Defaults to `self.parameters`. tree: Tree (nsted dependencies) used to construct the class. Defaults to `self.tree`.",
"name": "test_default_creation",
"signature": ... | 2 | stack_v2_sparse_classes_30k_train_005276 | Implement the Python class `BaseTest` described below.
Class description:
Class which runs default creation tests Todo: Include * Better description * Example
Method signatures and docstrings:
- def test_default_creation(self, parameters: Optional[Dict[str, Any]]=None, tree: Optional[Dict[str, Any]]=None) -> Base: Te... | Implement the Python class `BaseTest` described below.
Class description:
Class which runs default creation tests Todo: Include * Better description * Example
Method signatures and docstrings:
- def test_default_creation(self, parameters: Optional[Dict[str, Any]]=None, tree: Optional[Dict[str, Any]]=None) -> Base: Te... | 75c06748f3d59332a84ec1b5794c215c5974a46f | <|skeleton|>
class BaseTest:
"""Class which runs default creation tests Todo: Include * Better description * Example"""
def test_default_creation(self, parameters: Optional[Dict[str, Any]]=None, tree: Optional[Dict[str, Any]]=None) -> Base:
"""Tests if creation of model works with default entries. Argu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BaseTest:
"""Class which runs default creation tests Todo: Include * Better description * Example"""
def test_default_creation(self, parameters: Optional[Dict[str, Any]]=None, tree: Optional[Dict[str, Any]]=None) -> Base:
"""Tests if creation of model works with default entries. Arguments: parame... | the_stack_v2_python_sparse | lattedb/utilities/tests.py | callat-qcd/lattedb | train | 1 |
843bfade7a096c817161fb0668600731572c7372 | [
"if n == 1 or n == 2:\n return n\nreturn self.numWays(n - 1) + self.numWays(n - 2)",
"dic = {1: 1, 2: 2}\nif n == 1 or n == 2:\n return n\nfor i in range(3, n + 1):\n dic[i] = dic[i - 1] + dic[i - 2]\nreturn dic[n]",
"a = b = 1\nfor _ in range(n):\n a, b = (b, a + b)\nreturn a"
] | <|body_start_0|>
if n == 1 or n == 2:
return n
return self.numWays(n - 1) + self.numWays(n - 2)
<|end_body_0|>
<|body_start_1|>
dic = {1: 1, 2: 2}
if n == 1 or n == 2:
return n
for i in range(3, n + 1):
dic[i] = dic[i - 1] + dic[i - 2]
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def numWays_recursion(self, n):
"""overtime :type n: int :rtype: int"""
<|body_0|>
def numWays_another_recur(self, n):
"""记忆化递归法 time O(n) space O(n) overtime :type n: int :rtype: int"""
<|body_1|>
def numWays_fabonacci(self, n):
"""tim... | stack_v2_sparse_classes_36k_train_002890 | 1,341 | no_license | [
{
"docstring": "overtime :type n: int :rtype: int",
"name": "numWays_recursion",
"signature": "def numWays_recursion(self, n)"
},
{
"docstring": "记忆化递归法 time O(n) space O(n) overtime :type n: int :rtype: int",
"name": "numWays_another_recur",
"signature": "def numWays_another_recur(self,... | 3 | stack_v2_sparse_classes_30k_val_001158 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numWays_recursion(self, n): overtime :type n: int :rtype: int
- def numWays_another_recur(self, n): 记忆化递归法 time O(n) space O(n) overtime :type n: int :rtype: int
- def numWay... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numWays_recursion(self, n): overtime :type n: int :rtype: int
- def numWays_another_recur(self, n): 记忆化递归法 time O(n) space O(n) overtime :type n: int :rtype: int
- def numWay... | 85f71621c54f6b0029f3a2746f022f89dd7419d9 | <|skeleton|>
class Solution:
def numWays_recursion(self, n):
"""overtime :type n: int :rtype: int"""
<|body_0|>
def numWays_another_recur(self, n):
"""记忆化递归法 time O(n) space O(n) overtime :type n: int :rtype: int"""
<|body_1|>
def numWays_fabonacci(self, n):
"""tim... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def numWays_recursion(self, n):
"""overtime :type n: int :rtype: int"""
if n == 1 or n == 2:
return n
return self.numWays(n - 1) + self.numWays(n - 2)
def numWays_another_recur(self, n):
"""记忆化递归法 time O(n) space O(n) overtime :type n: int :rtype: int... | the_stack_v2_python_sparse | LeetCode/Offer/青蛙跳台阶.py | XyK0907/for_work | train | 0 | |
5247ef9797fcb8bd76e899ceb630d13308773ca1 | [
"if self.user:\n return 'Plan:{0}, Taken by: {1}'.format(self.plan.title, self.user.email)\nelse:\n return self.plan",
"subject = 'Your Cheers World Subscription has been Activated'\ncontext_data = {'user': self.user, 'plan': self.plan, 'language': language}\nhtml_template_path = 'emails/subscription-email.... | <|body_start_0|>
if self.user:
return 'Plan:{0}, Taken by: {1}'.format(self.plan.title, self.user.email)
else:
return self.plan
<|end_body_0|>
<|body_start_1|>
subject = 'Your Cheers World Subscription has been Activated'
context_data = {'user': self.user, 'plan'... | This model store the data of bar subscription. | ModelBarSubscription | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModelBarSubscription:
"""This model store the data of bar subscription."""
def __str__(self):
"""Returns the string representation of the bar subscription object."""
<|body_0|>
def send_activation_subscription_email(self, language=None):
"""Sends the activation s... | stack_v2_sparse_classes_36k_train_002891 | 3,210 | no_license | [
{
"docstring": "Returns the string representation of the bar subscription object.",
"name": "__str__",
"signature": "def __str__(self)"
},
{
"docstring": "Sends the activation subscription mail to the user.",
"name": "send_activation_subscription_email",
"signature": "def send_activation... | 2 | null | Implement the Python class `ModelBarSubscription` described below.
Class description:
This model store the data of bar subscription.
Method signatures and docstrings:
- def __str__(self): Returns the string representation of the bar subscription object.
- def send_activation_subscription_email(self, language=None): S... | Implement the Python class `ModelBarSubscription` described below.
Class description:
This model store the data of bar subscription.
Method signatures and docstrings:
- def __str__(self): Returns the string representation of the bar subscription object.
- def send_activation_subscription_email(self, language=None): S... | a8389cfa268c74e956358dac3ee925d54948a15c | <|skeleton|>
class ModelBarSubscription:
"""This model store the data of bar subscription."""
def __str__(self):
"""Returns the string representation of the bar subscription object."""
<|body_0|>
def send_activation_subscription_email(self, language=None):
"""Sends the activation s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ModelBarSubscription:
"""This model store the data of bar subscription."""
def __str__(self):
"""Returns the string representation of the bar subscription object."""
if self.user:
return 'Plan:{0}, Taken by: {1}'.format(self.plan.title, self.user.email)
else:
... | the_stack_v2_python_sparse | cheers/apps/bar/models/subscription.py | prabhjot-s-kbihm-com/python3-cheers | train | 0 |
412f56d37953828168a990f05e663165e334e00e | [
"queryset = super().get_queryset()\nif self.action == 'retrieve':\n return queryset.with_rating()\nreturn queryset",
"first_user_id = request.user.id\nsecond_user = self.get_object()\nhas_users_dialog = Dialog.objects.exclude(meeting__isnull=False).filter(dialogmember__member_id=first_user_id).filter(dialogmem... | <|body_start_0|>
queryset = super().get_queryset()
if self.action == 'retrieve':
return queryset.with_rating()
return queryset
<|end_body_0|>
<|body_start_1|>
first_user_id = request.user.id
second_user = self.get_object()
has_users_dialog = Dialog.objects.ex... | ViewSet for viewing users, start dialog with user. | UserInfoViewSet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserInfoViewSet:
"""ViewSet for viewing users, start dialog with user."""
def get_queryset(self):
"""Return queryset of Users with rating for 'retrieve' requests."""
<|body_0|>
def join(self, request, *args, **kwargs):
"""Start dialog with user."""
<|body... | stack_v2_sparse_classes_36k_train_002892 | 3,759 | no_license | [
{
"docstring": "Return queryset of Users with rating for 'retrieve' requests.",
"name": "get_queryset",
"signature": "def get_queryset(self)"
},
{
"docstring": "Start dialog with user.",
"name": "join",
"signature": "def join(self, request, *args, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002346 | Implement the Python class `UserInfoViewSet` described below.
Class description:
ViewSet for viewing users, start dialog with user.
Method signatures and docstrings:
- def get_queryset(self): Return queryset of Users with rating for 'retrieve' requests.
- def join(self, request, *args, **kwargs): Start dialog with us... | Implement the Python class `UserInfoViewSet` described below.
Class description:
ViewSet for viewing users, start dialog with user.
Method signatures and docstrings:
- def get_queryset(self): Return queryset of Users with rating for 'retrieve' requests.
- def join(self, request, *args, **kwargs): Start dialog with us... | 0879ade24685b628624dce06698f8a0afd042000 | <|skeleton|>
class UserInfoViewSet:
"""ViewSet for viewing users, start dialog with user."""
def get_queryset(self):
"""Return queryset of Users with rating for 'retrieve' requests."""
<|body_0|>
def join(self, request, *args, **kwargs):
"""Start dialog with user."""
<|body... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserInfoViewSet:
"""ViewSet for viewing users, start dialog with user."""
def get_queryset(self):
"""Return queryset of Users with rating for 'retrieve' requests."""
queryset = super().get_queryset()
if self.action == 'retrieve':
return queryset.with_rating()
r... | the_stack_v2_python_sparse | camp-python-2021-find-me-develop/apps/users/api/views.py | rhanmar/oi_projects_summer_2021 | train | 0 |
973e12159969629bde8a2e073d2d9be16fa04e0d | [
"if loctype == 'CT2007':\n self.localization = True\n self.localizetype = 'CT2007'\n if self.nmembers == 50:\n self.tvalue = 2.0086\n elif self.nmembers == 100:\n self.tvalue = 1.984\n elif self.nmembers == 150:\n self.tvalue = 1.97591\n elif self.nmembers == 200:\n sel... | <|body_start_0|>
if loctype == 'CT2007':
self.localization = True
self.localizetype = 'CT2007'
if self.nmembers == 50:
self.tvalue = 2.0086
elif self.nmembers == 100:
self.tvalue = 1.984
elif self.nmembers == 150:
... | This creates an instance of a CarbonTracker optimization object. The base class it derives from is the optimizer object. Additionally, this CO2Optimizer implements a special localization option following the CT2007 method. All other methods are inherited from the base class Optimizer. | CO2Optimizer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CO2Optimizer:
"""This creates an instance of a CarbonTracker optimization object. The base class it derives from is the optimizer object. Additionally, this CO2Optimizer implements a special localization option following the CT2007 method. All other methods are inherited from the base class Optim... | stack_v2_sparse_classes_36k_train_002893 | 3,226 | no_license | [
{
"docstring": "determine which localization to use",
"name": "set_localization",
"signature": "def set_localization(self, loctype='None')"
},
{
"docstring": "localize the Kalman Gain matrix",
"name": "localize",
"signature": "def localize(self, n)"
},
{
"docstring": "determine w... | 3 | stack_v2_sparse_classes_30k_train_011679 | Implement the Python class `CO2Optimizer` described below.
Class description:
This creates an instance of a CarbonTracker optimization object. The base class it derives from is the optimizer object. Additionally, this CO2Optimizer implements a special localization option following the CT2007 method. All other methods ... | Implement the Python class `CO2Optimizer` described below.
Class description:
This creates an instance of a CarbonTracker optimization object. The base class it derives from is the optimizer object. Additionally, this CO2Optimizer implements a special localization option following the CT2007 method. All other methods ... | 6f65b8dd5d8a9a1d6d002f201162432ecb6f3068 | <|skeleton|>
class CO2Optimizer:
"""This creates an instance of a CarbonTracker optimization object. The base class it derives from is the optimizer object. Additionally, this CO2Optimizer implements a special localization option following the CT2007 method. All other methods are inherited from the base class Optim... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CO2Optimizer:
"""This creates an instance of a CarbonTracker optimization object. The base class it derives from is the optimizer object. Additionally, this CO2Optimizer implements a special localization option following the CT2007 method. All other methods are inherited from the base class Optimizer."""
... | the_stack_v2_python_sparse | ctdas-stilt-base/exec/da/carbondioxide/optimizer.py | ddlddl58/CTDAS-Lagrange | train | 0 |
a40d244ef34a5736ac4679443ffdc007644687ea | [
"first = s[0]\nlast_first = 0\nfor c in s:\n if c == first:\n last_first += 1\n else:\n break\nret = s[last_first:]\nrecord_another = 0\nfor c in s[last_first:]:\n if c == str(1 - int(first)):\n record_another += 1\n if last_first == record_another:\n break\n else:... | <|body_start_0|>
first = s[0]
last_first = 0
for c in s:
if c == first:
last_first += 1
else:
break
ret = s[last_first:]
record_another = 0
for c in s[last_first:]:
if c == str(1 - int(first)):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def forword_find(self, s):
""":type s: str"""
<|body_0|>
def back_find(self, s):
""":type s: str"""
<|body_1|>
def countBinarySubstrings1(self, s):
""":type s: str :rtype: int"""
<|body_2|>
def countBinarySubstrings2(self, ... | stack_v2_sparse_classes_36k_train_002894 | 3,891 | no_license | [
{
"docstring": ":type s: str",
"name": "forword_find",
"signature": "def forword_find(self, s)"
},
{
"docstring": ":type s: str",
"name": "back_find",
"signature": "def back_find(self, s)"
},
{
"docstring": ":type s: str :rtype: int",
"name": "countBinarySubstrings1",
"si... | 6 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def forword_find(self, s): :type s: str
- def back_find(self, s): :type s: str
- def countBinarySubstrings1(self, s): :type s: str :rtype: int
- def countBinarySubstrings2(self, ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def forword_find(self, s): :type s: str
- def back_find(self, s): :type s: str
- def countBinarySubstrings1(self, s): :type s: str :rtype: int
- def countBinarySubstrings2(self, ... | 70bdd75b6af2e1811c1beab22050c01d28d7373e | <|skeleton|>
class Solution:
def forword_find(self, s):
""":type s: str"""
<|body_0|>
def back_find(self, s):
""":type s: str"""
<|body_1|>
def countBinarySubstrings1(self, s):
""":type s: str :rtype: int"""
<|body_2|>
def countBinarySubstrings2(self, ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def forword_find(self, s):
""":type s: str"""
first = s[0]
last_first = 0
for c in s:
if c == first:
last_first += 1
else:
break
ret = s[last_first:]
record_another = 0
for c in s[last_fir... | the_stack_v2_python_sparse | python/leetcode/696_Count_Binary_Substrings.py | bobcaoge/my-code | train | 0 | |
21e033f46e6cd918a18038be0cf19374ed7161ff | [
"user_obj = User()\nuser = user_obj.get_by_id(user_id)\nif not user:\n return ({'error': 'No such User', 'success': False}, 400)\ndata = {'result': {'username': user.username, 'name': user.profile.name if user.profile else '', 'email': user.profile.email if user.profile else '', 'bio': user.profile.bio if user.p... | <|body_start_0|>
user_obj = User()
user = user_obj.get_by_id(user_id)
if not user:
return ({'error': 'No such User', 'success': False}, 400)
data = {'result': {'username': user.username, 'name': user.profile.name if user.profile else '', 'email': user.profile.email if user.pr... | User Profile class, supply get/put method | UserProfile | [
"CC-BY-4.0",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserProfile:
"""User Profile class, supply get/put method"""
def get(self, user_id):
"""Get user profile information :param user_id: user id of User to query :return: profile data, status code"""
<|body_0|>
def put(self, user_id):
"""Update user profile :param us... | stack_v2_sparse_classes_36k_train_002895 | 3,980 | permissive | [
{
"docstring": "Get user profile information :param user_id: user id of User to query :return: profile data, status code",
"name": "get",
"signature": "def get(self, user_id)"
},
{
"docstring": "Update user profile :param user_id: user id of User to update profile :return: api response, status c... | 2 | stack_v2_sparse_classes_30k_train_012010 | Implement the Python class `UserProfile` described below.
Class description:
User Profile class, supply get/put method
Method signatures and docstrings:
- def get(self, user_id): Get user profile information :param user_id: user id of User to query :return: profile data, status code
- def put(self, user_id): Update u... | Implement the Python class `UserProfile` described below.
Class description:
User Profile class, supply get/put method
Method signatures and docstrings:
- def get(self, user_id): Get user profile information :param user_id: user id of User to query :return: profile data, status code
- def put(self, user_id): Update u... | 43f537380b93896c543a1248bf2b04c3fafe993d | <|skeleton|>
class UserProfile:
"""User Profile class, supply get/put method"""
def get(self, user_id):
"""Get user profile information :param user_id: user id of User to query :return: profile data, status code"""
<|body_0|>
def put(self, user_id):
"""Update user profile :param us... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserProfile:
"""User Profile class, supply get/put method"""
def get(self, user_id):
"""Get user profile information :param user_id: user id of User to query :return: profile data, status code"""
user_obj = User()
user = user_obj.get_by_id(user_id)
if not user:
... | the_stack_v2_python_sparse | src/modules/user/profile.py | zale144/cello | train | 0 |
8ead5d9849a6b00bda1f64ed4625b8069832be67 | [
"url = 'parameters/%s' % name\ntry:\n response_dict = self.get(url)\n return tortuga.objects.parameter.Parameter.getFromDict(response_dict.get('globalparameter'))\nexcept TortugaException:\n raise\nexcept Exception as ex:\n raise TortugaException(exception=ex)",
"url = 'parameters/'\ntry:\n respons... | <|body_start_0|>
url = 'parameters/%s' % name
try:
response_dict = self.get(url)
return tortuga.objects.parameter.Parameter.getFromDict(response_dict.get('globalparameter'))
except TortugaException:
raise
except Exception as ex:
raise Tortu... | Parameter WS API class. | ParameterWsApi | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ParameterWsApi:
"""Parameter WS API class."""
def getParameter(self, name):
"""Gets a parameter. :param name: the name of the parameter to get :return: a parameter :raises ParameterNotFound:"""
<|body_0|>
def getParameterList(self):
"""Get all known parameters. :... | stack_v2_sparse_classes_36k_train_002896 | 3,168 | permissive | [
{
"docstring": "Gets a parameter. :param name: the name of the parameter to get :return: a parameter :raises ParameterNotFound:",
"name": "getParameter",
"signature": "def getParameter(self, name)"
},
{
"docstring": "Get all known parameters. :return: a list of parameters",
"name": "getParam... | 5 | null | Implement the Python class `ParameterWsApi` described below.
Class description:
Parameter WS API class.
Method signatures and docstrings:
- def getParameter(self, name): Gets a parameter. :param name: the name of the parameter to get :return: a parameter :raises ParameterNotFound:
- def getParameterList(self): Get al... | Implement the Python class `ParameterWsApi` described below.
Class description:
Parameter WS API class.
Method signatures and docstrings:
- def getParameter(self, name): Gets a parameter. :param name: the name of the parameter to get :return: a parameter :raises ParameterNotFound:
- def getParameterList(self): Get al... | 56d808d7836cd15d6c6748cbf704cdea4407fef6 | <|skeleton|>
class ParameterWsApi:
"""Parameter WS API class."""
def getParameter(self, name):
"""Gets a parameter. :param name: the name of the parameter to get :return: a parameter :raises ParameterNotFound:"""
<|body_0|>
def getParameterList(self):
"""Get all known parameters. :... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ParameterWsApi:
"""Parameter WS API class."""
def getParameter(self, name):
"""Gets a parameter. :param name: the name of the parameter to get :return: a parameter :raises ParameterNotFound:"""
url = 'parameters/%s' % name
try:
response_dict = self.get(url)
... | the_stack_v2_python_sparse | src/core/src/tortuga/wsapi/parameterWsApi.py | UnivaCorporation/tortuga | train | 33 |
1da8737671f1da0a7c4a0f80d4a296abe2b1cff9 | [
"@lru_cache(None)\ndef dp(i, k):\n \"\"\"The number of consecutive 1 ends at i using at most k flips\"\"\"\n if i < 0:\n return 0\n if nums[i] == 1:\n return dp(i - 1, k) + 1\n if k:\n return dp(i - 1, k - 1) + 1\n return 0\nreturn max((dp(i, k) for i in range(len(nums))))",
"i... | <|body_start_0|>
@lru_cache(None)
def dp(i, k):
"""The number of consecutive 1 ends at i using at most k flips"""
if i < 0:
return 0
if nums[i] == 1:
return dp(i - 1, k) + 1
if k:
return dp(i - 1, k - 1) + 1
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def longestOnes(self, nums: List[int], k: int) -> int:
"""Time complexity: O(n*k) Space complexity: O(n*k)"""
<|body_0|>
def longestOnes(self, nums: List[int], k: int) -> int:
"""Time complexity: O(n) Space complexity: O(k)"""
<|body_1|>
def lo... | stack_v2_sparse_classes_36k_train_002897 | 20,448 | no_license | [
{
"docstring": "Time complexity: O(n*k) Space complexity: O(n*k)",
"name": "longestOnes",
"signature": "def longestOnes(self, nums: List[int], k: int) -> int"
},
{
"docstring": "Time complexity: O(n) Space complexity: O(k)",
"name": "longestOnes",
"signature": "def longestOnes(self, nums... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestOnes(self, nums: List[int], k: int) -> int: Time complexity: O(n*k) Space complexity: O(n*k)
- def longestOnes(self, nums: List[int], k: int) -> int: Time complexity: ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestOnes(self, nums: List[int], k: int) -> int: Time complexity: O(n*k) Space complexity: O(n*k)
- def longestOnes(self, nums: List[int], k: int) -> int: Time complexity: ... | 1389a009a02e90e8700a7a00e0b7f797c129cdf4 | <|skeleton|>
class Solution:
def longestOnes(self, nums: List[int], k: int) -> int:
"""Time complexity: O(n*k) Space complexity: O(n*k)"""
<|body_0|>
def longestOnes(self, nums: List[int], k: int) -> int:
"""Time complexity: O(n) Space complexity: O(k)"""
<|body_1|>
def lo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def longestOnes(self, nums: List[int], k: int) -> int:
"""Time complexity: O(n*k) Space complexity: O(n*k)"""
@lru_cache(None)
def dp(i, k):
"""The number of consecutive 1 ends at i using at most k flips"""
if i < 0:
return 0
... | the_stack_v2_python_sparse | leetcode/solved/1046_Max_Consecutive_Ones_III/solution.py | sungminoh/algorithms | train | 0 | |
c3334c70b3f47a2ace52a9dedc32085cec750277 | [
"self.cursors = {'default': wx.NullCursor}\nself.addCursor('Hand', Resources.getHandImage())\nself.addCursor('GrabHand', Resources.getGrabHandImage())\nself.addCursor('MagPlus', navCanvasIcons.getviewmag_plusImage(), (9, 9))\nself.addCursor('MagMinus', navCanvasIcons.getviewmag_minusImage(), (9, 9))\nself.addCursor... | <|body_start_0|>
self.cursors = {'default': wx.NullCursor}
self.addCursor('Hand', Resources.getHandImage())
self.addCursor('GrabHand', Resources.getGrabHandImage())
self.addCursor('MagPlus', navCanvasIcons.getviewmag_plusImage(), (9, 9))
self.addCursor('MagMinus', navCanvasIcons.... | Singleton-like class to hold the standard Cursors | Cursors | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Cursors:
"""Singleton-like class to hold the standard Cursors"""
def __init__(self):
"""Build a list with the default cursors, specialize for mac"""
<|body_0|>
def addCursor(self, name, img, hotspot=None):
"""Adds a cursor to our inventory"""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_002898 | 12,707 | no_license | [
{
"docstring": "Build a list with the default cursors, specialize for mac",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Adds a cursor to our inventory",
"name": "addCursor",
"signature": "def addCursor(self, name, img, hotspot=None)"
},
{
"docstring":... | 3 | null | Implement the Python class `Cursors` described below.
Class description:
Singleton-like class to hold the standard Cursors
Method signatures and docstrings:
- def __init__(self): Build a list with the default cursors, specialize for mac
- def addCursor(self, name, img, hotspot=None): Adds a cursor to our inventory
- ... | Implement the Python class `Cursors` described below.
Class description:
Singleton-like class to hold the standard Cursors
Method signatures and docstrings:
- def __init__(self): Build a list with the default cursors, specialize for mac
- def addCursor(self, name, img, hotspot=None): Adds a cursor to our inventory
- ... | 6a7473c258ea4105f44e31d140ea5c0ae6bc46d8 | <|skeleton|>
class Cursors:
"""Singleton-like class to hold the standard Cursors"""
def __init__(self):
"""Build a list with the default cursors, specialize for mac"""
<|body_0|>
def addCursor(self, name, img, hotspot=None):
"""Adds a cursor to our inventory"""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Cursors:
"""Singleton-like class to hold the standard Cursors"""
def __init__(self):
"""Build a list with the default cursors, specialize for mac"""
self.cursors = {'default': wx.NullCursor}
self.addCursor('Hand', Resources.getHandImage())
self.addCursor('GrabHand', Resour... | the_stack_v2_python_sparse | 3rdParty/branches/FloatCanvas/SOC2008_FloatCanvas/floatcanvas2/floatcanvas/canvas/guiMode.py | czxxjtu/wxPython-1 | train | 0 |
4d04cfdfd48f34058e147cd16bf684b413ba4533 | [
"self.name = name\nself.center = center\nself.bottom_left_corner = bottom_left_corner\nself.bottom_right_corner = bottom_right_corner\nself.top_left_corner = top_left_corner\nself.top_right_corner = top_right_corner\nself.image_contents = image_contents",
"if dictionary is None:\n return None\nname = dictionar... | <|body_start_0|>
self.name = name
self.center = center
self.bottom_left_corner = bottom_left_corner
self.bottom_right_corner = bottom_right_corner
self.top_left_corner = top_left_corner
self.top_right_corner = top_right_corner
self.image_contents = image_contents
... | Implementation of the 'updateNetworkFloorPlan' model. TODO: type model description here. Attributes: name (string): The name of your floor plan. center (Center1Model): The longitude and latitude of the center of your floor plan. If you want to change the geolocation data of your floor plan, either the 'center' or two a... | UpdateNetworkFloorPlanModel | [
"MIT",
"Python-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UpdateNetworkFloorPlanModel:
"""Implementation of the 'updateNetworkFloorPlan' model. TODO: type model description here. Attributes: name (string): The name of your floor plan. center (Center1Model): The longitude and latitude of the center of your floor plan. If you want to change the geolocatio... | stack_v2_sparse_classes_36k_train_002899 | 5,591 | permissive | [
{
"docstring": "Constructor for the UpdateNetworkFloorPlanModel class",
"name": "__init__",
"signature": "def __init__(self, name=None, center=None, bottom_left_corner=None, bottom_right_corner=None, top_left_corner=None, top_right_corner=None, image_contents=None)"
},
{
"docstring": "Creates an... | 2 | stack_v2_sparse_classes_30k_train_011695 | Implement the Python class `UpdateNetworkFloorPlanModel` described below.
Class description:
Implementation of the 'updateNetworkFloorPlan' model. TODO: type model description here. Attributes: name (string): The name of your floor plan. center (Center1Model): The longitude and latitude of the center of your floor pla... | Implement the Python class `UpdateNetworkFloorPlanModel` described below.
Class description:
Implementation of the 'updateNetworkFloorPlan' model. TODO: type model description here. Attributes: name (string): The name of your floor plan. center (Center1Model): The longitude and latitude of the center of your floor pla... | 9894089eb013318243ae48869cc5130eb37f80c0 | <|skeleton|>
class UpdateNetworkFloorPlanModel:
"""Implementation of the 'updateNetworkFloorPlan' model. TODO: type model description here. Attributes: name (string): The name of your floor plan. center (Center1Model): The longitude and latitude of the center of your floor plan. If you want to change the geolocatio... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UpdateNetworkFloorPlanModel:
"""Implementation of the 'updateNetworkFloorPlan' model. TODO: type model description here. Attributes: name (string): The name of your floor plan. center (Center1Model): The longitude and latitude of the center of your floor plan. If you want to change the geolocation data of you... | the_stack_v2_python_sparse | meraki_sdk/models/update_network_floor_plan_model.py | RaulCatalano/meraki-python-sdk | train | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.