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
d3076f357c7ba8fa3d1d33199cbb74411a6e5590
[ "assert isinstance(response, scrapy.http.response.html.HtmlResponse)\nURLS = ['https://www.charterboats-uk.co.uk/wales?page=1', 'https://www.charterboats-uk.co.uk/wales?page=2', 'https://www.charterboats-uk.co.uk/wales?page=3', 'https://www.charterboats-uk.co.uk/wales?page=4', 'https://www.charterboats-uk.co.uk/sco...
<|body_start_0|> assert isinstance(response, scrapy.http.response.html.HtmlResponse) URLS = ['https://www.charterboats-uk.co.uk/wales?page=1', 'https://www.charterboats-uk.co.uk/wales?page=2', 'https://www.charterboats-uk.co.uk/wales?page=3', 'https://www.charterboats-uk.co.uk/wales?page=4', 'https://ww...
scrape all the text in on the boat details tab to write to ugc
CharterBoatUKBoatWalesScotlandTextSpider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CharterBoatUKBoatWalesScotlandTextSpider: """scrape all the text in on the boat details tab to write to ugc""" def parse(self, response): """generate links to pages in a board""" <|body_0|> def crawl_boats(self, response): """each page with links to 10 boats deta...
stack_v2_sparse_classes_10k_train_000600
17,953
no_license
[ { "docstring": "generate links to pages in a board", "name": "parse", "signature": "def parse(self, response)" }, { "docstring": "each page with links to 10 boats details", "name": "crawl_boats", "signature": "def crawl_boats(self, response)" }, { "docstring": "crawl", "name"...
3
null
Implement the Python class `CharterBoatUKBoatWalesScotlandTextSpider` described below. Class description: scrape all the text in on the boat details tab to write to ugc Method signatures and docstrings: - def parse(self, response): generate links to pages in a board - def crawl_boats(self, response): each page with l...
Implement the Python class `CharterBoatUKBoatWalesScotlandTextSpider` described below. Class description: scrape all the text in on the boat details tab to write to ugc Method signatures and docstrings: - def parse(self, response): generate links to pages in a board - def crawl_boats(self, response): each page with l...
9123aa6baf538b662143b9098d963d55165e8409
<|skeleton|> class CharterBoatUKBoatWalesScotlandTextSpider: """scrape all the text in on the boat details tab to write to ugc""" def parse(self, response): """generate links to pages in a board""" <|body_0|> def crawl_boats(self, response): """each page with links to 10 boats deta...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CharterBoatUKBoatWalesScotlandTextSpider: """scrape all the text in on the boat details tab to write to ugc""" def parse(self, response): """generate links to pages in a board""" assert isinstance(response, scrapy.http.response.html.HtmlResponse) URLS = ['https://www.charterboats-...
the_stack_v2_python_sparse
imgscrape/spiders/charterboatuk.py
gmonkman/python
train
0
eb329a3c3167ea5b7392eeeda6985c37d3a3b532
[ "classes = {b'\\xff': Header, b'[': Package}\nif not packetPrefix in classes:\n return None\nreturn classes[packetPrefix]", "if data is None:\n return\npacketPrefix = data[:1]\nCLASS = self.getClass(packetPrefix)\nif not CLASS:\n raise Exception('Packet %s is not found' % binascii.hexlify(packetPrefix).d...
<|body_start_0|> classes = {b'\xff': Header, b'[': Package} if not packetPrefix in classes: return None return classes[packetPrefix] <|end_body_0|> <|body_start_1|> if data is None: return packetPrefix = data[:1] CLASS = self.getClass(packetPrefix...
Packet factory
PacketFactory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PacketFactory: """Packet factory""" def getClass(cls, packetPrefix): """Returns a tag class by number @param packetPrefix: one byte buffer""" <|body_0|> def getInstance(self, data=None): """Returns a tag instance by its number""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_10k_train_000601
15,657
no_license
[ { "docstring": "Returns a tag class by number @param packetPrefix: one byte buffer", "name": "getClass", "signature": "def getClass(cls, packetPrefix)" }, { "docstring": "Returns a tag instance by its number", "name": "getInstance", "signature": "def getInstance(self, data=None)" } ]
2
stack_v2_sparse_classes_30k_train_003367
Implement the Python class `PacketFactory` described below. Class description: Packet factory Method signatures and docstrings: - def getClass(cls, packetPrefix): Returns a tag class by number @param packetPrefix: one byte buffer - def getInstance(self, data=None): Returns a tag instance by its number
Implement the Python class `PacketFactory` described below. Class description: Packet factory Method signatures and docstrings: - def getClass(cls, packetPrefix): Returns a tag class by number @param packetPrefix: one byte buffer - def getInstance(self, data=None): Returns a tag instance by its number <|skeleton|> c...
4a4bc730252ece695b2773388812e2d59d4947ce
<|skeleton|> class PacketFactory: """Packet factory""" def getClass(cls, packetPrefix): """Returns a tag class by number @param packetPrefix: one byte buffer""" <|body_0|> def getInstance(self, data=None): """Returns a tag instance by its number""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PacketFactory: """Packet factory""" def getClass(cls, packetPrefix): """Returns a tag class by number @param packetPrefix: one byte buffer""" classes = {b'\xff': Header, b'[': Package} if not packetPrefix in classes: return None return classes[packetPrefix] ...
the_stack_v2_python_sparse
lib/handlers/autolink/packets.py
maprox/pipe
train
4
4e3c8e809c8e27e7a7e3a66fd252759063d857ba
[ "if not prices:\n return 0\nprofit = 0\nminPrice = prices[0]\nfor i in range(len(prices)):\n profit = max(profit, prices[i] - minPrice)\n minPrice = min(prices[i], minPrice)\nreturn profit", "if not prices:\n return 0\nprofit = 0\nfor i in range(len(prices) - 1):\n profit += max(prices[i + 1] - pri...
<|body_start_0|> if not prices: return 0 profit = 0 minPrice = prices[0] for i in range(len(prices)): profit = max(profit, prices[i] - minPrice) minPrice = min(prices[i], minPrice) return profit <|end_body_0|> <|body_start_1|> if not p...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfitMulti(self, prices): """:type prices: List[int] :rtype: int""" <|body_1|> def maxProfitTwice(self, prices): """:type prices: List[int] :rtype...
stack_v2_sparse_classes_10k_train_000602
5,151
no_license
[ { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfit", "signature": "def maxProfit(self, prices)" }, { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfitMulti", "signature": "def maxProfitMulti(self, prices)" }, { "docstring": ":type prices...
4
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices): :type prices: List[int] :rtype: int - def maxProfitMulti(self, prices): :type prices: List[int] :rtype: int - def maxProfitTwice(self, prices): :type...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices): :type prices: List[int] :rtype: int - def maxProfitMulti(self, prices): :type prices: List[int] :rtype: int - def maxProfitTwice(self, prices): :type...
0584b86642dff667f5bf6b7acfbbce86a41a55b6
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfitMulti(self, prices): """:type prices: List[int] :rtype: int""" <|body_1|> def maxProfitTwice(self, prices): """:type prices: List[int] :rtype...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" if not prices: return 0 profit = 0 minPrice = prices[0] for i in range(len(prices)): profit = max(profit, prices[i] - minPrice) minPrice = min(prices[i],...
the_stack_v2_python_sparse
python_solution/121_130/BuyAndSellStock.py
CescWang1991/LeetCode-Python
train
1
58084122f432a51e940bc912c977e4a59393de90
[ "if root is None:\n return []\nqueue = [root]\ndata = []\n\ndef dfs():\n if queue == []:\n return\n node = queue.pop(0)\n data.append(node.val)\n if node.left:\n queue.append(node.left)\n dfs()\n else:\n data.append(None)\n if node.right:\n queue.append(node.r...
<|body_start_0|> if root is None: return [] queue = [root] data = [] def dfs(): if queue == []: return node = queue.pop(0) data.append(node.val) if node.left: queue.append(node.left) ...
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_000603
1,631
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
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:...
cdf785856941f7ea546aee56ebcda8801cbb04de
<|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 [] queue = [root] data = [] def dfs(): if queue == []: return node = queue.pop(0) ...
the_stack_v2_python_sparse
ProgrammingQuestions/leetcode/297.py
strawsyz/straw
train
2
13bc22c36cac712e09d5ec992cd3225eb04fd438
[ "super().setUp()\nself.request = self.request_context['request']\nself.request.path = '/api/v1/status/'\nself.request.META['QUERY_STRING'] = ''", "middleware = RequestTimingMiddleware()\nmiddleware.process_request(self.request)\nself.assertTrue(hasattr(self.request, 'start_time'))", "mock_get_tenant.return_valu...
<|body_start_0|> super().setUp() self.request = self.request_context['request'] self.request.path = '/api/v1/status/' self.request.META['QUERY_STRING'] = '' <|end_body_0|> <|body_start_1|> middleware = RequestTimingMiddleware() middleware.process_request(self.request) ...
Tests against the koku tenant middleware.
RequestTimingMiddlewareTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RequestTimingMiddlewareTest: """Tests against the koku tenant middleware.""" def setUp(self): """Set up middleware tests.""" <|body_0|> def test_process_request(self): """Test that the request gets a user.""" <|body_1|> def test_process_response(self...
stack_v2_sparse_classes_10k_train_000604
27,733
permissive
[ { "docstring": "Set up middleware tests.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test that the request gets a user.", "name": "test_process_request", "signature": "def test_process_request(self)" }, { "docstring": "Test that the request gets a user.",...
3
stack_v2_sparse_classes_30k_train_005214
Implement the Python class `RequestTimingMiddlewareTest` described below. Class description: Tests against the koku tenant middleware. Method signatures and docstrings: - def setUp(self): Set up middleware tests. - def test_process_request(self): Test that the request gets a user. - def test_process_response(self, mo...
Implement the Python class `RequestTimingMiddlewareTest` described below. Class description: Tests against the koku tenant middleware. Method signatures and docstrings: - def setUp(self): Set up middleware tests. - def test_process_request(self): Test that the request gets a user. - def test_process_response(self, mo...
0416e5216eb1ec4b41c8dd4999adde218b1ab2e1
<|skeleton|> class RequestTimingMiddlewareTest: """Tests against the koku tenant middleware.""" def setUp(self): """Set up middleware tests.""" <|body_0|> def test_process_request(self): """Test that the request gets a user.""" <|body_1|> def test_process_response(self...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RequestTimingMiddlewareTest: """Tests against the koku tenant middleware.""" def setUp(self): """Set up middleware tests.""" super().setUp() self.request = self.request_context['request'] self.request.path = '/api/v1/status/' self.request.META['QUERY_STRING'] = '' ...
the_stack_v2_python_sparse
koku/koku/test_middleware.py
project-koku/koku
train
225
6f446e2ef3f403c60ff5f7f25eb434eea7ca3343
[ "if not root:\n return ''\nrt = []\nstk = [root]\nwhile stk:\n newstk = []\n while stk:\n p = stk.pop(0)\n if p == None:\n rt.append('#')\n else:\n rt.append(str(p.val))\n newstk.extend([p.left, p.right])\n stk = newstk\nreturn ':'.join(rt)", "if n...
<|body_start_0|> if not root: return '' rt = [] stk = [root] while stk: newstk = [] while stk: p = stk.pop(0) if p == None: rt.append('#') else: rt.append(str(p.val...
Codec1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec1: 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_000605
3,374
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 `Codec1` described below. Class description: Implement the Codec1 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 :rtyp...
Implement the Python class `Codec1` described below. Class description: Implement the Codec1 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 :rtyp...
0e99f9a5226507706b3ee66fd04bae813755ef40
<|skeleton|> class Codec1: 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 Codec1: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return '' rt = [] stk = [root] while stk: newstk = [] while stk: p = stk.pop(0) ...
the_stack_v2_python_sparse
medium/tree/test_449_Serialize_and_Deserialize_BST.py
wuxu1019/leetcode_sophia
train
1
fd8c34f609363a555db9d7d6a84b88c6e4b6c466
[ "@lru_cache(None)\ndef dfs(curSum: int, visited: int) -> bool:\n if curSum >= target:\n return True\n for select in range(1, upper + 1):\n if visited >> select & 1:\n continue\n if curSum + select >= target or not dfs(curSum + select, visited | 1 << select):\n return...
<|body_start_0|> @lru_cache(None) def dfs(curSum: int, visited: int) -> bool: if curSum >= target: return True for select in range(1, upper + 1): if visited >> select & 1: continue if curSum + select >= target or...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canIWin(self, upper: int, target: int) -> bool: """2^n*n 每次dfs不用重新计算cur,因为curSum由visted唯一确定,两种的时间复杂度都是 O(2^n*n)""" <|body_0|> def canIWin2(self, upper: int, target: int) -> bool: """2^n*n 会慢一些""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_000606
1,839
no_license
[ { "docstring": "2^n*n 每次dfs不用重新计算cur,因为curSum由visted唯一确定,两种的时间复杂度都是 O(2^n*n)", "name": "canIWin", "signature": "def canIWin(self, upper: int, target: int) -> bool" }, { "docstring": "2^n*n 会慢一些", "name": "canIWin2", "signature": "def canIWin2(self, upper: int, target: int) -> bool" } ]
2
stack_v2_sparse_classes_30k_train_006490
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canIWin(self, upper: int, target: int) -> bool: 2^n*n 每次dfs不用重新计算cur,因为curSum由visted唯一确定,两种的时间复杂度都是 O(2^n*n) - def canIWin2(self, upper: int, target: int) -> bool: 2^n*n 会慢一些
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canIWin(self, upper: int, target: int) -> bool: 2^n*n 每次dfs不用重新计算cur,因为curSum由visted唯一确定,两种的时间复杂度都是 O(2^n*n) - def canIWin2(self, upper: int, target: int) -> bool: 2^n*n 会慢一些...
7e79e26bb8f641868561b186e34c1127ed63c9e0
<|skeleton|> class Solution: def canIWin(self, upper: int, target: int) -> bool: """2^n*n 每次dfs不用重新计算cur,因为curSum由visted唯一确定,两种的时间复杂度都是 O(2^n*n)""" <|body_0|> def canIWin2(self, upper: int, target: int) -> bool: """2^n*n 会慢一些""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def canIWin(self, upper: int, target: int) -> bool: """2^n*n 每次dfs不用重新计算cur,因为curSum由visted唯一确定,两种的时间复杂度都是 O(2^n*n)""" @lru_cache(None) def dfs(curSum: int, visited: int) -> bool: if curSum >= target: return True for select in range(1, ...
the_stack_v2_python_sparse
11_动态规划/dp分类/状压dp/visited上携带参数/464. 我能赢吗.py
981377660LMT/algorithm-study
train
225
c1155c50c6fef91dd8c275c01c8503caee6206cb
[ "st = []\nres, start, n = (0, 0, len(s))\nfor i in range(n):\n if s[i] == '(':\n st.append(i)\n if s[i] == ')':\n if not st:\n start = i + 1\n else:\n st.pop()\n if not st:\n res = max(res, i - start + 1)\n else:\n ...
<|body_start_0|> st = [] res, start, n = (0, 0, len(s)) for i in range(n): if s[i] == '(': st.append(i) if s[i] == ')': if not st: start = i + 1 else: st.pop() if n...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestValidParentheses(self, s): """:type s: str :rtype: int""" <|body_0|> def longestValidParenthesesDP(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> st = [] res, start, n = (0, 0, len(...
stack_v2_sparse_classes_10k_train_000607
2,705
no_license
[ { "docstring": ":type s: str :rtype: int", "name": "longestValidParentheses", "signature": "def longestValidParentheses(self, s)" }, { "docstring": ":type s: str :rtype: int", "name": "longestValidParenthesesDP", "signature": "def longestValidParenthesesDP(self, s)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestValidParentheses(self, s): :type s: str :rtype: int - def longestValidParenthesesDP(self, s): :type s: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestValidParentheses(self, s): :type s: str :rtype: int - def longestValidParenthesesDP(self, s): :type s: str :rtype: int <|skeleton|> class Solution: def longestVa...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def longestValidParentheses(self, s): """:type s: str :rtype: int""" <|body_0|> def longestValidParenthesesDP(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def longestValidParentheses(self, s): """:type s: str :rtype: int""" st = [] res, start, n = (0, 0, len(s)) for i in range(n): if s[i] == '(': st.append(i) if s[i] == ')': if not st: start = i...
the_stack_v2_python_sparse
L/LongestValidParentheses.py
bssrdf/pyleet
train
2
4a0521e733d7580ef3eba6519f3e26a369b68637
[ "super().__init__()\nself.pooling = pooling\nself.kernel_size = kernel_size\nself.enc_l5 = SphericalChebBN2(16, 32, 64, laps[5], self.kernel_size)\nself.enc_l4 = SphericalChebBNPool(64, 128, laps[4], self.pooling, self.kernel_size)\nself.enc_l3 = SphericalChebBNPool(128, 256, laps[3], self.pooling, self.kernel_size...
<|body_start_0|> super().__init__() self.pooling = pooling self.kernel_size = kernel_size self.enc_l5 = SphericalChebBN2(16, 32, 64, laps[5], self.kernel_size) self.enc_l4 = SphericalChebBNPool(64, 128, laps[4], self.pooling, self.kernel_size) self.enc_l3 = SphericalChebB...
Encoder for the Spherical UNet.
Encoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Encoder: """Encoder for the Spherical UNet.""" def __init__(self, pooling, laps, kernel_size): """Initialization. Args: pooling (:obj:`torch.nn.Module`): pooling layer. laps (list): List of laplacians. kernel_size (int): polynomial degree.""" <|body_0|> def forward(self,...
stack_v2_sparse_classes_10k_train_000608
41,403
no_license
[ { "docstring": "Initialization. Args: pooling (:obj:`torch.nn.Module`): pooling layer. laps (list): List of laplacians. kernel_size (int): polynomial degree.", "name": "__init__", "signature": "def __init__(self, pooling, laps, kernel_size)" }, { "docstring": "Forward Pass. Args: x (:obj:`torch....
2
null
Implement the Python class `Encoder` described below. Class description: Encoder for the Spherical UNet. Method signatures and docstrings: - def __init__(self, pooling, laps, kernel_size): Initialization. Args: pooling (:obj:`torch.nn.Module`): pooling layer. laps (list): List of laplacians. kernel_size (int): polyno...
Implement the Python class `Encoder` described below. Class description: Encoder for the Spherical UNet. Method signatures and docstrings: - def __init__(self, pooling, laps, kernel_size): Initialization. Args: pooling (:obj:`torch.nn.Module`): pooling layer. laps (list): List of laplacians. kernel_size (int): polyno...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class Encoder: """Encoder for the Spherical UNet.""" def __init__(self, pooling, laps, kernel_size): """Initialization. Args: pooling (:obj:`torch.nn.Module`): pooling layer. laps (list): List of laplacians. kernel_size (int): polynomial degree.""" <|body_0|> def forward(self,...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Encoder: """Encoder for the Spherical UNet.""" def __init__(self, pooling, laps, kernel_size): """Initialization. Args: pooling (:obj:`torch.nn.Module`): pooling layer. laps (list): List of laplacians. kernel_size (int): polynomial degree.""" super().__init__() self.pooling = pool...
the_stack_v2_python_sparse
generated/test_deepsphere_deepsphere_pytorch.py
jansel/pytorch-jit-paritybench
train
35
5e689a13d9a6503791cb1d84dc0efc29d8ad5ab3
[ "profit = 0\nfor i in range(1, len(prices)):\n if prices[i] > prices[i - 1]:\n profit += prices[i] - prices[i - 1]\nreturn profit", "profit = day = 0\ntotal_days = len(prices) - 1\nwhile day < total_days:\n while day < total_days and prices[day] >= prices[day + 1]:\n day += 1\n valley = pri...
<|body_start_0|> profit = 0 for i in range(1, len(prices)): if prices[i] > prices[i - 1]: profit += prices[i] - prices[i - 1] return profit <|end_body_0|> <|body_start_1|> profit = day = 0 total_days = len(prices) - 1 while day < total_days: ...
Stock
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Stock: def max_profit(self, prices: List[int]) -> int: """Approach: Greedy (One Pass) Time Complexity: O(N) Space Complexity: O(1) :param prices: :return:""" <|body_0|> def max_profit_(self, prices: List[int]) -> int: """Approach: Peak Valley Time Complexity: O(N) Sp...
stack_v2_sparse_classes_10k_train_000609
1,201
no_license
[ { "docstring": "Approach: Greedy (One Pass) Time Complexity: O(N) Space Complexity: O(1) :param prices: :return:", "name": "max_profit", "signature": "def max_profit(self, prices: List[int]) -> int" }, { "docstring": "Approach: Peak Valley Time Complexity: O(N) Space Complexity: O(1) :param pric...
2
null
Implement the Python class `Stock` described below. Class description: Implement the Stock class. Method signatures and docstrings: - def max_profit(self, prices: List[int]) -> int: Approach: Greedy (One Pass) Time Complexity: O(N) Space Complexity: O(1) :param prices: :return: - def max_profit_(self, prices: List[in...
Implement the Python class `Stock` described below. Class description: Implement the Stock class. Method signatures and docstrings: - def max_profit(self, prices: List[int]) -> int: Approach: Greedy (One Pass) Time Complexity: O(N) Space Complexity: O(1) :param prices: :return: - def max_profit_(self, prices: List[in...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class Stock: def max_profit(self, prices: List[int]) -> int: """Approach: Greedy (One Pass) Time Complexity: O(N) Space Complexity: O(1) :param prices: :return:""" <|body_0|> def max_profit_(self, prices: List[int]) -> int: """Approach: Peak Valley Time Complexity: O(N) Sp...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Stock: def max_profit(self, prices: List[int]) -> int: """Approach: Greedy (One Pass) Time Complexity: O(N) Space Complexity: O(1) :param prices: :return:""" profit = 0 for i in range(1, len(prices)): if prices[i] > prices[i - 1]: profit += prices[i] - price...
the_stack_v2_python_sparse
expedia/best_time_to_buy_stock_ii.py
Shiv2157k/leet_code
train
1
e7d766f34572154b7a0fec27fef9cf801aa40c0f
[ "super(SpatialPath, self).__init__()\nself.conv_7x7 = ConvBnRelu(in_planes, inner_channel, 7, 2, 3, norm_layer=norm_layer, Conv2d=Conv2d)\nself.conv_3x3_1 = ConvBnRelu(inner_channel, inner_channel, 3, 2, 1, norm_layer=norm_layer, Conv2d=Conv2d)\nself.conv_3x3_2 = ConvBnRelu(inner_channel, inner_channel, 3, 2, 1, no...
<|body_start_0|> super(SpatialPath, self).__init__() self.conv_7x7 = ConvBnRelu(in_planes, inner_channel, 7, 2, 3, norm_layer=norm_layer, Conv2d=Conv2d) self.conv_3x3_1 = ConvBnRelu(inner_channel, inner_channel, 3, 2, 1, norm_layer=norm_layer, Conv2d=Conv2d) self.conv_3x3_2 = ConvBnRelu(...
SpatialPath module.
SpatialPath
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpatialPath: """SpatialPath module.""" def __init__(self, in_planes, out_planes, norm_layer='BN', Conv2d=nn.Conv2d, inner_channel=64, **kwargs): """Create SpatialPath. :param in_planes: input channels :param out_planes: output channels :param norm_layer: type of norm layer. :param Co...
stack_v2_sparse_classes_10k_train_000610
9,350
permissive
[ { "docstring": "Create SpatialPath. :param in_planes: input channels :param out_planes: output channels :param norm_layer: type of norm layer. :param Conv2d: type of conv layer. :param inner_channel: number of inner channels.", "name": "__init__", "signature": "def __init__(self, in_planes, out_planes, ...
2
null
Implement the Python class `SpatialPath` described below. Class description: SpatialPath module. Method signatures and docstrings: - def __init__(self, in_planes, out_planes, norm_layer='BN', Conv2d=nn.Conv2d, inner_channel=64, **kwargs): Create SpatialPath. :param in_planes: input channels :param out_planes: output ...
Implement the Python class `SpatialPath` described below. Class description: SpatialPath module. Method signatures and docstrings: - def __init__(self, in_planes, out_planes, norm_layer='BN', Conv2d=nn.Conv2d, inner_channel=64, **kwargs): Create SpatialPath. :param in_planes: input channels :param out_planes: output ...
e4ef3a1c92d19d1d08c3ef0e2156b6fecefdbe04
<|skeleton|> class SpatialPath: """SpatialPath module.""" def __init__(self, in_planes, out_planes, norm_layer='BN', Conv2d=nn.Conv2d, inner_channel=64, **kwargs): """Create SpatialPath. :param in_planes: input channels :param out_planes: output channels :param norm_layer: type of norm layer. :param Co...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SpatialPath: """SpatialPath module.""" def __init__(self, in_planes, out_planes, norm_layer='BN', Conv2d=nn.Conv2d, inner_channel=64, **kwargs): """Create SpatialPath. :param in_planes: input channels :param out_planes: output channels :param norm_layer: type of norm layer. :param Conv2d: type of...
the_stack_v2_python_sparse
zeus/networks/pytorch/customs/bisenet.py
huawei-noah/xingtian
train
308
711f71d8d6a8742fa7e90fe73dd1413ef9e953ee
[ "contact = Contacts.query.order_by(desc(Contacts.Created)).first_or_404()\ncontent = jsonify({'contacts': [{'id': contact.ContactsID, 'email': contact.Email, 'techRider': contact.TechRider, 'inputList': contact.InputList, 'backline': contact.Backline, 'createdAt': contact.Created, 'updatedAt': contact.Updated}]})\n...
<|body_start_0|> contact = Contacts.query.order_by(desc(Contacts.Created)).first_or_404() content = jsonify({'contacts': [{'id': contact.ContactsID, 'email': contact.Email, 'techRider': contact.TechRider, 'inputList': contact.InputList, 'backline': contact.Backline, 'createdAt': contact.Created, 'update...
ContactsView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContactsView: def index(self): """Return the newest Contacts entry.""" <|body_0|> def post(self): """Add a new Contacts entry.""" <|body_1|> def patch(self): """Partially modify the newest contact.""" <|body_2|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_10k_train_000611
2,412
permissive
[ { "docstring": "Return the newest Contacts entry.", "name": "index", "signature": "def index(self)" }, { "docstring": "Add a new Contacts entry.", "name": "post", "signature": "def post(self)" }, { "docstring": "Partially modify the newest contact.", "name": "patch", "sig...
3
stack_v2_sparse_classes_30k_train_003828
Implement the Python class `ContactsView` described below. Class description: Implement the ContactsView class. Method signatures and docstrings: - def index(self): Return the newest Contacts entry. - def post(self): Add a new Contacts entry. - def patch(self): Partially modify the newest contact.
Implement the Python class `ContactsView` described below. Class description: Implement the ContactsView class. Method signatures and docstrings: - def index(self): Return the newest Contacts entry. - def post(self): Add a new Contacts entry. - def patch(self): Partially modify the newest contact. <|skeleton|> class...
62f8e8e904e379541193f0cbb91a8434b47f538f
<|skeleton|> class ContactsView: def index(self): """Return the newest Contacts entry.""" <|body_0|> def post(self): """Add a new Contacts entry.""" <|body_1|> def patch(self): """Partially modify the newest contact.""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ContactsView: def index(self): """Return the newest Contacts entry.""" contact = Contacts.query.order_by(desc(Contacts.Created)).first_or_404() content = jsonify({'contacts': [{'id': contact.ContactsID, 'email': contact.Email, 'techRider': contact.TechRider, 'inputList': contact.InputL...
the_stack_v2_python_sparse
apps/contacts/views.py
Torniojaws/vortech-backend
train
0
385d3cf9d5d1dd91ad4110eab40841a87aa3930c
[ "file_ = g.db.query(File).filter(File.id == id_).first()\ndata_dir = get_path('data')\ncache_timeout = 0 if g.debug else None\nif file_ is None:\n raise NotFound('No file exists with id={}'.format(id_))\nif file_.mime == 'application/zip':\n return send_from_directory(data_dir, file_.relpath(), mimetype=file_...
<|body_start_0|> file_ = g.db.query(File).filter(File.id == id_).first() data_dir = get_path('data') cache_timeout = 0 if g.debug else None if file_ is None: raise NotFound('No file exists with id={}'.format(id_)) if file_.mime == 'application/zip': return...
Manipulate files.
FileView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileView: """Manipulate files.""" def get(self, id_): """Get a file identified by ``id_``. :status 200: ok :status 401: authentication required :status 404: no file with that ID""" <|body_0|> def delete(self, id_): """Delete file identified by `id_`.""" <...
stack_v2_sparse_classes_10k_train_000612
2,365
no_license
[ { "docstring": "Get a file identified by ``id_``. :status 200: ok :status 401: authentication required :status 404: no file with that ID", "name": "get", "signature": "def get(self, id_)" }, { "docstring": "Delete file identified by `id_`.", "name": "delete", "signature": "def delete(sel...
2
stack_v2_sparse_classes_30k_train_000467
Implement the Python class `FileView` described below. Class description: Manipulate files. Method signatures and docstrings: - def get(self, id_): Get a file identified by ``id_``. :status 200: ok :status 401: authentication required :status 404: no file with that ID - def delete(self, id_): Delete file identified b...
Implement the Python class `FileView` described below. Class description: Manipulate files. Method signatures and docstrings: - def get(self, id_): Get a file identified by ``id_``. :status 200: ok :status 401: authentication required :status 404: no file with that ID - def delete(self, id_): Delete file identified b...
449630ebcacc1f7cb15c435152842b206cc1e8a3
<|skeleton|> class FileView: """Manipulate files.""" def get(self, id_): """Get a file identified by ``id_``. :status 200: ok :status 401: authentication required :status 404: no file with that ID""" <|body_0|> def delete(self, id_): """Delete file identified by `id_`.""" <...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FileView: """Manipulate files.""" def get(self, id_): """Get a file identified by ``id_``. :status 200: ok :status 401: authentication required :status 404: no file with that ID""" file_ = g.db.query(File).filter(File.id == id_).first() data_dir = get_path('data') cache_ti...
the_stack_v2_python_sparse
lib/app/views/file.py
jaisanas/hgprofiler
train
1
f6eabc8a08b00ca08ec6eae6491452c2401db6a2
[ "self.id = id\nself.neighs = neighs\nif variance == 'false':\n self.data = data\nelse:\n n = old_div(np.sqrt(9 + 8 * (len(data) - 1)) - 3, 2)\n self.var = np.matrix(np.identity(n))\n index = n + 1\n for i in range(int(n)):\n for j in range(i + 1):\n self.var[i, j] = data[int(index)]...
<|body_start_0|> self.id = id self.neighs = neighs if variance == 'false': self.data = data else: n = old_div(np.sqrt(9 + 8 * (len(data) - 1)) - 3, 2) self.var = np.matrix(np.identity(n)) index = n + 1 for i in range(int(n)): ...
Area Class for Regional Clustering.
AreaCl
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AreaCl: """Area Class for Regional Clustering.""" def __init__(self, id, neighs, data, variance='false'): """@type id: integer @param id: Id of the polygon/area @type neighs: list @param neighs: Neighborhood ids @type data: list. @param data: Data releated to the area. @type variance...
stack_v2_sparse_classes_10k_train_000613
2,124
permissive
[ { "docstring": "@type id: integer @param id: Id of the polygon/area @type neighs: list @param neighs: Neighborhood ids @type data: list. @param data: Data releated to the area. @type variance: boolean @keyword variance: Boolean indicating if the data have variance matrix", "name": "__init__", "signature...
2
stack_v2_sparse_classes_30k_train_000003
Implement the Python class `AreaCl` described below. Class description: Area Class for Regional Clustering. Method signatures and docstrings: - def __init__(self, id, neighs, data, variance='false'): @type id: integer @param id: Id of the polygon/area @type neighs: list @param neighs: Neighborhood ids @type data: lis...
Implement the Python class `AreaCl` described below. Class description: Area Class for Regional Clustering. Method signatures and docstrings: - def __init__(self, id, neighs, data, variance='false'): @type id: integer @param id: Id of the polygon/area @type neighs: list @param neighs: Neighborhood ids @type data: lis...
5c2600b048836e54495dc5997a250af72f72f6e7
<|skeleton|> class AreaCl: """Area Class for Regional Clustering.""" def __init__(self, id, neighs, data, variance='false'): """@type id: integer @param id: Id of the polygon/area @type neighs: list @param neighs: Neighborhood ids @type data: list. @param data: Data releated to the area. @type variance...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AreaCl: """Area Class for Regional Clustering.""" def __init__(self, id, neighs, data, variance='false'): """@type id: integer @param id: Id of the polygon/area @type neighs: list @param neighs: Neighborhood ids @type data: list. @param data: Data releated to the area. @type variance: boolean @ke...
the_stack_v2_python_sparse
clusterpy/core/toolboxes/cluster/componentsAlg/areacl.py
CentroGeo/clusterpy
train
4
64be7b63fe73434be9d0f771faf85ec51e86d8c7
[ "assert_is_instance(l_plus, np.ndarray, 'L plus has to be a np array')\nassert_is_instance(l_minus, np.ndarray, 'L minus has to be a np array')\nassert_condition(l_plus.shape == l_minus.shape, TypeError, 'It is not an splitting')\nassert_is_instance(level, IMultigridLevel, 'Not the right level')\nself.order = kwarg...
<|body_start_0|> assert_is_instance(l_plus, np.ndarray, 'L plus has to be a np array') assert_is_instance(l_minus, np.ndarray, 'L minus has to be a np array') assert_condition(l_plus.shape == l_minus.shape, TypeError, 'It is not an splitting') assert_is_instance(level, IMultigridLevel, '...
A general Smoothing class which arises from splitting the main stencil This class of smoothers is easy to derive and really broad, it is statically linked to a certain level.
SplitSmoother
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SplitSmoother: """A general Smoothing class which arises from splitting the main stencil This class of smoothers is easy to derive and really broad, it is statically linked to a certain level.""" def __init__(self, l_plus, l_minus, level, *args, **kwargs): """init method of the split...
stack_v2_sparse_classes_10k_train_000614
9,259
no_license
[ { "docstring": "init method of the split smoother l_plus and l_minus have to be centralized", "name": "__init__", "signature": "def __init__(self, l_plus, l_minus, level, *args, **kwargs)" }, { "docstring": "Does the relaxation step several times on the lvl the hardship in this case is to use th...
2
stack_v2_sparse_classes_30k_train_003675
Implement the Python class `SplitSmoother` described below. Class description: A general Smoothing class which arises from splitting the main stencil This class of smoothers is easy to derive and really broad, it is statically linked to a certain level. Method signatures and docstrings: - def __init__(self, l_plus, l...
Implement the Python class `SplitSmoother` described below. Class description: A general Smoothing class which arises from splitting the main stencil This class of smoothers is easy to derive and really broad, it is statically linked to a certain level. Method signatures and docstrings: - def __init__(self, l_plus, l...
90aed34cf43d633e44f56444f6c5d4fa39619663
<|skeleton|> class SplitSmoother: """A general Smoothing class which arises from splitting the main stencil This class of smoothers is easy to derive and really broad, it is statically linked to a certain level.""" def __init__(self, l_plus, l_minus, level, *args, **kwargs): """init method of the split...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SplitSmoother: """A general Smoothing class which arises from splitting the main stencil This class of smoothers is easy to derive and really broad, it is statically linked to a certain level.""" def __init__(self, l_plus, l_minus, level, *args, **kwargs): """init method of the split smoother l_p...
the_stack_v2_python_sparse
pypint/plugins/multigrid/multigrid_smoother.py
Parallel-in-Time/PyPinT
train
0
5f50cac7bab77100f94eb1a636a9bf86fef3c89c
[ "if obj.organization_address is None:\n return None\nserializer = OrganizationAddressSerializer(obj.organization_address, read_only=True)\nreturn serializer.data", "request = self.context.get('request')\nif not request.user.has_perm('VIEW_FUEL_SUPPLIERS') and request.user.organization.id != obj.id:\n return...
<|body_start_0|> if obj.organization_address is None: return None serializer = OrganizationAddressSerializer(obj.organization_address, read_only=True) return serializer.data <|end_body_0|> <|body_start_1|> request = self.context.get('request') if not request.user.has...
Serializer for the Fuel Supplier Loads most of the fields and the balance for the Fuel Supplier
OrganizationSerializer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrganizationSerializer: """Serializer for the Fuel Supplier Loads most of the fields and the balance for the Fuel Supplier""" def get_organization_address(self, obj): """Shows the organization address""" <|body_0|> def get_organization_balance(self, obj): """Only...
stack_v2_sparse_classes_10k_train_000615
8,700
permissive
[ { "docstring": "Shows the organization address", "name": "get_organization_address", "signature": "def get_organization_address(self, obj)" }, { "docstring": "Only show the credit balance if the logged in user has permission to view fuel suppliers", "name": "get_organization_balance", "s...
2
stack_v2_sparse_classes_30k_train_000338
Implement the Python class `OrganizationSerializer` described below. Class description: Serializer for the Fuel Supplier Loads most of the fields and the balance for the Fuel Supplier Method signatures and docstrings: - def get_organization_address(self, obj): Shows the organization address - def get_organization_bal...
Implement the Python class `OrganizationSerializer` described below. Class description: Serializer for the Fuel Supplier Loads most of the fields and the balance for the Fuel Supplier Method signatures and docstrings: - def get_organization_address(self, obj): Shows the organization address - def get_organization_bal...
80ae1ef5938ef5e580128ed0c622071b307fc7e1
<|skeleton|> class OrganizationSerializer: """Serializer for the Fuel Supplier Loads most of the fields and the balance for the Fuel Supplier""" def get_organization_address(self, obj): """Shows the organization address""" <|body_0|> def get_organization_balance(self, obj): """Only...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class OrganizationSerializer: """Serializer for the Fuel Supplier Loads most of the fields and the balance for the Fuel Supplier""" def get_organization_address(self, obj): """Shows the organization address""" if obj.organization_address is None: return None serializer = Org...
the_stack_v2_python_sparse
backend/api/serializers/Organization.py
kuanfandevops/tfrs
train
0
c1a7ec53d5d78103be18b6683a8c104e4bd2dcb1
[ "try:\n import StringIO\n class_StringIO = StringIO.StringIO\nexcept Exception:\n import io\n class_StringIO = io.StringIO\nsio = class_StringIO('<foo> <bar> </foo>\\n')\ntry:\n ET.parse(sio)\nexcept Exception:\n self.ET_exc_class = sys.exc_info()[0]\nelse:\n self.ET_exc_class = Exception", "...
<|body_start_0|> try: import StringIO class_StringIO = StringIO.StringIO except Exception: import io class_StringIO = io.StringIO sio = class_StringIO('<foo> <bar> </foo>\n') try: ET.parse(sio) except Exception: ...
Construct an XmlDocReader, call its readDoc(filename) method, then access the resulting DOM structure using XmlNode methods. If more than one document must be parsed, it is slightly faster to repeatedly call the readDoc method rather than constructing a new XmlDocReader each time.
XmlDocReader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XmlDocReader: """Construct an XmlDocReader, call its readDoc(filename) method, then access the resulting DOM structure using XmlNode methods. If more than one document must be parsed, it is slightly faster to repeatedly call the readDoc method rather than constructing a new XmlDocReader each time...
stack_v2_sparse_classes_10k_train_000616
8,265
no_license
[ { "docstring": "The constructor determines the error class used by ElementTree.parse().", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Open the XML file and read its contents into a tree of XmlNode objects. XML errors raise an XmlError exception.", "name": "readDo...
2
stack_v2_sparse_classes_30k_train_006986
Implement the Python class `XmlDocReader` described below. Class description: Construct an XmlDocReader, call its readDoc(filename) method, then access the resulting DOM structure using XmlNode methods. If more than one document must be parsed, it is slightly faster to repeatedly call the readDoc method rather than co...
Implement the Python class `XmlDocReader` described below. Class description: Construct an XmlDocReader, call its readDoc(filename) method, then access the resulting DOM structure using XmlNode methods. If more than one document must be parsed, it is slightly faster to repeatedly call the readDoc method rather than co...
2d07558737127077f97e9347d84e6ca46885b0bc
<|skeleton|> class XmlDocReader: """Construct an XmlDocReader, call its readDoc(filename) method, then access the resulting DOM structure using XmlNode methods. If more than one document must be parsed, it is slightly faster to repeatedly call the readDoc method rather than constructing a new XmlDocReader each time...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class XmlDocReader: """Construct an XmlDocReader, call its readDoc(filename) method, then access the resulting DOM structure using XmlNode methods. If more than one document must be parsed, it is slightly faster to repeatedly call the readDoc method rather than constructing a new XmlDocReader each time.""" def...
the_stack_v2_python_sparse
vvt/libvvtest/xmlwrapper.py
rrdrake/vvtools
train
5
06c0fcfbc7a04ef95670ddba3889f66c1b6c2c84
[ "self.readservice = readservice\nif u_context:\n self.user_context = u_context\n self.username = u_context.user\n if u_context.context == u_context.ChoicesOfView.COMMON:\n self.use_user = None\n else:\n self.use_user = u_context.user", "from bl.person import Person\nsource = self.readser...
<|body_start_0|> self.readservice = readservice if u_context: self.user_context = u_context self.username = u_context.user if u_context.context == u_context.ChoicesOfView.COMMON: self.use_user = None else: self.use_user = u_...
Public methods for accessing active database. Returns a PersonResult object
DbReader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DbReader: """Public methods for accessing active database. Returns a PersonResult object""" def __init__(self, readservice, u_context=None): """Create a reader object with db driver and user context. - readservice Neo4jReadService or Neo4jWriteDriver""" <|body_0|> def ge...
stack_v2_sparse_classes_10k_train_000617
3,432
no_license
[ { "docstring": "Create a reader object with db driver and user context. - readservice Neo4jReadService or Neo4jWriteDriver", "name": "__init__", "signature": "def __init__(self, readservice, u_context=None)" }, { "docstring": "Read the source, repository and events etc referencing this source. R...
2
stack_v2_sparse_classes_30k_train_006100
Implement the Python class `DbReader` described below. Class description: Public methods for accessing active database. Returns a PersonResult object Method signatures and docstrings: - def __init__(self, readservice, u_context=None): Create a reader object with db driver and user context. - readservice Neo4jReadServ...
Implement the Python class `DbReader` described below. Class description: Public methods for accessing active database. Returns a PersonResult object Method signatures and docstrings: - def __init__(self, readservice, u_context=None): Create a reader object with db driver and user context. - readservice Neo4jReadServ...
0f8d6ba035e3cca8dc756531b7cc51029a549a4f
<|skeleton|> class DbReader: """Public methods for accessing active database. Returns a PersonResult object""" def __init__(self, readservice, u_context=None): """Create a reader object with db driver and user context. - readservice Neo4jReadService or Neo4jWriteDriver""" <|body_0|> def ge...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DbReader: """Public methods for accessing active database. Returns a PersonResult object""" def __init__(self, readservice, u_context=None): """Create a reader object with db driver and user context. - readservice Neo4jReadService or Neo4jWriteDriver""" self.readservice = readservice ...
the_stack_v2_python_sparse
pe/db_reader.py
kkujansuu/stk
train
0
01900c1d14a04ee43553c8602a07e0c6ecfabded
[ "request = self.context['request']\ndata.setdefault('user', request.user)\ndata.setdefault('device_user_token', None)\nif not request.user.is_authenticated():\n raise serializers.ValidationError('user is not logged in.')\ntry:\n self.instance = DeviceUser.objects.get(**data)\nexcept DeviceUser.DoesNotExist:\n...
<|body_start_0|> request = self.context['request'] data.setdefault('user', request.user) data.setdefault('device_user_token', None) if not request.user.is_authenticated(): raise serializers.ValidationError('user is not logged in.') try: self.instance = Dev...
Serializer for log users out.
LogoutSerializer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LogoutSerializer: """Serializer for log users out.""" def validate(self, data): """Validate that the requesting user owns the given device.""" <|body_0|> def update(self): """Mark the given device as inactive.""" <|body_1|> <|end_skeleton|> <|body_start...
stack_v2_sparse_classes_10k_train_000618
4,186
permissive
[ { "docstring": "Validate that the requesting user owns the given device.", "name": "validate", "signature": "def validate(self, data)" }, { "docstring": "Mark the given device as inactive.", "name": "update", "signature": "def update(self)" } ]
2
stack_v2_sparse_classes_30k_train_003767
Implement the Python class `LogoutSerializer` described below. Class description: Serializer for log users out. Method signatures and docstrings: - def validate(self, data): Validate that the requesting user owns the given device. - def update(self): Mark the given device as inactive.
Implement the Python class `LogoutSerializer` described below. Class description: Serializer for log users out. Method signatures and docstrings: - def validate(self, data): Validate that the requesting user owns the given device. - def update(self): Mark the given device as inactive. <|skeleton|> class LogoutSerial...
7349ce18f56658d67daedf5e1abb352b5c15a029
<|skeleton|> class LogoutSerializer: """Serializer for log users out.""" def validate(self, data): """Validate that the requesting user owns the given device.""" <|body_0|> def update(self): """Mark the given device as inactive.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LogoutSerializer: """Serializer for log users out.""" def validate(self, data): """Validate that the requesting user owns the given device.""" request = self.context['request'] data.setdefault('user', request.user) data.setdefault('device_user_token', None) if not ...
the_stack_v2_python_sparse
src/tandlr/authentication/serializers.py
shrmoud/schoolapp
train
0
41a99e6f5963771541a3d24bf3b54f019328a3e0
[ "with document.file.open('rb') as file:\n text = extract_text(BytesIO(file.read()))\nreturn text", "with document.file.open('rb') as file:\n result = mammoth.extract_raw_text(file)\nreturn result.value" ]
<|body_start_0|> with document.file.open('rb') as file: text = extract_text(BytesIO(file.read())) return text <|end_body_0|> <|body_start_1|> with document.file.open('rb') as file: result = mammoth.extract_raw_text(file) return result.value <|end_body_1|>
Extract files text
TextExtractor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextExtractor: """Extract files text""" def from_pdf(document): """Extract pdf text""" <|body_0|> def from_docx(document): """Extract docx text""" <|body_1|> <|end_skeleton|> <|body_start_0|> with document.file.open('rb') as file: te...
stack_v2_sparse_classes_10k_train_000619
883
permissive
[ { "docstring": "Extract pdf text", "name": "from_pdf", "signature": "def from_pdf(document)" }, { "docstring": "Extract docx text", "name": "from_docx", "signature": "def from_docx(document)" } ]
2
stack_v2_sparse_classes_30k_train_000408
Implement the Python class `TextExtractor` described below. Class description: Extract files text Method signatures and docstrings: - def from_pdf(document): Extract pdf text - def from_docx(document): Extract docx text
Implement the Python class `TextExtractor` described below. Class description: Extract files text Method signatures and docstrings: - def from_pdf(document): Extract pdf text - def from_docx(document): Extract docx text <|skeleton|> class TextExtractor: """Extract files text""" def from_pdf(document): ...
22e4afa728a851bb4c2479fbb6f5944a75984b9b
<|skeleton|> class TextExtractor: """Extract files text""" def from_pdf(document): """Extract pdf text""" <|body_0|> def from_docx(document): """Extract docx text""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TextExtractor: """Extract files text""" def from_pdf(document): """Extract pdf text""" with document.file.open('rb') as file: text = extract_text(BytesIO(file.read())) return text def from_docx(document): """Extract docx text""" with document.file....
the_stack_v2_python_sparse
src/backend/partaj/core/services/file_handler.py
MTES-MCT/partaj
train
4
9a9d3e5f1cb707ccd191b81b14244b49cfa75748
[ "from sims4communitylib.utils.sims.common_occult_utils import CommonOccultUtils\nif CommonOccultUtils.is_alien(sim_info):\n return CommonOccultType.ALIEN\nelif CommonOccultUtils.is_ghost(sim_info):\n return CommonOccultType.GHOST\nelif CommonOccultUtils.is_mermaid(sim_info):\n return CommonOccultType.MERMA...
<|body_start_0|> from sims4communitylib.utils.sims.common_occult_utils import CommonOccultUtils if CommonOccultUtils.is_alien(sim_info): return CommonOccultType.ALIEN elif CommonOccultUtils.is_ghost(sim_info): return CommonOccultType.GHOST elif CommonOccultUtils.i...
Custom Occult Types enum containing all occults. DLC not required.
CommonOccultType
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommonOccultType: """Custom Occult Types enum containing all occults. DLC not required.""" def determine_occult_type(sim_info: SimInfo) -> 'CommonOccultType': """determine_occult_type(sim_info) Determine the type of Occult a Sim is. :param sim_info: An instance of a Sim. :type sim_in...
stack_v2_sparse_classes_10k_train_000620
3,786
permissive
[ { "docstring": "determine_occult_type(sim_info) Determine the type of Occult a Sim is. :param sim_info: An instance of a Sim. :type sim_info: SimInfo :return: The CommonOccultType that represents what a Sim is. :rtype: CommonOccultType", "name": "determine_occult_type", "signature": "def determine_occul...
2
stack_v2_sparse_classes_30k_train_005844
Implement the Python class `CommonOccultType` described below. Class description: Custom Occult Types enum containing all occults. DLC not required. Method signatures and docstrings: - def determine_occult_type(sim_info: SimInfo) -> 'CommonOccultType': determine_occult_type(sim_info) Determine the type of Occult a Si...
Implement the Python class `CommonOccultType` described below. Class description: Custom Occult Types enum containing all occults. DLC not required. Method signatures and docstrings: - def determine_occult_type(sim_info: SimInfo) -> 'CommonOccultType': determine_occult_type(sim_info) Determine the type of Occult a Si...
b59ea7e5f4bd01d3b3bd7603843d525a9c179867
<|skeleton|> class CommonOccultType: """Custom Occult Types enum containing all occults. DLC not required.""" def determine_occult_type(sim_info: SimInfo) -> 'CommonOccultType': """determine_occult_type(sim_info) Determine the type of Occult a Sim is. :param sim_info: An instance of a Sim. :type sim_in...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CommonOccultType: """Custom Occult Types enum containing all occults. DLC not required.""" def determine_occult_type(sim_info: SimInfo) -> 'CommonOccultType': """determine_occult_type(sim_info) Determine the type of Occult a Sim is. :param sim_info: An instance of a Sim. :type sim_info: SimInfo :...
the_stack_v2_python_sparse
src/sims4communitylib/enums/common_occult_type.py
velocist/TS4CheatsInfo
train
1
611cff14b17f6cdc5846187ccf778a29da273728
[ "if not head:\n return None\nif head.next is None:\n return head\nvals = []\ncur = head\nwhile cur:\n vals.append(cur.val)\n cur = cur.next\nvals = sorted(vals)\npHead = ListNode(None)\ncur = ListNode(vals[0])\npHead.next = cur\nfor v in vals[1:]:\n cur.next = ListNode(v)\n cur = cur.next\nreturn ...
<|body_start_0|> if not head: return None if head.next is None: return head vals = [] cur = head while cur: vals.append(cur.val) cur = cur.next vals = sorted(vals) pHead = ListNode(None) cur = ListNode(vals[0...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def sortList2(self, head: ListNode) -> ListNode: """把值都取出来, 然后排序, 再重新创建链表 时间复杂度是 O(n)+O(nlog(n))+O(n), 符合要求, 但是 空间复杂度是 O(n)""" <|body_0|> def sortList(self, head: ListNode) -> ListNode: """归并排序解法, 代码比较丑, 但是思路没问题: 先用快慢指针找到链表的中点, 断开, 然后分别排序, 再归并""" <|...
stack_v2_sparse_classes_10k_train_000621
2,838
no_license
[ { "docstring": "把值都取出来, 然后排序, 再重新创建链表 时间复杂度是 O(n)+O(nlog(n))+O(n), 符合要求, 但是 空间复杂度是 O(n)", "name": "sortList2", "signature": "def sortList2(self, head: ListNode) -> ListNode" }, { "docstring": "归并排序解法, 代码比较丑, 但是思路没问题: 先用快慢指针找到链表的中点, 断开, 然后分别排序, 再归并", "name": "sortList", "signature": "def ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortList2(self, head: ListNode) -> ListNode: 把值都取出来, 然后排序, 再重新创建链表 时间复杂度是 O(n)+O(nlog(n))+O(n), 符合要求, 但是 空间复杂度是 O(n) - def sortList(self, head: ListNode) -> ListNode: 归并排序解法,...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortList2(self, head: ListNode) -> ListNode: 把值都取出来, 然后排序, 再重新创建链表 时间复杂度是 O(n)+O(nlog(n))+O(n), 符合要求, 但是 空间复杂度是 O(n) - def sortList(self, head: ListNode) -> ListNode: 归并排序解法,...
99a3abf1774933af73a8405f9b59e5e64906bca4
<|skeleton|> class Solution: def sortList2(self, head: ListNode) -> ListNode: """把值都取出来, 然后排序, 再重新创建链表 时间复杂度是 O(n)+O(nlog(n))+O(n), 符合要求, 但是 空间复杂度是 O(n)""" <|body_0|> def sortList(self, head: ListNode) -> ListNode: """归并排序解法, 代码比较丑, 但是思路没问题: 先用快慢指针找到链表的中点, 断开, 然后分别排序, 再归并""" <|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def sortList2(self, head: ListNode) -> ListNode: """把值都取出来, 然后排序, 再重新创建链表 时间复杂度是 O(n)+O(nlog(n))+O(n), 符合要求, 但是 空间复杂度是 O(n)""" if not head: return None if head.next is None: return head vals = [] cur = head while cur: ...
the_stack_v2_python_sparse
2018年力扣高频算法面试题汇总/排序链表.py
iamkissg/leetcode
train
0
5b35ea4a5af61cc3193bbce9aee11e51dc5aa233
[ "subscription.is_active = self.instance.expiration_time > timezone.now()\nsubscription.save()\nself.instance.subscription = subscription\nself.instance.save()", "self.instance = self.instance or models.AppleReceipt()\nself.instance.receipt_data = data['receipt_data']\ntry:\n self.instance.update_info()\nexcept...
<|body_start_0|> subscription.is_active = self.instance.expiration_time > timezone.now() subscription.save() self.instance.subscription = subscription self.instance.save() <|end_body_0|> <|body_start_1|> self.instance = self.instance or models.AppleReceipt() self.instanc...
Serializer for an Apple receipt.
AppleReceiptSerializer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AppleReceiptSerializer: """Serializer for an Apple receipt.""" def save(self, subscription): """Save the :class:`AppleReceipt` instance associated with the serializer. Args: subscription: The subscription to associate the Apple receipt being saved with.""" <|body_0|> def...
stack_v2_sparse_classes_10k_train_000622
8,796
permissive
[ { "docstring": "Save the :class:`AppleReceipt` instance associated with the serializer. Args: subscription: The subscription to associate the Apple receipt being saved with.", "name": "save", "signature": "def save(self, subscription)" }, { "docstring": "Validate that the provided receipt data c...
2
stack_v2_sparse_classes_30k_train_005920
Implement the Python class `AppleReceiptSerializer` described below. Class description: Serializer for an Apple receipt. Method signatures and docstrings: - def save(self, subscription): Save the :class:`AppleReceipt` instance associated with the serializer. Args: subscription: The subscription to associate the Apple...
Implement the Python class `AppleReceiptSerializer` described below. Class description: Serializer for an Apple receipt. Method signatures and docstrings: - def save(self, subscription): Save the :class:`AppleReceipt` instance associated with the serializer. Args: subscription: The subscription to associate the Apple...
e4b72484c42e88a6c0087c9b1d5fef240e66cbb0
<|skeleton|> class AppleReceiptSerializer: """Serializer for an Apple receipt.""" def save(self, subscription): """Save the :class:`AppleReceipt` instance associated with the serializer. Args: subscription: The subscription to associate the Apple receipt being saved with.""" <|body_0|> def...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AppleReceiptSerializer: """Serializer for an Apple receipt.""" def save(self, subscription): """Save the :class:`AppleReceipt` instance associated with the serializer. Args: subscription: The subscription to associate the Apple receipt being saved with.""" subscription.is_active = self.in...
the_stack_v2_python_sparse
km_api/know_me/serializers/subscription_serializers.py
knowmetools/km-api
train
4
f46183fd5d77db4ad002a875a73fed28c2f8005c
[ "self.posterior = posterior\nmu = np.random.multivariate_normal(start, sigma, size=n)\nif student:\n self.components = [StudentsTComponent(1.0 / n, m, sigma, nu) for m in mu]\nelse:\n self.components = [GaussianComponent(1.0 / n, m, sigma) for m in mu]\nself.pool = pool\nself.quiet = quiet", "self.kill_coun...
<|body_start_0|> self.posterior = posterior mu = np.random.multivariate_normal(start, sigma, size=n) if student: self.components = [StudentsTComponent(1.0 / n, m, sigma, nu) for m in mu] else: self.components = [GaussianComponent(1.0 / n, m, sigma) for m in mu] ...
A Population Monte Carlo (PMC) sampler, which combines expectation-maximization and importance sampling This code follows the notation and methodolgy in http://arxiv.org/pdf/0903.0837v1.pdf
PopulationMonteCarlo
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PopulationMonteCarlo: """A Population Monte Carlo (PMC) sampler, which combines expectation-maximization and importance sampling This code follows the notation and methodolgy in http://arxiv.org/pdf/0903.0837v1.pdf""" def __init__(self, posterior, n, start, sigma, pool=None, quiet=False, stu...
stack_v2_sparse_classes_10k_train_000623
7,579
permissive
[ { "docstring": "posterior: the posterior function n: number of components to use in the mixture start: estimated mean of the distribution sigma: estimated covariance matrix pool (optional): an MPI or multiprocessing worker pool", "name": "__init__", "signature": "def __init__(self, posterior, n, start, ...
4
null
Implement the Python class `PopulationMonteCarlo` described below. Class description: A Population Monte Carlo (PMC) sampler, which combines expectation-maximization and importance sampling This code follows the notation and methodolgy in http://arxiv.org/pdf/0903.0837v1.pdf Method signatures and docstrings: - def __...
Implement the Python class `PopulationMonteCarlo` described below. Class description: A Population Monte Carlo (PMC) sampler, which combines expectation-maximization and importance sampling This code follows the notation and methodolgy in http://arxiv.org/pdf/0903.0837v1.pdf Method signatures and docstrings: - def __...
ce195564631b148bef0214a27a57470640c69a08
<|skeleton|> class PopulationMonteCarlo: """A Population Monte Carlo (PMC) sampler, which combines expectation-maximization and importance sampling This code follows the notation and methodolgy in http://arxiv.org/pdf/0903.0837v1.pdf""" def __init__(self, posterior, n, start, sigma, pool=None, quiet=False, stu...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PopulationMonteCarlo: """A Population Monte Carlo (PMC) sampler, which combines expectation-maximization and importance sampling This code follows the notation and methodolgy in http://arxiv.org/pdf/0903.0837v1.pdf""" def __init__(self, posterior, n, start, sigma, pool=None, quiet=False, student=False, n...
the_stack_v2_python_sparse
cosmosis/samplers/pmc/pmc.py
ktanidis/Modified_CosmoSIS_for_galaxy_number_count_angular_power_spectra
train
1
ca0a2a6984b8214c0ce214c666b4c8423107166d
[ "self.meshing_enabled = meshing_enabled\nself.ipv_6_bridge_enabled = ipv_6_bridge_enabled\nself.location_analytics_enabled = location_analytics_enabled\nself.led_lights_on = led_lights_on", "if dictionary is None:\n return None\nmeshing_enabled = dictionary.get('meshingEnabled')\nipv_6_bridge_enabled = diction...
<|body_start_0|> self.meshing_enabled = meshing_enabled self.ipv_6_bridge_enabled = ipv_6_bridge_enabled self.location_analytics_enabled = location_analytics_enabled self.led_lights_on = led_lights_on <|end_body_0|> <|body_start_1|> if dictionary is None: return None...
Implementation of the 'updateNetworkWirelessSettings' model. TODO: type model description here. Attributes: meshing_enabled (bool): Toggle for enabling or disabling meshing in a network ipv_6_bridge_enabled (bool): Toggle for enabling or disabling IPv6 bridging in a network (Note: if enabled, SSIDs must also be configu...
UpdateNetworkWirelessSettingsModel
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateNetworkWirelessSettingsModel: """Implementation of the 'updateNetworkWirelessSettings' model. TODO: type model description here. Attributes: meshing_enabled (bool): Toggle for enabling or disabling meshing in a network ipv_6_bridge_enabled (bool): Toggle for enabling or disabling IPv6 bridg...
stack_v2_sparse_classes_10k_train_000624
2,821
permissive
[ { "docstring": "Constructor for the UpdateNetworkWirelessSettingsModel class", "name": "__init__", "signature": "def __init__(self, meshing_enabled=None, ipv_6_bridge_enabled=None, location_analytics_enabled=None, led_lights_on=None)" }, { "docstring": "Creates an instance of this model from a d...
2
stack_v2_sparse_classes_30k_train_004721
Implement the Python class `UpdateNetworkWirelessSettingsModel` described below. Class description: Implementation of the 'updateNetworkWirelessSettings' model. TODO: type model description here. Attributes: meshing_enabled (bool): Toggle for enabling or disabling meshing in a network ipv_6_bridge_enabled (bool): Togg...
Implement the Python class `UpdateNetworkWirelessSettingsModel` described below. Class description: Implementation of the 'updateNetworkWirelessSettings' model. TODO: type model description here. Attributes: meshing_enabled (bool): Toggle for enabling or disabling meshing in a network ipv_6_bridge_enabled (bool): Togg...
9894089eb013318243ae48869cc5130eb37f80c0
<|skeleton|> class UpdateNetworkWirelessSettingsModel: """Implementation of the 'updateNetworkWirelessSettings' model. TODO: type model description here. Attributes: meshing_enabled (bool): Toggle for enabling or disabling meshing in a network ipv_6_bridge_enabled (bool): Toggle for enabling or disabling IPv6 bridg...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UpdateNetworkWirelessSettingsModel: """Implementation of the 'updateNetworkWirelessSettings' model. TODO: type model description here. Attributes: meshing_enabled (bool): Toggle for enabling or disabling meshing in a network ipv_6_bridge_enabled (bool): Toggle for enabling or disabling IPv6 bridging in a netw...
the_stack_v2_python_sparse
meraki_sdk/models/update_network_wireless_settings_model.py
RaulCatalano/meraki-python-sdk
train
1
221d3c789e5e6580f94d2daabddf663f1d249883
[ "Component.__init__(self, name, ReduceTensor, config)\nself.key_inputs = self.stream_keys['inputs']\nself.key_outputs = self.stream_keys['outputs']\nself.num_inputs_dims = self.config['num_inputs_dims']\nself.input_size = self.globals['input_size']\nself.dim = self.config['reduction_dim']\nself.keepdim = self.confi...
<|body_start_0|> Component.__init__(self, name, ReduceTensor, config) self.key_inputs = self.stream_keys['inputs'] self.key_outputs = self.stream_keys['outputs'] self.num_inputs_dims = self.config['num_inputs_dims'] self.input_size = self.globals['input_size'] self.dim = ...
Class responsible for reducing tensor using indicated reduction method along a given dimension.
ReduceTensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReduceTensor: """Class responsible for reducing tensor using indicated reduction method along a given dimension.""" def __init__(self, name, config): """Initializes object. :param name: Name of the component loaded from the configuration file. :type name: str :param config: Dictionar...
stack_v2_sparse_classes_10k_train_000625
4,905
permissive
[ { "docstring": "Initializes object. :param name: Name of the component loaded from the configuration file. :type name: str :param config: Dictionary of parameters (read from the configuration ``.yaml`` file). :type config: :py:class:`ptp.configuration.ConfigInterface`", "name": "__init__", "signature": ...
4
stack_v2_sparse_classes_30k_train_007278
Implement the Python class `ReduceTensor` described below. Class description: Class responsible for reducing tensor using indicated reduction method along a given dimension. Method signatures and docstrings: - def __init__(self, name, config): Initializes object. :param name: Name of the component loaded from the con...
Implement the Python class `ReduceTensor` described below. Class description: Class responsible for reducing tensor using indicated reduction method along a given dimension. Method signatures and docstrings: - def __init__(self, name, config): Initializes object. :param name: Name of the component loaded from the con...
9cb17271666061cb19fe24197ecd5e4c8d32c5da
<|skeleton|> class ReduceTensor: """Class responsible for reducing tensor using indicated reduction method along a given dimension.""" def __init__(self, name, config): """Initializes object. :param name: Name of the component loaded from the configuration file. :type name: str :param config: Dictionar...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ReduceTensor: """Class responsible for reducing tensor using indicated reduction method along a given dimension.""" def __init__(self, name, config): """Initializes object. :param name: Name of the component loaded from the configuration file. :type name: str :param config: Dictionary of paramete...
the_stack_v2_python_sparse
ptp/components/transforms/reduce_tensor.py
ConnectionMaster/pytorchpipe
train
1
9b73c17c9b10bcc2f777a8ab1c07abc053f02a42
[ "identifier = identifiers.primary_identifier\nfor required_perm in permission_s:\n required_permission = CaseSensitivePermission(wildcard_string=required_perm)\n domain = next(iter(required_permission.domain))\n assigned_permission_s = self.get_authzd_permissions(identifier, domain)\n is_permitted = Fal...
<|body_start_0|> identifier = identifiers.primary_identifier for required_perm in permission_s: required_permission = CaseSensitivePermission(wildcard_string=required_perm) domain = next(iter(required_permission.domain)) assigned_permission_s = self.get_authzd_permiss...
Customized version of hte default AccountStoreRealm. This is required to get case-sensitive permission behavior, which is not supported by default.
AnchoreNativeRealm
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnchoreNativeRealm: """Customized version of hte default AccountStoreRealm. This is required to get case-sensitive permission behavior, which is not supported by default.""" def is_permitted(self, identifiers, permission_s): """If the authorization info cannot be obtained from the ac...
stack_v2_sparse_classes_10k_train_000626
7,371
permissive
[ { "docstring": "If the authorization info cannot be obtained from the accountstore, permission check tuple yields False. :type identifiers: subject_abcs.IdentifierCollection :param permission_s: a collection of one or more permissions, represented as string-based permissions or Permission objects and NEVER comi...
2
stack_v2_sparse_classes_30k_train_003436
Implement the Python class `AnchoreNativeRealm` described below. Class description: Customized version of hte default AccountStoreRealm. This is required to get case-sensitive permission behavior, which is not supported by default. Method signatures and docstrings: - def is_permitted(self, identifiers, permission_s):...
Implement the Python class `AnchoreNativeRealm` described below. Class description: Customized version of hte default AccountStoreRealm. This is required to get case-sensitive permission behavior, which is not supported by default. Method signatures and docstrings: - def is_permitted(self, identifiers, permission_s):...
0f3c2a381febe1ab82918014fc421a54dedcdaeb
<|skeleton|> class AnchoreNativeRealm: """Customized version of hte default AccountStoreRealm. This is required to get case-sensitive permission behavior, which is not supported by default.""" def is_permitted(self, identifiers, permission_s): """If the authorization info cannot be obtained from the ac...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AnchoreNativeRealm: """Customized version of hte default AccountStoreRealm. This is required to get case-sensitive permission behavior, which is not supported by default.""" def is_permitted(self, identifiers, permission_s): """If the authorization info cannot be obtained from the accountstore, p...
the_stack_v2_python_sparse
anchore_engine/subsys/auth/realms.py
rkhozinov/anchore-engine
train
1
67c0ed03c8f71a462b43ce90fd9c89502261f5d4
[ "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.targetedManagedAppConfiguration'.casefold()...
<|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() ==...
Configuration used to deliver a set of custom settings as-is to apps for users to whom the configuration is scoped
ManagedAppConfiguration
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ManagedAppConfiguration: """Configuration used to deliver a set of custom settings as-is to apps for users to whom the configuration is scoped""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ManagedAppConfiguration: """Creates a new instance of the app...
stack_v2_sparse_classes_10k_train_000627
3,291
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: ManagedAppConfiguration", "name": "create_from_discriminator_value", "signature": "def create_from_discrimin...
3
null
Implement the Python class `ManagedAppConfiguration` described below. Class description: Configuration used to deliver a set of custom settings as-is to apps for users to whom the configuration is scoped Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> M...
Implement the Python class `ManagedAppConfiguration` described below. Class description: Configuration used to deliver a set of custom settings as-is to apps for users to whom the configuration is scoped Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> M...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class ManagedAppConfiguration: """Configuration used to deliver a set of custom settings as-is to apps for users to whom the configuration is scoped""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ManagedAppConfiguration: """Creates a new instance of the app...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ManagedAppConfiguration: """Configuration used to deliver a set of custom settings as-is to apps for users to whom the configuration is scoped""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ManagedAppConfiguration: """Creates a new instance of the appropriate clas...
the_stack_v2_python_sparse
msgraph/generated/models/managed_app_configuration.py
microsoftgraph/msgraph-sdk-python
train
135
e445912300bf78c0a1ba487a9cb69dbbcf6e74b6
[ "if not nums:\n return -1\nl, r = (0, len(nums) - 1)\nwhile l <= r:\n m = (l + r) // 2\n if nums[m] == target:\n return m\n if nums[l] <= nums[m]:\n if nums[l] <= target < nums[m]:\n r = m - 1\n else:\n l = m + 1\n elif nums[m] < target <= nums[r]:\n ...
<|body_start_0|> if not nums: return -1 l, r = (0, len(nums) - 1) while l <= r: m = (l + r) // 2 if nums[m] == target: return m if nums[l] <= nums[m]: if nums[l] <= target < nums[m]: r = m - 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def search(self, nums: List[int], target: int) -> int: """33 执行用时: 44 ms , 在所有 Python3 提交中击败了 36.20% 的用户 内存消耗: 14.9 MB , 在所有 Python3 提交中击败了 91.10% 的用户""" <|body_0|> def search1(self, nums: List[int], target: int) -> int: """33 执行用时: 44 ms , 在所有 Python3 提交中击...
stack_v2_sparse_classes_10k_train_000628
4,457
no_license
[ { "docstring": "33 执行用时: 44 ms , 在所有 Python3 提交中击败了 36.20% 的用户 内存消耗: 14.9 MB , 在所有 Python3 提交中击败了 91.10% 的用户", "name": "search", "signature": "def search(self, nums: List[int], target: int) -> int" }, { "docstring": "33 执行用时: 44 ms , 在所有 Python3 提交中击败了 36.48% 的用户 内存消耗: 15.2 MB , 在所有 Python3 提交中击...
3
stack_v2_sparse_classes_30k_train_002189
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def search(self, nums: List[int], target: int) -> int: 33 执行用时: 44 ms , 在所有 Python3 提交中击败了 36.20% 的用户 内存消耗: 14.9 MB , 在所有 Python3 提交中击败了 91.10% 的用户 - def search1(self, nums: List...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def search(self, nums: List[int], target: int) -> int: 33 执行用时: 44 ms , 在所有 Python3 提交中击败了 36.20% 的用户 内存消耗: 14.9 MB , 在所有 Python3 提交中击败了 91.10% 的用户 - def search1(self, nums: List...
d613ed8a5a2c15ace7d513965b372d128845d66a
<|skeleton|> class Solution: def search(self, nums: List[int], target: int) -> int: """33 执行用时: 44 ms , 在所有 Python3 提交中击败了 36.20% 的用户 内存消耗: 14.9 MB , 在所有 Python3 提交中击败了 91.10% 的用户""" <|body_0|> def search1(self, nums: List[int], target: int) -> int: """33 执行用时: 44 ms , 在所有 Python3 提交中击...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def search(self, nums: List[int], target: int) -> int: """33 执行用时: 44 ms , 在所有 Python3 提交中击败了 36.20% 的用户 内存消耗: 14.9 MB , 在所有 Python3 提交中击败了 91.10% 的用户""" if not nums: return -1 l, r = (0, len(nums) - 1) while l <= r: m = (l + r) // 2 ...
the_stack_v2_python_sparse
搜索旋转排序数组1&2.py
nomboy/leetcode
train
0
23552b6bd9a0076dff9fb1bde82366f6f0bf6595
[ "while get_current_window_id() == 10101:\n xbmc.sleep(100)\nsuper(progress_dialog, self).__init__()", "if kodi_version_major() < 19:\n lines = message.split('\\n', 2)\n line1, line2, line3 = lines + [None] * (3 - len(lines))\n return super(progress_dialog, self).create(heading, line1=line1, line2=line...
<|body_start_0|> while get_current_window_id() == 10101: xbmc.sleep(100) super(progress_dialog, self).__init__() <|end_body_0|> <|body_start_1|> if kodi_version_major() < 19: lines = message.split('\n', 2) line1, line2, line3 = lines + [None] * (3 - len(lines...
Show Kodi's Progress dialog
progress_dialog
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class progress_dialog: """Show Kodi's Progress dialog""" def __init__(self): """Initialize a new progress dialog""" <|body_0|> def create(self, heading, message=''): """Create and show a progress dialog""" <|body_1|> def update(self, percent, message=''): ...
stack_v2_sparse_classes_10k_train_000629
14,153
permissive
[ { "docstring": "Initialize a new progress dialog", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Create and show a progress dialog", "name": "create", "signature": "def create(self, heading, message='')" }, { "docstring": "Update the progress dialog", ...
3
null
Implement the Python class `progress_dialog` described below. Class description: Show Kodi's Progress dialog Method signatures and docstrings: - def __init__(self): Initialize a new progress dialog - def create(self, heading, message=''): Create and show a progress dialog - def update(self, percent, message=''): Upda...
Implement the Python class `progress_dialog` described below. Class description: Show Kodi's Progress dialog Method signatures and docstrings: - def __init__(self): Initialize a new progress dialog - def create(self, heading, message=''): Create and show a progress dialog - def update(self, percent, message=''): Upda...
9b7cab3656c2497c812ab101a56ed661dd8cf4a7
<|skeleton|> class progress_dialog: """Show Kodi's Progress dialog""" def __init__(self): """Initialize a new progress dialog""" <|body_0|> def create(self, heading, message=''): """Create and show a progress dialog""" <|body_1|> def update(self, percent, message=''): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class progress_dialog: """Show Kodi's Progress dialog""" def __init__(self): """Initialize a new progress dialog""" while get_current_window_id() == 10101: xbmc.sleep(100) super(progress_dialog, self).__init__() def create(self, heading, message=''): """Create a...
the_stack_v2_python_sparse
repo/script.module.inputstreamhelper/lib/inputstreamhelper/kodiutils.py
irmu/arda
train
7
7d2bf70a1736b50409a315ef6f4f601f3d63e250
[ "super(Exponential, self).__init__(n_dims=n_dims, active_dims=active_dims, name=name)\nlogger.debug('Initializing %s kernel.' % self.name)\nself.variance = np.float64(variance)\nself.lengthscale = np.float64(lengthscale)\nself.parameter_list = ['variance', 'lengthscale']\nself.constraint_map = {'variance': '+ve', '...
<|body_start_0|> super(Exponential, self).__init__(n_dims=n_dims, active_dims=active_dims, name=name) logger.debug('Initializing %s kernel.' % self.name) self.variance = np.float64(variance) self.lengthscale = np.float64(lengthscale) self.parameter_list = ['variance', 'lengthscal...
Exponential
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Exponential: def __init__(self, n_dims, variance=1.0, lengthscale=1.0, active_dims=None, name=None): """squared exponential kernel Inputs: n_dims : number of dimensions variance : kernel variance lengthscale : kernel lengthscale active_dims : all dims active by default, subset can be spe...
stack_v2_sparse_classes_10k_train_000630
9,047
no_license
[ { "docstring": "squared exponential kernel Inputs: n_dims : number of dimensions variance : kernel variance lengthscale : kernel lengthscale active_dims : all dims active by default, subset can be specified", "name": "__init__", "signature": "def __init__(self, n_dims, variance=1.0, lengthscale=1.0, act...
2
stack_v2_sparse_classes_30k_train_007217
Implement the Python class `Exponential` described below. Class description: Implement the Exponential class. Method signatures and docstrings: - def __init__(self, n_dims, variance=1.0, lengthscale=1.0, active_dims=None, name=None): squared exponential kernel Inputs: n_dims : number of dimensions variance : kernel v...
Implement the Python class `Exponential` described below. Class description: Implement the Exponential class. Method signatures and docstrings: - def __init__(self, n_dims, variance=1.0, lengthscale=1.0, active_dims=None, name=None): squared exponential kernel Inputs: n_dims : number of dimensions variance : kernel v...
1bed882b8a94ee58fd0bde6920ee85f81ffb77bb
<|skeleton|> class Exponential: def __init__(self, n_dims, variance=1.0, lengthscale=1.0, active_dims=None, name=None): """squared exponential kernel Inputs: n_dims : number of dimensions variance : kernel variance lengthscale : kernel lengthscale active_dims : all dims active by default, subset can be spe...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Exponential: def __init__(self, n_dims, variance=1.0, lengthscale=1.0, active_dims=None, name=None): """squared exponential kernel Inputs: n_dims : number of dimensions variance : kernel variance lengthscale : kernel lengthscale active_dims : all dims active by default, subset can be specified""" ...
the_stack_v2_python_sparse
gp_grief/kern/stationary.py
scwolof/gp_grief
train
2
71451c77233a845fd30a13fa73dc2c918dce6e58
[ "super().__init__(repo_path)\nself.oss_fuzz_project_name = oss_fuzz_project_name\nself.fuzzer_stats_url = _get_oss_fuzz_fuzzer_stats_dir_url(self.oss_fuzz_project_name)\nif self.fuzzer_stats_url is None:\n raise CoverageError('Could not get latest coverage.')", "if not self.fuzzer_stats_url:\n return None\n...
<|body_start_0|> super().__init__(repo_path) self.oss_fuzz_project_name = oss_fuzz_project_name self.fuzzer_stats_url = _get_oss_fuzz_fuzzer_stats_dir_url(self.oss_fuzz_project_name) if self.fuzzer_stats_url is None: raise CoverageError('Could not get latest coverage.') <|end...
Gets coverage data for a project from OSS-Fuzz.
OSSFuzzCoverage
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OSSFuzzCoverage: """Gets coverage data for a project from OSS-Fuzz.""" def __init__(self, repo_path, oss_fuzz_project_name): """Constructor for OSSFuzzCoverage.""" <|body_0|> def get_target_coverage(self, target): """Get the coverage report for a specific fuzz ta...
stack_v2_sparse_classes_10k_train_000631
7,002
permissive
[ { "docstring": "Constructor for OSSFuzzCoverage.", "name": "__init__", "signature": "def __init__(self, repo_path, oss_fuzz_project_name)" }, { "docstring": "Get the coverage report for a specific fuzz target. Args: target: The name of the fuzz target whose coverage is requested. Returns: The ta...
2
stack_v2_sparse_classes_30k_train_003451
Implement the Python class `OSSFuzzCoverage` described below. Class description: Gets coverage data for a project from OSS-Fuzz. Method signatures and docstrings: - def __init__(self, repo_path, oss_fuzz_project_name): Constructor for OSSFuzzCoverage. - def get_target_coverage(self, target): Get the coverage report f...
Implement the Python class `OSSFuzzCoverage` described below. Class description: Gets coverage data for a project from OSS-Fuzz. Method signatures and docstrings: - def __init__(self, repo_path, oss_fuzz_project_name): Constructor for OSSFuzzCoverage. - def get_target_coverage(self, target): Get the coverage report f...
f0275421f84b8f80ee767fb9230134ac97cb687b
<|skeleton|> class OSSFuzzCoverage: """Gets coverage data for a project from OSS-Fuzz.""" def __init__(self, repo_path, oss_fuzz_project_name): """Constructor for OSSFuzzCoverage.""" <|body_0|> def get_target_coverage(self, target): """Get the coverage report for a specific fuzz ta...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class OSSFuzzCoverage: """Gets coverage data for a project from OSS-Fuzz.""" def __init__(self, repo_path, oss_fuzz_project_name): """Constructor for OSSFuzzCoverage.""" super().__init__(repo_path) self.oss_fuzz_project_name = oss_fuzz_project_name self.fuzzer_stats_url = _get_o...
the_stack_v2_python_sparse
infra/cifuzz/get_coverage.py
google/oss-fuzz
train
9,438
d50b9ec43ce411c27531f7a4e837e90aacff257b
[ "memo = dict()\n\ndef dfs(nums, index, total, target):\n if index == len(nums):\n return 1 if total == target else 0\n if (index, total) in memo.keys():\n return memo[index, total]\n else:\n memo[index, total] = dfs(nums, index + 1, total + nums[index], target) + dfs(nums, index + 1, t...
<|body_start_0|> memo = dict() def dfs(nums, index, total, target): if index == len(nums): return 1 if total == target else 0 if (index, total) in memo.keys(): return memo[index, total] else: memo[index, total] = dfs(nu...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findTargetSumWays1(self, nums: List[int], S: int) -> int: """简单的dfs会超时,需要进行优化。 以[1,1,1] 为例: 0 / -1 1 / \\ / -2 0 0 2 # 当所在层数相同且sum相同时,则后面dfs的结果也是相同的,不用重复计算 /\\ /\\ /\\ / -3 -1 -1 1 -1 1 1 3 将当前层数及sum值存到dict,后面计算时遇到相同key直接取vaule即可(这里需要理解,dfs是自底向上返回值,所以从dict中取到的value,是当前key从底...
stack_v2_sparse_classes_10k_train_000632
3,042
no_license
[ { "docstring": "简单的dfs会超时,需要进行优化。 以[1,1,1] 为例: 0 / -1 1 / \\\\ / -2 0 0 2 # 当所在层数相同且sum相同时,则后面dfs的结果也是相同的,不用重复计算 /\\\\ /\\\\ /\\\\ / -3 -1 -1 1 -1 1 1 3 将当前层数及sum值存到dict,后面计算时遇到相同key直接取vaule即可(这里需要理解,dfs是自底向上返回值,所以从dict中取到的value,是当前key从底往上的返回值,即所有结果)", "name": "findTargetSumWays1", "signature": "def fin...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findTargetSumWays1(self, nums: List[int], S: int) -> int: 简单的dfs会超时,需要进行优化。 以[1,1,1] 为例: 0 / -1 1 / \\ / -2 0 0 2 # 当所在层数相同且sum相同时,则后面dfs的结果也是相同的,不用重复计算 /\\ /\\ /\\ / -3 -1 -...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findTargetSumWays1(self, nums: List[int], S: int) -> int: 简单的dfs会超时,需要进行优化。 以[1,1,1] 为例: 0 / -1 1 / \\ / -2 0 0 2 # 当所在层数相同且sum相同时,则后面dfs的结果也是相同的,不用重复计算 /\\ /\\ /\\ / -3 -1 -...
2bbb1640589aab34f2bc42489283033cc11fb885
<|skeleton|> class Solution: def findTargetSumWays1(self, nums: List[int], S: int) -> int: """简单的dfs会超时,需要进行优化。 以[1,1,1] 为例: 0 / -1 1 / \\ / -2 0 0 2 # 当所在层数相同且sum相同时,则后面dfs的结果也是相同的,不用重复计算 /\\ /\\ /\\ / -3 -1 -1 1 -1 1 1 3 将当前层数及sum值存到dict,后面计算时遇到相同key直接取vaule即可(这里需要理解,dfs是自底向上返回值,所以从dict中取到的value,是当前key从底...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def findTargetSumWays1(self, nums: List[int], S: int) -> int: """简单的dfs会超时,需要进行优化。 以[1,1,1] 为例: 0 / -1 1 / \\ / -2 0 0 2 # 当所在层数相同且sum相同时,则后面dfs的结果也是相同的,不用重复计算 /\\ /\\ /\\ / -3 -1 -1 1 -1 1 1 3 将当前层数及sum值存到dict,后面计算时遇到相同key直接取vaule即可(这里需要理解,dfs是自底向上返回值,所以从dict中取到的value,是当前key从底往上的返回值,即所有结果)"...
the_stack_v2_python_sparse
494_target-sum.py
helloocc/algorithm
train
1
1c3ca6b81fe71d475d65a203b8b1de5b1ec5459b
[ "data = request.get_json()\nseat = 1\nif data:\n seat = data.get('seat')\ncurrent_user = get_jwt_identity()\ntry:\n flight = get_flight(flight_id)\n if not flight:\n return generate_response('Selected flight not available', 400)\n if seat == 1 and flight.booked_economy < flight.airplane.economy_s...
<|body_start_0|> data = request.get_json() seat = 1 if data: seat = data.get('seat') current_user = get_jwt_identity() try: flight = get_flight(flight_id) if not flight: return generate_response('Selected flight not available', ...
Class to manipulate the airport details
BookingManipulation
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BookingManipulation: """Class to manipulate the airport details""" def post(self, flight_id): """POST method to add a new flight booking""" <|body_0|> def get(self, flight_id): """Return a list of all reservations in a given day""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_10k_train_000633
2,955
permissive
[ { "docstring": "POST method to add a new flight booking", "name": "post", "signature": "def post(self, flight_id)" }, { "docstring": "Return a list of all reservations in a given day", "name": "get", "signature": "def get(self, flight_id)" } ]
2
stack_v2_sparse_classes_30k_val_000322
Implement the Python class `BookingManipulation` described below. Class description: Class to manipulate the airport details Method signatures and docstrings: - def post(self, flight_id): POST method to add a new flight booking - def get(self, flight_id): Return a list of all reservations in a given day
Implement the Python class `BookingManipulation` described below. Class description: Class to manipulate the airport details Method signatures and docstrings: - def post(self, flight_id): POST method to add a new flight booking - def get(self, flight_id): Return a list of all reservations in a given day <|skeleton|>...
77b157098d618582737979382197e5302d347017
<|skeleton|> class BookingManipulation: """Class to manipulate the airport details""" def post(self, flight_id): """POST method to add a new flight booking""" <|body_0|> def get(self, flight_id): """Return a list of all reservations in a given day""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BookingManipulation: """Class to manipulate the airport details""" def post(self, flight_id): """POST method to add a new flight booking""" data = request.get_json() seat = 1 if data: seat = data.get('seat') current_user = get_jwt_identity() try...
the_stack_v2_python_sparse
app/bookings/views.py
muthash/flight-booking-flask
train
6
f2b0fbc98fc2bd8fe90294854641aa4a3e97e921
[ "self.event = None\nself.concrete_categories = None\nself.abstract_categories = None\nself.key = key\nif not regex_objects:\n if model:\n regex_objs = RegexCategory.objects.select_related().filter(model_type=model)\n else:\n regex_objs = RegexCategory.objects.all()\nelse:\n regex_objs = regex...
<|body_start_0|> self.event = None self.concrete_categories = None self.abstract_categories = None self.key = key if not regex_objects: if model: regex_objs = RegexCategory.objects.select_related().filter(model_type=model) else: ...
Use a regular expression to map the external category text to internal categories
RegexRule
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegexRule: """Use a regular expression to map the external category text to internal categories""" def __init__(self, key, model, regex_objects=None): """# note: regexes are compiled here- they are not strings self.source_rules = defaultdict(list) # built from a table self.null_rules...
stack_v2_sparse_classes_10k_train_000634
10,087
no_license
[ { "docstring": "# note: regexes are compiled here- they are not strings self.source_rules = defaultdict(list) # built from a table self.null_rules = [] # from items in table with source NULL for row in model: key(row) -> category each model is of the form: regular_expression We basically build 2 different types...
2
stack_v2_sparse_classes_30k_train_005717
Implement the Python class `RegexRule` described below. Class description: Use a regular expression to map the external category text to internal categories Method signatures and docstrings: - def __init__(self, key, model, regex_objects=None): # note: regexes are compiled here- they are not strings self.source_rules...
Implement the Python class `RegexRule` described below. Class description: Use a regular expression to map the external category text to internal categories Method signatures and docstrings: - def __init__(self, key, model, regex_objects=None): # note: regexes are compiled here- they are not strings self.source_rules...
c4992d80f984f3360eb2018c5a1b13ce962a55b4
<|skeleton|> class RegexRule: """Use a regular expression to map the external category text to internal categories""" def __init__(self, key, model, regex_objects=None): """# note: regexes are compiled here- they are not strings self.source_rules = defaultdict(list) # built from a table self.null_rules...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RegexRule: """Use a regular expression to map the external category text to internal categories""" def __init__(self, key, model, regex_objects=None): """# note: regexes are compiled here- they are not strings self.source_rules = defaultdict(list) # built from a table self.null_rules = [] # from ...
the_stack_v2_python_sparse
abextra/pundit/classification_rules.py
danbretl/mid-tier
train
0
1156dae05e641403082e891e000e447d1090a9b7
[ "self.key2node = {}\nself.freq2list = defaultdict(OrderedDict)\nself.capacity = capacity\nself.minf = 0", "if key not in self.key2node:\n return -1\nkey, value, freq = self.key2node[key]\nself.freq2list[freq].pop(key)\nself.key2node.pop(key)\nif not self.freq2list[freq] and freq == self.minf:\n self.minf +=...
<|body_start_0|> self.key2node = {} self.freq2list = defaultdict(OrderedDict) self.capacity = capacity self.minf = 0 <|end_body_0|> <|body_start_1|> if key not in self.key2node: return -1 key, value, freq = self.key2node[key] self.freq2list[freq].pop(...
LFUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LFUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_10k_train_000635
2,950
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: None", "name": "pu...
3
null
Implement the Python class `LFUCache` described below. Class description: Implement the LFUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None
Implement the Python class `LFUCache` described below. Class description: Implement the LFUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None <|sk...
547cdc7365716660a9d9590c1cc97d95bc38d315
<|skeleton|> class LFUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LFUCache: def __init__(self, capacity): """:type capacity: int""" self.key2node = {} self.freq2list = defaultdict(OrderedDict) self.capacity = capacity self.minf = 0 def get(self, key): """:type key: int :rtype: int""" if key not in self.key2node: ...
the_stack_v2_python_sparse
460.lfu-cache.py
zhch-sun/leetcode_szc
train
0
ab055e3c903c0a1c51ea4e8407d5df8c4b964dc7
[ "try:\n http_method = self._resolve_method(request)\n http_headers = self._convert_list_tuples_to_dict(headers_list=request.headers)\n parsed_url = parse_url(request.url)\n if parsed_url.scheme is None or parsed_url.scheme != 'https':\n raise ApiClientException('Requests against non-HTTPS endpoin...
<|body_start_0|> try: http_method = self._resolve_method(request) http_headers = self._convert_list_tuples_to_dict(headers_list=request.headers) parsed_url = parse_url(request.url) if parsed_url.scheme is None or parsed_url.scheme != 'https': raise...
Default ApiClient implementation of :py:class:`ask_sdk_model.services.api_client.ApiClient` using the `requests` library.
DefaultApiClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DefaultApiClient: """Default ApiClient implementation of :py:class:`ask_sdk_model.services.api_client.ApiClient` using the `requests` library.""" def invoke(self, request): """Dispatches a request to an API endpoint described in the request. Resolves the method from input request obj...
stack_v2_sparse_classes_10k_train_000636
6,077
permissive
[ { "docstring": "Dispatches a request to an API endpoint described in the request. Resolves the method from input request object, converts the list of header tuples to the required format (dict) for the `requests` lib call and invokes the method with corresponding parameters on `requests` library. The response f...
4
stack_v2_sparse_classes_30k_train_002203
Implement the Python class `DefaultApiClient` described below. Class description: Default ApiClient implementation of :py:class:`ask_sdk_model.services.api_client.ApiClient` using the `requests` library. Method signatures and docstrings: - def invoke(self, request): Dispatches a request to an API endpoint described i...
Implement the Python class `DefaultApiClient` described below. Class description: Default ApiClient implementation of :py:class:`ask_sdk_model.services.api_client.ApiClient` using the `requests` library. Method signatures and docstrings: - def invoke(self, request): Dispatches a request to an API endpoint described i...
7e13ca69b240985584dff6ec633a27598a154ca1
<|skeleton|> class DefaultApiClient: """Default ApiClient implementation of :py:class:`ask_sdk_model.services.api_client.ApiClient` using the `requests` library.""" def invoke(self, request): """Dispatches a request to an API endpoint described in the request. Resolves the method from input request obj...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DefaultApiClient: """Default ApiClient implementation of :py:class:`ask_sdk_model.services.api_client.ApiClient` using the `requests` library.""" def invoke(self, request): """Dispatches a request to an API endpoint described in the request. Resolves the method from input request object, converts...
the_stack_v2_python_sparse
ask-sdk-core/ask_sdk_core/api_client.py
alexa/alexa-skills-kit-sdk-for-python
train
560
0122accf959081acb64d200093feee0f2bd3b16b
[ "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.printer'.casefold():\n from .printer imp...
<|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() ==...
PrinterBase
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrinterBase: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> PrinterBase: """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: Pr...
stack_v2_sparse_classes_10k_train_000637
5,587
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: PrinterBase", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(p...
3
null
Implement the Python class `PrinterBase` described below. Class description: Implement the PrinterBase class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> PrinterBase: Creates a new instance of the appropriate class based on discriminator value Args:...
Implement the Python class `PrinterBase` described below. Class description: Implement the PrinterBase class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> PrinterBase: Creates a new instance of the appropriate class based on discriminator value Args:...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class PrinterBase: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> PrinterBase: """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: Pr...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PrinterBase: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> PrinterBase: """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: PrinterBase""" ...
the_stack_v2_python_sparse
msgraph/generated/models/printer_base.py
microsoftgraph/msgraph-sdk-python
train
135
a1fff8fc17bb72491be6d189cfc5ff8610bec0b7
[ "self.val = None\nself.prev = None\nself.next = None", "if index == 0:\n if self.val != None:\n return self.val\n else:\n return -1\nif self.next:\n return self.next.get(index - 1)\nelse:\n return -1", "new = MyLinkedList()\nnew.val = self.val\nnew.prev = self\nnew.next = self.next\nif...
<|body_start_0|> self.val = None self.prev = None self.next = None <|end_body_0|> <|body_start_1|> if index == 0: if self.val != None: return self.val else: return -1 if self.next: return self.next.get(index - 1...
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_000638
4,061
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...
4bf1a7814b5c76e11242e7933e09c59ede3284a3
<|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.val = None self.prev = None self.next = None 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
Explore/Linked List/Singly Linked List/0707_Design_Linked_List.py
actcheng/leetcode-solutions
train
2
093d8a9bba46d5917950997bdca51a8bfa1432b5
[ "account = v['user.account']\npassword = v['user.password']\napp = Demo()\nres = app.login(account, password).json()\nassert res['code'] == 10000\nassert res['msg'] == 'login success'", "email = v['user.account']\npassword = '123456'\napp = Demo()\nres = app.login(email, password).json()\nassert res['code'] == 20...
<|body_start_0|> account = v['user.account'] password = v['user.password'] app = Demo() res = app.login(account, password).json() assert res['code'] == 10000 assert res['msg'] == 'login success' <|end_body_0|> <|body_start_1|> email = v['user.account'] pa...
TestLogin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestLogin: def test_login_success(self): """测试登录成功场景""" <|body_0|> def test_login_with_error_password(self): """测试使用错误的密码登录""" <|body_1|> <|end_skeleton|> <|body_start_0|> account = v['user.account'] password = v['user.password'] app...
stack_v2_sparse_classes_10k_train_000639
722
permissive
[ { "docstring": "测试登录成功场景", "name": "test_login_success", "signature": "def test_login_success(self)" }, { "docstring": "测试使用错误的密码登录", "name": "test_login_with_error_password", "signature": "def test_login_with_error_password(self)" } ]
2
stack_v2_sparse_classes_30k_train_001432
Implement the Python class `TestLogin` described below. Class description: Implement the TestLogin class. Method signatures and docstrings: - def test_login_success(self): 测试登录成功场景 - def test_login_with_error_password(self): 测试使用错误的密码登录
Implement the Python class `TestLogin` described below. Class description: Implement the TestLogin class. Method signatures and docstrings: - def test_login_success(self): 测试登录成功场景 - def test_login_with_error_password(self): 测试使用错误的密码登录 <|skeleton|> class TestLogin: def test_login_success(self): """测试登录...
36be435d4aab7a730a267a985fc4ea6493cab232
<|skeleton|> class TestLogin: def test_login_success(self): """测试登录成功场景""" <|body_0|> def test_login_with_error_password(self): """测试使用错误的密码登录""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestLogin: def test_login_success(self): """测试登录成功场景""" account = v['user.account'] password = v['user.password'] app = Demo() res = app.login(account, password).json() assert res['code'] == 10000 assert res['msg'] == 'login success' def test_login_...
the_stack_v2_python_sparse
src/walnuts/templates/test_suites/test_login.py
hzs618/walnuts
train
0
e0b089fd82815c1cf94829106bbaa11934353e5b
[ "super().__init__(unique_id, zha_device, cluster_handlers, **kwargs)\nself._presets = [PRESET_NONE, self.PRESET_HOLIDAY, PRESET_SCHEDULE, self.PRESET_FROST]\nself._supported_flags |= ClimateEntityFeature.PRESET_MODE", "if record.attr_name == 'operation_preset':\n if record.value == 0:\n self._preset = P...
<|body_start_0|> super().__init__(unique_id, zha_device, cluster_handlers, **kwargs) self._presets = [PRESET_NONE, self.PRESET_HOLIDAY, PRESET_SCHEDULE, self.PRESET_FROST] self._supported_flags |= ClimateEntityFeature.PRESET_MODE <|end_body_0|> <|body_start_1|> if record.attr_name == 'o...
ZONNSMART Thermostat implementation. Notice that this device uses two holiday presets (2: HolidayMode, 3: HolidayModeTemp), but only one of them can be set.
ZONNSMARTThermostat
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZONNSMARTThermostat: """ZONNSMART Thermostat implementation. Notice that this device uses two holiday presets (2: HolidayMode, 3: HolidayModeTemp), but only one of them can be set.""" def __init__(self, unique_id, zha_device, cluster_handlers, **kwargs): """Initialize ZHA Thermostat ...
stack_v2_sparse_classes_10k_train_000640
29,216
permissive
[ { "docstring": "Initialize ZHA Thermostat instance.", "name": "__init__", "signature": "def __init__(self, unique_id, zha_device, cluster_handlers, **kwargs)" }, { "docstring": "Handle attribute update from device.", "name": "async_attribute_updated", "signature": "async def async_attrib...
3
null
Implement the Python class `ZONNSMARTThermostat` described below. Class description: ZONNSMART Thermostat implementation. Notice that this device uses two holiday presets (2: HolidayMode, 3: HolidayModeTemp), but only one of them can be set. Method signatures and docstrings: - def __init__(self, unique_id, zha_device...
Implement the Python class `ZONNSMARTThermostat` described below. Class description: ZONNSMART Thermostat implementation. Notice that this device uses two holiday presets (2: HolidayMode, 3: HolidayModeTemp), but only one of them can be set. Method signatures and docstrings: - def __init__(self, unique_id, zha_device...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class ZONNSMARTThermostat: """ZONNSMART Thermostat implementation. Notice that this device uses two holiday presets (2: HolidayMode, 3: HolidayModeTemp), but only one of them can be set.""" def __init__(self, unique_id, zha_device, cluster_handlers, **kwargs): """Initialize ZHA Thermostat ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ZONNSMARTThermostat: """ZONNSMART Thermostat implementation. Notice that this device uses two holiday presets (2: HolidayMode, 3: HolidayModeTemp), but only one of them can be set.""" def __init__(self, unique_id, zha_device, cluster_handlers, **kwargs): """Initialize ZHA Thermostat instance.""" ...
the_stack_v2_python_sparse
homeassistant/components/zha/climate.py
home-assistant/core
train
35,501
08c20671c2a17fca57a62e61251f33f66fd8d397
[ "super().__init__()\nself.v2_proj = nn.Linear(hidden_size, hidden_size)\nself.proj = nn.Linear(hidden_size * 4, hidden_size * 2)\nself.dropout = nn.Dropout(p=dropout_rate)", "proj_v2 = self.v2_proj(v2)\nsimilarity_matrix = v1.bmm(proj_v2.transpose(2, 1).contiguous())\nv1_v2_attn = F.softmax(similarity_matrix.mask...
<|body_start_0|> super().__init__() self.v2_proj = nn.Linear(hidden_size, hidden_size) self.proj = nn.Linear(hidden_size * 4, hidden_size * 2) self.dropout = nn.Dropout(p=dropout_rate) <|end_body_0|> <|body_start_1|> proj_v2 = self.v2_proj(v2) similarity_matrix = v1.bmm(...
Computing the match representation for Match LSTM. :param hidden_size: Size of hidden vectors. :param dropout_rate: Dropout rate of the projection layer. Defaults to 0. Examples: >>> import torch >>> attention = MatchModule(hidden_size=10) >>> v1 = torch.randn(4, 5, 10) >>> v1.shape torch.Size([4, 5, 10]) >>> v2 = torc...
MatchModule
[ "MIT", "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-proprietary-license", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-unknown-license-reference", "LGPL-2.1-or-later", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MatchModule: """Computing the match representation for Match LSTM. :param hidden_size: Size of hidden vectors. :param dropout_rate: Dropout rate of the projection layer. Defaults to 0. Examples: >>> import torch >>> attention = MatchModule(hidden_size=10) >>> v1 = torch.randn(4, 5, 10) >>> v1.sha...
stack_v2_sparse_classes_10k_train_000641
3,191
permissive
[ { "docstring": "Init.", "name": "__init__", "signature": "def __init__(self, hidden_size, dropout_rate=0)" }, { "docstring": "Computing attention vectors and projection vectors.", "name": "forward", "signature": "def forward(self, v1, v2, v2_mask)" } ]
2
stack_v2_sparse_classes_30k_train_007026
Implement the Python class `MatchModule` described below. Class description: Computing the match representation for Match LSTM. :param hidden_size: Size of hidden vectors. :param dropout_rate: Dropout rate of the projection layer. Defaults to 0. Examples: >>> import torch >>> attention = MatchModule(hidden_size=10) >>...
Implement the Python class `MatchModule` described below. Class description: Computing the match representation for Match LSTM. :param hidden_size: Size of hidden vectors. :param dropout_rate: Dropout rate of the projection layer. Defaults to 0. Examples: >>> import torch >>> attention = MatchModule(hidden_size=10) >>...
4198ebce942f4afe7ddca6a96ab6f4464ade4518
<|skeleton|> class MatchModule: """Computing the match representation for Match LSTM. :param hidden_size: Size of hidden vectors. :param dropout_rate: Dropout rate of the projection layer. Defaults to 0. Examples: >>> import torch >>> attention = MatchModule(hidden_size=10) >>> v1 = torch.randn(4, 5, 10) >>> v1.sha...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MatchModule: """Computing the match representation for Match LSTM. :param hidden_size: Size of hidden vectors. :param dropout_rate: Dropout rate of the projection layer. Defaults to 0. Examples: >>> import torch >>> attention = MatchModule(hidden_size=10) >>> v1 = torch.randn(4, 5, 10) >>> v1.shape torch.Size...
the_stack_v2_python_sparse
poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/modules/attention.py
microsoft/ContextualSP
train
332
9287250760624f3e344034fb105186a21f6ae4f2
[ "response = utility.ExecutorResponse()\nerr_msg = 'Testing handling of OSError'\nwith patch('subprocess.run') as mock_run:\n mock_run.side_effect = MagicMock(side_effect=OSError(err_msg))\n response.execute_command([])\nself.assertEqual(response._stdout, '')\nself.assertEqual(response._stderr, err_msg)", "t...
<|body_start_0|> response = utility.ExecutorResponse() err_msg = 'Testing handling of OSError' with patch('subprocess.run') as mock_run: mock_run.side_effect = MagicMock(side_effect=OSError(err_msg)) response.execute_command([]) self.assertEqual(response._stdout, ...
UtilityTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UtilityTest: def test_execute_command_oserror(self): """Testing stdout and stderr is correctly captured upon OSError.""" <|body_0|> def test_execute_command_stdout(self): """Testing stdout output is correctly captured.""" <|body_1|> def test_execute_comm...
stack_v2_sparse_classes_10k_train_000642
2,714
permissive
[ { "docstring": "Testing stdout and stderr is correctly captured upon OSError.", "name": "test_execute_command_oserror", "signature": "def test_execute_command_oserror(self)" }, { "docstring": "Testing stdout output is correctly captured.", "name": "test_execute_command_stdout", "signatur...
5
null
Implement the Python class `UtilityTest` described below. Class description: Implement the UtilityTest class. Method signatures and docstrings: - def test_execute_command_oserror(self): Testing stdout and stderr is correctly captured upon OSError. - def test_execute_command_stdout(self): Testing stdout output is corr...
Implement the Python class `UtilityTest` described below. Class description: Implement the UtilityTest class. Method signatures and docstrings: - def test_execute_command_oserror(self): Testing stdout and stderr is correctly captured upon OSError. - def test_execute_command_stdout(self): Testing stdout output is corr...
3fb199658f68e7debf4906d9ce32a9a307e39243
<|skeleton|> class UtilityTest: def test_execute_command_oserror(self): """Testing stdout and stderr is correctly captured upon OSError.""" <|body_0|> def test_execute_command_stdout(self): """Testing stdout output is correctly captured.""" <|body_1|> def test_execute_comm...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UtilityTest: def test_execute_command_oserror(self): """Testing stdout and stderr is correctly captured upon OSError.""" response = utility.ExecutorResponse() err_msg = 'Testing handling of OSError' with patch('subprocess.run') as mock_run: mock_run.side_effect = Ma...
the_stack_v2_python_sparse
sdk/python/kfp/cli/diagnose_me/utility_test.py
kubeflow/pipelines
train
3,434
ec53f19c80eb1e296e12949fc45f5cd3af31f792
[ "super().__init__()\nself.tade1 = TADELayer(in_channels=in_channels, aux_channels=aux_channels, kernel_size=kernel_size, bias=bias, upsample_factor=1, upsample_mode=upsample_mode)\nself.gated_conv1 = torch.nn.Conv1d(in_channels, in_channels * 2, kernel_size, 1, bias=bias, padding=(kernel_size - 1) // 2)\nself.tade2...
<|body_start_0|> super().__init__() self.tade1 = TADELayer(in_channels=in_channels, aux_channels=aux_channels, kernel_size=kernel_size, bias=bias, upsample_factor=1, upsample_mode=upsample_mode) self.gated_conv1 = torch.nn.Conv1d(in_channels, in_channels * 2, kernel_size, 1, bias=bias, padding=(...
TADEResBlock module.
TADEResBlock
[ "MIT", "LicenseRef-scancode-proprietary-license", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TADEResBlock: """TADEResBlock module.""" def __init__(self, in_channels=64, aux_channels=80, kernel_size=9, dilation=2, bias=True, upsample_factor=2, upsample_mode='nearest', gated_function='softmax'): """Initialize TADEResBlock module.""" <|body_0|> def forward(self, x,...
stack_v2_sparse_classes_10k_train_000643
4,805
permissive
[ { "docstring": "Initialize TADEResBlock module.", "name": "__init__", "signature": "def __init__(self, in_channels=64, aux_channels=80, kernel_size=9, dilation=2, bias=True, upsample_factor=2, upsample_mode='nearest', gated_function='softmax')" }, { "docstring": "Calculate forward propagation. A...
2
stack_v2_sparse_classes_30k_train_000062
Implement the Python class `TADEResBlock` described below. Class description: TADEResBlock module. Method signatures and docstrings: - def __init__(self, in_channels=64, aux_channels=80, kernel_size=9, dilation=2, bias=True, upsample_factor=2, upsample_mode='nearest', gated_function='softmax'): Initialize TADEResBloc...
Implement the Python class `TADEResBlock` described below. Class description: TADEResBlock module. Method signatures and docstrings: - def __init__(self, in_channels=64, aux_channels=80, kernel_size=9, dilation=2, bias=True, upsample_factor=2, upsample_mode='nearest', gated_function='softmax'): Initialize TADEResBloc...
c68b4590ab20eaf55e0b96b82325a90177fffd5c
<|skeleton|> class TADEResBlock: """TADEResBlock module.""" def __init__(self, in_channels=64, aux_channels=80, kernel_size=9, dilation=2, bias=True, upsample_factor=2, upsample_mode='nearest', gated_function='softmax'): """Initialize TADEResBlock module.""" <|body_0|> def forward(self, x,...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TADEResBlock: """TADEResBlock module.""" def __init__(self, in_channels=64, aux_channels=80, kernel_size=9, dilation=2, bias=True, upsample_factor=2, upsample_mode='nearest', gated_function='softmax'): """Initialize TADEResBlock module.""" super().__init__() self.tade1 = TADELayer...
the_stack_v2_python_sparse
parallel_wavegan/layers/tade_res_block.py
kan-bayashi/ParallelWaveGAN
train
1,405
dc12b70e917bb37106704c6059efc1f325368d92
[ "self.items = sorted(items) if items else []\nself.sorted = False\nself.sorting_parameters = sorting_parameters", "if not newitem in self.items:\n self.items.append(newitem)\n self.sorted = False", "if not self.sorted:\n self.items.sort(**self.sorting_parameters)\n self.sorted = True" ]
<|body_start_0|> self.items = sorted(items) if items else [] self.sorted = False self.sorting_parameters = sorting_parameters <|end_body_0|> <|body_start_1|> if not newitem in self.items: self.items.append(newitem) self.sorted = False <|end_body_1|> <|body_start...
Loose Python equivalent of std::set. makes sure list is sorted when it is accessed (searched, iterated over, etc.), but not until then. Basically, sort lazily. Items are also unique.
OrderedSet
[ "BSD-3-Clause", "BSD-2-Clause-Views", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrderedSet: """Loose Python equivalent of std::set. makes sure list is sorted when it is accessed (searched, iterated over, etc.), but not until then. Basically, sort lazily. Items are also unique.""" def __init__(self, items=None, **sorting_parameters): """Initialize the set with a ...
stack_v2_sparse_classes_10k_train_000644
1,239
permissive
[ { "docstring": "Initialize the set with a list of items, or not at all. They will be sorted automatically. items = list of initial items sorting_parameters = keyword arguments which will be passed to sort", "name": "__init__", "signature": "def __init__(self, items=None, **sorting_parameters)" }, { ...
3
stack_v2_sparse_classes_30k_train_001361
Implement the Python class `OrderedSet` described below. Class description: Loose Python equivalent of std::set. makes sure list is sorted when it is accessed (searched, iterated over, etc.), but not until then. Basically, sort lazily. Items are also unique. Method signatures and docstrings: - def __init__(self, item...
Implement the Python class `OrderedSet` described below. Class description: Loose Python equivalent of std::set. makes sure list is sorted when it is accessed (searched, iterated over, etc.), but not until then. Basically, sort lazily. Items are also unique. Method signatures and docstrings: - def __init__(self, item...
9a85b997ddf0a3d7c50ab109cb3b91e71743c7a3
<|skeleton|> class OrderedSet: """Loose Python equivalent of std::set. makes sure list is sorted when it is accessed (searched, iterated over, etc.), but not until then. Basically, sort lazily. Items are also unique.""" def __init__(self, items=None, **sorting_parameters): """Initialize the set with a ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class OrderedSet: """Loose Python equivalent of std::set. makes sure list is sorted when it is accessed (searched, iterated over, etc.), but not until then. Basically, sort lazily. Items are also unique.""" def __init__(self, items=None, **sorting_parameters): """Initialize the set with a list of items...
the_stack_v2_python_sparse
mobile/pcap2har/orderedset.py
jpvincent/WPT-server
train
17
0e7a0fb6d3bae406de8ccf2e614514c9c2fff34b
[ "cur_obj = self\nfor key in list_of_keys:\n cur_obj = cur_obj.get(key)\n if not cur_obj:\n break\nreturn cur_obj", "inv_map = {}\nfor k, v in self.items():\n if sys.version_info < (3, 0):\n acceptable_v_instance = isinstance(v, (str, int, float, long))\n else:\n acceptable_v_insta...
<|body_start_0|> cur_obj = self for key in list_of_keys: cur_obj = cur_obj.get(key) if not cur_obj: break return cur_obj <|end_body_0|> <|body_start_1|> inv_map = {} for k, v in self.items(): if sys.version_info < (3, 0): ...
This class expands on the dictionary class by adding the gettree class method.
adv_dict
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class adv_dict: """This class expands on the dictionary class by adding the gettree class method.""" def get_tree(self, list_of_keys): """gettree will extract the value from a nested tree INPUT list_of_keys: a list of keys ie. ['key1', 'key2'] USAGE >>> # Access the value for key2 within t...
stack_v2_sparse_classes_10k_train_000645
22,796
permissive
[ { "docstring": "gettree will extract the value from a nested tree INPUT list_of_keys: a list of keys ie. ['key1', 'key2'] USAGE >>> # Access the value for key2 within the nested dictionary >>> adv_dict({'key1': {'key2': 'value'}}).gettree(['key1', 'key2']) 'value'", "name": "get_tree", "signature": "def...
2
stack_v2_sparse_classes_30k_train_006726
Implement the Python class `adv_dict` described below. Class description: This class expands on the dictionary class by adding the gettree class method. Method signatures and docstrings: - def get_tree(self, list_of_keys): gettree will extract the value from a nested tree INPUT list_of_keys: a list of keys ie. ['key1...
Implement the Python class `adv_dict` described below. Class description: This class expands on the dictionary class by adding the gettree class method. Method signatures and docstrings: - def get_tree(self, list_of_keys): gettree will extract the value from a nested tree INPUT list_of_keys: a list of keys ie. ['key1...
b4cc546485bddbbe26de6a80b629350314db6422
<|skeleton|> class adv_dict: """This class expands on the dictionary class by adding the gettree class method.""" def get_tree(self, list_of_keys): """gettree will extract the value from a nested tree INPUT list_of_keys: a list of keys ie. ['key1', 'key2'] USAGE >>> # Access the value for key2 within t...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class adv_dict: """This class expands on the dictionary class by adding the gettree class method.""" def get_tree(self, list_of_keys): """gettree will extract the value from a nested tree INPUT list_of_keys: a list of keys ie. ['key1', 'key2'] USAGE >>> # Access the value for key2 within the nested dic...
the_stack_v2_python_sparse
genemethods/cgecore/utility.py
OLC-LOC-Bioinformatics/genemethods
train
1
54c4f3520d5d633aec41806b924b17ff1faf61a8
[ "QtWidgets.QDialog.__init__(self)\nself.df = pandaTable\nself.layout = QtWidgets.QGridLayout(self)\nself.columnSelect = QtWidgets.QComboBox()\nself.columnSelect.addItems(self.df.columns.values)\nself.layout.addWidget(self.columnSelect, 0, 1)\nself.layout.addWidget(QtWidgets.QLabel('Column:'), 0, 0)\nself.separatorL...
<|body_start_0|> QtWidgets.QDialog.__init__(self) self.df = pandaTable self.layout = QtWidgets.QGridLayout(self) self.columnSelect = QtWidgets.QComboBox() self.columnSelect.addItems(self.df.columns.values) self.layout.addWidget(self.columnSelect, 0, 1) self.layout...
A dialog box to get the information required by the newRowsOnSeparator function.
NewRowsOnSeparatorDialogBox
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NewRowsOnSeparatorDialogBox: """A dialog box to get the information required by the newRowsOnSeparator function.""" def __init__(self, pandaTable, parent): """Initializes the UI and sets the two dropdowns to display column names of the active Panda.""" <|body_0|> def get...
stack_v2_sparse_classes_10k_train_000646
29,548
no_license
[ { "docstring": "Initializes the UI and sets the two dropdowns to display column names of the active Panda.", "name": "__init__", "signature": "def __init__(self, pandaTable, parent)" }, { "docstring": "Returns the user's input", "name": "getResults", "signature": "def getResults(self, pa...
2
stack_v2_sparse_classes_30k_train_001999
Implement the Python class `NewRowsOnSeparatorDialogBox` described below. Class description: A dialog box to get the information required by the newRowsOnSeparator function. Method signatures and docstrings: - def __init__(self, pandaTable, parent): Initializes the UI and sets the two dropdowns to display column name...
Implement the Python class `NewRowsOnSeparatorDialogBox` described below. Class description: A dialog box to get the information required by the newRowsOnSeparator function. Method signatures and docstrings: - def __init__(self, pandaTable, parent): Initializes the UI and sets the two dropdowns to display column name...
1a3c5ad967472faf66236a311cc07a5128f5f911
<|skeleton|> class NewRowsOnSeparatorDialogBox: """A dialog box to get the information required by the newRowsOnSeparator function.""" def __init__(self, pandaTable, parent): """Initializes the UI and sets the two dropdowns to display column names of the active Panda.""" <|body_0|> def get...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NewRowsOnSeparatorDialogBox: """A dialog box to get the information required by the newRowsOnSeparator function.""" def __init__(self, pandaTable, parent): """Initializes the UI and sets the two dropdowns to display column names of the active Panda.""" QtWidgets.QDialog.__init__(self) ...
the_stack_v2_python_sparse
datatool/gui/Model.py
scottawalton/datatool
train
0
4982f4aff17a94f65f753fb1ec1b6a2656bd97ea
[ "message = (tag, ':', text_string)\nif global_step is not None:\n message = ('Global step', global_step, ',') + message\nprint(*message)\nreturn super().add_text(tag, text_string, global_step, walltime)", "message = (tag, ':', scalar_value)\nif global_step:\n message = ('Global step', global_step, ',') + me...
<|body_start_0|> message = (tag, ':', text_string) if global_step is not None: message = ('Global step', global_step, ',') + message print(*message) return super().add_text(tag, text_string, global_step, walltime) <|end_body_0|> <|body_start_1|> message = (tag, ':', ...
SummaryWriter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SummaryWriter: def add_text(self, tag, text_string, global_step=None, walltime=None): """Prints to console before running tensorboardX.SummaryWriter.add_text()""" <|body_0|> def add_scalar(self, tag, scalar_value, global_step=None, walltime=None): """Prints to consol...
stack_v2_sparse_classes_10k_train_000647
5,926
no_license
[ { "docstring": "Prints to console before running tensorboardX.SummaryWriter.add_text()", "name": "add_text", "signature": "def add_text(self, tag, text_string, global_step=None, walltime=None)" }, { "docstring": "Prints to console before running tensorboardX.SummaryWriter.add_scalar()", "nam...
2
stack_v2_sparse_classes_30k_train_004527
Implement the Python class `SummaryWriter` described below. Class description: Implement the SummaryWriter class. Method signatures and docstrings: - def add_text(self, tag, text_string, global_step=None, walltime=None): Prints to console before running tensorboardX.SummaryWriter.add_text() - def add_scalar(self, tag...
Implement the Python class `SummaryWriter` described below. Class description: Implement the SummaryWriter class. Method signatures and docstrings: - def add_text(self, tag, text_string, global_step=None, walltime=None): Prints to console before running tensorboardX.SummaryWriter.add_text() - def add_scalar(self, tag...
e0f6183e6b669c078793b326839665f69b3f324e
<|skeleton|> class SummaryWriter: def add_text(self, tag, text_string, global_step=None, walltime=None): """Prints to console before running tensorboardX.SummaryWriter.add_text()""" <|body_0|> def add_scalar(self, tag, scalar_value, global_step=None, walltime=None): """Prints to consol...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SummaryWriter: def add_text(self, tag, text_string, global_step=None, walltime=None): """Prints to console before running tensorboardX.SummaryWriter.add_text()""" message = (tag, ':', text_string) if global_step is not None: message = ('Global step', global_step, ',') + mes...
the_stack_v2_python_sparse
experiments/base.py
ctrl-q/pass-the-torch
train
0
bb170026178c714934d782b7989b93ed3159126d
[ "min_height = float('inf')\nupdated = False\n\ndef traverse(n, height=0):\n nonlocal min_height, updated\n if n == None:\n if height < min_height:\n if updated:\n return False\n else:\n if min_height < float('inf'):\n updated = True...
<|body_start_0|> min_height = float('inf') updated = False def traverse(n, height=0): nonlocal min_height, updated if n == None: if height < min_height: if updated: return False else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isCompleteTree(self, root: TreeNode) -> bool: """May 30, 2020 18:23""" <|body_0|> def isCompleteTree(self, root: Optional[TreeNode]) -> bool: """Apr 23, 2023 17:45""" <|body_1|> <|end_skeleton|> <|body_start_0|> min_height = float('inf...
stack_v2_sparse_classes_10k_train_000648
3,289
no_license
[ { "docstring": "May 30, 2020 18:23", "name": "isCompleteTree", "signature": "def isCompleteTree(self, root: TreeNode) -> bool" }, { "docstring": "Apr 23, 2023 17:45", "name": "isCompleteTree", "signature": "def isCompleteTree(self, root: Optional[TreeNode]) -> bool" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isCompleteTree(self, root: TreeNode) -> bool: May 30, 2020 18:23 - def isCompleteTree(self, root: Optional[TreeNode]) -> bool: Apr 23, 2023 17:45
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isCompleteTree(self, root: TreeNode) -> bool: May 30, 2020 18:23 - def isCompleteTree(self, root: Optional[TreeNode]) -> bool: Apr 23, 2023 17:45 <|skeleton|> class Solution...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def isCompleteTree(self, root: TreeNode) -> bool: """May 30, 2020 18:23""" <|body_0|> def isCompleteTree(self, root: Optional[TreeNode]) -> bool: """Apr 23, 2023 17:45""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def isCompleteTree(self, root: TreeNode) -> bool: """May 30, 2020 18:23""" min_height = float('inf') updated = False def traverse(n, height=0): nonlocal min_height, updated if n == None: if height < min_height: ...
the_stack_v2_python_sparse
leetcode/solved/998_Check_Completeness_of_a_Binary_Tree/solution.py
sungminoh/algorithms
train
0
8ec6597d5796ab7a2256d297d46718de9915f5ba
[ "self._linode = li\nself._node_id = node_id\nself._attr_extra_state_attributes = {}\nself._attr_name = None", "data = None\nself._linode.update()\nif self._linode.data is not None:\n for node in self._linode.data:\n if node.id == self._node_id:\n data = node\nif data is not None:\n self._a...
<|body_start_0|> self._linode = li self._node_id = node_id self._attr_extra_state_attributes = {} self._attr_name = None <|end_body_0|> <|body_start_1|> data = None self._linode.update() if self._linode.data is not None: for node in self._linode.data:...
Representation of a Linode droplet sensor.
LinodeBinarySensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinodeBinarySensor: """Representation of a Linode droplet sensor.""" def __init__(self, li, node_id): """Initialize a new Linode sensor.""" <|body_0|> def update(self) -> None: """Update state of sensor.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_000649
2,638
permissive
[ { "docstring": "Initialize a new Linode sensor.", "name": "__init__", "signature": "def __init__(self, li, node_id)" }, { "docstring": "Update state of sensor.", "name": "update", "signature": "def update(self) -> None" } ]
2
null
Implement the Python class `LinodeBinarySensor` described below. Class description: Representation of a Linode droplet sensor. Method signatures and docstrings: - def __init__(self, li, node_id): Initialize a new Linode sensor. - def update(self) -> None: Update state of sensor.
Implement the Python class `LinodeBinarySensor` described below. Class description: Representation of a Linode droplet sensor. Method signatures and docstrings: - def __init__(self, li, node_id): Initialize a new Linode sensor. - def update(self) -> None: Update state of sensor. <|skeleton|> class LinodeBinarySensor...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class LinodeBinarySensor: """Representation of a Linode droplet sensor.""" def __init__(self, li, node_id): """Initialize a new Linode sensor.""" <|body_0|> def update(self) -> None: """Update state of sensor.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LinodeBinarySensor: """Representation of a Linode droplet sensor.""" def __init__(self, li, node_id): """Initialize a new Linode sensor.""" self._linode = li self._node_id = node_id self._attr_extra_state_attributes = {} self._attr_name = None def update(self)...
the_stack_v2_python_sparse
homeassistant/components/linode/binary_sensor.py
home-assistant/core
train
35,501
c68e0d1d68fe9ae72cc4539b93bb6b6d35ac49e1
[ "self.cluster_partition_id = cluster_partition_id\nself.job_id = job_id\nself.job_name = job_name\nself.job_uid = job_uid\nself.object_name = object_name\nself.os_type = os_type\nself.registered_source = registered_source\nself.snapshotted_source = snapshotted_source\nself.versions = versions\nself.view_box_id = vi...
<|body_start_0|> self.cluster_partition_id = cluster_partition_id self.job_id = job_id self.job_name = job_name self.job_uid = job_uid self.object_name = object_name self.os_type = os_type self.registered_source = registered_source self.snapshotted_source ...
Implementation of the 'ObjectSnapshotInfo' model. Specifies information about an object that has been backed up. Attributes: cluster_partition_id (long|int): Specifies the Cohesity Cluster partition id where this object is stored. job_id (long|int): Specifies the id for the Protection Job that is currently associated w...
ObjectSnapshotInfo
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObjectSnapshotInfo: """Implementation of the 'ObjectSnapshotInfo' model. Specifies information about an object that has been backed up. Attributes: cluster_partition_id (long|int): Specifies the Cohesity Cluster partition id where this object is stored. job_id (long|int): Specifies the id for the...
stack_v2_sparse_classes_10k_train_000650
6,352
permissive
[ { "docstring": "Constructor for the ObjectSnapshotInfo class", "name": "__init__", "signature": "def __init__(self, cluster_partition_id=None, job_id=None, job_name=None, job_uid=None, object_name=None, os_type=None, registered_source=None, snapshotted_source=None, versions=None, view_box_id=None, view_...
2
null
Implement the Python class `ObjectSnapshotInfo` described below. Class description: Implementation of the 'ObjectSnapshotInfo' model. Specifies information about an object that has been backed up. Attributes: cluster_partition_id (long|int): Specifies the Cohesity Cluster partition id where this object is stored. job_...
Implement the Python class `ObjectSnapshotInfo` described below. Class description: Implementation of the 'ObjectSnapshotInfo' model. Specifies information about an object that has been backed up. Attributes: cluster_partition_id (long|int): Specifies the Cohesity Cluster partition id where this object is stored. job_...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class ObjectSnapshotInfo: """Implementation of the 'ObjectSnapshotInfo' model. Specifies information about an object that has been backed up. Attributes: cluster_partition_id (long|int): Specifies the Cohesity Cluster partition id where this object is stored. job_id (long|int): Specifies the id for the...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ObjectSnapshotInfo: """Implementation of the 'ObjectSnapshotInfo' model. Specifies information about an object that has been backed up. Attributes: cluster_partition_id (long|int): Specifies the Cohesity Cluster partition id where this object is stored. job_id (long|int): Specifies the id for the Protection J...
the_stack_v2_python_sparse
cohesity_management_sdk/models/object_snapshot_info.py
cohesity/management-sdk-python
train
24
e21a20afbea56534d5163025dc7f9af39c5520cd
[ "super().__init__()\naction_latent_features = 128\nif action_converter.is_singular_discrete:\n self.action_encoder = nn.Embedding(action_converter.shape[0], action_latent_features)\nelse:\n self.action_encoder = nn.Linear(action_converter.shape[0], action_latent_features)\nself.hidden = nn.Sequential(nn.Linea...
<|body_start_0|> super().__init__() action_latent_features = 128 if action_converter.is_singular_discrete: self.action_encoder = nn.Embedding(action_converter.shape[0], action_latent_features) else: self.action_encoder = nn.Linear(action_converter.shape[0], action...
ForwardModel
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ForwardModel: def __init__(self, action_converter: ActionSpace, state_latent_features: int): """:param action_converter: :param state_latent_features:""" <|body_0|> def forward(self, state_latent: torch.Tensor, action: torch.Tensor) -> torch.Tensor: """:param state_l...
stack_v2_sparse_classes_10k_train_000651
8,668
permissive
[ { "docstring": ":param action_converter: :param state_latent_features:", "name": "__init__", "signature": "def __init__(self, action_converter: ActionSpace, state_latent_features: int)" }, { "docstring": ":param state_latent: :param action: :return:", "name": "forward", "signature": "def...
2
stack_v2_sparse_classes_30k_train_004056
Implement the Python class `ForwardModel` described below. Class description: Implement the ForwardModel class. Method signatures and docstrings: - def __init__(self, action_converter: ActionSpace, state_latent_features: int): :param action_converter: :param state_latent_features: - def forward(self, state_latent: to...
Implement the Python class `ForwardModel` described below. Class description: Implement the ForwardModel class. Method signatures and docstrings: - def __init__(self, action_converter: ActionSpace, state_latent_features: int): :param action_converter: :param state_latent_features: - def forward(self, state_latent: to...
21e3564696062b67151b013fd5e47df46cf44aa5
<|skeleton|> class ForwardModel: def __init__(self, action_converter: ActionSpace, state_latent_features: int): """:param action_converter: :param state_latent_features:""" <|body_0|> def forward(self, state_latent: torch.Tensor, action: torch.Tensor) -> torch.Tensor: """:param state_l...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ForwardModel: def __init__(self, action_converter: ActionSpace, state_latent_features: int): """:param action_converter: :param state_latent_features:""" super().__init__() action_latent_features = 128 if action_converter.is_singular_discrete: self.action_encoder = ...
the_stack_v2_python_sparse
neodroidagent/utilities/exploration/intrinsic_signals/torch_isp/curiosity/icm.py
sintefneodroid/agent
train
9
28b2d67b6584d79dcc907f6282c07027b59eac75
[ "with tf.Graph().as_default():\n lp_dict = layer_collection.LayerParametersDict()\n x = tf.constant(0)\n y0 = tf.constant(0)\n y1 = tf.constant(0)\n z0 = tf.constant(0)\n z1 = tf.constant(0)\n keys = [x, (y0, y1), [z0, z1]]\n for key in keys:\n lp_dict[key] = key\n for key in keys:...
<|body_start_0|> with tf.Graph().as_default(): lp_dict = layer_collection.LayerParametersDict() x = tf.constant(0) y0 = tf.constant(0) y1 = tf.constant(0) z0 = tf.constant(0) z1 = tf.constant(0) keys = [x, (y0, y1), [z0, z1]] ...
LayerParametersDictTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LayerParametersDictTest: def testSetItem(self): """Ensure insertion, contains, retrieval works for supported key types.""" <|body_0|> def testSetItemOverlap(self): """Ensure insertion fails if key overlaps with existing key.""" <|body_1|> <|end_skeleton|> <...
stack_v2_sparse_classes_10k_train_000652
22,448
permissive
[ { "docstring": "Ensure insertion, contains, retrieval works for supported key types.", "name": "testSetItem", "signature": "def testSetItem(self)" }, { "docstring": "Ensure insertion fails if key overlaps with existing key.", "name": "testSetItemOverlap", "signature": "def testSetItemOve...
2
stack_v2_sparse_classes_30k_train_006355
Implement the Python class `LayerParametersDictTest` described below. Class description: Implement the LayerParametersDictTest class. Method signatures and docstrings: - def testSetItem(self): Ensure insertion, contains, retrieval works for supported key types. - def testSetItemOverlap(self): Ensure insertion fails i...
Implement the Python class `LayerParametersDictTest` described below. Class description: Implement the LayerParametersDictTest class. Method signatures and docstrings: - def testSetItem(self): Ensure insertion, contains, retrieval works for supported key types. - def testSetItemOverlap(self): Ensure insertion fails i...
ddad6375bbdebfae809bccfd3a5c3db073128764
<|skeleton|> class LayerParametersDictTest: def testSetItem(self): """Ensure insertion, contains, retrieval works for supported key types.""" <|body_0|> def testSetItemOverlap(self): """Ensure insertion fails if key overlaps with existing key.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LayerParametersDictTest: def testSetItem(self): """Ensure insertion, contains, retrieval works for supported key types.""" with tf.Graph().as_default(): lp_dict = layer_collection.LayerParametersDict() x = tf.constant(0) y0 = tf.constant(0) y1 = ...
the_stack_v2_python_sparse
kfac/python/kernel_tests/layer_collection_test.py
tensorflow/kfac
train
193
02210bcca96804748a836b6cc4f8043162ef4535
[ "try:\n db_creds = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../config/db_creds.json')\n user_creds = json.load(open(db_creds, 'r'))['elastic'][access]\n hosts = user_creds['hosts']\n http_auth = (user_creds['user'], user_creds['pass'])\nexcept:\n env_vars = ['ELASTIC_HOST', 'ELASTIC_...
<|body_start_0|> try: db_creds = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../config/db_creds.json') user_creds = json.load(open(db_creds, 'r'))['elastic'][access] hosts = user_creds['hosts'] http_auth = (user_creds['user'], user_creds['pass']) ...
Class representing a connection to the Elastic Cloud cluster (ElasticSearch)
ElasticConnection
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ElasticConnection: """Class representing a connection to the Elastic Cloud cluster (ElasticSearch)""" def __init__(self, local=local, access='read_only'): """Args: local (bool): True to use local config file, False for environment variables. Default: False access (str): Level of acce...
stack_v2_sparse_classes_10k_train_000653
6,259
no_license
[ { "docstring": "Args: local (bool): True to use local config file, False for environment variables. Default: False access (str): Level of access. e.g. \"admin\", \"read_only\", or \"annotator\" db (str): Desired database. e.g. \"test\" or \"production\" Returns: pymongo Client.", "name": "__init__", "si...
2
stack_v2_sparse_classes_30k_train_005297
Implement the Python class `ElasticConnection` described below. Class description: Class representing a connection to the Elastic Cloud cluster (ElasticSearch) Method signatures and docstrings: - def __init__(self, local=local, access='read_only'): Args: local (bool): True to use local config file, False for environm...
Implement the Python class `ElasticConnection` described below. Class description: Class representing a connection to the Elastic Cloud cluster (ElasticSearch) Method signatures and docstrings: - def __init__(self, local=local, access='read_only'): Args: local (bool): True to use local config file, False for environm...
b10cd933cbfaa969e00f68ad7a895be447472163
<|skeleton|> class ElasticConnection: """Class representing a connection to the Elastic Cloud cluster (ElasticSearch)""" def __init__(self, local=local, access='read_only'): """Args: local (bool): True to use local config file, False for environment variables. Default: False access (str): Level of acce...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ElasticConnection: """Class representing a connection to the Elastic Cloud cluster (ElasticSearch)""" def __init__(self, local=local, access='read_only'): """Args: local (bool): True to use local config file, False for environment variables. Default: False access (str): Level of access. e.g. "adm...
the_stack_v2_python_sparse
matstract/models/database.py
abhinavwidak/matstract
train
0
197829184cb24021170fa3b05836ea0ef845c0dc
[ "self.type = type\nself.name = name\nself.width = width\nself.cls = cls", "assert elem.tag in ['input', 'output', 'clock'], elem.tag\nport = Port(type=PortType.from_string(elem.tag), name=elem.attrib['name'], width=int(elem.get('num_pins', '1')), cls=elem.get('port_class', None))\nreturn port", "if range_spec i...
<|body_start_0|> self.type = type self.name = name self.width = width self.cls = cls <|end_body_0|> <|body_start_1|> assert elem.tag in ['input', 'output', 'clock'], elem.tag port = Port(type=PortType.from_string(elem.tag), name=elem.attrib['name'], width=int(elem.get('n...
A port of pb_type
Port
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Port: """A port of pb_type""" def __init__(self, type, name, width=1, cls=None): """Basic constructor""" <|body_0|> def from_etree(elem): """Create the object from its ElementTree representation""" <|body_1|> def yield_pins(self, range_spec=None): ...
stack_v2_sparse_classes_10k_train_000654
11,880
permissive
[ { "docstring": "Basic constructor", "name": "__init__", "signature": "def __init__(self, type, name, width=1, cls=None)" }, { "docstring": "Create the object from its ElementTree representation", "name": "from_etree", "signature": "def from_etree(elem)" }, { "docstring": "Yields ...
3
stack_v2_sparse_classes_30k_train_006160
Implement the Python class `Port` described below. Class description: A port of pb_type Method signatures and docstrings: - def __init__(self, type, name, width=1, cls=None): Basic constructor - def from_etree(elem): Create the object from its ElementTree representation - def yield_pins(self, range_spec=None): Yields...
Implement the Python class `Port` described below. Class description: A port of pb_type Method signatures and docstrings: - def __init__(self, type, name, width=1, cls=None): Basic constructor - def from_etree(elem): Create the object from its ElementTree representation - def yield_pins(self, range_spec=None): Yields...
835a40534f9efd70770d74f56f25fef6cfc6ebc6
<|skeleton|> class Port: """A port of pb_type""" def __init__(self, type, name, width=1, cls=None): """Basic constructor""" <|body_0|> def from_etree(elem): """Create the object from its ElementTree representation""" <|body_1|> def yield_pins(self, range_spec=None): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Port: """A port of pb_type""" def __init__(self, type, name, width=1, cls=None): """Basic constructor""" self.type = type self.name = name self.width = width self.cls = cls def from_etree(elem): """Create the object from its ElementTree representation"...
the_stack_v2_python_sparse
f4pga/utils/quicklogic/repacker/pb_type.py
f4pga/f4pga
train
19
b9cd4e1ab9cb30bf63b8487027b548f0388e16b0
[ "super().__init__()\nself.norm = nn.LayerNorm(query_dim)\nself.att = SelfAttention(name=name, how=how, query_dim=query_dim, cross_attention_dim=cross_attention_dim, head_dim=head_dim, num_heads=num_heads, dropout=dropout, bias=bias, slice_size=slice_size, **kwargs)", "residual = x\nx = self.norm(x)\nx = self.att(...
<|body_start_0|> super().__init__() self.norm = nn.LayerNorm(query_dim) self.att = SelfAttention(name=name, how=how, query_dim=query_dim, cross_attention_dim=cross_attention_dim, head_dim=head_dim, num_heads=num_heads, dropout=dropout, bias=bias, slice_size=slice_size, **kwargs) <|end_body_0|> ...
SelfAttentionBlock
[ "MIT", "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SelfAttentionBlock: def __init__(self, how: str, query_dim: int, name: str='exact', cross_attention_dim: int=None, num_heads: int=8, head_dim: int=64, dropout: float=0.0, bias: bool=False, slice_size: int=4, **kwargs) -> None: """Singular self-attention block. These can be stacked to for...
stack_v2_sparse_classes_10k_train_000655
10,093
permissive
[ { "docstring": "Singular self-attention block. These can be stacked to form a tranformer block. NOTE: Can be used as a cross-attention block if `cross_attention_dim` is given. Input Shape: (B, H'*W', query_dim). Output Shape: (B, H'*W', query_dim). Parameters ---------- name : str Name of the attention method. ...
2
stack_v2_sparse_classes_30k_train_002195
Implement the Python class `SelfAttentionBlock` described below. Class description: Implement the SelfAttentionBlock class. Method signatures and docstrings: - def __init__(self, how: str, query_dim: int, name: str='exact', cross_attention_dim: int=None, num_heads: int=8, head_dim: int=64, dropout: float=0.0, bias: b...
Implement the Python class `SelfAttentionBlock` described below. Class description: Implement the SelfAttentionBlock class. Method signatures and docstrings: - def __init__(self, how: str, query_dim: int, name: str='exact', cross_attention_dim: int=None, num_heads: int=8, head_dim: int=64, dropout: float=0.0, bias: b...
7f79405012eb934b419bbdba8de23f35e840ca85
<|skeleton|> class SelfAttentionBlock: def __init__(self, how: str, query_dim: int, name: str='exact', cross_attention_dim: int=None, num_heads: int=8, head_dim: int=64, dropout: float=0.0, bias: bool=False, slice_size: int=4, **kwargs) -> None: """Singular self-attention block. These can be stacked to for...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SelfAttentionBlock: def __init__(self, how: str, query_dim: int, name: str='exact', cross_attention_dim: int=None, num_heads: int=8, head_dim: int=64, dropout: float=0.0, bias: bool=False, slice_size: int=4, **kwargs) -> None: """Singular self-attention block. These can be stacked to form a tranformer...
the_stack_v2_python_sparse
cellseg_models_pytorch/modules/self_attention_modules.py
okunator/cellseg_models.pytorch
train
43
7fbc240e809f275c94cd1eae474ee11c6d760030
[ "@skip(False)\ndef func(data):\n \"\"\"dummy the func method\"\"\"\n return data\nself.assert_(func('test') == 'test')", "@skip(True)\ndef func(data):\n \"\"\"dummy the func method\"\"\"\n return data\nself.assert_(func('test') == None)", "@skip(True, 'stub')\ndef func(data):\n \"\"\"dummy the fu...
<|body_start_0|> @skip(False) def func(data): """dummy the func method""" return data self.assert_(func('test') == 'test') <|end_body_0|> <|body_start_1|> @skip(True) def func(data): """dummy the func method""" return data ...
Acceptance tests for unittestadditions.py
TestSkipDecorator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSkipDecorator: """Acceptance tests for unittestadditions.py""" def test_skip_false(self): """A skip(False) decorated function is executed properly""" <|body_0|> def test_skip_true(self): """A skip(True) decorated function is executed properly""" <|bod...
stack_v2_sparse_classes_10k_train_000656
1,723
no_license
[ { "docstring": "A skip(False) decorated function is executed properly", "name": "test_skip_false", "signature": "def test_skip_false(self)" }, { "docstring": "A skip(True) decorated function is executed properly", "name": "test_skip_true", "signature": "def test_skip_true(self)" }, {...
3
stack_v2_sparse_classes_30k_test_000024
Implement the Python class `TestSkipDecorator` described below. Class description: Acceptance tests for unittestadditions.py Method signatures and docstrings: - def test_skip_false(self): A skip(False) decorated function is executed properly - def test_skip_true(self): A skip(True) decorated function is executed prop...
Implement the Python class `TestSkipDecorator` described below. Class description: Acceptance tests for unittestadditions.py Method signatures and docstrings: - def test_skip_false(self): A skip(False) decorated function is executed properly - def test_skip_true(self): A skip(True) decorated function is executed prop...
f458a4ce83f74d603362fe6b71eaa647ccc62fee
<|skeleton|> class TestSkipDecorator: """Acceptance tests for unittestadditions.py""" def test_skip_false(self): """A skip(False) decorated function is executed properly""" <|body_0|> def test_skip_true(self): """A skip(True) decorated function is executed properly""" <|bod...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestSkipDecorator: """Acceptance tests for unittestadditions.py""" def test_skip_false(self): """A skip(False) decorated function is executed properly""" @skip(False) def func(data): """dummy the func method""" return data self.assert_(func('test') ...
the_stack_v2_python_sparse
buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_unittestadditions.py
anagovitsyn/oss.FCL.sftools.dev.build
train
0
46e1b6040e5c41d9cd5760ec9902fce4a5acda80
[ "self.client = aff4.FACTORY.Open(self.client_id, token=self.token)\nself.system = str(self.client.Get(self.client.Schema.SYSTEM))\nself.os_version = str(self.client.Get(self.client.Schema.OS_VERSION))\nself.os_major_version = self.os_version.split('.')[0]\nif self.use_tsk:\n self.path_type = rdfvalue.PathSpec.Pa...
<|body_start_0|> self.client = aff4.FACTORY.Open(self.client_id, token=self.token) self.system = str(self.client.Get(self.client.Schema.SYSTEM)) self.os_version = str(self.client.Get(self.client.Schema.OS_VERSION)) self.os_major_version = self.os_version.split('.')[0] if self.use...
Do the initial work for a system investigation. This encapsulates the different platform specific modules.
WinSystemActivityInvestigation
[ "Apache-2.0", "DOC" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WinSystemActivityInvestigation: """Do the initial work for a system investigation. This encapsulates the different platform specific modules.""" def Start(self): """Start.""" <|body_0|> def FinishFlow(self, responses): """Complete anything we need to do for each ...
stack_v2_sparse_classes_10k_train_000657
10,734
permissive
[ { "docstring": "Start.", "name": "Start", "signature": "def Start(self)" }, { "docstring": "Complete anything we need to do for each flow finishing.", "name": "FinishFlow", "signature": "def FinishFlow(self, responses)" } ]
2
stack_v2_sparse_classes_30k_test_000274
Implement the Python class `WinSystemActivityInvestigation` described below. Class description: Do the initial work for a system investigation. This encapsulates the different platform specific modules. Method signatures and docstrings: - def Start(self): Start. - def FinishFlow(self, responses): Complete anything we...
Implement the Python class `WinSystemActivityInvestigation` described below. Class description: Do the initial work for a system investigation. This encapsulates the different platform specific modules. Method signatures and docstrings: - def Start(self): Start. - def FinishFlow(self, responses): Complete anything we...
ba1648b97a76f844ffb8e1891cc9e2680f9b1c6e
<|skeleton|> class WinSystemActivityInvestigation: """Do the initial work for a system investigation. This encapsulates the different platform specific modules.""" def Start(self): """Start.""" <|body_0|> def FinishFlow(self, responses): """Complete anything we need to do for each ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WinSystemActivityInvestigation: """Do the initial work for a system investigation. This encapsulates the different platform specific modules.""" def Start(self): """Start.""" self.client = aff4.FACTORY.Open(self.client_id, token=self.token) self.system = str(self.client.Get(self.c...
the_stack_v2_python_sparse
lib/flows/general/automation.py
defaultnamehere/grr
train
3
1a75e952d9d3e270051b2c7f7aae701f30d74a93
[ "self.base_filters = filters or []\nself.polling_interval = polling_interval\nself.continue_interval = continue_interval or polling_interval\nself.should_continue = continue_func\nstart_timestamp = _GetTailStartingTimestamp(filters, num_prev_entries)\nlog.debug('start timestamp: {}'.format(start_timestamp))\nself.l...
<|body_start_0|> self.base_filters = filters or [] self.polling_interval = polling_interval self.continue_interval = continue_interval or polling_interval self.should_continue = continue_func start_timestamp = _GetTailStartingTimestamp(filters, num_prev_entries) log.debug...
A class which fetches job logs.
LogFetcher
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LogFetcher: """A class which fetches job logs.""" def __init__(self, filters=None, polling_interval=10, continue_func=lambda x: True, continue_interval=None, num_prev_entries=None): """Initializes the LogFetcher. Args: filters: list of string filters used in the API call. polling_int...
stack_v2_sparse_classes_10k_train_000658
9,319
permissive
[ { "docstring": "Initializes the LogFetcher. Args: filters: list of string filters used in the API call. polling_interval: amount of time to sleep between each poll. continue_func: One-arg function that takes in the number of empty polls and outputs a boolean to decide if we should keep polling or not. If not gi...
3
stack_v2_sparse_classes_30k_train_003018
Implement the Python class `LogFetcher` described below. Class description: A class which fetches job logs. Method signatures and docstrings: - def __init__(self, filters=None, polling_interval=10, continue_func=lambda x: True, continue_interval=None, num_prev_entries=None): Initializes the LogFetcher. Args: filters:...
Implement the Python class `LogFetcher` described below. Class description: A class which fetches job logs. Method signatures and docstrings: - def __init__(self, filters=None, polling_interval=10, continue_func=lambda x: True, continue_interval=None, num_prev_entries=None): Initializes the LogFetcher. Args: filters:...
85bb264e273568b5a0408f733b403c56373e2508
<|skeleton|> class LogFetcher: """A class which fetches job logs.""" def __init__(self, filters=None, polling_interval=10, continue_func=lambda x: True, continue_interval=None, num_prev_entries=None): """Initializes the LogFetcher. Args: filters: list of string filters used in the API call. polling_int...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LogFetcher: """A class which fetches job logs.""" def __init__(self, filters=None, polling_interval=10, continue_func=lambda x: True, continue_interval=None, num_prev_entries=None): """Initializes the LogFetcher. Args: filters: list of string filters used in the API call. polling_interval: amount...
the_stack_v2_python_sparse
google-cloud-sdk/lib/googlecloudsdk/command_lib/logs/stream.py
bopopescu/socialliteapp
train
0
3792202cbca60b4a19deac319b8a16b7cba5d625
[ "group1_antall, group1_image = detectFace(group1)\ngroup1_expectedNumber = 7\nself.assertEqual(group1_antall, group1_expectedNumber)", "couple_antall, couple_image = detectFace(couple)\ncouple_expectedNumber = 2\nself.assertEqual(couple_antall, couple_expectedNumber)" ]
<|body_start_0|> group1_antall, group1_image = detectFace(group1) group1_expectedNumber = 7 self.assertEqual(group1_antall, group1_expectedNumber) <|end_body_0|> <|body_start_1|> couple_antall, couple_image = detectFace(couple) couple_expectedNumber = 2 self.assertEqual(...
Tests for the anonymise module
test_Anon
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class test_Anon: """Tests for the anonymise module""" def test_faceDetect_Group1(self): """Test for face detection of image (group1.jpg)""" <|body_0|> def test_faceDetect_Couple(self): """Test for face detection of image (couple.jpg)""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_10k_train_000659
817
no_license
[ { "docstring": "Test for face detection of image (group1.jpg)", "name": "test_faceDetect_Group1", "signature": "def test_faceDetect_Group1(self)" }, { "docstring": "Test for face detection of image (couple.jpg)", "name": "test_faceDetect_Couple", "signature": "def test_faceDetect_Couple(...
2
stack_v2_sparse_classes_30k_train_000170
Implement the Python class `test_Anon` described below. Class description: Tests for the anonymise module Method signatures and docstrings: - def test_faceDetect_Group1(self): Test for face detection of image (group1.jpg) - def test_faceDetect_Couple(self): Test for face detection of image (couple.jpg)
Implement the Python class `test_Anon` described below. Class description: Tests for the anonymise module Method signatures and docstrings: - def test_faceDetect_Group1(self): Test for face detection of image (group1.jpg) - def test_faceDetect_Couple(self): Test for face detection of image (couple.jpg) <|skeleton|> ...
dd40d095231ed397cf69e3598f21483a3bcf11a6
<|skeleton|> class test_Anon: """Tests for the anonymise module""" def test_faceDetect_Group1(self): """Test for face detection of image (group1.jpg)""" <|body_0|> def test_faceDetect_Couple(self): """Test for face detection of image (couple.jpg)""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class test_Anon: """Tests for the anonymise module""" def test_faceDetect_Group1(self): """Test for face detection of image (group1.jpg)""" group1_antall, group1_image = detectFace(group1) group1_expectedNumber = 7 self.assertEqual(group1_antall, group1_expectedNumber) def ...
the_stack_v2_python_sparse
src/test_FaceDetect.py
jegerud/Sciprog2020project
train
0
143758b7a4c3091ebe280a532eb9e012acd08437
[ "super().__init__()\nself.extends: Sequence[Union[str, Dict[str, Any]]] = ''\nself.css: Optional[Union[Dict[str, Any], Combine]] = None", "new_obj = self.__class__(self)\nnew_obj.extends = extends\nnew_obj.css = css\nreturn new_obj" ]
<|body_start_0|> super().__init__() self.extends: Sequence[Union[str, Dict[str, Any]]] = '' self.css: Optional[Union[Dict[str, Any], Combine]] = None <|end_body_0|> <|body_start_1|> new_obj = self.__class__(self) new_obj.extends = extends new_obj.css = css return...
``Var`` that, when called, allows to extend a previously defined css dict. Attributes ---------- extends : Sequence[Union[str, Dict[str, Any]]] The list of css we extend. An extend can be the name of a previously defined "extend" (key starting with `%`) in the same css dict (same level or above), or directly a dict. Se...
Extend
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Extend: """``Var`` that, when called, allows to extend a previously defined css dict. Attributes ---------- extends : Sequence[Union[str, Dict[str, Any]]] The list of css we extend. An extend can be the name of a previously defined "extend" (key starting with `%`) in the same css dict (same level...
stack_v2_sparse_classes_10k_train_000660
44,402
permissive
[ { "docstring": "Init the var and its attributes. For the parameters, see ``str``.", "name": "__init__", "signature": "def __init__(self, _str_: str) -> None" }, { "docstring": "Allow to have a css key defined multiple times. Parameters ---------- extends : Tuple[Union[str, Dict[str, Any]]] The l...
2
stack_v2_sparse_classes_30k_test_000145
Implement the Python class `Extend` described below. Class description: ``Var`` that, when called, allows to extend a previously defined css dict. Attributes ---------- extends : Sequence[Union[str, Dict[str, Any]]] The list of css we extend. An extend can be the name of a previously defined "extend" (key starting wit...
Implement the Python class `Extend` described below. Class description: ``Var`` that, when called, allows to extend a previously defined css dict. Attributes ---------- extends : Sequence[Union[str, Dict[str, Any]]] The list of css we extend. An extend can be the name of a previously defined "extend" (key starting wit...
adeff652784f0d814835fd16a8cacab09f426922
<|skeleton|> class Extend: """``Var`` that, when called, allows to extend a previously defined css dict. Attributes ---------- extends : Sequence[Union[str, Dict[str, Any]]] The list of css we extend. An extend can be the name of a previously defined "extend" (key starting with `%`) in the same css dict (same level...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Extend: """``Var`` that, when called, allows to extend a previously defined css dict. Attributes ---------- extends : Sequence[Union[str, Dict[str, Any]]] The list of css we extend. An extend can be the name of a previously defined "extend" (key starting with `%`) in the same css dict (same level or above), o...
the_stack_v2_python_sparse
src/mixt/contrib/css/vars.py
twidi/mixt
train
37
dc53df9448c0be28b7793616e9afa47ca9da9db9
[ "self.chassis_serial = chassis_serial\nself.connected_to = connected_to\nself.hostname = hostname\nself.id = id\nself.ip = ip\nself.ipmi_ip = ipmi_ip\nself.ips = ips\nself.node_serial = node_serial\nself.node_ui_slot = node_ui_slot\nself.num_slots_in_chassis = num_slots_in_chassis\nself.product_model = product_mode...
<|body_start_0|> self.chassis_serial = chassis_serial self.connected_to = connected_to self.hostname = hostname self.id = id self.ip = ip self.ipmi_ip = ipmi_ip self.ips = ips self.node_serial = node_serial self.node_ui_slot = node_ui_slot ...
Implementation of the 'FreeNodeInformation' model. Specifies the Metadata of a free Node on the network. Attributes: chassis_serial (string): Specifies the serial number of the Chassis the Node is installed in. connected_to (bool): Specifies whether or not this is the Node that is sending the response. hostname (string...
FreeNodeInformation
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FreeNodeInformation: """Implementation of the 'FreeNodeInformation' model. Specifies the Metadata of a free Node on the network. Attributes: chassis_serial (string): Specifies the serial number of the Chassis the Node is installed in. connected_to (bool): Specifies whether or not this is the Node...
stack_v2_sparse_classes_10k_train_000661
4,722
permissive
[ { "docstring": "Constructor for the FreeNodeInformation class", "name": "__init__", "signature": "def __init__(self, chassis_serial=None, connected_to=None, hostname=None, id=None, ip=None, ipmi_ip=None, ips=None, node_serial=None, node_ui_slot=None, num_slots_in_chassis=None, product_model=None, slot_n...
2
null
Implement the Python class `FreeNodeInformation` described below. Class description: Implementation of the 'FreeNodeInformation' model. Specifies the Metadata of a free Node on the network. Attributes: chassis_serial (string): Specifies the serial number of the Chassis the Node is installed in. connected_to (bool): Sp...
Implement the Python class `FreeNodeInformation` described below. Class description: Implementation of the 'FreeNodeInformation' model. Specifies the Metadata of a free Node on the network. Attributes: chassis_serial (string): Specifies the serial number of the Chassis the Node is installed in. connected_to (bool): Sp...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class FreeNodeInformation: """Implementation of the 'FreeNodeInformation' model. Specifies the Metadata of a free Node on the network. Attributes: chassis_serial (string): Specifies the serial number of the Chassis the Node is installed in. connected_to (bool): Specifies whether or not this is the Node...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FreeNodeInformation: """Implementation of the 'FreeNodeInformation' model. Specifies the Metadata of a free Node on the network. Attributes: chassis_serial (string): Specifies the serial number of the Chassis the Node is installed in. connected_to (bool): Specifies whether or not this is the Node that is send...
the_stack_v2_python_sparse
cohesity_management_sdk/models/free_node_information.py
cohesity/management-sdk-python
train
24
9788f13284e58b468d12fd133c8028ffc2ca2dce
[ "tempdir = tempfile.mkdtemp()\nmodel_path = os.path.join(tempdir, cls.MODEL_FILENAME)\nstripped_state_dict = consume_prefix_in_state_dict_if_present_not_in_place(state_dict, 'module.')\ntorch.save(stripped_state_dict, model_path)\ncheckpoint = cls.from_directory(tempdir)\nif preprocessor:\n checkpoint.set_prepro...
<|body_start_0|> tempdir = tempfile.mkdtemp() model_path = os.path.join(tempdir, cls.MODEL_FILENAME) stripped_state_dict = consume_prefix_in_state_dict_if_present_not_in_place(state_dict, 'module.') torch.save(stripped_state_dict, model_path) checkpoint = cls.from_directory(tempd...
A :class:`~ray.train.Checkpoint` with Torch-specific functionality.
TorchCheckpoint
[ "MIT", "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TorchCheckpoint: """A :class:`~ray.train.Checkpoint` with Torch-specific functionality.""" def from_state_dict(cls, state_dict: Dict[str, Any], *, preprocessor: Optional['Preprocessor']=None) -> 'TorchCheckpoint': """Create a :class:`~ray.train.Checkpoint` that stores a model state d...
stack_v2_sparse_classes_10k_train_000662
15,178
permissive
[ { "docstring": "Create a :class:`~ray.train.Checkpoint` that stores a model state dictionary. .. tip:: This is the recommended method for creating :class:`TorchCheckpoints<TorchCheckpoint>`. Args: state_dict: The model state dictionary to store in the checkpoint. preprocessor: A fitted preprocessor to be applie...
3
stack_v2_sparse_classes_30k_train_003668
Implement the Python class `TorchCheckpoint` described below. Class description: A :class:`~ray.train.Checkpoint` with Torch-specific functionality. Method signatures and docstrings: - def from_state_dict(cls, state_dict: Dict[str, Any], *, preprocessor: Optional['Preprocessor']=None) -> 'TorchCheckpoint': Create a :...
Implement the Python class `TorchCheckpoint` described below. Class description: A :class:`~ray.train.Checkpoint` with Torch-specific functionality. Method signatures and docstrings: - def from_state_dict(cls, state_dict: Dict[str, Any], *, preprocessor: Optional['Preprocessor']=None) -> 'TorchCheckpoint': Create a :...
edba68c3e7cf255d1d6479329f305adb7fa4c3ed
<|skeleton|> class TorchCheckpoint: """A :class:`~ray.train.Checkpoint` with Torch-specific functionality.""" def from_state_dict(cls, state_dict: Dict[str, Any], *, preprocessor: Optional['Preprocessor']=None) -> 'TorchCheckpoint': """Create a :class:`~ray.train.Checkpoint` that stores a model state d...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TorchCheckpoint: """A :class:`~ray.train.Checkpoint` with Torch-specific functionality.""" def from_state_dict(cls, state_dict: Dict[str, Any], *, preprocessor: Optional['Preprocessor']=None) -> 'TorchCheckpoint': """Create a :class:`~ray.train.Checkpoint` that stores a model state dictionary. .....
the_stack_v2_python_sparse
python/ray/train/torch/torch_checkpoint.py
ray-project/ray
train
29,482
0eadfbfa1e83c474a949ac72b99f3851e324c0f4
[ "targets = (app_engine_http_target, http_target)\nif sum([1 if x is not None else 0 for x in targets]) > 1:\n raise CreatingHttpAndAppEngineQueueError('Attempting to send multiple queue target types simultaneously: {} , {}'.format(six.text_type(app_engine_http_target), six.text_type(http_target)))\ntargets = (pu...
<|body_start_0|> targets = (app_engine_http_target, http_target) if sum([1 if x is not None else 0 for x in targets]) > 1: raise CreatingHttpAndAppEngineQueueError('Attempting to send multiple queue target types simultaneously: {} , {}'.format(six.text_type(app_engine_http_target), six.text_...
Client for queues service in the Cloud Tasks API.
AlphaQueues
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlphaQueues: """Client for queues service in the Cloud Tasks API.""" def Create(self, parent_ref, queue_ref, retry_config=None, rate_limits=None, pull_target=None, app_engine_http_target=None, http_target=None): """Prepares and sends a Create request for creating a queue.""" ...
stack_v2_sparse_classes_10k_train_000663
19,528
permissive
[ { "docstring": "Prepares and sends a Create request for creating a queue.", "name": "Create", "signature": "def Create(self, parent_ref, queue_ref, retry_config=None, rate_limits=None, pull_target=None, app_engine_http_target=None, http_target=None)" }, { "docstring": "Prepares and sends a Patch...
2
null
Implement the Python class `AlphaQueues` described below. Class description: Client for queues service in the Cloud Tasks API. Method signatures and docstrings: - def Create(self, parent_ref, queue_ref, retry_config=None, rate_limits=None, pull_target=None, app_engine_http_target=None, http_target=None): Prepares and...
Implement the Python class `AlphaQueues` described below. Class description: Client for queues service in the Cloud Tasks API. Method signatures and docstrings: - def Create(self, parent_ref, queue_ref, retry_config=None, rate_limits=None, pull_target=None, app_engine_http_target=None, http_target=None): Prepares and...
392abf004b16203030e6efd2f0af24db7c8d669e
<|skeleton|> class AlphaQueues: """Client for queues service in the Cloud Tasks API.""" def Create(self, parent_ref, queue_ref, retry_config=None, rate_limits=None, pull_target=None, app_engine_http_target=None, http_target=None): """Prepares and sends a Create request for creating a queue.""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AlphaQueues: """Client for queues service in the Cloud Tasks API.""" def Create(self, parent_ref, queue_ref, retry_config=None, rate_limits=None, pull_target=None, app_engine_http_target=None, http_target=None): """Prepares and sends a Create request for creating a queue.""" targets = (ap...
the_stack_v2_python_sparse
lib/googlecloudsdk/api_lib/tasks/queues.py
google-cloud-sdk-unofficial/google-cloud-sdk
train
9
7659c8a25fb676ee8e232bb0543b536a311029b3
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Missing associated documentation comment in .proto file.
ModelRepositoryServiceServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModelRepositoryServiceServicer: """Missing associated documentation comment in .proto file.""" def RepositoryIndex(self, request, context): """Get the index of model repository contents.""" <|body_0|> def RepositoryModelLoad(self, request, context): """Load or re...
stack_v2_sparse_classes_10k_train_000664
6,338
permissive
[ { "docstring": "Get the index of model repository contents.", "name": "RepositoryIndex", "signature": "def RepositoryIndex(self, request, context)" }, { "docstring": "Load or reload a model from a repository.", "name": "RepositoryModelLoad", "signature": "def RepositoryModelLoad(self, re...
3
stack_v2_sparse_classes_30k_train_001322
Implement the Python class `ModelRepositoryServiceServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def RepositoryIndex(self, request, context): Get the index of model repository contents. - def RepositoryModelLoad(self, request,...
Implement the Python class `ModelRepositoryServiceServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def RepositoryIndex(self, request, context): Get the index of model repository contents. - def RepositoryModelLoad(self, request,...
07a36f2cacf4eea6ed3ac28436792f31adb04d01
<|skeleton|> class ModelRepositoryServiceServicer: """Missing associated documentation comment in .proto file.""" def RepositoryIndex(self, request, context): """Get the index of model repository contents.""" <|body_0|> def RepositoryModelLoad(self, request, context): """Load or re...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ModelRepositoryServiceServicer: """Missing associated documentation comment in .proto file.""" def RepositoryIndex(self, request, context): """Get the index of model repository contents.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented...
the_stack_v2_python_sparse
mlserver/grpc/model_repository_pb2_grpc.py
LiangTsao/MLServer
train
0
47a2344dde34deb1af4a49840057086e5567530e
[ "super().__init__()\nlogger.debug('Create PaddleVectorConnectionHandler to process the vector request')\nself.vector_engine = vector_engine\nself.executor = self.vector_engine.executor\nself.task = self.vector_engine.executor.task\nself.model = self.vector_engine.executor.model\nself.config = self.vector_engine.exe...
<|body_start_0|> super().__init__() logger.debug('Create PaddleVectorConnectionHandler to process the vector request') self.vector_engine = vector_engine self.executor = self.vector_engine.executor self.task = self.vector_engine.executor.task self.model = self.vector_engi...
PaddleVectorConnectionHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PaddleVectorConnectionHandler: def __init__(self, vector_engine): """The PaddleSpeech Vector Server Connection Handler This connection process every server request Args: vector_engine (VectorEngine): The Vector engine""" <|body_0|> def run(self, audio_data, task='spk'): ...
stack_v2_sparse_classes_10k_train_000665
7,306
permissive
[ { "docstring": "The PaddleSpeech Vector Server Connection Handler This connection process every server request Args: vector_engine (VectorEngine): The Vector engine", "name": "__init__", "signature": "def __init__(self, vector_engine)" }, { "docstring": "The connection process the http request a...
4
null
Implement the Python class `PaddleVectorConnectionHandler` described below. Class description: Implement the PaddleVectorConnectionHandler class. Method signatures and docstrings: - def __init__(self, vector_engine): The PaddleSpeech Vector Server Connection Handler This connection process every server request Args: ...
Implement the Python class `PaddleVectorConnectionHandler` described below. Class description: Implement the PaddleVectorConnectionHandler class. Method signatures and docstrings: - def __init__(self, vector_engine): The PaddleSpeech Vector Server Connection Handler This connection process every server request Args: ...
17854a04d43c231eff66bfed9d6aa55e94a29e79
<|skeleton|> class PaddleVectorConnectionHandler: def __init__(self, vector_engine): """The PaddleSpeech Vector Server Connection Handler This connection process every server request Args: vector_engine (VectorEngine): The Vector engine""" <|body_0|> def run(self, audio_data, task='spk'): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PaddleVectorConnectionHandler: def __init__(self, vector_engine): """The PaddleSpeech Vector Server Connection Handler This connection process every server request Args: vector_engine (VectorEngine): The Vector engine""" super().__init__() logger.debug('Create PaddleVectorConnectionHan...
the_stack_v2_python_sparse
paddlespeech/server/engine/vector/python/vector_engine.py
anniyanvr/DeepSpeech-1
train
0
62698644a9c83f32aa05e8b3c146af2b974449cb
[ "v_axis_item = Render2DNeuronIdentityLinesMixin._setup_custom_neuron_ticks(plot_widget, n_cells)\nv_axis_item = Render2DNeuronIdentityLinesMixin._add_lines(plot_widget)\nreturn v_axis_item", "neuron_id_ticks = [[(float(i), '') for i in np.arange(n_cells + 1)]]\nv_axis_item = plot_widget.axes['left']['item']\nv_ax...
<|body_start_0|> v_axis_item = Render2DNeuronIdentityLinesMixin._setup_custom_neuron_ticks(plot_widget, n_cells) v_axis_item = Render2DNeuronIdentityLinesMixin._add_lines(plot_widget) return v_axis_item <|end_body_0|> <|body_start_1|> neuron_id_ticks = [[(float(i), '') for i in np.arang...
renders the horizontal lines separating the neurons on the 2D raster plots Review 2022-08-30 - Confirmed working as implemented! (Actually, the correct spacing/grid layout of the lines wasn't validated and doesn't look perfect, but the whole thing works. TODO: This is not really a mixin, need to figure out how I want t...
Render2DNeuronIdentityLinesMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Render2DNeuronIdentityLinesMixin: """renders the horizontal lines separating the neurons on the 2D raster plots Review 2022-08-30 - Confirmed working as implemented! (Actually, the correct spacing/grid layout of the lines wasn't validated and doesn't look perfect, but the whole thing works. TODO:...
stack_v2_sparse_classes_10k_train_000666
3,487
permissive
[ { "docstring": "Completely sets up the custom 2D neuron identity axis vertical/y-axis) by adding one minor tick per neuron and displaying the horizontal grid.", "name": "setup_custom_neuron_identity_axis", "signature": "def setup_custom_neuron_identity_axis(plot_widget, n_cells)" }, { "docstring...
3
stack_v2_sparse_classes_30k_train_003208
Implement the Python class `Render2DNeuronIdentityLinesMixin` described below. Class description: renders the horizontal lines separating the neurons on the 2D raster plots Review 2022-08-30 - Confirmed working as implemented! (Actually, the correct spacing/grid layout of the lines wasn't validated and doesn't look pe...
Implement the Python class `Render2DNeuronIdentityLinesMixin` described below. Class description: renders the horizontal lines separating the neurons on the 2D raster plots Review 2022-08-30 - Confirmed working as implemented! (Actually, the correct spacing/grid layout of the lines wasn't validated and doesn't look pe...
212399d826284b394fce8894ff1a93133aef783f
<|skeleton|> class Render2DNeuronIdentityLinesMixin: """renders the horizontal lines separating the neurons on the 2D raster plots Review 2022-08-30 - Confirmed working as implemented! (Actually, the correct spacing/grid layout of the lines wasn't validated and doesn't look perfect, but the whole thing works. TODO:...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Render2DNeuronIdentityLinesMixin: """renders the horizontal lines separating the neurons on the 2D raster plots Review 2022-08-30 - Confirmed working as implemented! (Actually, the correct spacing/grid layout of the lines wasn't validated and doesn't look perfect, but the whole thing works. TODO: This is not ...
the_stack_v2_python_sparse
src/pyphoplacecellanalysis/GUI/PyQtPlot/Widgets/Mixins/Render2DNeuronIdentityLinesMixin.py
CommanderPho/pyPhoPlaceCellAnalysis
train
1
592daa4458b950c2da134bed83460a70b2106749
[ "user = request.user\nif not order_id:\n return redirect(reverse('user:order'))\ntry:\n order = OrderInfo.objects.get(order_id=order_id, user=user)\nexcept OrderInfo.DoesNotExist:\n return redirect(reverse('user:order'))\norder.order_status_name = OrderInfo.ORDER_STATUS[order.order_status]\norder_skus = Or...
<|body_start_0|> user = request.user if not order_id: return redirect(reverse('user:order')) try: order = OrderInfo.objects.get(order_id=order_id, user=user) except OrderInfo.DoesNotExist: return redirect(reverse('user:order')) order.order_stat...
订单评论
OrderCommentView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrderCommentView: """订单评论""" def get(self, request, order_id): """提供评论页面""" <|body_0|> def post(self, request, order_id): """处理评论内容""" <|body_1|> <|end_skeleton|> <|body_start_0|> user = request.user if not order_id: return r...
stack_v2_sparse_classes_10k_train_000667
18,227
no_license
[ { "docstring": "提供评论页面", "name": "get", "signature": "def get(self, request, order_id)" }, { "docstring": "处理评论内容", "name": "post", "signature": "def post(self, request, order_id)" } ]
2
stack_v2_sparse_classes_30k_train_003223
Implement the Python class `OrderCommentView` described below. Class description: 订单评论 Method signatures and docstrings: - def get(self, request, order_id): 提供评论页面 - def post(self, request, order_id): 处理评论内容
Implement the Python class `OrderCommentView` described below. Class description: 订单评论 Method signatures and docstrings: - def get(self, request, order_id): 提供评论页面 - def post(self, request, order_id): 处理评论内容 <|skeleton|> class OrderCommentView: """订单评论""" def get(self, request, order_id): """提供评论页面"...
96ed9be42ba487c065b5ea1783555b053f051586
<|skeleton|> class OrderCommentView: """订单评论""" def get(self, request, order_id): """提供评论页面""" <|body_0|> def post(self, request, order_id): """处理评论内容""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class OrderCommentView: """订单评论""" def get(self, request, order_id): """提供评论页面""" user = request.user if not order_id: return redirect(reverse('user:order')) try: order = OrderInfo.objects.get(order_id=order_id, user=user) except OrderInfo.DoesNot...
the_stack_v2_python_sparse
Web开发/02_web_django/celery_worker_env/dailyfresh/apps/order/views.py
YuanXianguo/Python-IT-Heima
train
0
b237319759db97fe256952d750a2f154decc69fc
[ "if isinstance(udf, Column) or not hasattr(udf, 'func') or udf.evalType != PythonEvalType.SQL_GROUPED_MAP_PANDAS_UDF:\n raise ValueError('Invalid udf: the udf argument must be a pandas_udf of type GROUPED_MAP.')\nwarnings.warn(\"It is preferred to use 'applyInPandas' over this API. This API will be deprecated in...
<|body_start_0|> if isinstance(udf, Column) or not hasattr(udf, 'func') or udf.evalType != PythonEvalType.SQL_GROUPED_MAP_PANDAS_UDF: raise ValueError('Invalid udf: the udf argument must be a pandas_udf of type GROUPED_MAP.') warnings.warn("It is preferred to use 'applyInPandas' over this AP...
Min-in for pandas grouped operations. Currently, only :class:`GroupedData` can use this class.
PandasGroupedOpsMixin
[ "BSD-3-Clause", "CC0-1.0", "CDDL-1.1", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference", "EPL-2.0", "CDDL-1.0", "MIT", "LGPL-2.0-or-later", "Python-2.0", "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-free-unknown",...
stack_v2_sparse_python_classes_v1
<|skeleton|> class PandasGroupedOpsMixin: """Min-in for pandas grouped operations. Currently, only :class:`GroupedData` can use this class.""" def apply(self, udf: 'GroupedMapPandasUserDefinedFunction') -> DataFrame: """It is an alias of :meth:`pyspark.sql.GroupedData.applyInPandas`; however, it takes ...
stack_v2_sparse_classes_10k_train_000668
21,716
permissive
[ { "docstring": "It is an alias of :meth:`pyspark.sql.GroupedData.applyInPandas`; however, it takes a :meth:`pyspark.sql.functions.pandas_udf` whereas :meth:`pyspark.sql.GroupedData.applyInPandas` takes a Python native function. .. versionadded:: 2.3.0 .. versionchanged:: 3.4.0 Support Spark Connect. Parameters ...
4
null
Implement the Python class `PandasGroupedOpsMixin` described below. Class description: Min-in for pandas grouped operations. Currently, only :class:`GroupedData` can use this class. Method signatures and docstrings: - def apply(self, udf: 'GroupedMapPandasUserDefinedFunction') -> DataFrame: It is an alias of :meth:`p...
Implement the Python class `PandasGroupedOpsMixin` described below. Class description: Min-in for pandas grouped operations. Currently, only :class:`GroupedData` can use this class. Method signatures and docstrings: - def apply(self, udf: 'GroupedMapPandasUserDefinedFunction') -> DataFrame: It is an alias of :meth:`p...
60d8fc49bec5dae1b8cf39a0670cb640b430f520
<|skeleton|> class PandasGroupedOpsMixin: """Min-in for pandas grouped operations. Currently, only :class:`GroupedData` can use this class.""" def apply(self, udf: 'GroupedMapPandasUserDefinedFunction') -> DataFrame: """It is an alias of :meth:`pyspark.sql.GroupedData.applyInPandas`; however, it takes ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PandasGroupedOpsMixin: """Min-in for pandas grouped operations. Currently, only :class:`GroupedData` can use this class.""" def apply(self, udf: 'GroupedMapPandasUserDefinedFunction') -> DataFrame: """It is an alias of :meth:`pyspark.sql.GroupedData.applyInPandas`; however, it takes a :meth:`pysp...
the_stack_v2_python_sparse
python/pyspark/sql/pandas/group_ops.py
apache/spark
train
39,983
690d8df99963f2c2fb15488e5f0c9ed73244cbd1
[ "prev_control_input = self.system.control_input\ncloud_node = self.system.cloud_node\nselected_nodes = None\nsolution = None\nif prev_control_input is None:\n solution, selected_nodes = MOGAOperator._decode_part_1(self, individual)\nelse:\n solution = OptSolution.create_empty(self.system)\n selected_nodes ...
<|body_start_0|> prev_control_input = self.system.control_input cloud_node = self.system.cloud_node selected_nodes = None solution = None if prev_control_input is None: solution, selected_nodes = MOGAOperator._decode_part_1(self, individual) else: ...
No Migration GA Operator
NoMigrationGAOperator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NoMigrationGAOperator: """No Migration GA Operator""" def _decode_part_1(self, individual): """Decode Part I. It selects candidate nodes to host applications Args: individual (GAIndividual): individual Returns: (OptSolution, dict): solution, list of selected nodes per application""" ...
stack_v2_sparse_classes_10k_train_000669
5,124
no_license
[ { "docstring": "Decode Part I. It selects candidate nodes to host applications Args: individual (GAIndividual): individual Returns: (OptSolution, dict): solution, list of selected nodes per application", "name": "_decode_part_1", "signature": "def _decode_part_1(self, individual)" }, { "docstrin...
3
stack_v2_sparse_classes_30k_train_003633
Implement the Python class `NoMigrationGAOperator` described below. Class description: No Migration GA Operator Method signatures and docstrings: - def _decode_part_1(self, individual): Decode Part I. It selects candidate nodes to host applications Args: individual (GAIndividual): individual Returns: (OptSolution, di...
Implement the Python class `NoMigrationGAOperator` described below. Class description: No Migration GA Operator Method signatures and docstrings: - def _decode_part_1(self, individual): Decode Part I. It selects candidate nodes to host applications Args: individual (GAIndividual): individual Returns: (OptSolution, di...
ce7045918f60c92ce1ed5ca4389b969bf28e6b82
<|skeleton|> class NoMigrationGAOperator: """No Migration GA Operator""" def _decode_part_1(self, individual): """Decode Part I. It selects candidate nodes to host applications Args: individual (GAIndividual): individual Returns: (OptSolution, dict): solution, list of selected nodes per application""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NoMigrationGAOperator: """No Migration GA Operator""" def _decode_part_1(self, individual): """Decode Part I. It selects candidate nodes to host applications Args: individual (GAIndividual): individual Returns: (OptSolution, dict): solution, list of selected nodes per application""" prev_...
the_stack_v2_python_sparse
sp/system_controller/optimizer/no_migration.py
adysonmaia/phd-sp-dynamic
train
0
d97f2d45da395ceb5ae6d8b2c7e8b6070515ed3d
[ "if not nums or len(nums) < 4:\n return []\nnums.sort()\nreturn [list(t) for t in self.kSum(nums, target, 4)]", "res = set()\nif k == 2:\n lo, hi = (0, len(nums) - 1)\n while lo < hi:\n if nums[lo] + nums[hi] == target:\n res.add((nums[lo], nums[hi]))\n lo += 1\n elif ...
<|body_start_0|> if not nums or len(nums) < 4: return [] nums.sort() return [list(t) for t in self.kSum(nums, target, 4)] <|end_body_0|> <|body_start_1|> res = set() if k == 2: lo, hi = (0, len(nums) - 1) while lo < hi: if nums...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def fourSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[List[int]]""" <|body_0|> def kSum(self, nums, target, k): """:type nums = List[int] :type target: int :type k: int :rtype: List[int]""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_10k_train_000670
1,102
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: List[List[int]]", "name": "fourSum", "signature": "def fourSum(self, nums, target)" }, { "docstring": ":type nums = List[int] :type target: int :type k: int :rtype: List[int]", "name": "kSum", "signature": "def kSum(self, nu...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fourSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[List[int]] - def kSum(self, nums, target, k): :type nums = List[int] :type target: int :type...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fourSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[List[int]] - def kSum(self, nums, target, k): :type nums = List[int] :type target: int :type...
24988428cada3b1f8a6c0cf0140e288511cd9a6d
<|skeleton|> class Solution: def fourSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[List[int]]""" <|body_0|> def kSum(self, nums, target, k): """:type nums = List[int] :type target: int :type k: int :rtype: List[int]""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def fourSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[List[int]]""" if not nums or len(nums) < 4: return [] nums.sort() return [list(t) for t in self.kSum(nums, target, 4)] def kSum(self, nums, target, k): ""...
the_stack_v2_python_sparse
LC_n_Misc/LC_18_4Sum.py
abhikrish06/PythonPractice
train
0
a071ae6dc0156217830ddfd3789d3b86e824d90e
[ "engine = MainEngine()\nqubits = engine.allocate_qureg(3)\nH | qubits[0]\nengine.flush()\nprint(engine.backend.cheat())\nX | qubits[2]\nengine.flush()\nprint(engine.backend.cheat())\nCNOT | (qubits[0], qubits[1])\nengine.flush()\nprint(engine.backend.cheat())", "drawer = CircuitDrawer()\nengine = MainEngine(drawe...
<|body_start_0|> engine = MainEngine() qubits = engine.allocate_qureg(3) H | qubits[0] engine.flush() print(engine.backend.cheat()) X | qubits[2] engine.flush() print(engine.backend.cheat()) CNOT | (qubits[0], qubits[1]) engine.flush() ...
This class contains demonstrations of ProjectQ's debugging and diagnostic features.
DebuggingFeatures
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DebuggingFeatures: """This class contains demonstrations of ProjectQ's debugging and diagnostic features.""" def test_step_by_step_circuit_inspection(self): """This function demonstrates how to use ProjectQ to print the state vector of every step (moment) in a circuit. It also shows ...
stack_v2_sparse_classes_10k_train_000671
3,023
permissive
[ { "docstring": "This function demonstrates how to use ProjectQ to print the state vector of every step (moment) in a circuit. It also shows how to get the state vector at each step, and how to print it in ket notation.", "name": "test_step_by_step_circuit_inspection", "signature": "def test_step_by_step...
3
stack_v2_sparse_classes_30k_train_003539
Implement the Python class `DebuggingFeatures` described below. Class description: This class contains demonstrations of ProjectQ's debugging and diagnostic features. Method signatures and docstrings: - def test_step_by_step_circuit_inspection(self): This function demonstrates how to use ProjectQ to print the state v...
Implement the Python class `DebuggingFeatures` described below. Class description: This class contains demonstrations of ProjectQ's debugging and diagnostic features. Method signatures and docstrings: - def test_step_by_step_circuit_inspection(self): This function demonstrates how to use ProjectQ to print the state v...
941488f8f8a81a4b7d7fe28414ce14fa478a692a
<|skeleton|> class DebuggingFeatures: """This class contains demonstrations of ProjectQ's debugging and diagnostic features.""" def test_step_by_step_circuit_inspection(self): """This function demonstrates how to use ProjectQ to print the state vector of every step (moment) in a circuit. It also shows ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DebuggingFeatures: """This class contains demonstrations of ProjectQ's debugging and diagnostic features.""" def test_step_by_step_circuit_inspection(self): """This function demonstrates how to use ProjectQ to print the state vector of every step (moment) in a circuit. It also shows how to get th...
the_stack_v2_python_sparse
ProjectQ/ProjectQDebugging/debugging_features.py
taibah/qsfe
train
0
f29c67392d53702387c32d9e921e15f1a9d29a95
[ "self._attr_available = False\nself._gitlab_data = gitlab_data\nself._attr_name = name", "if self.native_value == 'success':\n return ICON_HAPPY\nif self.native_value == 'failed':\n return ICON_SAD\nreturn ICON_OTHER", "self._gitlab_data.update()\nself._attr_native_value = self._gitlab_data.status\nself._...
<|body_start_0|> self._attr_available = False self._gitlab_data = gitlab_data self._attr_name = name <|end_body_0|> <|body_start_1|> if self.native_value == 'success': return ICON_HAPPY if self.native_value == 'failed': return ICON_SAD return ICON...
Representation of a GitLab sensor.
GitLabSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GitLabSensor: """Representation of a GitLab sensor.""" def __init__(self, gitlab_data: GitLabData, name: str) -> None: """Initialize the GitLab sensor.""" <|body_0|> def icon(self) -> str: """Return the icon to use in the frontend.""" <|body_1|> def ...
stack_v2_sparse_classes_10k_train_000672
5,282
permissive
[ { "docstring": "Initialize the GitLab sensor.", "name": "__init__", "signature": "def __init__(self, gitlab_data: GitLabData, name: str) -> None" }, { "docstring": "Return the icon to use in the frontend.", "name": "icon", "signature": "def icon(self) -> str" }, { "docstring": "C...
3
null
Implement the Python class `GitLabSensor` described below. Class description: Representation of a GitLab sensor. Method signatures and docstrings: - def __init__(self, gitlab_data: GitLabData, name: str) -> None: Initialize the GitLab sensor. - def icon(self) -> str: Return the icon to use in the frontend. - def upda...
Implement the Python class `GitLabSensor` described below. Class description: Representation of a GitLab sensor. Method signatures and docstrings: - def __init__(self, gitlab_data: GitLabData, name: str) -> None: Initialize the GitLab sensor. - def icon(self) -> str: Return the icon to use in the frontend. - def upda...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class GitLabSensor: """Representation of a GitLab sensor.""" def __init__(self, gitlab_data: GitLabData, name: str) -> None: """Initialize the GitLab sensor.""" <|body_0|> def icon(self) -> str: """Return the icon to use in the frontend.""" <|body_1|> def ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GitLabSensor: """Representation of a GitLab sensor.""" def __init__(self, gitlab_data: GitLabData, name: str) -> None: """Initialize the GitLab sensor.""" self._attr_available = False self._gitlab_data = gitlab_data self._attr_name = name def icon(self) -> str: ...
the_stack_v2_python_sparse
homeassistant/components/gitlab_ci/sensor.py
home-assistant/core
train
35,501
65069c192bdcfc8bf792f8d1e63112e0837c7ea7
[ "unique_digit_square_sums = set()\nwhile n not in unique_digit_square_sums:\n unique_digit_square_sums.add(n)\n n = self.sum_of_digit_squares(n)\n if n == 1:\n return True\nreturn False", "digit_square_sum = 0\nwhile n > 0:\n digit_square_sum += (n % 10) ** 2\n n //= 10\nreturn digit_square_...
<|body_start_0|> unique_digit_square_sums = set() while n not in unique_digit_square_sums: unique_digit_square_sums.add(n) n = self.sum_of_digit_squares(n) if n == 1: return True return False <|end_body_0|> <|body_start_1|> digit_squar...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isHappy(self, n: int) -> bool: """(Solution, int) -> bool Returns True iff n is a "happy" number, which is a number that results in a 1 after a repetitive process of replacing the original number by the sum of digit squares. >>> soln = Solution() >>> soln.isHappy(19) True""...
stack_v2_sparse_classes_10k_train_000673
2,132
no_license
[ { "docstring": "(Solution, int) -> bool Returns True iff n is a \"happy\" number, which is a number that results in a 1 after a repetitive process of replacing the original number by the sum of digit squares. >>> soln = Solution() >>> soln.isHappy(19) True", "name": "isHappy", "signature": "def isHappy(...
2
stack_v2_sparse_classes_30k_train_006423
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isHappy(self, n: int) -> bool: (Solution, int) -> bool Returns True iff n is a "happy" number, which is a number that results in a 1 after a repetitive process of replacing t...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isHappy(self, n: int) -> bool: (Solution, int) -> bool Returns True iff n is a "happy" number, which is a number that results in a 1 after a repetitive process of replacing t...
6812253b90bdd5a35c6bfba8eac54da9be26d56c
<|skeleton|> class Solution: def isHappy(self, n: int) -> bool: """(Solution, int) -> bool Returns True iff n is a "happy" number, which is a number that results in a 1 after a repetitive process of replacing the original number by the sum of digit squares. >>> soln = Solution() >>> soln.isHappy(19) True""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def isHappy(self, n: int) -> bool: """(Solution, int) -> bool Returns True iff n is a "happy" number, which is a number that results in a 1 after a repetitive process of replacing the original number by the sum of digit squares. >>> soln = Solution() >>> soln.isHappy(19) True""" uniq...
the_stack_v2_python_sparse
python3/happyNum.py
yichuanma95/leetcode-solns
train
2
dabb4b405eb88bdbb1304adde116f707797e5bc8
[ "super(TextSubNet, self).__init__()\nself.rnn = nn.LSTM(in_size, hidden_size, num_layers=num_layers, dropout=dropout, bidirectional=bidirectional, batch_first=True)\nself.dropout = nn.Dropout(dropout)\nself.linear_1 = nn.Linear(hidden_size, out_size)", "_, final_states = self.rnn(x)\nh = self.dropout(final_states...
<|body_start_0|> super(TextSubNet, self).__init__() self.rnn = nn.LSTM(in_size, hidden_size, num_layers=num_layers, dropout=dropout, bidirectional=bidirectional, batch_first=True) self.dropout = nn.Dropout(dropout) self.linear_1 = nn.Linear(hidden_size, out_size) <|end_body_0|> <|body_s...
The LSTM-based subnetwork that is used in LMF for text
TextSubNet
[ "Apache-2.0", "BSD-2-Clause", "MIT", "BSD-3-Clause", "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-unknown-license-reference", "GPL-1.0-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextSubNet: """The LSTM-based subnetwork that is used in LMF for text""" def __init__(self, in_size, hidden_size, out_size, num_layers=1, dropout=0.2, bidirectional=False): """Args: in_size: input dimension hidden_size: hidden layer dimension num_layers: specify the number of layers ...
stack_v2_sparse_classes_10k_train_000674
7,292
permissive
[ { "docstring": "Args: in_size: input dimension hidden_size: hidden layer dimension num_layers: specify the number of layers of LSTMs. dropout: dropout probability bidirectional: specify usage of bidirectional LSTM Output: (return value in forward) a tensor of shape (batch_size, out_size)", "name": "__init__...
2
stack_v2_sparse_classes_30k_train_003199
Implement the Python class `TextSubNet` described below. Class description: The LSTM-based subnetwork that is used in LMF for text Method signatures and docstrings: - def __init__(self, in_size, hidden_size, out_size, num_layers=1, dropout=0.2, bidirectional=False): Args: in_size: input dimension hidden_size: hidden ...
Implement the Python class `TextSubNet` described below. Class description: The LSTM-based subnetwork that is used in LMF for text Method signatures and docstrings: - def __init__(self, in_size, hidden_size, out_size, num_layers=1, dropout=0.2, bidirectional=False): Args: in_size: input dimension hidden_size: hidden ...
92acc188d3a0f634de58463b6676e70df83ef808
<|skeleton|> class TextSubNet: """The LSTM-based subnetwork that is used in LMF for text""" def __init__(self, in_size, hidden_size, out_size, num_layers=1, dropout=0.2, bidirectional=False): """Args: in_size: input dimension hidden_size: hidden layer dimension num_layers: specify the number of layers ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TextSubNet: """The LSTM-based subnetwork that is used in LMF for text""" def __init__(self, in_size, hidden_size, out_size, num_layers=1, dropout=0.2, bidirectional=False): """Args: in_size: input dimension hidden_size: hidden layer dimension num_layers: specify the number of layers of LSTMs. dro...
the_stack_v2_python_sparse
PyTorch/contrib/others/Low-rank-Multimodal-Fusion_ID2983_for_Pytorch/model.py
Ascend/ModelZoo-PyTorch
train
23
64b9ccc9a378d91f9c4f2ce10be7cb95d950dfb6
[ "self.debug = debug\nself.n = n\nself.a = a\nself.b = b\nself.x = np.zeros(n + 1, dtype=np.int8)\nsuper().__init__()\nif self.debug:\n print(sys._getframe().f_code.co_name, ':', self.n, self.a, self.b, self.debug)", "count = self.n\nfor i in range(1, self.n + 1):\n nxt = self.a * i + self.b\n if self.x[i...
<|body_start_0|> self.debug = debug self.n = n self.a = a self.b = b self.x = np.zeros(n + 1, dtype=np.int8) super().__init__() if self.debug: print(sys._getframe().f_code.co_name, ':', self.n, self.a, self.b, self.debug) <|end_body_0|> <|body_start_1...
A class used to get the count of elements url : https://codeup.kr/problem.php?id=2128&rid=0 n, a, b이 주어진다. (1<=n<=10100) (1<=a,b<=103) 집합 A의 임의의 원소 x를 선택했을 때 ax+b가 집합 A에 존재하지 않도록 A의 원소를 빼버리자! 하지만 a, b는 배려심이 많기 때문에 A의 크기를 최대로 하려고 한다. ax+b = n : hate a and b in set 10 2 2 : 2x + 2 <= 10 x=1 => 4 remove 1 2 3 5 6 7 8 9 10...
CountAntiSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CountAntiSet: """A class used to get the count of elements url : https://codeup.kr/problem.php?id=2128&rid=0 n, a, b이 주어진다. (1<=n<=10100) (1<=a,b<=103) 집합 A의 임의의 원소 x를 선택했을 때 ax+b가 집합 A에 존재하지 않도록 A의 원소를 빼버리자! 하지만 a, b는 배려심이 많기 때문에 A의 크기를 최대로 하려고 한다. ax+b = n : hate a and b in set 10 2 2 : 2x + 2 ...
stack_v2_sparse_classes_10k_train_000675
3,185
no_license
[ { "docstring": "get the count of elements to meet the rule. (2) :param n: max number :param a: ax+b :param b: ax+b :param debug: debug mode :return:", "name": "__init__", "signature": "def __init__(self, n, a, b, debug=0)" }, { "docstring": "get the count of elements to meet the rule. (2)", ...
3
stack_v2_sparse_classes_30k_train_007271
Implement the Python class `CountAntiSet` described below. Class description: A class used to get the count of elements url : https://codeup.kr/problem.php?id=2128&rid=0 n, a, b이 주어진다. (1<=n<=10100) (1<=a,b<=103) 집합 A의 임의의 원소 x를 선택했을 때 ax+b가 집합 A에 존재하지 않도록 A의 원소를 빼버리자! 하지만 a, b는 배려심이 많기 때문에 A의 크기를 최대로 하려고 한다. ax+b = n...
Implement the Python class `CountAntiSet` described below. Class description: A class used to get the count of elements url : https://codeup.kr/problem.php?id=2128&rid=0 n, a, b이 주어진다. (1<=n<=10100) (1<=a,b<=103) 집합 A의 임의의 원소 x를 선택했을 때 ax+b가 집합 A에 존재하지 않도록 A의 원소를 빼버리자! 하지만 a, b는 배려심이 많기 때문에 A의 크기를 최대로 하려고 한다. ax+b = n...
2fb6246be3bf48eb8ad626217300a1a9328f541a
<|skeleton|> class CountAntiSet: """A class used to get the count of elements url : https://codeup.kr/problem.php?id=2128&rid=0 n, a, b이 주어진다. (1<=n<=10100) (1<=a,b<=103) 집합 A의 임의의 원소 x를 선택했을 때 ax+b가 집합 A에 존재하지 않도록 A의 원소를 빼버리자! 하지만 a, b는 배려심이 많기 때문에 A의 크기를 최대로 하려고 한다. ax+b = n : hate a and b in set 10 2 2 : 2x + 2 ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CountAntiSet: """A class used to get the count of elements url : https://codeup.kr/problem.php?id=2128&rid=0 n, a, b이 주어진다. (1<=n<=10100) (1<=a,b<=103) 집합 A의 임의의 원소 x를 선택했을 때 ax+b가 집합 A에 존재하지 않도록 A의 원소를 빼버리자! 하지만 a, b는 배려심이 많기 때문에 A의 크기를 최대로 하려고 한다. ax+b = n : hate a and b in set 10 2 2 : 2x + 2 <= 10 x=1 => ...
the_stack_v2_python_sparse
2022/1.py
cheoljoo/problemSolving
train
1
13482df4285582a2ac66ff8b947e92a06c22d56b
[ "try:\n self.administrator\nexcept:\n return False\nreturn True", "try:\n self.coordinator\nexcept:\n return False\nreturn True" ]
<|body_start_0|> try: self.administrator except: return False return True <|end_body_0|> <|body_start_1|> try: self.coordinator except: return False return True <|end_body_1|>
Proxy for the main User class.
User
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class User: """Proxy for the main User class.""" def is_administrator(self): """Returns True if the user is an administrator.""" <|body_0|> def is_coordinator(self): """Returns True if the user is a coordinator.""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_10k_train_000676
758
no_license
[ { "docstring": "Returns True if the user is an administrator.", "name": "is_administrator", "signature": "def is_administrator(self)" }, { "docstring": "Returns True if the user is a coordinator.", "name": "is_coordinator", "signature": "def is_coordinator(self)" } ]
2
stack_v2_sparse_classes_30k_train_006298
Implement the Python class `User` described below. Class description: Proxy for the main User class. Method signatures and docstrings: - def is_administrator(self): Returns True if the user is an administrator. - def is_coordinator(self): Returns True if the user is a coordinator.
Implement the Python class `User` described below. Class description: Proxy for the main User class. Method signatures and docstrings: - def is_administrator(self): Returns True if the user is an administrator. - def is_coordinator(self): Returns True if the user is a coordinator. <|skeleton|> class User: """Pro...
b9992dc1ea27fe5e3a87cb10e691d277689008a5
<|skeleton|> class User: """Proxy for the main User class.""" def is_administrator(self): """Returns True if the user is an administrator.""" <|body_0|> def is_coordinator(self): """Returns True if the user is a coordinator.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class User: """Proxy for the main User class.""" def is_administrator(self): """Returns True if the user is an administrator.""" try: self.administrator except: return False return True def is_coordinator(self): """Returns True if the user is...
the_stack_v2_python_sparse
foji_project/foji/models/user.py
SoporteFoji/catastro
train
0
43521f506538523eb06306c5cfbdd46471880438
[ "QStandardItem.__init__(self, principal.displayName)\nself._initIcons()\nself.principal = principal\nif principal.type == USER_PRINCIPAL_TYPE:\n self.setIcon(self._userIcon)\nelse:\n self.setIcon(self._groupIcon)\nself.setEditable(False)\nself.setToolTip(self.principal.type.displayName)", "if self._groupIco...
<|body_start_0|> QStandardItem.__init__(self, principal.displayName) self._initIcons() self.principal = principal if principal.type == USER_PRINCIPAL_TYPE: self.setIcon(self._userIcon) else: self.setIcon(self._groupIcon) self.setEditable(False) ...
Principal-specific item.
PrincipalItem
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrincipalItem: """Principal-specific item.""" def __init__(self, principal): """Constructor. @param principal: The associated principal. @type principal: L{<Principal>datafinder.core.principal.Principal}""" <|body_0|> def _initIcons(self): """Initializes the icon...
stack_v2_sparse_classes_10k_train_000677
4,825
no_license
[ { "docstring": "Constructor. @param principal: The associated principal. @type principal: L{<Principal>datafinder.core.principal.Principal}", "name": "__init__", "signature": "def __init__(self, principal)" }, { "docstring": "Initializes the icons.", "name": "_initIcons", "signature": "d...
2
stack_v2_sparse_classes_30k_train_001151
Implement the Python class `PrincipalItem` described below. Class description: Principal-specific item. Method signatures and docstrings: - def __init__(self, principal): Constructor. @param principal: The associated principal. @type principal: L{<Principal>datafinder.core.principal.Principal} - def _initIcons(self):...
Implement the Python class `PrincipalItem` described below. Class description: Principal-specific item. Method signatures and docstrings: - def __init__(self, principal): Constructor. @param principal: The associated principal. @type principal: L{<Principal>datafinder.core.principal.Principal} - def _initIcons(self):...
958fda4f3064f9f6b2034da396a20ac9d9abd52f
<|skeleton|> class PrincipalItem: """Principal-specific item.""" def __init__(self, principal): """Constructor. @param principal: The associated principal. @type principal: L{<Principal>datafinder.core.principal.Principal}""" <|body_0|> def _initIcons(self): """Initializes the icon...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PrincipalItem: """Principal-specific item.""" def __init__(self, principal): """Constructor. @param principal: The associated principal. @type principal: L{<Principal>datafinder.core.principal.Principal}""" QStandardItem.__init__(self, principal.displayName) self._initIcons() ...
the_stack_v2_python_sparse
src/datafinder/gui/user/dialogs/privilege_dialog/items.py
DLR-SC/DataFinder
train
9
940afa7569cbec382be52baa393d226516ca4fb9
[ "assert size > 0\nself.size = size\nself.graph = [[] for _ in range(size)]\nself.cost_edge = [[] for _ in range(size)]", "assert 0 <= x < self.size\nassert 0 <= y < self.size\nself.graph[x].append(y)\nself.graph[y].append(x)\nself.cost_edge[x].append(cost)\nself.cost_edge[y].append(cost)", "s2 = 1\nwhile 1 << s...
<|body_start_0|> assert size > 0 self.size = size self.graph = [[] for _ in range(size)] self.cost_edge = [[] for _ in range(size)] <|end_body_0|> <|body_start_1|> assert 0 <= x < self.size assert 0 <= y < self.size self.graph[x].append(y) self.graph[y].a...
Lowest Common Ancestor
LCA
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LCA: """Lowest Common Ancestor""" def __init__(self, size): """保存領域の初期化。 辺に重みがついている時の頂点間の重み計算にはcostを使えます。 size: 頂点の数""" <|body_0|> def add_edge(self, x: int, y: int, cost: int=1) -> None: """木の辺を追加します。""" <|body_1|> def init(self) -> None: ""...
stack_v2_sparse_classes_10k_train_000678
25,752
no_license
[ { "docstring": "保存領域の初期化。 辺に重みがついている時の頂点間の重み計算にはcostを使えます。 size: 頂点の数", "name": "__init__", "signature": "def __init__(self, size)" }, { "docstring": "木の辺を追加します。", "name": "add_edge", "signature": "def add_edge(self, x: int, y: int, cost: int=1) -> None" }, { "docstring": "全ての辺を追...
6
stack_v2_sparse_classes_30k_train_000498
Implement the Python class `LCA` described below. Class description: Lowest Common Ancestor Method signatures and docstrings: - def __init__(self, size): 保存領域の初期化。 辺に重みがついている時の頂点間の重み計算にはcostを使えます。 size: 頂点の数 - def add_edge(self, x: int, y: int, cost: int=1) -> None: 木の辺を追加します。 - def init(self) -> None: 全ての辺を追加した後に、LC...
Implement the Python class `LCA` described below. Class description: Lowest Common Ancestor Method signatures and docstrings: - def __init__(self, size): 保存領域の初期化。 辺に重みがついている時の頂点間の重み計算にはcostを使えます。 size: 頂点の数 - def add_edge(self, x: int, y: int, cost: int=1) -> None: 木の辺を追加します。 - def init(self) -> None: 全ての辺を追加した後に、LC...
f214ef92f13bc5d6b290746d5a94e2faad20d8b0
<|skeleton|> class LCA: """Lowest Common Ancestor""" def __init__(self, size): """保存領域の初期化。 辺に重みがついている時の頂点間の重み計算にはcostを使えます。 size: 頂点の数""" <|body_0|> def add_edge(self, x: int, y: int, cost: int=1) -> None: """木の辺を追加します。""" <|body_1|> def init(self) -> None: ""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LCA: """Lowest Common Ancestor""" def __init__(self, size): """保存領域の初期化。 辺に重みがついている時の頂点間の重み計算にはcostを使えます。 size: 頂点の数""" assert size > 0 self.size = size self.graph = [[] for _ in range(size)] self.cost_edge = [[] for _ in range(size)] def add_edge(self, x: int...
the_stack_v2_python_sparse
lib/lib.py
silphire/atcoder
train
0
b8c7c97b09145b1b580d8f8a55d1d7a4bdc0d47e
[ "text = ''\nwith open(file_path, 'r') as file:\n for line in file.readlines():\n text += line\nreturn text", "read = sys.stdin.readlines()\ntext = ''\nfor line in read:\n text += line\nreturn text" ]
<|body_start_0|> text = '' with open(file_path, 'r') as file: for line in file.readlines(): text += line return text <|end_body_0|> <|body_start_1|> read = sys.stdin.readlines() text = '' for line in read: text += line retu...
Used in handling reading input.
Reader
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Reader: """Used in handling reading input.""" def read_file(file_path): """Reads a file and outputs it in a single string. :param str file_path: File pathname. :return str: File content in a string""" <|body_0|> def read_input(): """Reads a direct input. An input...
stack_v2_sparse_classes_10k_train_000679
855
permissive
[ { "docstring": "Reads a file and outputs it in a single string. :param str file_path: File pathname. :return str: File content in a string", "name": "read_file", "signature": "def read_file(file_path)" }, { "docstring": "Reads a direct input. An input ends with CTRL+D. Enables inputting from a f...
2
stack_v2_sparse_classes_30k_train_003031
Implement the Python class `Reader` described below. Class description: Used in handling reading input. Method signatures and docstrings: - def read_file(file_path): Reads a file and outputs it in a single string. :param str file_path: File pathname. :return str: File content in a string - def read_input(): Reads a d...
Implement the Python class `Reader` described below. Class description: Used in handling reading input. Method signatures and docstrings: - def read_file(file_path): Reads a file and outputs it in a single string. :param str file_path: File pathname. :return str: File content in a string - def read_input(): Reads a d...
1f7bea099dac93696d5d2ebb8d76926efe5ceda4
<|skeleton|> class Reader: """Used in handling reading input.""" def read_file(file_path): """Reads a file and outputs it in a single string. :param str file_path: File pathname. :return str: File content in a string""" <|body_0|> def read_input(): """Reads a direct input. An input...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Reader: """Used in handling reading input.""" def read_file(file_path): """Reads a file and outputs it in a single string. :param str file_path: File pathname. :return str: File content in a string""" text = '' with open(file_path, 'r') as file: for line in file.readli...
the_stack_v2_python_sparse
form/readers.py
ffhan/lingua
train
0
21d742e41aa04052e1d11888dab2f2ae0d5976ea
[ "device_obj = Device(context=context, type=self.type, vendor=self.vendor, model=self.model, hostname=host)\nif hasattr(self, 'std_board_info'):\n device_obj.std_board_info = self.std_board_info\nif hasattr(self, 'vendor_board_info'):\n device_obj.vendor_board_info = self.vendor_board_info\ndevice_obj.create(c...
<|body_start_0|> device_obj = Device(context=context, type=self.type, vendor=self.vendor, model=self.model, hostname=host) if hasattr(self, 'std_board_info'): device_obj.std_board_info = self.std_board_info if hasattr(self, 'vendor_board_info'): device_obj.vendor_board_in...
DriverDevice
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DriverDevice: def create(self, context, host): """Create a driver-side Device Object into DB. This object will be stored in many db tables: device, deployable, attach_handle, controlpath_id etc. by calling related Object.""" <|body_0|> def destroy(self, context, host): ...
stack_v2_sparse_classes_10k_train_000680
7,119
permissive
[ { "docstring": "Create a driver-side Device Object into DB. This object will be stored in many db tables: device, deployable, attach_handle, controlpath_id etc. by calling related Object.", "name": "create", "signature": "def create(self, context, host)" }, { "docstring": "Delete a driver-side D...
5
stack_v2_sparse_classes_30k_train_000922
Implement the Python class `DriverDevice` described below. Class description: Implement the DriverDevice class. Method signatures and docstrings: - def create(self, context, host): Create a driver-side Device Object into DB. This object will be stored in many db tables: device, deployable, attach_handle, controlpath_...
Implement the Python class `DriverDevice` described below. Class description: Implement the DriverDevice class. Method signatures and docstrings: - def create(self, context, host): Create a driver-side Device Object into DB. This object will be stored in many db tables: device, deployable, attach_handle, controlpath_...
ab8b8514242895b8adc2ec3dfbbb63a49f02c89e
<|skeleton|> class DriverDevice: def create(self, context, host): """Create a driver-side Device Object into DB. This object will be stored in many db tables: device, deployable, attach_handle, controlpath_id etc. by calling related Object.""" <|body_0|> def destroy(self, context, host): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DriverDevice: def create(self, context, host): """Create a driver-side Device Object into DB. This object will be stored in many db tables: device, deployable, attach_handle, controlpath_id etc. by calling related Object.""" device_obj = Device(context=context, type=self.type, vendor=self.vend...
the_stack_v2_python_sparse
cyborg/objects/driver_objects/driver_device.py
openstack/cyborg
train
41
d2fb199ca9b7a3023a6745bb13613567a408c2f6
[ "self.thresholds = np.array([276, 277], dtype=np.float32)\nself.rain_name = 'probability_of_falling_rain_level_above_surface'\nself.snow_name = 'probability_of_falling_snow_level_below_surface'\nrain_prob = np.array([[[0.5, 0.1, 1.0], [0.0, 0.2, 0.5], [0.1, 0.1, 0.3]], [[0.5, 0.1, 1.0], [0.0, 0.2, 0.5], [0.1, 0.1, ...
<|body_start_0|> self.thresholds = np.array([276, 277], dtype=np.float32) self.rain_name = 'probability_of_falling_rain_level_above_surface' self.snow_name = 'probability_of_falling_snow_level_below_surface' rain_prob = np.array([[[0.5, 0.1, 1.0], [0.0, 0.2, 0.5], [0.1, 0.1, 0.3]], [[0.5...
Tests the calculate sleet probability function.
Test_calculate_sleet_probability
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_calculate_sleet_probability: """Tests the calculate sleet probability function.""" def setUp(self): """Create cubes to input into the function.""" <|body_0|> def test_basic_calculation(self): """Test the basic sleet calculation works.""" <|body_1|> ...
stack_v2_sparse_classes_10k_train_000681
5,635
permissive
[ { "docstring": "Create cubes to input into the function.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test the basic sleet calculation works.", "name": "test_basic_calculation", "signature": "def test_basic_calculation(self)" }, { "docstring": "Test the ba...
5
stack_v2_sparse_classes_30k_val_000210
Implement the Python class `Test_calculate_sleet_probability` described below. Class description: Tests the calculate sleet probability function. Method signatures and docstrings: - def setUp(self): Create cubes to input into the function. - def test_basic_calculation(self): Test the basic sleet calculation works. - ...
Implement the Python class `Test_calculate_sleet_probability` described below. Class description: Tests the calculate sleet probability function. Method signatures and docstrings: - def setUp(self): Create cubes to input into the function. - def test_basic_calculation(self): Test the basic sleet calculation works. - ...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test_calculate_sleet_probability: """Tests the calculate sleet probability function.""" def setUp(self): """Create cubes to input into the function.""" <|body_0|> def test_basic_calculation(self): """Test the basic sleet calculation works.""" <|body_1|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Test_calculate_sleet_probability: """Tests the calculate sleet probability function.""" def setUp(self): """Create cubes to input into the function.""" self.thresholds = np.array([276, 277], dtype=np.float32) self.rain_name = 'probability_of_falling_rain_level_above_surface' ...
the_stack_v2_python_sparse
improver_tests/precipitation_type/calculate_sleet_prob/test_calculate_sleet_probability.py
metoppv/improver
train
101
be790ce3e8df5304abc4c98cac52a2ff1068da94
[ "super(PG_LOSS, self).__init__()\nself.simulations = simulations\nself.trajectory_length = trajectory_length\nself.max_ent = max_ent", "flat_states = torch.flatten(state_tensor, start_dim=0, end_dim=1)\nflat_actions = torch.flatten(action_tensor, start_dim=0, end_dim=1)\nflat_cumsum = torch.flatten(cumulative_rol...
<|body_start_0|> super(PG_LOSS, self).__init__() self.simulations = simulations self.trajectory_length = trajectory_length self.max_ent = max_ent <|end_body_0|> <|body_start_1|> flat_states = torch.flatten(state_tensor, start_dim=0, end_dim=1) flat_actions = torch.flatte...
POLICY GRADIENTS LOSS FUNCTION
PG_LOSS
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PG_LOSS: """POLICY GRADIENTS LOSS FUNCTION""" def __init__(self, trajectory_length, simulations, max_ent=0, TRPO=0, PPO=0, beta=None): """INITIALIZATIONS""" <|body_0|> def forward(self, policy, state_tensor, action_tensor, reward_tensor, cumulative_rollout): """C...
stack_v2_sparse_classes_10k_train_000682
1,741
no_license
[ { "docstring": "INITIALIZATIONS", "name": "__init__", "signature": "def __init__(self, trajectory_length, simulations, max_ent=0, TRPO=0, PPO=0, beta=None)" }, { "docstring": "CONVERT FORMAT", "name": "forward", "signature": "def forward(self, policy, state_tensor, action_tensor, reward_...
2
stack_v2_sparse_classes_30k_train_004608
Implement the Python class `PG_LOSS` described below. Class description: POLICY GRADIENTS LOSS FUNCTION Method signatures and docstrings: - def __init__(self, trajectory_length, simulations, max_ent=0, TRPO=0, PPO=0, beta=None): INITIALIZATIONS - def forward(self, policy, state_tensor, action_tensor, reward_tensor, c...
Implement the Python class `PG_LOSS` described below. Class description: POLICY GRADIENTS LOSS FUNCTION Method signatures and docstrings: - def __init__(self, trajectory_length, simulations, max_ent=0, TRPO=0, PPO=0, beta=None): INITIALIZATIONS - def forward(self, policy, state_tensor, action_tensor, reward_tensor, c...
5790d3b3214dcf60657a92149162511d12cdfea7
<|skeleton|> class PG_LOSS: """POLICY GRADIENTS LOSS FUNCTION""" def __init__(self, trajectory_length, simulations, max_ent=0, TRPO=0, PPO=0, beta=None): """INITIALIZATIONS""" <|body_0|> def forward(self, policy, state_tensor, action_tensor, reward_tensor, cumulative_rollout): """C...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PG_LOSS: """POLICY GRADIENTS LOSS FUNCTION""" def __init__(self, trajectory_length, simulations, max_ent=0, TRPO=0, PPO=0, beta=None): """INITIALIZATIONS""" super(PG_LOSS, self).__init__() self.simulations = simulations self.trajectory_length = trajectory_length se...
the_stack_v2_python_sparse
Vanilla Policy Gradients/objective_function.py
WilderLavington/Probabalistic_RL
train
1
9321b297db24abbafe12bf8e629a626aae4868fb
[ "if not nums:\n return [[]]\nres = []\nself.helper(res, [], nums)\nreturn res", "total.append(part)\nif len(nums) == 1:\n total.append(part + [nums[0]])\n return\nfor i, e in enumerate(nums):\n self.helper(total, part + [e], nums[i + 1:])" ]
<|body_start_0|> if not nums: return [[]] res = [] self.helper(res, [], nums) return res <|end_body_0|> <|body_start_1|> total.append(part) if len(nums) == 1: total.append(part + [nums[0]]) return for i, e in enumerate(nums): ...
Solution description
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """Solution description""" def func(self, nums): """Solution function description""" <|body_0|> def helper(self, total, part, nums): """Solution function description""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not nums: ...
stack_v2_sparse_classes_10k_train_000683
795
permissive
[ { "docstring": "Solution function description", "name": "func", "signature": "def func(self, nums)" }, { "docstring": "Solution function description", "name": "helper", "signature": "def helper(self, total, part, nums)" } ]
2
stack_v2_sparse_classes_30k_train_004705
Implement the Python class `Solution` described below. Class description: Solution description Method signatures and docstrings: - def func(self, nums): Solution function description - def helper(self, total, part, nums): Solution function description
Implement the Python class `Solution` described below. Class description: Solution description Method signatures and docstrings: - def func(self, nums): Solution function description - def helper(self, total, part, nums): Solution function description <|skeleton|> class Solution: """Solution description""" ...
869ee24c50c08403b170e8f7868699185e9dfdd1
<|skeleton|> class Solution: """Solution description""" def func(self, nums): """Solution function description""" <|body_0|> def helper(self, total, part, nums): """Solution function description""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: """Solution description""" def func(self, nums): """Solution function description""" if not nums: return [[]] res = [] self.helper(res, [], nums) return res def helper(self, total, part, nums): """Solution function description""" ...
the_stack_v2_python_sparse
78.Subsets/2.py
cerebrumaize/leetcode
train
0
8ee7b1947e3933d394e8244375cea3e346504307
[ "print('***DEBUG PARAMS PARAMS: |%s|' % param)\nparam = param[0]\nif param.get('getFields'):\n return [{'name': {'type': 'string'}}]\nsearch_args = []\np_name = param.get('p_name')\nif p_name:\n search_args.extend([('name', 'ilike', p_name)])\nids = self.search(cr, uid, search_args)\nresult = []\nfor partner ...
<|body_start_0|> print('***DEBUG PARAMS PARAMS: |%s|' % param) param = param[0] if param.get('getFields'): return [{'name': {'type': 'string'}}] search_args = [] p_name = param.get('p_name') if p_name: search_args.extend([('name', 'ilike', p_name)]...
res_partner
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class res_partner: def report_custom_data_params(self, cr, uid, *param): """Custom data method for 'params' report. 'param' is a tuple where the first element is a dict with any report parameters (keyed by the parameter name) and other environmental info. In this example the report has a singl...
stack_v2_sparse_classes_10k_train_000684
2,925
no_license
[ { "docstring": "Custom data method for 'params' report. 'param' is a tuple where the first element is a dict with any report parameters (keyed by the parameter name) and other environmental info. In this example the report has a single defined parameter 'p_name' which is a string. The code below uses 'ilike' to...
2
stack_v2_sparse_classes_30k_test_000160
Implement the Python class `res_partner` described below. Class description: Implement the res_partner class. Method signatures and docstrings: - def report_custom_data_params(self, cr, uid, *param): Custom data method for 'params' report. 'param' is a tuple where the first element is a dict with any report parameter...
Implement the Python class `res_partner` described below. Class description: Implement the res_partner class. Method signatures and docstrings: - def report_custom_data_params(self, cr, uid, *param): Custom data method for 'params' report. 'param' is a tuple where the first element is a dict with any report parameter...
7f36c019ed5405bfdff809c43ae74fb369cd1fd6
<|skeleton|> class res_partner: def report_custom_data_params(self, cr, uid, *param): """Custom data method for 'params' report. 'param' is a tuple where the first element is a dict with any report parameters (keyed by the parameter name) and other environmental info. In this example the report has a singl...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class res_partner: def report_custom_data_params(self, cr, uid, *param): """Custom data method for 'params' report. 'param' is a tuple where the first element is a dict with any report parameters (keyed by the parameter name) and other environmental info. In this example the report has a single defined para...
the_stack_v2_python_sparse
dme_pentaho_example/models/res_partner.py
turbodavid/dme
train
0
0f645ee91782f286c68d418dd060752e7354a76d
[ "self._host = host\nself._port = port\nself._dsmr_version = dsmr_version\nself._telegram = {}", "if obis_ref.EQUIPMENT_IDENTIFIER in self._telegram:\n dsmr_object = self._telegram[obis_ref.EQUIPMENT_IDENTIFIER]\n return getattr(dsmr_object, 'value', None)", "if obis_ref.EQUIPMENT_IDENTIFIER_GAS in self._t...
<|body_start_0|> self._host = host self._port = port self._dsmr_version = dsmr_version self._telegram = {} <|end_body_0|> <|body_start_1|> if obis_ref.EQUIPMENT_IDENTIFIER in self._telegram: dsmr_object = self._telegram[obis_ref.EQUIPMENT_IDENTIFIER] retu...
Test the connection to DSMR and receive telegram to read serial ids.
DSMRConnection
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DSMRConnection: """Test the connection to DSMR and receive telegram to read serial ids.""" def __init__(self, host, port, dsmr_version): """Initialize.""" <|body_0|> def equipment_identifier(self): """Equipment identifier.""" <|body_1|> def equipment...
stack_v2_sparse_classes_10k_train_000685
6,055
permissive
[ { "docstring": "Initialize.", "name": "__init__", "signature": "def __init__(self, host, port, dsmr_version)" }, { "docstring": "Equipment identifier.", "name": "equipment_identifier", "signature": "def equipment_identifier(self)" }, { "docstring": "Equipment identifier gas.", ...
4
stack_v2_sparse_classes_30k_train_003344
Implement the Python class `DSMRConnection` described below. Class description: Test the connection to DSMR and receive telegram to read serial ids. Method signatures and docstrings: - def __init__(self, host, port, dsmr_version): Initialize. - def equipment_identifier(self): Equipment identifier. - def equipment_ide...
Implement the Python class `DSMRConnection` described below. Class description: Test the connection to DSMR and receive telegram to read serial ids. Method signatures and docstrings: - def __init__(self, host, port, dsmr_version): Initialize. - def equipment_identifier(self): Equipment identifier. - def equipment_ide...
ed4ab403deaed9e8c95e0db728477fcb012bf4fa
<|skeleton|> class DSMRConnection: """Test the connection to DSMR and receive telegram to read serial ids.""" def __init__(self, host, port, dsmr_version): """Initialize.""" <|body_0|> def equipment_identifier(self): """Equipment identifier.""" <|body_1|> def equipment...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DSMRConnection: """Test the connection to DSMR and receive telegram to read serial ids.""" def __init__(self, host, port, dsmr_version): """Initialize.""" self._host = host self._port = port self._dsmr_version = dsmr_version self._telegram = {} def equipment_i...
the_stack_v2_python_sparse
homeassistant/components/dsmr/config_flow.py
tchellomello/home-assistant
train
8
60171a16cd96548f1768ae642e4e5494d52933c3
[ "ret = 0\nif len(A) < 3:\n return ret\nstart, end = (0, 1)\nwhile end < len(A):\n if A[end] <= A[start]:\n start = end\n end += 1\n else:\n peak = end + 1\n while peak < len(A) and A[peak] > A[peak - 1]:\n peak += 1\n peak -= 1\n end = peak + 1\n ...
<|body_start_0|> ret = 0 if len(A) < 3: return ret start, end = (0, 1) while end < len(A): if A[end] <= A[start]: start = end end += 1 else: peak = end + 1 while peak < len(A) and A[peak] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestMountain(self, A): """:type A: List[int] :rtype: int""" <|body_0|> def longestMountain2(self, A): """:type A: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> ret = 0 if len(A) < 3: retur...
stack_v2_sparse_classes_10k_train_000686
2,431
no_license
[ { "docstring": ":type A: List[int] :rtype: int", "name": "longestMountain", "signature": "def longestMountain(self, A)" }, { "docstring": ":type A: List[int] :rtype: int", "name": "longestMountain2", "signature": "def longestMountain2(self, A)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestMountain(self, A): :type A: List[int] :rtype: int - def longestMountain2(self, A): :type A: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestMountain(self, A): :type A: List[int] :rtype: int - def longestMountain2(self, A): :type A: List[int] :rtype: int <|skeleton|> class Solution: def longestMountai...
9190d3d178f1733aa226973757ee7e045b7bab00
<|skeleton|> class Solution: def longestMountain(self, A): """:type A: List[int] :rtype: int""" <|body_0|> def longestMountain2(self, A): """:type A: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def longestMountain(self, A): """:type A: List[int] :rtype: int""" ret = 0 if len(A) < 3: return ret start, end = (0, 1) while end < len(A): if A[end] <= A[start]: start = end end += 1 else: ...
the_stack_v2_python_sparse
LongestMountainInArray.py
ellinx/LC-python
train
1
ed94486254899116b94770c0259e0fb6dc50c06d
[ "data_list = []\nresults = self.query.all()\nformatter = date.getLocaleFormatter(self.request, 'date', 'long')\nfor result in results:\n data = {}\n data['qid'] = 'm_' + str(result.motion_id)\n data['subject'] = u'M ' + str(result.motion_number) + u' ' + result.short_name\n data['title'] = result.short_...
<|body_start_0|> data_list = [] results = self.query.all() formatter = date.getLocaleFormatter(self.request, 'date', 'long') for result in results: data = {} data['qid'] = 'm_' + str(result.motion_id) data['subject'] = u'M ' + str(result.motion_number)...
MotionInStateViewlet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MotionInStateViewlet: def _setData(self): """return the data of the query""" <|body_0|> def update(self): """refresh the query""" <|body_1|> <|end_skeleton|> <|body_start_0|> data_list = [] results = self.query.all() formatter = date...
stack_v2_sparse_classes_10k_train_000687
27,657
no_license
[ { "docstring": "return the data of the query", "name": "_setData", "signature": "def _setData(self)" }, { "docstring": "refresh the query", "name": "update", "signature": "def update(self)" } ]
2
stack_v2_sparse_classes_30k_train_003982
Implement the Python class `MotionInStateViewlet` described below. Class description: Implement the MotionInStateViewlet class. Method signatures and docstrings: - def _setData(self): return the data of the query - def update(self): refresh the query
Implement the Python class `MotionInStateViewlet` described below. Class description: Implement the MotionInStateViewlet class. Method signatures and docstrings: - def _setData(self): return the data of the query - def update(self): refresh the query <|skeleton|> class MotionInStateViewlet: def _setData(self): ...
5cf0ba31dfbff8d2c1b4aa8ab6f69c7a0ae9870d
<|skeleton|> class MotionInStateViewlet: def _setData(self): """return the data of the query""" <|body_0|> def update(self): """refresh the query""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MotionInStateViewlet: def _setData(self): """return the data of the query""" data_list = [] results = self.query.all() formatter = date.getLocaleFormatter(self.request, 'date', 'long') for result in results: data = {} data['qid'] = 'm_' + str(res...
the_stack_v2_python_sparse
bungeni.main/branches/mr/bungeni/ui/viewlets/workspace.py
malangalanga/bungeni-portal
train
0
d467e4aad74e0b846830603633fb678cca505b25
[ "super().__init__()\nself.conv = torch.nn.Conv1d(idim, odim, kernel_size, stride=stride, dilation=dilation, groups=groups, bias=bias)\nself.dropout = torch.nn.Dropout(p=dropout_rate)\nif relu:\n self.relu_func = torch.nn.ReLU()\nif batch_norm:\n self.bn = torch.nn.BatchNorm1d(odim)\nself.relu = relu\nself.bat...
<|body_start_0|> super().__init__() self.conv = torch.nn.Conv1d(idim, odim, kernel_size, stride=stride, dilation=dilation, groups=groups, bias=bias) self.dropout = torch.nn.Dropout(p=dropout_rate) if relu: self.relu_func = torch.nn.ReLU() if batch_norm: se...
1D convolution module for custom encoder. Args: idim: Input dimension. odim: Output dimension. kernel_size: Size of the convolving kernel. stride: Stride of the convolution. dilation: Spacing between the kernel points. groups: Number of blocked connections from input channels to output channels. bias: Whether to add a ...
Conv1d
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Conv1d: """1D convolution module for custom encoder. Args: idim: Input dimension. odim: Output dimension. kernel_size: Size of the convolving kernel. stride: Stride of the convolution. dilation: Spacing between the kernel points. groups: Number of blocked connections from input channels to output...
stack_v2_sparse_classes_10k_train_000688
7,246
permissive
[ { "docstring": "Construct a Conv1d module object.", "name": "__init__", "signature": "def __init__(self, idim: int, odim: int, kernel_size: Union[int, Tuple], stride: Union[int, Tuple]=1, dilation: Union[int, Tuple]=1, groups: Union[int, Tuple]=1, bias: bool=True, batch_norm: bool=False, relu: bool=True...
4
stack_v2_sparse_classes_30k_train_002277
Implement the Python class `Conv1d` described below. Class description: 1D convolution module for custom encoder. Args: idim: Input dimension. odim: Output dimension. kernel_size: Size of the convolving kernel. stride: Stride of the convolution. dilation: Spacing between the kernel points. groups: Number of blocked co...
Implement the Python class `Conv1d` described below. Class description: 1D convolution module for custom encoder. Args: idim: Input dimension. odim: Output dimension. kernel_size: Size of the convolving kernel. stride: Stride of the convolution. dilation: Spacing between the kernel points. groups: Number of blocked co...
bcd20948db7846ee523443ef9fd78c7a1248c95e
<|skeleton|> class Conv1d: """1D convolution module for custom encoder. Args: idim: Input dimension. odim: Output dimension. kernel_size: Size of the convolving kernel. stride: Stride of the convolution. dilation: Spacing between the kernel points. groups: Number of blocked connections from input channels to output...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Conv1d: """1D convolution module for custom encoder. Args: idim: Input dimension. odim: Output dimension. kernel_size: Size of the convolving kernel. stride: Stride of the convolution. dilation: Spacing between the kernel points. groups: Number of blocked connections from input channels to output channels. bi...
the_stack_v2_python_sparse
espnet/nets/pytorch_backend/transducer/conv1d_nets.py
espnet/espnet
train
7,242
3529772f5f0d5a938dfb56da9dce974eb1930df3
[ "globalsettings = sublime.load_settings('Preferences.sublime-settings')\nsettings = sublime.load_settings('AnacondaKite.sublime-settings')\nenabled = settings.get('integrate_with_kite', False)\nnot_ignored = 'Kite' not in globalsettings.get('ignored_packages')\nif enabled and not_ignored:\n try:\n from Ki...
<|body_start_0|> globalsettings = sublime.load_settings('Preferences.sublime-settings') settings = sublime.load_settings('AnacondaKite.sublime-settings') enabled = settings.get('integrate_with_kite', False) not_ignored = 'Kite' not in globalsettings.get('ignored_packages') if ena...
Checks if Kite integration is turned on
Integration
[ "MIT", "GPL-1.0-or-later", "LGPL-2.1-or-later", "GPL-3.0-only", "LicenseRef-scancode-warranty-disclaimer", "GPL-3.0-or-later", "LGPL-2.0-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Integration: """Checks if Kite integration is turned on""" def enabled(cls): """Returns True if Kite integration is enabled""" <|body_0|> def enable(cls): """Enable Kite integration""" <|body_1|> def disable(cls): """Disable Kite integration"...
stack_v2_sparse_classes_10k_train_000689
1,521
permissive
[ { "docstring": "Returns True if Kite integration is enabled", "name": "enabled", "signature": "def enabled(cls)" }, { "docstring": "Enable Kite integration", "name": "enable", "signature": "def enable(cls)" }, { "docstring": "Disable Kite integration", "name": "disable", ...
3
stack_v2_sparse_classes_30k_train_002325
Implement the Python class `Integration` described below. Class description: Checks if Kite integration is turned on Method signatures and docstrings: - def enabled(cls): Returns True if Kite integration is enabled - def enable(cls): Enable Kite integration - def disable(cls): Disable Kite integration
Implement the Python class `Integration` described below. Class description: Checks if Kite integration is turned on Method signatures and docstrings: - def enabled(cls): Returns True if Kite integration is enabled - def enable(cls): Enable Kite integration - def disable(cls): Disable Kite integration <|skeleton|> c...
9a3808d0d79504b488a407084b489b9d687a528a
<|skeleton|> class Integration: """Checks if Kite integration is turned on""" def enabled(cls): """Returns True if Kite integration is enabled""" <|body_0|> def enable(cls): """Enable Kite integration""" <|body_1|> def disable(cls): """Disable Kite integration"...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Integration: """Checks if Kite integration is turned on""" def enabled(cls): """Returns True if Kite integration is enabled""" globalsettings = sublime.load_settings('Preferences.sublime-settings') settings = sublime.load_settings('AnacondaKite.sublime-settings') enabled =...
the_stack_v2_python_sparse
sublime/Packages/Anaconda/anaconda_lib/kite.py
Kisura/dotfiles
train
0
9997f09387522570e5cfb1369655a98206fcf4bb
[ "self.product_code = product_code\nself.description = description\nself.market_price = market_price\nself.rental_price = rental_price", "output_dict = {}\noutput_dict['productCode'] = self.product_code\noutput_dict['description'] = self.description\noutput_dict['marketPrice'] = self.market_price\noutput_dict['ren...
<|body_start_0|> self.product_code = product_code self.description = description self.market_price = market_price self.rental_price = rental_price <|end_body_0|> <|body_start_1|> output_dict = {} output_dict['productCode'] = self.product_code output_dict['descrip...
inventory base class
Inventory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Inventory: """inventory base class""" def __init__(self, product_code, description, market_price, rental_price): """initializing""" <|body_0|> def return_as_dictionary(self): """returns a dictionary""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_000690
772
no_license
[ { "docstring": "initializing", "name": "__init__", "signature": "def __init__(self, product_code, description, market_price, rental_price)" }, { "docstring": "returns a dictionary", "name": "return_as_dictionary", "signature": "def return_as_dictionary(self)" } ]
2
stack_v2_sparse_classes_30k_train_000427
Implement the Python class `Inventory` described below. Class description: inventory base class Method signatures and docstrings: - def __init__(self, product_code, description, market_price, rental_price): initializing - def return_as_dictionary(self): returns a dictionary
Implement the Python class `Inventory` described below. Class description: inventory base class Method signatures and docstrings: - def __init__(self, product_code, description, market_price, rental_price): initializing - def return_as_dictionary(self): returns a dictionary <|skeleton|> class Inventory: """inven...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class Inventory: """inventory base class""" def __init__(self, product_code, description, market_price, rental_price): """initializing""" <|body_0|> def return_as_dictionary(self): """returns a dictionary""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Inventory: """inventory base class""" def __init__(self, product_code, description, market_price, rental_price): """initializing""" self.product_code = product_code self.description = description self.market_price = market_price self.rental_price = rental_price ...
the_stack_v2_python_sparse
students/humberto_gonzalez/lesson01/inventory_management/inventory_class.py
JavaRod/SP_Python220B_2019
train
1
4b83163dd1d632ad4e4d61fef5d6cd547ed515f9
[ "self.transform_types: Dict[str, List[str]] = {'str': ['interpolation', 'dtype', 'label_file', 'vocab_file'], 'int': ['x', 'y', 'height', 'width', 'offset_height', 'offset_width', 'target_height', 'target_width', 'dim', 'resize_side', 'label_shift'], 'float': ['scale', 'central_fraction'], 'list<float>': ['mean', '...
<|body_start_0|> self.transform_types: Dict[str, List[str]] = {'str': ['interpolation', 'dtype', 'label_file', 'vocab_file'], 'int': ['x', 'y', 'height', 'width', 'offset_height', 'offset_width', 'target_height', 'target_width', 'dim', 'resize_side', 'label_shift'], 'float': ['scale', 'central_fraction'], 'list...
Configuration type parser class.
ConfigurationParser
[ "MIT", "Intel", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConfigurationParser: """Configuration type parser class.""" def __init__(self) -> None: """Initialize configuration type parser.""" <|body_0|> def parse(self, data: dict) -> dict: """Parse configuration.""" <|body_1|> def parse_transforms(self, trans...
stack_v2_sparse_classes_10k_train_000691
9,825
permissive
[ { "docstring": "Initialize configuration type parser.", "name": "__init__", "signature": "def __init__(self) -> None" }, { "docstring": "Parse configuration.", "name": "parse", "signature": "def parse(self, data: dict) -> dict" }, { "docstring": "Parse transforms list.", "nam...
6
stack_v2_sparse_classes_30k_train_000881
Implement the Python class `ConfigurationParser` described below. Class description: Configuration type parser class. Method signatures and docstrings: - def __init__(self) -> None: Initialize configuration type parser. - def parse(self, data: dict) -> dict: Parse configuration. - def parse_transforms(self, transform...
Implement the Python class `ConfigurationParser` described below. Class description: Configuration type parser class. Method signatures and docstrings: - def __init__(self) -> None: Initialize configuration type parser. - def parse(self, data: dict) -> dict: Parse configuration. - def parse_transforms(self, transform...
3976edc4215398e69ce0213f87ec295f5dc96e0e
<|skeleton|> class ConfigurationParser: """Configuration type parser class.""" def __init__(self) -> None: """Initialize configuration type parser.""" <|body_0|> def parse(self, data: dict) -> dict: """Parse configuration.""" <|body_1|> def parse_transforms(self, trans...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ConfigurationParser: """Configuration type parser class.""" def __init__(self) -> None: """Initialize configuration type parser.""" self.transform_types: Dict[str, List[str]] = {'str': ['interpolation', 'dtype', 'label_file', 'vocab_file'], 'int': ['x', 'y', 'height', 'width', 'offset_hei...
the_stack_v2_python_sparse
neural_compressor/ux/components/configuration_wizard/configuration_parser.py
Skp80/neural-compressor
train
0
692b526d309f5dc65e96b4fa97641b156035f350
[ "if criteria is None:\n criteria = {}\nself.trials = get_trials(base_dir, criteria=criteria)\nassert len(self.trials) > 0, 'Nothing loaded.'\nself.label = 'AverageReturn'", "if criteria is None:\n criteria = {}\nreturn [trial for trial in self.trials if matches_dict(criteria, trial.variant)]" ]
<|body_start_0|> if criteria is None: criteria = {} self.trials = get_trials(base_dir, criteria=criteria) assert len(self.trials) > 0, 'Nothing loaded.' self.label = 'AverageReturn' <|end_body_0|> <|body_start_1|> if criteria is None: criteria = {} ...
Represents an experiment, which consists of many Trials.
Experiment
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Experiment: """Represents an experiment, which consists of many Trials.""" def __init__(self, base_dir, criteria=None): """:param base_dir: A path. Directory structure should be something like: ``` base_dir/ foo/ bar/ arbtrarily_deep/ trial_one/ variant.json progress.csv trial_two/ v...
stack_v2_sparse_classes_10k_train_000692
5,929
permissive
[ { "docstring": ":param base_dir: A path. Directory structure should be something like: ``` base_dir/ foo/ bar/ arbtrarily_deep/ trial_one/ variant.json progress.csv trial_two/ variant.json progress.csv trial_three/ variant.json progress.csv ... variant.json # <-- base_dir/foo/bar has its own Trial progress.csv ...
2
stack_v2_sparse_classes_30k_train_001520
Implement the Python class `Experiment` described below. Class description: Represents an experiment, which consists of many Trials. Method signatures and docstrings: - def __init__(self, base_dir, criteria=None): :param base_dir: A path. Directory structure should be something like: ``` base_dir/ foo/ bar/ arbtraril...
Implement the Python class `Experiment` described below. Class description: Represents an experiment, which consists of many Trials. Method signatures and docstrings: - def __init__(self, base_dir, criteria=None): :param base_dir: A path. Directory structure should be something like: ``` base_dir/ foo/ bar/ arbtraril...
baba8ce634d32a48c7dfe4dc03b123e18e96e0a3
<|skeleton|> class Experiment: """Represents an experiment, which consists of many Trials.""" def __init__(self, base_dir, criteria=None): """:param base_dir: A path. Directory structure should be something like: ``` base_dir/ foo/ bar/ arbtrarily_deep/ trial_one/ variant.json progress.csv trial_two/ v...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Experiment: """Represents an experiment, which consists of many Trials.""" def __init__(self, base_dir, criteria=None): """:param base_dir: A path. Directory structure should be something like: ``` base_dir/ foo/ bar/ arbtrarily_deep/ trial_one/ variant.json progress.csv trial_two/ variant.json p...
the_stack_v2_python_sparse
rlkit/misc/data_processing.py
Asap7772/railrl_evalsawyer
train
1
d870bc14e27f410951e7876aeb88f69f19ec363f
[ "self.require_collection()\nrequest = http.Request('POST', self.get_url(), self.wrap_object(text))\nreturn (request, parsers.parse_json)", "self.require_item()\nrequest = http.Request('PUT', self.get_url(), self.wrap_object(text))\nreturn (request, parsers.parse_json)" ]
<|body_start_0|> self.require_collection() request = http.Request('POST', self.get_url(), self.wrap_object(text)) return (request, parsers.parse_json) <|end_body_0|> <|body_start_1|> self.require_item() request = http.Request('PUT', self.get_url(), self.wrap_object(text)) ...
UserVoiceTextResource
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserVoiceTextResource: def create(self, text): """Create a new resource. :var text: the text of the resource to be created. :vartype text: str""" <|body_0|> def update(self, text): """Update this resource. :var text: the new text of the resource. :vartype text: str""...
stack_v2_sparse_classes_10k_train_000693
2,920
permissive
[ { "docstring": "Create a new resource. :var text: the text of the resource to be created. :vartype text: str", "name": "create", "signature": "def create(self, text)" }, { "docstring": "Update this resource. :var text: the new text of the resource. :vartype text: str", "name": "update", ...
2
null
Implement the Python class `UserVoiceTextResource` described below. Class description: Implement the UserVoiceTextResource class. Method signatures and docstrings: - def create(self, text): Create a new resource. :var text: the text of the resource to be created. :vartype text: str - def update(self, text): Update th...
Implement the Python class `UserVoiceTextResource` described below. Class description: Implement the UserVoiceTextResource class. Method signatures and docstrings: - def create(self, text): Create a new resource. :var text: the text of the resource to be created. :vartype text: str - def update(self, text): Update th...
25caa745a104c8dc209584fa359294c65dbf88bb
<|skeleton|> class UserVoiceTextResource: def create(self, text): """Create a new resource. :var text: the text of the resource to be created. :vartype text: str""" <|body_0|> def update(self, text): """Update this resource. :var text: the new text of the resource. :vartype text: str""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UserVoiceTextResource: def create(self, text): """Create a new resource. :var text: the text of the resource to be created. :vartype text: str""" self.require_collection() request = http.Request('POST', self.get_url(), self.wrap_object(text)) return (request, parsers.parse_json...
the_stack_v2_python_sparse
libsaas/services/uservoice/resource.py
piplcom/libsaas
train
1
1abea7b3f0164561422c7c796110264f1979584a
[ "if not root:\n return TreeNode(val)\ncur_node = root\npre_node = root\nwhile cur_node:\n pre_node = cur_node\n if cur_node.val < val:\n cur_node = cur_node.right\n else:\n cur_node = cur_node.left\nnew_node = TreeNode(val)\nif pre_node.val > val:\n pre_node.left = new_node\nelse:\n ...
<|body_start_0|> if not root: return TreeNode(val) cur_node = root pre_node = root while cur_node: pre_node = cur_node if cur_node.val < val: cur_node = cur_node.right else: cur_node = cur_node.left n...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def insertIntoBST(self, root: TreeNode, val: int) -> TreeNode: """遍历方式,找到合适的叶子节点,插入 :param root: :param val: :return:""" <|body_0|> def insertIntoBST1(self, root: TreeNode, val: int) -> TreeNode: """递归算法 :param root: :param val: :return:""" <|body_1...
stack_v2_sparse_classes_10k_train_000694
1,691
no_license
[ { "docstring": "遍历方式,找到合适的叶子节点,插入 :param root: :param val: :return:", "name": "insertIntoBST", "signature": "def insertIntoBST(self, root: TreeNode, val: int) -> TreeNode" }, { "docstring": "递归算法 :param root: :param val: :return:", "name": "insertIntoBST1", "signature": "def insertIntoBS...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def insertIntoBST(self, root: TreeNode, val: int) -> TreeNode: 遍历方式,找到合适的叶子节点,插入 :param root: :param val: :return: - def insertIntoBST1(self, root: TreeNode, val: int) -> TreeNod...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def insertIntoBST(self, root: TreeNode, val: int) -> TreeNode: 遍历方式,找到合适的叶子节点,插入 :param root: :param val: :return: - def insertIntoBST1(self, root: TreeNode, val: int) -> TreeNod...
9acba92695c06406f12f997a720bfe1deb9464a8
<|skeleton|> class Solution: def insertIntoBST(self, root: TreeNode, val: int) -> TreeNode: """遍历方式,找到合适的叶子节点,插入 :param root: :param val: :return:""" <|body_0|> def insertIntoBST1(self, root: TreeNode, val: int) -> TreeNode: """递归算法 :param root: :param val: :return:""" <|body_1...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def insertIntoBST(self, root: TreeNode, val: int) -> TreeNode: """遍历方式,找到合适的叶子节点,插入 :param root: :param val: :return:""" if not root: return TreeNode(val) cur_node = root pre_node = root while cur_node: pre_node = cur_node i...
the_stack_v2_python_sparse
datastructure/binary_search_tree/InsertIntoBST.py
yinhuax/leet_code
train
0
0c8dbca23cac908046cf4b261aa2d4d0d57964ba
[ "add_tuple, error_tuple = database.import_data('csv_files', 'products.csv', 'customers.csv', 'rentals.csv')\nself.assertEqual(add_tuple, (3, 3, 5))\nself.assertEqual(error_tuple, (0, 0, 0))\nadd_tuple, error_tuple = database.import_data('csv_files', 'products1.csv', 'customers1.csv', 'rentals1.csv')\nself.assertEqu...
<|body_start_0|> add_tuple, error_tuple = database.import_data('csv_files', 'products.csv', 'customers.csv', 'rentals.csv') self.assertEqual(add_tuple, (3, 3, 5)) self.assertEqual(error_tuple, (0, 0, 0)) add_tuple, error_tuple = database.import_data('csv_files', 'products1.csv', 'custome...
Define a class for testing database functions
DatabaseTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatabaseTests: """Define a class for testing database functions""" def test_import_data(self): """Test importing data from csv files""" <|body_0|> def test_show_available_products(self): """Test showing available products""" <|body_1|> def test_show_...
stack_v2_sparse_classes_10k_train_000695
2,440
no_license
[ { "docstring": "Test importing data from csv files", "name": "test_import_data", "signature": "def test_import_data(self)" }, { "docstring": "Test showing available products", "name": "test_show_available_products", "signature": "def test_show_available_products(self)" }, { "docs...
3
null
Implement the Python class `DatabaseTests` described below. Class description: Define a class for testing database functions Method signatures and docstrings: - def test_import_data(self): Test importing data from csv files - def test_show_available_products(self): Test showing available products - def test_show_rent...
Implement the Python class `DatabaseTests` described below. Class description: Define a class for testing database functions Method signatures and docstrings: - def test_import_data(self): Test importing data from csv files - def test_show_available_products(self): Test showing available products - def test_show_rent...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class DatabaseTests: """Define a class for testing database functions""" def test_import_data(self): """Test importing data from csv files""" <|body_0|> def test_show_available_products(self): """Test showing available products""" <|body_1|> def test_show_...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DatabaseTests: """Define a class for testing database functions""" def test_import_data(self): """Test importing data from csv files""" add_tuple, error_tuple = database.import_data('csv_files', 'products.csv', 'customers.csv', 'rentals.csv') self.assertEqual(add_tuple, (3, 3, 5))...
the_stack_v2_python_sparse
students/bcoates/lesson05/test_database.py
JavaRod/SP_Python220B_2019
train
1
1756ea43dc98dc035a6c13be858c9d6390111b92
[ "from math import sqrt\nself.min_instances = min_instances\nself.drift_level = float(drift_level)\nself.i = None\nself.pi = None\nself.si = None\nself.pi_min = None\nself.si_min = None\nself.sqrt = sqrt\nself.reset()", "self.i = 0\nself.pi = 1.0\nself.si = 0.0\nself.pi_min = float('inf')\nself.si_min = float('inf...
<|body_start_0|> from math import sqrt self.min_instances = min_instances self.drift_level = float(drift_level) self.i = None self.pi = None self.si = None self.pi_min = None self.si_min = None self.sqrt = sqrt self.reset() <|end_body_0|> ...
Implements the DDM drift detection method. This drift detector is based on the paper on the DDM Paper (João Gama, Pedro Medas, Gladys Castillo, Pedro Pereira Rodrigues: Learning with Drift Detection. SBIA 2004: 286-295). We keep the highest alarm level of drift detection (out of control), leaving out warning level. Att...
DDM
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DDM: """Implements the DDM drift detection method. This drift detector is based on the paper on the DDM Paper (João Gama, Pedro Medas, Gladys Castillo, Pedro Pereira Rodrigues: Learning with Drift Detection. SBIA 2004: 286-295). We keep the highest alarm level of drift detection (out of control),...
stack_v2_sparse_classes_10k_train_000696
3,161
no_license
[ { "docstring": "Initialize the DDM Drift Detector Initialize the DDM Drift detector. Default parameters are provided as well. Args: min_instances: INT. Minimum number of instances for Detector to return a result. drift_level: Alarm level for drift detector. 3.0 is from the DDM paper. 2.0 would be for drift warn...
3
stack_v2_sparse_classes_30k_train_001141
Implement the Python class `DDM` described below. Class description: Implements the DDM drift detection method. This drift detector is based on the paper on the DDM Paper (João Gama, Pedro Medas, Gladys Castillo, Pedro Pereira Rodrigues: Learning with Drift Detection. SBIA 2004: 286-295). We keep the highest alarm lev...
Implement the Python class `DDM` described below. Class description: Implements the DDM drift detection method. This drift detector is based on the paper on the DDM Paper (João Gama, Pedro Medas, Gladys Castillo, Pedro Pereira Rodrigues: Learning with Drift Detection. SBIA 2004: 286-295). We keep the highest alarm lev...
4938936dbf08b5331275d4413dbad51acbaf7da9
<|skeleton|> class DDM: """Implements the DDM drift detection method. This drift detector is based on the paper on the DDM Paper (João Gama, Pedro Medas, Gladys Castillo, Pedro Pereira Rodrigues: Learning with Drift Detection. SBIA 2004: 286-295). We keep the highest alarm level of drift detection (out of control),...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DDM: """Implements the DDM drift detection method. This drift detector is based on the paper on the DDM Paper (João Gama, Pedro Medas, Gladys Castillo, Pedro Pereira Rodrigues: Learning with Drift Detection. SBIA 2004: 286-295). We keep the highest alarm level of drift detection (out of control), leaving out ...
the_stack_v2_python_sparse
mlep_odin_main/mlep/mlep/drift_detector/LabeledDriftDetector/DDM.py
asuprem/ODIN
train
7
c6bbbc932da09ce1eacb63de1c7b238510195e60
[ "row = index / columns\ncolumn = index - row * columns\nreturn (row, column)", "if len(matrix) == 0 or len(matrix[0]) == 0:\n return False\nrows = len(matrix)\ncolumns = len(matrix[0])\nleft, right = (0, rows * columns - 1)\nwhile left <= right:\n middle = (left + right) / 2\n row, column = self.one_d_to...
<|body_start_0|> row = index / columns column = index - row * columns return (row, column) <|end_body_0|> <|body_start_1|> if len(matrix) == 0 or len(matrix[0]) == 0: return False rows = len(matrix) columns = len(matrix[0]) left, right = (0, rows * co...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def one_d_to_two_d_index(self, index, columns): """>>> s = Solution() >>> s.one_d_to_two_d_index(0, 3, 4) (0, 0) >>> s.one_d_to_two_d_index(11, 3, 4) (2, 3) >>> s.one_d_to_two_d_index(5, 3, 4) (1, 1) >>> s.one_d_to_two_d_index(4, 3, 4) (1, 0) >>> s.one_d_to_two_d_index(8, 3, 4)...
stack_v2_sparse_classes_10k_train_000697
1,790
no_license
[ { "docstring": ">>> s = Solution() >>> s.one_d_to_two_d_index(0, 3, 4) (0, 0) >>> s.one_d_to_two_d_index(11, 3, 4) (2, 3) >>> s.one_d_to_two_d_index(5, 3, 4) (1, 1) >>> s.one_d_to_two_d_index(4, 3, 4) (1, 0) >>> s.one_d_to_two_d_index(8, 3, 4) (2, 0) >>> s.one_d_to_two_d_index(7, 3, 4) (1, 3)", "name": "one...
2
stack_v2_sparse_classes_30k_train_006980
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def one_d_to_two_d_index(self, index, columns): >>> s = Solution() >>> s.one_d_to_two_d_index(0, 3, 4) (0, 0) >>> s.one_d_to_two_d_index(11, 3, 4) (2, 3) >>> s.one_d_to_two_d_ind...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def one_d_to_two_d_index(self, index, columns): >>> s = Solution() >>> s.one_d_to_two_d_index(0, 3, 4) (0, 0) >>> s.one_d_to_two_d_index(11, 3, 4) (2, 3) >>> s.one_d_to_two_d_ind...
3b13a02f9c8273f9794a57b948d2655792707f37
<|skeleton|> class Solution: def one_d_to_two_d_index(self, index, columns): """>>> s = Solution() >>> s.one_d_to_two_d_index(0, 3, 4) (0, 0) >>> s.one_d_to_two_d_index(11, 3, 4) (2, 3) >>> s.one_d_to_two_d_index(5, 3, 4) (1, 1) >>> s.one_d_to_two_d_index(4, 3, 4) (1, 0) >>> s.one_d_to_two_d_index(8, 3, 4)...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def one_d_to_two_d_index(self, index, columns): """>>> s = Solution() >>> s.one_d_to_two_d_index(0, 3, 4) (0, 0) >>> s.one_d_to_two_d_index(11, 3, 4) (2, 3) >>> s.one_d_to_two_d_index(5, 3, 4) (1, 1) >>> s.one_d_to_two_d_index(4, 3, 4) (1, 0) >>> s.one_d_to_two_d_index(8, 3, 4) (2, 0) >>> s....
the_stack_v2_python_sparse
search_2d_matrix.py
gsy/leetcode
train
1
2d238817366df2702990d6d077524275b689a3a2
[ "Inventory.__init__(self, product_code, description, market_price, rental_price)\nself.material = material\nself.size = size", "output_dict = Inventory.return_as_dictionary(self)\noutput_dict['material'] = self.material\noutput_dict['size'] = self.size\nreturn output_dict" ]
<|body_start_0|> Inventory.__init__(self, product_code, description, market_price, rental_price) self.material = material self.size = size <|end_body_0|> <|body_start_1|> output_dict = Inventory.return_as_dictionary(self) output_dict['material'] = self.material output_di...
Class for creating furniture object, inherits from Inventory class Methods: return_as_dictionary: Convert furniture object to a dictionary with keys for each attribute name and values for attribute value
Furniture
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Furniture: """Class for creating furniture object, inherits from Inventory class Methods: return_as_dictionary: Convert furniture object to a dictionary with keys for each attribute name and values for attribute value""" def __init__(self, product_code, description, market_price, rental_pric...
stack_v2_sparse_classes_10k_train_000698
1,759
no_license
[ { "docstring": "Create instance of furniture object Args: product_code (alphanumeric): Unique product code description (string): Description of product market_price (numeric): Product price rental_price (numeric): Product rental price material (string): Product material size (string): Product size", "name":...
2
null
Implement the Python class `Furniture` described below. Class description: Class for creating furniture object, inherits from Inventory class Methods: return_as_dictionary: Convert furniture object to a dictionary with keys for each attribute name and values for attribute value Method signatures and docstrings: - def...
Implement the Python class `Furniture` described below. Class description: Class for creating furniture object, inherits from Inventory class Methods: return_as_dictionary: Convert furniture object to a dictionary with keys for each attribute name and values for attribute value Method signatures and docstrings: - def...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class Furniture: """Class for creating furniture object, inherits from Inventory class Methods: return_as_dictionary: Convert furniture object to a dictionary with keys for each attribute name and values for attribute value""" def __init__(self, product_code, description, market_price, rental_pric...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Furniture: """Class for creating furniture object, inherits from Inventory class Methods: return_as_dictionary: Convert furniture object to a dictionary with keys for each attribute name and values for attribute value""" def __init__(self, product_code, description, market_price, rental_price, material, ...
the_stack_v2_python_sparse
students/gregdevore/lesson01/assignment/inventory_management/furniture_class.py
JavaRod/SP_Python220B_2019
train
1
cedcf3ef85cc1853886cbbfd65ab0178b77f5ca6
[ "super().__init__()\nself.eps = eps\nself.apply_softmax = apply_softmax\nself.class_weight_power = class_weight_power", "if not torch.is_tensor(output) or not torch.is_tensor(target):\n raise TypeError('Output and target must be torch.Tensors (type(output): {}, type(target): {})'.format(type(output), type(targ...
<|body_start_0|> super().__init__() self.eps = eps self.apply_softmax = apply_softmax self.class_weight_power = class_weight_power <|end_body_0|> <|body_start_1|> if not torch.is_tensor(output) or not torch.is_tensor(target): raise TypeError('Output and target must b...
Implementation of Soft-Dice Loss. Reference: Milletari, F., Navab, N., & Ahmadi, S. (2016). V-Net: Fully Convolutional Neural Networks for Volumetric Medical Image Segmentation. In International Conference on 3D Vision (3DV).
SoftDiceLoss
[ "MIT", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SoftDiceLoss: """Implementation of Soft-Dice Loss. Reference: Milletari, F., Navab, N., & Ahmadi, S. (2016). V-Net: Fully Convolutional Neural Networks for Volumetric Medical Image Segmentation. In International Conference on 3D Vision (3DV).""" def __init__(self, eps: float=1e-10, apply_sof...
stack_v2_sparse_classes_10k_train_000699
4,335
permissive
[ { "docstring": ":param eps: A small constant to smooth Sorensen-Dice Loss function. Additionally, it avoids division by zero. :param apply_softmax: If true, the input to the loss function will be first fed through a Softmax operation. If false, the input to the loss function will be used as is. :param class_wei...
2
null
Implement the Python class `SoftDiceLoss` described below. Class description: Implementation of Soft-Dice Loss. Reference: Milletari, F., Navab, N., & Ahmadi, S. (2016). V-Net: Fully Convolutional Neural Networks for Volumetric Medical Image Segmentation. In International Conference on 3D Vision (3DV). Method signatu...
Implement the Python class `SoftDiceLoss` described below. Class description: Implementation of Soft-Dice Loss. Reference: Milletari, F., Navab, N., & Ahmadi, S. (2016). V-Net: Fully Convolutional Neural Networks for Volumetric Medical Image Segmentation. In International Conference on 3D Vision (3DV). Method signatu...
2877002d50d3a34d80f647c18cb561025d9066cc
<|skeleton|> class SoftDiceLoss: """Implementation of Soft-Dice Loss. Reference: Milletari, F., Navab, N., & Ahmadi, S. (2016). V-Net: Fully Convolutional Neural Networks for Volumetric Medical Image Segmentation. In International Conference on 3D Vision (3DV).""" def __init__(self, eps: float=1e-10, apply_sof...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SoftDiceLoss: """Implementation of Soft-Dice Loss. Reference: Milletari, F., Navab, N., & Ahmadi, S. (2016). V-Net: Fully Convolutional Neural Networks for Volumetric Medical Image Segmentation. In International Conference on 3D Vision (3DV).""" def __init__(self, eps: float=1e-10, apply_softmax: bool=Tr...
the_stack_v2_python_sparse
InnerEye/ML/models/losses/soft_dice.py
microsoft/InnerEye-DeepLearning
train
511