blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 7.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 467 8.64k | id stringlengths 40 40 | length_bytes int64 515 49.7k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 160 3.93k | prompted_full_text stringlengths 681 10.7k | revision_id stringlengths 40 40 | skeleton stringlengths 162 4.09k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | solution stringlengths 331 8.3k | source stringclasses 1
value | source_path stringlengths 5 177 | source_repo stringlengths 6 88 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6789042fd28f7c65312f2d8dc337637d9dc2aa44 | [
"self.cells = cells\nself.cell_np = cell_np\nself.dnp = 0\nself.np = 0\nself.dsize = 0.0\nself.size = 1.0\nself.np_req = np_req\nself.tr = kwargs.get('tr', 0.8)\nself.u = kwargs.get('u', 0.4)\nself.e = kwargs.get('e', 3.0)\nself.er = kwargs.get('er', 6.0)\nself.r = kwargs.get('r', 2.0)\nself.t = 0.0\nself.x = self.... | <|body_start_0|>
self.cells = cells
self.cell_np = cell_np
self.dnp = 0
self.np = 0
self.dsize = 0.0
self.size = 1.0
self.np_req = np_req
self.tr = kwargs.get('tr', 0.8)
self.u = kwargs.get('u', 0.4)
self.e = kwargs.get('e', 3.0)
se... | Class representing a cluster in k-means clustering | Cluster | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Cluster:
"""Class representing a cluster in k-means clustering"""
def __init__(self, cells, cell_np, np_req, **kwargs):
"""constructor kwargs can be used to finetune the algorithm: t = ratio of old component of center used in the center calculation tr = `t` when the number of particl... | stack_v2_sparse_classes_10k_train_007900 | 12,256 | permissive | [
{
"docstring": "constructor kwargs can be used to finetune the algorithm: t = ratio of old component of center used in the center calculation tr = `t` when the number of particles over/undershoot (reversal) u = ratio of nearest cell center in the new center from the remaining (1-t) (other component is the centr... | 4 | stack_v2_sparse_classes_30k_train_002044 | Implement the Python class `Cluster` described below.
Class description:
Class representing a cluster in k-means clustering
Method signatures and docstrings:
- def __init__(self, cells, cell_np, np_req, **kwargs): constructor kwargs can be used to finetune the algorithm: t = ratio of old component of center used in t... | Implement the Python class `Cluster` described below.
Class description:
Class representing a cluster in k-means clustering
Method signatures and docstrings:
- def __init__(self, cells, cell_np, np_req, **kwargs): constructor kwargs can be used to finetune the algorithm: t = ratio of old component of center used in t... | 5bb1fc46a9c84aefd42758356a9986689db05454 | <|skeleton|>
class Cluster:
"""Class representing a cluster in k-means clustering"""
def __init__(self, cells, cell_np, np_req, **kwargs):
"""constructor kwargs can be used to finetune the algorithm: t = ratio of old component of center used in the center calculation tr = `t` when the number of particl... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Cluster:
"""Class representing a cluster in k-means clustering"""
def __init__(self, cells, cell_np, np_req, **kwargs):
"""constructor kwargs can be used to finetune the algorithm: t = ratio of old component of center used in the center calculation tr = `t` when the number of particles over/under... | the_stack_v2_python_sparse | source/pysph/parallel/load_balancer_mkmeans.py | pankajp/pysph | train | 1 |
91bc920380f815839d84305009957d00eeb0bbb5 | [
"if n <= 1:\n return head\nprev = head\nm = n\nprint('Find Tail')\nwhile m >= 1:\n print('prev.val = ', prev.val)\n prev = prev.next\n m -= 1\ncur = head\nprint('Reverse Start')\nwhile n >= 1:\n print('cur.val = ', cur.val)\n tail = cur.next\n cur.next = prev\n prev = cur\n cur = tail\n ... | <|body_start_0|>
if n <= 1:
return head
prev = head
m = n
print('Find Tail')
while m >= 1:
print('prev.val = ', prev.val)
prev = prev.next
m -= 1
cur = head
print('Reverse Start')
while n >= 1:
pr... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def reverseToN(self, head, n):
""":type head: ListNode :type n: int :rtype: ListNode"""
<|body_0|>
def reverseBetween(self, head, m, n):
""":type head: ListNode :type m: int :type n: int :rtype: ListNode"""
<|body_1|>
<|end_skeleton|>
<|body_start... | stack_v2_sparse_classes_10k_train_007901 | 1,461 | no_license | [
{
"docstring": ":type head: ListNode :type n: int :rtype: ListNode",
"name": "reverseToN",
"signature": "def reverseToN(self, head, n)"
},
{
"docstring": ":type head: ListNode :type m: int :type n: int :rtype: ListNode",
"name": "reverseBetween",
"signature": "def reverseBetween(self, he... | 2 | stack_v2_sparse_classes_30k_train_001717 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverseToN(self, head, n): :type head: ListNode :type n: int :rtype: ListNode
- def reverseBetween(self, head, m, n): :type head: ListNode :type m: int :type n: int :rtype: L... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverseToN(self, head, n): :type head: ListNode :type n: int :rtype: ListNode
- def reverseBetween(self, head, m, n): :type head: ListNode :type m: int :type n: int :rtype: L... | f8b35179b980e55f61bbcd2631fa3a9bf30c40ec | <|skeleton|>
class Solution:
def reverseToN(self, head, n):
""":type head: ListNode :type n: int :rtype: ListNode"""
<|body_0|>
def reverseBetween(self, head, m, n):
""":type head: ListNode :type m: int :type n: int :rtype: ListNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def reverseToN(self, head, n):
""":type head: ListNode :type n: int :rtype: ListNode"""
if n <= 1:
return head
prev = head
m = n
print('Find Tail')
while m >= 1:
print('prev.val = ', prev.val)
prev = prev.next
... | the_stack_v2_python_sparse | Python Solutions/092 Reverse Linked List II.py | Sue9/Leetcode | train | 0 | |
5f44da1901832f91793177a730c44144ce4e3399 | [
"TrafficLightHandler.num_tl = 0\nTrafficLightHandler.list_tl_actor = []\nTrafficLightHandler.list_tv_loc = []\nTrafficLightHandler.list_stopline_wps = []\nTrafficLightHandler.list_stopline_vtx = []\nall_actors = alf_world._world.get_actors()\nfor _actor in all_actors:\n if 'traffic_light' in _actor.type_id:\n ... | <|body_start_0|>
TrafficLightHandler.num_tl = 0
TrafficLightHandler.list_tl_actor = []
TrafficLightHandler.list_tv_loc = []
TrafficLightHandler.list_stopline_wps = []
TrafficLightHandler.list_stopline_vtx = []
all_actors = alf_world._world.get_actors()
for _actor ... | This class provides utility functions related to traffic lights. Currently the main functionality is to retrieve the stoplines for all the traffic lights, organized according to their current color states, i.e., the stopline of a traffic light is recorded into the list for the current color state of the traffic light. ... | TrafficLightHandler | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TrafficLightHandler:
"""This class provides utility functions related to traffic lights. Currently the main functionality is to retrieve the stoplines for all the traffic lights, organized according to their current color states, i.e., the stopline of a traffic light is recorded into the list for... | stack_v2_sparse_classes_10k_train_007902 | 30,805 | permissive | [
{
"docstring": "Args: alf_world (World): an instance of the World class defined in alf.environments.carla_sensors.",
"name": "reset",
"signature": "def reset(alf_world)"
},
{
"docstring": "Get the list of stop line vertices satisfying both the color and distance conditions for a given query loca... | 2 | stack_v2_sparse_classes_30k_train_002172 | Implement the Python class `TrafficLightHandler` described below.
Class description:
This class provides utility functions related to traffic lights. Currently the main functionality is to retrieve the stoplines for all the traffic lights, organized according to their current color states, i.e., the stopline of a traf... | Implement the Python class `TrafficLightHandler` described below.
Class description:
This class provides utility functions related to traffic lights. Currently the main functionality is to retrieve the stoplines for all the traffic lights, organized according to their current color states, i.e., the stopline of a traf... | b00ff2fa5e660de31020338ba340263183fbeaa4 | <|skeleton|>
class TrafficLightHandler:
"""This class provides utility functions related to traffic lights. Currently the main functionality is to retrieve the stoplines for all the traffic lights, organized according to their current color states, i.e., the stopline of a traffic light is recorded into the list for... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TrafficLightHandler:
"""This class provides utility functions related to traffic lights. Currently the main functionality is to retrieve the stoplines for all the traffic lights, organized according to their current color states, i.e., the stopline of a traffic light is recorded into the list for the current ... | the_stack_v2_python_sparse | alf/environments/carla_env/carla_utils.py | HorizonRobotics/alf | train | 288 |
5ffe2ba1dd325b0a8488a81e4a0f539e86c069b4 | [
"self.sumList = []\na = 0\nfor num in nums:\n a += num\n self.sumList.append(a)",
"if i == 0:\n return self.sumList[j]\nreturn self.sumList[j] - self.sumList[i - 1]"
] | <|body_start_0|>
self.sumList = []
a = 0
for num in nums:
a += num
self.sumList.append(a)
<|end_body_0|>
<|body_start_1|>
if i == 0:
return self.sumList[j]
return self.sumList[j] - self.sumList[i - 1]
<|end_body_1|>
| 记录一个累和数组 | NumArray | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NumArray:
"""记录一个累和数组"""
def __init__(self, nums):
""":type nums: List[int]"""
<|body_0|>
def sumRange(self, i, j):
""":type i: int :type j: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.sumList = []
a = 0
... | stack_v2_sparse_classes_10k_train_007903 | 645 | no_license | [
{
"docstring": ":type nums: List[int]",
"name": "__init__",
"signature": "def __init__(self, nums)"
},
{
"docstring": ":type i: int :type j: int :rtype: int",
"name": "sumRange",
"signature": "def sumRange(self, i, j)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000093 | Implement the Python class `NumArray` described below.
Class description:
记录一个累和数组
Method signatures and docstrings:
- def __init__(self, nums): :type nums: List[int]
- def sumRange(self, i, j): :type i: int :type j: int :rtype: int | Implement the Python class `NumArray` described below.
Class description:
记录一个累和数组
Method signatures and docstrings:
- def __init__(self, nums): :type nums: List[int]
- def sumRange(self, i, j): :type i: int :type j: int :rtype: int
<|skeleton|>
class NumArray:
"""记录一个累和数组"""
def __init__(self, nums):
... | 7167f1a7c6cb16cca63675c80037682752ee2a7d | <|skeleton|>
class NumArray:
"""记录一个累和数组"""
def __init__(self, nums):
""":type nums: List[int]"""
<|body_0|>
def sumRange(self, i, j):
""":type i: int :type j: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class NumArray:
"""记录一个累和数组"""
def __init__(self, nums):
""":type nums: List[int]"""
self.sumList = []
a = 0
for num in nums:
a += num
self.sumList.append(a)
def sumRange(self, i, j):
""":type i: int :type j: int :rtype: int"""
if i =... | the_stack_v2_python_sparse | Everyday/No303.py | kikihiter/LeetCode2 | train | 4 |
64719fc657c551ac1c7f7629f9246dd462d4f9c2 | [
"assertEqual = self.assertEqual\nvalues = ['A', 'B', 'B', 'C']\naggregate = S3GroupAggregate('count', 'Example', values)\nassertEqual(aggregate.result, 3)\nvalues = None\naggregate = S3GroupAggregate('count', 'Example', values)\nassertEqual(aggregate.result, None)\nvalues = 17\naggregate = S3GroupAggregate('count',... | <|body_start_0|>
assertEqual = self.assertEqual
values = ['A', 'B', 'B', 'C']
aggregate = S3GroupAggregate('count', 'Example', values)
assertEqual(aggregate.result, 3)
values = None
aggregate = S3GroupAggregate('count', 'Example', values)
assertEqual(aggregate.res... | Tests for grouped items value aggregation methods | GroupAggregateTests | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GroupAggregateTests:
"""Tests for grouped items value aggregation methods"""
def testCount(self):
"""Test aggregation method 'count'"""
<|body_0|>
def testSum(self):
"""Test aggregation method 'sum'"""
<|body_1|>
def testMin(self):
"""Test ag... | stack_v2_sparse_classes_10k_train_007904 | 15,171 | permissive | [
{
"docstring": "Test aggregation method 'count'",
"name": "testCount",
"signature": "def testCount(self)"
},
{
"docstring": "Test aggregation method 'sum'",
"name": "testSum",
"signature": "def testSum(self)"
},
{
"docstring": "Test aggregation method 'min'",
"name": "testMin... | 6 | stack_v2_sparse_classes_30k_train_003658 | Implement the Python class `GroupAggregateTests` described below.
Class description:
Tests for grouped items value aggregation methods
Method signatures and docstrings:
- def testCount(self): Test aggregation method 'count'
- def testSum(self): Test aggregation method 'sum'
- def testMin(self): Test aggregation metho... | Implement the Python class `GroupAggregateTests` described below.
Class description:
Tests for grouped items value aggregation methods
Method signatures and docstrings:
- def testCount(self): Test aggregation method 'count'
- def testSum(self): Test aggregation method 'sum'
- def testMin(self): Test aggregation metho... | 7ec4b959d009daf26d5ca6ce91dd9c3c0bd978d6 | <|skeleton|>
class GroupAggregateTests:
"""Tests for grouped items value aggregation methods"""
def testCount(self):
"""Test aggregation method 'count'"""
<|body_0|>
def testSum(self):
"""Test aggregation method 'sum'"""
<|body_1|>
def testMin(self):
"""Test ag... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GroupAggregateTests:
"""Tests for grouped items value aggregation methods"""
def testCount(self):
"""Test aggregation method 'count'"""
assertEqual = self.assertEqual
values = ['A', 'B', 'B', 'C']
aggregate = S3GroupAggregate('count', 'Example', values)
assertEqual... | the_stack_v2_python_sparse | modules/unit_tests/core/methods/grouped.py | nursix/drkcm | train | 3 |
0edde025936976aa089bd6cf642279cdd08c7033 | [
"super().__init__()\nself.image = None\nself.name = ''\nself.color = ''\nself.screen = chess_game.screen\nself.x, self.y = (0.0, 0.0)",
"self.rect = self.image.get_rect()\nself.rect.topleft = (self.x, self.y)\nself.screen.blit(self.image, self.rect)"
] | <|body_start_0|>
super().__init__()
self.image = None
self.name = ''
self.color = ''
self.screen = chess_game.screen
self.x, self.y = (0.0, 0.0)
<|end_body_0|>
<|body_start_1|>
self.rect = self.image.get_rect()
self.rect.topleft = (self.x, self.y)
... | Represents a chess piece. | Piece | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Piece:
"""Represents a chess piece."""
def __init__(self, chess_game):
"""Initialize attributes to represent a ches piece."""
<|body_0|>
def blitme(self):
"""Draw the piece at its current location."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_10k_train_007905 | 2,009 | permissive | [
{
"docstring": "Initialize attributes to represent a ches piece.",
"name": "__init__",
"signature": "def __init__(self, chess_game)"
},
{
"docstring": "Draw the piece at its current location.",
"name": "blitme",
"signature": "def blitme(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002750 | Implement the Python class `Piece` described below.
Class description:
Represents a chess piece.
Method signatures and docstrings:
- def __init__(self, chess_game): Initialize attributes to represent a ches piece.
- def blitme(self): Draw the piece at its current location. | Implement the Python class `Piece` described below.
Class description:
Represents a chess piece.
Method signatures and docstrings:
- def __init__(self, chess_game): Initialize attributes to represent a ches piece.
- def blitme(self): Draw the piece at its current location.
<|skeleton|>
class Piece:
"""Represents... | 2cb4b45dd14a230aa0e800042e893f8dfb23beda | <|skeleton|>
class Piece:
"""Represents a chess piece."""
def __init__(self, chess_game):
"""Initialize attributes to represent a ches piece."""
<|body_0|>
def blitme(self):
"""Draw the piece at its current location."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Piece:
"""Represents a chess piece."""
def __init__(self, chess_game):
"""Initialize attributes to represent a ches piece."""
super().__init__()
self.image = None
self.name = ''
self.color = ''
self.screen = chess_game.screen
self.x, self.y = (0.0, ... | the_stack_v2_python_sparse | MY_REPOS/Lambda-Resource-Static-Assets/2-resources/BLOG/Python/pcc_2e-master/beyond_pcc/chess_game/chess_set.py | bgoonz/UsefulResourceRepo2.0 | train | 10 |
f8a37a2e9d16fa72cf44fad38ce36e73a84659f8 | [
"self.ai_settings = ai_settings\nself.reset_stats()\nself.game_active = False\nself.high_score = 0",
"self.ships_left = self.ai_settings.ship_limit\nself.score = 0\nself.level = 1\nfilename = 'high_score.json'\ntry:\n with open(filename) as f:\n self.high_score = json.load(f)\nexcept FileNotFoundError:\... | <|body_start_0|>
self.ai_settings = ai_settings
self.reset_stats()
self.game_active = False
self.high_score = 0
<|end_body_0|>
<|body_start_1|>
self.ships_left = self.ai_settings.ship_limit
self.score = 0
self.level = 1
filename = 'high_score.json'
... | 跟踪游戏的统计信息 | GameStats | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GameStats:
"""跟踪游戏的统计信息"""
def __init__(self, ai_settings):
"""初始化统计信息"""
<|body_0|>
def reset_stats(self):
"""初始化在游戏运行期间可能变化的统计信息"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.ai_settings = ai_settings
self.reset_stats()
... | stack_v2_sparse_classes_10k_train_007906 | 901 | no_license | [
{
"docstring": "初始化统计信息",
"name": "__init__",
"signature": "def __init__(self, ai_settings)"
},
{
"docstring": "初始化在游戏运行期间可能变化的统计信息",
"name": "reset_stats",
"signature": "def reset_stats(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007263 | Implement the Python class `GameStats` described below.
Class description:
跟踪游戏的统计信息
Method signatures and docstrings:
- def __init__(self, ai_settings): 初始化统计信息
- def reset_stats(self): 初始化在游戏运行期间可能变化的统计信息 | Implement the Python class `GameStats` described below.
Class description:
跟踪游戏的统计信息
Method signatures and docstrings:
- def __init__(self, ai_settings): 初始化统计信息
- def reset_stats(self): 初始化在游戏运行期间可能变化的统计信息
<|skeleton|>
class GameStats:
"""跟踪游戏的统计信息"""
def __init__(self, ai_settings):
"""初始化统计信息"""
... | 9dc8ddd440e56a9961b118813162323fdfd4f16e | <|skeleton|>
class GameStats:
"""跟踪游戏的统计信息"""
def __init__(self, ai_settings):
"""初始化统计信息"""
<|body_0|>
def reset_stats(self):
"""初始化在游戏运行期间可能变化的统计信息"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GameStats:
"""跟踪游戏的统计信息"""
def __init__(self, ai_settings):
"""初始化统计信息"""
self.ai_settings = ai_settings
self.reset_stats()
self.game_active = False
self.high_score = 0
def reset_stats(self):
"""初始化在游戏运行期间可能变化的统计信息"""
self.ships_left = self.ai_... | the_stack_v2_python_sparse | python编程从入门到实践/第十四章/14-5/game_stats.py | huanglun1994/learn | train | 0 |
384a982f027e9b91e29be99ea587e51cd2b1c027 | [
"HistogramSeries.__init__(self, *args, **kwargs)\nself.__opts = self.displayCtx.getOpts(self.overlay)\nself.__opts.addListener('vertexData', self.name, self.__vertexDataChanged)\nself.__opts.addListener('vertexDataIndex', self.name, self.__vertexDataChanged)\nself.__vertexDataChanged()",
"HistogramSeries.destroy(... | <|body_start_0|>
HistogramSeries.__init__(self, *args, **kwargs)
self.__opts = self.displayCtx.getOpts(self.overlay)
self.__opts.addListener('vertexData', self.name, self.__vertexDataChanged)
self.__opts.addListener('vertexDataIndex', self.name, self.__vertexDataChanged)
self.__v... | A ``MeshHistogramSeries`` instance manages generation of histogram data for a :class:`.Mesh` overlay. | MeshHistogramSeries | [
"BSD-3-Clause",
"CC-BY-3.0",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MeshHistogramSeries:
"""A ``MeshHistogramSeries`` instance manages generation of histogram data for a :class:`.Mesh` overlay."""
def __init__(self, *args, **kwargs):
"""Create a ``MeshHistogramSeries``. All arguments are passed through to :meth:`HistogramSeries.__init__`."""
... | stack_v2_sparse_classes_10k_train_007907 | 19,944 | permissive | [
{
"docstring": "Create a ``MeshHistogramSeries``. All arguments are passed through to :meth:`HistogramSeries.__init__`.",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docstring": "Must be called when this ``MeshHistogramSeries`` is no longer needed. Calls :meth:`H... | 3 | null | Implement the Python class `MeshHistogramSeries` described below.
Class description:
A ``MeshHistogramSeries`` instance manages generation of histogram data for a :class:`.Mesh` overlay.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Create a ``MeshHistogramSeries``. All arguments are passed... | Implement the Python class `MeshHistogramSeries` described below.
Class description:
A ``MeshHistogramSeries`` instance manages generation of histogram data for a :class:`.Mesh` overlay.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Create a ``MeshHistogramSeries``. All arguments are passed... | 46ccb4fe2b2346eb57576247f49714032b61307a | <|skeleton|>
class MeshHistogramSeries:
"""A ``MeshHistogramSeries`` instance manages generation of histogram data for a :class:`.Mesh` overlay."""
def __init__(self, *args, **kwargs):
"""Create a ``MeshHistogramSeries``. All arguments are passed through to :meth:`HistogramSeries.__init__`."""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MeshHistogramSeries:
"""A ``MeshHistogramSeries`` instance manages generation of histogram data for a :class:`.Mesh` overlay."""
def __init__(self, *args, **kwargs):
"""Create a ``MeshHistogramSeries``. All arguments are passed through to :meth:`HistogramSeries.__init__`."""
HistogramSeri... | the_stack_v2_python_sparse | fsleyes/plotting/histogramseries.py | sanjayankur31/fsleyes | train | 1 |
0611b6fca551bb8e52cd0e5f936df4e4658e0188 | [
"self.root_public_folder_list = root_public_folder_list\nself.target_folder_path = target_folder_path\nself.target_root_public_folder = target_root_public_folder",
"if dictionary is None:\n return None\nroot_public_folder_list = None\nif dictionary.get('rootPublicFolderList') != None:\n root_public_folder_l... | <|body_start_0|>
self.root_public_folder_list = root_public_folder_list
self.target_folder_path = target_folder_path
self.target_root_public_folder = target_root_public_folder
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
root_public_folder_list ... | Implementation of the 'PublicFoldersRestoreParameters' model. Specifies information needed for recovering O365 Public Folders in O365Publicfolders environment. Attributes: root_public_folder_list (list of RootPublicFolder): Specifies the list of Public Folders to be restored. target_folder_path (string): Specifies the ... | PublicFoldersRestoreParameters | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PublicFoldersRestoreParameters:
"""Implementation of the 'PublicFoldersRestoreParameters' model. Specifies information needed for recovering O365 Public Folders in O365Publicfolders environment. Attributes: root_public_folder_list (list of RootPublicFolder): Specifies the list of Public Folders t... | stack_v2_sparse_classes_10k_train_007908 | 3,002 | permissive | [
{
"docstring": "Constructor for the PublicFoldersRestoreParameters class",
"name": "__init__",
"signature": "def __init__(self, root_public_folder_list=None, target_folder_path=None, target_root_public_folder=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dic... | 2 | stack_v2_sparse_classes_30k_train_005235 | Implement the Python class `PublicFoldersRestoreParameters` described below.
Class description:
Implementation of the 'PublicFoldersRestoreParameters' model. Specifies information needed for recovering O365 Public Folders in O365Publicfolders environment. Attributes: root_public_folder_list (list of RootPublicFolder):... | Implement the Python class `PublicFoldersRestoreParameters` described below.
Class description:
Implementation of the 'PublicFoldersRestoreParameters' model. Specifies information needed for recovering O365 Public Folders in O365Publicfolders environment. Attributes: root_public_folder_list (list of RootPublicFolder):... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class PublicFoldersRestoreParameters:
"""Implementation of the 'PublicFoldersRestoreParameters' model. Specifies information needed for recovering O365 Public Folders in O365Publicfolders environment. Attributes: root_public_folder_list (list of RootPublicFolder): Specifies the list of Public Folders t... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PublicFoldersRestoreParameters:
"""Implementation of the 'PublicFoldersRestoreParameters' model. Specifies information needed for recovering O365 Public Folders in O365Publicfolders environment. Attributes: root_public_folder_list (list of RootPublicFolder): Specifies the list of Public Folders to be restored... | the_stack_v2_python_sparse | cohesity_management_sdk/models/public_folders_restore_parameters.py | cohesity/management-sdk-python | train | 24 |
9ebc796f17095486673ae8da6119d33f0a4a9a66 | [
"defined_cmd = 'a $VERY $OVERSIMPLIFIED line'\nt = SCons.Platform.TempFileMunge(defined_cmd)\nenv = SCons.Environment.SubstitutionEnvironment(tools=[])\nenv['MAXLINELENGTH'] = 1024\nenv['VERY'] = 'test'\nenv['OVERSIMPLIFIED'] = 'command'\nexpanded_cmd = env.subst(defined_cmd)\ncmd = t(None, None, env, 0)\nassert cm... | <|body_start_0|>
defined_cmd = 'a $VERY $OVERSIMPLIFIED line'
t = SCons.Platform.TempFileMunge(defined_cmd)
env = SCons.Environment.SubstitutionEnvironment(tools=[])
env['MAXLINELENGTH'] = 1024
env['VERY'] = 'test'
env['OVERSIMPLIFIED'] = 'command'
expanded_cmd = ... | TempFileMungeTestCase | [
"MIT",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TempFileMungeTestCase:
def test_MAXLINELENGTH(self) -> None:
"""Test different values for MAXLINELENGTH with the same size command string to ensure that the temp file mechanism kicks in only at MAXLINELENGTH+1, or higher"""
<|body_0|>
def test_TEMPFILEARGJOINBYTE(self) -> No... | stack_v2_sparse_classes_10k_train_007909 | 12,425 | permissive | [
{
"docstring": "Test different values for MAXLINELENGTH with the same size command string to ensure that the temp file mechanism kicks in only at MAXLINELENGTH+1, or higher",
"name": "test_MAXLINELENGTH",
"signature": "def test_MAXLINELENGTH(self) -> None"
},
{
"docstring": "Test argument join b... | 4 | null | Implement the Python class `TempFileMungeTestCase` described below.
Class description:
Implement the TempFileMungeTestCase class.
Method signatures and docstrings:
- def test_MAXLINELENGTH(self) -> None: Test different values for MAXLINELENGTH with the same size command string to ensure that the temp file mechanism k... | Implement the Python class `TempFileMungeTestCase` described below.
Class description:
Implement the TempFileMungeTestCase class.
Method signatures and docstrings:
- def test_MAXLINELENGTH(self) -> None: Test different values for MAXLINELENGTH with the same size command string to ensure that the temp file mechanism k... | b2a7d7066a2b854460a334a5fe737ea389655e6e | <|skeleton|>
class TempFileMungeTestCase:
def test_MAXLINELENGTH(self) -> None:
"""Test different values for MAXLINELENGTH with the same size command string to ensure that the temp file mechanism kicks in only at MAXLINELENGTH+1, or higher"""
<|body_0|>
def test_TEMPFILEARGJOINBYTE(self) -> No... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TempFileMungeTestCase:
def test_MAXLINELENGTH(self) -> None:
"""Test different values for MAXLINELENGTH with the same size command string to ensure that the temp file mechanism kicks in only at MAXLINELENGTH+1, or higher"""
defined_cmd = 'a $VERY $OVERSIMPLIFIED line'
t = SCons.Platfor... | the_stack_v2_python_sparse | SCons/Platform/PlatformTests.py | SCons/scons | train | 1,827 | |
cbbc7585c8bf00d3a1203d27c048a561e94a914d | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn UserRegistrationFeatureSummary()",
"from .included_user_roles import IncludedUserRoles\nfrom .included_user_types import IncludedUserTypes\nfrom .user_registration_feature_count import UserRegistrationFeatureCount\nfrom .included_user_... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return UserRegistrationFeatureSummary()
<|end_body_0|>
<|body_start_1|>
from .included_user_roles import IncludedUserRoles
from .included_user_types import IncludedUserTypes
from .user_... | UserRegistrationFeatureSummary | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserRegistrationFeatureSummary:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserRegistrationFeatureSummary:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator v... | stack_v2_sparse_classes_10k_train_007910 | 4,327 | 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: UserRegistrationFeatureSummary",
"name": "create_from_discriminator_value",
"signature": "def create_from_di... | 3 | null | Implement the Python class `UserRegistrationFeatureSummary` described below.
Class description:
Implement the UserRegistrationFeatureSummary class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserRegistrationFeatureSummary: Creates a new instance of... | Implement the Python class `UserRegistrationFeatureSummary` described below.
Class description:
Implement the UserRegistrationFeatureSummary class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserRegistrationFeatureSummary: Creates a new instance of... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class UserRegistrationFeatureSummary:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserRegistrationFeatureSummary:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator v... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class UserRegistrationFeatureSummary:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserRegistrationFeatureSummary:
"""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 creat... | the_stack_v2_python_sparse | msgraph/generated/models/user_registration_feature_summary.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
0ca44ce02b0706ccdc523abe6eb0cef31a720582 | [
"first = second = third = float('-inf')\nfor n in nums:\n if n > first:\n first, second, third = (n, first, third)\n elif first > n > second:\n second, third = (n, second)\n elif second > n > third:\n third = n\n print(first, second, third)\nreturn third if third > float('-inf') els... | <|body_start_0|>
first = second = third = float('-inf')
for n in nums:
if n > first:
first, second, third = (n, first, third)
elif first > n > second:
second, third = (n, second)
elif second > n > third:
third = n
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def thirdMax(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def thirdMax_refer(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
first = second = third = float('-inf')
... | stack_v2_sparse_classes_10k_train_007911 | 1,879 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "thirdMax",
"signature": "def thirdMax(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "thirdMax_refer",
"signature": "def thirdMax_refer(self, nums)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def thirdMax(self, nums): :type nums: List[int] :rtype: int
- def thirdMax_refer(self, nums): :type nums: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def thirdMax(self, nums): :type nums: List[int] :rtype: int
- def thirdMax_refer(self, nums): :type nums: List[int] :rtype: int
<|skeleton|>
class Solution:
def thirdMax(se... | f3fc71f344cd758cfce77f16ab72992c99ab288e | <|skeleton|>
class Solution:
def thirdMax(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def thirdMax_refer(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def thirdMax(self, nums):
""":type nums: List[int] :rtype: int"""
first = second = third = float('-inf')
for n in nums:
if n > first:
first, second, third = (n, first, third)
elif first > n > second:
second, third = (n, ... | the_stack_v2_python_sparse | 414_thirdMax.py | jennyChing/leetCode | train | 2 | |
c49741e88d6666702907653723254268e92b73bd | [
"s_index = f_index = 0\nmin_length = float('inf')\nwhile f_index < len(nums):\n sub_sum = sum(nums[s_index:f_index + 1])\n if sub_sum < s:\n f_index += 1\n elif sub_sum > s:\n if min_length > f_index - s_index + 1:\n min_length = f_index - s_index + 1\n s_index += 1\n els... | <|body_start_0|>
s_index = f_index = 0
min_length = float('inf')
while f_index < len(nums):
sub_sum = sum(nums[s_index:f_index + 1])
if sub_sum < s:
f_index += 1
elif sub_sum > s:
if min_length > f_index - s_index + 1:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minSubArrayLen(self, s, nums):
""":type s: int :type nums: List[int] :rtype: int"""
<|body_0|>
def minSubArrayLen_II(self, s, nums):
""":type s: int :type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
s_in... | stack_v2_sparse_classes_10k_train_007912 | 1,418 | no_license | [
{
"docstring": ":type s: int :type nums: List[int] :rtype: int",
"name": "minSubArrayLen",
"signature": "def minSubArrayLen(self, s, nums)"
},
{
"docstring": ":type s: int :type nums: List[int] :rtype: int",
"name": "minSubArrayLen_II",
"signature": "def minSubArrayLen_II(self, s, nums)"... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minSubArrayLen(self, s, nums): :type s: int :type nums: List[int] :rtype: int
- def minSubArrayLen_II(self, s, nums): :type s: int :type nums: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minSubArrayLen(self, s, nums): :type s: int :type nums: List[int] :rtype: int
- def minSubArrayLen_II(self, s, nums): :type s: int :type nums: List[int] :rtype: int
<|skelet... | 1461b10b8910fa90a311939c6df9082a8526f9b1 | <|skeleton|>
class Solution:
def minSubArrayLen(self, s, nums):
""":type s: int :type nums: List[int] :rtype: int"""
<|body_0|>
def minSubArrayLen_II(self, s, nums):
""":type s: int :type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def minSubArrayLen(self, s, nums):
""":type s: int :type nums: List[int] :rtype: int"""
s_index = f_index = 0
min_length = float('inf')
while f_index < len(nums):
sub_sum = sum(nums[s_index:f_index + 1])
if sub_sum < s:
f_index ... | the_stack_v2_python_sparse | Medium/209_minimumSizeSubArraySum.py | Yucheng7713/CodingPracticeByYuch | train | 0 | |
c93e1eee22a2562395ebb320b7f806528ac34663 | [
"try:\n _ = list(Metrics(api_key=config['api_key']).read_records(sync_mode=SyncMode.full_refresh))\nexcept Exception as e:\n return (False, repr(e))\nreturn (True, None)",
"api_key = config['api_key']\nstart_date = config['start_date']\nreturn [Campaigns(api_key=api_key), Events(api_key=api_key, start_date=... | <|body_start_0|>
try:
_ = list(Metrics(api_key=config['api_key']).read_records(sync_mode=SyncMode.full_refresh))
except Exception as e:
return (False, repr(e))
return (True, None)
<|end_body_0|>
<|body_start_1|>
api_key = config['api_key']
start_date = co... | SourceKlaviyo | [
"MIT",
"Elastic-2.0",
"Apache-2.0",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SourceKlaviyo:
def check_connection(self, logger, config: Mapping[str, Any]) -> Tuple[bool, Any]:
"""Connection check to validate that the user-provided config can be used to connect to the underlying API :param config: the user-input config object conforming to the connector's spec.json... | stack_v2_sparse_classes_10k_train_007913 | 1,790 | permissive | [
{
"docstring": "Connection check to validate that the user-provided config can be used to connect to the underlying API :param config: the user-input config object conforming to the connector's spec.json :param logger: logger object :return Tuple[bool, Any]: (True, None) if the input config can be used to conne... | 2 | stack_v2_sparse_classes_30k_test_000105 | Implement the Python class `SourceKlaviyo` described below.
Class description:
Implement the SourceKlaviyo class.
Method signatures and docstrings:
- def check_connection(self, logger, config: Mapping[str, Any]) -> Tuple[bool, Any]: Connection check to validate that the user-provided config can be used to connect to ... | Implement the Python class `SourceKlaviyo` described below.
Class description:
Implement the SourceKlaviyo class.
Method signatures and docstrings:
- def check_connection(self, logger, config: Mapping[str, Any]) -> Tuple[bool, Any]: Connection check to validate that the user-provided config can be used to connect to ... | 8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6 | <|skeleton|>
class SourceKlaviyo:
def check_connection(self, logger, config: Mapping[str, Any]) -> Tuple[bool, Any]:
"""Connection check to validate that the user-provided config can be used to connect to the underlying API :param config: the user-input config object conforming to the connector's spec.json... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SourceKlaviyo:
def check_connection(self, logger, config: Mapping[str, Any]) -> Tuple[bool, Any]:
"""Connection check to validate that the user-provided config can be used to connect to the underlying API :param config: the user-input config object conforming to the connector's spec.json :param logger... | the_stack_v2_python_sparse | dts/airbyte/airbyte-integrations/connectors/source-klaviyo/source_klaviyo/source.py | alldatacenter/alldata | train | 774 | |
072a9010e93fdc08754c447269121d117e034df4 | [
"if self.dbconn.version < 90100:\n return\nfor ext in self.fetch():\n self[ext.key()] = ext",
"for key in inexts:\n if not key.startswith('extension '):\n raise KeyError('Unrecognized object type: %s' % key)\n ext = key[10:]\n inexten = inexts[key]\n self[ext] = Extension(name=ext, descri... | <|body_start_0|>
if self.dbconn.version < 90100:
return
for ext in self.fetch():
self[ext.key()] = ext
<|end_body_0|>
<|body_start_1|>
for key in inexts:
if not key.startswith('extension '):
raise KeyError('Unrecognized object type: %s' % key)... | The collection of extensions in a database | ExtensionDict | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExtensionDict:
"""The collection of extensions in a database"""
def _from_catalog(self):
"""Initialize the dictionary of extensions by querying the catalogs"""
<|body_0|>
def from_map(self, inexts, langtempls, newdb):
"""Initalize the dictionary of extensions by ... | stack_v2_sparse_classes_10k_train_007914 | 4,548 | permissive | [
{
"docstring": "Initialize the dictionary of extensions by querying the catalogs",
"name": "_from_catalog",
"signature": "def _from_catalog(self)"
},
{
"docstring": "Initalize the dictionary of extensions by converting the input map :param inexts: YAML map defining the extensions :param langtemp... | 4 | stack_v2_sparse_classes_30k_train_007252 | Implement the Python class `ExtensionDict` described below.
Class description:
The collection of extensions in a database
Method signatures and docstrings:
- def _from_catalog(self): Initialize the dictionary of extensions by querying the catalogs
- def from_map(self, inexts, langtempls, newdb): Initalize the diction... | Implement the Python class `ExtensionDict` described below.
Class description:
The collection of extensions in a database
Method signatures and docstrings:
- def _from_catalog(self): Initialize the dictionary of extensions by querying the catalogs
- def from_map(self, inexts, langtempls, newdb): Initalize the diction... | 0133f3bc522890e0564d27de6791824acb4d2773 | <|skeleton|>
class ExtensionDict:
"""The collection of extensions in a database"""
def _from_catalog(self):
"""Initialize the dictionary of extensions by querying the catalogs"""
<|body_0|>
def from_map(self, inexts, langtempls, newdb):
"""Initalize the dictionary of extensions by ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ExtensionDict:
"""The collection of extensions in a database"""
def _from_catalog(self):
"""Initialize the dictionary of extensions by querying the catalogs"""
if self.dbconn.version < 90100:
return
for ext in self.fetch():
self[ext.key()] = ext
def fr... | the_stack_v2_python_sparse | pyrseas/dbobject/extension.py | vayerx/Pyrseas | train | 1 |
feef0d345203017f14ce2e2591defb0a94057fc7 | [
"self.config_entry = config_entry\nself.meter = meter\nself.discovergy_client = discovergy_client\nsuper().__init__(hass, _LOGGER, name=DOMAIN, update_interval=timedelta(seconds=30))",
"try:\n return await self.discovergy_client.meter_last_reading(self.meter.meter_id)\nexcept AccessTokenExpired as err:\n ra... | <|body_start_0|>
self.config_entry = config_entry
self.meter = meter
self.discovergy_client = discovergy_client
super().__init__(hass, _LOGGER, name=DOMAIN, update_interval=timedelta(seconds=30))
<|end_body_0|>
<|body_start_1|>
try:
return await self.discovergy_clien... | The Discovergy update coordinator. | DiscovergyUpdateCoordinator | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DiscovergyUpdateCoordinator:
"""The Discovergy update coordinator."""
def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry, meter: Meter, discovergy_client: Discovergy) -> None:
"""Initialize the Discovergy coordinator."""
<|body_0|>
async def _async_update_... | stack_v2_sparse_classes_10k_train_007915 | 1,859 | permissive | [
{
"docstring": "Initialize the Discovergy coordinator.",
"name": "__init__",
"signature": "def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry, meter: Meter, discovergy_client: Discovergy) -> None"
},
{
"docstring": "Get last reading for meter.",
"name": "_async_update_data",
... | 2 | null | Implement the Python class `DiscovergyUpdateCoordinator` described below.
Class description:
The Discovergy update coordinator.
Method signatures and docstrings:
- def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry, meter: Meter, discovergy_client: Discovergy) -> None: Initialize the Discovergy coordin... | Implement the Python class `DiscovergyUpdateCoordinator` described below.
Class description:
The Discovergy update coordinator.
Method signatures and docstrings:
- def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry, meter: Meter, discovergy_client: Discovergy) -> None: Initialize the Discovergy coordin... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class DiscovergyUpdateCoordinator:
"""The Discovergy update coordinator."""
def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry, meter: Meter, discovergy_client: Discovergy) -> None:
"""Initialize the Discovergy coordinator."""
<|body_0|>
async def _async_update_... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DiscovergyUpdateCoordinator:
"""The Discovergy update coordinator."""
def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry, meter: Meter, discovergy_client: Discovergy) -> None:
"""Initialize the Discovergy coordinator."""
self.config_entry = config_entry
self.meter =... | the_stack_v2_python_sparse | homeassistant/components/discovergy/coordinator.py | home-assistant/core | train | 35,501 |
c1fb96d281ff340126642b38e421cb45381803dd | [
"config = current_app.cea_config\ndashboards = cea.plots.read_dashboards(config, current_app.plot_cache)\nout = []\nfor d in dashboards:\n out.append(dashboard_to_dict(d))\nreturn out",
"form = api.payload\nconfig = current_app.cea_config\nif 'grid' in form['layout']:\n types = [[2] + [1] * 4, [1] * 6, [1] ... | <|body_start_0|>
config = current_app.cea_config
dashboards = cea.plots.read_dashboards(config, current_app.plot_cache)
out = []
for d in dashboards:
out.append(dashboard_to_dict(d))
return out
<|end_body_0|>
<|body_start_1|>
form = api.payload
config... | Dashboards | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Dashboards:
def get(self):
"""Get list of Dashboards"""
<|body_0|>
def post(self):
"""Create Dashboard"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
config = current_app.cea_config
dashboards = cea.plots.read_dashboards(config, current_app... | stack_v2_sparse_classes_10k_train_007916 | 9,106 | permissive | [
{
"docstring": "Get list of Dashboards",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "Create Dashboard",
"name": "post",
"signature": "def post(self)"
}
] | 2 | null | Implement the Python class `Dashboards` described below.
Class description:
Implement the Dashboards class.
Method signatures and docstrings:
- def get(self): Get list of Dashboards
- def post(self): Create Dashboard | Implement the Python class `Dashboards` described below.
Class description:
Implement the Dashboards class.
Method signatures and docstrings:
- def get(self): Get list of Dashboards
- def post(self): Create Dashboard
<|skeleton|>
class Dashboards:
def get(self):
"""Get list of Dashboards"""
<|bo... | b84bcefdfdfc2bc0e009b5284b74391a957995ac | <|skeleton|>
class Dashboards:
def get(self):
"""Get list of Dashboards"""
<|body_0|>
def post(self):
"""Create Dashboard"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Dashboards:
def get(self):
"""Get list of Dashboards"""
config = current_app.cea_config
dashboards = cea.plots.read_dashboards(config, current_app.plot_cache)
out = []
for d in dashboards:
out.append(dashboard_to_dict(d))
return out
def post(sel... | the_stack_v2_python_sparse | cea/interfaces/dashboard/api/dashboard.py | architecture-building-systems/CityEnergyAnalyst | train | 166 | |
868fe3a2b8e740366c0faa1f3952fa2af1758f3a | [
"if HA is not None:\n self.HA = HA\nelse:\n self.HA = A\nself.A = np.mat(A)\nself.HA = np.mat(self.HA)\nself.d = np.mat(d)\nself.E = np.mat(E)\nself.ndim, self.nens = A.shape\nself.nobs = len(d)\nself.R = np.mat(np.diag(np.diag(1.0 / (self.nens - 1) * self.E * self.E.T)))",
"Dp = self.d + np.mean(self.E, ax... | <|body_start_0|>
if HA is not None:
self.HA = HA
else:
self.HA = A
self.A = np.mat(A)
self.HA = np.mat(self.HA)
self.d = np.mat(d)
self.E = np.mat(E)
self.ndim, self.nens = A.shape
self.nobs = len(d)
self.R = np.mat(np.diag(... | ENKF | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ENKF:
def __init__(self, A, HA, d, E):
"""Initialize Ensemble Kalman Filter object using a state matrix *A*, a predicted measurement matrix *HA*, an observation vector *d*, and an observation error covariance matrix *R*."""
<|body_0|>
def analysis(self, dists):
"""Pe... | stack_v2_sparse_classes_10k_train_007917 | 4,032 | permissive | [
{
"docstring": "Initialize Ensemble Kalman Filter object using a state matrix *A*, a predicted measurement matrix *HA*, an observation vector *d*, and an observation error covariance matrix *R*.",
"name": "__init__",
"signature": "def __init__(self, A, HA, d, E)"
},
{
"docstring": "Perform the a... | 2 | stack_v2_sparse_classes_30k_train_002617 | Implement the Python class `ENKF` described below.
Class description:
Implement the ENKF class.
Method signatures and docstrings:
- def __init__(self, A, HA, d, E): Initialize Ensemble Kalman Filter object using a state matrix *A*, a predicted measurement matrix *HA*, an observation vector *d*, and an observation err... | Implement the Python class `ENKF` described below.
Class description:
Implement the ENKF class.
Method signatures and docstrings:
- def __init__(self, A, HA, d, E): Initialize Ensemble Kalman Filter object using a state matrix *A*, a predicted measurement matrix *HA*, an observation vector *d*, and an observation err... | 27d0abcaeefd8760ce68e05e52905aea5f8f3a51 | <|skeleton|>
class ENKF:
def __init__(self, A, HA, d, E):
"""Initialize Ensemble Kalman Filter object using a state matrix *A*, a predicted measurement matrix *HA*, an observation vector *d*, and an observation error covariance matrix *R*."""
<|body_0|>
def analysis(self, dists):
"""Pe... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ENKF:
def __init__(self, A, HA, d, E):
"""Initialize Ensemble Kalman Filter object using a state matrix *A*, a predicted measurement matrix *HA*, an observation vector *d*, and an observation error covariance matrix *R*."""
if HA is not None:
self.HA = HA
else:
... | the_stack_v2_python_sparse | src/kalman.py | nasa/RHEAS | train | 88 | |
ad43c797f50b00bbdf820ecc6f9525399c45c97e | [
"self.rects = rects\nself.range = []\nsum = 0\nfor x1, y1, x2, y2 in rects:\n sum += (x2 - x1 + 1) * (y2 - y1 + 1)\n self.range.append(sum)",
"n = random.randint(0, self.range[-1] - 1)\ni = bisect.bisect(self.range, n) - 1\nx1, y1, x2, y2 = self.rects[i]\nn -= self.range[i]\nreturn [x1 + n % (x2 - x1 + 1), ... | <|body_start_0|>
self.rects = rects
self.range = []
sum = 0
for x1, y1, x2, y2 in rects:
sum += (x2 - x1 + 1) * (y2 - y1 + 1)
self.range.append(sum)
<|end_body_0|>
<|body_start_1|>
n = random.randint(0, self.range[-1] - 1)
i = bisect.bisect(self.r... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def __init__(self, rects):
""":type rects: List[List[int]]"""
<|body_0|>
def pick(self):
""":rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.rects = rects
self.range = []
sum = 0
for x1, y1, x2... | stack_v2_sparse_classes_10k_train_007918 | 982 | no_license | [
{
"docstring": ":type rects: List[List[int]]",
"name": "__init__",
"signature": "def __init__(self, rects)"
},
{
"docstring": ":rtype: List[int]",
"name": "pick",
"signature": "def pick(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002841 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, rects): :type rects: List[List[int]]
- def pick(self): :rtype: List[int] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, rects): :type rects: List[List[int]]
- def pick(self): :rtype: List[int]
<|skeleton|>
class Solution:
def __init__(self, rects):
""":type rects: ... | 63faf361cd4eefe0f6f1e50c49ea22577a75ea74 | <|skeleton|>
class Solution:
def __init__(self, rects):
""":type rects: List[List[int]]"""
<|body_0|>
def pick(self):
""":rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def __init__(self, rects):
""":type rects: List[List[int]]"""
self.rects = rects
self.range = []
sum = 0
for x1, y1, x2, y2 in rects:
sum += (x2 - x1 + 1) * (y2 - y1 + 1)
self.range.append(sum)
def pick(self):
""":rtype: Li... | the_stack_v2_python_sparse | leetcode/RandomPointinNon-overlappingRectangles/a.py | iamslash/learntocode | train | 7 | |
bbe542760a5fab2b6860dfa2cfd2b2daf83330ba | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\ntry:\n mapping_value = parse_node.get_child_node('@odata.type').get_str_value()\nexcept AttributeError:\n mapping_value = None\nif mapping_value and mapping_value.casefold() == '#microsoft.graph.taskFileAttachment'.casefold():\n from .... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
try:
mapping_value = parse_node.get_child_node('@odata.type').get_str_value()
except AttributeError:
mapping_value = None
if mapping_value and mapping_value.casefold() ==... | AttachmentBase | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AttachmentBase:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AttachmentBase:
"""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 Retur... | stack_v2_sparse_classes_10k_train_007919 | 3,410 | 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: AttachmentBase",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_valu... | 3 | stack_v2_sparse_classes_30k_train_001949 | Implement the Python class `AttachmentBase` described below.
Class description:
Implement the AttachmentBase class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AttachmentBase: Creates a new instance of the appropriate class based on discriminator va... | Implement the Python class `AttachmentBase` described below.
Class description:
Implement the AttachmentBase class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AttachmentBase: Creates a new instance of the appropriate class based on discriminator va... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class AttachmentBase:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AttachmentBase:
"""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 Retur... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AttachmentBase:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AttachmentBase:
"""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: Attachment... | the_stack_v2_python_sparse | msgraph/generated/models/attachment_base.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
074723f526b205c1a680fccc6c0c61f2f2fc7011 | [
"certPath = '..\\\\testCerts\\\\caBasicConstNotCrit.pem'\nlint_basic_constraints_not_critical.init()\nwith open(certPath, 'rb') as f:\n cert = x509.load_pem_x509_certificate(f.read(), default_backend())\n out = base.Lints['e_basic_constraints_not_critical'].Execute(cert)\n self.assertEqual(base.LintStatus.... | <|body_start_0|>
certPath = '..\\testCerts\\caBasicConstNotCrit.pem'
lint_basic_constraints_not_critical.init()
with open(certPath, 'rb') as f:
cert = x509.load_pem_x509_certificate(f.read(), default_backend())
out = base.Lints['e_basic_constraints_not_critical'].Execute(... | Test lint_basic_constraints_not_critical.py | test_lint_basic_constraints_not_critical | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class test_lint_basic_constraints_not_critical:
"""Test lint_basic_constraints_not_critical.py"""
def test_BasicConstNotCrit(self):
"""Test BasicConstNotCrit"""
<|body_0|>
def test_BasicConstCrit(self):
"""Test lint_basic_constraints_critical.py"""
<|body_1|>
... | stack_v2_sparse_classes_10k_train_007920 | 1,324 | no_license | [
{
"docstring": "Test BasicConstNotCrit",
"name": "test_BasicConstNotCrit",
"signature": "def test_BasicConstNotCrit(self)"
},
{
"docstring": "Test lint_basic_constraints_critical.py",
"name": "test_BasicConstCrit",
"signature": "def test_BasicConstCrit(self)"
}
] | 2 | null | Implement the Python class `test_lint_basic_constraints_not_critical` described below.
Class description:
Test lint_basic_constraints_not_critical.py
Method signatures and docstrings:
- def test_BasicConstNotCrit(self): Test BasicConstNotCrit
- def test_BasicConstCrit(self): Test lint_basic_constraints_critical.py | Implement the Python class `test_lint_basic_constraints_not_critical` described below.
Class description:
Test lint_basic_constraints_not_critical.py
Method signatures and docstrings:
- def test_BasicConstNotCrit(self): Test BasicConstNotCrit
- def test_BasicConstCrit(self): Test lint_basic_constraints_critical.py
<... | c7e7ca27e5d04bbaa4e7ad71d8e86ec5c9388987 | <|skeleton|>
class test_lint_basic_constraints_not_critical:
"""Test lint_basic_constraints_not_critical.py"""
def test_BasicConstNotCrit(self):
"""Test BasicConstNotCrit"""
<|body_0|>
def test_BasicConstCrit(self):
"""Test lint_basic_constraints_critical.py"""
<|body_1|>
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class test_lint_basic_constraints_not_critical:
"""Test lint_basic_constraints_not_critical.py"""
def test_BasicConstNotCrit(self):
"""Test BasicConstNotCrit"""
certPath = '..\\testCerts\\caBasicConstNotCrit.pem'
lint_basic_constraints_not_critical.init()
with open(certPath, 'rb... | the_stack_v2_python_sparse | testlints/test_lint_basic_constraints_not_critical.py | 846468230/Plint | train | 1 |
11475faad8630a53794bddbb026a9bcedc1d8f2b | [
"data = self.get_json()\nwith self.Session() as session:\n run_id = post_observing_run(data, self.associated_user_object.id, session)\n return self.success(data={'id': run_id})",
"with self.Session() as session:\n if run_id is not None:\n options = [joinedload(ObservingRun.assignments).joinedload(... | <|body_start_0|>
data = self.get_json()
with self.Session() as session:
run_id = post_observing_run(data, self.associated_user_object.id, session)
return self.success(data={'id': run_id})
<|end_body_0|>
<|body_start_1|>
with self.Session() as session:
if run_... | ObservingRunHandler | [
"BSD-3-Clause",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ObservingRunHandler:
def post(self):
"""--- description: Add a new observing run tags: - observing_runs requestBody: content: application/json: schema: ObservingRunPost responses: 200: content: application/json: schema: allOf: - $ref: '#/components/schemas/Success' - type: object propert... | stack_v2_sparse_classes_10k_train_007921 | 8,999 | permissive | [
{
"docstring": "--- description: Add a new observing run tags: - observing_runs requestBody: content: application/json: schema: ObservingRunPost responses: 200: content: application/json: schema: allOf: - $ref: '#/components/schemas/Success' - type: object properties: data: type: object properties: id: type: in... | 4 | null | Implement the Python class `ObservingRunHandler` described below.
Class description:
Implement the ObservingRunHandler class.
Method signatures and docstrings:
- def post(self): --- description: Add a new observing run tags: - observing_runs requestBody: content: application/json: schema: ObservingRunPost responses: ... | Implement the Python class `ObservingRunHandler` described below.
Class description:
Implement the ObservingRunHandler class.
Method signatures and docstrings:
- def post(self): --- description: Add a new observing run tags: - observing_runs requestBody: content: application/json: schema: ObservingRunPost responses: ... | 161d3532ba3ba059446addcdac58ca96f39e9636 | <|skeleton|>
class ObservingRunHandler:
def post(self):
"""--- description: Add a new observing run tags: - observing_runs requestBody: content: application/json: schema: ObservingRunPost responses: 200: content: application/json: schema: allOf: - $ref: '#/components/schemas/Success' - type: object propert... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ObservingRunHandler:
def post(self):
"""--- description: Add a new observing run tags: - observing_runs requestBody: content: application/json: schema: ObservingRunPost responses: 200: content: application/json: schema: allOf: - $ref: '#/components/schemas/Success' - type: object properties: data: typ... | the_stack_v2_python_sparse | skyportal/handlers/api/observingrun.py | skyportal/skyportal | train | 80 | |
68d0fef31cabf173e2c550d0d890103ae32e8051 | [
"tape = s\npattern = p\nm = len(tape)\nn = len(pattern)\ndp = [[False for _ in xrange(n + 1)] for _ in xrange(m + 1)]\ndp[m][n] = True\nfor j in xrange(n - 1, -1, -1):\n if pattern[j] == '*':\n dp[m][j] = dp[m][j + 1]\nfor i in xrange(m - 1, -1, -1):\n for j in xrange(n - 1, -1, -1):\n if tape[i... | <|body_start_0|>
tape = s
pattern = p
m = len(tape)
n = len(pattern)
dp = [[False for _ in xrange(n + 1)] for _ in xrange(m + 1)]
dp[m][n] = True
for j in xrange(n - 1, -1, -1):
if pattern[j] == '*':
dp[m][j] = dp[m][j + 1]
for ... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isMatch_MLE(self, s, p):
"""dp, similar to 011 Regular Expression Matching. Backward dp but Memory Limit Exceeds :param s: tape, an input string :param p: pattern, a pattern string :return: boolean"""
<|body_0|>
def isMatch_forward(self, s, p):
""""?" i... | stack_v2_sparse_classes_10k_train_007922 | 3,437 | permissive | [
{
"docstring": "dp, similar to 011 Regular Expression Matching. Backward dp but Memory Limit Exceeds :param s: tape, an input string :param p: pattern, a pattern string :return: boolean",
"name": "isMatch_MLE",
"signature": "def isMatch_MLE(self, s, p)"
},
{
"docstring": "\"?\" is not the proble... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isMatch_MLE(self, s, p): dp, similar to 011 Regular Expression Matching. Backward dp but Memory Limit Exceeds :param s: tape, an input string :param p: pattern, a pattern str... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isMatch_MLE(self, s, p): dp, similar to 011 Regular Expression Matching. Backward dp but Memory Limit Exceeds :param s: tape, an input string :param p: pattern, a pattern str... | cbbd4a67ab342ada2421e13f82d660b1d47d4d20 | <|skeleton|>
class Solution:
def isMatch_MLE(self, s, p):
"""dp, similar to 011 Regular Expression Matching. Backward dp but Memory Limit Exceeds :param s: tape, an input string :param p: pattern, a pattern string :return: boolean"""
<|body_0|>
def isMatch_forward(self, s, p):
""""?" i... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def isMatch_MLE(self, s, p):
"""dp, similar to 011 Regular Expression Matching. Backward dp but Memory Limit Exceeds :param s: tape, an input string :param p: pattern, a pattern string :return: boolean"""
tape = s
pattern = p
m = len(tape)
n = len(pattern)
... | the_stack_v2_python_sparse | 043 Wildcard Matching.py | Aminaba123/LeetCode | train | 1 | |
78d14cf55078c93108950c6e5aef9377914cdd2b | [
"if root:\n head, tail = self.helper(root)\n return head\nreturn None",
"head, tail = (root, root)\nif root.left:\n lh, lt = self.helper(root.left)\n lt.right = root\n root.left = lt\n head = lh\nif root.right:\n rh, rt = self.helper(root.right)\n rh.left = root\n root.right = rh\n t... | <|body_start_0|>
if root:
head, tail = self.helper(root)
return head
return None
<|end_body_0|>
<|body_start_1|>
head, tail = (root, root)
if root.left:
lh, lt = self.helper(root.left)
lt.right = root
root.left = lt
... | Solution3 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution3:
def treeToDoublyList(self, root):
""":type root: Node :rtype: Node"""
<|body_0|>
def helper(self, root):
"""Idea: Construct a DLL for each subtree, then return the head and tail"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if root:
... | stack_v2_sparse_classes_10k_train_007923 | 3,060 | no_license | [
{
"docstring": ":type root: Node :rtype: Node",
"name": "treeToDoublyList",
"signature": "def treeToDoublyList(self, root)"
},
{
"docstring": "Idea: Construct a DLL for each subtree, then return the head and tail",
"name": "helper",
"signature": "def helper(self, root)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001152 | Implement the Python class `Solution3` described below.
Class description:
Implement the Solution3 class.
Method signatures and docstrings:
- def treeToDoublyList(self, root): :type root: Node :rtype: Node
- def helper(self, root): Idea: Construct a DLL for each subtree, then return the head and tail | Implement the Python class `Solution3` described below.
Class description:
Implement the Solution3 class.
Method signatures and docstrings:
- def treeToDoublyList(self, root): :type root: Node :rtype: Node
- def helper(self, root): Idea: Construct a DLL for each subtree, then return the head and tail
<|skeleton|>
cl... | 11d6bf2ba7b50c07e048df37c4e05c8f46b92241 | <|skeleton|>
class Solution3:
def treeToDoublyList(self, root):
""":type root: Node :rtype: Node"""
<|body_0|>
def helper(self, root):
"""Idea: Construct a DLL for each subtree, then return the head and tail"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution3:
def treeToDoublyList(self, root):
""":type root: Node :rtype: Node"""
if root:
head, tail = self.helper(root)
return head
return None
def helper(self, root):
"""Idea: Construct a DLL for each subtree, then return the head and tail"""
... | the_stack_v2_python_sparse | LeetCodes/facebook/Convert Binary SearchTreetoSortedDoublyLinkedList.py | chutianwen/LeetCodes | train | 0 | |
49d717a463fe1aa2aba56a457a609fd5ef28eaef | [
"question = 'What language did you first learn to speak?'\nmy_survey = AnonymousSurvey(question)\nmy_survey.store_response('English')\nself.assertIn('English', my_survey.responses)",
"question = 'What language did you first learn to speak?'\nmy_survey = AnonymousSurvey(question)\nresponses = ['English', 'German',... | <|body_start_0|>
question = 'What language did you first learn to speak?'
my_survey = AnonymousSurvey(question)
my_survey.store_response('English')
self.assertIn('English', my_survey.responses)
<|end_body_0|>
<|body_start_1|>
question = 'What language did you first learn to spea... | Test for class AnonymousSurvey. | TestAnonymousSurvey | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestAnonymousSurvey:
"""Test for class AnonymousSurvey."""
def test_store_single_response(self):
"""Test that a single response is stored."""
<|body_0|>
def test_store_three_responses(self):
"""Test that 3 individual responses are stored properly."""
<|bo... | stack_v2_sparse_classes_10k_train_007924 | 912 | no_license | [
{
"docstring": "Test that a single response is stored.",
"name": "test_store_single_response",
"signature": "def test_store_single_response(self)"
},
{
"docstring": "Test that 3 individual responses are stored properly.",
"name": "test_store_three_responses",
"signature": "def test_store... | 2 | stack_v2_sparse_classes_30k_test_000380 | Implement the Python class `TestAnonymousSurvey` described below.
Class description:
Test for class AnonymousSurvey.
Method signatures and docstrings:
- def test_store_single_response(self): Test that a single response is stored.
- def test_store_three_responses(self): Test that 3 individual responses are stored prop... | Implement the Python class `TestAnonymousSurvey` described below.
Class description:
Test for class AnonymousSurvey.
Method signatures and docstrings:
- def test_store_single_response(self): Test that a single response is stored.
- def test_store_three_responses(self): Test that 3 individual responses are stored prop... | 0cacfab443d3eeeb274836b7be4b7205585f7758 | <|skeleton|>
class TestAnonymousSurvey:
"""Test for class AnonymousSurvey."""
def test_store_single_response(self):
"""Test that a single response is stored."""
<|body_0|>
def test_store_three_responses(self):
"""Test that 3 individual responses are stored properly."""
<|bo... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestAnonymousSurvey:
"""Test for class AnonymousSurvey."""
def test_store_single_response(self):
"""Test that a single response is stored."""
question = 'What language did you first learn to speak?'
my_survey = AnonymousSurvey(question)
my_survey.store_response('English')
... | the_stack_v2_python_sparse | Code Testing/test_survey.py | Ebyy/python_projects | train | 0 |
02c9455b9ced6587aea128fcb2ef9e56e6742474 | [
"if n < 3:\n return n\nif n in self.caches:\n return self.caches[n]\nself.caches[n] = self.climbStairs(n - 2) + self.climbStairs(n - 1)\nreturn self.caches[n]",
"if n < 3:\n return n\ndp = {1: 1, 2: 2}\nfor i in range(3, n + 1):\n dp[i] = dp[i - 2] + dp[i + 1]\nreturn dp[n]"
] | <|body_start_0|>
if n < 3:
return n
if n in self.caches:
return self.caches[n]
self.caches[n] = self.climbStairs(n - 2) + self.climbStairs(n - 1)
return self.caches[n]
<|end_body_0|>
<|body_start_1|>
if n < 3:
return n
dp = {1: 1, 2: 2... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def climbStairs(self, n: int) -> int:
"""递归+缓存"""
<|body_0|>
def climbStairs2(self, n: int) -> int:
"""动态规划"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if n < 3:
return n
if n in self.caches:
return self... | stack_v2_sparse_classes_10k_train_007925 | 650 | no_license | [
{
"docstring": "递归+缓存",
"name": "climbStairs",
"signature": "def climbStairs(self, n: int) -> int"
},
{
"docstring": "动态规划",
"name": "climbStairs2",
"signature": "def climbStairs2(self, n: int) -> int"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def climbStairs(self, n: int) -> int: 递归+缓存
- def climbStairs2(self, n: int) -> int: 动态规划 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def climbStairs(self, n: int) -> int: 递归+缓存
- def climbStairs2(self, n: int) -> int: 动态规划
<|skeleton|>
class Solution:
def climbStairs(self, n: int) -> int:
"""递归+缓... | f564806bd8e18831eeb20f2fd4bdd2d4aaa829ce | <|skeleton|>
class Solution:
def climbStairs(self, n: int) -> int:
"""递归+缓存"""
<|body_0|>
def climbStairs2(self, n: int) -> int:
"""动态规划"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def climbStairs(self, n: int) -> int:
"""递归+缓存"""
if n < 3:
return n
if n in self.caches:
return self.caches[n]
self.caches[n] = self.climbStairs(n - 2) + self.climbStairs(n - 1)
return self.caches[n]
def climbStairs2(self, n: int)... | the_stack_v2_python_sparse | Week 02/id_169/LeetCode_70_169.py | cboopen/algorithm004-04 | train | 2 | |
4d3b08e31bf040e50a28556fb0d8863e3b4c16a4 | [
"if self.GUI.machinefamily.lower().startswith('scroll'):\n return True\nelse:\n return False",
"chunk = []\nfor line in self.injection_panel.Lines:\n l = {}\n l['Length'] = float(line.Lval.GetValue())\n l['ID'] = float(line.IDval.GetValue())\n State = line.state.GetState()\n l['inletState'] =... | <|body_start_0|>
if self.GUI.machinefamily.lower().startswith('scroll'):
return True
else:
return False
<|end_body_0|>
<|body_start_1|>
chunk = []
for line in self.injection_panel.Lines:
l = {}
l['Length'] = float(line.Lval.GetValue())
... | A plugin that adds the injection ports for the scroll compressor | ScrollInjectionPlugin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ScrollInjectionPlugin:
"""A plugin that adds the injection ports for the scroll compressor"""
def should_enable(self):
"""Only enable if it is a scroll type compressor"""
<|body_0|>
def get_config_chunk(self):
"""The chunk for the configuration file"""
<|... | stack_v2_sparse_classes_10k_train_007926 | 40,548 | permissive | [
{
"docstring": "Only enable if it is a scroll type compressor",
"name": "should_enable",
"signature": "def should_enable(self)"
},
{
"docstring": "The chunk for the configuration file",
"name": "get_config_chunk",
"signature": "def get_config_chunk(self)"
},
{
"docstring": "Calle... | 4 | stack_v2_sparse_classes_30k_train_000852 | Implement the Python class `ScrollInjectionPlugin` described below.
Class description:
A plugin that adds the injection ports for the scroll compressor
Method signatures and docstrings:
- def should_enable(self): Only enable if it is a scroll type compressor
- def get_config_chunk(self): The chunk for the configurati... | Implement the Python class `ScrollInjectionPlugin` described below.
Class description:
A plugin that adds the injection ports for the scroll compressor
Method signatures and docstrings:
- def should_enable(self): Only enable if it is a scroll type compressor
- def get_config_chunk(self): The chunk for the configurati... | 2e33166fdbb3b868a196607c3d06de54e429824d | <|skeleton|>
class ScrollInjectionPlugin:
"""A plugin that adds the injection ports for the scroll compressor"""
def should_enable(self):
"""Only enable if it is a scroll type compressor"""
<|body_0|>
def get_config_chunk(self):
"""The chunk for the configuration file"""
<|... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ScrollInjectionPlugin:
"""A plugin that adds the injection ports for the scroll compressor"""
def should_enable(self):
"""Only enable if it is a scroll type compressor"""
if self.GUI.machinefamily.lower().startswith('scroll'):
return True
else:
return False... | the_stack_v2_python_sparse | GUI/plugins/scroll_plugins.py | ibell/pdsim | train | 36 |
b7a6264e14f9614ad5c5c272e7f574593d8532fd | [
"zeroList = []\nfor i in range(len(nums) - 2):\n for j in range(i + 1, len(nums) - 1):\n for k in range(j + 1, len(nums)):\n if nums[i] + nums[j] + nums[k] == 0:\n numList = (nums[i], nums[j], nums[k])\n if sorted(numList) not in zeroList:\n zero... | <|body_start_0|>
zeroList = []
for i in range(len(nums) - 2):
for j in range(i + 1, len(nums) - 1):
for k in range(j + 1, len(nums)):
if nums[i] + nums[j] + nums[k] == 0:
numList = (nums[i], nums[j], nums[k])
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def threeSum_naive(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_0|>
def threeSum(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
zeroList = []
... | stack_v2_sparse_classes_10k_train_007927 | 1,788 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: List[List[int]]",
"name": "threeSum_naive",
"signature": "def threeSum_naive(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: List[List[int]]",
"name": "threeSum",
"signature": "def threeSum(self, nums)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def threeSum_naive(self, nums): :type nums: List[int] :rtype: List[List[int]]
- def threeSum(self, nums): :type nums: List[int] :rtype: List[List[int]] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def threeSum_naive(self, nums): :type nums: List[int] :rtype: List[List[int]]
- def threeSum(self, nums): :type nums: List[int] :rtype: List[List[int]]
<|skeleton|>
class Soluti... | 786075e0f9f61cf062703bc0b41cc3191d77f033 | <|skeleton|>
class Solution:
def threeSum_naive(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_0|>
def threeSum(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def threeSum_naive(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
zeroList = []
for i in range(len(nums) - 2):
for j in range(i + 1, len(nums) - 1):
for k in range(j + 1, len(nums)):
if nums[i] + nums[j] + nums... | the_stack_v2_python_sparse | 15_threeSum.py | Anirban2404/LeetCodePractice | train | 1 | |
7f4a2f60ea0ad967752870abea028f98b29fa970 | [
"if root is None:\n return '[]'\nnodes = [root]\ni = 0\nwhile i < len(nodes):\n if nodes[i]:\n nodes.append(nodes[i].left)\n nodes.append(nodes[i].right)\n i += 1\nwhile nodes[-1] is None:\n nodes.pop()\nreturn '[' + ','.join((str(node.val) if node else 'null' for node in nodes)) + ']'",
... | <|body_start_0|>
if root is None:
return '[]'
nodes = [root]
i = 0
while i < len(nodes):
if nodes[i]:
nodes.append(nodes[i].left)
nodes.append(nodes[i].right)
i += 1
while nodes[-1] is None:
nodes.pop... | Codec | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_10k_train_007928 | 1,605 | permissive | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | stack_v2_sparse_classes_30k_train_005239 | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | 4ddea0a532fe7c5d053ffbd6870174ec99fc2d60 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
if root is None:
return '[]'
nodes = [root]
i = 0
while i < len(nodes):
if nodes[i]:
nodes.append(nodes[i].left)
... | the_stack_v2_python_sparse | 0201-0300/0297-Serialize and Deserialize Binary Tree/0297-Serialize and Deserialize Binary Tree.py | jiadaizhao/LeetCode | train | 52 | |
087cce9d7e4e757cf3f97bfd605b87a958f43831 | [
"self.str_path = os.path.dirname(os.path.abspath(__file__))\nself.list_pdf = list_pdf\nself.str_name = '%s\\\\files\\\\%s.pdf' % (self.str_path, str_name)\nself.bool_is_custom_color = bool_is_custom_color\nself.int_font_size = int_font_size\nself.float_offset_x = float_offset_x\nself.float_offset_y = float_offset_y... | <|body_start_0|>
self.str_path = os.path.dirname(os.path.abspath(__file__))
self.list_pdf = list_pdf
self.str_name = '%s\\files\\%s.pdf' % (self.str_path, str_name)
self.bool_is_custom_color = bool_is_custom_color
self.int_font_size = int_font_size
self.float_offset_x = f... | PDF类 | PDF | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PDF:
"""PDF类"""
def __init__(self, list_pdf: list, str_name: str, bool_is_custom_color: bool=False, tulpe_color: tuple=(0.77, 0.77, 0.77), int_font_size: int=18, float_offset_x: float=5, float_offset_y: float=5):
"""【初始化】 list_pdf:保存的内容 str_name:保存的文件名"""
<|body_0|>
def ... | stack_v2_sparse_classes_10k_train_007929 | 1,938 | no_license | [
{
"docstring": "【初始化】 list_pdf:保存的内容 str_name:保存的文件名",
"name": "__init__",
"signature": "def __init__(self, list_pdf: list, str_name: str, bool_is_custom_color: bool=False, tulpe_color: tuple=(0.77, 0.77, 0.77), int_font_size: int=18, float_offset_x: float=5, float_offset_y: float=5)"
},
{
"docs... | 2 | stack_v2_sparse_classes_30k_train_001809 | Implement the Python class `PDF` described below.
Class description:
PDF类
Method signatures and docstrings:
- def __init__(self, list_pdf: list, str_name: str, bool_is_custom_color: bool=False, tulpe_color: tuple=(0.77, 0.77, 0.77), int_font_size: int=18, float_offset_x: float=5, float_offset_y: float=5): 【初始化】 list_... | Implement the Python class `PDF` described below.
Class description:
PDF类
Method signatures and docstrings:
- def __init__(self, list_pdf: list, str_name: str, bool_is_custom_color: bool=False, tulpe_color: tuple=(0.77, 0.77, 0.77), int_font_size: int=18, float_offset_x: float=5, float_offset_y: float=5): 【初始化】 list_... | bd7152899dcb04aa76ed9f65b36e6a8ccc0affd0 | <|skeleton|>
class PDF:
"""PDF类"""
def __init__(self, list_pdf: list, str_name: str, bool_is_custom_color: bool=False, tulpe_color: tuple=(0.77, 0.77, 0.77), int_font_size: int=18, float_offset_x: float=5, float_offset_y: float=5):
"""【初始化】 list_pdf:保存的内容 str_name:保存的文件名"""
<|body_0|>
def ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PDF:
"""PDF类"""
def __init__(self, list_pdf: list, str_name: str, bool_is_custom_color: bool=False, tulpe_color: tuple=(0.77, 0.77, 0.77), int_font_size: int=18, float_offset_x: float=5, float_offset_y: float=5):
"""【初始化】 list_pdf:保存的内容 str_name:保存的文件名"""
self.str_path = os.path.dirname(o... | the_stack_v2_python_sparse | part03/week01/pdf.py | tea8336/test | train | 0 |
694c38324e3bf23b4398aefe1d0871af5e873463 | [
"if stack:\n node = stack.pop()\n if node.right:\n node = node.right\n stack.append(node)\n while node.left:\n node = node.left\n stack.append(node)\n else:\n while stack and stack[-1].val < node.val:\n stack.pop()\n return stack[-1] if stack ... | <|body_start_0|>
if stack:
node = stack.pop()
if node.right:
node = node.right
stack.append(node)
while node.left:
node = node.left
stack.append(node)
else:
while stack and... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def _nextGT(self, stack):
"""find node with smallest value > stack[-1].val."""
<|body_0|>
def inorderSuccessor(self, root: TreeNode, p: TreeNode) -> TreeNode:
"""Q0272, inorder predecessor and successor."""
<|body_1|>
<|end_skeleton|>
<|body_start... | stack_v2_sparse_classes_10k_train_007930 | 921 | no_license | [
{
"docstring": "find node with smallest value > stack[-1].val.",
"name": "_nextGT",
"signature": "def _nextGT(self, stack)"
},
{
"docstring": "Q0272, inorder predecessor and successor.",
"name": "inorderSuccessor",
"signature": "def inorderSuccessor(self, root: TreeNode, p: TreeNode) -> ... | 2 | stack_v2_sparse_classes_30k_train_005008 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _nextGT(self, stack): find node with smallest value > stack[-1].val.
- def inorderSuccessor(self, root: TreeNode, p: TreeNode) -> TreeNode: Q0272, inorder predecessor and suc... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _nextGT(self, stack): find node with smallest value > stack[-1].val.
- def inorderSuccessor(self, root: TreeNode, p: TreeNode) -> TreeNode: Q0272, inorder predecessor and suc... | 6043134736452a6f4704b62857d0aed2e9571164 | <|skeleton|>
class Solution:
def _nextGT(self, stack):
"""find node with smallest value > stack[-1].val."""
<|body_0|>
def inorderSuccessor(self, root: TreeNode, p: TreeNode) -> TreeNode:
"""Q0272, inorder predecessor and successor."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def _nextGT(self, stack):
"""find node with smallest value > stack[-1].val."""
if stack:
node = stack.pop()
if node.right:
node = node.right
stack.append(node)
while node.left:
node = node.lef... | the_stack_v2_python_sparse | src/0200-0299/0285.inorder.successor.bst.py | gyang274/leetcode | train | 1 | |
68e64a0b50e48ffba72ec442b8031f578f210cea | [
"params = dict(((key, val) for key, val in request.QUERY_PARAMS.iteritems()))\nparams['tag_id'] = tag_id\nparams['image_id'] = image_id\nparams['tag_group_id'] = tag_group_id\nparams['gene_link_id'] = gene_link_id\nform = SingleGetForm(params)\nif not form.is_valid():\n raise BadRequestException()\nreturn Respon... | <|body_start_0|>
params = dict(((key, val) for key, val in request.QUERY_PARAMS.iteritems()))
params['tag_id'] = tag_id
params['image_id'] = image_id
params['tag_group_id'] = tag_group_id
params['gene_link_id'] = gene_link_id
form = SingleGetForm(params)
if not fo... | Class for rendering the view for getting a GeneLink, deleting a GeneLink and updating a GeneLink. | GeneLinkSingle | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GeneLinkSingle:
"""Class for rendering the view for getting a GeneLink, deleting a GeneLink and updating a GeneLink."""
def get(self, request, image_id, tag_group_id, tag_id, gene_link_id):
"""Method for getting multiple GeneLinks either through search or general listing."""
... | stack_v2_sparse_classes_10k_train_007931 | 2,768 | no_license | [
{
"docstring": "Method for getting multiple GeneLinks either through search or general listing.",
"name": "get",
"signature": "def get(self, request, image_id, tag_group_id, tag_id, gene_link_id)"
},
{
"docstring": "Method for deleting a GeneLink.",
"name": "delete",
"signature": "def de... | 2 | stack_v2_sparse_classes_30k_test_000142 | Implement the Python class `GeneLinkSingle` described below.
Class description:
Class for rendering the view for getting a GeneLink, deleting a GeneLink and updating a GeneLink.
Method signatures and docstrings:
- def get(self, request, image_id, tag_group_id, tag_id, gene_link_id): Method for getting multiple GeneLi... | Implement the Python class `GeneLinkSingle` described below.
Class description:
Class for rendering the view for getting a GeneLink, deleting a GeneLink and updating a GeneLink.
Method signatures and docstrings:
- def get(self, request, image_id, tag_group_id, tag_id, gene_link_id): Method for getting multiple GeneLi... | 22c1ce3c5a8e4ed99c2f014672d60ad3c5a4003c | <|skeleton|>
class GeneLinkSingle:
"""Class for rendering the view for getting a GeneLink, deleting a GeneLink and updating a GeneLink."""
def get(self, request, image_id, tag_group_id, tag_id, gene_link_id):
"""Method for getting multiple GeneLinks either through search or general listing."""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GeneLinkSingle:
"""Class for rendering the view for getting a GeneLink, deleting a GeneLink and updating a GeneLink."""
def get(self, request, image_id, tag_group_id, tag_id, gene_link_id):
"""Method for getting multiple GeneLinks either through search or general listing."""
params = dict... | the_stack_v2_python_sparse | biodig/rest/v2/GeneLinks/views.py | asmariyaz23/BioDIG | train | 0 |
4680d7ec4bc549f26190f435f836c40f67c7d3ce | [
"from CortexCoreIR import handle_prevalence_command, Client\nmock_client = Client(base_url=f'{Core_URL}/xsiam/', headers={})\nmock_res = load_test_data('./test_data/prevalence_response.json')\nmocker.patch.object(mock_client, 'get_prevalence', return_value=mock_res.get('domain'))\nres = handle_prevalence_command(mo... | <|body_start_0|>
from CortexCoreIR import handle_prevalence_command, Client
mock_client = Client(base_url=f'{Core_URL}/xsiam/', headers={})
mock_res = load_test_data('./test_data/prevalence_response.json')
mocker.patch.object(mock_client, 'get_prevalence', return_value=mock_res.get('doma... | TestPrevalenceCommands | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestPrevalenceCommands:
def test_get_domain_analytics(self, mocker):
"""Given: - A domain name. When: - Calling handle_prevalence_command as part of core-get-domain-analytics-prevalence command. Then: - Verify response is as expected."""
<|body_0|>
def test_get_ip_analytics(... | stack_v2_sparse_classes_10k_train_007932 | 3,844 | permissive | [
{
"docstring": "Given: - A domain name. When: - Calling handle_prevalence_command as part of core-get-domain-analytics-prevalence command. Then: - Verify response is as expected.",
"name": "test_get_domain_analytics",
"signature": "def test_get_domain_analytics(self, mocker)"
},
{
"docstring": "... | 3 | null | Implement the Python class `TestPrevalenceCommands` described below.
Class description:
Implement the TestPrevalenceCommands class.
Method signatures and docstrings:
- def test_get_domain_analytics(self, mocker): Given: - A domain name. When: - Calling handle_prevalence_command as part of core-get-domain-analytics-pr... | Implement the Python class `TestPrevalenceCommands` described below.
Class description:
Implement the TestPrevalenceCommands class.
Method signatures and docstrings:
- def test_get_domain_analytics(self, mocker): Given: - A domain name. When: - Calling handle_prevalence_command as part of core-get-domain-analytics-pr... | 890def5a0e0ae8d6eaa538148249ddbc851dbb6b | <|skeleton|>
class TestPrevalenceCommands:
def test_get_domain_analytics(self, mocker):
"""Given: - A domain name. When: - Calling handle_prevalence_command as part of core-get-domain-analytics-prevalence command. Then: - Verify response is as expected."""
<|body_0|>
def test_get_ip_analytics(... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestPrevalenceCommands:
def test_get_domain_analytics(self, mocker):
"""Given: - A domain name. When: - Calling handle_prevalence_command as part of core-get-domain-analytics-prevalence command. Then: - Verify response is as expected."""
from CortexCoreIR import handle_prevalence_command, Clie... | the_stack_v2_python_sparse | Packs/Core/Integrations/CortexCoreIR/CortexCoreIR_test.py | demisto/content | train | 1,023 | |
3f26ecf96c363269480e66adb644c08f0860e6ec | [
"data = request.json\nnodeid = data.get('nodeid')\nreport = ExecuteTools.invoke(nodeid)\napp.logger.info(f'添加一条task,报告为{report},执行用例为{nodeid}')\ntask = Task(remark=nodeid, report=report)\ndb.session.add(task)\ndb.session.commit()\ndb.session.close()\nreturn {'error': 0, 'msg': 'ok'}",
"tasks = Task.query.all()\nt... | <|body_start_0|>
data = request.json
nodeid = data.get('nodeid')
report = ExecuteTools.invoke(nodeid)
app.logger.info(f'添加一条task,报告为{report},执行用例为{nodeid}')
task = Task(remark=nodeid, report=report)
db.session.add(task)
db.session.commit()
db.session.close... | TaskService | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TaskService:
def post(self):
"""1.调用jenkins执行用例 2.执行用例之后,写入执行记录到数据库表中 :return:"""
<|body_0|>
def get(self):
""":return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
data = request.json
nodeid = data.get('nodeid')
report = ExecuteT... | stack_v2_sparse_classes_10k_train_007933 | 1,578 | no_license | [
{
"docstring": "1.调用jenkins执行用例 2.执行用例之后,写入执行记录到数据库表中 :return:",
"name": "post",
"signature": "def post(self)"
},
{
"docstring": ":return:",
"name": "get",
"signature": "def get(self)"
}
] | 2 | stack_v2_sparse_classes_30k_val_000171 | Implement the Python class `TaskService` described below.
Class description:
Implement the TaskService class.
Method signatures and docstrings:
- def post(self): 1.调用jenkins执行用例 2.执行用例之后,写入执行记录到数据库表中 :return:
- def get(self): :return: | Implement the Python class `TaskService` described below.
Class description:
Implement the TaskService class.
Method signatures and docstrings:
- def post(self): 1.调用jenkins执行用例 2.执行用例之后,写入执行记录到数据库表中 :return:
- def get(self): :return:
<|skeleton|>
class TaskService:
def post(self):
"""1.调用jenkins执行用例 2.... | d32e4af68efc4eb935fe98d1f901f1408ed2e785 | <|skeleton|>
class TaskService:
def post(self):
"""1.调用jenkins执行用例 2.执行用例之后,写入执行记录到数据库表中 :return:"""
<|body_0|>
def get(self):
""":return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TaskService:
def post(self):
"""1.调用jenkins执行用例 2.执行用例之后,写入执行记录到数据库表中 :return:"""
data = request.json
nodeid = data.get('nodeid')
report = ExecuteTools.invoke(nodeid)
app.logger.info(f'添加一条task,报告为{report},执行用例为{nodeid}')
task = Task(remark=nodeid, report=report... | the_stack_v2_python_sparse | backend/apis/task.py | yangwei211/HogwartsSDET18 | train | 0 | |
e49f8b4b8a42f4d2a1848cb35511a9bf07a6f80a | [
"user_id = info.user_id\ndata = format_result(InfoAuthorize().query_auth_info(user_id))\nif data:\n data = [{k: '/aibus/' + v if k == 'take_photo' else v for k, v in auth.items()} for auth in data]\nreturn (ResponseCode.SUCCEED, '执行成功', data)",
"user_id = info.user_id\nauth_id = param.get('id')\ncreate_dt = da... | <|body_start_0|>
user_id = info.user_id
data = format_result(InfoAuthorize().query_auth_info(user_id))
if data:
data = [{k: '/aibus/' + v if k == 'take_photo' else v for k, v in auth.items()} for auth in data]
return (ResponseCode.SUCCEED, '执行成功', data)
<|end_body_0|>
<|body... | PickUpPersionService | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PickUpPersionService:
def get_pick_up_persion(self, info):
"""获取授权人列表"""
<|body_0|>
def drop_pick_up_persion(self, info, param):
"""删除授权人"""
<|body_1|>
def add_pick_up_persion(self, info, param, auth_photo):
"""增加授权人"""
<|body_2|>
<|end_... | stack_v2_sparse_classes_10k_train_007934 | 3,663 | no_license | [
{
"docstring": "获取授权人列表",
"name": "get_pick_up_persion",
"signature": "def get_pick_up_persion(self, info)"
},
{
"docstring": "删除授权人",
"name": "drop_pick_up_persion",
"signature": "def drop_pick_up_persion(self, info, param)"
},
{
"docstring": "增加授权人",
"name": "add_pick_up_pe... | 3 | stack_v2_sparse_classes_30k_train_002606 | Implement the Python class `PickUpPersionService` described below.
Class description:
Implement the PickUpPersionService class.
Method signatures and docstrings:
- def get_pick_up_persion(self, info): 获取授权人列表
- def drop_pick_up_persion(self, info, param): 删除授权人
- def add_pick_up_persion(self, info, param, auth_photo)... | Implement the Python class `PickUpPersionService` described below.
Class description:
Implement the PickUpPersionService class.
Method signatures and docstrings:
- def get_pick_up_persion(self, info): 获取授权人列表
- def drop_pick_up_persion(self, info, param): 删除授权人
- def add_pick_up_persion(self, info, param, auth_photo)... | a7cf5a0b6daa372ed860dc43d92c55fcde764eb9 | <|skeleton|>
class PickUpPersionService:
def get_pick_up_persion(self, info):
"""获取授权人列表"""
<|body_0|>
def drop_pick_up_persion(self, info, param):
"""删除授权人"""
<|body_1|>
def add_pick_up_persion(self, info, param, auth_photo):
"""增加授权人"""
<|body_2|>
<|end_... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PickUpPersionService:
def get_pick_up_persion(self, info):
"""获取授权人列表"""
user_id = info.user_id
data = format_result(InfoAuthorize().query_auth_info(user_id))
if data:
data = [{k: '/aibus/' + v if k == 'take_photo' else v for k, v in auth.items()} for auth in data]
... | the_stack_v2_python_sparse | python_project/smart_schoolBus_project/app/sys/pick_up_persion/service.py | malqch/aibus | train | 0 | |
c99bf13de4fbee66cb3a560cb3943d311b88bb78 | [
"if k < 0:\n return 0\ndset = set()\ncnt = set()\nfor i in range(len(nums)):\n pexpect = nums[i] + k\n mexpect = nums[i] - k\n if pexpect in dset:\n cnt.add(tuple(sorted([nums[i]] + [pexpect])))\n if mexpect in dset:\n cnt.add(tuple(sorted([nums[i]] + [mexpect])))\n dset.add(nums[i])... | <|body_start_0|>
if k < 0:
return 0
dset = set()
cnt = set()
for i in range(len(nums)):
pexpect = nums[i] + k
mexpect = nums[i] - k
if pexpect in dset:
cnt.add(tuple(sorted([nums[i]] + [pexpect])))
if mexpect in ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findPairs(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_0|>
def rewrite(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if k < 0:
... | stack_v2_sparse_classes_10k_train_007935 | 2,455 | no_license | [
{
"docstring": ":type nums: List[int] :type k: int :rtype: int",
"name": "findPairs",
"signature": "def findPairs(self, nums, k)"
},
{
"docstring": ":type nums: List[int] :type k: int :rtype: int",
"name": "rewrite",
"signature": "def rewrite(self, nums, k)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findPairs(self, nums, k): :type nums: List[int] :type k: int :rtype: int
- def rewrite(self, nums, k): :type nums: List[int] :type k: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findPairs(self, nums, k): :type nums: List[int] :type k: int :rtype: int
- def rewrite(self, nums, k): :type nums: List[int] :type k: int :rtype: int
<|skeleton|>
class Solu... | 6350568d16b0f8c49a020f055bb6d72e2705ea56 | <|skeleton|>
class Solution:
def findPairs(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_0|>
def rewrite(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def findPairs(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
if k < 0:
return 0
dset = set()
cnt = set()
for i in range(len(nums)):
pexpect = nums[i] + k
mexpect = nums[i] - k
if pexpect in ... | the_stack_v2_python_sparse | array/532_K-diff_Pairs_in_an_Array.py | vsdrun/lc_public | train | 6 | |
2aace7ec2a1d782fe06fa9af7a513096ce942b13 | [
"super().__init__(results, best_results, options, group_dir, pp_locations, table_name)\nself.name = 'acc'\nself.has_pp = True\nself.pp_filenames = [os.path.relpath(self.pp_locations[0], group_dir)]\nself.cbar_title = 'Problem-Specific Cell Shading: Relative Accuracy'",
"rel_value = result.norm_acc\nabs_value = re... | <|body_start_0|>
super().__init__(results, best_results, options, group_dir, pp_locations, table_name)
self.name = 'acc'
self.has_pp = True
self.pp_filenames = [os.path.relpath(self.pp_locations[0], group_dir)]
self.cbar_title = 'Problem-Specific Cell Shading: Relative Accuracy'
... | The accuracy results are calculated by evaluating the cost function with the fitted parameters. | AccTable | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AccTable:
"""The accuracy results are calculated by evaluating the cost function with the fitted parameters."""
def __init__(self, results, best_results, options, group_dir, pp_locations, table_name):
"""Initialise the accuracy table which shows the chi_sq results :param results: Res... | stack_v2_sparse_classes_10k_train_007936 | 2,227 | permissive | [
{
"docstring": "Initialise the accuracy table which shows the chi_sq results :param results: Results grouped by row and category (for colouring) :type results: dict[str, dict[str, list[utils.fitbm_result.FittingResult]]] :param best_results: The best results from each row/category :type best_results: dict[str, ... | 2 | stack_v2_sparse_classes_30k_train_001491 | Implement the Python class `AccTable` described below.
Class description:
The accuracy results are calculated by evaluating the cost function with the fitted parameters.
Method signatures and docstrings:
- def __init__(self, results, best_results, options, group_dir, pp_locations, table_name): Initialise the accuracy... | Implement the Python class `AccTable` described below.
Class description:
The accuracy results are calculated by evaluating the cost function with the fitted parameters.
Method signatures and docstrings:
- def __init__(self, results, best_results, options, group_dir, pp_locations, table_name): Initialise the accuracy... | 5ee7e66d963ebe9296c0a62c24b9616f6c65537e | <|skeleton|>
class AccTable:
"""The accuracy results are calculated by evaluating the cost function with the fitted parameters."""
def __init__(self, results, best_results, options, group_dir, pp_locations, table_name):
"""Initialise the accuracy table which shows the chi_sq results :param results: Res... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AccTable:
"""The accuracy results are calculated by evaluating the cost function with the fitted parameters."""
def __init__(self, results, best_results, options, group_dir, pp_locations, table_name):
"""Initialise the accuracy table which shows the chi_sq results :param results: Results grouped ... | the_stack_v2_python_sparse | fitbenchmarking/results_processing/acc_table.py | fitbenchmarking/fitbenchmarking | train | 15 |
69a7db37f552a29e804b6bdf8cd3878c590c8602 | [
"_LOGGER.debug('Enable sentry mode: %s', self.name)\nawait self.tesla_device.enable_sentry_mode()\nself.async_write_ha_state()",
"_LOGGER.debug('Disable sentry mode: %s', self.name)\nawait self.tesla_device.disable_sentry_mode()\nself.async_write_ha_state()",
"if self.tesla_device.is_on() is None:\n return N... | <|body_start_0|>
_LOGGER.debug('Enable sentry mode: %s', self.name)
await self.tesla_device.enable_sentry_mode()
self.async_write_ha_state()
<|end_body_0|>
<|body_start_1|>
_LOGGER.debug('Disable sentry mode: %s', self.name)
await self.tesla_device.disable_sentry_mode()
... | Representation of a Tesla sentry mode switch. | SentryModeSwitch | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SentryModeSwitch:
"""Representation of a Tesla sentry mode switch."""
async def async_turn_on(self, **kwargs):
"""Send the on command."""
<|body_0|>
async def async_turn_off(self, **kwargs):
"""Send the off command."""
<|body_1|>
def is_on(self):
... | stack_v2_sparse_classes_10k_train_007937 | 4,636 | permissive | [
{
"docstring": "Send the on command.",
"name": "async_turn_on",
"signature": "async def async_turn_on(self, **kwargs)"
},
{
"docstring": "Send the off command.",
"name": "async_turn_off",
"signature": "async def async_turn_off(self, **kwargs)"
},
{
"docstring": "Get whether the s... | 3 | null | Implement the Python class `SentryModeSwitch` described below.
Class description:
Representation of a Tesla sentry mode switch.
Method signatures and docstrings:
- async def async_turn_on(self, **kwargs): Send the on command.
- async def async_turn_off(self, **kwargs): Send the off command.
- def is_on(self): Get whe... | Implement the Python class `SentryModeSwitch` described below.
Class description:
Representation of a Tesla sentry mode switch.
Method signatures and docstrings:
- async def async_turn_on(self, **kwargs): Send the on command.
- async def async_turn_off(self, **kwargs): Send the off command.
- def is_on(self): Get whe... | 2fee32fce03bc49e86cf2e7b741a15621a97cce5 | <|skeleton|>
class SentryModeSwitch:
"""Representation of a Tesla sentry mode switch."""
async def async_turn_on(self, **kwargs):
"""Send the on command."""
<|body_0|>
async def async_turn_off(self, **kwargs):
"""Send the off command."""
<|body_1|>
def is_on(self):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SentryModeSwitch:
"""Representation of a Tesla sentry mode switch."""
async def async_turn_on(self, **kwargs):
"""Send the on command."""
_LOGGER.debug('Enable sentry mode: %s', self.name)
await self.tesla_device.enable_sentry_mode()
self.async_write_ha_state()
async ... | the_stack_v2_python_sparse | homeassistant/components/tesla/switch.py | BenWoodford/home-assistant | train | 11 |
93c6af025c29077888dda20465fa3c674ecdd5c4 | [
"for col in self.columns:\n if lower(col.type) == 'geometry':\n return col",
"for col in self.columns:\n col = col.column\n if col.is_geomref():\n return col"
] | <|body_start_0|>
for col in self.columns:
if lower(col.type) == 'geometry':
return col
<|end_body_0|>
<|body_start_1|>
for col in self.columns:
col = col.column
if col.is_geomref():
return col
<|end_body_1|>
| Describes a physical table in our database. These should *never* be instantiated manually. They are automatically created by :meth:`~.tasks.TableTask.output`. The unique key is :attr:~.meta.OBSTable.id:. .. py:attribute:: id The unique identifier for this table. Is always qualified by the module name of the class that ... | OBSTable | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OBSTable:
"""Describes a physical table in our database. These should *never* be instantiated manually. They are automatically created by :meth:`~.tasks.TableTask.output`. The unique key is :attr:~.meta.OBSTable.id:. .. py:attribute:: id The unique identifier for this table. Is always qualified b... | stack_v2_sparse_classes_10k_train_007938 | 38,974 | permissive | [
{
"docstring": "Return the column geometry column for this table, if it has one. Returns None if there is none.",
"name": "geom_column",
"signature": "def geom_column(self)"
},
{
"docstring": "Return the geomref column for this table, if it has one. Returns None if there is none.",
"name": "... | 2 | stack_v2_sparse_classes_30k_train_004648 | Implement the Python class `OBSTable` described below.
Class description:
Describes a physical table in our database. These should *never* be instantiated manually. They are automatically created by :meth:`~.tasks.TableTask.output`. The unique key is :attr:~.meta.OBSTable.id:. .. py:attribute:: id The unique identifie... | Implement the Python class `OBSTable` described below.
Class description:
Describes a physical table in our database. These should *never* be instantiated manually. They are automatically created by :meth:`~.tasks.TableTask.output`. The unique key is :attr:~.meta.OBSTable.id:. .. py:attribute:: id The unique identifie... | a32325382500f23b8a607e4e02cc0ec111360869 | <|skeleton|>
class OBSTable:
"""Describes a physical table in our database. These should *never* be instantiated manually. They are automatically created by :meth:`~.tasks.TableTask.output`. The unique key is :attr:~.meta.OBSTable.id:. .. py:attribute:: id The unique identifier for this table. Is always qualified b... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class OBSTable:
"""Describes a physical table in our database. These should *never* be instantiated manually. They are automatically created by :meth:`~.tasks.TableTask.output`. The unique key is :attr:~.meta.OBSTable.id:. .. py:attribute:: id The unique identifier for this table. Is always qualified by the module ... | the_stack_v2_python_sparse | tasks/meta.py | CartoDB/bigmetadata | train | 45 |
8b40ec1c8eeb6791438e2dc7605bbcc62cd94ba3 | [
"if value in validators.EMPTY_VALUES:\n return {}\nelif not isinstance(value, dict):\n raise ValidationError(self.error_messages['invalid_value'], code='invalid_value')\nreturn value",
"if not set(value.keys()) <= {k for k, _ in self.choices}:\n raise ValidationError(self.error_messages['invalid_choice']... | <|body_start_0|>
if value in validators.EMPTY_VALUES:
return {}
elif not isinstance(value, dict):
raise ValidationError(self.error_messages['invalid_value'], code='invalid_value')
return value
<|end_body_0|>
<|body_start_1|>
if not set(value.keys()) <= {k for k, ... | A multiple choice checkbox field where checkboxes has three states. States are: - Checked - Unchecked - Indeterminate It takes a ``dict`` instance as a value, where keys are internal values from `choices` and values are ones from following (in order respectively to states): - True - False - None | TriStateMultipleChoiceField | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TriStateMultipleChoiceField:
"""A multiple choice checkbox field where checkboxes has three states. States are: - Checked - Unchecked - Indeterminate It takes a ``dict`` instance as a value, where keys are internal values from `choices` and values are ones from following (in order respectively to... | stack_v2_sparse_classes_10k_train_007939 | 2,623 | permissive | [
{
"docstring": "Checks if value, that comes from widget, is a dict.",
"name": "to_python",
"signature": "def to_python(self, value)"
},
{
"docstring": "Ensures that value has only allowed values.",
"name": "validate",
"signature": "def validate(self, value)"
}
] | 2 | stack_v2_sparse_classes_30k_test_000122 | Implement the Python class `TriStateMultipleChoiceField` described below.
Class description:
A multiple choice checkbox field where checkboxes has three states. States are: - Checked - Unchecked - Indeterminate It takes a ``dict`` instance as a value, where keys are internal values from `choices` and values are ones f... | Implement the Python class `TriStateMultipleChoiceField` described below.
Class description:
A multiple choice checkbox field where checkboxes has three states. States are: - Checked - Unchecked - Indeterminate It takes a ``dict`` instance as a value, where keys are internal values from `choices` and values are ones f... | 54e2ea8a71385b1c7624b3d2c8056bd8a2c2e2f7 | <|skeleton|>
class TriStateMultipleChoiceField:
"""A multiple choice checkbox field where checkboxes has three states. States are: - Checked - Unchecked - Indeterminate It takes a ``dict`` instance as a value, where keys are internal values from `choices` and values are ones from following (in order respectively to... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TriStateMultipleChoiceField:
"""A multiple choice checkbox field where checkboxes has three states. States are: - Checked - Unchecked - Indeterminate It takes a ``dict`` instance as a value, where keys are internal values from `choices` and values are ones from following (in order respectively to states): - T... | the_stack_v2_python_sparse | muranodashboard/common/fields.py | openstack/murano-dashboard | train | 38 |
693fd3732eed403f711a30592f0e608ed85eba5f | [
"try:\n return version_manager_api.get(pk)\nexcept exceptions.DoesNotExist:\n raise Http404",
"try:\n template_version_manager_object = self.get_object(pk)\n serializer = TemplateVersionManagerSerializer(template_version_manager_object)\n return Response(serializer.data)\nexcept Http404:\n conte... | <|body_start_0|>
try:
return version_manager_api.get(pk)
except exceptions.DoesNotExist:
raise Http404
<|end_body_0|>
<|body_start_1|>
try:
template_version_manager_object = self.get_object(pk)
serializer = TemplateVersionManagerSerializer(templat... | Retrieve a TemplateVersionManager | TemplateVersionManagerDetail | [
"LicenseRef-scancode-public-domain"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TemplateVersionManagerDetail:
"""Retrieve a TemplateVersionManager"""
def get_object(self, pk):
"""Get TemplateVersionManager from db Args: pk: ObjectId Returns: TemplateVersionManager"""
<|body_0|>
def get(self, request, pk):
"""Retrieve a TemplateVersionManager... | stack_v2_sparse_classes_10k_train_007940 | 9,786 | permissive | [
{
"docstring": "Get TemplateVersionManager from db Args: pk: ObjectId Returns: TemplateVersionManager",
"name": "get_object",
"signature": "def get_object(self, pk)"
},
{
"docstring": "Retrieve a TemplateVersionManager Args: request: HTTP request pk: ObjectId Returns: - code: 200 content: Templa... | 2 | stack_v2_sparse_classes_30k_train_006314 | Implement the Python class `TemplateVersionManagerDetail` described below.
Class description:
Retrieve a TemplateVersionManager
Method signatures and docstrings:
- def get_object(self, pk): Get TemplateVersionManager from db Args: pk: ObjectId Returns: TemplateVersionManager
- def get(self, request, pk): Retrieve a T... | Implement the Python class `TemplateVersionManagerDetail` described below.
Class description:
Retrieve a TemplateVersionManager
Method signatures and docstrings:
- def get_object(self, pk): Get TemplateVersionManager from db Args: pk: ObjectId Returns: TemplateVersionManager
- def get(self, request, pk): Retrieve a T... | 568cb75a40ccff1d74a1a757866112535efd769a | <|skeleton|>
class TemplateVersionManagerDetail:
"""Retrieve a TemplateVersionManager"""
def get_object(self, pk):
"""Get TemplateVersionManager from db Args: pk: ObjectId Returns: TemplateVersionManager"""
<|body_0|>
def get(self, request, pk):
"""Retrieve a TemplateVersionManager... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TemplateVersionManagerDetail:
"""Retrieve a TemplateVersionManager"""
def get_object(self, pk):
"""Get TemplateVersionManager from db Args: pk: ObjectId Returns: TemplateVersionManager"""
try:
return version_manager_api.get(pk)
except exceptions.DoesNotExist:
... | the_stack_v2_python_sparse | core_main_app/rest/template_version_manager/views.py | adilmania/core_main_app | train | 0 |
ad73eac64076004763219edc238d4f2ddc727d01 | [
"def is_matched(left, right):\n if not left and (not right):\n return True\n if not left or not right:\n return False\n if left.val != right.val:\n return False\n return is_matched(left.left, right.right) and is_matched(left.right, right.left)\nif not root:\n return True\nreturn ... | <|body_start_0|>
def is_matched(left, right):
if not left and (not right):
return True
if not left or not right:
return False
if left.val != right.val:
return False
return is_matched(left.left, right.right) and is_ma... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isSymmetric(self, root):
""":type root: TreeNode :rtype: bool"""
<|body_0|>
def isSymmetric_iterative(self, root):
""":type root: TreeNode :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
def is_matched(left, right):
... | stack_v2_sparse_classes_10k_train_007941 | 2,214 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: bool",
"name": "isSymmetric",
"signature": "def isSymmetric(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: bool",
"name": "isSymmetric_iterative",
"signature": "def isSymmetric_iterative(self, root)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006969 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isSymmetric(self, root): :type root: TreeNode :rtype: bool
- def isSymmetric_iterative(self, root): :type root: TreeNode :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isSymmetric(self, root): :type root: TreeNode :rtype: bool
- def isSymmetric_iterative(self, root): :type root: TreeNode :rtype: bool
<|skeleton|>
class Solution:
def i... | e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59 | <|skeleton|>
class Solution:
def isSymmetric(self, root):
""":type root: TreeNode :rtype: bool"""
<|body_0|>
def isSymmetric_iterative(self, root):
""":type root: TreeNode :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def isSymmetric(self, root):
""":type root: TreeNode :rtype: bool"""
def is_matched(left, right):
if not left and (not right):
return True
if not left or not right:
return False
if left.val != right.val:
... | the_stack_v2_python_sparse | src/lt_101.py | oxhead/CodingYourWay | train | 0 | |
3d9dc77d88d2360fce6af24e7d1c211d9afa31d2 | [
"self.training_tasks = {}\nself.mutex = threading.Lock()\nself.garbage_collector()",
"if project_id in self.training_tasks:\n raise ProjectAlreadyTraining\nself.mutex.acquire()\ntask = TrainingTask(project_id=project_id)\nself.training_tasks[project_id] = task\ntask.start()\nself.mutex.release()",
"self.mute... | <|body_start_0|>
self.training_tasks = {}
self.mutex = threading.Lock()
self.garbage_collector()
<|end_body_0|>
<|body_start_1|>
if project_id in self.training_tasks:
raise ProjectAlreadyTraining
self.mutex.acquire()
task = TrainingTask(project_id=project_id)... | TrainingManager. | TrainingManager | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TrainingManager:
"""TrainingManager."""
def __init__(self):
"""__init__."""
<|body_0|>
def add(self, project_id):
"""add. Add a project in training tasks."""
<|body_1|>
def get_task_by_id(self, project_id):
"""get_task_by_id."""
<|bod... | stack_v2_sparse_classes_10k_train_007942 | 27,143 | permissive | [
{
"docstring": "__init__.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "add. Add a project in training tasks.",
"name": "add",
"signature": "def add(self, project_id)"
},
{
"docstring": "get_task_by_id.",
"name": "get_task_by_id",
"signature":... | 4 | stack_v2_sparse_classes_30k_train_003207 | Implement the Python class `TrainingManager` described below.
Class description:
TrainingManager.
Method signatures and docstrings:
- def __init__(self): __init__.
- def add(self, project_id): add. Add a project in training tasks.
- def get_task_by_id(self, project_id): get_task_by_id.
- def garbage_collector(self): ... | Implement the Python class `TrainingManager` described below.
Class description:
TrainingManager.
Method signatures and docstrings:
- def __init__(self): __init__.
- def add(self, project_id): add. Add a project in training tasks.
- def get_task_by_id(self, project_id): get_task_by_id.
- def garbage_collector(self): ... | 1d2f42cbf9f21157c1e1abf044b26160dfed5b16 | <|skeleton|>
class TrainingManager:
"""TrainingManager."""
def __init__(self):
"""__init__."""
<|body_0|>
def add(self, project_id):
"""add. Add a project in training tasks."""
<|body_1|>
def get_task_by_id(self, project_id):
"""get_task_by_id."""
<|bod... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TrainingManager:
"""TrainingManager."""
def __init__(self):
"""__init__."""
self.training_tasks = {}
self.mutex = threading.Lock()
self.garbage_collector()
def add(self, project_id):
"""add. Add a project in training tasks."""
if project_id in self.tra... | the_stack_v2_python_sparse | factory-ai-vision/EdgeSolution/modules/WebModule/backend/vision_on_edge/azure_projects/utils.py | Azure-Samples/azure-intelligent-edge-patterns | train | 193 |
315911396961d52916c19292d41ac6fd4a565761 | [
"head1 = self.build_list(nums1)\nhead2 = self.build_list(nums2)\np1 = head1\np2 = head2\nres = []\nwhile p1 and p2:\n if p1.val < p2.val:\n p2 = p2.next\n elif p1.val > p2.val:\n p1 = p1.next\n else:\n res.append(p1.val)\n p1 = p1.next\n p2 = p2.next\nreturn res",
"dumm... | <|body_start_0|>
head1 = self.build_list(nums1)
head2 = self.build_list(nums2)
p1 = head1
p2 = head2
res = []
while p1 and p2:
if p1.val < p2.val:
p2 = p2.next
elif p1.val > p2.val:
p1 = p1.next
else:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def func(self, nums1, nums2):
"""Args: nums1: list[int] nums2: list[int] Return: list[int]"""
<|body_0|>
def build_list(self, nums):
"""Args: nums: list[int] Return: ListNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
head1 = self.bui... | stack_v2_sparse_classes_10k_train_007943 | 1,263 | no_license | [
{
"docstring": "Args: nums1: list[int] nums2: list[int] Return: list[int]",
"name": "func",
"signature": "def func(self, nums1, nums2)"
},
{
"docstring": "Args: nums: list[int] Return: ListNode",
"name": "build_list",
"signature": "def build_list(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004692 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def func(self, nums1, nums2): Args: nums1: list[int] nums2: list[int] Return: list[int]
- def build_list(self, nums): Args: nums: list[int] Return: ListNode | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def func(self, nums1, nums2): Args: nums1: list[int] nums2: list[int] Return: list[int]
- def build_list(self, nums): Args: nums: list[int] Return: ListNode
<|skeleton|>
class S... | 101bce2fac8b188a4eb2f5e017293d21ad0ecb21 | <|skeleton|>
class Solution:
def func(self, nums1, nums2):
"""Args: nums1: list[int] nums2: list[int] Return: list[int]"""
<|body_0|>
def build_list(self, nums):
"""Args: nums: list[int] Return: ListNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def func(self, nums1, nums2):
"""Args: nums1: list[int] nums2: list[int] Return: list[int]"""
head1 = self.build_list(nums1)
head2 = self.build_list(nums2)
p1 = head1
p2 = head2
res = []
while p1 and p2:
if p1.val < p2.val:
... | the_stack_v2_python_sparse | 秋招/腾讯/1.1.py | AiZhanghan/Leetcode | train | 0 | |
12a12f273fd81ab25d9cd1ffd45dfd660b37bec6 | [
"myThread = threading.currentThread()\nif logger is None:\n logger = myThread.logger\nif dbi is None:\n dbi = myThread.dbi\nDBCreator.__init__(self, logger, dbi)\nself.create['01wm_components'] = 'CREATE TABLE wm_components (\\n id INTEGER PRIMARY KEY AUTO_INCREMENT,\\n ... | <|body_start_0|>
myThread = threading.currentThread()
if logger is None:
logger = myThread.logger
if dbi is None:
dbi = myThread.dbi
DBCreator.__init__(self, logger, dbi)
self.create['01wm_components'] = 'CREATE TABLE wm_components (\n id ... | CreateAgentBase | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CreateAgentBase:
def __init__(self, logger=None, dbi=None, params=None):
"""_init_ Call the DBCreator constructor and create the list of required tables."""
<|body_0|>
def execute(self, conn=None, transaction=None):
"""_execute_ Check to make sure that all required t... | stack_v2_sparse_classes_10k_train_007944 | 2,495 | permissive | [
{
"docstring": "_init_ Call the DBCreator constructor and create the list of required tables.",
"name": "__init__",
"signature": "def __init__(self, logger=None, dbi=None, params=None)"
},
{
"docstring": "_execute_ Check to make sure that all required tables have been defined. If everything is i... | 2 | stack_v2_sparse_classes_30k_test_000302 | Implement the Python class `CreateAgentBase` described below.
Class description:
Implement the CreateAgentBase class.
Method signatures and docstrings:
- def __init__(self, logger=None, dbi=None, params=None): _init_ Call the DBCreator constructor and create the list of required tables.
- def execute(self, conn=None,... | Implement the Python class `CreateAgentBase` described below.
Class description:
Implement the CreateAgentBase class.
Method signatures and docstrings:
- def __init__(self, logger=None, dbi=None, params=None): _init_ Call the DBCreator constructor and create the list of required tables.
- def execute(self, conn=None,... | de110ccf6fc63ef5589b4e871ef4d51d5bce7a25 | <|skeleton|>
class CreateAgentBase:
def __init__(self, logger=None, dbi=None, params=None):
"""_init_ Call the DBCreator constructor and create the list of required tables."""
<|body_0|>
def execute(self, conn=None, transaction=None):
"""_execute_ Check to make sure that all required t... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CreateAgentBase:
def __init__(self, logger=None, dbi=None, params=None):
"""_init_ Call the DBCreator constructor and create the list of required tables."""
myThread = threading.currentThread()
if logger is None:
logger = myThread.logger
if dbi is None:
... | the_stack_v2_python_sparse | src/python/WMCore/Agent/Database/CreateAgentBase.py | vkuznet/WMCore | train | 0 | |
6100f1a09996674b67a958a7026ada368ae699fb | [
"nn.Module.__init__(self)\nself.eta = eta\nself.eps = eps",
"dist, _ = torch.min(torch.norm(c.unsqueeze(0) - input.unsqueeze(1), p=2, dim=2), dim=1)\nlosses = torch.where(semi_target == 0, dist ** 2, self.eta * (dist ** 2 + self.eps) ** semi_target.float())\nloss = torch.mean(losses)\nreturn loss"
] | <|body_start_0|>
nn.Module.__init__(self)
self.eta = eta
self.eps = eps
<|end_body_0|>
<|body_start_1|>
dist, _ = torch.min(torch.norm(c.unsqueeze(0) - input.unsqueeze(1), p=2, dim=2), dim=1)
losses = torch.where(semi_target == 0, dist ** 2, self.eta * (dist ** 2 + self.eps) ** ... | Implementation of the DMSAD loss inspired by Ghafoori et al. (2020) and Ruff et al. (2020) | DMSADLoss | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DMSADLoss:
"""Implementation of the DMSAD loss inspired by Ghafoori et al. (2020) and Ruff et al. (2020)"""
def __init__(self, eta, eps=1e-06):
"""Constructor of the DMSAD loss. ---------- INPUT |---- eta (float) control the importance given to known or unknonw | samples. 1.0 gives e... | stack_v2_sparse_classes_10k_train_007945 | 18,386 | permissive | [
{
"docstring": "Constructor of the DMSAD loss. ---------- INPUT |---- eta (float) control the importance given to known or unknonw | samples. 1.0 gives equal weights, <1.0 gives more weight | to the unknown samples, >1.0 gives more weight to the | known samples. |---- eps (float) epsilon to ensure numerical sta... | 2 | stack_v2_sparse_classes_30k_train_005750 | Implement the Python class `DMSADLoss` described below.
Class description:
Implementation of the DMSAD loss inspired by Ghafoori et al. (2020) and Ruff et al. (2020)
Method signatures and docstrings:
- def __init__(self, eta, eps=1e-06): Constructor of the DMSAD loss. ---------- INPUT |---- eta (float) control the im... | Implement the Python class `DMSADLoss` described below.
Class description:
Implementation of the DMSAD loss inspired by Ghafoori et al. (2020) and Ruff et al. (2020)
Method signatures and docstrings:
- def __init__(self, eta, eps=1e-06): Constructor of the DMSAD loss. ---------- INPUT |---- eta (float) control the im... | 850b6195d6290a50eee865b4d5a66f5db5260e8f | <|skeleton|>
class DMSADLoss:
"""Implementation of the DMSAD loss inspired by Ghafoori et al. (2020) and Ruff et al. (2020)"""
def __init__(self, eta, eps=1e-06):
"""Constructor of the DMSAD loss. ---------- INPUT |---- eta (float) control the importance given to known or unknonw | samples. 1.0 gives e... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DMSADLoss:
"""Implementation of the DMSAD loss inspired by Ghafoori et al. (2020) and Ruff et al. (2020)"""
def __init__(self, eta, eps=1e-06):
"""Constructor of the DMSAD loss. ---------- INPUT |---- eta (float) control the importance given to known or unknonw | samples. 1.0 gives equal weights,... | the_stack_v2_python_sparse | Code/src/models/optim/CustomLosses.py | antoine-spahr/X-ray-Anomaly-Detection | train | 3 |
597af2f7e4854d6bcc87f39f33903b4d05761478 | [
"if len(self._tags) < 1:\n return True\nelse:\n return False",
"self._create_debug_info('Parse tag definitions ...')\nwhile not self._end_reached:\n self._parse_tag_definitions()\n if self._parser.has_errors():\n break\n self._step_to_next_row()",
"container = ExcelMoleculeDesignPoolLayout... | <|body_start_0|>
if len(self._tags) < 1:
return True
else:
return False
<|end_body_0|>
<|body_start_1|>
self._create_debug_info('Parse tag definitions ...')
while not self._end_reached:
self._parse_tag_definitions()
if self._parser.has_err... | ParsingContainer subclass performing the single steps of the parsing and storing the intermediate information of an Excel sheet. The data is passed back to the parser as soon it is in a hierarchy that can be used for the creation of a experiment design object. | _ExperimentDesignSheetParsingContainer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _ExperimentDesignSheetParsingContainer:
"""ParsingContainer subclass performing the single steps of the parsing and storing the intermediate information of an Excel sheet. The data is passed back to the parser as soon it is in a hierarchy that can be used for the creation of a experiment design o... | stack_v2_sparse_classes_10k_train_007946 | 13,192 | permissive | [
{
"docstring": "If there are no tag definitions in the container, it is considered as empty.",
"name": "is_empty",
"signature": "def is_empty(self)"
},
{
"docstring": "Parses tags, values and codes (including associated tags) of a sheet and stores them as TagParsingContainer objects in the tags ... | 6 | stack_v2_sparse_classes_30k_val_000398 | Implement the Python class `_ExperimentDesignSheetParsingContainer` described below.
Class description:
ParsingContainer subclass performing the single steps of the parsing and storing the intermediate information of an Excel sheet. The data is passed back to the parser as soon it is in a hierarchy that can be used fo... | Implement the Python class `_ExperimentDesignSheetParsingContainer` described below.
Class description:
ParsingContainer subclass performing the single steps of the parsing and storing the intermediate information of an Excel sheet. The data is passed back to the parser as soon it is in a hierarchy that can be used fo... | d2dc7a478ee5d24ccf3cc680888e712d482321d0 | <|skeleton|>
class _ExperimentDesignSheetParsingContainer:
"""ParsingContainer subclass performing the single steps of the parsing and storing the intermediate information of an Excel sheet. The data is passed back to the parser as soon it is in a hierarchy that can be used for the creation of a experiment design o... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class _ExperimentDesignSheetParsingContainer:
"""ParsingContainer subclass performing the single steps of the parsing and storing the intermediate information of an Excel sheet. The data is passed back to the parser as soon it is in a hierarchy that can be used for the creation of a experiment design object."""
... | the_stack_v2_python_sparse | thelma/tools/parsers/experimentdesign.py | papagr/TheLMA | train | 1 |
9c870e22e42c5c0078f7df8cffeba3bbe3909b2b | [
"self.TransmitterObj = Transmitter(transmitter_config, tx_data, bypass)\nself.transmitter_config = self.TransmitterObj.transmitter_config\nself.tx_data_in = self.TransmitterObj.tx_data_in\nself.bypass = self.TransmitterObj.bypass\npass",
"self.assertIsInstance(self.transmitter_config, list)\nself.assertIsInstance... | <|body_start_0|>
self.TransmitterObj = Transmitter(transmitter_config, tx_data, bypass)
self.transmitter_config = self.TransmitterObj.transmitter_config
self.tx_data_in = self.TransmitterObj.tx_data_in
self.bypass = self.TransmitterObj.bypass
pass
<|end_body_0|>
<|body_start_1|>... | TestTransmitterTypes | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestTransmitterTypes:
def setUp(self):
"""Setup function TestTypes for class Transmitter"""
<|body_0|>
def test_types(self):
"""Function to test data types for class Transmitter"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.TransmitterObj = T... | stack_v2_sparse_classes_10k_train_007947 | 1,534 | permissive | [
{
"docstring": "Setup function TestTypes for class Transmitter",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Function to test data types for class Transmitter",
"name": "test_types",
"signature": "def test_types(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000014 | Implement the Python class `TestTransmitterTypes` described below.
Class description:
Implement the TestTransmitterTypes class.
Method signatures and docstrings:
- def setUp(self): Setup function TestTypes for class Transmitter
- def test_types(self): Function to test data types for class Transmitter | Implement the Python class `TestTransmitterTypes` described below.
Class description:
Implement the TestTransmitterTypes class.
Method signatures and docstrings:
- def setUp(self): Setup function TestTypes for class Transmitter
- def test_types(self): Function to test data types for class Transmitter
<|skeleton|>
cl... | 825a0eab64be709efe161b9a48eb54c4bc5c1bef | <|skeleton|>
class TestTransmitterTypes:
def setUp(self):
"""Setup function TestTypes for class Transmitter"""
<|body_0|>
def test_types(self):
"""Function to test data types for class Transmitter"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestTransmitterTypes:
def setUp(self):
"""Setup function TestTypes for class Transmitter"""
self.TransmitterObj = Transmitter(transmitter_config, tx_data, bypass)
self.transmitter_config = self.TransmitterObj.transmitter_config
self.tx_data_in = self.TransmitterObj.tx_data_in
... | the_stack_v2_python_sparse | VLC_devel/class_structure/__auto_gen__/test_Transmitter.py | wenh81/vlc_simulator | train | 0 | |
e87e76f7ef72eca5f9d5cce01c4ad563a654479d | [
"posts = Post.objects.all()\nposts = post_filter(request, posts)\nif type(posts) == Response:\n return posts\nreturn Response(PostSerializer(posts, many=True).data)",
"serializer = PostSerializerCreate(data=request.data, context={'request': request})\nif serializer.is_valid():\n serializer.save()\n retur... | <|body_start_0|>
posts = Post.objects.all()
posts = post_filter(request, posts)
if type(posts) == Response:
return posts
return Response(PostSerializer(posts, many=True).data)
<|end_body_0|>
<|body_start_1|>
serializer = PostSerializerCreate(data=request.data, contex... | PostView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PostView:
def get(request):
"""List posts"""
<|body_0|>
def post(request):
"""Create post"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
posts = Post.objects.all()
posts = post_filter(request, posts)
if type(posts) == Response:
... | stack_v2_sparse_classes_10k_train_007948 | 2,180 | permissive | [
{
"docstring": "List posts",
"name": "get",
"signature": "def get(request)"
},
{
"docstring": "Create post",
"name": "post",
"signature": "def post(request)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005970 | Implement the Python class `PostView` described below.
Class description:
Implement the PostView class.
Method signatures and docstrings:
- def get(request): List posts
- def post(request): Create post | Implement the Python class `PostView` described below.
Class description:
Implement the PostView class.
Method signatures and docstrings:
- def get(request): List posts
- def post(request): Create post
<|skeleton|>
class PostView:
def get(request):
"""List posts"""
<|body_0|>
def post(reque... | b93fa2fea8d45df9f19c3c58037e59dad4981921 | <|skeleton|>
class PostView:
def get(request):
"""List posts"""
<|body_0|>
def post(request):
"""Create post"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PostView:
def get(request):
"""List posts"""
posts = Post.objects.all()
posts = post_filter(request, posts)
if type(posts) == Response:
return posts
return Response(PostSerializer(posts, many=True).data)
def post(request):
"""Create post"""
... | the_stack_v2_python_sparse | v1/posts/views/post.py | lawiz22/PLOUC-Backend-master | train | 0 | |
da76c9284ce7a56a474eba518ed805ea542c56f0 | [
"super().__init__()\nself.style = ''\nself.controller = controller\nself.assets_gui = assets_gui\nself.arch_diagram_gui = arch_diagram_gui\nself.technologies_gui = technologies_gui\nself.data_flow_diagram_gui = data_flow_diagram_gui\nself.entry_points_gui = entry_points_gui\nself.ranking_gui = ranking_gui\nself.ini... | <|body_start_0|>
super().__init__()
self.style = ''
self.controller = controller
self.assets_gui = assets_gui
self.arch_diagram_gui = arch_diagram_gui
self.technologies_gui = technologies_gui
self.data_flow_diagram_gui = data_flow_diagram_gui
self.entry_po... | Deals with module gui which is generated from ThreatModel data | ThreatModelGui | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ThreatModelGui:
"""Deals with module gui which is generated from ThreatModel data"""
def __init__(self, controller, assets_gui, arch_diagram_gui, technologies_gui, data_flow_diagram_gui, entry_points_gui, ranking_gui):
"""Init"""
<|body_0|>
def initUI(self):
"""F... | stack_v2_sparse_classes_10k_train_007949 | 3,689 | no_license | [
{
"docstring": "Init",
"name": "__init__",
"signature": "def __init__(self, controller, assets_gui, arch_diagram_gui, technologies_gui, data_flow_diagram_gui, entry_points_gui, ranking_gui)"
},
{
"docstring": "Function to move GUI creation from __init__",
"name": "initUI",
"signature": "... | 2 | stack_v2_sparse_classes_30k_train_001455 | Implement the Python class `ThreatModelGui` described below.
Class description:
Deals with module gui which is generated from ThreatModel data
Method signatures and docstrings:
- def __init__(self, controller, assets_gui, arch_diagram_gui, technologies_gui, data_flow_diagram_gui, entry_points_gui, ranking_gui): Init
... | Implement the Python class `ThreatModelGui` described below.
Class description:
Deals with module gui which is generated from ThreatModel data
Method signatures and docstrings:
- def __init__(self, controller, assets_gui, arch_diagram_gui, technologies_gui, data_flow_diagram_gui, entry_points_gui, ranking_gui): Init
... | be32512d6d098a123599b2ac8f032bd003c28f63 | <|skeleton|>
class ThreatModelGui:
"""Deals with module gui which is generated from ThreatModel data"""
def __init__(self, controller, assets_gui, arch_diagram_gui, technologies_gui, data_flow_diagram_gui, entry_points_gui, ranking_gui):
"""Init"""
<|body_0|>
def initUI(self):
"""F... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ThreatModelGui:
"""Deals with module gui which is generated from ThreatModel data"""
def __init__(self, controller, assets_gui, arch_diagram_gui, technologies_gui, data_flow_diagram_gui, entry_points_gui, ranking_gui):
"""Init"""
super().__init__()
self.style = ''
self.con... | the_stack_v2_python_sparse | iotpentool/threatmodelgui.py | sarunasil/iotPenTool | train | 0 |
2e561cd0a00a555cb425bf3af86598d3b1d59830 | [
"item_dict = {}\nfor attribute_obj in attributes(cls.meta_.entity_cls).values():\n if isinstance(attribute_obj, Reference):\n item_dict[attribute_obj.relation.attribute_name] = attribute_obj.relation.value\n else:\n item_dict[attribute_obj.attribute_name] = getattr(entity, attribute_obj.attribut... | <|body_start_0|>
item_dict = {}
for attribute_obj in attributes(cls.meta_.entity_cls).values():
if isinstance(attribute_obj, Reference):
item_dict[attribute_obj.relation.attribute_name] = attribute_obj.relation.value
else:
item_dict[attribute_obj.a... | A model for the Elasticsearch index | ElasticsearchModel | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ElasticsearchModel:
"""A model for the Elasticsearch index"""
def from_entity(cls, entity) -> 'ElasticsearchModel':
"""Convert the entity to a Elasticsearch record"""
<|body_0|>
def to_entity(cls, item: 'ElasticsearchModel'):
"""Convert the elasticsearch document... | stack_v2_sparse_classes_10k_train_007950 | 21,821 | permissive | [
{
"docstring": "Convert the entity to a Elasticsearch record",
"name": "from_entity",
"signature": "def from_entity(cls, entity) -> 'ElasticsearchModel'"
},
{
"docstring": "Convert the elasticsearch document to an entity",
"name": "to_entity",
"signature": "def to_entity(cls, item: 'Elas... | 2 | stack_v2_sparse_classes_30k_train_001043 | Implement the Python class `ElasticsearchModel` described below.
Class description:
A model for the Elasticsearch index
Method signatures and docstrings:
- def from_entity(cls, entity) -> 'ElasticsearchModel': Convert the entity to a Elasticsearch record
- def to_entity(cls, item: 'ElasticsearchModel'): Convert the e... | Implement the Python class `ElasticsearchModel` described below.
Class description:
A model for the Elasticsearch index
Method signatures and docstrings:
- def from_entity(cls, entity) -> 'ElasticsearchModel': Convert the entity to a Elasticsearch record
- def to_entity(cls, item: 'ElasticsearchModel'): Convert the e... | 60544e7a24757b7968c229343213807b0fcf6bc4 | <|skeleton|>
class ElasticsearchModel:
"""A model for the Elasticsearch index"""
def from_entity(cls, entity) -> 'ElasticsearchModel':
"""Convert the entity to a Elasticsearch record"""
<|body_0|>
def to_entity(cls, item: 'ElasticsearchModel'):
"""Convert the elasticsearch document... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ElasticsearchModel:
"""A model for the Elasticsearch index"""
def from_entity(cls, entity) -> 'ElasticsearchModel':
"""Convert the entity to a Elasticsearch record"""
item_dict = {}
for attribute_obj in attributes(cls.meta_.entity_cls).values():
if isinstance(attribute... | the_stack_v2_python_sparse | src/protean/adapters/repository/elasticsearch.py | proteanhq/protean | train | 9 |
607bedbda9ff4333f93798acbcd736421bfc7d29 | [
"classes = cls.action_classes(request_obj, model_cls, cls_options, method)\nall_actions = request_obj.has_url_param('actions', 'all')\nif not all_actions and include_link_actions:\n classes = [item for item in classes if item.LINK_ACTION]\ndata = {}\nfor item in classes:\n resolver['kwargs']['action'] = item.... | <|body_start_0|>
classes = cls.action_classes(request_obj, model_cls, cls_options, method)
all_actions = request_obj.has_url_param('actions', 'all')
if not all_actions and include_link_actions:
classes = [item for item in classes if item.LINK_ACTION]
data = {}
for ite... | Utility wrapper class for model actions. | ActionMapper | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ActionMapper:
"""Utility wrapper class for model actions."""
def serialize_actions(cls, request_obj, model_cls, cls_options, method, resolver, include_link_actions=False):
"""Serialize actions available for model or model item. Parameters ---------- request_obj Request object. model_... | stack_v2_sparse_classes_10k_train_007951 | 21,678 | permissive | [
{
"docstring": "Serialize actions available for model or model item. Parameters ---------- request_obj Request object. model_cls Model class for the request object. cls_options: List of action base classes for model and model item based action processing. method HTTP method. resolver URL resolver, should contai... | 3 | stack_v2_sparse_classes_30k_train_002412 | Implement the Python class `ActionMapper` described below.
Class description:
Utility wrapper class for model actions.
Method signatures and docstrings:
- def serialize_actions(cls, request_obj, model_cls, cls_options, method, resolver, include_link_actions=False): Serialize actions available for model or model item.... | Implement the Python class `ActionMapper` described below.
Class description:
Utility wrapper class for model actions.
Method signatures and docstrings:
- def serialize_actions(cls, request_obj, model_cls, cls_options, method, resolver, include_link_actions=False): Serialize actions available for model or model item.... | 3d3f5a53efe32c721c34d7e48267328a4e9e8402 | <|skeleton|>
class ActionMapper:
"""Utility wrapper class for model actions."""
def serialize_actions(cls, request_obj, model_cls, cls_options, method, resolver, include_link_actions=False):
"""Serialize actions available for model or model item. Parameters ---------- request_obj Request object. model_... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ActionMapper:
"""Utility wrapper class for model actions."""
def serialize_actions(cls, request_obj, model_cls, cls_options, method, resolver, include_link_actions=False):
"""Serialize actions available for model or model item. Parameters ---------- request_obj Request object. model_cls Model cla... | the_stack_v2_python_sparse | draalcore/rest/actions.py | jojanper/draalcore | train | 1 |
0465e6332722a08abf5b36a07b1aedbf3d444e19 | [
"queryset = models.Referral.objects.exclude(state=ReferralState.DRAFT).annotate(due_date=ExpressionWrapper(F('sent_at') + F('urgency_level__duration'), output_field=DateTimeField()))\nqueryset = queryset.annotate(is_user_related_unit_member=Exists(models.UnitMembership.objects.filter(unit=OuterRef('units'), user=se... | <|body_start_0|>
queryset = models.Referral.objects.exclude(state=ReferralState.DRAFT).annotate(due_date=ExpressionWrapper(F('sent_at') + F('urgency_level__duration'), output_field=DateTimeField()))
queryset = queryset.annotate(is_user_related_unit_member=Exists(models.UnitMembership.objects.filter(unit... | Return a list of referrals as a csv file to authenticated users. | ExportView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExportView:
"""Return a list of referrals as a csv file to authenticated users."""
def get_queryset(self):
"""fFilter referrals and return a ready-to-use queryset."""
<|body_0|>
def get(self, request):
"""Build and return the csv file"""
<|body_1|>
<|end... | stack_v2_sparse_classes_10k_train_007952 | 6,466 | permissive | [
{
"docstring": "fFilter referrals and return a ready-to-use queryset.",
"name": "get_queryset",
"signature": "def get_queryset(self)"
},
{
"docstring": "Build and return the csv file",
"name": "get",
"signature": "def get(self, request)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005640 | Implement the Python class `ExportView` described below.
Class description:
Return a list of referrals as a csv file to authenticated users.
Method signatures and docstrings:
- def get_queryset(self): fFilter referrals and return a ready-to-use queryset.
- def get(self, request): Build and return the csv file | Implement the Python class `ExportView` described below.
Class description:
Return a list of referrals as a csv file to authenticated users.
Method signatures and docstrings:
- def get_queryset(self): fFilter referrals and return a ready-to-use queryset.
- def get(self, request): Build and return the csv file
<|skel... | 22e4afa728a851bb4c2479fbb6f5944a75984b9b | <|skeleton|>
class ExportView:
"""Return a list of referrals as a csv file to authenticated users."""
def get_queryset(self):
"""fFilter referrals and return a ready-to-use queryset."""
<|body_0|>
def get(self, request):
"""Build and return the csv file"""
<|body_1|>
<|end... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ExportView:
"""Return a list of referrals as a csv file to authenticated users."""
def get_queryset(self):
"""fFilter referrals and return a ready-to-use queryset."""
queryset = models.Referral.objects.exclude(state=ReferralState.DRAFT).annotate(due_date=ExpressionWrapper(F('sent_at') + F... | the_stack_v2_python_sparse | src/backend/partaj/core/views/common.py | MTES-MCT/partaj | train | 4 |
8aefad83a67c0968fd41023c71f4436442cd5671 | [
"self.r = radius\nself.x = x_center\nself.y = y_center",
"r = self.r * random.random() ** 0.5\na = random.random() * 360.0\nreturn [self.x + r * math.cos(a), self.y + r * math.sin(a)]\nr = float('inf')\nwhile r > self.r:\n dx = (random.random() * 2 - 1) * self.r\n dy = (random.random() * 2 - 1) * self.r\n ... | <|body_start_0|>
self.r = radius
self.x = x_center
self.y = y_center
<|end_body_0|>
<|body_start_1|>
r = self.r * random.random() ** 0.5
a = random.random() * 360.0
return [self.x + r * math.cos(a), self.y + r * math.sin(a)]
r = float('inf')
while r > sel... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def __init__(self, radius, x_center, y_center):
""":type radius: float :type x_center: float :type y_center: float"""
<|body_0|>
def randPoint(self):
""":rtype: List[float]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.r = radius
... | stack_v2_sparse_classes_10k_train_007953 | 1,292 | no_license | [
{
"docstring": ":type radius: float :type x_center: float :type y_center: float",
"name": "__init__",
"signature": "def __init__(self, radius, x_center, y_center)"
},
{
"docstring": ":rtype: List[float]",
"name": "randPoint",
"signature": "def randPoint(self)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, radius, x_center, y_center): :type radius: float :type x_center: float :type y_center: float
- def randPoint(self): :rtype: List[float] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, radius, x_center, y_center): :type radius: float :type x_center: float :type y_center: float
- def randPoint(self): :rtype: List[float]
<|skeleton|>
class Sol... | 36d7f9e967a62db77622e0888f61999d7f37579a | <|skeleton|>
class Solution:
def __init__(self, radius, x_center, y_center):
""":type radius: float :type x_center: float :type y_center: float"""
<|body_0|>
def randPoint(self):
""":rtype: List[float]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def __init__(self, radius, x_center, y_center):
""":type radius: float :type x_center: float :type y_center: float"""
self.r = radius
self.x = x_center
self.y = y_center
def randPoint(self):
""":rtype: List[float]"""
r = self.r * random.random() *... | the_stack_v2_python_sparse | P0478.py | westgate458/LeetCode | train | 0 | |
5a6cc692df3673b87d7e413000aa34bd74a54ad5 | [
"super().__init__()\nlogger.debug('Create PaddleCLSConnectionHandler to process the cls request')\nself._inputs = OrderedDict()\nself._outputs = OrderedDict()\nself.cls_engine = cls_engine\nself.executor = self.cls_engine.executor\nself._conf = self.executor._conf\nself._label_list = self.executor._label_list\nself... | <|body_start_0|>
super().__init__()
logger.debug('Create PaddleCLSConnectionHandler to process the cls request')
self._inputs = OrderedDict()
self._outputs = OrderedDict()
self.cls_engine = cls_engine
self.executor = self.cls_engine.executor
self._conf = self.exec... | PaddleCLSConnectionHandler | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PaddleCLSConnectionHandler:
def __init__(self, cls_engine):
"""The PaddleSpeech CLS Server Connection Handler This connection process every cls server request Args: cls_engine (CLSEngine): The CLS engine"""
<|body_0|>
def run(self, audio_data):
"""engine run Args: au... | stack_v2_sparse_classes_10k_train_007954 | 7,010 | permissive | [
{
"docstring": "The PaddleSpeech CLS Server Connection Handler This connection process every cls server request Args: cls_engine (CLSEngine): The CLS engine",
"name": "__init__",
"signature": "def __init__(self, cls_engine)"
},
{
"docstring": "engine run Args: audio_data (bytes): base64.b64decod... | 3 | null | Implement the Python class `PaddleCLSConnectionHandler` described below.
Class description:
Implement the PaddleCLSConnectionHandler class.
Method signatures and docstrings:
- def __init__(self, cls_engine): The PaddleSpeech CLS Server Connection Handler This connection process every cls server request Args: cls_engi... | Implement the Python class `PaddleCLSConnectionHandler` described below.
Class description:
Implement the PaddleCLSConnectionHandler class.
Method signatures and docstrings:
- def __init__(self, cls_engine): The PaddleSpeech CLS Server Connection Handler This connection process every cls server request Args: cls_engi... | 17854a04d43c231eff66bfed9d6aa55e94a29e79 | <|skeleton|>
class PaddleCLSConnectionHandler:
def __init__(self, cls_engine):
"""The PaddleSpeech CLS Server Connection Handler This connection process every cls server request Args: cls_engine (CLSEngine): The CLS engine"""
<|body_0|>
def run(self, audio_data):
"""engine run Args: au... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PaddleCLSConnectionHandler:
def __init__(self, cls_engine):
"""The PaddleSpeech CLS Server Connection Handler This connection process every cls server request Args: cls_engine (CLSEngine): The CLS engine"""
super().__init__()
logger.debug('Create PaddleCLSConnectionHandler to process t... | the_stack_v2_python_sparse | paddlespeech/server/engine/cls/paddleinference/cls_engine.py | anniyanvr/DeepSpeech-1 | train | 0 | |
ad1d4f8077bb0ef986bd01297158670b6a6f51e1 | [
"self.id = id\nself.number = number\nself.owner_name = owner_name\nself.owner_address = owner_address\nself.name = name\nself.mtype = mtype\nself.available_balance = available_balance\nself.aggregation_status_code = aggregation_status_code\nself.balance = balance\nself.balance_date = balance_date\nself.average_mont... | <|body_start_0|>
self.id = id
self.number = number
self.owner_name = owner_name
self.owner_address = owner_address
self.name = name
self.mtype = mtype
self.available_balance = available_balance
self.aggregation_status_code = aggregation_status_code
... | Implementation of the 'Asset Summary Report Account' model. TODO: type model description here. Attributes: id (long|int): The generated FInicity ID of the account number (string): The account number from the institution (all digits except the last four are obfuscated) owner_name (string): The name(s) of the account own... | AssetSummaryReportAccount | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AssetSummaryReportAccount:
"""Implementation of the 'Asset Summary Report Account' model. TODO: type model description here. Attributes: id (long|int): The generated FInicity ID of the account number (string): The account number from the institution (all digits except the last four are obfuscated... | stack_v2_sparse_classes_10k_train_007955 | 7,314 | permissive | [
{
"docstring": "Constructor for the AssetSummaryReportAccount class",
"name": "__init__",
"signature": "def __init__(self, id=None, number=None, owner_name=None, owner_address=None, name=None, mtype=None, available_balance=None, aggregation_status_code=None, balance=None, balance_date=None, average_mont... | 2 | stack_v2_sparse_classes_30k_train_003099 | Implement the Python class `AssetSummaryReportAccount` described below.
Class description:
Implementation of the 'Asset Summary Report Account' model. TODO: type model description here. Attributes: id (long|int): The generated FInicity ID of the account number (string): The account number from the institution (all dig... | Implement the Python class `AssetSummaryReportAccount` described below.
Class description:
Implementation of the 'Asset Summary Report Account' model. TODO: type model description here. Attributes: id (long|int): The generated FInicity ID of the account number (string): The account number from the institution (all dig... | b2ab1ded435db75c78d42261f5e4acd2a3061487 | <|skeleton|>
class AssetSummaryReportAccount:
"""Implementation of the 'Asset Summary Report Account' model. TODO: type model description here. Attributes: id (long|int): The generated FInicity ID of the account number (string): The account number from the institution (all digits except the last four are obfuscated... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AssetSummaryReportAccount:
"""Implementation of the 'Asset Summary Report Account' model. TODO: type model description here. Attributes: id (long|int): The generated FInicity ID of the account number (string): The account number from the institution (all digits except the last four are obfuscated) owner_name ... | the_stack_v2_python_sparse | finicityapi/models/asset_summary_report_account.py | monarchmoney/finicity-python | train | 0 |
4ae1bfd0f4ffa051b92d3188993bb0d667edc03a | [
"info = OrderedDict({})\ntry:\n if obj.student:\n info['student'] = obj.student.pen_name\nexcept Pupil.DoesNotExist as e:\n info['student'] = str(e)\ntry:\n if obj.exam:\n info['exam'] = obj.exam.name\nexcept Pupil.DoesNotExist as e:\n info['exam'] = str(e)\ntry:\n info_problems = Order... | <|body_start_0|>
info = OrderedDict({})
try:
if obj.student:
info['student'] = obj.student.pen_name
except Pupil.DoesNotExist as e:
info['student'] = str(e)
try:
if obj.exam:
info['exam'] = obj.exam.name
except P... | Serialize the Exam Answer Key with links and info | ExamAnswersSerializers | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExamAnswersSerializers:
"""Serialize the Exam Answer Key with links and info"""
def get_info_data(self, obj, *args, **kwargs):
"""Get Information data :param obj: :param args: :param kwargs: :return:"""
<|body_0|>
def get_links_url(self, obj, *args, **kwargs):
""... | stack_v2_sparse_classes_10k_train_007956 | 7,433 | no_license | [
{
"docstring": "Get Information data :param obj: :param args: :param kwargs: :return:",
"name": "get_info_data",
"signature": "def get_info_data(self, obj, *args, **kwargs)"
},
{
"docstring": "Get links url :param obj: :param args: :param kwargs: :return:",
"name": "get_links_url",
"sign... | 2 | stack_v2_sparse_classes_30k_train_001436 | Implement the Python class `ExamAnswersSerializers` described below.
Class description:
Serialize the Exam Answer Key with links and info
Method signatures and docstrings:
- def get_info_data(self, obj, *args, **kwargs): Get Information data :param obj: :param args: :param kwargs: :return:
- def get_links_url(self, o... | Implement the Python class `ExamAnswersSerializers` described below.
Class description:
Serialize the Exam Answer Key with links and info
Method signatures and docstrings:
- def get_info_data(self, obj, *args, **kwargs): Get Information data :param obj: :param args: :param kwargs: :return:
- def get_links_url(self, o... | acd31a2f43d7ea83fc9bb34627f5dca94763eade | <|skeleton|>
class ExamAnswersSerializers:
"""Serialize the Exam Answer Key with links and info"""
def get_info_data(self, obj, *args, **kwargs):
"""Get Information data :param obj: :param args: :param kwargs: :return:"""
<|body_0|>
def get_links_url(self, obj, *args, **kwargs):
""... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ExamAnswersSerializers:
"""Serialize the Exam Answer Key with links and info"""
def get_info_data(self, obj, *args, **kwargs):
"""Get Information data :param obj: :param args: :param kwargs: :return:"""
info = OrderedDict({})
try:
if obj.student:
info['... | the_stack_v2_python_sparse | classroom/serializers.py | JoenyBui/mywaterbuffalo | train | 0 |
22b1732d723a24284b4156248463121e13cf4c29 | [
"if page_url is None or html_cont is None:\n return\nsoup = BeautifulSoup(html_cont, 'html.parser', from_encoding='utf-8')\nnew_urls = self._get_new_urls(page_url, soup)\nnew_data = self._get_new_data(page_url, soup)\nreturn (new_urls, new_data)",
"new_urls = set()\nlinks = soup.find_all('a', href=re.compile('... | <|body_start_0|>
if page_url is None or html_cont is None:
return
soup = BeautifulSoup(html_cont, 'html.parser', from_encoding='utf-8')
new_urls = self._get_new_urls(page_url, soup)
new_data = self._get_new_data(page_url, soup)
return (new_urls, new_data)
<|end_body_0... | Htmlparser | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Htmlparser:
def parser(self, page_url, html_cont):
"""用于解析网页内容,抽取URL和数据 :param page_url:下载页面的URL:param html_cont:下载的网页内容 :return:返回URL和数据"""
<|body_0|>
def _get_new_urls(self, page_url, soup):
""":F1抽取新的URL集合 :param page_ur1:下载页面的URL :param soup:soup :return:返回新的URL集... | stack_v2_sparse_classes_10k_train_007957 | 1,722 | no_license | [
{
"docstring": "用于解析网页内容,抽取URL和数据 :param page_url:下载页面的URL:param html_cont:下载的网页内容 :return:返回URL和数据",
"name": "parser",
"signature": "def parser(self, page_url, html_cont)"
},
{
"docstring": ":F1抽取新的URL集合 :param page_ur1:下载页面的URL :param soup:soup :return:返回新的URL集合",
"name": "_get_new_urls",
... | 3 | stack_v2_sparse_classes_30k_train_006672 | Implement the Python class `Htmlparser` described below.
Class description:
Implement the Htmlparser class.
Method signatures and docstrings:
- def parser(self, page_url, html_cont): 用于解析网页内容,抽取URL和数据 :param page_url:下载页面的URL:param html_cont:下载的网页内容 :return:返回URL和数据
- def _get_new_urls(self, page_url, soup): :F1抽取新的U... | Implement the Python class `Htmlparser` described below.
Class description:
Implement the Htmlparser class.
Method signatures and docstrings:
- def parser(self, page_url, html_cont): 用于解析网页内容,抽取URL和数据 :param page_url:下载页面的URL:param html_cont:下载的网页内容 :return:返回URL和数据
- def _get_new_urls(self, page_url, soup): :F1抽取新的U... | 5651c6469496e9d3aa08c9ff66884175e181a7d4 | <|skeleton|>
class Htmlparser:
def parser(self, page_url, html_cont):
"""用于解析网页内容,抽取URL和数据 :param page_url:下载页面的URL:param html_cont:下载的网页内容 :return:返回URL和数据"""
<|body_0|>
def _get_new_urls(self, page_url, soup):
""":F1抽取新的URL集合 :param page_ur1:下载页面的URL :param soup:soup :return:返回新的URL集... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Htmlparser:
def parser(self, page_url, html_cont):
"""用于解析网页内容,抽取URL和数据 :param page_url:下载页面的URL:param html_cont:下载的网页内容 :return:返回URL和数据"""
if page_url is None or html_cont is None:
return
soup = BeautifulSoup(html_cont, 'html.parser', from_encoding='utf-8')
new_ur... | the_stack_v2_python_sparse | PythonReptiles/HtmlParser.py | liwtText/GetText | train | 0 | |
0b3068aec1ecc933b9a2f6b3b587809c033a5e3e | [
"if xsID in self:\n return dict.__getitem__(self, xsID)\nxsType = xsID[0]\nbuGroup = xsID[1]\nexistingXsOpts = [xsOpt for xsOpt in self.values() if xsOpt.xsType == xsType and xsOpt.buGroup < buGroup]\nif not any(existingXsOpts):\n return self._getDefault(xsID)\nelse:\n return sorted(existingXsOpts, key=lam... | <|body_start_0|>
if xsID in self:
return dict.__getitem__(self, xsID)
xsType = xsID[0]
buGroup = xsID[1]
existingXsOpts = [xsOpt for xsOpt in self.values() if xsOpt.xsType == xsType and xsOpt.buGroup < buGroup]
if not any(existingXsOpts):
return self._getD... | The container that holds the multiple individual XS settings for different ids. This is what the value of the cs setting is set to. It handles reading/writing the settings to file as well as some other special behavior. | XSSettings | [
"LicenseRef-scancode-free-unknown",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class XSSettings:
"""The container that holds the multiple individual XS settings for different ids. This is what the value of the cs setting is set to. It handles reading/writing the settings to file as well as some other special behavior."""
def __getitem__(self, xsID):
"""Return the sto... | stack_v2_sparse_classes_10k_train_007958 | 11,956 | permissive | [
{
"docstring": "Return the stored settings of the same xs type and the lowest burnup group if they exist. Notes ----- 1. If `AA` and `AB` exist, but `AC` is created, then the intended behavior is that `AC` settings will be set to the settings in `AA`. 2. If only `YZ' exists and `YA` is created, then the intende... | 3 | stack_v2_sparse_classes_30k_train_004824 | Implement the Python class `XSSettings` described below.
Class description:
The container that holds the multiple individual XS settings for different ids. This is what the value of the cs setting is set to. It handles reading/writing the settings to file as well as some other special behavior.
Method signatures and ... | Implement the Python class `XSSettings` described below.
Class description:
The container that holds the multiple individual XS settings for different ids. This is what the value of the cs setting is set to. It handles reading/writing the settings to file as well as some other special behavior.
Method signatures and ... | 6c4fea1ca9d256a2599efd52af5e5ebe9860d192 | <|skeleton|>
class XSSettings:
"""The container that holds the multiple individual XS settings for different ids. This is what the value of the cs setting is set to. It handles reading/writing the settings to file as well as some other special behavior."""
def __getitem__(self, xsID):
"""Return the sto... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class XSSettings:
"""The container that holds the multiple individual XS settings for different ids. This is what the value of the cs setting is set to. It handles reading/writing the settings to file as well as some other special behavior."""
def __getitem__(self, xsID):
"""Return the stored settings ... | the_stack_v2_python_sparse | armi/physics/neutronics/crossSectionSettings.py | paulromano/armi | train | 1 |
652a1e2e8b6505c8509e78e302d308bdd1f23802 | [
"max_texture_size = pyglet.image.get_max_texture_size()\nself.texture_width = min(texture_width, max_texture_size)\nself.texture_height = min(texture_height, max_texture_size)\nself.atlases = []",
"for atlas in list(self.atlases):\n try:\n return atlas.add(img, border)\n except AllocatorException:\n ... | <|body_start_0|>
max_texture_size = pyglet.image.get_max_texture_size()
self.texture_width = min(texture_width, max_texture_size)
self.texture_height = min(texture_height, max_texture_size)
self.atlases = []
<|end_body_0|>
<|body_start_1|>
for atlas in list(self.atlases):
... | Collection of texture atlases. :py:class:`~pyglet.image.atlas.TextureBin` maintains a collection of texture atlases, and creates new ones as necessary to accommodate images added to the bin. | TextureBin | [
"BSD-3-Clause",
"LicenseRef-scancode-free-unknown"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TextureBin:
"""Collection of texture atlases. :py:class:`~pyglet.image.atlas.TextureBin` maintains a collection of texture atlases, and creates new ones as necessary to accommodate images added to the bin."""
def __init__(self, texture_width: int=2048, texture_height: int=2048) -> None:
... | stack_v2_sparse_classes_10k_train_007959 | 10,284 | permissive | [
{
"docstring": "Create a texture bin for holding atlases of the given size. :Parameters: `texture_width` : int Width of texture atlases to create. `texture_height` : int Height of texture atlases to create. `border` : int Leaves specified pixels of blank space around each image added to the Atlases.",
"name... | 2 | stack_v2_sparse_classes_30k_train_005452 | Implement the Python class `TextureBin` described below.
Class description:
Collection of texture atlases. :py:class:`~pyglet.image.atlas.TextureBin` maintains a collection of texture atlases, and creates new ones as necessary to accommodate images added to the bin.
Method signatures and docstrings:
- def __init__(se... | Implement the Python class `TextureBin` described below.
Class description:
Collection of texture atlases. :py:class:`~pyglet.image.atlas.TextureBin` maintains a collection of texture atlases, and creates new ones as necessary to accommodate images added to the bin.
Method signatures and docstrings:
- def __init__(se... | 094c638f0529fecab4e74556487b92453a78753c | <|skeleton|>
class TextureBin:
"""Collection of texture atlases. :py:class:`~pyglet.image.atlas.TextureBin` maintains a collection of texture atlases, and creates new ones as necessary to accommodate images added to the bin."""
def __init__(self, texture_width: int=2048, texture_height: int=2048) -> None:
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TextureBin:
"""Collection of texture atlases. :py:class:`~pyglet.image.atlas.TextureBin` maintains a collection of texture atlases, and creates new ones as necessary to accommodate images added to the bin."""
def __init__(self, texture_width: int=2048, texture_height: int=2048) -> None:
"""Create... | the_stack_v2_python_sparse | pyglet/image/atlas.py | pyglet/pyglet | train | 1,687 |
44b3b5181aab2d65fab7bbe02e9755b8af2313da | [
"try:\n self.teaClassPractice = []\n self.sqlhandler = None\n if not utils.isUIDValid(self):\n self.write('no uid')\n return\n if self.getTeaClass():\n print(self.teaClassPractice)\n self.write(json.dumps(self.teaClassPractice) if self.teaClassPractice is not None else '[]')\... | <|body_start_0|>
try:
self.teaClassPractice = []
self.sqlhandler = None
if not utils.isUIDValid(self):
self.write('no uid')
return
if self.getTeaClass():
print(self.teaClassPractice)
self.write(json.d... | TeaGetPracticeListRequestHandler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TeaGetPracticeListRequestHandler:
def get(self):
"""获取练习题列表,返回给老师客户端"""
<|body_0|>
def getTeaClass(self):
"""返回老师的习题列表"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
try:
self.teaClassPractice = []
self.sqlhandler = None
... | stack_v2_sparse_classes_10k_train_007960 | 2,660 | no_license | [
{
"docstring": "获取练习题列表,返回给老师客户端",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "返回老师的习题列表",
"name": "getTeaClass",
"signature": "def getTeaClass(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001828 | Implement the Python class `TeaGetPracticeListRequestHandler` described below.
Class description:
Implement the TeaGetPracticeListRequestHandler class.
Method signatures and docstrings:
- def get(self): 获取练习题列表,返回给老师客户端
- def getTeaClass(self): 返回老师的习题列表 | Implement the Python class `TeaGetPracticeListRequestHandler` described below.
Class description:
Implement the TeaGetPracticeListRequestHandler class.
Method signatures and docstrings:
- def get(self): 获取练习题列表,返回给老师客户端
- def getTeaClass(self): 返回老师的习题列表
<|skeleton|>
class TeaGetPracticeListRequestHandler:
def ... | b28eb4163b02bd0a931653b94851592f2654b199 | <|skeleton|>
class TeaGetPracticeListRequestHandler:
def get(self):
"""获取练习题列表,返回给老师客户端"""
<|body_0|>
def getTeaClass(self):
"""返回老师的习题列表"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TeaGetPracticeListRequestHandler:
def get(self):
"""获取练习题列表,返回给老师客户端"""
try:
self.teaClassPractice = []
self.sqlhandler = None
if not utils.isUIDValid(self):
self.write('no uid')
return
if self.getTeaClass():
... | the_stack_v2_python_sparse | server/teacher/TeaGetPracticeListRequestHandler.py | lyh-ADT/edu-app | train | 1 | |
28eb4480717626dbf1cba59b8a4fc991e099a71e | [
"m = {'(': [], '[': [], '{': []}\nb = {')': '(', ']': '[', '}': '{'}\nfor ch in s:\n if ch in m:\n m[ch].append(ch)\n elif len(m[b[ch]]) <= 0:\n return False\n else:\n m[b[ch]].pop()\nfor k in m:\n if len(m[k]) != 0:\n return False\nreturn True",
"m = []\nb = {')': '(', ']'... | <|body_start_0|>
m = {'(': [], '[': [], '{': []}
b = {')': '(', ']': '[', '}': '{'}
for ch in s:
if ch in m:
m[ch].append(ch)
elif len(m[b[ch]]) <= 0:
return False
else:
m[b[ch]].pop()
for k in m:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isValid(self, s):
""":type s: str :rtype: bool"""
<|body_0|>
def isValid(self, s):
""":type s: str :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
m = {'(': [], '[': [], '{': []}
b = {')': '(', ']': '[', '}': '{'}
... | stack_v2_sparse_classes_10k_train_007961 | 2,131 | no_license | [
{
"docstring": ":type s: str :rtype: bool",
"name": "isValid",
"signature": "def isValid(self, s)"
},
{
"docstring": ":type s: str :rtype: bool",
"name": "isValid",
"signature": "def isValid(self, s)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002923 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isValid(self, s): :type s: str :rtype: bool
- def isValid(self, s): :type s: str :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isValid(self, s): :type s: str :rtype: bool
- def isValid(self, s): :type s: str :rtype: bool
<|skeleton|>
class Solution:
def isValid(self, s):
""":type s: str... | 860590239da0618c52967a55eda8d6bbe00bfa96 | <|skeleton|>
class Solution:
def isValid(self, s):
""":type s: str :rtype: bool"""
<|body_0|>
def isValid(self, s):
""":type s: str :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def isValid(self, s):
""":type s: str :rtype: bool"""
m = {'(': [], '[': [], '{': []}
b = {')': '(', ']': '[', '}': '{'}
for ch in s:
if ch in m:
m[ch].append(ch)
elif len(m[b[ch]]) <= 0:
return False
... | the_stack_v2_python_sparse | LeetCode/p0020/II/valid-parentheses.py | Ynjxsjmh/PracticeMakesPerfect | train | 0 | |
0ff40cbf2ac376f4e94e8977b6616fdf70826b82 | [
"self.n_head = n_head\nself.d_k = self.d_v = d_k = d_v = d_model // n_head\nself.dropout = dropout\nself.seed = seed\nself.qs_layers = []\nself.ks_layers = []\nself.vs_layers = []\nvs_layer = Dense(d_v, use_bias=False)\nfor _ in range(n_head):\n self.qs_layers.append(Dense(d_k, use_bias=False))\n self.ks_laye... | <|body_start_0|>
self.n_head = n_head
self.d_k = self.d_v = d_k = d_v = d_model // n_head
self.dropout = dropout
self.seed = seed
self.qs_layers = []
self.ks_layers = []
self.vs_layers = []
vs_layer = Dense(d_v, use_bias=False)
for _ in range(n_hea... | Defines interpretable multi-head attention layer. Attributes: n_head: Number of heads d_k: Key/query dimensionality per head d_v: Value dimensionality dropout: Dropout rate to apply qs_layers: List of queries across heads ks_layers: List of keys across heads vs_layers: List of values across heads attention: Scaled dot ... | InterpretableMultiHeadAttention | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InterpretableMultiHeadAttention:
"""Defines interpretable multi-head attention layer. Attributes: n_head: Number of heads d_k: Key/query dimensionality per head d_v: Value dimensionality dropout: Dropout rate to apply qs_layers: List of queries across heads ks_layers: List of keys across heads vs... | stack_v2_sparse_classes_10k_train_007962 | 13,910 | permissive | [
{
"docstring": "Initialises layer. Args: n_head: Number of heads d_model: TFT state dimensionality dropout: Dropout discard rate",
"name": "__init__",
"signature": "def __init__(self, n_head, d_model, dropout, seed=313, **kwargs)"
},
{
"docstring": "Applies interpretable multihead attention. Usi... | 2 | stack_v2_sparse_classes_30k_train_006447 | Implement the Python class `InterpretableMultiHeadAttention` described below.
Class description:
Defines interpretable multi-head attention layer. Attributes: n_head: Number of heads d_k: Key/query dimensionality per head d_v: Value dimensionality dropout: Dropout rate to apply qs_layers: List of queries across heads ... | Implement the Python class `InterpretableMultiHeadAttention` described below.
Class description:
Defines interpretable multi-head attention layer. Attributes: n_head: Number of heads d_k: Key/query dimensionality per head d_v: Value dimensionality dropout: Dropout rate to apply qs_layers: List of queries across heads ... | ec2a4a426673b11e3589b64cef9d7160b1de28d4 | <|skeleton|>
class InterpretableMultiHeadAttention:
"""Defines interpretable multi-head attention layer. Attributes: n_head: Number of heads d_k: Key/query dimensionality per head d_v: Value dimensionality dropout: Dropout rate to apply qs_layers: List of queries across heads ks_layers: List of keys across heads vs... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class InterpretableMultiHeadAttention:
"""Defines interpretable multi-head attention layer. Attributes: n_head: Number of heads d_k: Key/query dimensionality per head d_v: Value dimensionality dropout: Dropout rate to apply qs_layers: List of queries across heads ks_layers: List of keys across heads vs_layers: List... | the_stack_v2_python_sparse | ai4water/models/_tensorflow/utils.py | AtrCheema/AI4Water | train | 47 |
31ffd77e4e8f770f58ab9fa488ab14b3b3e51d75 | [
"kwargs = {}\nkwargs['status'] = SMS_CAMPAIGN_STATUS.START\ntday = datetime.utcnow().replace(tzinfo=utc)\nkwargs['startingdate__lte'] = datetime(tday.year, tday.month, tday.day, tday.hour, tday.minute, tday.second, tday.microsecond).replace(tzinfo=utc)\nkwargs['expirationdate__gte'] = datetime(tday.year, tday.month... | <|body_start_0|>
kwargs = {}
kwargs['status'] = SMS_CAMPAIGN_STATUS.START
tday = datetime.utcnow().replace(tzinfo=utc)
kwargs['startingdate__lte'] = datetime(tday.year, tday.month, tday.day, tday.hour, tday.minute, tday.second, tday.microsecond).replace(tzinfo=utc)
kwargs['expira... | SMSCampaign Manager | SMSCampaignManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SMSCampaignManager:
"""SMSCampaign Manager"""
def get_running_sms_campaign(self):
"""Return all the active smscampaigns which will be running based on the expiry date, the daily start/stop time and days of the week"""
<|body_0|>
def get_expired_sms_campaign(self):
... | stack_v2_sparse_classes_10k_train_007963 | 23,219 | no_license | [
{
"docstring": "Return all the active smscampaigns which will be running based on the expiry date, the daily start/stop time and days of the week",
"name": "get_running_sms_campaign",
"signature": "def get_running_sms_campaign(self)"
},
{
"docstring": "Return all the smscampaigns which are expir... | 2 | stack_v2_sparse_classes_30k_train_005027 | Implement the Python class `SMSCampaignManager` described below.
Class description:
SMSCampaign Manager
Method signatures and docstrings:
- def get_running_sms_campaign(self): Return all the active smscampaigns which will be running based on the expiry date, the daily start/stop time and days of the week
- def get_ex... | Implement the Python class `SMSCampaignManager` described below.
Class description:
SMSCampaign Manager
Method signatures and docstrings:
- def get_running_sms_campaign(self): Return all the active smscampaigns which will be running based on the expiry date, the daily start/stop time and days of the week
- def get_ex... | 2923a7d974f362af91b7c7c8f2e208cb2353c921 | <|skeleton|>
class SMSCampaignManager:
"""SMSCampaign Manager"""
def get_running_sms_campaign(self):
"""Return all the active smscampaigns which will be running based on the expiry date, the daily start/stop time and days of the week"""
<|body_0|>
def get_expired_sms_campaign(self):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SMSCampaignManager:
"""SMSCampaign Manager"""
def get_running_sms_campaign(self):
"""Return all the active smscampaigns which will be running based on the expiry date, the daily start/stop time and days of the week"""
kwargs = {}
kwargs['status'] = SMS_CAMPAIGN_STATUS.START
... | the_stack_v2_python_sparse | sms_module/models.py | goksie/TheFies | train | 0 |
d49c7eddf657e4cadc22b5a982fdd661fd897d97 | [
"super().__init__(False, universeSettings)\nself.fastPeriod = fastPeriod\nself.slowPeriod = slowPeriod\nself.universeCount = universeCount\nself.tolerance = 0.01\nself.averages = {}",
"filtered = []\nfor cf in coarse:\n if cf.Symbol not in self.averages:\n self.averages[cf.Symbol] = self.SelectionData(c... | <|body_start_0|>
super().__init__(False, universeSettings)
self.fastPeriod = fastPeriod
self.slowPeriod = slowPeriod
self.universeCount = universeCount
self.tolerance = 0.01
self.averages = {}
<|end_body_0|>
<|body_start_1|>
filtered = []
for cf in coarse... | Provides an implementation of FundamentalUniverseSelectionModel that subscribes to symbols with the larger delta by percentage between the two exponential moving average | EmaCrossUniverseSelectionModel | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EmaCrossUniverseSelectionModel:
"""Provides an implementation of FundamentalUniverseSelectionModel that subscribes to symbols with the larger delta by percentage between the two exponential moving average"""
def __init__(self, fastPeriod=100, slowPeriod=300, universeCount=500, universeSettin... | stack_v2_sparse_classes_10k_train_007964 | 4,147 | permissive | [
{
"docstring": "Initializes a new instance of the EmaCrossUniverseSelectionModel class Args: fastPeriod: Fast EMA period slowPeriod: Slow EMA period universeCount: Maximum number of members of this universe selection universeSettings: The settings used when adding symbols to the algorithm, specify null to use a... | 2 | null | Implement the Python class `EmaCrossUniverseSelectionModel` described below.
Class description:
Provides an implementation of FundamentalUniverseSelectionModel that subscribes to symbols with the larger delta by percentage between the two exponential moving average
Method signatures and docstrings:
- def __init__(sel... | Implement the Python class `EmaCrossUniverseSelectionModel` described below.
Class description:
Provides an implementation of FundamentalUniverseSelectionModel that subscribes to symbols with the larger delta by percentage between the two exponential moving average
Method signatures and docstrings:
- def __init__(sel... | b33dd3bc140e14b883f39ecf848a793cf7292277 | <|skeleton|>
class EmaCrossUniverseSelectionModel:
"""Provides an implementation of FundamentalUniverseSelectionModel that subscribes to symbols with the larger delta by percentage between the two exponential moving average"""
def __init__(self, fastPeriod=100, slowPeriod=300, universeCount=500, universeSettin... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class EmaCrossUniverseSelectionModel:
"""Provides an implementation of FundamentalUniverseSelectionModel that subscribes to symbols with the larger delta by percentage between the two exponential moving average"""
def __init__(self, fastPeriod=100, slowPeriod=300, universeCount=500, universeSettings=None):
... | the_stack_v2_python_sparse | Algorithm.Framework/Selection/EmaCrossUniverseSelectionModel.py | Capnode/Algoloop | train | 87 |
57fe1ef3247ddcbbd3274545bc56ae87e89f04fd | [
"super().validate(data)\nhandle_invalid_fields(self, data)\nreturn data",
"dh = DateHelper()\nif value >= materialized_view_month_start(dh).date() and value <= dh.today.date():\n return value\nerror = 'Parameter start_date must be from {} to {}'.format(dh.last_month_start.date(), dh.today.date())\nraise serial... | <|body_start_0|>
super().validate(data)
handle_invalid_fields(self, data)
return data
<|end_body_0|>
<|body_start_1|>
dh = DateHelper()
if value >= materialized_view_month_start(dh).date() and value <= dh.today.date():
return value
error = 'Parameter start_da... | Serializer for handling query parameters. | TagsQueryParamSerializer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TagsQueryParamSerializer:
"""Serializer for handling query parameters."""
def validate(self, data):
"""Validate incoming data. Args: data (Dict): data to be validated Returns: (Dict): Validated data Raises: (ValidationError): if field inputs are invalid"""
<|body_0|>
def... | stack_v2_sparse_classes_10k_train_007965 | 11,000 | permissive | [
{
"docstring": "Validate incoming data. Args: data (Dict): data to be validated Returns: (Dict): Validated data Raises: (ValidationError): if field inputs are invalid",
"name": "validate",
"signature": "def validate(self, data)"
},
{
"docstring": "Validate that the start_date is within the expec... | 3 | stack_v2_sparse_classes_30k_train_007287 | Implement the Python class `TagsQueryParamSerializer` described below.
Class description:
Serializer for handling query parameters.
Method signatures and docstrings:
- def validate(self, data): Validate incoming data. Args: data (Dict): data to be validated Returns: (Dict): Validated data Raises: (ValidationError): i... | Implement the Python class `TagsQueryParamSerializer` described below.
Class description:
Serializer for handling query parameters.
Method signatures and docstrings:
- def validate(self, data): Validate incoming data. Args: data (Dict): data to be validated Returns: (Dict): Validated data Raises: (ValidationError): i... | 2979f03fbdd1c20c3abc365a963a1282b426f321 | <|skeleton|>
class TagsQueryParamSerializer:
"""Serializer for handling query parameters."""
def validate(self, data):
"""Validate incoming data. Args: data (Dict): data to be validated Returns: (Dict): Validated data Raises: (ValidationError): if field inputs are invalid"""
<|body_0|>
def... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TagsQueryParamSerializer:
"""Serializer for handling query parameters."""
def validate(self, data):
"""Validate incoming data. Args: data (Dict): data to be validated Returns: (Dict): Validated data Raises: (ValidationError): if field inputs are invalid"""
super().validate(data)
h... | the_stack_v2_python_sparse | koku/api/tags/serializers.py | luisfdez/koku | train | 0 |
c9a663c85bab3e44f79a3548d2329cc05a1271a0 | [
"data = get_inventory_row_by_id(pk)\nif not data:\n raise NotFound\nresult = marshal(data, fields_item_inventory, envelope=structure_key_item)\nreturn jsonify(result)",
"result = delete_inventory(pk)\nif result:\n success_msg = SUCCESS_MSG.copy()\n return make_response(jsonify(success_msg), 204)\nelse:\n... | <|body_start_0|>
data = get_inventory_row_by_id(pk)
if not data:
raise NotFound
result = marshal(data, fields_item_inventory, envelope=structure_key_item)
return jsonify(result)
<|end_body_0|>
<|body_start_1|>
result = delete_inventory(pk)
if result:
... | InventoryResource | InventoryResource | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InventoryResource:
"""InventoryResource"""
def get(self, pk):
"""Example: curl http://0.0.0.0:5000/bearings/inventory/1 :param pk: :return:"""
<|body_0|>
def delete(self, pk):
"""Example: curl http://0.0.0.0:5000/bearings/inventory/1 -X DELETE :param pk: :return:... | stack_v2_sparse_classes_10k_train_007966 | 5,543 | permissive | [
{
"docstring": "Example: curl http://0.0.0.0:5000/bearings/inventory/1 :param pk: :return:",
"name": "get",
"signature": "def get(self, pk)"
},
{
"docstring": "Example: curl http://0.0.0.0:5000/bearings/inventory/1 -X DELETE :param pk: :return:",
"name": "delete",
"signature": "def delet... | 3 | stack_v2_sparse_classes_30k_train_005681 | Implement the Python class `InventoryResource` described below.
Class description:
InventoryResource
Method signatures and docstrings:
- def get(self, pk): Example: curl http://0.0.0.0:5000/bearings/inventory/1 :param pk: :return:
- def delete(self, pk): Example: curl http://0.0.0.0:5000/bearings/inventory/1 -X DELET... | Implement the Python class `InventoryResource` described below.
Class description:
InventoryResource
Method signatures and docstrings:
- def get(self, pk): Example: curl http://0.0.0.0:5000/bearings/inventory/1 :param pk: :return:
- def delete(self, pk): Example: curl http://0.0.0.0:5000/bearings/inventory/1 -X DELET... | 6ef54f3f7efbbaff6169e963dcf45ab25e11e593 | <|skeleton|>
class InventoryResource:
"""InventoryResource"""
def get(self, pk):
"""Example: curl http://0.0.0.0:5000/bearings/inventory/1 :param pk: :return:"""
<|body_0|>
def delete(self, pk):
"""Example: curl http://0.0.0.0:5000/bearings/inventory/1 -X DELETE :param pk: :return:... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class InventoryResource:
"""InventoryResource"""
def get(self, pk):
"""Example: curl http://0.0.0.0:5000/bearings/inventory/1 :param pk: :return:"""
data = get_inventory_row_by_id(pk)
if not data:
raise NotFound
result = marshal(data, fields_item_inventory, envelope=... | the_stack_v2_python_sparse | web_api/bearings/resources/inventory.py | zhanghe06/flask_restful | train | 2 |
10a919e8a5978aeb8eaf66409f071a2e553cf04e | [
"self._unix_start = datetime(1970, 1, 1)\nt = Time(mjd_init, format='mjd')\nself.initial_dt = t.datetime",
"if datetime2 is None:\n datetime2 = self._unix_start\nif reverse:\n return (datetime1 - datetime2).total_seconds()\nelse:\n return (datetime2 - datetime1).total_seconds()"
] | <|body_start_0|>
self._unix_start = datetime(1970, 1, 1)
t = Time(mjd_init, format='mjd')
self.initial_dt = t.datetime
<|end_body_0|>
<|body_start_1|>
if datetime2 is None:
datetime2 = self._unix_start
if reverse:
return (datetime1 - datetime2).total_seco... | Don't need the full time handler, so save a dependency and use this. | dummy_time_handler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class dummy_time_handler:
"""Don't need the full time handler, so save a dependency and use this."""
def __init__(self, mjd_init):
"""Parameters ---------- mjd_init : float The initial mjd"""
<|body_0|>
def time_since_given_datetime(self, datetime1, datetime2=None, reverse=Fal... | stack_v2_sparse_classes_10k_train_007967 | 17,828 | no_license | [
{
"docstring": "Parameters ---------- mjd_init : float The initial mjd",
"name": "__init__",
"signature": "def __init__(self, mjd_init)"
},
{
"docstring": "Really? We need a method to do one line of arithmatic?",
"name": "time_since_given_datetime",
"signature": "def time_since_given_dat... | 2 | stack_v2_sparse_classes_30k_train_004603 | Implement the Python class `dummy_time_handler` described below.
Class description:
Don't need the full time handler, so save a dependency and use this.
Method signatures and docstrings:
- def __init__(self, mjd_init): Parameters ---------- mjd_init : float The initial mjd
- def time_since_given_datetime(self, dateti... | Implement the Python class `dummy_time_handler` described below.
Class description:
Don't need the full time handler, so save a dependency and use this.
Method signatures and docstrings:
- def __init__(self, mjd_init): Parameters ---------- mjd_init : float The initial mjd
- def time_since_given_datetime(self, dateti... | 20fd8cfe38dbecfd6f219086e273eefe3ff6ff07 | <|skeleton|>
class dummy_time_handler:
"""Don't need the full time handler, so save a dependency and use this."""
def __init__(self, mjd_init):
"""Parameters ---------- mjd_init : float The initial mjd"""
<|body_0|>
def time_since_given_datetime(self, datetime1, datetime2=None, reverse=Fal... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class dummy_time_handler:
"""Don't need the full time handler, so save a dependency and use this."""
def __init__(self, mjd_init):
"""Parameters ---------- mjd_init : float The initial mjd"""
self._unix_start = datetime(1970, 1, 1)
t = Time(mjd_init, format='mjd')
self.initial_d... | the_stack_v2_python_sparse | python/lsst/sims/speedObservatory/speed_observatory.py | lsst-sims/sims_speedObservatory | train | 0 |
484ab52a9b288846d4ff055d7a46687ac2ba512d | [
"super(ExpandImage, self).__init__()\nself.max_ratio = max_ratio\nself.mean = mean\nself.prob = prob",
"prob = np.random.uniform(0, 1)\nassert 'image' in sample, 'not found image data'\nim = sample['image']\ngt_bbox = sample['gt_bbox']\ngt_class = sample['gt_class']\nim_width = sample['w']\nim_height = sample['h'... | <|body_start_0|>
super(ExpandImage, self).__init__()
self.max_ratio = max_ratio
self.mean = mean
self.prob = prob
<|end_body_0|>
<|body_start_1|>
prob = np.random.uniform(0, 1)
assert 'image' in sample, 'not found image data'
im = sample['image']
gt_bbox ... | ExpandImage | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExpandImage:
def __init__(self, max_ratio, prob, mean=[127.5, 127.5, 127.5]):
"""Args: max_ratio (float): the ratio of expanding prob (float): the probability of expanding image mean (list): the pixel mean"""
<|body_0|>
def __call__(self, sample, context):
"""Expand ... | stack_v2_sparse_classes_10k_train_007968 | 39,037 | permissive | [
{
"docstring": "Args: max_ratio (float): the ratio of expanding prob (float): the probability of expanding image mean (list): the pixel mean",
"name": "__init__",
"signature": "def __init__(self, max_ratio, prob, mean=[127.5, 127.5, 127.5])"
},
{
"docstring": "Expand the image and modify boundin... | 2 | null | Implement the Python class `ExpandImage` described below.
Class description:
Implement the ExpandImage class.
Method signatures and docstrings:
- def __init__(self, max_ratio, prob, mean=[127.5, 127.5, 127.5]): Args: max_ratio (float): the ratio of expanding prob (float): the probability of expanding image mean (list... | Implement the Python class `ExpandImage` described below.
Class description:
Implement the ExpandImage class.
Method signatures and docstrings:
- def __init__(self, max_ratio, prob, mean=[127.5, 127.5, 127.5]): Args: max_ratio (float): the ratio of expanding prob (float): the probability of expanding image mean (list... | 420527996b6da60ca401717a734329f126ed0680 | <|skeleton|>
class ExpandImage:
def __init__(self, max_ratio, prob, mean=[127.5, 127.5, 127.5]):
"""Args: max_ratio (float): the ratio of expanding prob (float): the probability of expanding image mean (list): the pixel mean"""
<|body_0|>
def __call__(self, sample, context):
"""Expand ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ExpandImage:
def __init__(self, max_ratio, prob, mean=[127.5, 127.5, 127.5]):
"""Args: max_ratio (float): the ratio of expanding prob (float): the probability of expanding image mean (list): the pixel mean"""
super(ExpandImage, self).__init__()
self.max_ratio = max_ratio
self.m... | the_stack_v2_python_sparse | PaddleCV/PaddleDetection/ppdet/data/transform/operators.py | chenbjin/models | train | 3 | |
9db7794d7fad0e0ae313b8ce0d41928331e4c460 | [
"timestamp = self._GetRowValue(query_hash, row, value_name)\nif timestamp is None:\n return None\nreturn dfdatetime_webkit_time.WebKitTime(timestamp=timestamp)",
"query_hash = hash(query)\ncookie_name = self._GetRowValue(query_hash, row, 'name')\ncookie_data = self._GetRowValue(query_hash, row, 'value')\nhostn... | <|body_start_0|>
timestamp = self._GetRowValue(query_hash, row, value_name)
if timestamp is None:
return None
return dfdatetime_webkit_time.WebKitTime(timestamp=timestamp)
<|end_body_0|>
<|body_start_1|>
query_hash = hash(query)
cookie_name = self._GetRowValue(query_... | SQLite parser plugin for Google Chrome cookies database files. | BaseChromeCookiePlugin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseChromeCookiePlugin:
"""SQLite parser plugin for Google Chrome cookies database files."""
def _GetDateTimeRowValue(self, query_hash, row, value_name):
"""Retrieves a date and time value from the row. Args: query_hash (int): hash of the query, that uniquely identifies the query tha... | stack_v2_sparse_classes_10k_train_007969 | 7,358 | permissive | [
{
"docstring": "Retrieves a date and time value from the row. Args: query_hash (int): hash of the query, that uniquely identifies the query that produced the row. row (sqlite3.Row): row. value_name (str): name of the value. Returns: dfdatetime.WebKitTime: date and time value or None if not available.",
"nam... | 2 | null | Implement the Python class `BaseChromeCookiePlugin` described below.
Class description:
SQLite parser plugin for Google Chrome cookies database files.
Method signatures and docstrings:
- def _GetDateTimeRowValue(self, query_hash, row, value_name): Retrieves a date and time value from the row. Args: query_hash (int): ... | Implement the Python class `BaseChromeCookiePlugin` described below.
Class description:
SQLite parser plugin for Google Chrome cookies database files.
Method signatures and docstrings:
- def _GetDateTimeRowValue(self, query_hash, row, value_name): Retrieves a date and time value from the row. Args: query_hash (int): ... | d6022f8cfebfddf2d08ab2d300a41b61f3349933 | <|skeleton|>
class BaseChromeCookiePlugin:
"""SQLite parser plugin for Google Chrome cookies database files."""
def _GetDateTimeRowValue(self, query_hash, row, value_name):
"""Retrieves a date and time value from the row. Args: query_hash (int): hash of the query, that uniquely identifies the query tha... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BaseChromeCookiePlugin:
"""SQLite parser plugin for Google Chrome cookies database files."""
def _GetDateTimeRowValue(self, query_hash, row, value_name):
"""Retrieves a date and time value from the row. Args: query_hash (int): hash of the query, that uniquely identifies the query that produced th... | the_stack_v2_python_sparse | plaso/parsers/sqlite_plugins/chrome_cookies.py | log2timeline/plaso | train | 1,506 |
b1c77a78e55f5e7a9ab1154871b970af629d52bb | [
"self.root_public_folder_vec = root_public_folder_vec\nself.target_folder_path = target_folder_path\nself.target_root_public_folder = target_root_public_folder",
"if dictionary is None:\n return None\nroot_public_folder_vec = None\nif dictionary.get('rootPublicFolderVec') != None:\n root_public_folder_vec =... | <|body_start_0|>
self.root_public_folder_vec = root_public_folder_vec
self.target_folder_path = target_folder_path
self.target_root_public_folder = target_root_public_folder
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
root_public_folder_vec = N... | Implementation of the 'RestoreO365PublicFoldersParams' model. TODO: type description here. Attributes: root_public_folder_vec (list of RestoreO365PublicFoldersParams_RootPublicFolder): In a RestoreJob , user will provide the list of Root Public Folders to be restored. Provision is there for restoring full and partial P... | RestoreO365PublicFoldersParams | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RestoreO365PublicFoldersParams:
"""Implementation of the 'RestoreO365PublicFoldersParams' model. TODO: type description here. Attributes: root_public_folder_vec (list of RestoreO365PublicFoldersParams_RootPublicFolder): In a RestoreJob , user will provide the list of Root Public Folders to be res... | stack_v2_sparse_classes_10k_train_007970 | 3,416 | permissive | [
{
"docstring": "Constructor for the RestoreO365PublicFoldersParams class",
"name": "__init__",
"signature": "def __init__(self, root_public_folder_vec=None, target_folder_path=None, target_root_public_folder=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dict... | 2 | stack_v2_sparse_classes_30k_train_001427 | Implement the Python class `RestoreO365PublicFoldersParams` described below.
Class description:
Implementation of the 'RestoreO365PublicFoldersParams' model. TODO: type description here. Attributes: root_public_folder_vec (list of RestoreO365PublicFoldersParams_RootPublicFolder): In a RestoreJob , user will provide th... | Implement the Python class `RestoreO365PublicFoldersParams` described below.
Class description:
Implementation of the 'RestoreO365PublicFoldersParams' model. TODO: type description here. Attributes: root_public_folder_vec (list of RestoreO365PublicFoldersParams_RootPublicFolder): In a RestoreJob , user will provide th... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class RestoreO365PublicFoldersParams:
"""Implementation of the 'RestoreO365PublicFoldersParams' model. TODO: type description here. Attributes: root_public_folder_vec (list of RestoreO365PublicFoldersParams_RootPublicFolder): In a RestoreJob , user will provide the list of Root Public Folders to be res... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RestoreO365PublicFoldersParams:
"""Implementation of the 'RestoreO365PublicFoldersParams' model. TODO: type description here. Attributes: root_public_folder_vec (list of RestoreO365PublicFoldersParams_RootPublicFolder): In a RestoreJob , user will provide the list of Root Public Folders to be restored. Provis... | the_stack_v2_python_sparse | cohesity_management_sdk/models/restore_o_365_public_folders_params.py | cohesity/management-sdk-python | train | 24 |
1cc14bf69f611220fa5776f8fd7349435778e3e6 | [
"self.size = size\nself.queue = []\nself.sum = 0",
"if len(self.queue) < self.size:\n self.queue.append(val)\nelse:\n self.sum -= self.queue[0]\n del self.queue[0]\n self.queue.append(val)\nself.sum += val\nreturn float(self.sum) / len(self.queue)"
] | <|body_start_0|>
self.size = size
self.queue = []
self.sum = 0
<|end_body_0|>
<|body_start_1|>
if len(self.queue) < self.size:
self.queue.append(val)
else:
self.sum -= self.queue[0]
del self.queue[0]
self.queue.append(val)
... | MovingAverage | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MovingAverage:
def __init__(self, size):
"""Initialize your data structure here. :type size: int"""
<|body_0|>
def next(self, val):
""":type val: int :rtype: float"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.size = size
self.queue =... | stack_v2_sparse_classes_10k_train_007971 | 1,199 | no_license | [
{
"docstring": "Initialize your data structure here. :type size: int",
"name": "__init__",
"signature": "def __init__(self, size)"
},
{
"docstring": ":type val: int :rtype: float",
"name": "next",
"signature": "def next(self, val)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002599 | Implement the Python class `MovingAverage` described below.
Class description:
Implement the MovingAverage class.
Method signatures and docstrings:
- def __init__(self, size): Initialize your data structure here. :type size: int
- def next(self, val): :type val: int :rtype: float | Implement the Python class `MovingAverage` described below.
Class description:
Implement the MovingAverage class.
Method signatures and docstrings:
- def __init__(self, size): Initialize your data structure here. :type size: int
- def next(self, val): :type val: int :rtype: float
<|skeleton|>
class MovingAverage:
... | 36c584e8f92a0725bab7a567dfd10b918408627b | <|skeleton|>
class MovingAverage:
def __init__(self, size):
"""Initialize your data structure here. :type size: int"""
<|body_0|>
def next(self, val):
""":type val: int :rtype: float"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MovingAverage:
def __init__(self, size):
"""Initialize your data structure here. :type size: int"""
self.size = size
self.queue = []
self.sum = 0
def next(self, val):
""":type val: int :rtype: float"""
if len(self.queue) < self.size:
self.queue.... | the_stack_v2_python_sparse | 346. Moving Average from Data Stream.py | Huijuan2015/leetcode_Python_2019 | train | 0 | |
e5c985594fd7c781250e91b09ffbc396856cb7d8 | [
"self._synapse_client = syn\nself._project = syn.get(project_id)\nself.entitylist = entitylist\nself.center = center\nself._format_registry = format_registry\nself.file_type = self.determine_filetype() if file_type is None else file_type\nself.genie_config = genie_config\nself.ancillary_files = ancillary_files",
... | <|body_start_0|>
self._synapse_client = syn
self._project = syn.get(project_id)
self.entitylist = entitylist
self.center = center
self._format_registry = format_registry
self.file_type = self.determine_filetype() if file_type is None else file_type
self.genie_conf... | ValidationHelper | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ValidationHelper:
def __init__(self, syn: synapseclient.Synapse, project_id: str, center: str, entitylist: List[synapseclient.File], format_registry: Optional[Dict]=None, file_type: Optional[str]=None, genie_config: Optional[Dict]=None, ancillary_files: Optional[list]=None):
"""A validat... | stack_v2_sparse_classes_10k_train_007972 | 12,242 | permissive | [
{
"docstring": "A validator helper class for a center's files. Args: syn: a synapseclient.Synapse object project_id: Synapse Project ID where files are stored and configured. center: The participating center name. entitylist: a list of file paths. format_registry: A dictionary mapping file format name to the fo... | 3 | stack_v2_sparse_classes_30k_train_005318 | Implement the Python class `ValidationHelper` described below.
Class description:
Implement the ValidationHelper class.
Method signatures and docstrings:
- def __init__(self, syn: synapseclient.Synapse, project_id: str, center: str, entitylist: List[synapseclient.File], format_registry: Optional[Dict]=None, file_type... | Implement the Python class `ValidationHelper` described below.
Class description:
Implement the ValidationHelper class.
Method signatures and docstrings:
- def __init__(self, syn: synapseclient.Synapse, project_id: str, center: str, entitylist: List[synapseclient.File], format_registry: Optional[Dict]=None, file_type... | 1513cc2fcb5aa3867fce810d0db9b5479e962f05 | <|skeleton|>
class ValidationHelper:
def __init__(self, syn: synapseclient.Synapse, project_id: str, center: str, entitylist: List[synapseclient.File], format_registry: Optional[Dict]=None, file_type: Optional[str]=None, genie_config: Optional[Dict]=None, ancillary_files: Optional[list]=None):
"""A validat... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ValidationHelper:
def __init__(self, syn: synapseclient.Synapse, project_id: str, center: str, entitylist: List[synapseclient.File], format_registry: Optional[Dict]=None, file_type: Optional[str]=None, genie_config: Optional[Dict]=None, ancillary_files: Optional[list]=None):
"""A validator helper clas... | the_stack_v2_python_sparse | genie/validate.py | Sage-Bionetworks/Genie | train | 12 | |
06e6146673b2f1d27f75534b98237268c395bedd | [
"if not matrix or not matrix[0]:\n return []\nrow = len(matrix)\ncol = len(matrix[0])\ndigits = [[] for _ in range(row + col - 1)]\nfor i in range(row):\n for j in range(col):\n digits[i + j].append(matrix[i][j])\nret = []\nfor k in range(row + col - 1):\n if k % 2 == 0:\n ret.extend(digits[k... | <|body_start_0|>
if not matrix or not matrix[0]:
return []
row = len(matrix)
col = len(matrix[0])
digits = [[] for _ in range(row + col - 1)]
for i in range(row):
for j in range(col):
digits[i + j].append(matrix[i][j])
ret = []
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findDiagonalOrder(self, matrix):
""":type matrix: List[List[int]] :rtype: List[int]"""
<|body_0|>
def findDiagonalOrder2(self, matrix):
""":type matrix: List[List[int]] :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_10k_train_007973 | 1,552 | no_license | [
{
"docstring": ":type matrix: List[List[int]] :rtype: List[int]",
"name": "findDiagonalOrder",
"signature": "def findDiagonalOrder(self, matrix)"
},
{
"docstring": ":type matrix: List[List[int]] :rtype: List[int]",
"name": "findDiagonalOrder2",
"signature": "def findDiagonalOrder2(self, ... | 2 | stack_v2_sparse_classes_30k_train_003991 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findDiagonalOrder(self, matrix): :type matrix: List[List[int]] :rtype: List[int]
- def findDiagonalOrder2(self, matrix): :type matrix: List[List[int]] :rtype: List[int] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findDiagonalOrder(self, matrix): :type matrix: List[List[int]] :rtype: List[int]
- def findDiagonalOrder2(self, matrix): :type matrix: List[List[int]] :rtype: List[int]
<|sk... | 7841cf88fa7c78376a6a162c0077b05c51c1491b | <|skeleton|>
class Solution:
def findDiagonalOrder(self, matrix):
""":type matrix: List[List[int]] :rtype: List[int]"""
<|body_0|>
def findDiagonalOrder2(self, matrix):
""":type matrix: List[List[int]] :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def findDiagonalOrder(self, matrix):
""":type matrix: List[List[int]] :rtype: List[int]"""
if not matrix or not matrix[0]:
return []
row = len(matrix)
col = len(matrix[0])
digits = [[] for _ in range(row + col - 1)]
for i in range(row):
... | the_stack_v2_python_sparse | python/498/Diagonal_Traverse.py | Leetcode-tc/Leetcode | train | 2 | |
e3e1091ecb5601df2e558a4a3a63d50054551116 | [
"store_config = config.online_store\nassert isinstance(store_config, HbaseOnlineStoreConfig)\nif not self._conn:\n self._conn = Connection(host=store_config.host, port=int(store_config.port))\nreturn self._conn",
"hbase = HbaseUtils(self._get_conn(config))\nproject = config.project\ntable_name = _table_id(proj... | <|body_start_0|>
store_config = config.online_store
assert isinstance(store_config, HbaseOnlineStoreConfig)
if not self._conn:
self._conn = Connection(host=store_config.host, port=int(store_config.port))
return self._conn
<|end_body_0|>
<|body_start_1|>
hbase = Hbase... | Online feature store for Hbase. Attributes: _conn: Happybase Connection to connect to hbase thrift server. | HbaseOnlineStore | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HbaseOnlineStore:
"""Online feature store for Hbase. Attributes: _conn: Happybase Connection to connect to hbase thrift server."""
def _get_conn(self, config: RepoConfig):
"""Get or Create Hbase Connection from Repoconfig. Args: config: The RepoConfig for the current FeatureStore."""... | stack_v2_sparse_classes_10k_train_007974 | 8,571 | permissive | [
{
"docstring": "Get or Create Hbase Connection from Repoconfig. Args: config: The RepoConfig for the current FeatureStore.",
"name": "_get_conn",
"signature": "def _get_conn(self, config: RepoConfig)"
},
{
"docstring": "Write a batch of feature rows to Hbase online store. Args: config: The RepoC... | 5 | stack_v2_sparse_classes_30k_test_000085 | Implement the Python class `HbaseOnlineStore` described below.
Class description:
Online feature store for Hbase. Attributes: _conn: Happybase Connection to connect to hbase thrift server.
Method signatures and docstrings:
- def _get_conn(self, config: RepoConfig): Get or Create Hbase Connection from Repoconfig. Args... | Implement the Python class `HbaseOnlineStore` described below.
Class description:
Online feature store for Hbase. Attributes: _conn: Happybase Connection to connect to hbase thrift server.
Method signatures and docstrings:
- def _get_conn(self, config: RepoConfig): Get or Create Hbase Connection from Repoconfig. Args... | 58aff346832ebde1695a47cf724da3d65a4a8c53 | <|skeleton|>
class HbaseOnlineStore:
"""Online feature store for Hbase. Attributes: _conn: Happybase Connection to connect to hbase thrift server."""
def _get_conn(self, config: RepoConfig):
"""Get or Create Hbase Connection from Repoconfig. Args: config: The RepoConfig for the current FeatureStore."""... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class HbaseOnlineStore:
"""Online feature store for Hbase. Attributes: _conn: Happybase Connection to connect to hbase thrift server."""
def _get_conn(self, config: RepoConfig):
"""Get or Create Hbase Connection from Repoconfig. Args: config: The RepoConfig for the current FeatureStore."""
stor... | the_stack_v2_python_sparse | sdk/python/feast/infra/online_stores/contrib/hbase_online_store/hbase.py | feast-dev/feast | train | 3,956 |
e2c1552cb5ed88acd0b5612787f4a03adb3afe90 | [
"houses.sort()\nheaters.sort()\nradius = 0\ni = 0\nfor house in houses:\n while i < len(heaters) and heaters[i] < house:\n i += 1\n if i == 0:\n radius = max(radius, heaters[i] - house)\n elif i == len(heaters):\n return max(radius, houses[-1] - heaters[-1])\n else:\n radius ... | <|body_start_0|>
houses.sort()
heaters.sort()
radius = 0
i = 0
for house in houses:
while i < len(heaters) and heaters[i] < house:
i += 1
if i == 0:
radius = max(radius, heaters[i] - house)
elif i == len(heaters)... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findRadius(self, houses, heaters):
""":type houses: List[int] :type heaters: List[int] :rtype: int"""
<|body_0|>
def findRadius_work(self, houses, heaters):
""":type houses: List[int] :type heaters: List[int] :rtype: int"""
<|body_1|>
<|end_ske... | stack_v2_sparse_classes_10k_train_007975 | 2,366 | no_license | [
{
"docstring": ":type houses: List[int] :type heaters: List[int] :rtype: int",
"name": "findRadius",
"signature": "def findRadius(self, houses, heaters)"
},
{
"docstring": ":type houses: List[int] :type heaters: List[int] :rtype: int",
"name": "findRadius_work",
"signature": "def findRad... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findRadius(self, houses, heaters): :type houses: List[int] :type heaters: List[int] :rtype: int
- def findRadius_work(self, houses, heaters): :type houses: List[int] :type he... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findRadius(self, houses, heaters): :type houses: List[int] :type heaters: List[int] :rtype: int
- def findRadius_work(self, houses, heaters): :type houses: List[int] :type he... | 3f0ffd519404165fd1a735441b212c801fd1ad1e | <|skeleton|>
class Solution:
def findRadius(self, houses, heaters):
""":type houses: List[int] :type heaters: List[int] :rtype: int"""
<|body_0|>
def findRadius_work(self, houses, heaters):
""":type houses: List[int] :type heaters: List[int] :rtype: int"""
<|body_1|>
<|end_ske... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def findRadius(self, houses, heaters):
""":type houses: List[int] :type heaters: List[int] :rtype: int"""
houses.sort()
heaters.sort()
radius = 0
i = 0
for house in houses:
while i < len(heaters) and heaters[i] < house:
i +=... | the_stack_v2_python_sparse | Problems/0400_0499/0475_Heaters/Project_Python3/Heaters.py | NobuyukiInoue/LeetCode | train | 0 | |
abe83dfa747012538f6ffa7f9edb6151d7f55ddc | [
"cursor = cnx.cursor(buffered=True)\ncommand = '\\n INSERT INTO `ordersystem_db`.`sub_cat`\\n (`subcat_name`,`upper_cat`)\\n VALUES(%s,%s);\\n '\ncursor.execute(command, (object.sub_category, object.upper_category))\ncursor.execute('SELECT MAX(id) FROM upper_cat')\nmax_id = cursor.fetcho... | <|body_start_0|>
cursor = cnx.cursor(buffered=True)
command = '\n INSERT INTO `ordersystem_db`.`sub_cat`\n (`subcat_name`,`upper_cat`)\n VALUES(%s,%s);\n '
cursor.execute(command, (object.sub_category, object.upper_category))
cursor.execute('SELECT MAX(id) FRO... | SubCatMapper | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SubCatMapper:
def insert(cnx: db_connector, object: SubCatObject) -> SubCatObject:
"""Creates a new Upper Category."""
<|body_0|>
def find_all(cnx: db_connector, upperCat: int) -> SubCatObject:
"""Get All Upper Categories."""
<|body_1|>
def delete(cnx: d... | stack_v2_sparse_classes_10k_train_007976 | 2,310 | no_license | [
{
"docstring": "Creates a new Upper Category.",
"name": "insert",
"signature": "def insert(cnx: db_connector, object: SubCatObject) -> SubCatObject"
},
{
"docstring": "Get All Upper Categories.",
"name": "find_all",
"signature": "def find_all(cnx: db_connector, upperCat: int) -> SubCatOb... | 4 | stack_v2_sparse_classes_30k_train_006486 | Implement the Python class `SubCatMapper` described below.
Class description:
Implement the SubCatMapper class.
Method signatures and docstrings:
- def insert(cnx: db_connector, object: SubCatObject) -> SubCatObject: Creates a new Upper Category.
- def find_all(cnx: db_connector, upperCat: int) -> SubCatObject: Get A... | Implement the Python class `SubCatMapper` described below.
Class description:
Implement the SubCatMapper class.
Method signatures and docstrings:
- def insert(cnx: db_connector, object: SubCatObject) -> SubCatObject: Creates a new Upper Category.
- def find_all(cnx: db_connector, upperCat: int) -> SubCatObject: Get A... | 960bd09661623a353936f0f11e2c8bc3ca49c1b6 | <|skeleton|>
class SubCatMapper:
def insert(cnx: db_connector, object: SubCatObject) -> SubCatObject:
"""Creates a new Upper Category."""
<|body_0|>
def find_all(cnx: db_connector, upperCat: int) -> SubCatObject:
"""Get All Upper Categories."""
<|body_1|>
def delete(cnx: d... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SubCatMapper:
def insert(cnx: db_connector, object: SubCatObject) -> SubCatObject:
"""Creates a new Upper Category."""
cursor = cnx.cursor(buffered=True)
command = '\n INSERT INTO `ordersystem_db`.`sub_cat`\n (`subcat_name`,`upper_cat`)\n VALUES(%s,%s);\n '
... | the_stack_v2_python_sparse | Backend/subcat/SubCatMapper.py | AtaullahShinwari/Ordersystem | train | 0 | |
f89b4c257775bcc222c8dc0203a5defabbbd1b04 | [
"if not digits:\n return []\ndigit_dict = {'2': 'abc', '3': 'def', '4': 'ghi', '5': 'jkl', '6': 'mno', '7': 'pqrs', '8': 'tuv', '9': 'wxyz'}\ndq = collections.deque(list(digit_dict[digits[0]]))\nfor i, d in enumerate(digits[1:], 1):\n while len(dq[0]) <= i:\n s = dq.popleft()\n for c in digit_di... | <|body_start_0|>
if not digits:
return []
digit_dict = {'2': 'abc', '3': 'def', '4': 'ghi', '5': 'jkl', '6': 'mno', '7': 'pqrs', '8': 'tuv', '9': 'wxyz'}
dq = collections.deque(list(digit_dict[digits[0]]))
for i, d in enumerate(digits[1:], 1):
while len(dq[0]) <= ... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def letterCombinations2(self, digits: str) -> List[str]:
"""AC: 05/09/2022 Runtime: 34 ms, faster than 76.96% Memory Usage: 13.9 MB, less than 79.68% :param digits: 0 <= digits.length <= 4 digits[i] is a digit in the range ['2', '9'] :return:"""
<|body_0|>
def lett... | stack_v2_sparse_classes_10k_train_007977 | 1,805 | permissive | [
{
"docstring": "AC: 05/09/2022 Runtime: 34 ms, faster than 76.96% Memory Usage: 13.9 MB, less than 79.68% :param digits: 0 <= digits.length <= 4 digits[i] is a digit in the range ['2', '9'] :return:",
"name": "letterCombinations2",
"signature": "def letterCombinations2(self, digits: str) -> List[str]"
... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def letterCombinations2(self, digits: str) -> List[str]: AC: 05/09/2022 Runtime: 34 ms, faster than 76.96% Memory Usage: 13.9 MB, less than 79.68% :param digits: 0 <= digits.leng... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def letterCombinations2(self, digits: str) -> List[str]: AC: 05/09/2022 Runtime: 34 ms, faster than 76.96% Memory Usage: 13.9 MB, less than 79.68% :param digits: 0 <= digits.leng... | 4dd1e54d8d08f7e6590bc76abd08ecaacaf775e5 | <|skeleton|>
class Solution:
def letterCombinations2(self, digits: str) -> List[str]:
"""AC: 05/09/2022 Runtime: 34 ms, faster than 76.96% Memory Usage: 13.9 MB, less than 79.68% :param digits: 0 <= digits.length <= 4 digits[i] is a digit in the range ['2', '9'] :return:"""
<|body_0|>
def lett... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def letterCombinations2(self, digits: str) -> List[str]:
"""AC: 05/09/2022 Runtime: 34 ms, faster than 76.96% Memory Usage: 13.9 MB, less than 79.68% :param digits: 0 <= digits.length <= 4 digits[i] is a digit in the range ['2', '9'] :return:"""
if not digits:
return []
... | the_stack_v2_python_sparse | src/17-LetterCombinationsOfAPhoneNumber.py | Jiezhi/myleetcode | train | 1 | |
b5e535ea31f8b3683829e49dfeb1a5c0523f8206 | [
"manager = multiprocessing.Manager()\nhelper_queue = manager.Queue()\nresult_queue = manager.Queue()\ncompleted_queue = manager.Queue()\nhelper_process = multiprocessing.Process(target=pipeline_worker.Helper, args=(TEST_STAGE, {}, helper_queue, completed_queue, result_queue))\nhelper_process.start()\nmock_result = ... | <|body_start_0|>
manager = multiprocessing.Manager()
helper_queue = manager.Queue()
result_queue = manager.Queue()
completed_queue = manager.Queue()
helper_process = multiprocessing.Process(target=pipeline_worker.Helper, args=(TEST_STAGE, {}, helper_queue, completed_queue, result... | This class tests the pipeline_worker functions. Given the same identifier, the cost should result the same from the pipeline_worker functions. | PipelineWorkerTest | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PipelineWorkerTest:
"""This class tests the pipeline_worker functions. Given the same identifier, the cost should result the same from the pipeline_worker functions."""
def testHelper(self):
""""Test the helper. Call the helper method twice, and test the results. The results should b... | stack_v2_sparse_classes_10k_train_007978 | 4,118 | permissive | [
{
"docstring": "\"Test the helper. Call the helper method twice, and test the results. The results should be the same, i.e., the cost should be the same.",
"name": "testHelper",
"signature": "def testHelper(self)"
},
{
"docstring": "\"Test the worker method. The worker should process all the inp... | 2 | stack_v2_sparse_classes_30k_val_000397 | Implement the Python class `PipelineWorkerTest` described below.
Class description:
This class tests the pipeline_worker functions. Given the same identifier, the cost should result the same from the pipeline_worker functions.
Method signatures and docstrings:
- def testHelper(self): "Test the helper. Call the helper... | Implement the Python class `PipelineWorkerTest` described below.
Class description:
This class tests the pipeline_worker functions. Given the same identifier, the cost should result the same from the pipeline_worker functions.
Method signatures and docstrings:
- def testHelper(self): "Test the helper. Call the helper... | e2745b756317aac3c7a27a4c10bdfe0921a82a1c | <|skeleton|>
class PipelineWorkerTest:
"""This class tests the pipeline_worker functions. Given the same identifier, the cost should result the same from the pipeline_worker functions."""
def testHelper(self):
""""Test the helper. Call the helper method twice, and test the results. The results should b... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PipelineWorkerTest:
"""This class tests the pipeline_worker functions. Given the same identifier, the cost should result the same from the pipeline_worker functions."""
def testHelper(self):
""""Test the helper. Call the helper method twice, and test the results. The results should be the same, i... | the_stack_v2_python_sparse | app/src/main/java/com/syd/source/aosp/external/toolchain-utils/bestflags/pipeline_worker_test.py | lz-purple/Source | train | 4 |
1476efeb3e657995a52da993a83b207470af6553 | [
"re = cloudparking_service().mockCarInOut(send_data['carNum'], 1, send_data['outClientID'])\nresult = re\nAssertions().assert_in_text(result, expect['mockCarOutMessage'])",
"re = CarInOutHandle(sentryLogin).carInOutHandle(send_data['carNum'], send_data['carOutHandleType'], send_data['carOut_jobId'])\nresult = re\... | <|body_start_0|>
re = cloudparking_service().mockCarInOut(send_data['carNum'], 1, send_data['outClientID'])
result = re
Assertions().assert_in_text(result, expect['mockCarOutMessage'])
<|end_body_0|>
<|body_start_1|>
re = CarInOutHandle(sentryLogin).carInOutHandle(send_data['carNum'], s... | 临时车无在场需缴费宽出(岗亭收费处收费放行) | TestCarOutNoInside | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestCarOutNoInside:
"""临时车无在场需缴费宽出(岗亭收费处收费放行)"""
def test_mockCarOut(self, sentryLogin, send_data, expect):
"""离场"""
<|body_0|>
def test_sentryAbnormalPay(self, sentryLogin, send_data, expect):
"""岗亭端收费异常放行"""
<|body_1|>
def test_carLeaveHistory(self... | stack_v2_sparse_classes_10k_train_007979 | 1,943 | no_license | [
{
"docstring": "离场",
"name": "test_mockCarOut",
"signature": "def test_mockCarOut(self, sentryLogin, send_data, expect)"
},
{
"docstring": "岗亭端收费异常放行",
"name": "test_sentryAbnormalPay",
"signature": "def test_sentryAbnormalPay(self, sentryLogin, send_data, expect)"
},
{
"docstrin... | 3 | stack_v2_sparse_classes_30k_train_005999 | Implement the Python class `TestCarOutNoInside` described below.
Class description:
临时车无在场需缴费宽出(岗亭收费处收费放行)
Method signatures and docstrings:
- def test_mockCarOut(self, sentryLogin, send_data, expect): 离场
- def test_sentryAbnormalPay(self, sentryLogin, send_data, expect): 岗亭端收费异常放行
- def test_carLeaveHistory(self, us... | Implement the Python class `TestCarOutNoInside` described below.
Class description:
临时车无在场需缴费宽出(岗亭收费处收费放行)
Method signatures and docstrings:
- def test_mockCarOut(self, sentryLogin, send_data, expect): 离场
- def test_sentryAbnormalPay(self, sentryLogin, send_data, expect): 岗亭端收费异常放行
- def test_carLeaveHistory(self, us... | 34c368c109867da26d9256bca85f872b0fac2ea7 | <|skeleton|>
class TestCarOutNoInside:
"""临时车无在场需缴费宽出(岗亭收费处收费放行)"""
def test_mockCarOut(self, sentryLogin, send_data, expect):
"""离场"""
<|body_0|>
def test_sentryAbnormalPay(self, sentryLogin, send_data, expect):
"""岗亭端收费异常放行"""
<|body_1|>
def test_carLeaveHistory(self... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestCarOutNoInside:
"""临时车无在场需缴费宽出(岗亭收费处收费放行)"""
def test_mockCarOut(self, sentryLogin, send_data, expect):
"""离场"""
re = cloudparking_service().mockCarInOut(send_data['carNum'], 1, send_data['outClientID'])
result = re
Assertions().assert_in_text(result, expect['mockCarOu... | the_stack_v2_python_sparse | test_suite/sentryDutyRoom/carInOutHandle/test_carOutNoInside.py | oyebino/pomp_api | train | 1 |
734f2ebf461d2224a1bf3764aec326ceb6686102 | [
"if root == None:\n return '[null]'\nre, ls, levelCnt, lev = ([], [[root, 1]], 1, 0)\nwhile len(ls) > 0:\n p = ls.pop(0)\n if lev != p[1]:\n if levelCnt <= 0:\n break\n lev, levelCnt = (p[1], 0)\n if p[0] != None:\n re.append(str(p[0].val))\n ls.append([p[0].left, ... | <|body_start_0|>
if root == None:
return '[null]'
re, ls, levelCnt, lev = ([], [[root, 1]], 1, 0)
while len(ls) > 0:
p = ls.pop(0)
if lev != p[1]:
if levelCnt <= 0:
break
lev, levelCnt = (p[1], 0)
... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_10k_train_007980 | 3,082 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | null | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | 737b9bac5a73c319e46cda8c3e9d729f734d7792 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
if root == None:
return '[null]'
re, ls, levelCnt, lev = ([], [[root, 1]], 1, 0)
while len(ls) > 0:
p = ls.pop(0)
if lev != p[1]:
... | the_stack_v2_python_sparse | leetcode/python/297-serialize-and-deserialize-binary-tree.py | iampkuhz/OnlineJudge_cpp | train | 0 | |
87ecd5518f3befb9afe7101947964df954e1d40e | [
"checked_choid: Set[ObjectId] = set()\nret: List[ChannelData] = []\nmissing = []\nch_oids = ProfileManager.get_users_exist_channel_dict([root_oid]).get(root_oid)\nif not ch_oids:\n return ret\nfor ch_model in ChannelManager.get_channel_default_name(keyword, hide_private=True):\n ch_oid = ch_model.id\n if c... | <|body_start_0|>
checked_choid: Set[ObjectId] = set()
ret: List[ChannelData] = []
missing = []
ch_oids = ProfileManager.get_users_exist_channel_dict([root_oid]).get(root_oid)
if not ch_oids:
return ret
for ch_model in ChannelManager.get_channel_default_name(ke... | Class to search for any types of identity data. | IdentitySearcher | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IdentitySearcher:
"""Class to search for any types of identity data."""
def search_channel(keyword: str, root_oid: ObjectId) -> List[ChannelData]:
"""Search the channels that the user ``root_oid`` is inside using ``keyword``. This search **hides** all private channels. Returned resul... | stack_v2_sparse_classes_10k_train_007981 | 4,634 | permissive | [
{
"docstring": "Search the channels that the user ``root_oid`` is inside using ``keyword``. This search **hides** all private channels. Returned result will be sorted by last message time (DESC) then by its ID (DESC). ----------- ``keyword`` can be: - partial word from the message of a channel - a part of the d... | 2 | stack_v2_sparse_classes_30k_train_001117 | Implement the Python class `IdentitySearcher` described below.
Class description:
Class to search for any types of identity data.
Method signatures and docstrings:
- def search_channel(keyword: str, root_oid: ObjectId) -> List[ChannelData]: Search the channels that the user ``root_oid`` is inside using ``keyword``. T... | Implement the Python class `IdentitySearcher` described below.
Class description:
Class to search for any types of identity data.
Method signatures and docstrings:
- def search_channel(keyword: str, root_oid: ObjectId) -> List[ChannelData]: Search the channels that the user ``root_oid`` is inside using ``keyword``. T... | c7da1e91783dce3a2b71b955b3a22b68db9056cf | <|skeleton|>
class IdentitySearcher:
"""Class to search for any types of identity data."""
def search_channel(keyword: str, root_oid: ObjectId) -> List[ChannelData]:
"""Search the channels that the user ``root_oid`` is inside using ``keyword``. This search **hides** all private channels. Returned resul... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class IdentitySearcher:
"""Class to search for any types of identity data."""
def search_channel(keyword: str, root_oid: ObjectId) -> List[ChannelData]:
"""Search the channels that the user ``root_oid`` is inside using ``keyword``. This search **hides** all private channels. Returned result will be sor... | the_stack_v2_python_sparse | mongodb/helper/search.py | RxJellyBot/Jelly-Bot | train | 5 |
acb158bed21a097adecc23ddab1a1fc3dda7b1e6 | [
"super().__init__()\nself.min_iterations = min_iterations\nself.max_iterations = max_iterations\nself.atol = atol\nself.gaptol = gaptol",
"self.particle_weights = np.array([1])\nmarginal, gap_between_consecutives = loopy_belief_propagation(state.past_test_results, state.past_groups, state.prior_infection_rate, st... | <|body_start_0|>
super().__init__()
self.min_iterations = min_iterations
self.max_iterations = max_iterations
self.atol = atol
self.gaptol = gaptol
<|end_body_0|>
<|body_start_1|>
self.particle_weights = np.array([1])
marginal, gap_between_consecutives = loopy_be... | Loopy Belief Propagation approximation to Marginal. | LbpSampler | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LbpSampler:
"""Loopy Belief Propagation approximation to Marginal."""
def __init__(self, min_iterations=10, max_iterations=1000, atol=0.0001, gaptol=0.01):
"""Initialize LbpSampler with parameters passed on to LBP algorithm. Args: min_iterations : int, minimal number of executions pe... | stack_v2_sparse_classes_10k_train_007982 | 7,089 | permissive | [
{
"docstring": "Initialize LbpSampler with parameters passed on to LBP algorithm. Args: min_iterations : int, minimal number of executions per loop of LBP max_iterations : int, maximal number of iterations LBP updates marginal atol : float, tolerance parameter used to measure discrepancy between two consecutive... | 2 | stack_v2_sparse_classes_30k_train_002642 | Implement the Python class `LbpSampler` described below.
Class description:
Loopy Belief Propagation approximation to Marginal.
Method signatures and docstrings:
- def __init__(self, min_iterations=10, max_iterations=1000, atol=0.0001, gaptol=0.01): Initialize LbpSampler with parameters passed on to LBP algorithm. Ar... | Implement the Python class `LbpSampler` described below.
Class description:
Loopy Belief Propagation approximation to Marginal.
Method signatures and docstrings:
- def __init__(self, min_iterations=10, max_iterations=1000, atol=0.0001, gaptol=0.01): Initialize LbpSampler with parameters passed on to LBP algorithm. Ar... | 727ec399ad17b4dd1f71ce69a26fc3b0371d9fa7 | <|skeleton|>
class LbpSampler:
"""Loopy Belief Propagation approximation to Marginal."""
def __init__(self, min_iterations=10, max_iterations=1000, atol=0.0001, gaptol=0.01):
"""Initialize LbpSampler with parameters passed on to LBP algorithm. Args: min_iterations : int, minimal number of executions pe... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class LbpSampler:
"""Loopy Belief Propagation approximation to Marginal."""
def __init__(self, min_iterations=10, max_iterations=1000, atol=0.0001, gaptol=0.01):
"""Initialize LbpSampler with parameters passed on to LBP algorithm. Args: min_iterations : int, minimal number of executions per loop of LBP... | the_stack_v2_python_sparse | grouptesting/samplers/loopy_belief_propagation.py | Ayoob7/google-research | train | 2 |
ad3e822a848fb09cb289c5f4a5df3359ac7a962e | [
"if self.request.method == 'GET':\n return (IsInActiveCommunity(), IsInPubliclyVisibleCommunity())\nelif self.request.method == 'POST':\n return (permissions.IsAuthenticated(),)\nelif self.request.method in ('PUT', 'PATCH'):\n return (permissions.IsAuthenticated(), IsInActiveCommunity(), IsAbleToUpdateCust... | <|body_start_0|>
if self.request.method == 'GET':
return (IsInActiveCommunity(), IsInPubliclyVisibleCommunity())
elif self.request.method == 'POST':
return (permissions.IsAuthenticated(),)
elif self.request.method in ('PUT', 'PATCH'):
return (permissions.IsAut... | Custom membership label view set | CustomMembershipLabelViewSet | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CustomMembershipLabelViewSet:
"""Custom membership label view set"""
def get_permissions(self):
"""Get permissions"""
<|body_0|>
def get_serializer_class(self):
"""Get serializer class"""
<|body_1|>
def list(self, request, *args, **kwargs):
"... | stack_v2_sparse_classes_10k_train_007983 | 27,778 | permissive | [
{
"docstring": "Get permissions",
"name": "get_permissions",
"signature": "def get_permissions(self)"
},
{
"docstring": "Get serializer class",
"name": "get_serializer_class",
"signature": "def get_serializer_class(self)"
},
{
"docstring": "List custom membership labels",
"na... | 3 | stack_v2_sparse_classes_30k_train_002472 | Implement the Python class `CustomMembershipLabelViewSet` described below.
Class description:
Custom membership label view set
Method signatures and docstrings:
- def get_permissions(self): Get permissions
- def get_serializer_class(self): Get serializer class
- def list(self, request, *args, **kwargs): List custom m... | Implement the Python class `CustomMembershipLabelViewSet` described below.
Class description:
Custom membership label view set
Method signatures and docstrings:
- def get_permissions(self): Get permissions
- def get_serializer_class(self): Get serializer class
- def list(self, request, *args, **kwargs): List custom m... | cf429f43251ad7e77c0d9bc9fe91bb030ca8bae8 | <|skeleton|>
class CustomMembershipLabelViewSet:
"""Custom membership label view set"""
def get_permissions(self):
"""Get permissions"""
<|body_0|>
def get_serializer_class(self):
"""Get serializer class"""
<|body_1|>
def list(self, request, *args, **kwargs):
"... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CustomMembershipLabelViewSet:
"""Custom membership label view set"""
def get_permissions(self):
"""Get permissions"""
if self.request.method == 'GET':
return (IsInActiveCommunity(), IsInPubliclyVisibleCommunity())
elif self.request.method == 'POST':
return ... | the_stack_v2_python_sparse | membership/views.py | 810Teams/clubs-and-events-backend | train | 3 |
454e693ba128413c4932d0eaaa442ba159c9b180 | [
"if training_type == TrainingType.NLU:\n core_required = False\n core_target = None\nelse:\n core_required = True\n core_target = config.get('core_target')\nnlu_target = config.get('nlu_target')\nif nlu_target is None or (core_required and core_target is None):\n raise InvalidConfigException(\"Can't ... | <|body_start_0|>
if training_type == TrainingType.NLU:
core_required = False
core_target = None
else:
core_required = True
core_target = config.get('core_target')
nlu_target = config.get('nlu_target')
if nlu_target is None or (core_required... | Recipe which converts the graph model config to train and predict graph. | GraphV1Recipe | [
"LicenseRef-scancode-generic-cla",
"Apache-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GraphV1Recipe:
"""Recipe which converts the graph model config to train and predict graph."""
def get_targets(self, config: Dict, training_type: TrainingType) -> Tuple[Text, Any]:
"""Return NLU and core targets from config dictionary. Note that default recipe has `nlu_target` and `co... | stack_v2_sparse_classes_10k_train_007984 | 3,301 | permissive | [
{
"docstring": "Return NLU and core targets from config dictionary. Note that default recipe has `nlu_target` and `core_target` as fixed values of `run_RegexMessageHandler` and `select_prediction` respectively. For graph recipe, target values are customizable. These can be used in validation (default recipe doe... | 2 | stack_v2_sparse_classes_30k_train_002757 | Implement the Python class `GraphV1Recipe` described below.
Class description:
Recipe which converts the graph model config to train and predict graph.
Method signatures and docstrings:
- def get_targets(self, config: Dict, training_type: TrainingType) -> Tuple[Text, Any]: Return NLU and core targets from config dict... | Implement the Python class `GraphV1Recipe` described below.
Class description:
Recipe which converts the graph model config to train and predict graph.
Method signatures and docstrings:
- def get_targets(self, config: Dict, training_type: TrainingType) -> Tuple[Text, Any]: Return NLU and core targets from config dict... | 50857610bdf0c26dc61f3203a6cbb4bcf193768c | <|skeleton|>
class GraphV1Recipe:
"""Recipe which converts the graph model config to train and predict graph."""
def get_targets(self, config: Dict, training_type: TrainingType) -> Tuple[Text, Any]:
"""Return NLU and core targets from config dictionary. Note that default recipe has `nlu_target` and `co... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GraphV1Recipe:
"""Recipe which converts the graph model config to train and predict graph."""
def get_targets(self, config: Dict, training_type: TrainingType) -> Tuple[Text, Any]:
"""Return NLU and core targets from config dictionary. Note that default recipe has `nlu_target` and `core_target` as... | the_stack_v2_python_sparse | rasa/engine/recipes/graph_recipe.py | RasaHQ/rasa | train | 13,167 |
c04b77031f4830aea5281031d539843413e662a2 | [
"self.d = {}\nself.dict = dictionary = set(dictionary)\nfor word in dictionary:\n wordLen = len(word)\n if wordLen > 2:\n key = word[0] + str(wordLen - 2) + word[-1]\n self.d[key] = self.d.get(key, 0) + 1\n else:\n self.d[word] = self.d.get(word, 0) + 1",
"wordLen = len(word)\nkey = ... | <|body_start_0|>
self.d = {}
self.dict = dictionary = set(dictionary)
for word in dictionary:
wordLen = len(word)
if wordLen > 2:
key = word[0] + str(wordLen - 2) + word[-1]
self.d[key] = self.d.get(key, 0) + 1
else:
... | ValidWordAbbr | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ValidWordAbbr:
def __init__(self, dictionary):
"""initialize your data structure here. :type dictionary: List[str]"""
<|body_0|>
def isUnique(self, word):
"""check if a word is unique. :type word: str :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start... | stack_v2_sparse_classes_10k_train_007985 | 989 | no_license | [
{
"docstring": "initialize your data structure here. :type dictionary: List[str]",
"name": "__init__",
"signature": "def __init__(self, dictionary)"
},
{
"docstring": "check if a word is unique. :type word: str :rtype: bool",
"name": "isUnique",
"signature": "def isUnique(self, word)"
... | 2 | stack_v2_sparse_classes_30k_train_000827 | Implement the Python class `ValidWordAbbr` described below.
Class description:
Implement the ValidWordAbbr class.
Method signatures and docstrings:
- def __init__(self, dictionary): initialize your data structure here. :type dictionary: List[str]
- def isUnique(self, word): check if a word is unique. :type word: str ... | Implement the Python class `ValidWordAbbr` described below.
Class description:
Implement the ValidWordAbbr class.
Method signatures and docstrings:
- def __init__(self, dictionary): initialize your data structure here. :type dictionary: List[str]
- def isUnique(self, word): check if a word is unique. :type word: str ... | 929dde1723fb2f54870c8a9badc80fc23e8400d3 | <|skeleton|>
class ValidWordAbbr:
def __init__(self, dictionary):
"""initialize your data structure here. :type dictionary: List[str]"""
<|body_0|>
def isUnique(self, word):
"""check if a word is unique. :type word: str :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ValidWordAbbr:
def __init__(self, dictionary):
"""initialize your data structure here. :type dictionary: List[str]"""
self.d = {}
self.dict = dictionary = set(dictionary)
for word in dictionary:
wordLen = len(word)
if wordLen > 2:
key = w... | the_stack_v2_python_sparse | _algorithms_challenges/leetcode/lc-all-solutions/288.unique-word-abbreviation/unique-word-abbreviation.py | syurskyi/Algorithms_and_Data_Structure | train | 4 | |
1ce9646cc7a8a4278dfbfcde159bdfa0b06f05b5 | [
"gt_bboxes, gt_bboxes_ignore = ([], [])\ngt_masks, gt_masks_ignore = ([], [])\ngt_labels = []\nfor ann in annotations:\n if ann.get('iscrowd', False):\n gt_bboxes_ignore.append(ann['bbox'])\n gt_masks_ignore.append(ann.get('segmentation', None))\n else:\n gt_bboxes.append(ann['bbox'])\n ... | <|body_start_0|>
gt_bboxes, gt_bboxes_ignore = ([], [])
gt_masks, gt_masks_ignore = ([], [])
gt_labels = []
for ann in annotations:
if ann.get('iscrowd', False):
gt_bboxes_ignore.append(ann['bbox'])
gt_masks_ignore.append(ann.get('segmentation'... | TextDetDataset | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TextDetDataset:
def _parse_anno_info(self, annotations):
"""Parse bbox and mask annotation. Args: annotations (dict): Annotations of one image. Returns: dict: A dict containing the following keys: bboxes, bboxes_ignore, labels, masks, masks_ignore. "masks" and "masks_ignore" are represen... | stack_v2_sparse_classes_10k_train_007986 | 4,665 | permissive | [
{
"docstring": "Parse bbox and mask annotation. Args: annotations (dict): Annotations of one image. Returns: dict: A dict containing the following keys: bboxes, bboxes_ignore, labels, masks, masks_ignore. \"masks\" and \"masks_ignore\" are represented by polygon boundary point sequences.",
"name": "_parse_a... | 3 | stack_v2_sparse_classes_30k_train_004800 | Implement the Python class `TextDetDataset` described below.
Class description:
Implement the TextDetDataset class.
Method signatures and docstrings:
- def _parse_anno_info(self, annotations): Parse bbox and mask annotation. Args: annotations (dict): Annotations of one image. Returns: dict: A dict containing the foll... | Implement the Python class `TextDetDataset` described below.
Class description:
Implement the TextDetDataset class.
Method signatures and docstrings:
- def _parse_anno_info(self, annotations): Parse bbox and mask annotation. Args: annotations (dict): Annotations of one image. Returns: dict: A dict containing the foll... | 89bf8a218881b250d0ead7a0287526c69586c92a | <|skeleton|>
class TextDetDataset:
def _parse_anno_info(self, annotations):
"""Parse bbox and mask annotation. Args: annotations (dict): Annotations of one image. Returns: dict: A dict containing the following keys: bboxes, bboxes_ignore, labels, masks, masks_ignore. "masks" and "masks_ignore" are represen... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TextDetDataset:
def _parse_anno_info(self, annotations):
"""Parse bbox and mask annotation. Args: annotations (dict): Annotations of one image. Returns: dict: A dict containing the following keys: bboxes, bboxes_ignore, labels, masks, masks_ignore. "masks" and "masks_ignore" are represented by polygon... | the_stack_v2_python_sparse | mmocr/datasets/text_det_dataset.py | xdxie/WordArt | train | 106 | |
22861d043b1f770aae6fb2a1642c34732b6f22e7 | [
"exchange = quote(exchange, '')\nproperties = properties or {}\nbody = json.dumps({'routing_key': routing_key, 'payload': body, 'payload_encoding': payload_encoding, 'properties': properties, 'vhost': virtual_host})\nvirtual_host = quote(virtual_host, '')\nreturn self.http_client.post(API_BASIC_PUBLISH % (virtual_h... | <|body_start_0|>
exchange = quote(exchange, '')
properties = properties or {}
body = json.dumps({'routing_key': routing_key, 'payload': body, 'payload_encoding': payload_encoding, 'properties': properties, 'vhost': virtual_host})
virtual_host = quote(virtual_host, '')
return self... | Basic | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Basic:
def publish(self, body, routing_key, exchange='amq.default', virtual_host='/', properties=None, payload_encoding='string'):
"""Publish a Message. :param bytes|str|unicode body: Message payload :param str routing_key: Message routing key :param str exchange: The exchange to publish... | stack_v2_sparse_classes_10k_train_007987 | 3,574 | permissive | [
{
"docstring": "Publish a Message. :param bytes|str|unicode body: Message payload :param str routing_key: Message routing key :param str exchange: The exchange to publish the message to :param str virtual_host: Virtual host name :param dict properties: Message properties :param str payload_encoding: Payload enc... | 2 | stack_v2_sparse_classes_30k_train_003240 | Implement the Python class `Basic` described below.
Class description:
Implement the Basic class.
Method signatures and docstrings:
- def publish(self, body, routing_key, exchange='amq.default', virtual_host='/', properties=None, payload_encoding='string'): Publish a Message. :param bytes|str|unicode body: Message pa... | Implement the Python class `Basic` described below.
Class description:
Implement the Basic class.
Method signatures and docstrings:
- def publish(self, body, routing_key, exchange='amq.default', virtual_host='/', properties=None, payload_encoding='string'): Publish a Message. :param bytes|str|unicode body: Message pa... | ca2e086818433abc08c014dd06bfd22d4985ea2a | <|skeleton|>
class Basic:
def publish(self, body, routing_key, exchange='amq.default', virtual_host='/', properties=None, payload_encoding='string'):
"""Publish a Message. :param bytes|str|unicode body: Message payload :param str routing_key: Message routing key :param str exchange: The exchange to publish... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Basic:
def publish(self, body, routing_key, exchange='amq.default', virtual_host='/', properties=None, payload_encoding='string'):
"""Publish a Message. :param bytes|str|unicode body: Message payload :param str routing_key: Message routing key :param str exchange: The exchange to publish the message t... | the_stack_v2_python_sparse | amqpstorm/management/basic.py | fake-name/ReadableWebProxy | train | 207 | |
c851c9a22e38ca3d9fd3456fe4318a535643a750 | [
"for order in self.browse(cr, uid, ids, context=context):\n if not order.order_line:\n raise osv.except_osv(_('Error !'), _('You can not confirm the order without order lines.'))\n x = 0\n for line in order.order_line:\n if line.product_id.asset == True:\n x += 1\n if x > 0 and... | <|body_start_0|>
for order in self.browse(cr, uid, ids, context=context):
if not order.order_line:
raise osv.except_osv(_('Error !'), _('You can not confirm the order without order lines.'))
x = 0
for line in order.order_line:
if line.product_... | exchange_order | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class exchange_order:
def action_confirm_order(self, cr, uid, ids, context=None):
"""wf_service Changes order state to confirm. @return: True"""
<|body_0|>
def _prepare_order_picking(self, cr, uid, order, context=None):
"""Prepare the dict of values to create the new picki... | stack_v2_sparse_classes_10k_train_007988 | 14,719 | no_license | [
{
"docstring": "wf_service Changes order state to confirm. @return: True",
"name": "action_confirm_order",
"signature": "def action_confirm_order(self, cr, uid, ids, context=None)"
},
{
"docstring": "Prepare the dict of values to create the new picking for a exchange order. This method may be ov... | 2 | stack_v2_sparse_classes_30k_train_005424 | Implement the Python class `exchange_order` described below.
Class description:
Implement the exchange_order class.
Method signatures and docstrings:
- def action_confirm_order(self, cr, uid, ids, context=None): wf_service Changes order state to confirm. @return: True
- def _prepare_order_picking(self, cr, uid, order... | Implement the Python class `exchange_order` described below.
Class description:
Implement the exchange_order class.
Method signatures and docstrings:
- def action_confirm_order(self, cr, uid, ids, context=None): wf_service Changes order state to confirm. @return: True
- def _prepare_order_picking(self, cr, uid, order... | 0b997095c260d58b026440967fea3a202bef7efb | <|skeleton|>
class exchange_order:
def action_confirm_order(self, cr, uid, ids, context=None):
"""wf_service Changes order state to confirm. @return: True"""
<|body_0|>
def _prepare_order_picking(self, cr, uid, order, context=None):
"""Prepare the dict of values to create the new picki... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class exchange_order:
def action_confirm_order(self, cr, uid, ids, context=None):
"""wf_service Changes order state to confirm. @return: True"""
for order in self.browse(cr, uid, ids, context=context):
if not order.order_line:
raise osv.except_osv(_('Error !'), _('You can... | the_stack_v2_python_sparse | v_7/NISS/shamil_v3/account_asset_custody_niss/stock.py | musabahmed/baba | train | 0 | |
1a4fcfbc2af81d0722cb695cfefe25bddde9d8ad | [
"fields = super(HistoricalRecords, self).copy_fields(model)\nfor name, field in self.additional_fields.items():\n assert name not in fields\n assert hasattr(self, 'get_%s_value' % name)\n fields[name] = field\nreturn fields",
"extra_fields = super(HistoricalRecords, self).get_extra_fields(model, fields)\... | <|body_start_0|>
fields = super(HistoricalRecords, self).copy_fields(model)
for name, field in self.additional_fields.items():
assert name not in fields
assert hasattr(self, 'get_%s_value' % name)
fields[name] = field
return fields
<|end_body_0|>
<|body_start... | simple_history.HistoricalRecords with modifications. Changes from simple_history: * Can add additional fields (e.g., preserve relationship order) * References a history_changeset instead of a history_user | HistoricalRecords | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HistoricalRecords:
"""simple_history.HistoricalRecords with modifications. Changes from simple_history: * Can add additional fields (e.g., preserve relationship order) * References a history_changeset instead of a history_user"""
def copy_fields(self, model):
"""Add additional_fields... | stack_v2_sparse_classes_10k_train_007989 | 7,986 | no_license | [
{
"docstring": "Add additional_fields to the historic model.",
"name": "copy_fields",
"signature": "def copy_fields(self, model)"
},
{
"docstring": "Remove fields moved to changeset.",
"name": "get_extra_fields",
"signature": "def get_extra_fields(self, model, fields)"
},
{
"docs... | 4 | stack_v2_sparse_classes_30k_val_000342 | Implement the Python class `HistoricalRecords` described below.
Class description:
simple_history.HistoricalRecords with modifications. Changes from simple_history: * Can add additional fields (e.g., preserve relationship order) * References a history_changeset instead of a history_user
Method signatures and docstrin... | Implement the Python class `HistoricalRecords` described below.
Class description:
simple_history.HistoricalRecords with modifications. Changes from simple_history: * Can add additional fields (e.g., preserve relationship order) * References a history_changeset instead of a history_user
Method signatures and docstrin... | bc092964153b03381aaff74a4d80f43a2b2dec19 | <|skeleton|>
class HistoricalRecords:
"""simple_history.HistoricalRecords with modifications. Changes from simple_history: * Can add additional fields (e.g., preserve relationship order) * References a history_changeset instead of a history_user"""
def copy_fields(self, model):
"""Add additional_fields... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class HistoricalRecords:
"""simple_history.HistoricalRecords with modifications. Changes from simple_history: * Can add additional fields (e.g., preserve relationship order) * References a history_changeset instead of a history_user"""
def copy_fields(self, model):
"""Add additional_fields to the histo... | the_stack_v2_python_sparse | browsercompat/webplatformcompat/history.py | WeilerWebServices/MDN-Web-Docs | train | 1 |
39adad70f87fcde5a6fa3503fa58835bcf195f43 | [
"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... | A set of methods for managing access keys. | AccessKeyServiceServicer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AccessKeyServiceServicer:
"""A set of methods for managing access keys."""
def List(self, request, context):
"""Retrieves the list of access keys for the specified service account."""
<|body_0|>
def Get(self, request, context):
"""Returns the specified access key... | stack_v2_sparse_classes_10k_train_007990 | 13,154 | permissive | [
{
"docstring": "Retrieves the list of access keys for the specified service account.",
"name": "List",
"signature": "def List(self, request, context)"
},
{
"docstring": "Returns the specified access key. To get the list of available access keys, make a [List] request.",
"name": "Get",
"s... | 6 | stack_v2_sparse_classes_30k_train_005771 | Implement the Python class `AccessKeyServiceServicer` described below.
Class description:
A set of methods for managing access keys.
Method signatures and docstrings:
- def List(self, request, context): Retrieves the list of access keys for the specified service account.
- def Get(self, request, context): Returns the... | Implement the Python class `AccessKeyServiceServicer` described below.
Class description:
A set of methods for managing access keys.
Method signatures and docstrings:
- def List(self, request, context): Retrieves the list of access keys for the specified service account.
- def Get(self, request, context): Returns the... | b906a014dd893e2697864e1e48e814a8d9fbc48c | <|skeleton|>
class AccessKeyServiceServicer:
"""A set of methods for managing access keys."""
def List(self, request, context):
"""Retrieves the list of access keys for the specified service account."""
<|body_0|>
def Get(self, request, context):
"""Returns the specified access key... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AccessKeyServiceServicer:
"""A set of methods for managing access keys."""
def List(self, request, context):
"""Retrieves the list of access keys for the specified service account."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
... | the_stack_v2_python_sparse | yandex/cloud/iam/v1/awscompatibility/access_key_service_pb2_grpc.py | yandex-cloud/python-sdk | train | 63 |
4f3320ad73bcc1cd6d6795b273cc99eebcebb0b2 | [
"self.head = None\nself.tail = None\nself.length = 0",
"if index < 0 or index >= self.length:\n return -1\nresult = self.head\nfor i in range(index):\n result = result.next\nreturn result.val",
"if self.head is None:\n self.head = self.ListNode(val, None, None)\n self.tail = self.head\nelse:\n te... | <|body_start_0|>
self.head = None
self.tail = None
self.length = 0
<|end_body_0|>
<|body_start_1|>
if index < 0 or index >= self.length:
return -1
result = self.head
for i in range(index):
result = result.next
return result.val
<|end_body_... | MyLinkedList | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyLinkedList:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def get(self, index: int) -> int:
"""Get the value of the index-th node in the linked list. If the index is invalid, return -1."""
<|body_1|>
def addAtHead(self, val:... | stack_v2_sparse_classes_10k_train_007991 | 3,577 | no_license | [
{
"docstring": "Initialize your data structure here.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Get the value of the index-th node in the linked list. If the index is invalid, return -1.",
"name": "get",
"signature": "def get(self, index: int) -> int"
},... | 6 | null | Implement the Python class `MyLinkedList` described below.
Class description:
Implement the MyLinkedList class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def get(self, index: int) -> int: Get the value of the index-th node in the linked list. If the index is invali... | Implement the Python class `MyLinkedList` described below.
Class description:
Implement the MyLinkedList class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def get(self, index: int) -> int: Get the value of the index-th node in the linked list. If the index is invali... | a0ab59ba0a1a11a06b7086aa8f791293ec9c7139 | <|skeleton|>
class MyLinkedList:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def get(self, index: int) -> int:
"""Get the value of the index-th node in the linked list. If the index is invalid, return -1."""
<|body_1|>
def addAtHead(self, val:... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MyLinkedList:
def __init__(self):
"""Initialize your data structure here."""
self.head = None
self.tail = None
self.length = 0
def get(self, index: int) -> int:
"""Get the value of the index-th node in the linked list. If the index is invalid, return -1."""
... | the_stack_v2_python_sparse | leetCodePython2020/707.design-linked-list.py | HOZH/leetCode | train | 2 | |
a119e3072d4c53a267a94ca999c4f2c51ab457a1 | [
"name = operation['name']\nif name in self.operations:\n raise ValueError('operation name already registered: {}'.format(name))\nself.operations[name] = _Operation({**operation, 'resource': self})",
"super().__init__()\nself.name = name or getattr(self, 'name', type(self).__name__.lower())\nself.description = ... | <|body_start_0|>
name = operation['name']
if name in self.operations:
raise ValueError('operation name already registered: {}'.format(name))
self.operations[name] = _Operation({**operation, 'resource': self})
<|end_body_0|>
<|body_start_1|>
super().__init__()
self.na... | Base class for a resource. | Resource | [
"Python-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Resource:
"""Base class for a resource."""
def _register_operation(self, **operation):
"""Register a resource operation."""
<|body_0|>
def __init__(self, name=None, description=None):
"""Initialize resource. Arguments can be alternatively declared as class or ins... | stack_v2_sparse_classes_10k_train_007992 | 10,795 | permissive | [
{
"docstring": "Register a resource operation.",
"name": "_register_operation",
"signature": "def _register_operation(self, **operation)"
},
{
"docstring": "Initialize resource. Arguments can be alternatively declared as class or instance variables. :param name: Short name of the resource. [clas... | 2 | stack_v2_sparse_classes_30k_train_000594 | Implement the Python class `Resource` described below.
Class description:
Base class for a resource.
Method signatures and docstrings:
- def _register_operation(self, **operation): Register a resource operation.
- def __init__(self, name=None, description=None): Initialize resource. Arguments can be alternatively dec... | Implement the Python class `Resource` described below.
Class description:
Base class for a resource.
Method signatures and docstrings:
- def _register_operation(self, **operation): Register a resource operation.
- def __init__(self, name=None, description=None): Initialize resource. Arguments can be alternatively dec... | 19e8d396aa9f3b6df28f773d06846d2bb58d1674 | <|skeleton|>
class Resource:
"""Base class for a resource."""
def _register_operation(self, **operation):
"""Register a resource operation."""
<|body_0|>
def __init__(self, name=None, description=None):
"""Initialize resource. Arguments can be alternatively declared as class or ins... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Resource:
"""Base class for a resource."""
def _register_operation(self, **operation):
"""Register a resource operation."""
name = operation['name']
if name in self.operations:
raise ValueError('operation name already registered: {}'.format(name))
self.operatio... | the_stack_v2_python_sparse | src/roax/resource.py | lliu8080/roax | train | 0 |
3c2ae1718db51e2625f9bb18367957de2df00787 | [
"super(ReparametrisedGaussianEncoder, self).__init__(data_dim=data_dim, noise_dim=noise_dim, latent_dim=latent_dim, network_architecture=network_architecture, name=name or 'Reparametrised Gaussian Encoder')\nlatent_mean, latent_log_var = get_network_by_name['reparametrised_encoder'][network_architecture](self.data_... | <|body_start_0|>
super(ReparametrisedGaussianEncoder, self).__init__(data_dim=data_dim, noise_dim=noise_dim, latent_dim=latent_dim, network_architecture=network_architecture, name=name or 'Reparametrised Gaussian Encoder')
latent_mean, latent_log_var = get_network_by_name['reparametrised_encoder'][netwo... | A ReparametrisedGaussianEncoder model is trained to parametrise a Gaussian latent variables: Data | ----------- | Encoder | ----------- | mu + sigma * Noise <--- Reparametrised Gaussian latent space | ReparametrisedGaussianEncoder | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReparametrisedGaussianEncoder:
"""A ReparametrisedGaussianEncoder model is trained to parametrise a Gaussian latent variables: Data | ----------- | Encoder | ----------- | mu + sigma * Noise <--- Reparametrised Gaussian latent space"""
def __init__(self, data_dim, noise_dim, latent_dim, netw... | stack_v2_sparse_classes_10k_train_007993 | 23,104 | permissive | [
{
"docstring": "Args: data_dim: int, flattened data space dimensionality noise_dim: int, flattened noise space dimensionality latent_dim: int, flattened latent space dimensionality network_architecture: str, the architecture name for the body of the reparametrised Gaussian Encoder model name: str, optional iden... | 2 | stack_v2_sparse_classes_30k_test_000084 | Implement the Python class `ReparametrisedGaussianEncoder` described below.
Class description:
A ReparametrisedGaussianEncoder model is trained to parametrise a Gaussian latent variables: Data | ----------- | Encoder | ----------- | mu + sigma * Noise <--- Reparametrised Gaussian latent space
Method signatures and do... | Implement the Python class `ReparametrisedGaussianEncoder` described below.
Class description:
A ReparametrisedGaussianEncoder model is trained to parametrise a Gaussian latent variables: Data | ----------- | Encoder | ----------- | mu + sigma * Noise <--- Reparametrised Gaussian latent space
Method signatures and do... | 545e4993c90622f05b5b7ba0183bc07d5972371e | <|skeleton|>
class ReparametrisedGaussianEncoder:
"""A ReparametrisedGaussianEncoder model is trained to parametrise a Gaussian latent variables: Data | ----------- | Encoder | ----------- | mu + sigma * Noise <--- Reparametrised Gaussian latent space"""
def __init__(self, data_dim, noise_dim, latent_dim, netw... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ReparametrisedGaussianEncoder:
"""A ReparametrisedGaussianEncoder model is trained to parametrise a Gaussian latent variables: Data | ----------- | Encoder | ----------- | mu + sigma * Noise <--- Reparametrised Gaussian latent space"""
def __init__(self, data_dim, noise_dim, latent_dim, network_architect... | the_stack_v2_python_sparse | playground/models/networks/encoder.py | gdikov/vae-playground | train | 1 |
b0288d915642e58ee4c56f2011056b7002ce162a | [
"exporter = tsert_export(filename)\nexporter.set_electrode_positions(self.electrode_positions)\nexporter.set_topography(self.topography)\nexporter.add_data(self.data, version, **kwargs)\nexporter.add_metadata(self.metadata)",
"logger.info('Exporting to pygimli DataContainer')\nlogger.info('{} data will be exporte... | <|body_start_0|>
exporter = tsert_export(filename)
exporter.set_electrode_positions(self.electrode_positions)
exporter.set_topography(self.topography)
exporter.add_data(self.data, version, **kwargs)
exporter.add_metadata(self.metadata)
<|end_body_0|>
<|body_start_1|>
log... | ERTExporters | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ERTExporters:
def export_tsert(self, filename, version, **kwargs):
"""Export data to TSERT"""
<|body_0|>
def export_to_pygimli_scheme(self, norrec='nor', timestep=None):
"""Export the data into a pygimili.DataContainerERT object. For now, do NOT set any sensor positi... | stack_v2_sparse_classes_10k_train_007994 | 12,616 | permissive | [
{
"docstring": "Export data to TSERT",
"name": "export_tsert",
"signature": "def export_tsert(self, filename, version, **kwargs)"
},
{
"docstring": "Export the data into a pygimili.DataContainerERT object. For now, do NOT set any sensor positions Parameters ---------- Returns -------",
"name... | 2 | stack_v2_sparse_classes_30k_train_002989 | Implement the Python class `ERTExporters` described below.
Class description:
Implement the ERTExporters class.
Method signatures and docstrings:
- def export_tsert(self, filename, version, **kwargs): Export data to TSERT
- def export_to_pygimli_scheme(self, norrec='nor', timestep=None): Export the data into a pygimi... | Implement the Python class `ERTExporters` described below.
Class description:
Implement the ERTExporters class.
Method signatures and docstrings:
- def export_tsert(self, filename, version, **kwargs): Export data to TSERT
- def export_to_pygimli_scheme(self, norrec='nor', timestep=None): Export the data into a pygimi... | adecc344837c0bf53c5e005a97c2c231b6f9eac2 | <|skeleton|>
class ERTExporters:
def export_tsert(self, filename, version, **kwargs):
"""Export data to TSERT"""
<|body_0|>
def export_to_pygimli_scheme(self, norrec='nor', timestep=None):
"""Export the data into a pygimili.DataContainerERT object. For now, do NOT set any sensor positi... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ERTExporters:
def export_tsert(self, filename, version, **kwargs):
"""Export data to TSERT"""
exporter = tsert_export(filename)
exporter.set_electrode_positions(self.electrode_positions)
exporter.set_topography(self.topography)
exporter.add_data(self.data, version, **kw... | the_stack_v2_python_sparse | lib/reda/containers/ERT.py | geophysics-ubonn/reda | train | 14 | |
951e9294f4c0d4c9c9346e4886fe1ecf234a15d0 | [
"if data is not None:\n if not isinstance(data, list):\n raise TypeError('data must be a list')\n if len(data) <= 2:\n raise ValueError('data must contain multiple values')\n mean = sum(data) / len(data)\n variance = 0\n for x in data:\n variance += (x - mean) ** 2\n variance ... | <|body_start_0|>
if data is not None:
if not isinstance(data, list):
raise TypeError('data must be a list')
if len(data) <= 2:
raise ValueError('data must contain multiple values')
mean = sum(data) / len(data)
variance = 0
... | Binomial class | Binomial | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Binomial:
"""Binomial class"""
def __init__(self, data=None, n=1, p=0.5):
"""Class constructor"""
<|body_0|>
def factorial(n):
"""Calculates the factorial of a given number"""
<|body_1|>
def pmf(self, k):
"""Calculates the value of the PMF fo... | stack_v2_sparse_classes_10k_train_007995 | 2,028 | no_license | [
{
"docstring": "Class constructor",
"name": "__init__",
"signature": "def __init__(self, data=None, n=1, p=0.5)"
},
{
"docstring": "Calculates the factorial of a given number",
"name": "factorial",
"signature": "def factorial(n)"
},
{
"docstring": "Calculates the value of the PMF... | 4 | stack_v2_sparse_classes_30k_train_007050 | Implement the Python class `Binomial` described below.
Class description:
Binomial class
Method signatures and docstrings:
- def __init__(self, data=None, n=1, p=0.5): Class constructor
- def factorial(n): Calculates the factorial of a given number
- def pmf(self, k): Calculates the value of the PMF for a given numbe... | Implement the Python class `Binomial` described below.
Class description:
Binomial class
Method signatures and docstrings:
- def __init__(self, data=None, n=1, p=0.5): Class constructor
- def factorial(n): Calculates the factorial of a given number
- def pmf(self, k): Calculates the value of the PMF for a given numbe... | 23162e01761cfa56158a1ebc88ac7709ff1c2af2 | <|skeleton|>
class Binomial:
"""Binomial class"""
def __init__(self, data=None, n=1, p=0.5):
"""Class constructor"""
<|body_0|>
def factorial(n):
"""Calculates the factorial of a given number"""
<|body_1|>
def pmf(self, k):
"""Calculates the value of the PMF fo... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Binomial:
"""Binomial class"""
def __init__(self, data=None, n=1, p=0.5):
"""Class constructor"""
if data is not None:
if not isinstance(data, list):
raise TypeError('data must be a list')
if len(data) <= 2:
raise ValueError('data mu... | the_stack_v2_python_sparse | math/0x03-probability/binomial.py | emmanavarro/holbertonschool-machine_learning | train | 0 |
4bff64b5ea30f00bceac84482cd4ab24f3a15ed2 | [
"self.root = root\nself.settings = settings\nself.collected = defaultdict(dict)",
"base_file, ext = os.path.splitext(relative_path)\next = '.{hash}{ext}'.format(hash=hash, ext=ext)\nrelative_path = base_file + ext\nreturn os.path.join(self.root, MARKER_FOLDER, relative_path)",
"hash = md5(entry.path)\ntarget = ... | <|body_start_0|>
self.root = root
self.settings = settings
self.collected = defaultdict(dict)
<|end_body_0|>
<|body_start_1|>
base_file, ext = os.path.splitext(relative_path)
ext = '.{hash}{ext}'.format(hash=hash, ext=ext)
relative_path = base_file + ext
return o... | Toss all static files into perma-asset folder, MD5 hash included in the name. | CopyAndHashCollector | [
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CopyAndHashCollector:
"""Toss all static files into perma-asset folder, MD5 hash included in the name."""
def __init__(self, root: str, settings: dict, target_path: str=None):
"""Initialize CopyAndHashCollector. :param root: Root path. :param settings: Configuration. :param target_pa... | stack_v2_sparse_classes_10k_train_007996 | 9,928 | permissive | [
{
"docstring": "Initialize CopyAndHashCollector. :param root: Root path. :param settings: Configuration. :param target_path: Destination path.",
"name": "__init__",
"signature": "def __init__(self, root: str, settings: dict, target_path: str=None)"
},
{
"docstring": "Return the permanent path fo... | 5 | stack_v2_sparse_classes_30k_train_004311 | Implement the Python class `CopyAndHashCollector` described below.
Class description:
Toss all static files into perma-asset folder, MD5 hash included in the name.
Method signatures and docstrings:
- def __init__(self, root: str, settings: dict, target_path: str=None): Initialize CopyAndHashCollector. :param root: Ro... | Implement the Python class `CopyAndHashCollector` described below.
Class description:
Toss all static files into perma-asset folder, MD5 hash included in the name.
Method signatures and docstrings:
- def __init__(self, root: str, settings: dict, target_path: str=None): Initialize CopyAndHashCollector. :param root: Ro... | a57de54fb8a3fae859f24f373f0292e1e4b3c344 | <|skeleton|>
class CopyAndHashCollector:
"""Toss all static files into perma-asset folder, MD5 hash included in the name."""
def __init__(self, root: str, settings: dict, target_path: str=None):
"""Initialize CopyAndHashCollector. :param root: Root path. :param settings: Configuration. :param target_pa... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CopyAndHashCollector:
"""Toss all static files into perma-asset folder, MD5 hash included in the name."""
def __init__(self, root: str, settings: dict, target_path: str=None):
"""Initialize CopyAndHashCollector. :param root: Root path. :param settings: Configuration. :param target_path: Destinati... | the_stack_v2_python_sparse | websauna/system/http/static.py | websauna/websauna | train | 294 |
4b0341f4952bf77825858b09db9c60a4693e64ad | [
"if key is not None:\n self.key = key\n self.conf = self.get_train_obj(key)",
"try:\n graph_id = str(graph_id)\n query_set = models.AUTO_ML_RULE.objects.all()\n query_set = serial.serialize('json', query_set)\n query_set = json.loads(query_set)\n ids = []\n for row in query_set:\n g... | <|body_start_0|>
if key is not None:
self.key = key
self.conf = self.get_train_obj(key)
<|end_body_0|>
<|body_start_1|>
try:
graph_id = str(graph_id)
query_set = models.AUTO_ML_RULE.objects.all()
query_set = serial.serialize('json', query_set)... | Auto ML related conf get/set common methos | AutoMlRule | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AutoMlRule:
"""Auto ML related conf get/set common methos"""
def __init__(self, key=None):
"""init key variable :param key: :return:"""
<|body_0|>
def get_graph_type_list(self, graph_id):
"""get view data for net config :return:"""
<|body_1|>
def get... | stack_v2_sparse_classes_10k_train_007997 | 3,528 | permissive | [
{
"docstring": "init key variable :param key: :return:",
"name": "__init__",
"signature": "def __init__(self, key=None)"
},
{
"docstring": "get view data for net config :return:",
"name": "get_graph_type_list",
"signature": "def get_graph_type_list(self, graph_id)"
},
{
"docstrin... | 5 | stack_v2_sparse_classes_30k_test_000285 | Implement the Python class `AutoMlRule` described below.
Class description:
Auto ML related conf get/set common methos
Method signatures and docstrings:
- def __init__(self, key=None): init key variable :param key: :return:
- def get_graph_type_list(self, graph_id): get view data for net config :return:
- def get_gra... | Implement the Python class `AutoMlRule` described below.
Class description:
Auto ML related conf get/set common methos
Method signatures and docstrings:
- def __init__(self, key=None): init key variable :param key: :return:
- def get_graph_type_list(self, graph_id): get view data for net config :return:
- def get_gra... | 6ad2fbc7384e4dbe7e3e63bdb44c8ce0387f4b7f | <|skeleton|>
class AutoMlRule:
"""Auto ML related conf get/set common methos"""
def __init__(self, key=None):
"""init key variable :param key: :return:"""
<|body_0|>
def get_graph_type_list(self, graph_id):
"""get view data for net config :return:"""
<|body_1|>
def get... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AutoMlRule:
"""Auto ML related conf get/set common methos"""
def __init__(self, key=None):
"""init key variable :param key: :return:"""
if key is not None:
self.key = key
self.conf = self.get_train_obj(key)
def get_graph_type_list(self, graph_id):
"""g... | the_stack_v2_python_sparse | master/automl/automl_rule.py | yurimkoo/tensormsa | train | 1 |
02b7572458a23a3ce384e19c4594cf02f7429179 | [
"self.batchsize = batchsize\nself.half_window = half_window\nself.n_negative = n_negative\nself.dataset = dataset\nself.counter = 0\nself.datasize = len(dataset)\nself.sampler = CategoricalSampler(dataset)\nself.indices = np.random.permutation(self.datasize - 2 * self.half_window) + self.half_window\nself.n_batch =... | <|body_start_0|>
self.batchsize = batchsize
self.half_window = half_window
self.n_negative = n_negative
self.dataset = dataset
self.counter = 0
self.datasize = len(dataset)
self.sampler = CategoricalSampler(dataset)
self.indices = np.random.permutation(sel... | DataIteratorForEmbeddingLearning | [
"BSD-3-Clause",
"MIT",
"LicenseRef-scancode-proprietary-license",
"Apache-2.0",
"CC-BY-NC-4.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataIteratorForEmbeddingLearning:
def __init__(self, batchsize, half_window, n_negative, dataset):
"""Initialization Args: batchsize: batchsize half_window: half window length n_negative: number of negative samples dataset: corpus replaced with word ids"""
<|body_0|>
def nex... | stack_v2_sparse_classes_10k_train_007998 | 11,796 | permissive | [
{
"docstring": "Initialization Args: batchsize: batchsize half_window: half window length n_negative: number of negative samples dataset: corpus replaced with word ids",
"name": "__init__",
"signature": "def __init__(self, batchsize, half_window, n_negative, dataset)"
},
{
"docstring": "Creating... | 2 | null | Implement the Python class `DataIteratorForEmbeddingLearning` described below.
Class description:
Implement the DataIteratorForEmbeddingLearning class.
Method signatures and docstrings:
- def __init__(self, batchsize, half_window, n_negative, dataset): Initialization Args: batchsize: batchsize half_window: half windo... | Implement the Python class `DataIteratorForEmbeddingLearning` described below.
Class description:
Implement the DataIteratorForEmbeddingLearning class.
Method signatures and docstrings:
- def __init__(self, batchsize, half_window, n_negative, dataset): Initialization Args: batchsize: batchsize half_window: half windo... | 41f71faa6efff7774a76bbd5af3198322a90a6ab | <|skeleton|>
class DataIteratorForEmbeddingLearning:
def __init__(self, batchsize, half_window, n_negative, dataset):
"""Initialization Args: batchsize: batchsize half_window: half window length n_negative: number of negative samples dataset: corpus replaced with word ids"""
<|body_0|>
def nex... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DataIteratorForEmbeddingLearning:
def __init__(self, batchsize, half_window, n_negative, dataset):
"""Initialization Args: batchsize: batchsize half_window: half window length n_negative: number of negative samples dataset: corpus replaced with word ids"""
self.batchsize = batchsize
se... | the_stack_v2_python_sparse | language-modeling/word2vec/word_embedding.py | sony/nnabla-examples | train | 308 | |
1f98ad9d262a5d9ad2fd1f24d6e3e82f65ca0dc5 | [
"self._colors = list(map(mcolors.to_rgba, colors))\nself._segment_colors = [(self._colors[0], self._colors[0]), (self._colors[0], self._colors[1]), (self._colors[1], self._colors[1]), (self._colors[1], self._colors[0])]\nsuper().__init__(color=self._colors[0], **kwargs)",
"gcs = [self._override_gc(renderer, gc, f... | <|body_start_0|>
self._colors = list(map(mcolors.to_rgba, colors))
self._segment_colors = [(self._colors[0], self._colors[0]), (self._colors[0], self._colors[1]), (self._colors[1], self._colors[1]), (self._colors[1], self._colors[0])]
super().__init__(color=self._colors[0], **kwargs)
<|end_body_... | Draw a weakening stationary front.. | StationaryFrontolysis | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StationaryFrontolysis:
"""Draw a weakening stationary front.."""
def __init__(self, colors=('red', 'blue'), **kwargs):
"""Initialize a weakening stationary front path effect. This effect alternates between a warm front and cold front symbol. Parameters ---------- colors : Sequence[st... | stack_v2_sparse_classes_10k_train_007999 | 43,343 | permissive | [
{
"docstring": "Initialize a weakening stationary front path effect. This effect alternates between a warm front and cold front symbol. Parameters ---------- colors : Sequence[str] or Sequence[tuple[float]] Matplotlib color identifiers to cycle between on the two different front styles. Defaults to alternating ... | 2 | stack_v2_sparse_classes_30k_train_006343 | Implement the Python class `StationaryFrontolysis` described below.
Class description:
Draw a weakening stationary front..
Method signatures and docstrings:
- def __init__(self, colors=('red', 'blue'), **kwargs): Initialize a weakening stationary front path effect. This effect alternates between a warm front and cold... | Implement the Python class `StationaryFrontolysis` described below.
Class description:
Draw a weakening stationary front..
Method signatures and docstrings:
- def __init__(self, colors=('red', 'blue'), **kwargs): Initialize a weakening stationary front path effect. This effect alternates between a warm front and cold... | c7124e6f375eb5810ce49d53c9d5501c2efdfb75 | <|skeleton|>
class StationaryFrontolysis:
"""Draw a weakening stationary front.."""
def __init__(self, colors=('red', 'blue'), **kwargs):
"""Initialize a weakening stationary front path effect. This effect alternates between a warm front and cold front symbol. Parameters ---------- colors : Sequence[st... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class StationaryFrontolysis:
"""Draw a weakening stationary front.."""
def __init__(self, colors=('red', 'blue'), **kwargs):
"""Initialize a weakening stationary front path effect. This effect alternates between a warm front and cold front symbol. Parameters ---------- colors : Sequence[str] or Sequenc... | the_stack_v2_python_sparse | src/metpy/plots/patheffects.py | Unidata/MetPy | train | 1,041 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.