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
9da3d7349e6bac7906d2c0a0fe4ea834bfcdaaf1
[ "if not head:\n return\nhash_table = dict()\ncur = head\nwhile cur:\n node = Node(cur.val)\n hash_table[cur] = node\n cur = cur.next\ncur = head\nwhile cur is not None:\n hash_table[cur].next = hash_table[cur.next] if cur.next else None\n hash_table[cur].random = hash_table[cur.random] if cur.rand...
<|body_start_0|> if not head: return hash_table = dict() cur = head while cur: node = Node(cur.val) hash_table[cur] = node cur = cur.next cur = head while cur is not None: hash_table[cur].next = hash_table[cur.ne...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def copyRandomList(self, head: 'Node') -> 'Node': """复制带随机指针的链表,使用遍历+队列方式,先生成next链表,使用hash表存储index信息 :param head: :return:""" <|body_0|> def copyRandomList1(self, head: 'Node') -> 'Node': """创建一个节点,放在原节点后面,额外空间O(0) :param head: :return:""" <|body_1|...
stack_v2_sparse_classes_10k_train_003800
2,376
no_license
[ { "docstring": "复制带随机指针的链表,使用遍历+队列方式,先生成next链表,使用hash表存储index信息 :param head: :return:", "name": "copyRandomList", "signature": "def copyRandomList(self, head: 'Node') -> 'Node'" }, { "docstring": "创建一个节点,放在原节点后面,额外空间O(0) :param head: :return:", "name": "copyRandomList1", "signature": "de...
2
stack_v2_sparse_classes_30k_train_004274
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def copyRandomList(self, head: 'Node') -> 'Node': 复制带随机指针的链表,使用遍历+队列方式,先生成next链表,使用hash表存储index信息 :param head: :return: - def copyRandomList1(self, head: 'Node') -> 'Node': 创建一个节...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def copyRandomList(self, head: 'Node') -> 'Node': 复制带随机指针的链表,使用遍历+队列方式,先生成next链表,使用hash表存储index信息 :param head: :return: - def copyRandomList1(self, head: 'Node') -> 'Node': 创建一个节...
9acba92695c06406f12f997a720bfe1deb9464a8
<|skeleton|> class Solution: def copyRandomList(self, head: 'Node') -> 'Node': """复制带随机指针的链表,使用遍历+队列方式,先生成next链表,使用hash表存储index信息 :param head: :return:""" <|body_0|> def copyRandomList1(self, head: 'Node') -> 'Node': """创建一个节点,放在原节点后面,额外空间O(0) :param head: :return:""" <|body_1|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def copyRandomList(self, head: 'Node') -> 'Node': """复制带随机指针的链表,使用遍历+队列方式,先生成next链表,使用hash表存储index信息 :param head: :return:""" if not head: return hash_table = dict() cur = head while cur: node = Node(cur.val) hash_table[cur]...
the_stack_v2_python_sparse
datastructure/linked_list/CopyRandomList.py
yinhuax/leet_code
train
0
0a4b120ee42abefee06c448bd9402eb173f69b6a
[ "future = sorted(zip(Capital, Profits))[::-1]\ncurrent = []\nwhile k > 0:\n while future and future[-1][0] <= W:\n heappush(current, -future.pop()[1])\n if not current:\n break\n W -= heappop(current)\n k -= 1\nreturn W", "t = sorted(zip(map(lambda x: -x, Profits), Capital), key=lambda x...
<|body_start_0|> future = sorted(zip(Capital, Profits))[::-1] current = [] while k > 0: while future and future[-1][0] <= W: heappush(current, -future.pop()[1]) if not current: break W -= heappop(current) k -= 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMaximizedCapital_OJBest(self, k, W, Profits, Capital): """:type k: int :type W: int :type Profits: List[int] :type Capital: List[int] :rtype: int""" <|body_0|> def findMaximizedCapital(self, k, W, Profits, Capital): """:type k: int :type W: int :typ...
stack_v2_sparse_classes_10k_train_003801
3,716
no_license
[ { "docstring": ":type k: int :type W: int :type Profits: List[int] :type Capital: List[int] :rtype: int", "name": "findMaximizedCapital_OJBest", "signature": "def findMaximizedCapital_OJBest(self, k, W, Profits, Capital)" }, { "docstring": ":type k: int :type W: int :type Profits: List[int] :typ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMaximizedCapital_OJBest(self, k, W, Profits, Capital): :type k: int :type W: int :type Profits: List[int] :type Capital: List[int] :rtype: int - def findMaximizedCapital(...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMaximizedCapital_OJBest(self, k, W, Profits, Capital): :type k: int :type W: int :type Profits: List[int] :type Capital: List[int] :rtype: int - def findMaximizedCapital(...
635af6e22aa8eef8e7920a585d43a45a891a8157
<|skeleton|> class Solution: def findMaximizedCapital_OJBest(self, k, W, Profits, Capital): """:type k: int :type W: int :type Profits: List[int] :type Capital: List[int] :rtype: int""" <|body_0|> def findMaximizedCapital(self, k, W, Profits, Capital): """:type k: int :type W: int :typ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def findMaximizedCapital_OJBest(self, k, W, Profits, Capital): """:type k: int :type W: int :type Profits: List[int] :type Capital: List[int] :rtype: int""" future = sorted(zip(Capital, Profits))[::-1] current = [] while k > 0: while future and future[-1][...
the_stack_v2_python_sparse
code502IPO.py
cybelewang/leetcode-python
train
0
2f6ba4cc20176528312b371586d926ac57a78300
[ "with self.OutputCapturer():\n print('foo')\n print('bar', file=sys.stderr)\nself.AssertOutputContainsLine('foo')\nself.AssertOutputContainsLine('bar', check_stdout=False, check_stderr=True)", "with self.OutputCapturer():\n print('foo')\n self.AssertOutputContainsLine('foo')\n print('bar')\n sel...
<|body_start_0|> with self.OutputCapturer(): print('foo') print('bar', file=sys.stderr) self.AssertOutputContainsLine('foo') self.AssertOutputContainsLine('bar', check_stdout=False, check_stderr=True) <|end_body_0|> <|body_start_1|> with self.OutputCapturer(): ...
Tests OutputTestCase functionality.
OutputTestCaseTest
[ "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0", "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OutputTestCaseTest: """Tests OutputTestCase functionality.""" def testStdoutAndStderr(self): """Check capturing stdout and stderr.""" <|body_0|> def testStdoutReadDuringCapture(self): """Check reading stdout mid-capture.""" <|body_1|> def testClearCa...
stack_v2_sparse_classes_10k_train_003802
9,390
permissive
[ { "docstring": "Check capturing stdout and stderr.", "name": "testStdoutAndStderr", "signature": "def testStdoutAndStderr(self)" }, { "docstring": "Check reading stdout mid-capture.", "name": "testStdoutReadDuringCapture", "signature": "def testStdoutReadDuringCapture(self)" }, { ...
5
stack_v2_sparse_classes_30k_train_005509
Implement the Python class `OutputTestCaseTest` described below. Class description: Tests OutputTestCase functionality. Method signatures and docstrings: - def testStdoutAndStderr(self): Check capturing stdout and stderr. - def testStdoutReadDuringCapture(self): Check reading stdout mid-capture. - def testClearCaptur...
Implement the Python class `OutputTestCaseTest` described below. Class description: Tests OutputTestCase functionality. Method signatures and docstrings: - def testStdoutAndStderr(self): Check capturing stdout and stderr. - def testStdoutReadDuringCapture(self): Check reading stdout mid-capture. - def testClearCaptur...
72a05af97787001756bae2511b7985e61498c965
<|skeleton|> class OutputTestCaseTest: """Tests OutputTestCase functionality.""" def testStdoutAndStderr(self): """Check capturing stdout and stderr.""" <|body_0|> def testStdoutReadDuringCapture(self): """Check reading stdout mid-capture.""" <|body_1|> def testClearCa...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class OutputTestCaseTest: """Tests OutputTestCase functionality.""" def testStdoutAndStderr(self): """Check capturing stdout and stderr.""" with self.OutputCapturer(): print('foo') print('bar', file=sys.stderr) self.AssertOutputContainsLine('foo') self.As...
the_stack_v2_python_sparse
third_party/chromite/lib/cros_test_lib_unittest.py
metux/chromium-suckless
train
5
0451006a1922b3474ce88b0dcd67c401f0be408d
[ "if not strs:\n return 0\nsize = len(strs)\ndp = [[[0 for _ in range(n + 1)] for _ in range(m + 1)] for _ in range(size + 1)]\nfor i in range(1, size + 1):\n count_0, count_1 = (strs[i - 1].count('0'), strs[i - 1].count('1'))\n for M in range(m + 1):\n for N in range(n + 1):\n dp[i][M][N]...
<|body_start_0|> if not strs: return 0 size = len(strs) dp = [[[0 for _ in range(n + 1)] for _ in range(m + 1)] for _ in range(size + 1)] for i in range(1, size + 1): count_0, count_1 = (strs[i - 1].count('0'), strs[i - 1].count('1')) for M in range(m ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMaxForm(self, strs: List[str], m: int, n: int) -> int: """三维动态规划 没有进行状态压缩时,会超时""" <|body_0|> def findMaxForm_1(self, strs: List[str], m: int, n: int) -> int: """进行状态压缩""" <|body_1|> def findMaxForm_2(self, strs: List[str], m: int, n: in...
stack_v2_sparse_classes_10k_train_003803
3,121
no_license
[ { "docstring": "三维动态规划 没有进行状态压缩时,会超时", "name": "findMaxForm", "signature": "def findMaxForm(self, strs: List[str], m: int, n: int) -> int" }, { "docstring": "进行状态压缩", "name": "findMaxForm_1", "signature": "def findMaxForm_1(self, strs: List[str], m: int, n: int) -> int" }, { "doc...
3
stack_v2_sparse_classes_30k_test_000200
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMaxForm(self, strs: List[str], m: int, n: int) -> int: 三维动态规划 没有进行状态压缩时,会超时 - def findMaxForm_1(self, strs: List[str], m: int, n: int) -> int: 进行状态压缩 - def findMaxForm_2(...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMaxForm(self, strs: List[str], m: int, n: int) -> int: 三维动态规划 没有进行状态压缩时,会超时 - def findMaxForm_1(self, strs: List[str], m: int, n: int) -> int: 进行状态压缩 - def findMaxForm_2(...
3508e1ce089131b19603c3206aab4cf43023bb19
<|skeleton|> class Solution: def findMaxForm(self, strs: List[str], m: int, n: int) -> int: """三维动态规划 没有进行状态压缩时,会超时""" <|body_0|> def findMaxForm_1(self, strs: List[str], m: int, n: int) -> int: """进行状态压缩""" <|body_1|> def findMaxForm_2(self, strs: List[str], m: int, n: in...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def findMaxForm(self, strs: List[str], m: int, n: int) -> int: """三维动态规划 没有进行状态压缩时,会超时""" if not strs: return 0 size = len(strs) dp = [[[0 for _ in range(n + 1)] for _ in range(m + 1)] for _ in range(size + 1)] for i in range(1, size + 1): ...
the_stack_v2_python_sparse
algorithm/leetcode/dp/29-零和一.py
lxconfig/UbuntuCode_bak
train
0
3bd5a9110174a406b2fb8a158292e2238a175b5f
[ "if not root:\n return\ncurrentLevel, nextLevel = (collections.deque([root]), collections.deque())\nwhile currentLevel:\n node = currentLevel.popleft()\n if node.left:\n nextLevel.append(node.left)\n if node.right:\n nextLevel.append(node.right)\n node.next = currentLevel[0] if currentL...
<|body_start_0|> if not root: return currentLevel, nextLevel = (collections.deque([root]), collections.deque()) while currentLevel: node = currentLevel.popleft() if node.left: nextLevel.append(node.left) if node.right: ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def connect(self, root): """BFS :param root: :return:""" <|body_0|> def connect2(self, root): """把上面的bfs转换为常数空间 :param root: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: return currentLevel, nex...
stack_v2_sparse_classes_10k_train_003804
3,639
permissive
[ { "docstring": "BFS :param root: :return:", "name": "connect", "signature": "def connect(self, root)" }, { "docstring": "把上面的bfs转换为常数空间 :param root: :return:", "name": "connect2", "signature": "def connect2(self, root)" } ]
2
stack_v2_sparse_classes_30k_train_003276
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def connect(self, root): BFS :param root: :return: - def connect2(self, root): 把上面的bfs转换为常数空间 :param root: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def connect(self, root): BFS :param root: :return: - def connect2(self, root): 把上面的bfs转换为常数空间 :param root: :return: <|skeleton|> class Solution: def connect(self, root): ...
2830c7e2ada8dfd3dcdda7c06846116d4f944a27
<|skeleton|> class Solution: def connect(self, root): """BFS :param root: :return:""" <|body_0|> def connect2(self, root): """把上面的bfs转换为常数空间 :param root: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def connect(self, root): """BFS :param root: :return:""" if not root: return currentLevel, nextLevel = (collections.deque([root]), collections.deque()) while currentLevel: node = currentLevel.popleft() if node.left: ...
the_stack_v2_python_sparse
leetcode/hard/Populating_Next_Right_Pointers_in_Each_Node_II.py
shhuan/algorithms
train
0
17fb400b25190900dc3ad347471bc3e50bf7c3bc
[ "try:\n res = get_all_orders()\n return Response({'status': 200, 'message': 'Success', 'data': res})\nexcept Exception as e:\n traceback.print_exc()\n return Response({'status': 500, 'message': 'Error', 'data': {'error': str(e)}})", "try:\n res = {}\n brand_data = request.data\n if C.SHOPIFY ...
<|body_start_0|> try: res = get_all_orders() return Response({'status': 200, 'message': 'Success', 'data': res}) except Exception as e: traceback.print_exc() return Response({'status': 500, 'message': 'Error', 'data': {'error': str(e)}}) <|end_body_0|> <|...
OrderView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrderView: def get(self, request): """Return all orders coming from different sources in the system.""" <|body_0|> def post(self, request, format=None): """Ingest all orders coming from different sources in the system.""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_10k_train_003805
1,296
no_license
[ { "docstring": "Return all orders coming from different sources in the system.", "name": "get", "signature": "def get(self, request)" }, { "docstring": "Ingest all orders coming from different sources in the system.", "name": "post", "signature": "def post(self, request, format=None)" ...
2
stack_v2_sparse_classes_30k_train_004996
Implement the Python class `OrderView` described below. Class description: Implement the OrderView class. Method signatures and docstrings: - def get(self, request): Return all orders coming from different sources in the system. - def post(self, request, format=None): Ingest all orders coming from different sources i...
Implement the Python class `OrderView` described below. Class description: Implement the OrderView class. Method signatures and docstrings: - def get(self, request): Return all orders coming from different sources in the system. - def post(self, request, format=None): Ingest all orders coming from different sources i...
83dbfa69bcf225b623b5b9c0364d4e9fedd087fe
<|skeleton|> class OrderView: def get(self, request): """Return all orders coming from different sources in the system.""" <|body_0|> def post(self, request, format=None): """Ingest all orders coming from different sources in the system.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class OrderView: def get(self, request): """Return all orders coming from different sources in the system.""" try: res = get_all_orders() return Response({'status': 200, 'message': 'Success', 'data': res}) except Exception as e: traceback.print_exc() ...
the_stack_v2_python_sparse
order_fulfiller/backend/ordc/apps/order_fulfiller/views.py
sarojrai/ordc-pranali
train
0
df2a3038d307c16f6c7ea0ef1ccd4e11876e461a
[ "self.face_cascade = cv.CascadeClassifier(cascade_file_path)\nif self.face_cascade.empty():\n print(\"Classifier failed to load '{}' filepath\".format(cascade_file_path))\n raise", "rows, cols = frame.shape[:2]\nself.all_faces = self.face_cascade.detectMultiScale(frame, scaleFactor=1.3, minNeighbors=5)\nif ...
<|body_start_0|> self.face_cascade = cv.CascadeClassifier(cascade_file_path) if self.face_cascade.empty(): print("Classifier failed to load '{}' filepath".format(cascade_file_path)) raise <|end_body_0|> <|body_start_1|> rows, cols = frame.shape[:2] self.all_faces...
Wrapper for the OpenCV program for detecting faces. Calling the 'detect_faces(...)' method on an image will get the information on the faces in the image. This class allows for an implementation agnostic way of detecting faces.
FaceDetector
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FaceDetector: """Wrapper for the OpenCV program for detecting faces. Calling the 'detect_faces(...)' method on an image will get the information on the faces in the image. This class allows for an implementation agnostic way of detecting faces.""" def __init__(self, cascade_file_path=default...
stack_v2_sparse_classes_10k_train_003806
3,297
permissive
[ { "docstring": "Loads the image classifier and raises an exception if the classifier fails to load the xml classifier file. When using a different classifier xml, make sure to take into account relative file paths to avoid raising an exception.", "name": "__init__", "signature": "def __init__(self, casc...
2
stack_v2_sparse_classes_30k_train_002543
Implement the Python class `FaceDetector` described below. Class description: Wrapper for the OpenCV program for detecting faces. Calling the 'detect_faces(...)' method on an image will get the information on the faces in the image. This class allows for an implementation agnostic way of detecting faces. Method signa...
Implement the Python class `FaceDetector` described below. Class description: Wrapper for the OpenCV program for detecting faces. Calling the 'detect_faces(...)' method on an image will get the information on the faces in the image. This class allows for an implementation agnostic way of detecting faces. Method signa...
c9cf67c7c502406465d647d013f0d98cad2d4c44
<|skeleton|> class FaceDetector: """Wrapper for the OpenCV program for detecting faces. Calling the 'detect_faces(...)' method on an image will get the information on the faces in the image. This class allows for an implementation agnostic way of detecting faces.""" def __init__(self, cascade_file_path=default...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FaceDetector: """Wrapper for the OpenCV program for detecting faces. Calling the 'detect_faces(...)' method on an image will get the information on the faces in the image. This class allows for an implementation agnostic way of detecting faces.""" def __init__(self, cascade_file_path=default_cascade_file...
the_stack_v2_python_sparse
ComputerVisionServer/moedx/facial_detection/face_detector.py
mobiledgex/edge-cloud-sampleapps
train
12
54ebebd9743d02d1010166895bb95a2b63a8a954
[ "AnalysisTask.__init__(self, **kwargs)\nself._mask_file_dict = {}\nself._sdark_file_dict = {}\nself._sdark_images = None\nself._sdark_arrays = None", "self.safe_update(**kwargs)\nself._mask_file_dict = {}\nself._sdark_file_dict = {}\nif butler is not None:\n self.log.warn('Ignoring butler')\nself.set_local_dat...
<|body_start_0|> AnalysisTask.__init__(self, **kwargs) self._mask_file_dict = {} self._sdark_file_dict = {} self._sdark_images = None self._sdark_arrays = None <|end_body_0|> <|body_start_1|> self.safe_update(**kwargs) self._mask_file_dict = {} self._sdar...
Analyze the outliers in the superdark frames for a raft
SuperdarkRaftTask
[ "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SuperdarkRaftTask: """Analyze the outliers in the superdark frames for a raft""" def __init__(self, **kwargs): """C'tor Parameters ---------- kwargs Used to override configruation""" <|body_0|> def extract(self, butler, data, **kwargs): """Extract the utliers in ...
stack_v2_sparse_classes_10k_train_003807
14,784
permissive
[ { "docstring": "C'tor Parameters ---------- kwargs Used to override configruation", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "Extract the utliers in the superdark frames for the raft Parameters ---------- butler : `Butler` The data butler data : `dict` Di...
4
stack_v2_sparse_classes_30k_train_001851
Implement the Python class `SuperdarkRaftTask` described below. Class description: Analyze the outliers in the superdark frames for a raft Method signatures and docstrings: - def __init__(self, **kwargs): C'tor Parameters ---------- kwargs Used to override configruation - def extract(self, butler, data, **kwargs): Ex...
Implement the Python class `SuperdarkRaftTask` described below. Class description: Analyze the outliers in the superdark frames for a raft Method signatures and docstrings: - def __init__(self, **kwargs): C'tor Parameters ---------- kwargs Used to override configruation - def extract(self, butler, data, **kwargs): Ex...
28418284fdaf2b2fb0afbeccd4324f7ad3e676c8
<|skeleton|> class SuperdarkRaftTask: """Analyze the outliers in the superdark frames for a raft""" def __init__(self, **kwargs): """C'tor Parameters ---------- kwargs Used to override configruation""" <|body_0|> def extract(self, butler, data, **kwargs): """Extract the utliers in ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SuperdarkRaftTask: """Analyze the outliers in the superdark frames for a raft""" def __init__(self, **kwargs): """C'tor Parameters ---------- kwargs Used to override configruation""" AnalysisTask.__init__(self, **kwargs) self._mask_file_dict = {} self._sdark_file_dict = {}...
the_stack_v2_python_sparse
python/lsst/eo_utils/dark/superdark.py
lsst-camera-dh/EO-utilities
train
2
4d733c4aefc460de5b36fbc0fb046509e030af71
[ "alloy_type_set = alloy_model.AlloyType.objects.only('id', 'type').filter(is_delete=False)\ndata = {'alloy_type_set': alloy_type_set}\nreturn render(request, 'admin/alloy/alloy_edit.html', context=data)", "alloy_query = alloy_model.Alloy.objects.only('name').filter(is_delete=False)\ntry:\n alloy_json_data = re...
<|body_start_0|> alloy_type_set = alloy_model.AlloyType.objects.only('id', 'type').filter(is_delete=False) data = {'alloy_type_set': alloy_type_set} return render(request, 'admin/alloy/alloy_edit.html', context=data) <|end_body_0|> <|body_start_1|> alloy_query = alloy_model.Alloy.object...
AlloyAdd
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlloyAdd: def get(self, request): """添加页面展示 :param request: :return:""" <|body_0|> def post(self, request): """新合金添加 :param request: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> alloy_type_set = alloy_model.AlloyType.objects.only('id', '...
stack_v2_sparse_classes_10k_train_003808
11,849
no_license
[ { "docstring": "添加页面展示 :param request: :return:", "name": "get", "signature": "def get(self, request)" }, { "docstring": "新合金添加 :param request: :return:", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_006308
Implement the Python class `AlloyAdd` described below. Class description: Implement the AlloyAdd class. Method signatures and docstrings: - def get(self, request): 添加页面展示 :param request: :return: - def post(self, request): 新合金添加 :param request: :return:
Implement the Python class `AlloyAdd` described below. Class description: Implement the AlloyAdd class. Method signatures and docstrings: - def get(self, request): 添加页面展示 :param request: :return: - def post(self, request): 新合金添加 :param request: :return: <|skeleton|> class AlloyAdd: def get(self, request): ...
063332d2a5e2ddabf800817f02074b4f5c162ade
<|skeleton|> class AlloyAdd: def get(self, request): """添加页面展示 :param request: :return:""" <|body_0|> def post(self, request): """新合金添加 :param request: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AlloyAdd: def get(self, request): """添加页面展示 :param request: :return:""" alloy_type_set = alloy_model.AlloyType.objects.only('id', 'type').filter(is_delete=False) data = {'alloy_type_set': alloy_type_set} return render(request, 'admin/alloy/alloy_edit.html', context=data) d...
the_stack_v2_python_sparse
sfs/apps/alloy/views.py
Hx-someone/sfs-1
train
0
d58f11e5172c450c8744e65b400586f3f40cfeff
[ "self.stacks = []\nself.cap = capacity\nself.open_positions = []", "while self.open_positions and self.open_positions[0] < len(self.stacks) and (len(self.stacks[self.open_positions[0]]) == self.cap):\n heapq.heappop(self.open_positions)\nif not self.open_positions:\n heapq.heappush(self.open_positions, len(...
<|body_start_0|> self.stacks = [] self.cap = capacity self.open_positions = [] <|end_body_0|> <|body_start_1|> while self.open_positions and self.open_positions[0] < len(self.stacks) and (len(self.stacks[self.open_positions[0]]) == self.cap): heapq.heappop(self.open_position...
DinnerPlates
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DinnerPlates: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def push(self, val): """:type val: int :rtype: None""" <|body_1|> def pop(self): """:rtype: int""" <|body_2|> def popAtStack(self, index): """:t...
stack_v2_sparse_classes_10k_train_003809
1,445
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type val: int :rtype: None", "name": "push", "signature": "def push(self, val)" }, { "docstring": ":rtype: int", "name": "pop", "signature": "def pop(...
4
null
Implement the Python class `DinnerPlates` described below. Class description: Implement the DinnerPlates class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def push(self, val): :type val: int :rtype: None - def pop(self): :rtype: int - def popAtStack(self, index): :type ind...
Implement the Python class `DinnerPlates` described below. Class description: Implement the DinnerPlates class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def push(self, val): :type val: int :rtype: None - def pop(self): :rtype: int - def popAtStack(self, index): :type ind...
20623defecf65cbc35b194d8b60d8b211816ee4f
<|skeleton|> class DinnerPlates: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def push(self, val): """:type val: int :rtype: None""" <|body_1|> def pop(self): """:rtype: int""" <|body_2|> def popAtStack(self, index): """:t...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DinnerPlates: def __init__(self, capacity): """:type capacity: int""" self.stacks = [] self.cap = capacity self.open_positions = [] def push(self, val): """:type val: int :rtype: None""" while self.open_positions and self.open_positions[0] < len(self.stacks...
the_stack_v2_python_sparse
in_Python/1172 Dinner Plate Stacks.py
YangLiyli131/Leetcode2020
train
0
79acabd4a389c9de7e1ced93adbe9402126d4a18
[ "super(DSANet, self).__init__()\nself.batch_size = batch_size\nself.window = window\nself.local = local\nself.n_multiv = n_multiv\nself.n_kernels = n_kernels\nself.w_kernel = w_kernel\nself.d_model = d_model\nself.d_inner = d_inner\nself.n_layers = n_layers\nself.n_head = n_head\nself.d_k = d_k\nself.d_v = d_v\nsel...
<|body_start_0|> super(DSANet, self).__init__() self.batch_size = batch_size self.window = window self.local = local self.n_multiv = n_multiv self.n_kernels = n_kernels self.w_kernel = w_kernel self.d_model = d_model self.d_inner = d_inner ...
DSANet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DSANet: def __init__(self, batch_size, window, local, n_multiv, n_kernels, w_kernel, d_model, d_inner, n_layers, n_head, d_k, d_v, drop_prob): """Pass in parsed HyperOptArgumentParser to the model""" <|body_0|> def __build_model(self): """Layout model""" <|bo...
stack_v2_sparse_classes_10k_train_003810
11,776
permissive
[ { "docstring": "Pass in parsed HyperOptArgumentParser to the model", "name": "__init__", "signature": "def __init__(self, batch_size, window, local, n_multiv, n_kernels, w_kernel, d_model, d_inner, n_layers, n_head, d_k, d_v, drop_prob)" }, { "docstring": "Layout model", "name": "__build_mod...
3
stack_v2_sparse_classes_30k_train_004260
Implement the Python class `DSANet` described below. Class description: Implement the DSANet class. Method signatures and docstrings: - def __init__(self, batch_size, window, local, n_multiv, n_kernels, w_kernel, d_model, d_inner, n_layers, n_head, d_k, d_v, drop_prob): Pass in parsed HyperOptArgumentParser to the mo...
Implement the Python class `DSANet` described below. Class description: Implement the DSANet class. Method signatures and docstrings: - def __init__(self, batch_size, window, local, n_multiv, n_kernels, w_kernel, d_model, d_inner, n_layers, n_head, d_k, d_v, drop_prob): Pass in parsed HyperOptArgumentParser to the mo...
39b5aeeead440eaa88d6fdaf4a8a70c15373e062
<|skeleton|> class DSANet: def __init__(self, batch_size, window, local, n_multiv, n_kernels, w_kernel, d_model, d_inner, n_layers, n_head, d_k, d_v, drop_prob): """Pass in parsed HyperOptArgumentParser to the model""" <|body_0|> def __build_model(self): """Layout model""" <|bo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DSANet: def __init__(self, batch_size, window, local, n_multiv, n_kernels, w_kernel, d_model, d_inner, n_layers, n_head, d_k, d_v, drop_prob): """Pass in parsed HyperOptArgumentParser to the model""" super(DSANet, self).__init__() self.batch_size = batch_size self.window = wind...
the_stack_v2_python_sparse
model/dsanet.py
lixiaoyu0575/physionet_challenge2020_pytorch
train
2
2b03cab14342456c315f7d33f4770c8fbd7a2767
[ "self.log = logging.getLogger(__name__)\nself.name = name\nself.clouds = {}\nself.group_resources = group_resources\nself.group_yamls = group_yamls", "base = automap_base()\nengine = create_engine('mysql+pymysql://' + csconfig.config.db_user + ':' + csconfig.config.db_password + '@' + csconfig.config.db_host + ':...
<|body_start_0|> self.log = logging.getLogger(__name__) self.name = name self.clouds = {} self.group_resources = group_resources self.group_yamls = group_yamls <|end_body_0|> <|body_start_1|> base = automap_base() engine = create_engine('mysql+pymysql://' + cscon...
CloudManager class for holding a groups resources and their group yaml
CloudManager
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CloudManager: """CloudManager class for holding a groups resources and their group yaml""" def __init__(self, name, group_resources, group_yamls): """Create a new CloudManager. :param name: The name of the group :param group_resources: sqlalchemy result of this groups resources :para...
stack_v2_sparse_classes_10k_train_003811
2,414
permissive
[ { "docstring": "Create a new CloudManager. :param name: The name of the group :param group_resources: sqlalchemy result of this groups resources :param group_yamls: the group's yaml from the database.", "name": "__init__", "signature": "def __init__(self, name, group_resources, group_yamls)" }, { ...
2
stack_v2_sparse_classes_30k_train_006450
Implement the Python class `CloudManager` described below. Class description: CloudManager class for holding a groups resources and their group yaml Method signatures and docstrings: - def __init__(self, name, group_resources, group_yamls): Create a new CloudManager. :param name: The name of the group :param group_re...
Implement the Python class `CloudManager` described below. Class description: CloudManager class for holding a groups resources and their group yaml Method signatures and docstrings: - def __init__(self, name, group_resources, group_yamls): Create a new CloudManager. :param name: The name of the group :param group_re...
2d1aa488737046b6fefceb1bfaed72af2ac97758
<|skeleton|> class CloudManager: """CloudManager class for holding a groups resources and their group yaml""" def __init__(self, name, group_resources, group_yamls): """Create a new CloudManager. :param name: The name of the group :param group_resources: sqlalchemy result of this groups resources :para...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CloudManager: """CloudManager class for holding a groups resources and their group yaml""" def __init__(self, name, group_resources, group_yamls): """Create a new CloudManager. :param name: The name of the group :param group_resources: sqlalchemy result of this groups resources :param group_yamls...
the_stack_v2_python_sparse
cloudscheduler/cloudmanager.py
t-gibbons/cloudscheduler
train
0
cfb199ba9ac1faaf97bfc88acbdc190f88174f7f
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn WindowsMalwareOverview()", "from .os_version_count import OsVersionCount\nfrom .windows_malware_category_count import WindowsMalwareCategoryCount\nfrom .windows_malware_execution_state_count import WindowsMalwareExecutionStateCount\nfr...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return WindowsMalwareOverview() <|end_body_0|> <|body_start_1|> from .os_version_count import OsVersionCount from .windows_malware_category_count import WindowsMalwareCategoryCount from...
Windows device malware overview.
WindowsMalwareOverview
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WindowsMalwareOverview: """Windows device malware overview.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsMalwareOverview: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use ...
stack_v2_sparse_classes_10k_train_003812
7,019
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: WindowsMalwareOverview", "name": "create_from_discriminator_value", "signature": "def create_from_discrimina...
3
null
Implement the Python class `WindowsMalwareOverview` described below. Class description: Windows device malware overview. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsMalwareOverview: Creates a new instance of the appropriate class based on dis...
Implement the Python class `WindowsMalwareOverview` described below. Class description: Windows device malware overview. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsMalwareOverview: Creates a new instance of the appropriate class based on dis...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class WindowsMalwareOverview: """Windows device malware overview.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsMalwareOverview: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WindowsMalwareOverview: """Windows device malware overview.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsMalwareOverview: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the d...
the_stack_v2_python_sparse
msgraph/generated/models/windows_malware_overview.py
microsoftgraph/msgraph-sdk-python
train
135
cecee4dd391786e0707cf6e0629d9aad46e9f7ba
[ "if type == 'city':\n return self.db.query(City.Fid, City.Fcity_name).filter(City.Ffather == father_id, City.Fdeleted == 0)\nif type == 'area':\n return self.db.query(Area.Fid, Area.Farea_name).filter(Area.Ffather == father_id, Area.Fdeleted == 0)\nif type == 'province':\n return self.db.query(Province.Fid...
<|body_start_0|> if type == 'city': return self.db.query(City.Fid, City.Fcity_name).filter(City.Ffather == father_id, City.Fdeleted == 0) if type == 'area': return self.db.query(Area.Fid, Area.Farea_name).filter(Area.Ffather == father_id, Area.Fdeleted == 0) if type == 'p...
LocationServices
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LocationServices: def get_location_name_list(self, type, father_id=0): """:param type: 查询的地区登记 province,city,area :param father_id: :return: 地址id和名称""" <|body_0|> def get_city_area_list(self, province_id=0, city_id=0): """:param type: 查询的地区登记 province,city,area :para...
stack_v2_sparse_classes_10k_train_003813
4,110
no_license
[ { "docstring": ":param type: 查询的地区登记 province,city,area :param father_id: :return: 地址id和名称", "name": "get_location_name_list", "signature": "def get_location_name_list(self, type, father_id=0)" }, { "docstring": ":param type: 查询的地区登记 province,city,area :param father_id: :return: 地址id和名称", "n...
3
null
Implement the Python class `LocationServices` described below. Class description: Implement the LocationServices class. Method signatures and docstrings: - def get_location_name_list(self, type, father_id=0): :param type: 查询的地区登记 province,city,area :param father_id: :return: 地址id和名称 - def get_city_area_list(self, pro...
Implement the Python class `LocationServices` described below. Class description: Implement the LocationServices class. Method signatures and docstrings: - def get_location_name_list(self, type, father_id=0): :param type: 查询的地区登记 province,city,area :param father_id: :return: 地址id和名称 - def get_city_area_list(self, pro...
0596bcb429674b75243d343c73e0f022b6d86820
<|skeleton|> class LocationServices: def get_location_name_list(self, type, father_id=0): """:param type: 查询的地区登记 province,city,area :param father_id: :return: 地址id和名称""" <|body_0|> def get_city_area_list(self, province_id=0, city_id=0): """:param type: 查询的地区登记 province,city,area :para...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LocationServices: def get_location_name_list(self, type, father_id=0): """:param type: 查询的地区登记 province,city,area :param father_id: :return: 地址id和名称""" if type == 'city': return self.db.query(City.Fid, City.Fcity_name).filter(City.Ffather == father_id, City.Fdeleted == 0) i...
the_stack_v2_python_sparse
source/services/company/location_service.py
cash2one/gongzhuhao
train
0
13a3a46246fa5c27dc08c6cffa10eecdfce626dd
[ "if not nums:\n return 0\nfor i in range(len(nums)):\n while i < len(nums) - 1 and nums[i] == nums[i + 1]:\n nums.pop(i + 1)\nreturn len(nums)", "if not nums:\n return 0\nfor i in range(len(nums) - 1):\n print('-------------------------')\n print('i:%d, nums:%s, len(nums):%d' % (i, nums, len...
<|body_start_0|> if not nums: return 0 for i in range(len(nums)): while i < len(nums) - 1 and nums[i] == nums[i + 1]: nums.pop(i + 1) return len(nums) <|end_body_0|> <|body_start_1|> if not nums: return 0 for i in range(len(num...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeDuplicates(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def removeDuplicates_v2(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> def removeDuplicates_v3(self, nums): """:type nums: List[int] :...
stack_v2_sparse_classes_10k_train_003814
3,305
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "removeDuplicates", "signature": "def removeDuplicates(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "removeDuplicates_v2", "signature": "def removeDuplicates_v2(self, nums)" }, { "docstring...
3
stack_v2_sparse_classes_30k_train_002907
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeDuplicates(self, nums): :type nums: List[int] :rtype: int - def removeDuplicates_v2(self, nums): :type nums: List[int] :rtype: int - def removeDuplicates_v3(self, nums)...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeDuplicates(self, nums): :type nums: List[int] :rtype: int - def removeDuplicates_v2(self, nums): :type nums: List[int] :rtype: int - def removeDuplicates_v3(self, nums)...
1ca58b87e5edfa8db389f14e3a9105e92b4ae85f
<|skeleton|> class Solution: def removeDuplicates(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def removeDuplicates_v2(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> def removeDuplicates_v3(self, nums): """:type nums: List[int] :...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def removeDuplicates(self, nums): """:type nums: List[int] :rtype: int""" if not nums: return 0 for i in range(len(nums)): while i < len(nums) - 1 and nums[i] == nums[i + 1]: nums.pop(i + 1) return len(nums) def removeDupli...
the_stack_v2_python_sparse
other/删除排序数据中的重复项.py
houhailun/leetcode
train
1
e7f2400e7d765a9b168719127be8f4659eba42ff
[ "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...
Provides text analysis operations such as sentiment analysis and entity recognition.
LanguageServiceServicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LanguageServiceServicer: """Provides text analysis operations such as sentiment analysis and entity recognition.""" def AnalyzeSentiment(self, request, context): """Analyzes the sentiment of the provided text.""" <|body_0|> def AnalyzeEntities(self, request, context): ...
stack_v2_sparse_classes_10k_train_003815
6,518
no_license
[ { "docstring": "Analyzes the sentiment of the provided text.", "name": "AnalyzeSentiment", "signature": "def AnalyzeSentiment(self, request, context)" }, { "docstring": "Finds named entities (currently proper names and common nouns) in the text along with entity types, salience, mentions for eac...
5
stack_v2_sparse_classes_30k_train_006972
Implement the Python class `LanguageServiceServicer` described below. Class description: Provides text analysis operations such as sentiment analysis and entity recognition. Method signatures and docstrings: - def AnalyzeSentiment(self, request, context): Analyzes the sentiment of the provided text. - def AnalyzeEnti...
Implement the Python class `LanguageServiceServicer` described below. Class description: Provides text analysis operations such as sentiment analysis and entity recognition. Method signatures and docstrings: - def AnalyzeSentiment(self, request, context): Analyzes the sentiment of the provided text. - def AnalyzeEnti...
d7424d21aa0dc121acc4d64b427ba365a3581a20
<|skeleton|> class LanguageServiceServicer: """Provides text analysis operations such as sentiment analysis and entity recognition.""" def AnalyzeSentiment(self, request, context): """Analyzes the sentiment of the provided text.""" <|body_0|> def AnalyzeEntities(self, request, context): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LanguageServiceServicer: """Provides text analysis operations such as sentiment analysis and entity recognition.""" def AnalyzeSentiment(self, request, context): """Analyzes the sentiment of the provided text.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details(...
the_stack_v2_python_sparse
google/cloud/language/v1/language_service_pb2_grpc.py
msachtler/bazel-event-protocol-parser
train
1
0d8d1c3e6819939ebb050b24b2c5ae2596a89539
[ "def structure2list(list):\n if list == []:\n return None\n max_1 = list[0]\n max_item = 0\n for i, val in enumerate(list):\n if val >= max_1:\n max_1 = val\n max_item = i\n root = TreeNode(max_1)\n root.left = structure2list(list[0:max_item])\n root.right = ...
<|body_start_0|> def structure2list(list): if list == []: return None max_1 = list[0] max_item = 0 for i, val in enumerate(list): if val >= max_1: max_1 = val max_item = i root = T...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def constructMaximumBinaryTree(self, nums): """:type nums: List[int] :rtype: TreeNode 282ms""" <|body_0|> def constructMaximumBinaryTree_1(self, nums): """:type nums: List[int] :rtype: TreeNode 192ms""" <|body_1|> def constructMaximumBinaryTree...
stack_v2_sparse_classes_10k_train_003816
2,893
no_license
[ { "docstring": ":type nums: List[int] :rtype: TreeNode 282ms", "name": "constructMaximumBinaryTree", "signature": "def constructMaximumBinaryTree(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: TreeNode 192ms", "name": "constructMaximumBinaryTree_1", "signature": "def const...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def constructMaximumBinaryTree(self, nums): :type nums: List[int] :rtype: TreeNode 282ms - def constructMaximumBinaryTree_1(self, nums): :type nums: List[int] :rtype: TreeNode 19...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def constructMaximumBinaryTree(self, nums): :type nums: List[int] :rtype: TreeNode 282ms - def constructMaximumBinaryTree_1(self, nums): :type nums: List[int] :rtype: TreeNode 19...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def constructMaximumBinaryTree(self, nums): """:type nums: List[int] :rtype: TreeNode 282ms""" <|body_0|> def constructMaximumBinaryTree_1(self, nums): """:type nums: List[int] :rtype: TreeNode 192ms""" <|body_1|> def constructMaximumBinaryTree...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def constructMaximumBinaryTree(self, nums): """:type nums: List[int] :rtype: TreeNode 282ms""" def structure2list(list): if list == []: return None max_1 = list[0] max_item = 0 for i, val in enumerate(list): ...
the_stack_v2_python_sparse
MaximumBinaryTree_MID_654.py
953250587/leetcode-python
train
2
4348c1acaff6d1fcb1365c803b3c689cc84a5b74
[ "device_types.DeviceComponent.__init__(self, device)\nself.led_infoes = {}\nself._GetLEDInfo()\nself._ectool_led_name = ectool_led_name\nself._pwm_idx = pwm_idx\nself._duty_map = duty_map or self.DefaultDutyMap\nif not set(self._duty_map).issuperset(list(self.Index) + [None]):\n raise ValueError('Invalid duty ma...
<|body_start_0|> device_types.DeviceComponent.__init__(self, device) self.led_infoes = {} self._GetLEDInfo() self._ectool_led_name = ectool_led_name self._pwm_idx = pwm_idx self._duty_map = duty_map or self.DefaultDutyMap if not set(self._duty_map).issuperset(list...
Devices with only Left and Right LEDs which are controlled by PWM.
PWMLeftRightLED
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PWMLeftRightLED: """Devices with only Left and Right LEDs which are controlled by PWM.""" def __init__(self, device, ectool_led_name=LED.CrOSIndexes.POWER, pwm_idx=3, duty_map=None): """Construct PWMLeftRightLED. Args: device: The sys_interface. ectool_led_name: The led name in ectoo...
stack_v2_sparse_classes_10k_train_003817
6,820
permissive
[ { "docstring": "Construct PWMLeftRightLED. Args: device: The sys_interface. ectool_led_name: The led name in ectool. pwm_idx: The index of 'ectool pwmsetduty'. duty_map: The map from led_name to duty value of 'ectool pwmsetduty'.", "name": "__init__", "signature": "def __init__(self, device, ectool_led_...
2
null
Implement the Python class `PWMLeftRightLED` described below. Class description: Devices with only Left and Right LEDs which are controlled by PWM. Method signatures and docstrings: - def __init__(self, device, ectool_led_name=LED.CrOSIndexes.POWER, pwm_idx=3, duty_map=None): Construct PWMLeftRightLED. Args: device: ...
Implement the Python class `PWMLeftRightLED` described below. Class description: Devices with only Left and Right LEDs which are controlled by PWM. Method signatures and docstrings: - def __init__(self, device, ectool_led_name=LED.CrOSIndexes.POWER, pwm_idx=3, duty_map=None): Construct PWMLeftRightLED. Args: device: ...
a1b0fccd68987d8cd9c89710adc3c04b868347ec
<|skeleton|> class PWMLeftRightLED: """Devices with only Left and Right LEDs which are controlled by PWM.""" def __init__(self, device, ectool_led_name=LED.CrOSIndexes.POWER, pwm_idx=3, duty_map=None): """Construct PWMLeftRightLED. Args: device: The sys_interface. ectool_led_name: The led name in ectoo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PWMLeftRightLED: """Devices with only Left and Right LEDs which are controlled by PWM.""" def __init__(self, device, ectool_led_name=LED.CrOSIndexes.POWER, pwm_idx=3, duty_map=None): """Construct PWMLeftRightLED. Args: device: The sys_interface. ectool_led_name: The led name in ectool. pwm_idx: T...
the_stack_v2_python_sparse
py/device/led.py
bridder/factory
train
0
33f2887c4568e71985fe51770b0904c51f57e187
[ "try:\n file_id = UUID(req_data['file_id']).hex\nexcept ValueError:\n return Response(status='400 Bad Request')\nstored_files = StoredFile.collection()\nto_delete = stored_files.first(id=file_id)\nlog_activity('%s deleted file %s' % (context.user.link, to_delete.filename))\nstored_files.delete(to_delete)\nget...
<|body_start_0|> try: file_id = UUID(req_data['file_id']).hex except ValueError: return Response(status='400 Bad Request') stored_files = StoredFile.collection() to_delete = stored_files.first(id=file_id) log_activity('%s deleted file %s' % (context.user.l...
The file set controller.
FileSetController
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileSetController: """The file set controller.""" def delete(self, *route, **req_data): """Handle a file delete.""" <|body_0|> def upload(self, *route, **req_data): """Handle a file upload.""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: ...
stack_v2_sparse_classes_10k_train_003818
8,541
permissive
[ { "docstring": "Handle a file delete.", "name": "delete", "signature": "def delete(self, *route, **req_data)" }, { "docstring": "Handle a file upload.", "name": "upload", "signature": "def upload(self, *route, **req_data)" } ]
2
stack_v2_sparse_classes_30k_train_005430
Implement the Python class `FileSetController` described below. Class description: The file set controller. Method signatures and docstrings: - def delete(self, *route, **req_data): Handle a file delete. - def upload(self, *route, **req_data): Handle a file upload.
Implement the Python class `FileSetController` described below. Class description: The file set controller. Method signatures and docstrings: - def delete(self, *route, **req_data): Handle a file delete. - def upload(self, *route, **req_data): Handle a file upload. <|skeleton|> class FileSetController: """The fi...
b34cb4b2ee7cc40b2c99015f05bfcc12d4b49065
<|skeleton|> class FileSetController: """The file set controller.""" def delete(self, *route, **req_data): """Handle a file delete.""" <|body_0|> def upload(self, *route, **req_data): """Handle a file upload.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FileSetController: """The file set controller.""" def delete(self, *route, **req_data): """Handle a file delete.""" try: file_id = UUID(req_data['file_id']).hex except ValueError: return Response(status='400 Bad Request') stored_files = StoredFile.c...
the_stack_v2_python_sparse
zoom/_assets/standard_apps/content/files.py
dsilabs/zoom
train
9
8688f2fd9b8440b73bae969de90c2bde95ceddaa
[ "self.d = {}\nself.cap = capacity\nself.l = []", "if key in self.d:\n self.l[self.d[key]][1] += 1\n p = self.d[key]\n while p > 0:\n if self.l[p][1] >= self.l[p - 1][1]:\n self.l[p], self.l[p - 1] = (self.l[p - 1], self.l[p])\n p -= 1\n else:\n self.d[key] =...
<|body_start_0|> self.d = {} self.cap = capacity self.l = [] <|end_body_0|> <|body_start_1|> if key in self.d: self.l[self.d[key]][1] += 1 p = self.d[key] while p > 0: if self.l[p][1] >= self.l[p - 1][1]: self.l[p],...
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:rtype: int""" <|body_1|> def set(self, key, value): """:type key: int :type value: int :rtype: nothing""" <|body_2|> <|end_skeleton|> <...
stack_v2_sparse_classes_10k_train_003819
1,141
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: nothing", "name": "set", "sig...
3
stack_v2_sparse_classes_30k_train_005454
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :rtype: int - def set(self, key, value): :type key: int :type value: int :rtype: nothing
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :rtype: int - def set(self, key, value): :type key: int :type value: int :rtype: nothing <|skeleton|> cla...
d61363f99de3d591ebc8cd94f62544a31a026d55
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:rtype: int""" <|body_1|> def set(self, key, value): """:type key: int :type value: int :rtype: nothing""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LRUCache: def __init__(self, capacity): """:type capacity: int""" self.d = {} self.cap = capacity self.l = [] def get(self, key): """:rtype: int""" if key in self.d: self.l[self.d[key]][1] += 1 p = self.d[key] while p > 0...
the_stack_v2_python_sparse
146_LRU_Cache_Alter.py
nlfox/leetcode
train
2
12f8a1f84095c51a4ecaa2fab7a76fa787a593f0
[ "for el in nums:\n if el in map:\n map[el] += 1\n else:\n map[el] = 1\nfor el in map:\n if map[el] < 2:\n return el", "a = 0\nfor i in nums:\n a ^= i\nreturn a" ]
<|body_start_0|> for el in nums: if el in map: map[el] += 1 else: map[el] = 1 for el in map: if map[el] < 2: return el <|end_body_0|> <|body_start_1|> a = 0 for i in nums: a ^= i retu...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def singleNumber(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def singleNumber2(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> for el in nums: if el in map: ...
stack_v2_sparse_classes_10k_train_003820
642
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "singleNumber", "signature": "def singleNumber(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "singleNumber2", "signature": "def singleNumber2(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_005151
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def singleNumber(self, nums): :type nums: List[int] :rtype: int - def singleNumber2(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def singleNumber(self, nums): :type nums: List[int] :rtype: int - def singleNumber2(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def singleNu...
b925bb22d1daa4a56c5a238a5758a926905559b4
<|skeleton|> class Solution: def singleNumber(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def singleNumber2(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def singleNumber(self, nums): """:type nums: List[int] :rtype: int""" for el in nums: if el in map: map[el] += 1 else: map[el] = 1 for el in map: if map[el] < 2: return el def singleNumbe...
the_stack_v2_python_sparse
Hash Table/136. Single Number.py
beninghton/notGivenUpToG
train
0
523cf396d97a5ba9a88feccb2aaf9633b356a7e9
[ "distribution = renamed_kwargs('distributions', 'distribution', distribution, kwargs)\ninstance_type = renamed_kwargs('train_instance_type', 'instance_type', kwargs.get('instance_type'), kwargs)\nvalidate_version_or_image_args(framework_version, py_version, image_uri)\nif py_version == 'py2':\n logger.warning(py...
<|body_start_0|> distribution = renamed_kwargs('distributions', 'distribution', distribution, kwargs) instance_type = renamed_kwargs('train_instance_type', 'instance_type', kwargs.get('instance_type'), kwargs) validate_version_or_image_args(framework_version, py_version, image_uri) if py...
Handle end-to-end training and deployment of custom MXNet code.
MXNet
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MXNet: """Handle end-to-end training and deployment of custom MXNet code.""" def __init__(self, entry_point: Union[str, PipelineVariable], framework_version: Optional[str]=None, py_version: Optional[str]=None, source_dir: Optional[Union[str, PipelineVariable]]=None, hyperparameters: Optional...
stack_v2_sparse_classes_10k_train_003821
15,079
permissive
[ { "docstring": "This ``Estimator`` executes an MXNet script in a managed MXNet execution environment. The managed MXNet environment is an Amazon-built Docker container that executes functions defined in the supplied ``entry_point`` Python script. Training is started by calling :meth:`~sagemaker.amazon.estimator...
4
null
Implement the Python class `MXNet` described below. Class description: Handle end-to-end training and deployment of custom MXNet code. Method signatures and docstrings: - def __init__(self, entry_point: Union[str, PipelineVariable], framework_version: Optional[str]=None, py_version: Optional[str]=None, source_dir: Op...
Implement the Python class `MXNet` described below. Class description: Handle end-to-end training and deployment of custom MXNet code. Method signatures and docstrings: - def __init__(self, entry_point: Union[str, PipelineVariable], framework_version: Optional[str]=None, py_version: Optional[str]=None, source_dir: Op...
8d5d7fd8ae1a917ed3e2b988d5e533bce244fd85
<|skeleton|> class MXNet: """Handle end-to-end training and deployment of custom MXNet code.""" def __init__(self, entry_point: Union[str, PipelineVariable], framework_version: Optional[str]=None, py_version: Optional[str]=None, source_dir: Optional[Union[str, PipelineVariable]]=None, hyperparameters: Optional...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MXNet: """Handle end-to-end training and deployment of custom MXNet code.""" def __init__(self, entry_point: Union[str, PipelineVariable], framework_version: Optional[str]=None, py_version: Optional[str]=None, source_dir: Optional[Union[str, PipelineVariable]]=None, hyperparameters: Optional[Dict[str, Un...
the_stack_v2_python_sparse
src/sagemaker/mxnet/estimator.py
aws/sagemaker-python-sdk
train
2,050
e261ee90ac21f193058a3a9581da3dc8b8eef0ec
[ "for group in self:\n if group.match(environments):\n return group\nreturn None", "ret = set()\nfor group in self:\n for env in group.environments:\n ret.add(HashableEnvironment(name=env.name, typename=env.environmentType.name))\nreturn sorted(ret, key=lambda e: e.typename)" ]
<|body_start_0|> for group in self: if group.match(environments): return group return None <|end_body_0|> <|body_start_1|> ret = set() for group in self: for env in group.environments: ret.add(HashableEnvironment(name=env.name, typ...
BaseEnvironmentGroupList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseEnvironmentGroupList: def match(self, environments): """If the given set of ``environments`` match any environment group in this environment group list, return that environment group. Else return None.""" <|body_0|> def environments(self): """Return a list of all...
stack_v2_sparse_classes_10k_train_003822
8,477
no_license
[ { "docstring": "If the given set of ``environments`` match any environment group in this environment group list, return that environment group. Else return None.", "name": "match", "signature": "def match(self, environments)" }, { "docstring": "Return a list of all unique environments in this en...
2
stack_v2_sparse_classes_30k_train_001414
Implement the Python class `BaseEnvironmentGroupList` described below. Class description: Implement the BaseEnvironmentGroupList class. Method signatures and docstrings: - def match(self, environments): If the given set of ``environments`` match any environment group in this environment group list, return that enviro...
Implement the Python class `BaseEnvironmentGroupList` described below. Class description: Implement the BaseEnvironmentGroupList class. Method signatures and docstrings: - def match(self, environments): If the given set of ``environments`` match any environment group in this environment group list, return that enviro...
deb6b22ed417740bf947e86938710bd5fa2ee2e7
<|skeleton|> class BaseEnvironmentGroupList: def match(self, environments): """If the given set of ``environments`` match any environment group in this environment group list, return that environment group. Else return None.""" <|body_0|> def environments(self): """Return a list of all...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BaseEnvironmentGroupList: def match(self, environments): """If the given set of ``environments`` match any environment group in this environment group list, return that environment group. Else return None.""" for group in self: if group.match(environments): return g...
the_stack_v2_python_sparse
ccui/environments/models.py
camd/caseconductor-ui
train
0
3e626f92e92602192afb86f04d6408699dbc6959
[ "self.image = image\nself.T_camera_world = T_camera_world\nself.obj_key = obj_key\nself.stable_pose = stable_pose", "if self.stable_pose is None:\n T_obj_world = RigidTransform(from_frame='obj', to_frame='world')\nelse:\n T_obj_world = self.stable_pose.T_obj_table.as_frames('obj', 'world')\nT_camera_obj = T...
<|body_start_0|> self.image = image self.T_camera_world = T_camera_world self.obj_key = obj_key self.stable_pose = stable_pose <|end_body_0|> <|body_start_1|> if self.stable_pose is None: T_obj_world = RigidTransform(from_frame='obj', to_frame='world') else: ...
Class to encapsulate images of an object rendered from a virtual camera. Note ---- In this class, the table's frame of reference is the 'world' frame for the renderer.
ObjectRender
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObjectRender: """Class to encapsulate images of an object rendered from a virtual camera. Note ---- In this class, the table's frame of reference is the 'world' frame for the renderer.""" def __init__(self, image, T_camera_world=RigidTransform(from_frame='camera', to_frame='table'), obj_key=...
stack_v2_sparse_classes_10k_train_003823
3,973
permissive
[ { "docstring": "Create an ObjectRender. Parameters ---------- image : :obj:`Image` The image to be encapsulated. T_camera_world : :obj:`autolab_core.RigidTransform` A rigid transform from camera to world coordinates (positions the camera in the world). TODO -- this should be renamed. obj_key : :obj:`str`, optio...
2
null
Implement the Python class `ObjectRender` described below. Class description: Class to encapsulate images of an object rendered from a virtual camera. Note ---- In this class, the table's frame of reference is the 'world' frame for the renderer. Method signatures and docstrings: - def __init__(self, image, T_camera_w...
Implement the Python class `ObjectRender` described below. Class description: Class to encapsulate images of an object rendered from a virtual camera. Note ---- In this class, the table's frame of reference is the 'world' frame for the renderer. Method signatures and docstrings: - def __init__(self, image, T_camera_w...
61217d65f040d536e54804150ce8abcf97343410
<|skeleton|> class ObjectRender: """Class to encapsulate images of an object rendered from a virtual camera. Note ---- In this class, the table's frame of reference is the 'world' frame for the renderer.""" def __init__(self, image, T_camera_world=RigidTransform(from_frame='camera', to_frame='table'), obj_key=...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ObjectRender: """Class to encapsulate images of an object rendered from a virtual camera. Note ---- In this class, the table's frame of reference is the 'world' frame for the renderer.""" def __init__(self, image, T_camera_world=RigidTransform(from_frame='camera', to_frame='table'), obj_key=None, stable_...
the_stack_v2_python_sparse
perception/object_render.py
jhu-lcsr/good_robot
train
95
d1905617c752cdda633b5c05b75315e3325fbb2d
[ "pre = None\ncur = head\nwhile cur:\n temp = cur.next\n cur.next = pre\n pre = cur\n cur = temp\nreturn pre", "pre = None\ncur = head\nwhile cur:\n cur.next, pre, cur = (pre, cur, cur.next)\nreturn pre" ]
<|body_start_0|> pre = None cur = head while cur: temp = cur.next cur.next = pre pre = cur cur = temp return pre <|end_body_0|> <|body_start_1|> pre = None cur = head while cur: cur.next, pre, cur = (pre...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseList(self, head): """反转链表的不用栈的解法 :type head: ListNode :rtype: ListNode""" <|body_0|> def reverseList2(self, head): """反转链表的不用栈的解法 :type head: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> pre = None ...
stack_v2_sparse_classes_10k_train_003824
1,805
no_license
[ { "docstring": "反转链表的不用栈的解法 :type head: ListNode :rtype: ListNode", "name": "reverseList", "signature": "def reverseList(self, head)" }, { "docstring": "反转链表的不用栈的解法 :type head: ListNode :rtype: ListNode", "name": "reverseList2", "signature": "def reverseList2(self, head)" } ]
2
stack_v2_sparse_classes_30k_train_006122
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head): 反转链表的不用栈的解法 :type head: ListNode :rtype: ListNode - def reverseList2(self, head): 反转链表的不用栈的解法 :type head: ListNode :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head): 反转链表的不用栈的解法 :type head: ListNode :rtype: ListNode - def reverseList2(self, head): 反转链表的不用栈的解法 :type head: ListNode :rtype: ListNode <|skeleton|> cla...
97cc61fefe0bedf5161687aab92fb09b0df990e2
<|skeleton|> class Solution: def reverseList(self, head): """反转链表的不用栈的解法 :type head: ListNode :rtype: ListNode""" <|body_0|> def reverseList2(self, head): """反转链表的不用栈的解法 :type head: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def reverseList(self, head): """反转链表的不用栈的解法 :type head: ListNode :rtype: ListNode""" pre = None cur = head while cur: temp = cur.next cur.next = pre pre = cur cur = temp return pre def reverseList2(self, hea...
the_stack_v2_python_sparse
code/link/reverse_link.py
JiaXingBinggan/For_work
train
0
e315300a30b15850767f98f346ae3062864c903d
[ "from .tier_config_request import TierConfigRequest\nfrom connect.resources.base import ApiClient\nresponse, _ = ApiClient(config, base_path='tier/config-requests').get(params={'status': 'approved', 'configuration.product.id': product_id, 'configuration.account.id': account_id})\nobjects = TierConfigRequest.deseria...
<|body_start_0|> from .tier_config_request import TierConfigRequest from connect.resources.base import ApiClient response, _ = ApiClient(config, base_path='tier/config-requests').get(params={'status': 'approved', 'configuration.product.id': product_id, 'configuration.account.id': account_id}) ...
Full representation of Tier object.
TierConfig
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TierConfig: """Full representation of Tier object.""" def get(cls, account_id, product_id, config=None): """Gets the specified tier config data. For example, to get Tier 1 configuration data for one request we can do: :: TierConfig.get(request.asset.tiers.tier1.id, request.asset.prod...
stack_v2_sparse_classes_10k_train_003825
3,868
permissive
[ { "docstring": "Gets the specified tier config data. For example, to get Tier 1 configuration data for one request we can do: :: TierConfig.get(request.asset.tiers.tier1.id, request.asset.product.id) :param str account_id: Account Id of the requested Tier Config (id with TA prefix). :param str product_id: Id of...
2
stack_v2_sparse_classes_30k_train_004414
Implement the Python class `TierConfig` described below. Class description: Full representation of Tier object. Method signatures and docstrings: - def get(cls, account_id, product_id, config=None): Gets the specified tier config data. For example, to get Tier 1 configuration data for one request we can do: :: TierCo...
Implement the Python class `TierConfig` described below. Class description: Full representation of Tier object. Method signatures and docstrings: - def get(cls, account_id, product_id, config=None): Gets the specified tier config data. For example, to get Tier 1 configuration data for one request we can do: :: TierCo...
656d653e4065637e2cc5768d7d554de17d0120eb
<|skeleton|> class TierConfig: """Full representation of Tier object.""" def get(cls, account_id, product_id, config=None): """Gets the specified tier config data. For example, to get Tier 1 configuration data for one request we can do: :: TierConfig.get(request.asset.tiers.tier1.id, request.asset.prod...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TierConfig: """Full representation of Tier object.""" def get(cls, account_id, product_id, config=None): """Gets the specified tier config data. For example, to get Tier 1 configuration data for one request we can do: :: TierConfig.get(request.asset.tiers.tier1.id, request.asset.product.id) :para...
the_stack_v2_python_sparse
connect/models/tier_config.py
cloudblue/connect-python-sdk
train
13
272a843592f160ad7cdbb2c798a266e0a7c50293
[ "if not prices:\n return 0\nn = len(prices)\ndp, money, profit = ([], prices[0], 0)\nfor i in range(n):\n profit = max(profit, prices[i] - money)\n money = min(money, prices[i])\n dp.append(profit)\ni, ans, money, profit = (n - 1, dp[n - 1], prices[n - 1], 0)\nwhile i >= 0:\n profit = max(profit, mon...
<|body_start_0|> if not prices: return 0 n = len(prices) dp, money, profit = ([], prices[0], 0) for i in range(n): profit = max(profit, prices[i] - money) money = min(money, prices[i]) dp.append(profit) i, ans, money, profit = (n - ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" <|body_1|> def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" ...
stack_v2_sparse_classes_10k_train_003826
3,922
no_license
[ { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfit", "signature": "def maxProfit(self, prices)" }, { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfit", "signature": "def maxProfit(self, prices)" }, { "docstring": ":type prices: List[int...
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 maxProfit(self, prices): :type prices: List[int] :rtype: int - def maxProfit(self, prices): :type prices: L...
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 maxProfit(self, prices): :type prices: List[int] :rtype: int - def maxProfit(self, prices): :type prices: L...
a2cd0dc5e098080df87c4fb57d16877d21ca47a3
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" <|body_1|> def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" ...
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 n = len(prices) dp, money, profit = ([], prices[0], 0) for i in range(n): profit = max(profit, prices[i] - money) money = min(mon...
the_stack_v2_python_sparse
0123_Best_Time_to_Buy_and_Sell_Stock_III/solution.py
benjaminhuanghuang/ben-leetcode
train
1
e9ee71490a9adedf56080c4fb337fe554becf3b7
[ "permission = AdministerOrganizationPermission(orgname)\nif permission.can():\n try:\n org = model.organization.get_organization(orgname)\n except model.InvalidOrganizationException:\n raise NotFound()\n permissions = model.permission.get_prototype_permissions(org)\n users_filter = {p.acti...
<|body_start_0|> permission = AdministerOrganizationPermission(orgname) if permission.can(): try: org = model.organization.get_organization(orgname) except model.InvalidOrganizationException: raise NotFound() permissions = model.permiss...
Resource for listing and creating permission prototypes.
PermissionPrototypeList
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PermissionPrototypeList: """Resource for listing and creating permission prototypes.""" def get(self, orgname): """List the existing prototypes for this organization.""" <|body_0|> def post(self, orgname): """Create a new permission prototype.""" <|body_1...
stack_v2_sparse_classes_10k_train_003827
10,847
permissive
[ { "docstring": "List the existing prototypes for this organization.", "name": "get", "signature": "def get(self, orgname)" }, { "docstring": "Create a new permission prototype.", "name": "post", "signature": "def post(self, orgname)" } ]
2
stack_v2_sparse_classes_30k_train_006243
Implement the Python class `PermissionPrototypeList` described below. Class description: Resource for listing and creating permission prototypes. Method signatures and docstrings: - def get(self, orgname): List the existing prototypes for this organization. - def post(self, orgname): Create a new permission prototype...
Implement the Python class `PermissionPrototypeList` described below. Class description: Resource for listing and creating permission prototypes. Method signatures and docstrings: - def get(self, orgname): List the existing prototypes for this organization. - def post(self, orgname): Create a new permission prototype...
e400a0c22c5f89dd35d571654b13d262b1f6e3b3
<|skeleton|> class PermissionPrototypeList: """Resource for listing and creating permission prototypes.""" def get(self, orgname): """List the existing prototypes for this organization.""" <|body_0|> def post(self, orgname): """Create a new permission prototype.""" <|body_1...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PermissionPrototypeList: """Resource for listing and creating permission prototypes.""" def get(self, orgname): """List the existing prototypes for this organization.""" permission = AdministerOrganizationPermission(orgname) if permission.can(): try: or...
the_stack_v2_python_sparse
endpoints/api/prototype.py
quay/quay
train
2,363
03fda521bbe5e29bb4b667e00ac2bca7a3b8dd5a
[ "if BLOCK_TARGET_MIN <= celsius <= BLOCK_TARGET_MAX:\n return celsius\nraise InvalidTargetTemperatureError(f'Thermocycler block temperature must be between {BLOCK_TARGET_MIN} and {BLOCK_TARGET_MAX}, but got {celsius}.')", "if BLOCK_VOL_MIN <= volume <= BLOCK_VOL_MAX:\n return volume\nraise InvalidBlockVolum...
<|body_start_0|> if BLOCK_TARGET_MIN <= celsius <= BLOCK_TARGET_MAX: return celsius raise InvalidTargetTemperatureError(f'Thermocycler block temperature must be between {BLOCK_TARGET_MIN} and {BLOCK_TARGET_MAX}, but got {celsius}.') <|end_body_0|> <|body_start_1|> if BLOCK_VOL_MIN <...
Thermocycler-specific state. Provides calculations and read-only state access for an individual loaded Thermocycler Module.
ThermocyclerModuleSubState
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ThermocyclerModuleSubState: """Thermocycler-specific state. Provides calculations and read-only state access for an individual loaded Thermocycler Module.""" def validate_target_block_temperature(celsius: float) -> float: """Validate a given target block temperature. Args: celsius: T...
stack_v2_sparse_classes_10k_train_003828
4,389
permissive
[ { "docstring": "Validate a given target block temperature. Args: celsius: The requested block temperature. Raises: InvalidTargetTemperatureError: The given temperature is outside the thermocycler's operating range. Returns: The validated temperature in degrees Celsius.", "name": "validate_target_block_tempe...
6
null
Implement the Python class `ThermocyclerModuleSubState` described below. Class description: Thermocycler-specific state. Provides calculations and read-only state access for an individual loaded Thermocycler Module. Method signatures and docstrings: - def validate_target_block_temperature(celsius: float) -> float: Va...
Implement the Python class `ThermocyclerModuleSubState` described below. Class description: Thermocycler-specific state. Provides calculations and read-only state access for an individual loaded Thermocycler Module. Method signatures and docstrings: - def validate_target_block_temperature(celsius: float) -> float: Va...
026b523c8c9e5d45910c490efb89194d72595be9
<|skeleton|> class ThermocyclerModuleSubState: """Thermocycler-specific state. Provides calculations and read-only state access for an individual loaded Thermocycler Module.""" def validate_target_block_temperature(celsius: float) -> float: """Validate a given target block temperature. Args: celsius: T...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ThermocyclerModuleSubState: """Thermocycler-specific state. Provides calculations and read-only state access for an individual loaded Thermocycler Module.""" def validate_target_block_temperature(celsius: float) -> float: """Validate a given target block temperature. Args: celsius: The requested ...
the_stack_v2_python_sparse
api/src/opentrons/protocol_engine/state/module_substates/thermocycler_module_substate.py
Opentrons/opentrons
train
326
28c7565cb588438c403d9c51a49e43678b3ac228
[ "self.bottomleft = []\nself.areas = []\ntotal = 0\nfor rect in rects:\n x1, y1, x2, y2 = rect\n self.bottomleft.append([x1, y1, x2 - x1 + 1])\n total += (y2 - y1 + 1) * (x2 - x1 + 1)\n self.areas.append(total)", "if not self.bottomleft:\n return []\nn = random.randint(1, self.areas[-1])\ni = bisect...
<|body_start_0|> self.bottomleft = [] self.areas = [] total = 0 for rect in rects: x1, y1, x2, y2 = rect self.bottomleft.append([x1, y1, x2 - x1 + 1]) total += (y2 - y1 + 1) * (x2 - x1 + 1) self.areas.append(total) <|end_body_0|> <|body_st...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, rects): """:type rects: List[List[int]]""" <|body_0|> def pick(self): """:rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.bottomleft = [] self.areas = [] total = 0 for rect i...
stack_v2_sparse_classes_10k_train_003829
2,440
no_license
[ { "docstring": ":type rects: List[List[int]]", "name": "__init__", "signature": "def __init__(self, rects)" }, { "docstring": ":rtype: List[int]", "name": "pick", "signature": "def pick(self)" } ]
2
stack_v2_sparse_classes_30k_train_002062
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, rects): :type rects: List[List[int]] - def pick(self): :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, rects): :type rects: List[List[int]] - def pick(self): :rtype: List[int] <|skeleton|> class Solution: def __init__(self, rects): """:type rects: ...
188befbfb7080ba1053ee1f7187b177b64cf42d2
<|skeleton|> class Solution: def __init__(self, rects): """:type rects: List[List[int]]""" <|body_0|> def pick(self): """:rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, rects): """:type rects: List[List[int]]""" self.bottomleft = [] self.areas = [] total = 0 for rect in rects: x1, y1, x2, y2 = rect self.bottomleft.append([x1, y1, x2 - x1 + 1]) total += (y2 - y1 + 1) * (x2...
the_stack_v2_python_sparse
0497. Random Point in Non-overlapping Rectangles.py
pwang867/LeetCode-Solutions-Python
train
0
08a9bb372d73c7a681974837030963b6634e078e
[ "threading.Thread.__init__(self)\nself.__port_queue = port_queue\nself.__ip = ip\nself.__timeout = timeout", "while True:\n if self.__port_queue.empty():\n break\n OPEN_MSG = '% 6d [OPEN]\\n'\n port = self.__port_queue.get(timeout=0.5)\n ip = self.__ip\n timeout = self.__timeout\n try:\n ...
<|body_start_0|> threading.Thread.__init__(self) self.__port_queue = port_queue self.__ip = ip self.__timeout = timeout <|end_body_0|> <|body_start_1|> while True: if self.__port_queue.empty(): break OPEN_MSG = '% 6d [OPEN]\n' ...
PortScan
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PortScan: def __init__(self, port_queue, ip, timeout=3): """初始化参数""" <|body_0|> def run(self): """多线程实际调用的方法,如果端口队列不为空,循环执行""" <|body_1|> <|end_skeleton|> <|body_start_0|> threading.Thread.__init__(self) self.__port_queue = port_queue ...
stack_v2_sparse_classes_10k_train_003830
11,644
no_license
[ { "docstring": "初始化参数", "name": "__init__", "signature": "def __init__(self, port_queue, ip, timeout=3)" }, { "docstring": "多线程实际调用的方法,如果端口队列不为空,循环执行", "name": "run", "signature": "def run(self)" } ]
2
stack_v2_sparse_classes_30k_train_001095
Implement the Python class `PortScan` described below. Class description: Implement the PortScan class. Method signatures and docstrings: - def __init__(self, port_queue, ip, timeout=3): 初始化参数 - def run(self): 多线程实际调用的方法,如果端口队列不为空,循环执行
Implement the Python class `PortScan` described below. Class description: Implement the PortScan class. Method signatures and docstrings: - def __init__(self, port_queue, ip, timeout=3): 初始化参数 - def run(self): 多线程实际调用的方法,如果端口队列不为空,循环执行 <|skeleton|> class PortScan: def __init__(self, port_queue, ip, timeout=3): ...
03ea528b0405e3602e7cdab82dc98ed4ada79e0f
<|skeleton|> class PortScan: def __init__(self, port_queue, ip, timeout=3): """初始化参数""" <|body_0|> def run(self): """多线程实际调用的方法,如果端口队列不为空,循环执行""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PortScan: def __init__(self, port_queue, ip, timeout=3): """初始化参数""" threading.Thread.__init__(self) self.__port_queue = port_queue self.__ip = ip self.__timeout = timeout def run(self): """多线程实际调用的方法,如果端口队列不为空,循环执行""" while True: if sel...
the_stack_v2_python_sparse
Python/python_saomiao/main.py
QiYi92/StudyLab
train
3
6544b630174ec46621b87b7fff5e3fddeef21266
[ "url = self.trimUrlPrefix(urlTrait.url)\nif url and self.isTnsStyle(url):\n EMPTY = OracleTnsRecordParser.EMPTY\n obj = OracleTnsRecordParser().parse(url)\n uniqueHostCount = self._countUniqueHosts(obj)\n description = self._getDescription(obj)\n serviceName = description.connect_data.service_name\n ...
<|body_start_0|> url = self.trimUrlPrefix(urlTrait.url) if url and self.isTnsStyle(url): EMPTY = OracleTnsRecordParser.EMPTY obj = OracleTnsRecordParser().parse(url) uniqueHostCount = self._countUniqueHosts(obj) description = self._getDescription(obj) ...
OracleThinNoSidCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OracleThinNoSidCase: def isApplicableUrlTrait(self, urlTrait): """@types: jdbc_url_parser.Trait -> bool""" <|body_0|> def parse(self, url): """@types: str -> tuple[db.DatabaseServer]""" <|body_1|> <|end_skeleton|> <|body_start_0|> url = self.trimUrl...
stack_v2_sparse_classes_10k_train_003831
40,819
no_license
[ { "docstring": "@types: jdbc_url_parser.Trait -> bool", "name": "isApplicableUrlTrait", "signature": "def isApplicableUrlTrait(self, urlTrait)" }, { "docstring": "@types: str -> tuple[db.DatabaseServer]", "name": "parse", "signature": "def parse(self, url)" } ]
2
stack_v2_sparse_classes_30k_train_003677
Implement the Python class `OracleThinNoSidCase` described below. Class description: Implement the OracleThinNoSidCase class. Method signatures and docstrings: - def isApplicableUrlTrait(self, urlTrait): @types: jdbc_url_parser.Trait -> bool - def parse(self, url): @types: str -> tuple[db.DatabaseServer]
Implement the Python class `OracleThinNoSidCase` described below. Class description: Implement the OracleThinNoSidCase class. Method signatures and docstrings: - def isApplicableUrlTrait(self, urlTrait): @types: jdbc_url_parser.Trait -> bool - def parse(self, url): @types: str -> tuple[db.DatabaseServer] <|skeleton|...
c431e809e8d0f82e1bca7e3429dd0245560b5680
<|skeleton|> class OracleThinNoSidCase: def isApplicableUrlTrait(self, urlTrait): """@types: jdbc_url_parser.Trait -> bool""" <|body_0|> def parse(self, url): """@types: str -> tuple[db.DatabaseServer]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class OracleThinNoSidCase: def isApplicableUrlTrait(self, urlTrait): """@types: jdbc_url_parser.Trait -> bool""" url = self.trimUrlPrefix(urlTrait.url) if url and self.isTnsStyle(url): EMPTY = OracleTnsRecordParser.EMPTY obj = OracleTnsRecordParser().parse(url) ...
the_stack_v2_python_sparse
reference/ucmdb/discovery/jdbc_url_parser.py
madmonkyang/cda-record
train
0
40bcfafa21c3ca7b5460447beb018a09eb520a02
[ "super(FeatureImportanceAndBilinearFeatureInteractionNetwork, self).__init__()\nself.senet = SENETLayer(num_fields, senet_reduction)\nself.emb_bilinear = BilinearInteractionLayer(embed_size, num_fields, bilinear_type, bilinear_bias)\nself.senet_bilinear = BilinearInteractionLayer(embed_size, num_fields, bilinear_ty...
<|body_start_0|> super(FeatureImportanceAndBilinearFeatureInteractionNetwork, self).__init__() self.senet = SENETLayer(num_fields, senet_reduction) self.emb_bilinear = BilinearInteractionLayer(embed_size, num_fields, bilinear_type, bilinear_bias) self.senet_bilinear = BilinearInteraction...
Model class of Feature-Importance and Bilinear-Feature-Interaction Network (FiBiNet). Feature-Importance and Bilinear-Feature-Interaction Network was proposed by Tongwen Huang in Sina Weibo Inc. in 2019, which is: #. to implement a famous computer vision algorithm `SENET` on recommendation system. #. to apply bilinear ...
FeatureImportanceAndBilinearFeatureInteractionNetwork
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FeatureImportanceAndBilinearFeatureInteractionNetwork: """Model class of Feature-Importance and Bilinear-Feature-Interaction Network (FiBiNet). Feature-Importance and Bilinear-Feature-Interaction Network was proposed by Tongwen Huang in Sina Weibo Inc. in 2019, which is: #. to implement a famous ...
stack_v2_sparse_classes_10k_train_003832
5,507
permissive
[ { "docstring": "Initialize FeatureImportanceAndBilinearFeatureInteractionNetwork Args: embed_size (int): Size of embedding tensor num_fields (int): Number of inputs' fields senet_reduction (int): Size of reduction in dense layer of senet. deep_output_size (int): Output size of dense network deep_layer_sizes (Li...
2
stack_v2_sparse_classes_30k_train_004107
Implement the Python class `FeatureImportanceAndBilinearFeatureInteractionNetwork` described below. Class description: Model class of Feature-Importance and Bilinear-Feature-Interaction Network (FiBiNet). Feature-Importance and Bilinear-Feature-Interaction Network was proposed by Tongwen Huang in Sina Weibo Inc. in 20...
Implement the Python class `FeatureImportanceAndBilinearFeatureInteractionNetwork` described below. Class description: Model class of Feature-Importance and Bilinear-Feature-Interaction Network (FiBiNet). Feature-Importance and Bilinear-Feature-Interaction Network was proposed by Tongwen Huang in Sina Weibo Inc. in 20...
07a6a38c7eb44225f2b22f332081f697c3b92894
<|skeleton|> class FeatureImportanceAndBilinearFeatureInteractionNetwork: """Model class of Feature-Importance and Bilinear-Feature-Interaction Network (FiBiNet). Feature-Importance and Bilinear-Feature-Interaction Network was proposed by Tongwen Huang in Sina Weibo Inc. in 2019, which is: #. to implement a famous ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FeatureImportanceAndBilinearFeatureInteractionNetwork: """Model class of Feature-Importance and Bilinear-Feature-Interaction Network (FiBiNet). Feature-Importance and Bilinear-Feature-Interaction Network was proposed by Tongwen Huang in Sina Weibo Inc. in 2019, which is: #. to implement a famous computer visi...
the_stack_v2_python_sparse
torecsys/models/ctr/feature_importance_and_bilinear_feature_interaction_network.py
zwcdp/torecsys
train
0
30f28f4fe58d9bf2525ffca0c671effbc3b0f3a6
[ "len_g = len(grid)\nlen_gp = len_g * 4 + 1\ngp = [['1'] * len_gp for _ in range(len_gp)]\nfor i in range(len_g):\n l = list(grid[i])\n for j in range(len_g):\n row = 4 * i + 2\n col = 4 * j + 2\n if l[j] == '\\\\':\n gp[row - 2][col - 2] = '0'\n gp[row - 1][col - 1] ...
<|body_start_0|> len_g = len(grid) len_gp = len_g * 4 + 1 gp = [['1'] * len_gp for _ in range(len_gp)] for i in range(len_g): l = list(grid[i]) for j in range(len_g): row = 4 * i + 2 col = 4 * j + 2 if l[j] == '\\': ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def regionsBySlashes(self, grid): """:type grid: List[str] :rtype: int""" <|body_0|> def numIslands(self, grid): """:type grid: List[List[str]] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> len_g = len(grid) len_gp = ...
stack_v2_sparse_classes_10k_train_003833
2,743
no_license
[ { "docstring": ":type grid: List[str] :rtype: int", "name": "regionsBySlashes", "signature": "def regionsBySlashes(self, grid)" }, { "docstring": ":type grid: List[List[str]] :rtype: int", "name": "numIslands", "signature": "def numIslands(self, grid)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def regionsBySlashes(self, grid): :type grid: List[str] :rtype: int - def numIslands(self, grid): :type grid: List[List[str]] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def regionsBySlashes(self, grid): :type grid: List[str] :rtype: int - def numIslands(self, grid): :type grid: List[List[str]] :rtype: int <|skeleton|> class Solution: def r...
3232620c73175dcf4cfef31a07319e7cc032d224
<|skeleton|> class Solution: def regionsBySlashes(self, grid): """:type grid: List[str] :rtype: int""" <|body_0|> def numIslands(self, grid): """:type grid: List[List[str]] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def regionsBySlashes(self, grid): """:type grid: List[str] :rtype: int""" len_g = len(grid) len_gp = len_g * 4 + 1 gp = [['1'] * len_gp for _ in range(len_gp)] for i in range(len_g): l = list(grid[i]) for j in range(len_g): ...
the_stack_v2_python_sparse
C115/0959_regions_cut_by_slashes/solution_1.py
asymmetry/leetcode
train
0
5eae4fc521669e25024b4e7526a1b103c984d9a4
[ "srcdir = tf_cfg.cfg.get('Tempesta', 'srcdir')\nworkdir = tf_cfg.cfg.get('Tempesta', 'workdir')\ntemplate = '%s/etc/js_challenge.tpl' % srcdir\njs_code = '%s/etc/js_challenge.js.tpl' % srcdir\nremote.tempesta.run_cmd('cp %s %s' % (js_code, workdir))\nremote.tempesta.run_cmd('cp %s %s/js1.tpl' % (template, workdir))...
<|body_start_0|> srcdir = tf_cfg.cfg.get('Tempesta', 'srcdir') workdir = tf_cfg.cfg.get('Tempesta', 'workdir') template = '%s/etc/js_challenge.tpl' % srcdir js_code = '%s/etc/js_challenge.js.tpl' % srcdir remote.tempesta.run_cmd('cp %s %s' % (js_code, workdir)) remote.tem...
Implicit default vhost use other implementation of `sticky` inheritance. Check that correct configuration is derived.
JSChallengeDefVhostInherit
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JSChallengeDefVhostInherit: """Implicit default vhost use other implementation of `sticky` inheritance. Check that correct configuration is derived.""" def prepare_js_templates(self): """Templates for JS challenge are modified by start script, create a copy of default template for ea...
stack_v2_sparse_classes_10k_train_003834
24,777
no_license
[ { "docstring": "Templates for JS challenge are modified by start script, create a copy of default template for each vhost.", "name": "prepare_js_templates", "signature": "def prepare_js_templates(self)" }, { "docstring": "Clients send the validating request just in time and pass the challenge.",...
2
null
Implement the Python class `JSChallengeDefVhostInherit` described below. Class description: Implicit default vhost use other implementation of `sticky` inheritance. Check that correct configuration is derived. Method signatures and docstrings: - def prepare_js_templates(self): Templates for JS challenge are modified ...
Implement the Python class `JSChallengeDefVhostInherit` described below. Class description: Implicit default vhost use other implementation of `sticky` inheritance. Check that correct configuration is derived. Method signatures and docstrings: - def prepare_js_templates(self): Templates for JS challenge are modified ...
d56358ea653dbb367624937197ce5e489abf0b00
<|skeleton|> class JSChallengeDefVhostInherit: """Implicit default vhost use other implementation of `sticky` inheritance. Check that correct configuration is derived.""" def prepare_js_templates(self): """Templates for JS challenge are modified by start script, create a copy of default template for ea...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class JSChallengeDefVhostInherit: """Implicit default vhost use other implementation of `sticky` inheritance. Check that correct configuration is derived.""" def prepare_js_templates(self): """Templates for JS challenge are modified by start script, create a copy of default template for each vhost.""" ...
the_stack_v2_python_sparse
sessions/test_js_challenge.py
tempesta-tech/tempesta-test
train
13
0454283d33cae7fb384f8ea432ca3f005e621e7a
[ "if not head:\n return\nif not head.next:\n return head\ncurrent = head\nwhile current and current.next:\n next = current.next\n if current.val == next.val:\n current.next = next.next\n else:\n current = current.next\nreturn head", "if not head:\n return\nif not head.next:\n ret...
<|body_start_0|> if not head: return if not head.next: return head current = head while current and current.next: next = current.next if current.val == next.val: current.next = next.next else: cur...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def deleteDuplicates(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def deleteDuplicates1(self, head): """82. Remove Duplicates from Sorted List II Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only d...
stack_v2_sparse_classes_10k_train_003835
1,622
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode", "name": "deleteDuplicates", "signature": "def deleteDuplicates(self, head)" }, { "docstring": "82. Remove Duplicates from Sorted List II Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers...
2
stack_v2_sparse_classes_30k_train_004970
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def deleteDuplicates(self, head): :type head: ListNode :rtype: ListNode - def deleteDuplicates1(self, head): 82. Remove Duplicates from Sorted List II Given a sorted linked list,...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def deleteDuplicates(self, head): :type head: ListNode :rtype: ListNode - def deleteDuplicates1(self, head): 82. Remove Duplicates from Sorted List II Given a sorted linked list,...
11ad9d3841de09c0b4dc3a667e7e63c3558656a5
<|skeleton|> class Solution: def deleteDuplicates(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def deleteDuplicates1(self, head): """82. Remove Duplicates from Sorted List II Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only d...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def deleteDuplicates(self, head): """:type head: ListNode :rtype: ListNode""" if not head: return if not head.next: return head current = head while current and current.next: next = current.next if current.val ==...
the_stack_v2_python_sparse
remove_duplicate_from_linklist.py
ganlanshu/leetcode
train
0
ad8494616fa79f617b37aa9cb59fbcd103124889
[ "def function(x, n):\n \"\"\" Square root function f(x) = x^2 - n \"\"\"\n return x ** 2 - n\n\ndef newton_raphson(x1, fx1, f1):\n \"\"\" newton raphson formula -> x2 = x1 - fx1 / f1 \n here f1 is derivative of fx1\n \"\"\"\n return x1 - f1 / fx1\nif x == 0 or x == 1:\n ret...
<|body_start_0|> def function(x, n): """ Square root function f(x) = x^2 - n """ return x ** 2 - n def newton_raphson(x1, fx1, f1): """ newton raphson formula -> x2 = x1 - fx1 / f1 here f1 is derivative of fx1 """ ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mySqrt(self, x): """:type x: int :rtype: int""" <|body_0|> def mySqrt2(self, x): """Alternative method using newton integer division method""" <|body_1|> <|end_skeleton|> <|body_start_0|> def function(x, n): """ Square root...
stack_v2_sparse_classes_10k_train_003836
1,218
no_license
[ { "docstring": ":type x: int :rtype: int", "name": "mySqrt", "signature": "def mySqrt(self, x)" }, { "docstring": "Alternative method using newton integer division method", "name": "mySqrt2", "signature": "def mySqrt2(self, x)" } ]
2
stack_v2_sparse_classes_30k_val_000149
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mySqrt(self, x): :type x: int :rtype: int - def mySqrt2(self, x): Alternative method using newton integer division method
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mySqrt(self, x): :type x: int :rtype: int - def mySqrt2(self, x): Alternative method using newton integer division method <|skeleton|> class Solution: def mySqrt(self, ...
b7e92f9a7c4d6652d4901b189f51063ce5520653
<|skeleton|> class Solution: def mySqrt(self, x): """:type x: int :rtype: int""" <|body_0|> def mySqrt2(self, x): """Alternative method using newton integer division method""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def mySqrt(self, x): """:type x: int :rtype: int""" def function(x, n): """ Square root function f(x) = x^2 - n """ return x ** 2 - n def newton_raphson(x1, fx1, f1): """ newton raphson formula -> x2 = x1 - fx1 / f1 ...
the_stack_v2_python_sparse
leetcode/easy/sqrt.py
abkunal/Data-Structures-and-Algorithms
train
2
e3b011d583ba1bc375c176c8ff82128a252c3d0a
[ "self.class_score_th = class_score_th\nsession_option = onnxruntime.SessionOptions()\nsession_option.log_severity_level = 3\nself.onnx_session = onnxruntime.InferenceSession(model_path, sess_options=session_option, providers=providers)\nself.providers = self.onnx_session.get_providers()\nself.input_shapes = [input....
<|body_start_0|> self.class_score_th = class_score_th session_option = onnxruntime.SessionOptions() session_option.log_severity_level = 3 self.onnx_session = onnxruntime.InferenceSession(model_path, sess_options=session_option, providers=providers) self.providers = self.onnx_sess...
YOLOv5ONNX
[ "AGPL-3.0-only", "LicenseRef-scancode-proprietary-license", "MIT", "GPL-3.0-only" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class YOLOv5ONNX: def __init__(self, model_path: Optional[str]='yolov5l6_ball_1088x1920_130050_post.onnx', class_score_th: Optional[float]=0.3, providers: Optional[List]=[('TensorrtExecutionProvider', {'trt_engine_cache_enable': True, 'trt_engine_cache_path': '.', 'trt_fp16_enable': True}), 'CUDAExecu...
stack_v2_sparse_classes_10k_train_003837
9,092
permissive
[ { "docstring": "YOLOv5ONNX Parameters ---------- model_path: Optional[str] ONNX file path for YOLOv5 class_score_th: Optional[float] class_score_th: Optional[float] Score threshold. Default: 0.30 providers: Optional[List] Name of onnx execution providers Default: [ ( 'TensorrtExecutionProvider', { 'trt_engine_c...
4
null
Implement the Python class `YOLOv5ONNX` described below. Class description: Implement the YOLOv5ONNX class. Method signatures and docstrings: - def __init__(self, model_path: Optional[str]='yolov5l6_ball_1088x1920_130050_post.onnx', class_score_th: Optional[float]=0.3, providers: Optional[List]=[('TensorrtExecutionPr...
Implement the Python class `YOLOv5ONNX` described below. Class description: Implement the YOLOv5ONNX class. Method signatures and docstrings: - def __init__(self, model_path: Optional[str]='yolov5l6_ball_1088x1920_130050_post.onnx', class_score_th: Optional[float]=0.3, providers: Optional[List]=[('TensorrtExecutionPr...
ff08e6e8ab095d98e96fc4a136ad5cbccc75fcf9
<|skeleton|> class YOLOv5ONNX: def __init__(self, model_path: Optional[str]='yolov5l6_ball_1088x1920_130050_post.onnx', class_score_th: Optional[float]=0.3, providers: Optional[List]=[('TensorrtExecutionProvider', {'trt_engine_cache_enable': True, 'trt_engine_cache_path': '.', 'trt_fp16_enable': True}), 'CUDAExecu...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class YOLOv5ONNX: def __init__(self, model_path: Optional[str]='yolov5l6_ball_1088x1920_130050_post.onnx', class_score_th: Optional[float]=0.3, providers: Optional[List]=[('TensorrtExecutionProvider', {'trt_engine_cache_enable': True, 'trt_engine_cache_path': '.', 'trt_fp16_enable': True}), 'CUDAExecutionProvider',...
the_stack_v2_python_sparse
331_YOLOv5L6_Ball/demo_yolov5_onnx.py
PINTO0309/PINTO_model_zoo
train
2,849
7bbe6ff85c57ff3dda3a1eb95e2eab12c735ee1b
[ "json_data = open(BASE_DIR + '/../config/keyArel.json')\nif json_data:\n data = json.load(json_data)\n key = data['key']\n app = data['app']\n data = {'grant_type': 'password', 'username': user, 'password': pwd, 'scope': 'read', 'format': 'json'}\n http_response = requests.post('https://arel.eisti.fr...
<|body_start_0|> json_data = open(BASE_DIR + '/../config/keyArel.json') if json_data: data = json.load(json_data) key = data['key'] app = data['app'] data = {'grant_type': 'password', 'username': user, 'password': pwd, 'scope': 'read', 'format': 'json'} ...
Arel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Arel: def get_token(self, user, pwd): """recupere un token de l'api d'arel si le user et le mot de passe correspondent""" <|body_0|> def requete_arel(self, url_api, token): """fait une requete sur l'api d'arel et renvoi le résultat en json (le token doit être valide)...
stack_v2_sparse_classes_10k_train_003838
1,755
permissive
[ { "docstring": "recupere un token de l'api d'arel si le user et le mot de passe correspondent", "name": "get_token", "signature": "def get_token(self, user, pwd)" }, { "docstring": "fait une requete sur l'api d'arel et renvoi le résultat en json (le token doit être valide)", "name": "requete...
2
stack_v2_sparse_classes_30k_train_007151
Implement the Python class `Arel` described below. Class description: Implement the Arel class. Method signatures and docstrings: - def get_token(self, user, pwd): recupere un token de l'api d'arel si le user et le mot de passe correspondent - def requete_arel(self, url_api, token): fait une requete sur l'api d'arel ...
Implement the Python class `Arel` described below. Class description: Implement the Arel class. Method signatures and docstrings: - def get_token(self, user, pwd): recupere un token de l'api d'arel si le user et le mot de passe correspondent - def requete_arel(self, url_api, token): fait une requete sur l'api d'arel ...
753890fe5c57cd5f6ac7754d9042817059b2ee4a
<|skeleton|> class Arel: def get_token(self, user, pwd): """recupere un token de l'api d'arel si le user et le mot de passe correspondent""" <|body_0|> def requete_arel(self, url_api, token): """fait une requete sur l'api d'arel et renvoi le résultat en json (le token doit être valide)...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Arel: def get_token(self, user, pwd): """recupere un token de l'api d'arel si le user et le mot de passe correspondent""" json_data = open(BASE_DIR + '/../config/keyArel.json') if json_data: data = json.load(json_data) key = data['key'] app = data['a...
the_stack_v2_python_sparse
peytalaneApp/functions/arel.py
lpmng/lpmng-peytalane
train
1
47c0047efdc7219376c31b662c1461e701071671
[ "conf = GlobalConfig.fetch()\nif not conf:\n conf = GlobalConfig()\nreturn GlobalConfigMessage(services_config_location=conf.services_config_location, services_config_storage_type=conf.services_config_storage_type)", "conf = GlobalConfig.fetch()\nif not conf:\n conf = GlobalConfig()\nchanged = conf.modify(u...
<|body_start_0|> conf = GlobalConfig.fetch() if not conf: conf = GlobalConfig() return GlobalConfigMessage(services_config_location=conf.services_config_location, services_config_storage_type=conf.services_config_storage_type) <|end_body_0|> <|body_start_1|> conf = GlobalCon...
Administration API accessible only by the service admins.
AdminApi
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdminApi: """Administration API accessible only by the service admins.""" def read_global_config(self, _request): """Reads global configuration.""" <|body_0|> def write_global_config(self, request): """Writes global configuration.""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_10k_train_003839
3,033
permissive
[ { "docstring": "Reads global configuration.", "name": "read_global_config", "signature": "def read_global_config(self, _request)" }, { "docstring": "Writes global configuration.", "name": "write_global_config", "signature": "def write_global_config(self, request)" } ]
2
null
Implement the Python class `AdminApi` described below. Class description: Administration API accessible only by the service admins. Method signatures and docstrings: - def read_global_config(self, _request): Reads global configuration. - def write_global_config(self, request): Writes global configuration.
Implement the Python class `AdminApi` described below. Class description: Administration API accessible only by the service admins. Method signatures and docstrings: - def read_global_config(self, _request): Reads global configuration. - def write_global_config(self, request): Writes global configuration. <|skeleton...
10cc5fdcca53e2a1690867acbe6fce099273f092
<|skeleton|> class AdminApi: """Administration API accessible only by the service admins.""" def read_global_config(self, _request): """Reads global configuration.""" <|body_0|> def write_global_config(self, request): """Writes global configuration.""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AdminApi: """Administration API accessible only by the service admins.""" def read_global_config(self, _request): """Reads global configuration.""" conf = GlobalConfig.fetch() if not conf: conf = GlobalConfig() return GlobalConfigMessage(services_config_locatio...
the_stack_v2_python_sparse
appengine/config_service/admin.py
luci/luci-py
train
84
4406a3e8d5e4a86d8e52abdac2b187e7773c5f98
[ "gtk.Button.__init__(self)\nself.test_ticker = 0\nself.progress_buffer = PowerProgressBuffer()\nself.connect('expose-event', self.expose_progressbar)", "cr = widget.window.cairo_create()\nrect = widget.allocation\nself.progress_buffer.render(cr, rect)\npropagate_expose(widget, event)\nreturn True" ]
<|body_start_0|> gtk.Button.__init__(self) self.test_ticker = 0 self.progress_buffer = PowerProgressBuffer() self.connect('expose-event', self.expose_progressbar) <|end_body_0|> <|body_start_1|> cr = widget.window.cairo_create() rect = widget.allocation self.prog...
Progress bar. @undocumented: expose_progressbar @undocumented: update_light_ticker
PowerProgressBar
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PowerProgressBar: """Progress bar. @undocumented: expose_progressbar @undocumented: update_light_ticker""" def __init__(self): """Initialize progress bar.""" <|body_0|> def expose_progressbar(self, widget, event): """Internal callback for `expose` signal.""" ...
stack_v2_sparse_classes_10k_train_003840
4,596
no_license
[ { "docstring": "Initialize progress bar.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Internal callback for `expose` signal.", "name": "expose_progressbar", "signature": "def expose_progressbar(self, widget, event)" } ]
2
null
Implement the Python class `PowerProgressBar` described below. Class description: Progress bar. @undocumented: expose_progressbar @undocumented: update_light_ticker Method signatures and docstrings: - def __init__(self): Initialize progress bar. - def expose_progressbar(self, widget, event): Internal callback for `ex...
Implement the Python class `PowerProgressBar` described below. Class description: Progress bar. @undocumented: expose_progressbar @undocumented: update_light_ticker Method signatures and docstrings: - def __init__(self): Initialize progress bar. - def expose_progressbar(self, widget, event): Internal callback for `ex...
1b83a035a4dfd57a2ba87c453f6b394d506c98f1
<|skeleton|> class PowerProgressBar: """Progress bar. @undocumented: expose_progressbar @undocumented: update_light_ticker""" def __init__(self): """Initialize progress bar.""" <|body_0|> def expose_progressbar(self, widget, event): """Internal callback for `expose` signal.""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PowerProgressBar: """Progress bar. @undocumented: expose_progressbar @undocumented: update_light_ticker""" def __init__(self): """Initialize progress bar.""" gtk.Button.__init__(self) self.test_ticker = 0 self.progress_buffer = PowerProgressBuffer() self.connect('e...
the_stack_v2_python_sparse
modules/power/src/power_progressbar.py
electricface/deepin-system-settings
train
0
0530e9112702a0b71ec68f72aa4ac7d4fb39baa0
[ "super().__init__()\nself.query_emb = nn.Linear(in_channels, out_channels)\nself.key_emb = nn.Linear(in_channels, out_channels)\nself.val_emb = nn.Linear(in_channels, out_channels)\nself.att = nn.MultiheadAttention(out_channels, 1)", "queries = self.query_emb(node_encodings.permute(1, 0, 2))\nkeys = self.key_emb(...
<|body_start_0|> super().__init__() self.query_emb = nn.Linear(in_channels, out_channels) self.key_emb = nn.Linear(in_channels, out_channels) self.val_emb = nn.Linear(in_channels, out_channels) self.att = nn.MultiheadAttention(out_channels, 1) <|end_body_0|> <|body_start_1|> ...
GAT layer for aggregating local context at each lane node. Uses scaled dot product attention using pytorch's multihead attention module.
GAT
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GAT: """GAT layer for aggregating local context at each lane node. Uses scaled dot product attention using pytorch's multihead attention module.""" def __init__(self, in_channels, out_channels): """Initialize GAT layer. :param in_channels: size of node encodings :param out_channels: ...
stack_v2_sparse_classes_10k_train_003841
27,074
permissive
[ { "docstring": "Initialize GAT layer. :param in_channels: size of node encodings :param out_channels: size of aggregated node encodings", "name": "__init__", "signature": "def __init__(self, in_channels, out_channels)" }, { "docstring": "Forward pass for GAT layer :param node_encodings: Tensor o...
2
stack_v2_sparse_classes_30k_train_002376
Implement the Python class `GAT` described below. Class description: GAT layer for aggregating local context at each lane node. Uses scaled dot product attention using pytorch's multihead attention module. Method signatures and docstrings: - def __init__(self, in_channels, out_channels): Initialize GAT layer. :param ...
Implement the Python class `GAT` described below. Class description: GAT layer for aggregating local context at each lane node. Uses scaled dot product attention using pytorch's multihead attention module. Method signatures and docstrings: - def __init__(self, in_channels, out_channels): Initialize GAT layer. :param ...
6419894aa040adb9570b14493952a98c0a52f803
<|skeleton|> class GAT: """GAT layer for aggregating local context at each lane node. Uses scaled dot product attention using pytorch's multihead attention module.""" def __init__(self, in_channels, out_channels): """Initialize GAT layer. :param in_channels: size of node encodings :param out_channels: ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GAT: """GAT layer for aggregating local context at each lane node. Uses scaled dot product attention using pytorch's multihead attention module.""" def __init__(self, in_channels, out_channels): """Initialize GAT layer. :param in_channels: size of node encodings :param out_channels: size of aggre...
the_stack_v2_python_sparse
models/encoders/pgp_scout_encoder.py
sancarlim/Explainable-MP
train
17
aef84ae33dce75ec795635e6de0c426818fee2f0
[ "print(response.status)\nTags = response.xpath('//div[@class=\"Taright\"]/a')\nfor Tag in Tags:\n Tag_items = ChinazTagItem()\n Tag_items['TagName'] = Tag.xpath('./text()')[0].extract()\n Tag_items['FirstUrl'] = Tag.xpath('./@href').extract()[0]\n yield Tag_items\n yield scrapy.Request(Tag_items['Fir...
<|body_start_0|> print(response.status) Tags = response.xpath('//div[@class="Taright"]/a') for Tag in Tags: Tag_items = ChinazTagItem() Tag_items['TagName'] = Tag.xpath('./text()')[0].extract() Tag_items['FirstUrl'] = Tag.xpath('./@href').extract()[0] ...
ChinazSpider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChinazSpider: def parse(self, response): """在parse回调方法中 step1:提取目标数据 step2:获取新的目标url :param response: 请求的响应结果 :return:""" <|body_0|> def parser_tags_page(self, response): """解析分类网页的网站信息 :param response: 响应结果 :return:""" <|body_1|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_10k_train_003842
3,371
no_license
[ { "docstring": "在parse回调方法中 step1:提取目标数据 step2:获取新的目标url :param response: 请求的响应结果 :return:", "name": "parse", "signature": "def parse(self, response)" }, { "docstring": "解析分类网页的网站信息 :param response: 响应结果 :return:", "name": "parser_tags_page", "signature": "def parser_tags_page(self, resp...
2
stack_v2_sparse_classes_30k_train_004770
Implement the Python class `ChinazSpider` described below. Class description: Implement the ChinazSpider class. Method signatures and docstrings: - def parse(self, response): 在parse回调方法中 step1:提取目标数据 step2:获取新的目标url :param response: 请求的响应结果 :return: - def parser_tags_page(self, response): 解析分类网页的网站信息 :param response:...
Implement the Python class `ChinazSpider` described below. Class description: Implement the ChinazSpider class. Method signatures and docstrings: - def parse(self, response): 在parse回调方法中 step1:提取目标数据 step2:获取新的目标url :param response: 请求的响应结果 :return: - def parser_tags_page(self, response): 解析分类网页的网站信息 :param response:...
841cad4bf84c6e3af98a32f4f33ebda62055680c
<|skeleton|> class ChinazSpider: def parse(self, response): """在parse回调方法中 step1:提取目标数据 step2:获取新的目标url :param response: 请求的响应结果 :return:""" <|body_0|> def parser_tags_page(self, response): """解析分类网页的网站信息 :param response: 响应结果 :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ChinazSpider: def parse(self, response): """在parse回调方法中 step1:提取目标数据 step2:获取新的目标url :param response: 请求的响应结果 :return:""" print(response.status) Tags = response.xpath('//div[@class="Taright"]/a') for Tag in Tags: Tag_items = ChinazTagItem() Tag_items['Ta...
the_stack_v2_python_sparse
scrapy_Spider/Chinaz/Chinaz/spiders/chinaz.py
aini626204777/spider
train
0
d45833cd406bed8d7365cbd9e7c0bc0c4124e17b
[ "super().save(*args, **kwargs)\nself.book_list.updated_date = timezone.now()\nself.book_list.save(broadcast=False, update_fields=['updated_date'])", "if self.book_list.user == viewer:\n return\nis_group_member = GroupMember.objects.filter(group=self.book_list.group, user=viewer).exists()\nif is_group_member:\n...
<|body_start_0|> super().save(*args, **kwargs) self.book_list.updated_date = timezone.now() self.book_list.save(broadcast=False, update_fields=['updated_date']) <|end_body_0|> <|body_start_1|> if self.book_list.user == viewer: return is_group_member = GroupMember.obj...
ok
ListItem
[ "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ListItem: """ok""" def save(self, *args, **kwargs): """Update the list's date""" <|body_0|> def raise_not_deletable(self, viewer): """the associated user OR the list owner can delete""" <|body_1|> <|end_skeleton|> <|body_start_0|> super().save(*...
stack_v2_sparse_classes_10k_train_003843
5,915
no_license
[ { "docstring": "Update the list's date", "name": "save", "signature": "def save(self, *args, **kwargs)" }, { "docstring": "the associated user OR the list owner can delete", "name": "raise_not_deletable", "signature": "def raise_not_deletable(self, viewer)" } ]
2
null
Implement the Python class `ListItem` described below. Class description: ok Method signatures and docstrings: - def save(self, *args, **kwargs): Update the list's date - def raise_not_deletable(self, viewer): the associated user OR the list owner can delete
Implement the Python class `ListItem` described below. Class description: ok Method signatures and docstrings: - def save(self, *args, **kwargs): Update the list's date - def raise_not_deletable(self, viewer): the associated user OR the list owner can delete <|skeleton|> class ListItem: """ok""" def save(se...
0f8da5b738047f3c34d60d93f59bdedd8f797224
<|skeleton|> class ListItem: """ok""" def save(self, *args, **kwargs): """Update the list's date""" <|body_0|> def raise_not_deletable(self, viewer): """the associated user OR the list owner can delete""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ListItem: """ok""" def save(self, *args, **kwargs): """Update the list's date""" super().save(*args, **kwargs) self.book_list.updated_date = timezone.now() self.book_list.save(broadcast=False, update_fields=['updated_date']) def raise_not_deletable(self, viewer): ...
the_stack_v2_python_sparse
bookwyrm/models/list.py
bookwyrm-social/bookwyrm
train
1,398
7ddde0e67f63e69770c45559b0eabc3989417b6a
[ "response = super(BkChVs, self).__init__()\nif len(bkchvs) == 9:\n idno = int(bkchvs[0:3])\n self.ch = int(bkchvs[3:6])\n self.vs = int(bkchvs[6:])\n self.book = Book.get_abbr(idno)\nreturn response", "if self.book != other.book:\n return False\nif self.ch == other.ch:\n return self.vs == other....
<|body_start_0|> response = super(BkChVs, self).__init__() if len(bkchvs) == 9: idno = int(bkchvs[0:3]) self.ch = int(bkchvs[3:6]) self.vs = int(bkchvs[6:]) self.book = Book.get_abbr(idno) return response <|end_body_0|> <|body_start_1|> if...
Helper class to convert to/from bk/ch/vs
BkChVs
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BkChVs: """Helper class to convert to/from bk/ch/vs""" def __init__(self, bkchvs): """Create an object""" <|body_0|> def is_next(self, other): """Check if [self] follows immediately upon [other]""" <|body_1|> def get_until(self, einde, idno, include_...
stack_v2_sparse_classes_10k_train_003844
33,755
permissive
[ { "docstring": "Create an object", "name": "__init__", "signature": "def __init__(self, bkchvs)" }, { "docstring": "Check if [self] follows immediately upon [other]", "name": "is_next", "signature": "def is_next(self, other)" }, { "docstring": "Show ch/vs-ch/vs", "name": "get...
3
stack_v2_sparse_classes_30k_train_004132
Implement the Python class `BkChVs` described below. Class description: Helper class to convert to/from bk/ch/vs Method signatures and docstrings: - def __init__(self, bkchvs): Create an object - def is_next(self, other): Check if [self] follows immediately upon [other] - def get_until(self, einde, idno, include_book...
Implement the Python class `BkChVs` described below. Class description: Helper class to convert to/from bk/ch/vs Method signatures and docstrings: - def __init__(self, bkchvs): Create an object - def is_next(self, other): Check if [self] follows immediately upon [other] - def get_until(self, einde, idno, include_book...
921fb5ec3f5b40b169bd3f65417580878365ccab
<|skeleton|> class BkChVs: """Helper class to convert to/from bk/ch/vs""" def __init__(self, bkchvs): """Create an object""" <|body_0|> def is_next(self, other): """Check if [self] follows immediately upon [other]""" <|body_1|> def get_until(self, einde, idno, include_...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BkChVs: """Helper class to convert to/from bk/ch/vs""" def __init__(self, bkchvs): """Create an object""" response = super(BkChVs, self).__init__() if len(bkchvs) == 9: idno = int(bkchvs[0:3]) self.ch = int(bkchvs[3:6]) self.vs = int(bkchvs[6:])...
the_stack_v2_python_sparse
passim/passim/bible/models.py
ErwinKomen/RU-passim
train
0
ea528af4785b7df4535ffd317f9b5397290e0a05
[ "dummy = TreeNode(0)\nself.prev = dummy\n\ndef inorder(root):\n if not root:\n return\n inorder(root.left)\n root.left = None\n self.prev.right = root\n self.prev = self.prev.right\n inorder(root.right)\ninorder(root)\nreturn dummy.right", "new_root = TreeNode(0)\nnodes = []\n\ndef recons...
<|body_start_0|> dummy = TreeNode(0) self.prev = dummy def inorder(root): if not root: return inorder(root.left) root.left = None self.prev.right = root self.prev = self.prev.right inorder(root.right) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def increasingBST(self, root): """:type root: TreeNode :rtype: TreeNode""" <|body_0|> def increasingBST_2(self, root): """:type root: TreeNode :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> dummy = TreeNode(0) sel...
stack_v2_sparse_classes_10k_train_003845
2,163
no_license
[ { "docstring": ":type root: TreeNode :rtype: TreeNode", "name": "increasingBST", "signature": "def increasingBST(self, root)" }, { "docstring": ":type root: TreeNode :rtype: TreeNode", "name": "increasingBST_2", "signature": "def increasingBST_2(self, root)" } ]
2
stack_v2_sparse_classes_30k_train_005497
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def increasingBST(self, root): :type root: TreeNode :rtype: TreeNode - def increasingBST_2(self, root): :type root: TreeNode :rtype: TreeNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def increasingBST(self, root): :type root: TreeNode :rtype: TreeNode - def increasingBST_2(self, root): :type root: TreeNode :rtype: TreeNode <|skeleton|> class Solution: d...
8595b04cf5a024c2cd8a97f750d890a818568401
<|skeleton|> class Solution: def increasingBST(self, root): """:type root: TreeNode :rtype: TreeNode""" <|body_0|> def increasingBST_2(self, root): """:type root: TreeNode :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def increasingBST(self, root): """:type root: TreeNode :rtype: TreeNode""" dummy = TreeNode(0) self.prev = dummy def inorder(root): if not root: return inorder(root.left) root.left = None self.prev.right...
the_stack_v2_python_sparse
python/897.increasing-order-search-tree.py
tainenko/Leetcode2019
train
5
81dd8a4241f2afff221da36ffb4e554c47561822
[ "if len(prices) < 2 or k == 0:\n return 0\nif k >= len(prices) // 2:\n return self.maxProfitGreedy(prices)\nholds = [-9999] * k\nreleases = [0] * k\nfor j, price in enumerate(prices):\n for i in range(min((j + 2) // 2, k) - 1, -1, -1):\n releases[i] = max(releases[i], holds[i] + price)\n if i...
<|body_start_0|> if len(prices) < 2 or k == 0: return 0 if k >= len(prices) // 2: return self.maxProfitGreedy(prices) holds = [-9999] * k releases = [0] * k for j, price in enumerate(prices): for i in range(min((j + 2) // 2, k) - 1, -1, -1): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, k, prices): """:type k: int :type prices: List[int] :rtype: int""" <|body_0|> def maxProfitGreedy(self, prices): """:type prices: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(prices) < 2 ...
stack_v2_sparse_classes_10k_train_003846
757
no_license
[ { "docstring": ":type k: int :type prices: List[int] :rtype: int", "name": "maxProfit", "signature": "def maxProfit(self, k, prices)" }, { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfitGreedy", "signature": "def maxProfitGreedy(self, prices)" } ]
2
stack_v2_sparse_classes_30k_train_004316
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, k, prices): :type k: int :type prices: List[int] :rtype: int - def maxProfitGreedy(self, prices): :type prices: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, k, prices): :type k: int :type prices: List[int] :rtype: int - def maxProfitGreedy(self, prices): :type prices: List[int] :rtype: int <|skeleton|> class Solu...
15f012927dc34b5d751af6633caa5e8882d26ff7
<|skeleton|> class Solution: def maxProfit(self, k, prices): """:type k: int :type prices: List[int] :rtype: int""" <|body_0|> def maxProfitGreedy(self, prices): """:type prices: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit(self, k, prices): """:type k: int :type prices: List[int] :rtype: int""" if len(prices) < 2 or k == 0: return 0 if k >= len(prices) // 2: return self.maxProfitGreedy(prices) holds = [-9999] * k releases = [0] * k f...
the_stack_v2_python_sparse
python/188.BestTimeToBuyAndSellStockIV.py
MaxPoon/Leetcode
train
15
201baff64043997c3684f8a68b37ce77190717e7
[ "for i in orm.Item.objects.all():\n try:\n i.status.remove(orm.Status.objects.get(name='Usable'))\n i.save()\n except ObjectDoesNotExist:\n pass\ntry:\n orm.Status.delete(orm.Status.objects.get(name='Usable'))\nexcept ObjectDoesNotExist:\n pass", "try:\n usable = orm.Status.obj...
<|body_start_0|> for i in orm.Item.objects.all(): try: i.status.remove(orm.Status.objects.get(name='Usable')) i.save() except ObjectDoesNotExist: pass try: orm.Status.delete(orm.Status.objects.get(name='Usable')) ...
Migration
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Migration: def forwards(self, orm): """Loop through all items and delete the Usable status At the end remove 'Usable' status from Status""" <|body_0|> def backwards(self, orm): """Add 'Usable' status to Status. Loop through all items and add the Usable status if not ...
stack_v2_sparse_classes_10k_train_003847
12,509
permissive
[ { "docstring": "Loop through all items and delete the Usable status At the end remove 'Usable' status from Status", "name": "forwards", "signature": "def forwards(self, orm)" }, { "docstring": "Add 'Usable' status to Status. Loop through all items and add the Usable status if not exist", "na...
2
stack_v2_sparse_classes_30k_train_004985
Implement the Python class `Migration` described below. Class description: Implement the Migration class. Method signatures and docstrings: - def forwards(self, orm): Loop through all items and delete the Usable status At the end remove 'Usable' status from Status - def backwards(self, orm): Add 'Usable' status to St...
Implement the Python class `Migration` described below. Class description: Implement the Migration class. Method signatures and docstrings: - def forwards(self, orm): Loop through all items and delete the Usable status At the end remove 'Usable' status from Status - def backwards(self, orm): Add 'Usable' status to St...
7096ff360a6161118bb454b2874318eade69c6df
<|skeleton|> class Migration: def forwards(self, orm): """Loop through all items and delete the Usable status At the end remove 'Usable' status from Status""" <|body_0|> def backwards(self, orm): """Add 'Usable' status to Status. Loop through all items and add the Usable status if not ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Migration: def forwards(self, orm): """Loop through all items and delete the Usable status At the end remove 'Usable' status from Status""" for i in orm.Item.objects.all(): try: i.status.remove(orm.Status.objects.get(name='Usable')) i.save() ...
the_stack_v2_python_sparse
Machine/migrations/0008_remove_usable_status.py
abztrakt/labtracker
train
0
1ae0290dcd59bc3adf4b4d2c1b805ba3d1a27e42
[ "if nums:\n nums = list(set(nums))\n for j in range(len(nums) - 1, 0, -1):\n for i in range(j):\n if nums[i] > nums[i + 1]:\n nums[i], nums[i + 1] = (nums[i + 1], nums[i])\n cur = 1\n MAX = 1\n for i in range(len(nums)):\n if nums[i - 1] + 1 == nums[i]:\n ...
<|body_start_0|> if nums: nums = list(set(nums)) for j in range(len(nums) - 1, 0, -1): for i in range(j): if nums[i] > nums[i + 1]: nums[i], nums[i + 1] = (nums[i + 1], nums[i]) cur = 1 MAX = 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestConsecutive(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def longestConsecutive_Hash(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if nums: nums ...
stack_v2_sparse_classes_10k_train_003848
2,241
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "longestConsecutive", "signature": "def longestConsecutive(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "longestConsecutive_Hash", "signature": "def longestConsecutive_Hash(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestConsecutive(self, nums): :type nums: List[int] :rtype: int - def longestConsecutive_Hash(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestConsecutive(self, nums): :type nums: List[int] :rtype: int - def longestConsecutive_Hash(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: ...
3f7b2ea959308eb80f4c65be35aaeed666570f80
<|skeleton|> class Solution: def longestConsecutive(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def longestConsecutive_Hash(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def longestConsecutive(self, nums): """:type nums: List[int] :rtype: int""" if nums: nums = list(set(nums)) for j in range(len(nums) - 1, 0, -1): for i in range(j): if nums[i] > nums[i + 1]: nums[i], ...
the_stack_v2_python_sparse
128. 最长连续序列.py
dxc19951001/Everyday_LeetCode
train
1
3c44016df7badbd9f28932a29b14369687079c32
[ "super(CondBatchNorm, self).__init__(x_dim, eps, momentum, affine=False)\nself.eps = eps\nself.shift_conv = nn.Sequential(nn.Conv2d(z_dim, x_dim, kernel_size=1, padding=0, bias=True))\nself.scale_conv = nn.Sequential(nn.Conv2d(z_dim, x_dim, kernel_size=1, padding=0, bias=True))", "shift = self.shift_conv.forward(...
<|body_start_0|> super(CondBatchNorm, self).__init__(x_dim, eps, momentum, affine=False) self.eps = eps self.shift_conv = nn.Sequential(nn.Conv2d(z_dim, x_dim, kernel_size=1, padding=0, bias=True)) self.scale_conv = nn.Sequential(nn.Conv2d(z_dim, x_dim, kernel_size=1, padding=0, bias=Tru...
Conditional batch norm.
CondBatchNorm
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CondBatchNorm: """Conditional batch norm.""" def __init__(self, x_dim, z_dim, eps=1e-05, momentum=0.1): """Constructor. - `x_dim`: dimensionality of x input - `z_dim`: dimensionality of z latents""" <|body_0|> def forward(self, input, noise): """Forward method.""...
stack_v2_sparse_classes_10k_train_003849
34,675
permissive
[ { "docstring": "Constructor. - `x_dim`: dimensionality of x input - `z_dim`: dimensionality of z latents", "name": "__init__", "signature": "def __init__(self, x_dim, z_dim, eps=1e-05, momentum=0.1)" }, { "docstring": "Forward method.", "name": "forward", "signature": "def forward(self, ...
2
stack_v2_sparse_classes_30k_train_005495
Implement the Python class `CondBatchNorm` described below. Class description: Conditional batch norm. Method signatures and docstrings: - def __init__(self, x_dim, z_dim, eps=1e-05, momentum=0.1): Constructor. - `x_dim`: dimensionality of x input - `z_dim`: dimensionality of z latents - def forward(self, input, nois...
Implement the Python class `CondBatchNorm` described below. Class description: Conditional batch norm. Method signatures and docstrings: - def __init__(self, x_dim, z_dim, eps=1e-05, momentum=0.1): Constructor. - `x_dim`: dimensionality of x input - `z_dim`: dimensionality of z latents - def forward(self, input, nois...
e1e4a8d9a2ab51c2108a4d167bc37fab101f0c2c
<|skeleton|> class CondBatchNorm: """Conditional batch norm.""" def __init__(self, x_dim, z_dim, eps=1e-05, momentum=0.1): """Constructor. - `x_dim`: dimensionality of x input - `z_dim`: dimensionality of z latents""" <|body_0|> def forward(self, input, noise): """Forward method.""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CondBatchNorm: """Conditional batch norm.""" def __init__(self, x_dim, z_dim, eps=1e-05, momentum=0.1): """Constructor. - `x_dim`: dimensionality of x input - `z_dim`: dimensionality of z latents""" super(CondBatchNorm, self).__init__(x_dim, eps, momentum, affine=False) self.eps =...
the_stack_v2_python_sparse
diffrend/torch/GAN/twin_networks.py
sainatarajan/pix2shape
train
0
d1f6321444eebb293c4c5b7e242eeb6170c23217
[ "future_question = create_question(question_text='Future question.', days=5)\nchoice_one = create_choice(future_question, 'Choice one', votes=2)\nchoice_two = create_choice(future_question, 'Choice two', votes=4)\nurl = reverse('polls:results', args=(future_question.id,))\nresponse = self.client.get(url)\nself.asse...
<|body_start_0|> future_question = create_question(question_text='Future question.', days=5) choice_one = create_choice(future_question, 'Choice one', votes=2) choice_two = create_choice(future_question, 'Choice two', votes=4) url = reverse('polls:results', args=(future_question.id,)) ...
QuestionResultsViewTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuestionResultsViewTests: def test_results_view_with_a_future_question(self): """The results view of a question with a pub_date in the future should return a 404 not found.""" <|body_0|> def test_results_view_with_a_past_question(self): """The results view of a quest...
stack_v2_sparse_classes_10k_train_003850
7,438
no_license
[ { "docstring": "The results view of a question with a pub_date in the future should return a 404 not found.", "name": "test_results_view_with_a_future_question", "signature": "def test_results_view_with_a_future_question(self)" }, { "docstring": "The results view of a question with a pub_date in...
2
stack_v2_sparse_classes_30k_train_000566
Implement the Python class `QuestionResultsViewTests` described below. Class description: Implement the QuestionResultsViewTests class. Method signatures and docstrings: - def test_results_view_with_a_future_question(self): The results view of a question with a pub_date in the future should return a 404 not found. - ...
Implement the Python class `QuestionResultsViewTests` described below. Class description: Implement the QuestionResultsViewTests class. Method signatures and docstrings: - def test_results_view_with_a_future_question(self): The results view of a question with a pub_date in the future should return a 404 not found. - ...
a7e7fc72abe357172f5aa49b03c5b9298d92d6e8
<|skeleton|> class QuestionResultsViewTests: def test_results_view_with_a_future_question(self): """The results view of a question with a pub_date in the future should return a 404 not found.""" <|body_0|> def test_results_view_with_a_past_question(self): """The results view of a quest...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class QuestionResultsViewTests: def test_results_view_with_a_future_question(self): """The results view of a question with a pub_date in the future should return a 404 not found.""" future_question = create_question(question_text='Future question.', days=5) choice_one = create_choice(future_...
the_stack_v2_python_sparse
firstdjango/polls/tests.py
thewritingstew/lpthw
train
0
04e09c95b452b28a4575e817943c51407109db12
[ "def _get_next_moves(move_id):\n if move_id:\n next_moves = _get_next_moves(fields.first(move_id.move_dest_ids))\n if next_moves:\n return move_id | next_moves\n else:\n return move_id\n return False\nself._check_change_permitted()\nres = super(ChangeProductionQty, s...
<|body_start_0|> def _get_next_moves(move_id): if move_id: next_moves = _get_next_moves(fields.first(move_id.move_dest_ids)) if next_moves: return move_id | next_moves else: return move_id return Fals...
ChangeProductionQty
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChangeProductionQty: def change_prod_qty(self): """When the production quantity is changed, also change the quantity of related moves""" <|body_0|> def _check_change_permitted(self): """Check increase or decrease percentage is not more than 10%""" <|body_1|> ...
stack_v2_sparse_classes_10k_train_003851
1,817
no_license
[ { "docstring": "When the production quantity is changed, also change the quantity of related moves", "name": "change_prod_qty", "signature": "def change_prod_qty(self)" }, { "docstring": "Check increase or decrease percentage is not more than 10%", "name": "_check_change_permitted", "sig...
2
null
Implement the Python class `ChangeProductionQty` described below. Class description: Implement the ChangeProductionQty class. Method signatures and docstrings: - def change_prod_qty(self): When the production quantity is changed, also change the quantity of related moves - def _check_change_permitted(self): Check inc...
Implement the Python class `ChangeProductionQty` described below. Class description: Implement the ChangeProductionQty class. Method signatures and docstrings: - def change_prod_qty(self): When the production quantity is changed, also change the quantity of related moves - def _check_change_permitted(self): Check inc...
c04e2b9730db07848c153d8245d2df65ec4e2c8f
<|skeleton|> class ChangeProductionQty: def change_prod_qty(self): """When the production quantity is changed, also change the quantity of related moves""" <|body_0|> def _check_change_permitted(self): """Check increase or decrease percentage is not more than 10%""" <|body_1|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ChangeProductionQty: def change_prod_qty(self): """When the production quantity is changed, also change the quantity of related moves""" def _get_next_moves(move_id): if move_id: next_moves = _get_next_moves(fields.first(move_id.move_dest_ids)) if ne...
the_stack_v2_python_sparse
altinkaya_mrp/wizard/change_production_qty.py
aaltinisik/customaddons
train
15
f1f2ab8a2dd361b8dd32ad5e25f9c3c0393a02d9
[ "if not field:\n raise ValueError('Empty field name.')\nif not is_string(field):\n raise TypeError('The field name must be a string, not {0}'.format(type(field).__name__))\nif ' ' in field:\n raise ValueError(\"Field name can't contain spaces.\")\nself.__field = field\nspecifications = _get_specifications(...
<|body_start_0|> if not field: raise ValueError('Empty field name.') if not is_string(field): raise TypeError('The field name must be a string, not {0}'.format(type(field).__name__)) if ' ' in field: raise ValueError("Field name can't contain spaces.") ...
@RequiresMap decorator Defines a required service, injected in a dictionary
RequiresMap
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RequiresMap: """@RequiresMap decorator Defines a required service, injected in a dictionary""" def __init__(self, field, specification, key, allow_none=False, aggregate=False, optional=False, spec_filter=None): """Sets up the requirement :param field: The injected field :param specif...
stack_v2_sparse_classes_10k_train_003852
41,418
permissive
[ { "docstring": "Sets up the requirement :param field: The injected field :param specification: The injected service specification :param key: Name of the service property to use as a dictionary key :param allow_none: If True, inject services with a None property value :param aggregate: If true, injects a list :...
2
stack_v2_sparse_classes_30k_train_003168
Implement the Python class `RequiresMap` described below. Class description: @RequiresMap decorator Defines a required service, injected in a dictionary Method signatures and docstrings: - def __init__(self, field, specification, key, allow_none=False, aggregate=False, optional=False, spec_filter=None): Sets up the r...
Implement the Python class `RequiresMap` described below. Class description: @RequiresMap decorator Defines a required service, injected in a dictionary Method signatures and docstrings: - def __init__(self, field, specification, key, allow_none=False, aggregate=False, optional=False, spec_filter=None): Sets up the r...
686556cdde20beba77ae202de9969be46feed5e2
<|skeleton|> class RequiresMap: """@RequiresMap decorator Defines a required service, injected in a dictionary""" def __init__(self, field, specification, key, allow_none=False, aggregate=False, optional=False, spec_filter=None): """Sets up the requirement :param field: The injected field :param specif...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RequiresMap: """@RequiresMap decorator Defines a required service, injected in a dictionary""" def __init__(self, field, specification, key, allow_none=False, aggregate=False, optional=False, spec_filter=None): """Sets up the requirement :param field: The injected field :param specification: The ...
the_stack_v2_python_sparse
python/src/lib/python/pelix/ipopo/decorators.py
cohorte/cohorte-runtime
train
3
b9214029d439a4adbb3ccc25e22d7118d47dcdc5
[ "self.text = str(text)\nself.screen = screen\nself.drawCursor = drawCursor\nself.colour = colour\nif settings.textSpeed == 'SLOW':\n self.speed = 1\nelif settings.textSpeed == 'MEDIUM':\n self.speed = 2\nelif settings.textSpeed == 'FAST':\n self.speed = 4\nroot = data.getTreeRoot(globs.BOX, 'Ditto main')\n...
<|body_start_0|> self.text = str(text) self.screen = screen self.drawCursor = drawCursor self.colour = colour if settings.textSpeed == 'SLOW': self.speed = 1 elif settings.textSpeed == 'MEDIUM': self.speed = 2 elif settings.textSpeed == 'FA...
Class to provide dialogs to be shown by the script engine.
Dialog
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dialog: """Class to provide dialogs to be shown by the script engine.""" def __init__(self, text, screen, drawCursor=True, colour='main'): """Create the dialog box and load cursors. text - a list of lines of text to go in the dialog. font - the font with which to write the text. scre...
stack_v2_sparse_classes_10k_train_003853
7,179
no_license
[ { "docstring": "Create the dialog box and load cursors. text - a list of lines of text to go in the dialog. font - the font with which to write the text. screen - the surface to draw the dialog onto. soundManager - the sound manager. drawCursor - whether a continuation cursor should be drawn when the text has f...
4
stack_v2_sparse_classes_30k_train_002905
Implement the Python class `Dialog` described below. Class description: Class to provide dialogs to be shown by the script engine. Method signatures and docstrings: - def __init__(self, text, screen, drawCursor=True, colour='main'): Create the dialog box and load cursors. text - a list of lines of text to go in the d...
Implement the Python class `Dialog` described below. Class description: Class to provide dialogs to be shown by the script engine. Method signatures and docstrings: - def __init__(self, text, screen, drawCursor=True, colour='main'): Create the dialog box and load cursors. text - a list of lines of text to go in the d...
72841fc503c716ac3b524e42f2311cbd9d18a092
<|skeleton|> class Dialog: """Class to provide dialogs to be shown by the script engine.""" def __init__(self, text, screen, drawCursor=True, colour='main'): """Create the dialog box and load cursors. text - a list of lines of text to go in the dialog. font - the font with which to write the text. scre...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Dialog: """Class to provide dialogs to be shown by the script engine.""" def __init__(self, text, screen, drawCursor=True, colour='main'): """Create the dialog box and load cursors. text - a list of lines of text to go in the dialog. font - the font with which to write the text. screen - the surf...
the_stack_v2_python_sparse
eng/dialog.py
andrew-turner/Ditto
train
0
330c511f0f6f06d060ecc82374f7ed169e72094e
[ "self.data = None\nself._hass = hass\nself._app_id = app_id\nself._device_id = device_id\nself._values = values\nself._url = TTN_DATA_STORAGE_URL.format(app_id=app_id, endpoint='api/v2/query', device_id=device_id)\nself._headers = {ACCEPT: CONTENT_TYPE_JSON, AUTHORIZATION: f'key {access_key}'}", "try:\n sessio...
<|body_start_0|> self.data = None self._hass = hass self._app_id = app_id self._device_id = device_id self._values = values self._url = TTN_DATA_STORAGE_URL.format(app_id=app_id, endpoint='api/v2/query', device_id=device_id) self._headers = {ACCEPT: CONTENT_TYPE_J...
Get the latest data from The Things Network Data Storage.
TtnDataStorage
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TtnDataStorage: """Get the latest data from The Things Network Data Storage.""" def __init__(self, hass, app_id, device_id, access_key, values): """Initialize the data object.""" <|body_0|> async def async_update(self): """Get the current state from The Things Ne...
stack_v2_sparse_classes_10k_train_003854
5,254
permissive
[ { "docstring": "Initialize the data object.", "name": "__init__", "signature": "def __init__(self, hass, app_id, device_id, access_key, values)" }, { "docstring": "Get the current state from The Things Network Data Storage.", "name": "async_update", "signature": "async def async_update(s...
2
null
Implement the Python class `TtnDataStorage` described below. Class description: Get the latest data from The Things Network Data Storage. Method signatures and docstrings: - def __init__(self, hass, app_id, device_id, access_key, values): Initialize the data object. - async def async_update(self): Get the current sta...
Implement the Python class `TtnDataStorage` described below. Class description: Get the latest data from The Things Network Data Storage. Method signatures and docstrings: - def __init__(self, hass, app_id, device_id, access_key, values): Initialize the data object. - async def async_update(self): Get the current sta...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class TtnDataStorage: """Get the latest data from The Things Network Data Storage.""" def __init__(self, hass, app_id, device_id, access_key, values): """Initialize the data object.""" <|body_0|> async def async_update(self): """Get the current state from The Things Ne...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TtnDataStorage: """Get the latest data from The Things Network Data Storage.""" def __init__(self, hass, app_id, device_id, access_key, values): """Initialize the data object.""" self.data = None self._hass = hass self._app_id = app_id self._device_id = device_id ...
the_stack_v2_python_sparse
homeassistant/components/thethingsnetwork/sensor.py
home-assistant/core
train
35,501
183e6b3e8f7c23efd6e6e6360ee7095e191b6462
[ "class ClassMethodTest(NSObject):\n\n def clsMeth(self):\n return 'hello'\n clsMeth = classmethod(clsMeth)\nself.assertIsInstance(ClassMethodTest.clsMeth, objc.selector)\nself.assertTrue(ClassMethodTest.clsMeth.isClassMethod)", "class StaticMethodTest(NSObject):\n\n def stMeth(self):\n retu...
<|body_start_0|> class ClassMethodTest(NSObject): def clsMeth(self): return 'hello' clsMeth = classmethod(clsMeth) self.assertIsInstance(ClassMethodTest.clsMeth, objc.selector) self.assertTrue(ClassMethodTest.clsMeth.isClassMethod) <|end_body_0|> <|body_...
TestClassMethods
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestClassMethods: def testClassMethod(self): """check that classmethod()-s are converted to selectors""" <|body_0|> def testStaticMethod(self): """check that staticmethod()-s are not converted to selectors""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_003855
36,093
permissive
[ { "docstring": "check that classmethod()-s are converted to selectors", "name": "testClassMethod", "signature": "def testClassMethod(self)" }, { "docstring": "check that staticmethod()-s are not converted to selectors", "name": "testStaticMethod", "signature": "def testStaticMethod(self)...
2
null
Implement the Python class `TestClassMethods` described below. Class description: Implement the TestClassMethods class. Method signatures and docstrings: - def testClassMethod(self): check that classmethod()-s are converted to selectors - def testStaticMethod(self): check that staticmethod()-s are not converted to se...
Implement the Python class `TestClassMethods` described below. Class description: Implement the TestClassMethods class. Method signatures and docstrings: - def testClassMethod(self): check that classmethod()-s are converted to selectors - def testStaticMethod(self): check that staticmethod()-s are not converted to se...
77b98382e52818690449111cd2e23cd469b53cf5
<|skeleton|> class TestClassMethods: def testClassMethod(self): """check that classmethod()-s are converted to selectors""" <|body_0|> def testStaticMethod(self): """check that staticmethod()-s are not converted to selectors""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestClassMethods: def testClassMethod(self): """check that classmethod()-s are converted to selectors""" class ClassMethodTest(NSObject): def clsMeth(self): return 'hello' clsMeth = classmethod(clsMeth) self.assertIsInstance(ClassMethodTest.clsM...
the_stack_v2_python_sparse
pyobjc-core/PyObjCTest/test_subclass.py
ronaldoussoren/pyobjc
train
439
4d4bb353640feb56a1e2dc1b2ebc7102e9519e62
[ "self.memo = {}\nfor i, item in enumerate(arr):\n if item not in self.memo:\n self.memo[item] = []\n self.memo[item].append(i)", "for k in self.memo.keys():\n if len(self.memo[k]) < threshold:\n continue\n idx1 = bisect.bisect_left(self.memo[k], left)\n idx2 = bisect.bisect_left(self....
<|body_start_0|> self.memo = {} for i, item in enumerate(arr): if item not in self.memo: self.memo[item] = [] self.memo[item].append(i) <|end_body_0|> <|body_start_1|> for k in self.memo.keys(): if len(self.memo[k]) < threshold: ...
MajorityChecker
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MajorityChecker: def __init__(self, arr): """:type arr: List[int]""" <|body_0|> def query(self, left, right, threshold): """:type left: int :type right: int :type threshold: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.memo =...
stack_v2_sparse_classes_10k_train_003856
2,215
no_license
[ { "docstring": ":type arr: List[int]", "name": "__init__", "signature": "def __init__(self, arr)" }, { "docstring": ":type left: int :type right: int :type threshold: int :rtype: int", "name": "query", "signature": "def query(self, left, right, threshold)" } ]
2
stack_v2_sparse_classes_30k_train_002887
Implement the Python class `MajorityChecker` described below. Class description: Implement the MajorityChecker class. Method signatures and docstrings: - def __init__(self, arr): :type arr: List[int] - def query(self, left, right, threshold): :type left: int :type right: int :type threshold: int :rtype: int
Implement the Python class `MajorityChecker` described below. Class description: Implement the MajorityChecker class. Method signatures and docstrings: - def __init__(self, arr): :type arr: List[int] - def query(self, left, right, threshold): :type left: int :type right: int :type threshold: int :rtype: int <|skelet...
a5cb862f0c5a3cfd21468141800568c2dedded0a
<|skeleton|> class MajorityChecker: def __init__(self, arr): """:type arr: List[int]""" <|body_0|> def query(self, left, right, threshold): """:type left: int :type right: int :type threshold: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MajorityChecker: def __init__(self, arr): """:type arr: List[int]""" self.memo = {} for i, item in enumerate(arr): if item not in self.memo: self.memo[item] = [] self.memo[item].append(i) def query(self, left, right, threshold): """:...
the_stack_v2_python_sparse
python/leetcode/binary_search/1157_online_majority.py
Levintsky/topcoder
train
0
d99b5a3f0a61ae0e02d655921277d762d6d9fc53
[ "limit = request.args.get('limit', 10, int)\npage = request.args.get('page', 1, int)\ninfo = request.args.get('info', '', str)\nskip = limit * (page - 1)\nweekpasswd_db = db_name_conf()['weekpasswd_db']\ntotal = mongo_cli[weekpasswd_db].find({'task_name': re.compile(info)}).count()\ndict_resp = mongo_cli[weekpasswd...
<|body_start_0|> limit = request.args.get('limit', 10, int) page = request.args.get('page', 1, int) info = request.args.get('info', '', str) skip = limit * (page - 1) weekpasswd_db = db_name_conf()['weekpasswd_db'] total = mongo_cli[weekpasswd_db].find({'task_name': re.co...
AuthTesterDetectView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuthTesterDetectView: def get(self): """检出目标列表 --- tags: - 弱口令检测(auth_tester) definitions: - schema: id: dao.auth_tester_weekpasswd_info properties: _id: type: string description: _id date: type: string description: 扫描日期 username: type: string description: 账户 password: type: string descr...
stack_v2_sparse_classes_10k_train_003857
20,908
no_license
[ { "docstring": "检出目标列表 --- tags: - 弱口令检测(auth_tester) definitions: - schema: id: dao.auth_tester_weekpasswd_info properties: _id: type: string description: _id date: type: string description: 扫描日期 username: type: string description: 账户 password: type: string description: 密码 service: type: string description: 服务...
2
stack_v2_sparse_classes_30k_train_002288
Implement the Python class `AuthTesterDetectView` described below. Class description: Implement the AuthTesterDetectView class. Method signatures and docstrings: - def get(self): 检出目标列表 --- tags: - 弱口令检测(auth_tester) definitions: - schema: id: dao.auth_tester_weekpasswd_info properties: _id: type: string description:...
Implement the Python class `AuthTesterDetectView` described below. Class description: Implement the AuthTesterDetectView class. Method signatures and docstrings: - def get(self): 检出目标列表 --- tags: - 弱口令检测(auth_tester) definitions: - schema: id: dao.auth_tester_weekpasswd_info properties: _id: type: string description:...
aa75f06ad25b1238176165a0dcf4685c59cd8284
<|skeleton|> class AuthTesterDetectView: def get(self): """检出目标列表 --- tags: - 弱口令检测(auth_tester) definitions: - schema: id: dao.auth_tester_weekpasswd_info properties: _id: type: string description: _id date: type: string description: 扫描日期 username: type: string description: 账户 password: type: string descr...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AuthTesterDetectView: def get(self): """检出目标列表 --- tags: - 弱口令检测(auth_tester) definitions: - schema: id: dao.auth_tester_weekpasswd_info properties: _id: type: string description: _id date: type: string description: 扫描日期 username: type: string description: 账户 password: type: string description: 密码 ser...
the_stack_v2_python_sparse
aquaman/views/auth_tester.py
jstang9527/aquaman
train
15
f218a16813a9351c677fdbc7a6ebe9d0242e2284
[ "QuestionTextsFormRecord._init_map(self)\nQuestionFilesFormRecord._init_map(self)\nsuper(QuestionTextsAndFilesMixin, self)._init_map()", "QuestionTextsFormRecord._init_metadata(self)\nQuestionFilesFormRecord._init_metadata(self)\nsuper(QuestionTextsAndFilesMixin, self)._init_metadata()" ]
<|body_start_0|> QuestionTextsFormRecord._init_map(self) QuestionFilesFormRecord._init_map(self) super(QuestionTextsAndFilesMixin, self)._init_map() <|end_body_0|> <|body_start_1|> QuestionTextsFormRecord._init_metadata(self) QuestionFilesFormRecord._init_metadata(self) ...
Mixin class to make the two classes compatible with super() for _init_map and _init_metadata
QuestionTextsAndFilesMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuestionTextsAndFilesMixin: """Mixin class to make the two classes compatible with super() for _init_map and _init_metadata""" def _init_map(self): """stub""" <|body_0|> def _init_metadata(self): """stub""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_003858
22,562
permissive
[ { "docstring": "stub", "name": "_init_map", "signature": "def _init_map(self)" }, { "docstring": "stub", "name": "_init_metadata", "signature": "def _init_metadata(self)" } ]
2
null
Implement the Python class `QuestionTextsAndFilesMixin` described below. Class description: Mixin class to make the two classes compatible with super() for _init_map and _init_metadata Method signatures and docstrings: - def _init_map(self): stub - def _init_metadata(self): stub
Implement the Python class `QuestionTextsAndFilesMixin` described below. Class description: Mixin class to make the two classes compatible with super() for _init_map and _init_metadata Method signatures and docstrings: - def _init_map(self): stub - def _init_metadata(self): stub <|skeleton|> class QuestionTextsAndFi...
445f968a175d61c8d92c0f617a3c17dc1dc7c584
<|skeleton|> class QuestionTextsAndFilesMixin: """Mixin class to make the two classes compatible with super() for _init_map and _init_metadata""" def _init_map(self): """stub""" <|body_0|> def _init_metadata(self): """stub""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class QuestionTextsAndFilesMixin: """Mixin class to make the two classes compatible with super() for _init_map and _init_metadata""" def _init_map(self): """stub""" QuestionTextsFormRecord._init_map(self) QuestionFilesFormRecord._init_map(self) super(QuestionTextsAndFilesMixin, ...
the_stack_v2_python_sparse
dlkit/records/assessment/basic/simple_records.py
mitsei/dlkit
train
2
c633c1521b12eba42e15276ec56d35461bbd10a5
[ "if hasattr(self.o, 'flush'):\n try:\n self.o.flush()\n except (socket.error, IOError) as v:\n raise exceptions.TcpDisconnect(str(v))", "if v:\n self.first_byte_timestamp = self.first_byte_timestamp or time.time()\n try:\n if hasattr(self.o, 'sendall'):\n self.add_log(v...
<|body_start_0|> if hasattr(self.o, 'flush'): try: self.o.flush() except (socket.error, IOError) as v: raise exceptions.TcpDisconnect(str(v)) <|end_body_0|> <|body_start_1|> if v: self.first_byte_timestamp = self.first_byte_timestamp o...
Writer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Writer: def flush(self): """May raise exceptions.TcpDisconnect""" <|body_0|> def write(self, v): """May raise exceptions.TcpDisconnect""" <|body_1|> <|end_skeleton|> <|body_start_0|> if hasattr(self.o, 'flush'): try: self...
stack_v2_sparse_classes_10k_train_003859
34,015
permissive
[ { "docstring": "May raise exceptions.TcpDisconnect", "name": "flush", "signature": "def flush(self)" }, { "docstring": "May raise exceptions.TcpDisconnect", "name": "write", "signature": "def write(self, v)" } ]
2
stack_v2_sparse_classes_30k_test_000015
Implement the Python class `Writer` described below. Class description: Implement the Writer class. Method signatures and docstrings: - def flush(self): May raise exceptions.TcpDisconnect - def write(self, v): May raise exceptions.TcpDisconnect
Implement the Python class `Writer` described below. Class description: Implement the Writer class. Method signatures and docstrings: - def flush(self): May raise exceptions.TcpDisconnect - def write(self, v): May raise exceptions.TcpDisconnect <|skeleton|> class Writer: def flush(self): """May raise ex...
4e28fdf2ffd0eaefc0d23049106609421c9290b0
<|skeleton|> class Writer: def flush(self): """May raise exceptions.TcpDisconnect""" <|body_0|> def write(self, v): """May raise exceptions.TcpDisconnect""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Writer: def flush(self): """May raise exceptions.TcpDisconnect""" if hasattr(self.o, 'flush'): try: self.o.flush() except (socket.error, IOError) as v: raise exceptions.TcpDisconnect(str(v)) def write(self, v): """May raise e...
the_stack_v2_python_sparse
mitmproxy/mitmproxy/net/tcp.py
SynthAI/SynthAI
train
3
875c9f8bb3f7db8aa1850977fab4a54aba129495
[ "if not root:\n return []\nres = []\n\ndef digui(root):\n if root:\n res.append(root.val)\n for i in root.children:\n digui(i)\ndigui(root)\nreturn res", "if not root:\n return []\nres = []\nstack = [root]\nwhile stack:\n node = stack.pop()\n res.append(node.val)\n stack...
<|body_start_0|> if not root: return [] res = [] def digui(root): if root: res.append(root.val) for i in root.children: digui(i) digui(root) return res <|end_body_0|> <|body_start_1|> if not roo...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def preorder(self, root: 'Node') -> List[int]: """递归""" <|body_0|> def preorder1(self, root: 'Node') -> List[int]: """迭代""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: return [] res = [] def digui...
stack_v2_sparse_classes_10k_train_003860
1,083
no_license
[ { "docstring": "递归", "name": "preorder", "signature": "def preorder(self, root: 'Node') -> List[int]" }, { "docstring": "迭代", "name": "preorder1", "signature": "def preorder1(self, root: 'Node') -> List[int]" } ]
2
stack_v2_sparse_classes_30k_train_001500
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def preorder(self, root: 'Node') -> List[int]: 递归 - def preorder1(self, root: 'Node') -> List[int]: 迭代
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def preorder(self, root: 'Node') -> List[int]: 递归 - def preorder1(self, root: 'Node') -> List[int]: 迭代 <|skeleton|> class Solution: def preorder(self, root: 'Node') -> List...
069bb0b751ef7f469036b9897436eb5d138ffa24
<|skeleton|> class Solution: def preorder(self, root: 'Node') -> List[int]: """递归""" <|body_0|> def preorder1(self, root: 'Node') -> List[int]: """迭代""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def preorder(self, root: 'Node') -> List[int]: """递归""" if not root: return [] res = [] def digui(root): if root: res.append(root.val) for i in root.children: digui(i) digui(root) ...
the_stack_v2_python_sparse
算法/Week_02/589. N叉树的前序遍历.py
RichieSong/algorithm
train
0
1bc906fc8646aa6e30f84b5f6c56e5cbc1e51e12
[ "message = str.encode(str(record.geneid) + record.diseaseid)\nhexdigest = hashlib.sha256(message).hexdigest()\nreturn str(hexdigest)", "try:\n parsed_df = pd.read_csv(StringIO(data))\n parsed_df = parsed_df.drop(columns=['DirectEvidence', 'InferenceChemicalName', 'InferenceScore', 'OmimIDs'])\n parsed_df...
<|body_start_0|> message = str.encode(str(record.geneid) + record.diseaseid) hexdigest = hashlib.sha256(message).hexdigest() return str(hexdigest) <|end_body_0|> <|body_start_1|> try: parsed_df = pd.read_csv(StringIO(data)) parsed_df = parsed_df.drop(columns=['Di...
Implementation of CTD Database Parser. Comparative Toxicogenomics Gene-Disease Associations Database Parser. http://ctdbase.org/
CtdParser
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CtdParser: """Implementation of CTD Database Parser. Comparative Toxicogenomics Gene-Disease Associations Database Parser. http://ctdbase.org/""" def hash_record(record: pd.Series) -> str: """Hash the ctd record to generate digest column. Arguments: record {pd.Series} -- The ctd reco...
stack_v2_sparse_classes_10k_train_003861
12,683
permissive
[ { "docstring": "Hash the ctd record to generate digest column. Arguments: record {pd.Series} -- The ctd record in form of pandas Series Returns: str -- the hex string of the computed digest", "name": "hash_record", "signature": "def hash_record(record: pd.Series) -> str" }, { "docstring": "Parse...
2
stack_v2_sparse_classes_30k_train_003865
Implement the Python class `CtdParser` described below. Class description: Implementation of CTD Database Parser. Comparative Toxicogenomics Gene-Disease Associations Database Parser. http://ctdbase.org/ Method signatures and docstrings: - def hash_record(record: pd.Series) -> str: Hash the ctd record to generate dig...
Implement the Python class `CtdParser` described below. Class description: Implementation of CTD Database Parser. Comparative Toxicogenomics Gene-Disease Associations Database Parser. http://ctdbase.org/ Method signatures and docstrings: - def hash_record(record: pd.Series) -> str: Hash the ctd record to generate dig...
83e36e24077169d141f25c357cb1009b79b78661
<|skeleton|> class CtdParser: """Implementation of CTD Database Parser. Comparative Toxicogenomics Gene-Disease Associations Database Parser. http://ctdbase.org/""" def hash_record(record: pd.Series) -> str: """Hash the ctd record to generate digest column. Arguments: record {pd.Series} -- The ctd reco...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CtdParser: """Implementation of CTD Database Parser. Comparative Toxicogenomics Gene-Disease Associations Database Parser. http://ctdbase.org/""" def hash_record(record: pd.Series) -> str: """Hash the ctd record to generate digest column. Arguments: record {pd.Series} -- The ctd record in form of...
the_stack_v2_python_sparse
geniepy/src/geniepy/datamgmt/parsers.py
cjflanagan/genie-1
train
0
5861cc01c4a420be5f5f333481614ec63a6891f1
[ "if len(directory_path) > 0:\n if not os.path.isdir(directory_path):\n raise Exception('Path {} for '.format(directory_path) + 'StructDict construction was not a directory.')\n self.update(read(directory_path, file_format=file_format))", "if type(struct) == dict:\n for key, value in struct.items()...
<|body_start_0|> if len(directory_path) > 0: if not os.path.isdir(directory_path): raise Exception('Path {} for '.format(directory_path) + 'StructDict construction was not a directory.') self.update(read(directory_path, file_format=file_format)) <|end_body_0|> <|body_sta...
Specifies the behavior of a StructDict which is abbreviated as struct_dict throughout the code base. The StructDict behaves exactly the same as a Python dictionary where each key is the struct_id and each value is a Structure.
StructDict
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StructDict: """Specifies the behavior of a StructDict which is abbreviated as struct_dict throughout the code base. The StructDict behaves exactly the same as a Python dictionary where each key is the struct_id and each value is a Structure.""" def __init__(self, directory_path='', file_form...
stack_v2_sparse_classes_10k_train_003862
8,467
permissive
[ { "docstring": "Creates StructDict for the optional input directory path.", "name": "__init__", "signature": "def __init__(self, directory_path='', file_format='')" }, { "docstring": "Behaves as a wrapper to append", "name": "update", "signature": "def update(self, struct)" }, { ...
3
stack_v2_sparse_classes_30k_train_000167
Implement the Python class `StructDict` described below. Class description: Specifies the behavior of a StructDict which is abbreviated as struct_dict throughout the code base. The StructDict behaves exactly the same as a Python dictionary where each key is the struct_id and each value is a Structure. Method signatur...
Implement the Python class `StructDict` described below. Class description: Specifies the behavior of a StructDict which is abbreviated as struct_dict throughout the code base. The StructDict behaves exactly the same as a Python dictionary where each key is the struct_id and each value is a Structure. Method signatur...
142d6f6b4f852b23aa8cfdae1593db207363e30e
<|skeleton|> class StructDict: """Specifies the behavior of a StructDict which is abbreviated as struct_dict throughout the code base. The StructDict behaves exactly the same as a Python dictionary where each key is the struct_id and each value is a Structure.""" def __init__(self, directory_path='', file_form...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class StructDict: """Specifies the behavior of a StructDict which is abbreviated as struct_dict throughout the code base. The StructDict behaves exactly the same as a Python dictionary where each key is the struct_id and each value is a Structure.""" def __init__(self, directory_path='', file_format=''): ...
the_stack_v2_python_sparse
mcse/core/struct_dict.py
manny405/mcse
train
6
fb10f6d6998c8c810fe9818015376f0b41ba7a02
[ "if value is not None:\n assert value.tzinfo == timezone.utc, f\"Expected '{value}' to be UTC\"\nreturn value", "if value is not None:\n assert value.tzinfo is None\n return value.replace(tzinfo=timezone.utc)\nreturn None" ]
<|body_start_0|> if value is not None: assert value.tzinfo == timezone.utc, f"Expected '{value}' to be UTC" return value <|end_body_0|> <|body_start_1|> if value is not None: assert value.tzinfo is None return value.replace(tzinfo=timezone.utc) return...
A SQL column type to store UTC datetimes. Usage example: table = sqlalchemy.Table( ... sqlalchemy.Column("my_datetime_column", UTCDateTime) ) Opentrons robot-server code should always use this instead of SQLAlchemy's built-in DateTime type. Motivation: We generally want our datetimes to have a UTC timezone so they're u...
UTCDateTime
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UTCDateTime: """A SQL column type to store UTC datetimes. Usage example: table = sqlalchemy.Table( ... sqlalchemy.Column("my_datetime_column", UTCDateTime) ) Opentrons robot-server code should always use this instead of SQLAlchemy's built-in DateTime type. Motivation: We generally want our dateti...
stack_v2_sparse_classes_10k_train_003863
2,273
permissive
[ { "docstring": "Prepare a Python datetime object to inserted into SQL via SQLAlchemy.", "name": "process_bind_param", "signature": "def process_bind_param(self, value: Optional[datetime], dialect: object) -> Optional[datetime]" }, { "docstring": "Process a Python datetime object that SQLAlchemy ...
2
null
Implement the Python class `UTCDateTime` described below. Class description: A SQL column type to store UTC datetimes. Usage example: table = sqlalchemy.Table( ... sqlalchemy.Column("my_datetime_column", UTCDateTime) ) Opentrons robot-server code should always use this instead of SQLAlchemy's built-in DateTime type. M...
Implement the Python class `UTCDateTime` described below. Class description: A SQL column type to store UTC datetimes. Usage example: table = sqlalchemy.Table( ... sqlalchemy.Column("my_datetime_column", UTCDateTime) ) Opentrons robot-server code should always use this instead of SQLAlchemy's built-in DateTime type. M...
026b523c8c9e5d45910c490efb89194d72595be9
<|skeleton|> class UTCDateTime: """A SQL column type to store UTC datetimes. Usage example: table = sqlalchemy.Table( ... sqlalchemy.Column("my_datetime_column", UTCDateTime) ) Opentrons robot-server code should always use this instead of SQLAlchemy's built-in DateTime type. Motivation: We generally want our dateti...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UTCDateTime: """A SQL column type to store UTC datetimes. Usage example: table = sqlalchemy.Table( ... sqlalchemy.Column("my_datetime_column", UTCDateTime) ) Opentrons robot-server code should always use this instead of SQLAlchemy's built-in DateTime type. Motivation: We generally want our datetimes to have a...
the_stack_v2_python_sparse
robot-server/robot_server/persistence/_utc_datetime.py
Opentrons/opentrons
train
326
4ba416bc443732063d2757149c0541d6ee21b54c
[ "allNums = sorted(set(arr))\nres = []\nfor num in arr:\n pos = bisect_right(allNums, num)\n res.append(pos)\nreturn res", "allNums = sorted(set(arr))\nmp = {allNums[i]: i + 1 for i in range(len(allNums))}\nreturn [mp[num] for num in arr]" ]
<|body_start_0|> allNums = sorted(set(arr)) res = [] for num in arr: pos = bisect_right(allNums, num) res.append(pos) return res <|end_body_0|> <|body_start_1|> allNums = sorted(set(arr)) mp = {allNums[i]: i + 1 for i in range(len(allNums))} ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def arrayRankTransform1(self, arr: List[int]) -> List[int]: """离散+二分查询""" <|body_0|> def arrayRankTransform2(self, arr: List[int]) -> List[int]: """离散+哈希表查询""" <|body_1|> <|end_skeleton|> <|body_start_0|> allNums = sorted(set(arr)) ...
stack_v2_sparse_classes_10k_train_003864
1,177
no_license
[ { "docstring": "离散+二分查询", "name": "arrayRankTransform1", "signature": "def arrayRankTransform1(self, arr: List[int]) -> List[int]" }, { "docstring": "离散+哈希表查询", "name": "arrayRankTransform2", "signature": "def arrayRankTransform2(self, arr: List[int]) -> List[int]" } ]
2
stack_v2_sparse_classes_30k_test_000021
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def arrayRankTransform1(self, arr: List[int]) -> List[int]: 离散+二分查询 - def arrayRankTransform2(self, arr: List[int]) -> List[int]: 离散+哈希表查询
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def arrayRankTransform1(self, arr: List[int]) -> List[int]: 离散+二分查询 - def arrayRankTransform2(self, arr: List[int]) -> List[int]: 离散+哈希表查询 <|skeleton|> class Solution: def ...
7e79e26bb8f641868561b186e34c1127ed63c9e0
<|skeleton|> class Solution: def arrayRankTransform1(self, arr: List[int]) -> List[int]: """离散+二分查询""" <|body_0|> def arrayRankTransform2(self, arr: List[int]) -> List[int]: """离散+哈希表查询""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def arrayRankTransform1(self, arr: List[int]) -> List[int]: """离散+二分查询""" allNums = sorted(set(arr)) res = [] for num in arr: pos = bisect_right(allNums, num) res.append(pos) return res def arrayRankTransform2(self, arr: List[int])...
the_stack_v2_python_sparse
22_专题/前缀与差分/差分数组/离散化/离散化模板-1331. 数组序号转换.py
981377660LMT/algorithm-study
train
225
a0250260b5cd4549a68514faaebdde48a46ee8cd
[ "self.output = list()\nself._permuteUnique(list(), nums)\nreturn self.output", "mem = dict()\nif not nums:\n self.output.append(curr_arr)\n return\nfor i, v in enumerate(nums):\n if v in mem:\n continue\n else:\n mem[v] = 1\n new_arr = list(curr_arr)\n new_arr.append(v)\n ...
<|body_start_0|> self.output = list() self._permuteUnique(list(), nums) return self.output <|end_body_0|> <|body_start_1|> mem = dict() if not nums: self.output.append(curr_arr) return for i, v in enumerate(nums): if v in mem: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def permuteUnique(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def _permuteUnique(self, curr_arr, nums): """Helper method to compute permutations recursively using a local dict() to deal with duplicates""" <|body_1|> ...
stack_v2_sparse_classes_10k_train_003865
827
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "permuteUnique", "signature": "def permuteUnique(self, nums)" }, { "docstring": "Helper method to compute permutations recursively using a local dict() to deal with duplicates", "name": "_permuteUnique", "signature":...
2
stack_v2_sparse_classes_30k_train_006231
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def permuteUnique(self, nums): :type nums: List[int] :rtype: List[List[int]] - def _permuteUnique(self, curr_arr, nums): Helper method to compute permutations recursively using a...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def permuteUnique(self, nums): :type nums: List[int] :rtype: List[List[int]] - def _permuteUnique(self, curr_arr, nums): Helper method to compute permutations recursively using a...
43dbcc129de3092d1ef24b95eaf35e20363cbd93
<|skeleton|> class Solution: def permuteUnique(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def _permuteUnique(self, curr_arr, nums): """Helper method to compute permutations recursively using a local dict() to deal with duplicates""" <|body_1|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def permuteUnique(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" self.output = list() self._permuteUnique(list(), nums) return self.output def _permuteUnique(self, curr_arr, nums): """Helper method to compute permutations recursively usi...
the_stack_v2_python_sparse
permutations-ii.py
iyyuan/leetcode-practice
train
0
d1565af10a938cb36ddf7b6ec5b43224700f01f2
[ "if isinstance(reference, pd.DataFrame):\n reference = reference.values\nself.reference = reference\nself.scalers = {}", "if not (log, scale) in self.scalers.keys():\n scaler = None\n ref = self.reference.copy()\n if log:\n ref = np.log2(ref + 1)\n if scale == 'minmax':\n scaler = pp....
<|body_start_0|> if isinstance(reference, pd.DataFrame): reference = reference.values self.reference = reference self.scalers = {} <|end_body_0|> <|body_start_1|> if not (log, scale) in self.scalers.keys(): scaler = None ref = self.reference.copy() ...
CustomScaler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomScaler: def __init__(self, reference): """:param reference:""" <|body_0|> def transform(self, data, log, scale: str): """:param data: :param log: log2(data+1) :param scale: 'minmax','m0s1','divide_mean' :return:""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_10k_train_003866
45,930
no_license
[ { "docstring": ":param reference:", "name": "__init__", "signature": "def __init__(self, reference)" }, { "docstring": ":param data: :param log: log2(data+1) :param scale: 'minmax','m0s1','divide_mean' :return:", "name": "transform", "signature": "def transform(self, data, log, scale: st...
2
stack_v2_sparse_classes_30k_train_001568
Implement the Python class `CustomScaler` described below. Class description: Implement the CustomScaler class. Method signatures and docstrings: - def __init__(self, reference): :param reference: - def transform(self, data, log, scale: str): :param data: :param log: log2(data+1) :param scale: 'minmax','m0s1','divide...
Implement the Python class `CustomScaler` described below. Class description: Implement the CustomScaler class. Method signatures and docstrings: - def __init__(self, reference): :param reference: - def transform(self, data, log, scale: str): :param data: :param log: log2(data+1) :param scale: 'minmax','m0s1','divide...
6d11df5e8ca37e53e048d261ac287f859ba6e9b9
<|skeleton|> class CustomScaler: def __init__(self, reference): """:param reference:""" <|body_0|> def transform(self, data, log, scale: str): """:param data: :param log: log2(data+1) :param scale: 'minmax','m0s1','divide_mean' :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CustomScaler: def __init__(self, reference): """:param reference:""" if isinstance(reference, pd.DataFrame): reference = reference.values self.reference = reference self.scalers = {} def transform(self, data, log, scale: str): """:param data: :param log...
the_stack_v2_python_sparse
stages_DE/stages_library.py
biolab/baylor-dicty
train
0
dccee75890cce38d8b94c56ce0baf766415aca64
[ "self.buffer_max = buffer_max\nself.reg = reg\nself.buff_opt = None\nself.seed = 10\nsuper().__init__(*args, **kwargs)", "print('Eigen Start Method')\nx = eigengap_init(array, k=self.k, b_max=self.buffer_max, warm_start_row_factor=self.init_row_sampling_factor, tol=self.scoring_tol, seed=seed, log=0)\nm, n = x.sh...
<|body_start_0|> self.buffer_max = buffer_max self.reg = reg self.buff_opt = None self.seed = 10 super().__init__(*args, **kwargs) <|end_body_0|> <|body_start_1|> print('Eigen Start Method') x = eigengap_init(array, k=self.k, b_max=self.buffer_max, warm_start_row...
PowerMethodEigenStart
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PowerMethodEigenStart: def __init__(self, buffer_max: int=50, reg: Union[int, float]=0.01, *args, **kwargs) -> None: """Only difference is :param buffer_max: :param reg:""" <|body_0|> def __start(self, array: ArrayType, seed: int) -> ArrayType: """:param array: :retu...
stack_v2_sparse_classes_10k_train_003867
8,055
permissive
[ { "docstring": "Only difference is :param buffer_max: :param reg:", "name": "__init__", "signature": "def __init__(self, buffer_max: int=50, reg: Union[int, float]=0.01, *args, **kwargs) -> None" }, { "docstring": ":param array: :return:", "name": "__start", "signature": "def __start(sel...
6
stack_v2_sparse_classes_30k_train_000454
Implement the Python class `PowerMethodEigenStart` described below. Class description: Implement the PowerMethodEigenStart class. Method signatures and docstrings: - def __init__(self, buffer_max: int=50, reg: Union[int, float]=0.01, *args, **kwargs) -> None: Only difference is :param buffer_max: :param reg: - def __...
Implement the Python class `PowerMethodEigenStart` described below. Class description: Implement the PowerMethodEigenStart class. Method signatures and docstrings: - def __init__(self, buffer_max: int=50, reg: Union[int, float]=0.01, *args, **kwargs) -> None: Only difference is :param buffer_max: :param reg: - def __...
962e91463f4889bb1e67a3fbfc54128c1b3a3735
<|skeleton|> class PowerMethodEigenStart: def __init__(self, buffer_max: int=50, reg: Union[int, float]=0.01, *args, **kwargs) -> None: """Only difference is :param buffer_max: :param reg:""" <|body_0|> def __start(self, array: ArrayType, seed: int) -> ArrayType: """:param array: :retu...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PowerMethodEigenStart: def __init__(self, buffer_max: int=50, reg: Union[int, float]=0.01, *args, **kwargs) -> None: """Only difference is :param buffer_max: :param reg:""" self.buffer_max = buffer_max self.reg = reg self.buff_opt = None self.seed = 10 super()._...
the_stack_v2_python_sparse
lmdec/decomp/legacy/power_method.py
TNonet/lmdec_research
train
0
f2bd910ae4dc16a74c1f11c8aa676739361e4b1d
[ "if root:\n return str(root.val) + ' ' + self.serialize(root.left) + ' ' + self.serialize(root.right)\nelse:\n return '#'", "q = data.split()\n\ndef dfs(q):\n if not q:\n return None\n val = q.pop(0)\n if val == '#':\n return None\n else:\n node = TreeNode(val)\n node...
<|body_start_0|> if root: return str(root.val) + ' ' + self.serialize(root.left) + ' ' + self.serialize(root.right) else: return '#' <|end_body_0|> <|body_start_1|> q = data.split() def dfs(q): if not q: return None val = ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_10k_train_003868
2,028
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_000211
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:...
9d9e0c08992ef7dbd9ac517821faa9de17f49b0e
<|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: return str(root.val) + ' ' + self.serialize(root.left) + ' ' + self.serialize(root.right) else: return '#' def deserialize(self, data): ...
the_stack_v2_python_sparse
297-serialize-and-deserialize-binary-tree.py
floydchenchen/leetcode
train
0
368f3d65b3dcbbfb9b9ff08b82a8748cb8826381
[ "super().setUp()\nself.signup(self.CURRICULUM_ADMIN_EMAIL, self.CURRICULUM_ADMIN_USERNAME)\nself.signup(self.ALBERT_EMAIL, self.ALBERT_NAME)\nself.admin_id = self.get_user_id_from_email(self.CURRICULUM_ADMIN_EMAIL)\nself.albert_id = self.get_user_id_from_email(self.ALBERT_EMAIL)\nself.albert = user_services.get_use...
<|body_start_0|> super().setUp() self.signup(self.CURRICULUM_ADMIN_EMAIL, self.CURRICULUM_ADMIN_USERNAME) self.signup(self.ALBERT_EMAIL, self.ALBERT_NAME) self.admin_id = self.get_user_id_from_email(self.CURRICULUM_ADMIN_EMAIL) self.albert_id = self.get_user_id_from_email(self.AL...
Test functions for getting displayable recently published exploration summary dicts.
RecentlyPublishedExplorationDisplayableSummariesTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RecentlyPublishedExplorationDisplayableSummariesTest: """Test functions for getting displayable recently published exploration summary dicts.""" def setUp(self) -> None: """Populate the database of explorations and their summaries. The sequence of events is: - (1) Albert creates EXP_...
stack_v2_sparse_classes_10k_train_003869
47,358
permissive
[ { "docstring": "Populate the database of explorations and their summaries. The sequence of events is: - (1) Albert creates EXP_ID_1. - (2) Albert creates EXP_ID_2. - (3) Albert creates EXP_ID_3. - (4) Albert publishes EXP_ID_1. - (5) Albert publishes EXP_ID_2. - (6) Albert publishes EXP_ID_3. - (7) Admin user i...
2
null
Implement the Python class `RecentlyPublishedExplorationDisplayableSummariesTest` described below. Class description: Test functions for getting displayable recently published exploration summary dicts. Method signatures and docstrings: - def setUp(self) -> None: Populate the database of explorations and their summar...
Implement the Python class `RecentlyPublishedExplorationDisplayableSummariesTest` described below. Class description: Test functions for getting displayable recently published exploration summary dicts. Method signatures and docstrings: - def setUp(self) -> None: Populate the database of explorations and their summar...
d16fdf23d790eafd63812bd7239532256e30a21d
<|skeleton|> class RecentlyPublishedExplorationDisplayableSummariesTest: """Test functions for getting displayable recently published exploration summary dicts.""" def setUp(self) -> None: """Populate the database of explorations and their summaries. The sequence of events is: - (1) Albert creates EXP_...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RecentlyPublishedExplorationDisplayableSummariesTest: """Test functions for getting displayable recently published exploration summary dicts.""" def setUp(self) -> None: """Populate the database of explorations and their summaries. The sequence of events is: - (1) Albert creates EXP_ID_1. - (2) A...
the_stack_v2_python_sparse
core/domain/summary_services_test.py
oppia/oppia
train
6,172
22ec3713c3592add9205e4f539a934c6af6f4544
[ "res, n, M = (0, len(arr), 10 ** 9 + 7)\nst = [-1]\ndp = [0] * (n + 1)\nfor i in range(1, n + 1):\n while st[-1] != -1 and arr[st[-1]] >= arr[i - 1]:\n st.pop()\n dp[i] = (dp[st[-1] + 1] + (i - 1 - st[-1]) * arr[i - 1]) % M\n st.append(i - 1)\n res = (res + dp[i]) % M\nreturn res", "res = 0\ns ...
<|body_start_0|> res, n, M = (0, len(arr), 10 ** 9 + 7) st = [-1] dp = [0] * (n + 1) for i in range(1, n + 1): while st[-1] != -1 and arr[st[-1]] >= arr[i - 1]: st.pop() dp[i] = (dp[st[-1] + 1] + (i - 1 - st[-1]) * arr[i - 1]) % M st.ap...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def sumSubarrayMins(self, arr): """:type arr: List[int] :rtype: int""" <|body_0|> def sumSubarrayMins2(self, arr): """:type arr: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> res, n, M = (0, len(arr), 10 ** 9 + 7) ...
stack_v2_sparse_classes_10k_train_003870
1,665
no_license
[ { "docstring": ":type arr: List[int] :rtype: int", "name": "sumSubarrayMins", "signature": "def sumSubarrayMins(self, arr)" }, { "docstring": ":type arr: List[int] :rtype: int", "name": "sumSubarrayMins2", "signature": "def sumSubarrayMins2(self, arr)" } ]
2
stack_v2_sparse_classes_30k_train_001490
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sumSubarrayMins(self, arr): :type arr: List[int] :rtype: int - def sumSubarrayMins2(self, arr): :type arr: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sumSubarrayMins(self, arr): :type arr: List[int] :rtype: int - def sumSubarrayMins2(self, arr): :type arr: List[int] :rtype: int <|skeleton|> class Solution: def sumSub...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def sumSubarrayMins(self, arr): """:type arr: List[int] :rtype: int""" <|body_0|> def sumSubarrayMins2(self, arr): """:type arr: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def sumSubarrayMins(self, arr): """:type arr: List[int] :rtype: int""" res, n, M = (0, len(arr), 10 ** 9 + 7) st = [-1] dp = [0] * (n + 1) for i in range(1, n + 1): while st[-1] != -1 and arr[st[-1]] >= arr[i - 1]: st.pop() ...
the_stack_v2_python_sparse
S/SumofSubarrayMinimums.py
bssrdf/pyleet
train
2
ee3c534ee682148d21573725a6d0d85d5f428acf
[ "res_set = set(A[0])\narr_size = len(A)\ncount_dict = {}\nres = []\nfor i in range(1, arr_size):\n res_set = set(A[i]) & res_set\n if len(res_set) != 0:\n i += 1\nfor char in res_set:\n count = A[0].count(char)\n for i in range(1, arr_size):\n count = min(A[i].count(char), count)\n ...
<|body_start_0|> res_set = set(A[0]) arr_size = len(A) count_dict = {} res = [] for i in range(1, arr_size): res_set = set(A[i]) & res_set if len(res_set) != 0: i += 1 for char in res_set: count = A[0].count(char) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def commonChars(self, A): """:type A: List[str] :rtype: List[str]""" <|body_0|> def commonChars2(self, words): """:type words: List[str] :rtype: List[str]""" <|body_1|> <|end_skeleton|> <|body_start_0|> res_set = set(A[0]) arr_size...
stack_v2_sparse_classes_10k_train_003871
2,410
no_license
[ { "docstring": ":type A: List[str] :rtype: List[str]", "name": "commonChars", "signature": "def commonChars(self, A)" }, { "docstring": ":type words: List[str] :rtype: List[str]", "name": "commonChars2", "signature": "def commonChars2(self, words)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def commonChars(self, A): :type A: List[str] :rtype: List[str] - def commonChars2(self, words): :type words: List[str] :rtype: List[str]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def commonChars(self, A): :type A: List[str] :rtype: List[str] - def commonChars2(self, words): :type words: List[str] :rtype: List[str] <|skeleton|> class Solution: def co...
813235789ce422a3bab198317aafc46fbc61625e
<|skeleton|> class Solution: def commonChars(self, A): """:type A: List[str] :rtype: List[str]""" <|body_0|> def commonChars2(self, words): """:type words: List[str] :rtype: List[str]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def commonChars(self, A): """:type A: List[str] :rtype: List[str]""" res_set = set(A[0]) arr_size = len(A) count_dict = {} res = [] for i in range(1, arr_size): res_set = set(A[i]) & res_set if len(res_set) != 0: ...
the_stack_v2_python_sparse
2.SET/e1002_Find Common Characters/solution.py
kimmyoo/python_leetcode
train
1
896710a50b6a81bb782a3c9852cf7a51dd384abb
[ "self.name = name\nself.bord = []\nfor i in range(0, 4):\n self.bord.append(PuzzleGirafeBord(definition[i * 2:i * 2 + 2]))\nself.orientation = 0\nself.position = position\nself.numero = numero", "image = pygame.image.load(self.name)\nself.image = pygame.transform.scale(image, (250, 250))\ns = self.image.get_si...
<|body_start_0|> self.name = name self.bord = [] for i in range(0, 4): self.bord.append(PuzzleGirafeBord(definition[i * 2:i * 2 + 2])) self.orientation = 0 self.position = position self.numero = numero <|end_body_0|> <|body_start_1|> image = pygame.im...
Définition d'une pièce du puzzle, celle-ci inclut : - **bord** : cette liste contient quatre objets de type Bord, cette liste ne changera plus - **position** : c'est la position de la pièce dans le puzzle, ce qui nous intéresse, c'est la position finale de la pièce dans le puzzle, cette information va donc bouger au fu...
PuzzleGirafePiece
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PuzzleGirafePiece: """Définition d'une pièce du puzzle, celle-ci inclut : - **bord** : cette liste contient quatre objets de type Bord, cette liste ne changera plus - **position** : c'est la position de la pièce dans le puzzle, ce qui nous intéresse, c'est la position finale de la pièce dans le p...
stack_v2_sparse_classes_10k_train_003872
17,048
permissive
[ { "docstring": "on définit la pièce @param name nom de l'image représentant la pièce @param definition chaîne de 8 caractères, c'est une suite de 4 x 2 caractères définissant chaque bord, voir la classe bord pour leur signification @param position c'est la position initiale de la pièce, on suppose que l'orienta...
5
null
Implement the Python class `PuzzleGirafePiece` described below. Class description: Définition d'une pièce du puzzle, celle-ci inclut : - **bord** : cette liste contient quatre objets de type Bord, cette liste ne changera plus - **position** : c'est la position de la pièce dans le puzzle, ce qui nous intéresse, c'est l...
Implement the Python class `PuzzleGirafePiece` described below. Class description: Définition d'une pièce du puzzle, celle-ci inclut : - **bord** : cette liste contient quatre objets de type Bord, cette liste ne changera plus - **position** : c'est la position de la pièce dans le puzzle, ce qui nous intéresse, c'est l...
2abbc7a20c7437f9ab91d1ec83a6aecdefceb028
<|skeleton|> class PuzzleGirafePiece: """Définition d'une pièce du puzzle, celle-ci inclut : - **bord** : cette liste contient quatre objets de type Bord, cette liste ne changera plus - **position** : c'est la position de la pièce dans le puzzle, ce qui nous intéresse, c'est la position finale de la pièce dans le p...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PuzzleGirafePiece: """Définition d'une pièce du puzzle, celle-ci inclut : - **bord** : cette liste contient quatre objets de type Bord, cette liste ne changera plus - **position** : c'est la position de la pièce dans le puzzle, ce qui nous intéresse, c'est la position finale de la pièce dans le puzzle, cette ...
the_stack_v2_python_sparse
src/ensae_teaching_cs/special/puzzle_girafe.py
Pandinosaurus/ensae_teaching_cs
train
1
6d5f686bad698a983f2b5e18d94daa47bcd9287c
[ "if n < 2:\n raise ValueError('Please input a number greater then 2')\nprimes = []\ni = 2\nwhile i < n:\n j = 2\n isPrime = True\n '\\n We only need to consider j < sqrt(i) for example if we consider 36 we know that if we consider\\n 9 it has a factor less then 6 which is 4\\n ...
<|body_start_0|> if n < 2: raise ValueError('Please input a number greater then 2') primes = [] i = 2 while i < n: j = 2 isPrime = True '\n We only need to consider j < sqrt(i) for example if we consider 36 we know that if we con...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def naive_enumeration(self, n: int) -> List[int]: """Enumerates all primes up to the number n input ---- n : integer output ---- res : list of integers Complexity ---- Time : O(N^3/2) Space : O(N)""" <|body_0|> def sieve_eratosthenes(self, n: int) -> List[int]: ...
stack_v2_sparse_classes_10k_train_003873
2,164
no_license
[ { "docstring": "Enumerates all primes up to the number n input ---- n : integer output ---- res : list of integers Complexity ---- Time : O(N^3/2) Space : O(N)", "name": "naive_enumeration", "signature": "def naive_enumeration(self, n: int) -> List[int]" }, { "docstring": "Enumerates all primes ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def naive_enumeration(self, n: int) -> List[int]: Enumerates all primes up to the number n input ---- n : integer output ---- res : list of integers Complexity ---- Time : O(N^3/...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def naive_enumeration(self, n: int) -> List[int]: Enumerates all primes up to the number n input ---- n : integer output ---- res : list of integers Complexity ---- Time : O(N^3/...
c0d49423885832b616ae3c7cd58e8f24c17cfd4d
<|skeleton|> class Solution: def naive_enumeration(self, n: int) -> List[int]: """Enumerates all primes up to the number n input ---- n : integer output ---- res : list of integers Complexity ---- Time : O(N^3/2) Space : O(N)""" <|body_0|> def sieve_eratosthenes(self, n: int) -> List[int]: ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def naive_enumeration(self, n: int) -> List[int]: """Enumerates all primes up to the number n input ---- n : integer output ---- res : list of integers Complexity ---- Time : O(N^3/2) Space : O(N)""" if n < 2: raise ValueError('Please input a number greater then 2') ...
the_stack_v2_python_sparse
Arrays/enumerate_primes.py
miaviles/Data-Structures-Algorithms-Python
train
0
48bbd1bb640dcf045b7e89fd130dbf07ec173e7d
[ "self.cluster_gateway = cluster_gateway\nself.cluster_subnet_mask = cluster_subnet_mask\nself.dns_servers = dns_servers\nself.domain_names = domain_names\nself.ntp_servers = ntp_servers\nself.vip_hostname = vip_hostname\nself.vips = vips", "if dictionary is None:\n return None\ncluster_gateway = dictionary.get...
<|body_start_0|> self.cluster_gateway = cluster_gateway self.cluster_subnet_mask = cluster_subnet_mask self.dns_servers = dns_servers self.domain_names = domain_names self.ntp_servers = ntp_servers self.vip_hostname = vip_hostname self.vips = vips <|end_body_0|> ...
Implementation of the 'NetworkConfiguration' model. Specifies all of the parameters needed for network configuration of the new Cluster. Attributes: cluster_gateway (string): Specifies the default gateway IP address (or addresses) for the Cluster network. cluster_subnet_mask (string): Specifies the subnet mask (or mask...
NetworkConfiguration
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NetworkConfiguration: """Implementation of the 'NetworkConfiguration' model. Specifies all of the parameters needed for network configuration of the new Cluster. Attributes: cluster_gateway (string): Specifies the default gateway IP address (or addresses) for the Cluster network. cluster_subnet_m...
stack_v2_sparse_classes_10k_train_003874
3,285
permissive
[ { "docstring": "Constructor for the NetworkConfiguration class", "name": "__init__", "signature": "def __init__(self, cluster_gateway=None, cluster_subnet_mask=None, dns_servers=None, domain_names=None, ntp_servers=None, vip_hostname=None, vips=None)" }, { "docstring": "Creates an instance of th...
2
null
Implement the Python class `NetworkConfiguration` described below. Class description: Implementation of the 'NetworkConfiguration' model. Specifies all of the parameters needed for network configuration of the new Cluster. Attributes: cluster_gateway (string): Specifies the default gateway IP address (or addresses) fo...
Implement the Python class `NetworkConfiguration` described below. Class description: Implementation of the 'NetworkConfiguration' model. Specifies all of the parameters needed for network configuration of the new Cluster. Attributes: cluster_gateway (string): Specifies the default gateway IP address (or addresses) fo...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class NetworkConfiguration: """Implementation of the 'NetworkConfiguration' model. Specifies all of the parameters needed for network configuration of the new Cluster. Attributes: cluster_gateway (string): Specifies the default gateway IP address (or addresses) for the Cluster network. cluster_subnet_m...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NetworkConfiguration: """Implementation of the 'NetworkConfiguration' model. Specifies all of the parameters needed for network configuration of the new Cluster. Attributes: cluster_gateway (string): Specifies the default gateway IP address (or addresses) for the Cluster network. cluster_subnet_mask (string):...
the_stack_v2_python_sparse
cohesity_management_sdk/models/network_configuration.py
cohesity/management-sdk-python
train
24
7971ae69eec593041f3bb59c11e8855bb4f0e8ff
[ "for row in matrix:\n if not is_distinct_row(row):\n return False\nreturn True", "rows = []\nfor _ in range(self.num_rows):\n random_permutation = random_state.permutation(self.num_atoms)\n rows.append(random_permutation[:self.num_cols])\nreturn np.array(rows)" ]
<|body_start_0|> for row in matrix: if not is_distinct_row(row): return False return True <|end_body_0|> <|body_start_1|> rows = [] for _ in range(self.num_rows): random_permutation = random_state.permutation(self.num_atoms) rows.appen...
Relation where elements in a matrix row are distinct.
DistinctRelation
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DistinctRelation: """Relation where elements in a matrix row are distinct.""" def is_consistent(matrix): """Checks whether the matrix satisfies the relation.""" <|body_0|> def sample(self, random_state): """Samples a matrix consistent with the relation.""" ...
stack_v2_sparse_classes_10k_train_003875
10,947
permissive
[ { "docstring": "Checks whether the matrix satisfies the relation.", "name": "is_consistent", "signature": "def is_consistent(matrix)" }, { "docstring": "Samples a matrix consistent with the relation.", "name": "sample", "signature": "def sample(self, random_state)" } ]
2
stack_v2_sparse_classes_30k_test_000382
Implement the Python class `DistinctRelation` described below. Class description: Relation where elements in a matrix row are distinct. Method signatures and docstrings: - def is_consistent(matrix): Checks whether the matrix satisfies the relation. - def sample(self, random_state): Samples a matrix consistent with th...
Implement the Python class `DistinctRelation` described below. Class description: Relation where elements in a matrix row are distinct. Method signatures and docstrings: - def is_consistent(matrix): Checks whether the matrix satisfies the relation. - def sample(self, random_state): Samples a matrix consistent with th...
73d4b995e88efdd5ffbe98a72e48a620c58f4dc7
<|skeleton|> class DistinctRelation: """Relation where elements in a matrix row are distinct.""" def is_consistent(matrix): """Checks whether the matrix satisfies the relation.""" <|body_0|> def sample(self, random_state): """Samples a matrix consistent with the relation.""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DistinctRelation: """Relation where elements in a matrix row are distinct.""" def is_consistent(matrix): """Checks whether the matrix satisfies the relation.""" for row in matrix: if not is_distinct_row(row): return False return True def sample(sel...
the_stack_v2_python_sparse
disentanglement_lib/evaluation/abstract_reasoning/pgm_utils.py
travers-rhodes/disentanglement_lib
train
0
980de806b394bb46849606d7e27fdf360354e87e
[ "super().setUpTestData()\ncls.acme = Company.objects.create(name='ACME', description='Supplier', is_customer=False, is_supplier=True)\nCompany.objects.create(name='Drippy Cup Co.', description='Customer', is_customer=True, is_supplier=False)\nCompany.objects.create(name='Sippy Cup Emporium', description='Another su...
<|body_start_0|> super().setUpTestData() cls.acme = Company.objects.create(name='ACME', description='Supplier', is_customer=False, is_supplier=True) Company.objects.create(name='Drippy Cup Co.', description='Customer', is_customer=True, is_supplier=False) Company.objects.create(name='Sip...
Series of tests for the Company DRF API.
CompanyTest
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CompanyTest: """Series of tests for the Company DRF API.""" def setUpTestData(cls): """Perform initialization for the unit test class""" <|body_0|> def test_company_list(self): """Test the list API endpoint for the Company model""" <|body_1|> def tes...
stack_v2_sparse_classes_10k_train_003876
19,439
permissive
[ { "docstring": "Perform initialization for the unit test class", "name": "setUpTestData", "signature": "def setUpTestData(cls)" }, { "docstring": "Test the list API endpoint for the Company model", "name": "test_company_list", "signature": "def test_company_list(self)" }, { "docs...
5
stack_v2_sparse_classes_30k_train_003818
Implement the Python class `CompanyTest` described below. Class description: Series of tests for the Company DRF API. Method signatures and docstrings: - def setUpTestData(cls): Perform initialization for the unit test class - def test_company_list(self): Test the list API endpoint for the Company model - def test_co...
Implement the Python class `CompanyTest` described below. Class description: Series of tests for the Company DRF API. Method signatures and docstrings: - def setUpTestData(cls): Perform initialization for the unit test class - def test_company_list(self): Test the list API endpoint for the Company model - def test_co...
e88a8e99a5f0b201c67a95cba097c729f090d5e2
<|skeleton|> class CompanyTest: """Series of tests for the Company DRF API.""" def setUpTestData(cls): """Perform initialization for the unit test class""" <|body_0|> def test_company_list(self): """Test the list API endpoint for the Company model""" <|body_1|> def tes...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CompanyTest: """Series of tests for the Company DRF API.""" def setUpTestData(cls): """Perform initialization for the unit test class""" super().setUpTestData() cls.acme = Company.objects.create(name='ACME', description='Supplier', is_customer=False, is_supplier=True) Comp...
the_stack_v2_python_sparse
InvenTree/company/test_api.py
inventree/InvenTree
train
3,077
9d2a96c22863de4ae01db19901fa985c4fedc346
[ "A.sort()\nB = sorted([(num, index) for index, num in enumerate(B)])\nremain = []\nj = 0\nret = [0 for _ in range(len(A))]\nfor i, num in enumerate(A):\n if num > B[j][0]:\n ret[B[j][1]] = num\n j += 1\n else:\n remain.append(num)\nfor i in range(j, len(B)):\n ret[B[i][1]] = remain.pop...
<|body_start_0|> A.sort() B = sorted([(num, index) for index, num in enumerate(B)]) remain = [] j = 0 ret = [0 for _ in range(len(A))] for i, num in enumerate(A): if num > B[j][0]: ret[B[j][1]] = num j += 1 else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def advantageCount(self, A, B): """:type A: List[int] :type B: List[int] :rtype: List[int]""" <|body_0|> def advantageCount2(self, A, B): """:type A: List[int] :type B: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_003877
1,330
no_license
[ { "docstring": ":type A: List[int] :type B: List[int] :rtype: List[int]", "name": "advantageCount", "signature": "def advantageCount(self, A, B)" }, { "docstring": ":type A: List[int] :type B: List[int] :rtype: List[int]", "name": "advantageCount2", "signature": "def advantageCount2(self...
2
stack_v2_sparse_classes_30k_train_003013
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def advantageCount(self, A, B): :type A: List[int] :type B: List[int] :rtype: List[int] - def advantageCount2(self, A, B): :type A: List[int] :type B: List[int] :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def advantageCount(self, A, B): :type A: List[int] :type B: List[int] :rtype: List[int] - def advantageCount2(self, A, B): :type A: List[int] :type B: List[int] :rtype: List[int]...
70bdd75b6af2e1811c1beab22050c01d28d7373e
<|skeleton|> class Solution: def advantageCount(self, A, B): """:type A: List[int] :type B: List[int] :rtype: List[int]""" <|body_0|> def advantageCount2(self, A, B): """:type A: List[int] :type B: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def advantageCount(self, A, B): """:type A: List[int] :type B: List[int] :rtype: List[int]""" A.sort() B = sorted([(num, index) for index, num in enumerate(B)]) remain = [] j = 0 ret = [0 for _ in range(len(A))] for i, num in enumerate(A): ...
the_stack_v2_python_sparse
python/leetcode/870_Advantage_Shuffle.py
bobcaoge/my-code
train
0
ba379577b22edd9af0c0d1f9d85a667ded2ec6a0
[ "matstamm_info = request.json\ninserted_matstaemme = []\nfor matstamm in matstamm_info:\n inserted_matstamm = Matstamm.create(matstamm_dict=matstamm)\n inserted_matstaemme.append(inserted_matstamm)\nreturn inserted_matstaemme", "matstamm_info = request.json\nmatstamm_info['last_updated'] = datetime.utcnow()...
<|body_start_0|> matstamm_info = request.json inserted_matstaemme = [] for matstamm in matstamm_info: inserted_matstamm = Matstamm.create(matstamm_dict=matstamm) inserted_matstaemme.append(inserted_matstamm) return inserted_matstaemme <|end_body_0|> <|body_start_...
Matstammn
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Matstammn: def post(self): """Matstammliste wird in die Datenbank hinzugefügt""" <|body_0|> def put(self): """Matstamm bearbeiten""" <|body_1|> def get(self): """Matstamm anzeigen""" <|body_2|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_003878
4,078
no_license
[ { "docstring": "Matstammliste wird in die Datenbank hinzugefügt", "name": "post", "signature": "def post(self)" }, { "docstring": "Matstamm bearbeiten", "name": "put", "signature": "def put(self)" }, { "docstring": "Matstamm anzeigen", "name": "get", "signature": "def get...
3
stack_v2_sparse_classes_30k_train_004031
Implement the Python class `Matstammn` described below. Class description: Implement the Matstammn class. Method signatures and docstrings: - def post(self): Matstammliste wird in die Datenbank hinzugefügt - def put(self): Matstamm bearbeiten - def get(self): Matstamm anzeigen
Implement the Python class `Matstammn` described below. Class description: Implement the Matstammn class. Method signatures and docstrings: - def post(self): Matstammliste wird in die Datenbank hinzugefügt - def put(self): Matstamm bearbeiten - def get(self): Matstamm anzeigen <|skeleton|> class Matstammn: def ...
8f1f0f9bb2a060aa5c32be320a6d2c955f442053
<|skeleton|> class Matstammn: def post(self): """Matstammliste wird in die Datenbank hinzugefügt""" <|body_0|> def put(self): """Matstamm bearbeiten""" <|body_1|> def get(self): """Matstamm anzeigen""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Matstammn: def post(self): """Matstammliste wird in die Datenbank hinzugefügt""" matstamm_info = request.json inserted_matstaemme = [] for matstamm in matstamm_info: inserted_matstamm = Matstamm.create(matstamm_dict=matstamm) inserted_matstaemme.append(i...
the_stack_v2_python_sparse
app/api/matstaemme.py
hammadi3/freig
train
0
5e5131fc36127519aac6e979c4c37d66a168b8d9
[ "candidate_plant = None\nplants = self.filter(last_seen=day_date, partner_short_name=partner_name, include=True)\nif len(plants) > 0:\n candidate_plant = plants[0]\nelif day_date > date.today():\n candidate_plant = None\nelse:\n plants = self.filter(last_seen__isnull=True, partner_short_name=partner_name, ...
<|body_start_0|> candidate_plant = None plants = self.filter(last_seen=day_date, partner_short_name=partner_name, include=True) if len(plants) > 0: candidate_plant = plants[0] elif day_date > date.today(): candidate_plant = None else: plants = ...
Custom model manager for getting Plant of the Day records by date.
PlantOfTheDayManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlantOfTheDayManager: """Custom model manager for getting Plant of the Day records by date.""" def _pick_candidate_plant(self, day_date, partner_name): """Pick a candidate Plant of the Day for a given day and partner.""" <|body_0|> def for_day(self, day_date, partner_nam...
stack_v2_sparse_classes_10k_train_003879
5,522
no_license
[ { "docstring": "Pick a candidate Plant of the Day for a given day and partner.", "name": "_pick_candidate_plant", "signature": "def _pick_candidate_plant(self, day_date, partner_name)" }, { "docstring": "Return the Plant of the Day for a given day and partner site.", "name": "for_day", "...
2
stack_v2_sparse_classes_30k_train_003607
Implement the Python class `PlantOfTheDayManager` described below. Class description: Custom model manager for getting Plant of the Day records by date. Method signatures and docstrings: - def _pick_candidate_plant(self, day_date, partner_name): Pick a candidate Plant of the Day for a given day and partner. - def for...
Implement the Python class `PlantOfTheDayManager` described below. Class description: Custom model manager for getting Plant of the Day records by date. Method signatures and docstrings: - def _pick_candidate_plant(self, day_date, partner_name): Pick a candidate Plant of the Day for a given day and partner. - def for...
9030d08b9a1b8bdb0f897c6e482c09ef78cc4d3d
<|skeleton|> class PlantOfTheDayManager: """Custom model manager for getting Plant of the Day records by date.""" def _pick_candidate_plant(self, day_date, partner_name): """Pick a candidate Plant of the Day for a given day and partner.""" <|body_0|> def for_day(self, day_date, partner_nam...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PlantOfTheDayManager: """Custom model manager for getting Plant of the Day records by date.""" def _pick_candidate_plant(self, day_date, partner_name): """Pick a candidate Plant of the Day for a given day and partner.""" candidate_plant = None plants = self.filter(last_seen=day_da...
the_stack_v2_python_sparse
gobotany/plantoftheday/models.py
newfs/gobotany-app
train
10
87da29dba6340ec4955cc8c858e6108d0a19d6ed
[ "super(Summarization, self).__init__(**kwargs)\nself.d_model = d_model\nself.n_head = n_head\nself.d_head = d_head\nself.initializer = initializer\nself.dropout = dropout\nself.dropout_att = dropout_att\nself.use_proj = use_proj\nself.summary_type = summary_type", "if self.use_proj:\n self.proj_layer = tf.kera...
<|body_start_0|> super(Summarization, self).__init__(**kwargs) self.d_model = d_model self.n_head = n_head self.d_head = d_head self.initializer = initializer self.dropout = dropout self.dropout_att = dropout_att self.use_proj = use_proj self.summa...
The layer to pool the output from XLNet model into a vector.
Summarization
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Summarization: """The layer to pool the output from XLNet model into a vector.""" def __init__(self, d_model, n_head, d_head, dropout, dropout_att, initializer, use_proj=True, summary_type='last', **kwargs): """Constructs Summarization layer. Args: d_model: int, the dimension of mode...
stack_v2_sparse_classes_10k_train_003880
46,062
permissive
[ { "docstring": "Constructs Summarization layer. Args: d_model: int, the dimension of model hidden state. n_head: int, the number of attention heads. d_head: int, the dimension size of each attention head. dropout: float, dropout rate. dropout_att: float, dropout rate on attention probabilities. initializer: Ini...
3
null
Implement the Python class `Summarization` described below. Class description: The layer to pool the output from XLNet model into a vector. Method signatures and docstrings: - def __init__(self, d_model, n_head, d_head, dropout, dropout_att, initializer, use_proj=True, summary_type='last', **kwargs): Constructs Summa...
Implement the Python class `Summarization` described below. Class description: The layer to pool the output from XLNet model into a vector. Method signatures and docstrings: - def __init__(self, d_model, n_head, d_head, dropout, dropout_att, initializer, use_proj=True, summary_type='last', **kwargs): Constructs Summa...
a115d918f6894a69586174653172be0b5d1de952
<|skeleton|> class Summarization: """The layer to pool the output from XLNet model into a vector.""" def __init__(self, d_model, n_head, d_head, dropout, dropout_att, initializer, use_proj=True, summary_type='last', **kwargs): """Constructs Summarization layer. Args: d_model: int, the dimension of mode...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Summarization: """The layer to pool the output from XLNet model into a vector.""" def __init__(self, d_model, n_head, d_head, dropout, dropout_att, initializer, use_proj=True, summary_type='last', **kwargs): """Constructs Summarization layer. Args: d_model: int, the dimension of model hidden stat...
the_stack_v2_python_sparse
models/official/nlp/xlnet/xlnet_modeling.py
finnickniu/tensorflow_object_detection_tflite
train
60
cf3b386e69a352230fec7e5af27d9b4262f68c72
[ "self.shape_predictor_path = shape_predictor_path\nself.predictor = dlib.shape_predictor(self.shape_predictor_path)\nself.detector = dlib.get_frontal_face_detector()\nself.face_aligner = FaceAligner(self.predictor, desiredFaceWidth=256)", "rectangles = self.detector(image, 1)\nif len(rectangles) == 0:\n logger...
<|body_start_0|> self.shape_predictor_path = shape_predictor_path self.predictor = dlib.shape_predictor(self.shape_predictor_path) self.detector = dlib.get_frontal_face_detector() self.face_aligner = FaceAligner(self.predictor, desiredFaceWidth=256) <|end_body_0|> <|body_start_1|> ...
The FaceDetector class is responsible for: 1. Detecting the face. 2. Extracting a face from an image. 3. Applying blurring on a detected face in an image.
FaceDetector
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FaceDetector: """The FaceDetector class is responsible for: 1. Detecting the face. 2. Extracting a face from an image. 3. Applying blurring on a detected face in an image.""" def __init__(self, shape_predictor_path): """Initialise Face Detector Manager. :param shape_predictor_path (s...
stack_v2_sparse_classes_10k_train_003881
4,580
permissive
[ { "docstring": "Initialise Face Detector Manager. :param shape_predictor_path (str): Describes the path to the Shape Predictor trained data.", "name": "__init__", "signature": "def __init__(self, shape_predictor_path)" }, { "docstring": "This function detects the face in the image passed. By mak...
4
stack_v2_sparse_classes_30k_train_006303
Implement the Python class `FaceDetector` described below. Class description: The FaceDetector class is responsible for: 1. Detecting the face. 2. Extracting a face from an image. 3. Applying blurring on a detected face in an image. Method signatures and docstrings: - def __init__(self, shape_predictor_path): Initial...
Implement the Python class `FaceDetector` described below. Class description: The FaceDetector class is responsible for: 1. Detecting the face. 2. Extracting a face from an image. 3. Applying blurring on a detected face in an image. Method signatures and docstrings: - def __init__(self, shape_predictor_path): Initial...
d62917262080f09d7c9e7262f507e2c1482d7c56
<|skeleton|> class FaceDetector: """The FaceDetector class is responsible for: 1. Detecting the face. 2. Extracting a face from an image. 3. Applying blurring on a detected face in an image.""" def __init__(self, shape_predictor_path): """Initialise Face Detector Manager. :param shape_predictor_path (s...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FaceDetector: """The FaceDetector class is responsible for: 1. Detecting the face. 2. Extracting a face from an image. 3. Applying blurring on a detected face in an image.""" def __init__(self, shape_predictor_path): """Initialise Face Detector Manager. :param shape_predictor_path (str): Describe...
the_stack_v2_python_sparse
src/main/python/hutts_verification/image_preprocessing/face_manager.py
javaTheHutts/Java-the-Hutts
train
2
9eee53666080595bf3d5754cff63751a2dc52e4d
[ "self.input_arr = [3, 4, 2, 1, 2, 3, 7, 1, 1, 1, 3]\nself.output = 4\nreturn (self.input_arr, self.output)", "input_arr, output = self.setUp()\noutput_method = minNumberOfJumps(input_arr)\nself.assertEqual(output, output_method)" ]
<|body_start_0|> self.input_arr = [3, 4, 2, 1, 2, 3, 7, 1, 1, 1, 3] self.output = 4 return (self.input_arr, self.output) <|end_body_0|> <|body_start_1|> input_arr, output = self.setUp() output_method = minNumberOfJumps(input_arr) self.assertEqual(output, output_method) <...
Class with unittests for MinNumberOfJumps.py
test_MinNumberOfJumps
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class test_MinNumberOfJumps: """Class with unittests for MinNumberOfJumps.py""" def setUp(self): """Sets up input.""" <|body_0|> def test_user_input(self): """Checks if method works properly.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.input_...
stack_v2_sparse_classes_10k_train_003882
863
no_license
[ { "docstring": "Sets up input.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Checks if method works properly.", "name": "test_user_input", "signature": "def test_user_input(self)" } ]
2
null
Implement the Python class `test_MinNumberOfJumps` described below. Class description: Class with unittests for MinNumberOfJumps.py Method signatures and docstrings: - def setUp(self): Sets up input. - def test_user_input(self): Checks if method works properly.
Implement the Python class `test_MinNumberOfJumps` described below. Class description: Class with unittests for MinNumberOfJumps.py Method signatures and docstrings: - def setUp(self): Sets up input. - def test_user_input(self): Checks if method works properly. <|skeleton|> class test_MinNumberOfJumps: """Class ...
3aa62ad36c3b06b2a3b05f1f8e2a9e21d68b371f
<|skeleton|> class test_MinNumberOfJumps: """Class with unittests for MinNumberOfJumps.py""" def setUp(self): """Sets up input.""" <|body_0|> def test_user_input(self): """Checks if method works properly.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class test_MinNumberOfJumps: """Class with unittests for MinNumberOfJumps.py""" def setUp(self): """Sets up input.""" self.input_arr = [3, 4, 2, 1, 2, 3, 7, 1, 1, 1, 3] self.output = 4 return (self.input_arr, self.output) def test_user_input(self): """Checks if meth...
the_stack_v2_python_sparse
AlgoExpert_algorithms/Hard/MinNumberOfJumps/test_MinNumberOfJumps.py
JakubKazimierski/PythonPortfolio
train
9
584d61b0847c65baca43054c5189a65d7b5100d3
[ "self.path = path\nself.name = path.split('.')[-1]\nself.cls = None", "if not self.cls:\n self.cls = _istring(self.path)\nreturn self.cls()" ]
<|body_start_0|> self.path = path self.name = path.split('.')[-1] self.cls = None <|end_body_0|> <|body_start_1|> if not self.cls: self.cls = _istring(self.path) return self.cls() <|end_body_1|>
Handles lazily importing and instantiating a class.
_lazy
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _lazy: """Handles lazily importing and instantiating a class.""" def __init__(self, path): """Specify the path to the class to lazily import and instantiate.""" <|body_0|> def __call__(self): """Import the specified class and return a new instantiation of it.""" ...
stack_v2_sparse_classes_10k_train_003883
1,315
no_license
[ { "docstring": "Specify the path to the class to lazily import and instantiate.", "name": "__init__", "signature": "def __init__(self, path)" }, { "docstring": "Import the specified class and return a new instantiation of it.", "name": "__call__", "signature": "def __call__(self)" } ]
2
stack_v2_sparse_classes_30k_train_003226
Implement the Python class `_lazy` described below. Class description: Handles lazily importing and instantiating a class. Method signatures and docstrings: - def __init__(self, path): Specify the path to the class to lazily import and instantiate. - def __call__(self): Import the specified class and return a new ins...
Implement the Python class `_lazy` described below. Class description: Handles lazily importing and instantiating a class. Method signatures and docstrings: - def __init__(self, path): Specify the path to the class to lazily import and instantiate. - def __call__(self): Import the specified class and return a new ins...
40aeb38397041d042b7497c6090d75a03d751dd6
<|skeleton|> class _lazy: """Handles lazily importing and instantiating a class.""" def __init__(self, path): """Specify the path to the class to lazily import and instantiate.""" <|body_0|> def __call__(self): """Import the specified class and return a new instantiation of it.""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class _lazy: """Handles lazily importing and instantiating a class.""" def __init__(self, path): """Specify the path to the class to lazily import and instantiate.""" self.path = path self.name = path.split('.')[-1] self.cls = None def __call__(self): """Import the ...
the_stack_v2_python_sparse
lib/LazyControllerLoader.py
dound/CraigNotes
train
0
fa5ebecb56a13ae944e4edc225880237395e5342
[ "if isinstance(init, type(self)):\n self.elec = fields.electric(init.elec)\n self.magn = fields.magnetic(init.magn)\nelif isinstance(init, tuple) and (init[1] is None or isinstance(init[1], MPI.Intracomm)) and isinstance(init[2], np.dtype):\n if isinstance(val, int) or isinstance(val, float) or val is None...
<|body_start_0|> if isinstance(init, type(self)): self.elec = fields.electric(init.elec) self.magn = fields.magnetic(init.magn) elif isinstance(init, tuple) and (init[1] is None or isinstance(init[1], MPI.Intracomm)) and isinstance(init[2], np.dtype): if isinstance(va...
Field data type for 3 dimensions This data type can be used for electric and magnetic fields in 3 dimensions Attributes: elec: contains the electric field magn: contains the magnetic field
fields
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class fields: """Field data type for 3 dimensions This data type can be used for electric and magnetic fields in 3 dimensions Attributes: elec: contains the electric field magn: contains the magnetic field""" def __init__(self, init=None, val=None): """Initialization routine Args: init: ca...
stack_v2_sparse_classes_10k_train_003884
10,653
permissive
[ { "docstring": "Initialization routine Args: init: can either be a number or another fields object val: initial tuple of values for electric and magnetic (default: (None,None)) Raises: DataError: if init is none of the types above", "name": "__init__", "signature": "def __init__(self, init=None, val=Non...
4
stack_v2_sparse_classes_30k_train_006826
Implement the Python class `fields` described below. Class description: Field data type for 3 dimensions This data type can be used for electric and magnetic fields in 3 dimensions Attributes: elec: contains the electric field magn: contains the magnetic field Method signatures and docstrings: - def __init__(self, in...
Implement the Python class `fields` described below. Class description: Field data type for 3 dimensions This data type can be used for electric and magnetic fields in 3 dimensions Attributes: elec: contains the electric field magn: contains the magnetic field Method signatures and docstrings: - def __init__(self, in...
1a51834bedffd4472e344bed28f4d766614b1537
<|skeleton|> class fields: """Field data type for 3 dimensions This data type can be used for electric and magnetic fields in 3 dimensions Attributes: elec: contains the electric field magn: contains the magnetic field""" def __init__(self, init=None, val=None): """Initialization routine Args: init: ca...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class fields: """Field data type for 3 dimensions This data type can be used for electric and magnetic fields in 3 dimensions Attributes: elec: contains the electric field magn: contains the magnetic field""" def __init__(self, init=None, val=None): """Initialization routine Args: init: can either be a...
the_stack_v2_python_sparse
pySDC/implementations/datatype_classes/particles.py
Parallel-in-Time/pySDC
train
30
1451ccf5ff0951b9c8a222db4384a22ec0166fec
[ "self.pos_enc_type = pos_enc_type\nsuper(ConformerEncoderLayer, self).__init__()\nself.ffn1 = FeedForwardModule(embed_dim, ffn_embed_dim, dropout, dropout)\nself.self_attn_layer_norm = LayerNorm(embed_dim, export=False)\nself.self_attn_dropout = torch.nn.Dropout(dropout)\nif attn_type == 'espnet':\n if self.pos_...
<|body_start_0|> self.pos_enc_type = pos_enc_type super(ConformerEncoderLayer, self).__init__() self.ffn1 = FeedForwardModule(embed_dim, ffn_embed_dim, dropout, dropout) self.self_attn_layer_norm = LayerNorm(embed_dim, export=False) self.self_attn_dropout = torch.nn.Dropout(dropo...
Conformer block based on https://arxiv.org/abs/2005.08100. We currently don't support relative positional encoding in MHA
ConformerEncoderLayer
[ "LicenseRef-scancode-unknown-license-reference", "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-free-unknown", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConformerEncoderLayer: """Conformer block based on https://arxiv.org/abs/2005.08100. We currently don't support relative positional encoding in MHA""" def __init__(self, embed_dim, ffn_embed_dim, attention_heads, dropout, use_fp16, depthwise_conv_kernel_size=31, activation_fn='swish', attn_t...
stack_v2_sparse_classes_10k_train_003885
9,087
permissive
[ { "docstring": "Args: embed_dim: Input embedding dimension ffn_embed_dim: FFN layer dimension attention_heads: Number of attention heads in MHA dropout: dropout value depthwise_conv_kernel_size: Size of kernel in depthwise conv layer in convolution module activation_fn: Activation function name to use in convul...
2
null
Implement the Python class `ConformerEncoderLayer` described below. Class description: Conformer block based on https://arxiv.org/abs/2005.08100. We currently don't support relative positional encoding in MHA Method signatures and docstrings: - def __init__(self, embed_dim, ffn_embed_dim, attention_heads, dropout, us...
Implement the Python class `ConformerEncoderLayer` described below. Class description: Conformer block based on https://arxiv.org/abs/2005.08100. We currently don't support relative positional encoding in MHA Method signatures and docstrings: - def __init__(self, embed_dim, ffn_embed_dim, attention_heads, dropout, us...
b60c741f746877293bb85eed6806736fc8fa0ffd
<|skeleton|> class ConformerEncoderLayer: """Conformer block based on https://arxiv.org/abs/2005.08100. We currently don't support relative positional encoding in MHA""" def __init__(self, embed_dim, ffn_embed_dim, attention_heads, dropout, use_fp16, depthwise_conv_kernel_size=31, activation_fn='swish', attn_t...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ConformerEncoderLayer: """Conformer block based on https://arxiv.org/abs/2005.08100. We currently don't support relative positional encoding in MHA""" def __init__(self, embed_dim, ffn_embed_dim, attention_heads, dropout, use_fp16, depthwise_conv_kernel_size=31, activation_fn='swish', attn_type=None, pos...
the_stack_v2_python_sparse
kosmos-2/fairseq/fairseq/modules/conformer_layer.py
microsoft/unilm
train
15,313
c617f04672fad8564a6935c73a1c8b5bb90d4c4a
[ "logic = AssociationLogic(self.auth, sid)\nlogic.association = logic.get_association(aid)\nif self.VERSION:\n check_login(lambda x: True)(self)\n return Result(data=logic.get_config().version_dict, association_id=self.auth.get_association_id())\nlogic.account = logic.get_association_account(throw=True)\nretur...
<|body_start_0|> logic = AssociationLogic(self.auth, sid) logic.association = logic.get_association(aid) if self.VERSION: check_login(lambda x: True)(self) return Result(data=logic.get_config().version_dict, association_id=self.auth.get_association_id()) logic.acc...
AssociationInfoView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AssociationInfoView: def get(self, request, sid, aid): """获取协会信息 or 获取评优版本信息 :param request: :param sid: :param aid: :return:""" <|body_0|> def post(self, request, sid): """创建协会 :param request: :param sid: :return:""" <|body_1|> def put(self, request, si...
stack_v2_sparse_classes_10k_train_003886
7,404
no_license
[ { "docstring": "获取协会信息 or 获取评优版本信息 :param request: :param sid: :param aid: :return:", "name": "get", "signature": "def get(self, request, sid, aid)" }, { "docstring": "创建协会 :param request: :param sid: :return:", "name": "post", "signature": "def post(self, request, sid)" }, { "do...
4
stack_v2_sparse_classes_30k_train_005148
Implement the Python class `AssociationInfoView` described below. Class description: Implement the AssociationInfoView class. Method signatures and docstrings: - def get(self, request, sid, aid): 获取协会信息 or 获取评优版本信息 :param request: :param sid: :param aid: :return: - def post(self, request, sid): 创建协会 :param request: :...
Implement the Python class `AssociationInfoView` described below. Class description: Implement the AssociationInfoView class. Method signatures and docstrings: - def get(self, request, sid, aid): 获取协会信息 or 获取评优版本信息 :param request: :param sid: :param aid: :return: - def post(self, request, sid): 创建协会 :param request: :...
a0553be3c259712de1fe5517b06317ad5756f79d
<|skeleton|> class AssociationInfoView: def get(self, request, sid, aid): """获取协会信息 or 获取评优版本信息 :param request: :param sid: :param aid: :return:""" <|body_0|> def post(self, request, sid): """创建协会 :param request: :param sid: :return:""" <|body_1|> def put(self, request, si...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AssociationInfoView: def get(self, request, sid, aid): """获取协会信息 or 获取评优版本信息 :param request: :param sid: :param aid: :return:""" logic = AssociationLogic(self.auth, sid) logic.association = logic.get_association(aid) if self.VERSION: check_login(lambda x: True)(self...
the_stack_v2_python_sparse
LittlePigHoHo/server/association/views/info.py
shoogoome/hoho
train
1
a9703e3245d30c08a05f3034a267611f95e8f4ce
[ "self.have_context = True\nif not self._have_info:\n self.extensions = asstr(cast(gluGetString(GLU_EXTENSIONS), c_char_p).value).split()\n self.version = asstr(cast(gluGetString(GLU_VERSION), c_char_p).value)\n self._have_info = True", "if not self.have_context:\n warnings.warn('No GL context created ...
<|body_start_0|> self.have_context = True if not self._have_info: self.extensions = asstr(cast(gluGetString(GLU_EXTENSIONS), c_char_p).value).split() self.version = asstr(cast(gluGetString(GLU_VERSION), c_char_p).value) self._have_info = True <|end_body_0|> <|body_st...
Information interface for the GLU library. A default instance is created automatically when the first OpenGL context is created. You can use the module functions as a convenience for this default instance's methods. If you are using more than one context, you must call `set_active_context` when the context is active fo...
GLUInfo
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GLUInfo: """Information interface for the GLU library. A default instance is created automatically when the first OpenGL context is created. You can use the module functions as a convenience for this default instance's methods. If you are using more than one context, you must call `set_active_con...
stack_v2_sparse_classes_10k_train_003887
5,650
permissive
[ { "docstring": "Store information for the currently active context. This method is called automatically for the default context.", "name": "set_active_context", "signature": "def set_active_context(self)" }, { "docstring": "Determine if a version of GLU is supported. :Parameters: `major` : int T...
5
null
Implement the Python class `GLUInfo` described below. Class description: Information interface for the GLU library. A default instance is created automatically when the first OpenGL context is created. You can use the module functions as a convenience for this default instance's methods. If you are using more than one...
Implement the Python class `GLUInfo` described below. Class description: Information interface for the GLU library. A default instance is created automatically when the first OpenGL context is created. You can use the module functions as a convenience for this default instance's methods. If you are using more than one...
29f79c41cfb49ea5b1dd1bec559795727e868558
<|skeleton|> class GLUInfo: """Information interface for the GLU library. A default instance is created automatically when the first OpenGL context is created. You can use the module functions as a convenience for this default instance's methods. If you are using more than one context, you must call `set_active_con...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GLUInfo: """Information interface for the GLU library. A default instance is created automatically when the first OpenGL context is created. You can use the module functions as a convenience for this default instance's methods. If you are using more than one context, you must call `set_active_context` when th...
the_stack_v2_python_sparse
blimgui/dist/pyglet/gl/glu_info.py
juso40/bl2sdk_Mods
train
42
4f744ce10776d493d82f6b4da4a501624e2338c2
[ "missing = len(nums)\nfor i, n in enumerate(nums):\n missing ^= i ^ n\nreturn missing", "ans = len(nums) * (len(nums) + 1) // 2\nfor n in nums:\n ans -= n\nreturn ans" ]
<|body_start_0|> missing = len(nums) for i, n in enumerate(nums): missing ^= i ^ n return missing <|end_body_0|> <|body_start_1|> ans = len(nums) * (len(nums) + 1) // 2 for n in nums: ans -= n return ans <|end_body_1|>
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def missingNumber_MK1(self, nums: List[int]) -> int: """XOR. Time Complexity: O(n) Space Complexity: O(1)""" <|body_0|> def missingNumber_MK2(self, nums: List[int]) -> int: """Gauss' Formula""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_003888
529
no_license
[ { "docstring": "XOR. Time Complexity: O(n) Space Complexity: O(1)", "name": "missingNumber_MK1", "signature": "def missingNumber_MK1(self, nums: List[int]) -> int" }, { "docstring": "Gauss' Formula", "name": "missingNumber_MK2", "signature": "def missingNumber_MK2(self, nums: List[int]) ...
2
stack_v2_sparse_classes_30k_train_002508
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def missingNumber_MK1(self, nums: List[int]) -> int: XOR. Time Complexity: O(n) Space Complexity: O(1) - def missingNumber_MK2(self, nums: List[int]) -> int: Gauss' Formula
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def missingNumber_MK1(self, nums: List[int]) -> int: XOR. Time Complexity: O(n) Space Complexity: O(1) - def missingNumber_MK2(self, nums: List[int]) -> int: Gauss' Formula <|sk...
d7ba416d22becfa8f2a2ae4eee04c86617cd9332
<|skeleton|> class Solution: def missingNumber_MK1(self, nums: List[int]) -> int: """XOR. Time Complexity: O(n) Space Complexity: O(1)""" <|body_0|> def missingNumber_MK2(self, nums: List[int]) -> int: """Gauss' Formula""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def missingNumber_MK1(self, nums: List[int]) -> int: """XOR. Time Complexity: O(n) Space Complexity: O(1)""" missing = len(nums) for i, n in enumerate(nums): missing ^= i ^ n return missing def missingNumber_MK2(self, nums: List[int]) -> int: ...
the_stack_v2_python_sparse
0268. Missing Number/Solution.py
faterazer/LeetCode
train
4
df525bd38c608465b9fbf4899b120d90ed4cbcc5
[ "data = requests.get(url).text\nhtml = BeautifulSoup(data)\ntr = html.find_all('tr')\nhy = tr[0].find_all('td')[0].text.split('\\t')[0]\ntitle = [i.text for i in tr[1].find_all('td')]\ntitle = title[:2] + title[3:10]\ntitle.append('行业')\nres = []\nBM = {'B': 1000000000, 'M': 1000000}\nfor td in tr[2:-2]:\n td = ...
<|body_start_0|> data = requests.get(url).text html = BeautifulSoup(data) tr = html.find_all('tr') hy = tr[0].find_all('td')[0].text.split('\t')[0] title = [i.text for i in tr[1].find_all('td')] title = title[:2] + title[3:10] title.append('行业') res = [] ...
市值、货币、行业
BanKuai
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BanKuai: """市值、货币、行业""" def get_hyl(self, url): """以指定行业的URL获取其下所属的股票数据""" <|body_0|> def get_hys(self, url='http://www.etnet.com.hk/www/sc/stocks/industry_adu.php'): """获取所有的行业URL""" <|body_1|> def get_all(self): """获得所有数据""" <|body_...
stack_v2_sparse_classes_10k_train_003889
11,353
no_license
[ { "docstring": "以指定行业的URL获取其下所属的股票数据", "name": "get_hyl", "signature": "def get_hyl(self, url)" }, { "docstring": "获取所有的行业URL", "name": "get_hys", "signature": "def get_hys(self, url='http://www.etnet.com.hk/www/sc/stocks/industry_adu.php')" }, { "docstring": "获得所有数据", "name"...
3
stack_v2_sparse_classes_30k_train_006822
Implement the Python class `BanKuai` described below. Class description: 市值、货币、行业 Method signatures and docstrings: - def get_hyl(self, url): 以指定行业的URL获取其下所属的股票数据 - def get_hys(self, url='http://www.etnet.com.hk/www/sc/stocks/industry_adu.php'): 获取所有的行业URL - def get_all(self): 获得所有数据
Implement the Python class `BanKuai` described below. Class description: 市值、货币、行业 Method signatures and docstrings: - def get_hyl(self, url): 以指定行业的URL获取其下所属的股票数据 - def get_hys(self, url='http://www.etnet.com.hk/www/sc/stocks/industry_adu.php'): 获取所有的行业URL - def get_all(self): 获得所有数据 <|skeleton|> class BanKuai: ...
818ae04b6f2ca00495c73fd9b3810f083aa3339e
<|skeleton|> class BanKuai: """市值、货币、行业""" def get_hyl(self, url): """以指定行业的URL获取其下所属的股票数据""" <|body_0|> def get_hys(self, url='http://www.etnet.com.hk/www/sc/stocks/industry_adu.php'): """获取所有的行业URL""" <|body_1|> def get_all(self): """获得所有数据""" <|body_...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BanKuai: """市值、货币、行业""" def get_hyl(self, url): """以指定行业的URL获取其下所属的股票数据""" data = requests.get(url).text html = BeautifulSoup(data) tr = html.find_all('tr') hy = tr[0].find_all('td')[0].text.split('\t')[0] title = [i.text for i in tr[1].find_all('td')] ...
the_stack_v2_python_sparse
2019/港股回购数据获取/huigou_guben.py
hunaghaikong/CodeAll
train
0
4b2918b46709903a8fcf3c31e6cfc4ac220ec6ca
[ "ModbusBaseParser.__init__(self)\nself.logger = logging.getLogger(__name__)\nself.matcher = re.compile(self.ASCII_MSG_REGEX)\nself.remainder = ''", "msg = None\nr = self.matcher.match(b)\nif r:\n address = int(r.group(1), 16)\n function = int(r.group(2), 16)\n data = []\n for i in range(0, len(r.group...
<|body_start_0|> ModbusBaseParser.__init__(self) self.logger = logging.getLogger(__name__) self.matcher = re.compile(self.ASCII_MSG_REGEX) self.remainder = '' <|end_body_0|> <|body_start_1|> msg = None r = self.matcher.match(b) if r: address = int(r.g...
ModbusASCIIParser
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModbusASCIIParser: def __init__(self): """Construct a ModbusASCIIParser.""" <|body_0|> def _parse_msg(self, b): """Internal method, parses a single Modbus ASCII message frame, with the ' ' delimiter already removed.""" <|body_1|> def msgs_from_bytes(self...
stack_v2_sparse_classes_10k_train_003890
2,618
permissive
[ { "docstring": "Construct a ModbusASCIIParser.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Internal method, parses a single Modbus ASCII message frame, with the ' ' delimiter already removed.", "name": "_parse_msg", "signature": "def _parse_msg(self, b)" ...
3
stack_v2_sparse_classes_30k_train_004854
Implement the Python class `ModbusASCIIParser` described below. Class description: Implement the ModbusASCIIParser class. Method signatures and docstrings: - def __init__(self): Construct a ModbusASCIIParser. - def _parse_msg(self, b): Internal method, parses a single Modbus ASCII message frame, with the ' ' delimite...
Implement the Python class `ModbusASCIIParser` described below. Class description: Implement the ModbusASCIIParser class. Method signatures and docstrings: - def __init__(self): Construct a ModbusASCIIParser. - def _parse_msg(self, b): Internal method, parses a single Modbus ASCII message frame, with the ' ' delimite...
3fec5bf658c8a4af75fda66360f4f9cad01d8932
<|skeleton|> class ModbusASCIIParser: def __init__(self): """Construct a ModbusASCIIParser.""" <|body_0|> def _parse_msg(self, b): """Internal method, parses a single Modbus ASCII message frame, with the ' ' delimiter already removed.""" <|body_1|> def msgs_from_bytes(self...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ModbusASCIIParser: def __init__(self): """Construct a ModbusASCIIParser.""" ModbusBaseParser.__init__(self) self.logger = logging.getLogger(__name__) self.matcher = re.compile(self.ASCII_MSG_REGEX) self.remainder = '' def _parse_msg(self, b): """Internal me...
the_stack_v2_python_sparse
python/igsdk/modbus/asciiparser.py
LairdCP/igsdk
train
1
72de027ad380186edcd59b98e76f4f1eb3effbe9
[ "self.layers = layers\nself.feature_n = feature_n\nself.codeword_w = np.ones(feature_n + 2)\nself.codeword_w[0] = action_n\nfor i in range(self.feature_n):\n self.codeword_w[i + 1] = self.codeword_w[i] * layers", "scaled_floats = tuple((f * self.layers * self.layers for f in floats))\nfeatures = []\nfor layer ...
<|body_start_0|> self.layers = layers self.feature_n = feature_n self.codeword_w = np.ones(feature_n + 2) self.codeword_w[0] = action_n for i in range(self.feature_n): self.codeword_w[i + 1] = self.codeword_w[i] * layers <|end_body_0|> <|body_start_1|> scaled...
砖瓦编码
TileCoderMAT
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TileCoderMAT: """砖瓦编码""" def __init__(self, layers, feature_n, action_n): """layers 要用到几层砖瓦编码 features 砖瓦编码应该得到多少特征""" <|body_0|> def __call__(self, floats=(), ints=()): """将观测值向量转化为 坐标 floats 特征值 向量 即观测值映射从[下界,上界]到[0, 1]的映射 分位数 ints 动作 返回 features 不同层次的编码的位置1*fe...
stack_v2_sparse_classes_10k_train_003891
22,277
no_license
[ { "docstring": "layers 要用到几层砖瓦编码 features 砖瓦编码应该得到多少特征", "name": "__init__", "signature": "def __init__(self, layers, feature_n, action_n)" }, { "docstring": "将观测值向量转化为 坐标 floats 特征值 向量 即观测值映射从[下界,上界]到[0, 1]的映射 分位数 ints 动作 返回 features 不同层次的编码的位置1*feature_num的向量", "name": "__call__", "sig...
2
stack_v2_sparse_classes_30k_train_001105
Implement the Python class `TileCoderMAT` described below. Class description: 砖瓦编码 Method signatures and docstrings: - def __init__(self, layers, feature_n, action_n): layers 要用到几层砖瓦编码 features 砖瓦编码应该得到多少特征 - def __call__(self, floats=(), ints=()): 将观测值向量转化为 坐标 floats 特征值 向量 即观测值映射从[下界,上界]到[0, 1]的映射 分位数 ints 动作 返回 fe...
Implement the Python class `TileCoderMAT` described below. Class description: 砖瓦编码 Method signatures and docstrings: - def __init__(self, layers, feature_n, action_n): layers 要用到几层砖瓦编码 features 砖瓦编码应该得到多少特征 - def __call__(self, floats=(), ints=()): 将观测值向量转化为 坐标 floats 特征值 向量 即观测值映射从[下界,上界]到[0, 1]的映射 分位数 ints 动作 返回 fe...
e6526e9e38fcb5be91b46cb40715c15242198a0b
<|skeleton|> class TileCoderMAT: """砖瓦编码""" def __init__(self, layers, feature_n, action_n): """layers 要用到几层砖瓦编码 features 砖瓦编码应该得到多少特征""" <|body_0|> def __call__(self, floats=(), ints=()): """将观测值向量转化为 坐标 floats 特征值 向量 即观测值映射从[下界,上界]到[0, 1]的映射 分位数 ints 动作 返回 features 不同层次的编码的位置1*fe...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TileCoderMAT: """砖瓦编码""" def __init__(self, layers, feature_n, action_n): """layers 要用到几层砖瓦编码 features 砖瓦编码应该得到多少特征""" self.layers = layers self.feature_n = feature_n self.codeword_w = np.ones(feature_n + 2) self.codeword_w[0] = action_n for i in range(self...
the_stack_v2_python_sparse
mountain_car/function_approx.py
lwzswufe/gym_learning
train
0
63baf4ae34a81d2efa875f074c6dd316f07a7b3f
[ "n, result = (x ^ y, 0)\nwhile n:\n result += 1 if n & 1 else 0\n n = n >> 1\nreturn result", "n, result = (x ^ y, 0)\nwhile n:\n n = n & n - 1\n result += 1\nreturn result" ]
<|body_start_0|> n, result = (x ^ y, 0) while n: result += 1 if n & 1 else 0 n = n >> 1 return result <|end_body_0|> <|body_start_1|> n, result = (x ^ y, 0) while n: n = n & n - 1 result += 1 return result <|end_body_1|>
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def hammingDistance(self, x, y): """:type x: int :type y: int :rtype: int 移位实现计数 我们可以不断地检查 s 的最低位,如果最低位为 1,那么令计数器加一 然后我们令 s 整体右移一位这样 s 的最低位将被舍去,原本的次低位就变成了新的最低位。 我们重复这个过程直到 s=0 为止。这样计数器中就累计了 s 的二进制表示中 1 的数量。 时间击败95.89%,内存击败43.84%""" <|body_0|> def hammingDistance1(s...
stack_v2_sparse_classes_10k_train_003892
2,400
no_license
[ { "docstring": ":type x: int :type y: int :rtype: int 移位实现计数 我们可以不断地检查 s 的最低位,如果最低位为 1,那么令计数器加一 然后我们令 s 整体右移一位这样 s 的最低位将被舍去,原本的次低位就变成了新的最低位。 我们重复这个过程直到 s=0 为止。这样计数器中就累计了 s 的二进制表示中 1 的数量。 时间击败95.89%,内存击败43.84%", "name": "hammingDistance", "signature": "def hammingDistance(self, x, y)" }, { "docst...
2
stack_v2_sparse_classes_30k_train_003083
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hammingDistance(self, x, y): :type x: int :type y: int :rtype: int 移位实现计数 我们可以不断地检查 s 的最低位,如果最低位为 1,那么令计数器加一 然后我们令 s 整体右移一位这样 s 的最低位将被舍去,原本的次低位就变成了新的最低位。 我们重复这个过程直到 s=0 为止。这样...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hammingDistance(self, x, y): :type x: int :type y: int :rtype: int 移位实现计数 我们可以不断地检查 s 的最低位,如果最低位为 1,那么令计数器加一 然后我们令 s 整体右移一位这样 s 的最低位将被舍去,原本的次低位就变成了新的最低位。 我们重复这个过程直到 s=0 为止。这样...
2dc982e690b153c33bc7e27a63604f754a0df90c
<|skeleton|> class Solution: def hammingDistance(self, x, y): """:type x: int :type y: int :rtype: int 移位实现计数 我们可以不断地检查 s 的最低位,如果最低位为 1,那么令计数器加一 然后我们令 s 整体右移一位这样 s 的最低位将被舍去,原本的次低位就变成了新的最低位。 我们重复这个过程直到 s=0 为止。这样计数器中就累计了 s 的二进制表示中 1 的数量。 时间击败95.89%,内存击败43.84%""" <|body_0|> def hammingDistance1(s...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def hammingDistance(self, x, y): """:type x: int :type y: int :rtype: int 移位实现计数 我们可以不断地检查 s 的最低位,如果最低位为 1,那么令计数器加一 然后我们令 s 整体右移一位这样 s 的最低位将被舍去,原本的次低位就变成了新的最低位。 我们重复这个过程直到 s=0 为止。这样计数器中就累计了 s 的二进制表示中 1 的数量。 时间击败95.89%,内存击败43.84%""" n, result = (x ^ y, 0) while n: ...
the_stack_v2_python_sparse
461_hamming-distance.py
95275059/Algorithm
train
0
c33b5be39314f70677e6db819510013647a2d1be
[ "self._attr_name = name\nself.hemisphere = hemisphere\nself.type = season_tracking_type", "self._attr_native_value = get_season(utcnow().replace(tzinfo=None), self.hemisphere, self.type)\nself._attr_icon = 'mdi:cloud'\nif self._attr_native_value:\n self._attr_icon = SEASON_ICONS[self._attr_native_value]" ]
<|body_start_0|> self._attr_name = name self.hemisphere = hemisphere self.type = season_tracking_type <|end_body_0|> <|body_start_1|> self._attr_native_value = get_season(utcnow().replace(tzinfo=None), self.hemisphere, self.type) self._attr_icon = 'mdi:cloud' if self._at...
Representation of the current season.
Season
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Season: """Representation of the current season.""" def __init__(self, hemisphere: str, season_tracking_type: str, name: str) -> None: """Initialize the season.""" <|body_0|> def update(self) -> None: """Update season.""" <|body_1|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_10k_train_003893
4,050
permissive
[ { "docstring": "Initialize the season.", "name": "__init__", "signature": "def __init__(self, hemisphere: str, season_tracking_type: str, name: str) -> None" }, { "docstring": "Update season.", "name": "update", "signature": "def update(self) -> None" } ]
2
stack_v2_sparse_classes_30k_train_001744
Implement the Python class `Season` described below. Class description: Representation of the current season. Method signatures and docstrings: - def __init__(self, hemisphere: str, season_tracking_type: str, name: str) -> None: Initialize the season. - def update(self) -> None: Update season.
Implement the Python class `Season` described below. Class description: Representation of the current season. Method signatures and docstrings: - def __init__(self, hemisphere: str, season_tracking_type: str, name: str) -> None: Initialize the season. - def update(self) -> None: Update season. <|skeleton|> class Sea...
8f4ec89be6c2505d8a59eee44de335abe308ac9f
<|skeleton|> class Season: """Representation of the current season.""" def __init__(self, hemisphere: str, season_tracking_type: str, name: str) -> None: """Initialize the season.""" <|body_0|> def update(self) -> None: """Update season.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Season: """Representation of the current season.""" def __init__(self, hemisphere: str, season_tracking_type: str, name: str) -> None: """Initialize the season.""" self._attr_name = name self.hemisphere = hemisphere self.type = season_tracking_type def update(self) ->...
the_stack_v2_python_sparse
homeassistant/components/season/sensor.py
JeffLIrion/home-assistant
train
5
65bca06eda577b457a460d13822a338ab6cbfb62
[ "QProgressBar.__init__(self)\nself.setMinimum(0)\nself.parent = parent\nself.remaining_time_label = remaining_time_label", "self.current_thread = QThread.currentThread()\nself.setEnabled(True)\nif new_set_value != 0:\n self.setValue(new_set_value)\nif increment_value != 0:\n self.setValue(self.value() + inc...
<|body_start_0|> QProgressBar.__init__(self) self.setMinimum(0) self.parent = parent self.remaining_time_label = remaining_time_label <|end_body_0|> <|body_start_1|> self.current_thread = QThread.currentThread() self.setEnabled(True) if new_set_value != 0: ...
Class containing the progress bar of the current analysis
ProgressBar
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProgressBar: """Class containing the progress bar of the current analysis""" def __init__(self, remaining_time_label, parent=None): """Args: remaining_time_label: Associated analysis remaining time""" <|body_0|> def update_progress_bar(self, time_started, increment_value...
stack_v2_sparse_classes_10k_train_003894
49,308
no_license
[ { "docstring": "Args: remaining_time_label: Associated analysis remaining time", "name": "__init__", "signature": "def __init__(self, remaining_time_label, parent=None)" }, { "docstring": "Update the progress bar in the analysis widget and the corresponding remaining time Args: time_started (flo...
3
stack_v2_sparse_classes_30k_train_004856
Implement the Python class `ProgressBar` described below. Class description: Class containing the progress bar of the current analysis Method signatures and docstrings: - def __init__(self, remaining_time_label, parent=None): Args: remaining_time_label: Associated analysis remaining time - def update_progress_bar(sel...
Implement the Python class `ProgressBar` described below. Class description: Class containing the progress bar of the current analysis Method signatures and docstrings: - def __init__(self, remaining_time_label, parent=None): Args: remaining_time_label: Associated analysis remaining time - def update_progress_bar(sel...
75449d4f0f7ea92e4daf329b5d40820832b62de2
<|skeleton|> class ProgressBar: """Class containing the progress bar of the current analysis""" def __init__(self, remaining_time_label, parent=None): """Args: remaining_time_label: Associated analysis remaining time""" <|body_0|> def update_progress_bar(self, time_started, increment_value...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ProgressBar: """Class containing the progress bar of the current analysis""" def __init__(self, remaining_time_label, parent=None): """Args: remaining_time_label: Associated analysis remaining time""" QProgressBar.__init__(self) self.setMinimum(0) self.parent = parent ...
the_stack_v2_python_sparse
src/cicada/gui/cicada_analysis_parameters_gui.py
PaulUteza/cicada
train
0
9d8d308307823a5e580f7dccb5e5167e55fdf3d5
[ "super(BusyOverlay, self).__init__(parent, message=message)\nself.indicator = ftrack_connect.ui.widget.indicator.BusyIndicator()\nself.indicator.setFixedSize(85, 85)\nself.icon.hide()\nself.contentLayout.insertWidget(1, self.indicator, alignment=QtCore.Qt.AlignCenter)", "if visible:\n self.indicator.start()\ne...
<|body_start_0|> super(BusyOverlay, self).__init__(parent, message=message) self.indicator = ftrack_connect.ui.widget.indicator.BusyIndicator() self.indicator.setFixedSize(85, 85) self.icon.hide() self.contentLayout.insertWidget(1, self.indicator, alignment=QtCore.Qt.AlignCenter)...
Display a standard busy overlay over another widget.
BusyOverlay
[ "Apache-2.0", "MIT", "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BusyOverlay: """Display a standard busy overlay over another widget.""" def __init__(self, parent, message='Processing'): """Initialise with *parent* and busy *message*.""" <|body_0|> def setVisible(self, visible): """Set whether *visible* or not.""" <|bo...
stack_v2_sparse_classes_10k_train_003895
8,378
permissive
[ { "docstring": "Initialise with *parent* and busy *message*.", "name": "__init__", "signature": "def __init__(self, parent, message='Processing')" }, { "docstring": "Set whether *visible* or not.", "name": "setVisible", "signature": "def setVisible(self, visible)" } ]
2
stack_v2_sparse_classes_30k_train_005294
Implement the Python class `BusyOverlay` described below. Class description: Display a standard busy overlay over another widget. Method signatures and docstrings: - def __init__(self, parent, message='Processing'): Initialise with *parent* and busy *message*. - def setVisible(self, visible): Set whether *visible* or...
Implement the Python class `BusyOverlay` described below. Class description: Display a standard busy overlay over another widget. Method signatures and docstrings: - def __init__(self, parent, message='Processing'): Initialise with *parent* and busy *message*. - def setVisible(self, visible): Set whether *visible* or...
f55f52787484fcf931c4653e7e241791f052c04f
<|skeleton|> class BusyOverlay: """Display a standard busy overlay over another widget.""" def __init__(self, parent, message='Processing'): """Initialise with *parent* and busy *message*.""" <|body_0|> def setVisible(self, visible): """Set whether *visible* or not.""" <|bo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BusyOverlay: """Display a standard busy overlay over another widget.""" def __init__(self, parent, message='Processing'): """Initialise with *parent* and busy *message*.""" super(BusyOverlay, self).__init__(parent, message=message) self.indicator = ftrack_connect.ui.widget.indicat...
the_stack_v2_python_sparse
source/ftrack_connect/ui/widget/overlay.py
IngenuityEngine/ftrack-connect
train
0
6e3ff59d92de4fa810222be82c191aa56336529d
[ "charList = [chr(x) for x in xrange(97, 123)]\nvisited = set()\nvisited.add(beginWord)\nwordSet = set(wordList)\nq = Queue()\nq.put(beginWord)\nres = 1\nwhile not q.empty():\n for _ in xrange(q.qsize()):\n curr = q.get()\n if curr == endWord:\n return res\n for i in xrange(len(cur...
<|body_start_0|> charList = [chr(x) for x in xrange(97, 123)] visited = set() visited.add(beginWord) wordSet = set(wordList) q = Queue() q.put(beginWord) res = 1 while not q.empty(): for _ in xrange(q.qsize()): curr = q.get() ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def ladderLength(self, beginWord, endWord, wordList): """:type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int""" <|body_0|> def ladderLength(self, beginWord, endWord, wordList): """:type beginWord: str :type endWord: str :type wordL...
stack_v2_sparse_classes_10k_train_003896
2,961
no_license
[ { "docstring": ":type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int", "name": "ladderLength", "signature": "def ladderLength(self, beginWord, endWord, wordList)" }, { "docstring": ":type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int", "name...
2
stack_v2_sparse_classes_30k_train_005893
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def ladderLength(self, beginWord, endWord, wordList): :type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int - def ladderLength(self, beginWord, endWord, w...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def ladderLength(self, beginWord, endWord, wordList): :type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int - def ladderLength(self, beginWord, endWord, w...
14febbb5d8504438ef143678dedc89d4b61b07c9
<|skeleton|> class Solution: def ladderLength(self, beginWord, endWord, wordList): """:type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int""" <|body_0|> def ladderLength(self, beginWord, endWord, wordList): """:type beginWord: str :type endWord: str :type wordL...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def ladderLength(self, beginWord, endWord, wordList): """:type beginWord: str :type endWord: str :type wordList: List[str] :rtype: int""" charList = [chr(x) for x in xrange(97, 123)] visited = set() visited.add(beginWord) wordSet = set(wordList) q = Qu...
the_stack_v2_python_sparse
BFS/127. Word Ladder.py
roy355068/Algo
train
0
e35ec7abf6e7728b5d089da0380f237f9adfcb69
[ "message.CopyFrom(union_message)\nuser = data.user.get(True)\nunion = data.union.get(True)\nmessage.user.user.user_id = user.id\nmessage.user.user.name = user.get_readable_name()\nmessage.user.user.headicon_id = user.icon_id\nmessage.user.left_attack_count = union.battle_attack_count_left\nmessage.user.refresh_atta...
<|body_start_0|> message.CopyFrom(union_message) user = data.user.get(True) union = data.union.get(True) message.user.user.user_id = user.id message.user.user.name = user.get_readable_name() message.user.user.headicon_id = user.icon_id message.user.left_attack_cou...
填充联盟战争信息,可能包括敌对联盟信息
UnionBattlePatcher
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UnionBattlePatcher: """填充联盟战争信息,可能包括敌对联盟信息""" def patch(self, message, union_message, data, now): """填充联盟战争信息 Args: message[protobuf UnionBattleInfo]: 需要打包的联盟信息 union_message[protobuf UnionBattleInfo]: 己方联盟返回的战斗信息 data[UserData] now[int]: 时间戳""" <|body_0|> def _patch_riv...
stack_v2_sparse_classes_10k_train_003897
8,396
no_license
[ { "docstring": "填充联盟战争信息 Args: message[protobuf UnionBattleInfo]: 需要打包的联盟信息 union_message[protobuf UnionBattleInfo]: 己方联盟返回的战斗信息 data[UserData] now[int]: 时间戳", "name": "patch", "signature": "def patch(self, message, union_message, data, now)" }, { "docstring": "填充敌对联盟的战争信息", "name": "_patch_...
5
null
Implement the Python class `UnionBattlePatcher` described below. Class description: 填充联盟战争信息,可能包括敌对联盟信息 Method signatures and docstrings: - def patch(self, message, union_message, data, now): 填充联盟战争信息 Args: message[protobuf UnionBattleInfo]: 需要打包的联盟信息 union_message[protobuf UnionBattleInfo]: 己方联盟返回的战斗信息 data[UserData...
Implement the Python class `UnionBattlePatcher` described below. Class description: 填充联盟战争信息,可能包括敌对联盟信息 Method signatures and docstrings: - def patch(self, message, union_message, data, now): 填充联盟战争信息 Args: message[protobuf UnionBattleInfo]: 需要打包的联盟信息 union_message[protobuf UnionBattleInfo]: 己方联盟返回的战斗信息 data[UserData...
a16c872ba781855a8c891eff41e8e651cd565ebf
<|skeleton|> class UnionBattlePatcher: """填充联盟战争信息,可能包括敌对联盟信息""" def patch(self, message, union_message, data, now): """填充联盟战争信息 Args: message[protobuf UnionBattleInfo]: 需要打包的联盟信息 union_message[protobuf UnionBattleInfo]: 己方联盟返回的战斗信息 data[UserData] now[int]: 时间戳""" <|body_0|> def _patch_riv...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UnionBattlePatcher: """填充联盟战争信息,可能包括敌对联盟信息""" def patch(self, message, union_message, data, now): """填充联盟战争信息 Args: message[protobuf UnionBattleInfo]: 需要打包的联盟信息 union_message[protobuf UnionBattleInfo]: 己方联盟返回的战斗信息 data[UserData] now[int]: 时间戳""" message.CopyFrom(union_message) use...
the_stack_v2_python_sparse
app/union_patcher.py
daxingyou/test-2
train
0
2e314d5b6e8a356503455f0160e0f595f239d004
[ "self.check_dependencies()\nimport xesmf as xe\nself.grid_in = {'lat': lats, 'lon': lons}\nlons, lats = np.meshgrid(np.linspace(min_lon, max_lon, n_lons), np.linspace(min_lat, max_lat, n_lats))\nself.grid_out = {'lat': lats, 'lon': lons}\nself.new_lat_lon = np.zeros((*lats.shape, 2))\nself.new_lat_lon[..., 0] = lat...
<|body_start_0|> self.check_dependencies() import xesmf as xe self.grid_in = {'lat': lats, 'lon': lons} lons, lats = np.meshgrid(np.linspace(min_lon, max_lon, n_lons), np.linspace(min_lat, max_lat, n_lats)) self.grid_out = {'lat': lats, 'lon': lons} self.new_lat_lon = np....
Regridder class for stitching domains
Regridder
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Regridder: """Regridder class for stitching domains""" def __init__(self, lats, lons, min_lat, max_lat, min_lon, max_lon, n_lats, n_lons): """Parameters ---------- lats : ndarray Array of latitudes for input grid lons : ndarray Array of longitudes for input grid min_lat : float Minim...
stack_v2_sparse_classes_10k_train_003898
15,917
permissive
[ { "docstring": "Parameters ---------- lats : ndarray Array of latitudes for input grid lons : ndarray Array of longitudes for input grid min_lat : float Minimum lat for output grid max_lat : float Maximum lat for output grid min_lon : float Minimum lon for output grid max_lon : float Maximum lon for output grid...
3
stack_v2_sparse_classes_30k_train_002829
Implement the Python class `Regridder` described below. Class description: Regridder class for stitching domains Method signatures and docstrings: - def __init__(self, lats, lons, min_lat, max_lat, min_lon, max_lon, n_lats, n_lons): Parameters ---------- lats : ndarray Array of latitudes for input grid lons : ndarray...
Implement the Python class `Regridder` described below. Class description: Regridder class for stitching domains Method signatures and docstrings: - def __init__(self, lats, lons, min_lat, max_lat, min_lon, max_lon, n_lats, n_lons): Parameters ---------- lats : ndarray Array of latitudes for input grid lons : ndarray...
f3803a823c7bb0afd7ab6064625908dca0be3476
<|skeleton|> class Regridder: """Regridder class for stitching domains""" def __init__(self, lats, lons, min_lat, max_lat, min_lon, max_lon, n_lats, n_lons): """Parameters ---------- lats : ndarray Array of latitudes for input grid lons : ndarray Array of longitudes for input grid min_lat : float Minim...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Regridder: """Regridder class for stitching domains""" def __init__(self, lats, lons, min_lat, max_lat, min_lon, max_lon, n_lats, n_lons): """Parameters ---------- lats : ndarray Array of latitudes for input grid lons : ndarray Array of longitudes for input grid min_lat : float Minimum lat for ou...
the_stack_v2_python_sparse
sup3r/utilities/stitching.py
NREL/sup3r
train
20
47bf3fdd9d8cafef8d71a5ae66f1061ae59e707a
[ "super().__init__(**attrs)\nself.value = value\nself.padding = padding\nself.width = real_length(value) + self.padding", "value_style = self.get_style('value')\nlines = break_line(value_style(self.padding * ' ' + self.value), self.width)\nreturn list(lines) or ['']" ]
<|body_start_0|> super().__init__(**attrs) self.value = value self.padding = padding self.width = real_length(value) + self.padding <|end_body_0|> <|body_start_1|> value_style = self.get_style('value') lines = break_line(value_style(self.padding * ' ' + self.value), self...
Unselectable text object
Label
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Label: """Unselectable text object""" def __init__(self, value: str='', padding: int=0, **attrs: Any) -> None: """Set up object""" <|body_0|> def get_lines(self) -> list[str]: """Get lines of object""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_003899
29,898
no_license
[ { "docstring": "Set up object", "name": "__init__", "signature": "def __init__(self, value: str='', padding: int=0, **attrs: Any) -> None" }, { "docstring": "Get lines of object", "name": "get_lines", "signature": "def get_lines(self) -> list[str]" } ]
2
stack_v2_sparse_classes_30k_train_003659
Implement the Python class `Label` described below. Class description: Unselectable text object Method signatures and docstrings: - def __init__(self, value: str='', padding: int=0, **attrs: Any) -> None: Set up object - def get_lines(self) -> list[str]: Get lines of object
Implement the Python class `Label` described below. Class description: Unselectable text object Method signatures and docstrings: - def __init__(self, value: str='', padding: int=0, **attrs: Any) -> None: Set up object - def get_lines(self) -> list[str]: Get lines of object <|skeleton|> class Label: """Unselecta...
05ddaf41fd8de11c7300a8ba125eddf9e1ee1131
<|skeleton|> class Label: """Unselectable text object""" def __init__(self, value: str='', padding: int=0, **attrs: Any) -> None: """Set up object""" <|body_0|> def get_lines(self) -> list[str]: """Get lines of object""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Label: """Unselectable text object""" def __init__(self, value: str='', padding: int=0, **attrs: Any) -> None: """Set up object""" super().__init__(**attrs) self.value = value self.padding = padding self.width = real_length(value) + self.padding def get_lines(...
the_stack_v2_python_sparse
pytermgui/widgets/base.py
ekapujiw2002/pytermgui
train
0