blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
24279632f980c7ee174612d490f01a5ec4b5317f
[ "self.c = capacity\nself.q = deque()\nself.d = {}", "if key not in self.d:\n return -1\nself.q.remove(key)\nself.q.append(key)\nreturn self.d[key]", "if key in self.q:\n self.q.remove(key)\n self.q.append(key)\n self.d[key] = value\nelse:\n if len(self.q) == self.c:\n ql = self.q.popleft()...
<|body_start_0|> self.c = capacity self.q = deque() self.d = {} <|end_body_0|> <|body_start_1|> if key not in self.d: return -1 self.q.remove(key) self.q.append(key) return self.d[key] <|end_body_1|> <|body_start_2|> if key in self.q: ...
LRUCache1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache1: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_...
stack_v2_sparse_classes_36k_train_016300
2,031
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: void", "name": "pu...
3
stack_v2_sparse_classes_30k_train_009456
Implement the Python class `LRUCache1` described below. Class description: Implement the LRUCache1 class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void
Implement the Python class `LRUCache1` described below. Class description: Implement the LRUCache1 class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void <|...
28d47c9488d47921769f40383ea9ffe2c56f3597
<|skeleton|> class LRUCache1: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LRUCache1: def __init__(self, capacity): """:type capacity: int""" self.c = capacity self.q = deque() self.d = {} def get(self, key): """:type key: int :rtype: int""" if key not in self.d: return -1 self.q.remove(key) self.q.appe...
the_stack_v2_python_sparse
146. LRU Cache.py
liangliannie/LeetCode
train
0
3e3ecd5339ce3e3cc9d3d282129d02238c83a655
[ "num.sort()\nresset = set()\nfor i in range(len(num) - 2):\n if i > 0 and num[i] == num[i - 1]:\n continue\n j = i + 1\n k = len(num) - 1\n while j < k:\n x = num[i] + num[j] + num[k]\n if x == 0:\n resset.add((num[i], num[j], num[k]))\n j += 1\n k -...
<|body_start_0|> num.sort() resset = set() for i in range(len(num) - 2): if i > 0 and num[i] == num[i - 1]: continue j = i + 1 k = len(num) - 1 while j < k: x = num[i] + num[j] + num[k] if x == 0: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def threeSum(self, num): """Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero. Note: Elements in a triplet (a,b,c) must be in non-descending order. (ie, a ≤ b ≤ c) The solut...
stack_v2_sparse_classes_36k_train_016301
2,612
no_license
[ { "docstring": "Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero. Note: Elements in a triplet (a,b,c) must be in non-descending order. (ie, a ≤ b ≤ c) The solution set must not contain duplicate triplets. F...
2
stack_v2_sparse_classes_30k_val_000601
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeSum(self, num): Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zer...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeSum(self, num): Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zer...
d16e4724ee34a0046cb2a8b0b13139b43d284e83
<|skeleton|> class Solution: def threeSum(self, num): """Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero. Note: Elements in a triplet (a,b,c) must be in non-descending order. (ie, a ≤ b ≤ c) The solut...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def threeSum(self, num): """Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero. Note: Elements in a triplet (a,b,c) must be in non-descending order. (ie, a ≤ b ≤ c) The solution set must n...
the_stack_v2_python_sparse
3Sum.py
KnightChan/LeetCode-Python
train
0
b499d5e8a2652421b29cb9f7300f2d6ea3d47aee
[ "if len(prices) <= 1:\n return 0\nbuy_min = prices[0]\nmax_profit = 0\nfor i in range(len(prices)):\n buy_min = min(buy_min, prices[i])\n max_profit = max(max_profit, prices[i] - buy_min)\nreturn max_profit", "if len(prices) <= 1:\n return 0\nmax_profit = 0\nbuy_in = prices[0]\nfor i in range(len(pric...
<|body_start_0|> if len(prices) <= 1: return 0 buy_min = prices[0] max_profit = 0 for i in range(len(prices)): buy_min = min(buy_min, prices[i]) max_profit = max(max_profit, prices[i] - buy_min) return max_profit <|end_body_0|> <|body_start_1|...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def max_profit(prices): """leetcode121 买卖股票的最佳时机 给定一个数组,它的第 i 个元素是一支给定股票第 i 天的价格。 如果你最多只允许完成一笔交易(即买入和卖出一支股票),设计一个算法来计算你所能获取的最大利润。 链接:https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock :solution 使用动态规划算法求解 :param prices: 最近几天的股票的价格 int数组 :return: 返回最大利润""" ...
stack_v2_sparse_classes_36k_train_016302
4,646
no_license
[ { "docstring": "leetcode121 买卖股票的最佳时机 给定一个数组,它的第 i 个元素是一支给定股票第 i 天的价格。 如果你最多只允许完成一笔交易(即买入和卖出一支股票),设计一个算法来计算你所能获取的最大利润。 链接:https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock :solution 使用动态规划算法求解 :param prices: 最近几天的股票的价格 int数组 :return: 返回最大利润", "name": "max_profit", "signature": "def max_pr...
5
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def max_profit(prices): leetcode121 买卖股票的最佳时机 给定一个数组,它的第 i 个元素是一支给定股票第 i 天的价格。 如果你最多只允许完成一笔交易(即买入和卖出一支股票),设计一个算法来计算你所能获取的最大利润。 链接:https://leetcode-cn.com/problems/best-time-to-bu...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def max_profit(prices): leetcode121 买卖股票的最佳时机 给定一个数组,它的第 i 个元素是一支给定股票第 i 天的价格。 如果你最多只允许完成一笔交易(即买入和卖出一支股票),设计一个算法来计算你所能获取的最大利润。 链接:https://leetcode-cn.com/problems/best-time-to-bu...
6479c0ad862a18d1021f35493e5e7d18d1ced5e4
<|skeleton|> class Solution: def max_profit(prices): """leetcode121 买卖股票的最佳时机 给定一个数组,它的第 i 个元素是一支给定股票第 i 天的价格。 如果你最多只允许完成一笔交易(即买入和卖出一支股票),设计一个算法来计算你所能获取的最大利润。 链接:https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock :solution 使用动态规划算法求解 :param prices: 最近几天的股票的价格 int数组 :return: 返回最大利润""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def max_profit(prices): """leetcode121 买卖股票的最佳时机 给定一个数组,它的第 i 个元素是一支给定股票第 i 天的价格。 如果你最多只允许完成一笔交易(即买入和卖出一支股票),设计一个算法来计算你所能获取的最大利润。 链接:https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock :solution 使用动态规划算法求解 :param prices: 最近几天的股票的价格 int数组 :return: 返回最大利润""" if len(prices)...
the_stack_v2_python_sparse
dp/max_profit.py
Batman001/leetcode_in_python
train
3
cf7c6084c41c8f0b7910a3ec6fc980d787f3b1a5
[ "if head is None:\n return False\ntry:\n cur1 = head\n cur2 = head.next\n while cur1 is not None and cur2 is not None:\n if cur1 == cur2:\n return True\n cur1 = cur1.next\n cur2 = cur2.next.next\n return False\nexcept Exception:\n return False", "if head is None o...
<|body_start_0|> if head is None: return False try: cur1 = head cur2 = head.next while cur1 is not None and cur2 is not None: if cur1 == cur2: return True cur1 = cur1.next cur2 = cur2.next...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def hasCycle(self, head): """:type head: ListNode :rtype: bool""" <|body_0|> def hasCycle2(self, head): """:type head: ListNode :rtype: bool""" <|body_1|> def hasCycle3(self, head): """我们可以通过检查一个结点此前是否被访问过来判断链表是否为环形链表。常用的方法是使用哈希表。 :type...
stack_v2_sparse_classes_36k_train_016303
2,439
no_license
[ { "docstring": ":type head: ListNode :rtype: bool", "name": "hasCycle", "signature": "def hasCycle(self, head)" }, { "docstring": ":type head: ListNode :rtype: bool", "name": "hasCycle2", "signature": "def hasCycle2(self, head)" }, { "docstring": "我们可以通过检查一个结点此前是否被访问过来判断链表是否为环形链表...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasCycle(self, head): :type head: ListNode :rtype: bool - def hasCycle2(self, head): :type head: ListNode :rtype: bool - def hasCycle3(self, head): 我们可以通过检查一个结点此前是否被访问过来判断链表是...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasCycle(self, head): :type head: ListNode :rtype: bool - def hasCycle2(self, head): :type head: ListNode :rtype: bool - def hasCycle3(self, head): 我们可以通过检查一个结点此前是否被访问过来判断链表是...
3b13b36f37eb364410b3b5b4f10a1808d8b1111e
<|skeleton|> class Solution: def hasCycle(self, head): """:type head: ListNode :rtype: bool""" <|body_0|> def hasCycle2(self, head): """:type head: ListNode :rtype: bool""" <|body_1|> def hasCycle3(self, head): """我们可以通过检查一个结点此前是否被访问过来判断链表是否为环形链表。常用的方法是使用哈希表。 :type...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def hasCycle(self, head): """:type head: ListNode :rtype: bool""" if head is None: return False try: cur1 = head cur2 = head.next while cur1 is not None and cur2 is not None: if cur1 == cur2: ...
the_stack_v2_python_sparse
leetcode/141.py
yanggelinux/algorithm-data-structure
train
0
6814973a993f94bccc736713901012cc7aa48974
[ "tree_list = []\n\ndef _serialize(node):\n if not node:\n tree_list.append('#')\n return\n tree_list.append(node.val)\n _serialize(node.left)\n _serialize(node.right)\n_serialize(root)\nreturn ','.join(map(str, tree_list))", "tree_list = data.split(',')\nitr = iter(tree_list)\n\ndef _des...
<|body_start_0|> tree_list = [] def _serialize(node): if not node: tree_list.append('#') return tree_list.append(node.val) _serialize(node.left) _serialize(node.right) _serialize(root) return ','.join(map(st...
Codec
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_016304
1,765
permissive
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
f38b598a925ea1c701d44b276749b8254a44974f
<|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_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" tree_list = [] def _serialize(node): if not node: tree_list.append('#') return tree_list.append(node.val) _se...
the_stack_v2_python_sparse
python/serialize_and_deserialize_bst.py
soumasish/leetcodely
train
10
84d8ab8c591e7857b354c1e6679af855269def17
[ "config = ''\nconfig += f'{Constants.REMOTE_FW_DIR}/'\nconfig += f'{Constants.RESOURCES_TPL_TELEMETRY}/'\nconfig += f'{profile}'\ncd_cmd = ''\ncd_cmd += f'sh -c \"cd {Constants.REMOTE_FW_DIR}/'\ncd_cmd += f'{Constants.RESOURCES_TOOLS}'\nif spath:\n bin_cmd = f'python3 -m telemetry --config {config} --hook {spath...
<|body_start_0|> config = '' config += f'{Constants.REMOTE_FW_DIR}/' config += f'{Constants.RESOURCES_TPL_TELEMETRY}/' config += f'{profile}' cd_cmd = '' cd_cmd += f'sh -c "cd {Constants.REMOTE_FW_DIR}/' cd_cmd += f'{Constants.RESOURCES_TOOLS}' if spath: ...
Class contains methods for telemetry utility.
TelemetryUtil
[ "GPL-1.0-or-later", "CC-BY-4.0", "Apache-2.0", "LicenseRef-scancode-dco-1.1" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TelemetryUtil: """Class contains methods for telemetry utility.""" def _run_telemetry(node, profile, sid=None, spath=None, rate='', export=False): """Get telemetry read on node. :param node: Node in the topology. :param profile: Telemetry configuration profile. :param sid: Socket ID ...
stack_v2_sparse_classes_36k_train_016305
3,724
permissive
[ { "docstring": "Get telemetry read on node. :param node: Node in the topology. :param profile: Telemetry configuration profile. :param sid: Socket ID used to describe recipient side of socket. :param spath: Socket path. :param rate: Telemetry load, unique within the test (optional). :param export: If false, do ...
2
null
Implement the Python class `TelemetryUtil` described below. Class description: Class contains methods for telemetry utility. Method signatures and docstrings: - def _run_telemetry(node, profile, sid=None, spath=None, rate='', export=False): Get telemetry read on node. :param node: Node in the topology. :param profile...
Implement the Python class `TelemetryUtil` described below. Class description: Class contains methods for telemetry utility. Method signatures and docstrings: - def _run_telemetry(node, profile, sid=None, spath=None, rate='', export=False): Get telemetry read on node. :param node: Node in the topology. :param profile...
947057d7310cd1602119258c6b82fbb25fe1b79d
<|skeleton|> class TelemetryUtil: """Class contains methods for telemetry utility.""" def _run_telemetry(node, profile, sid=None, spath=None, rate='', export=False): """Get telemetry read on node. :param node: Node in the topology. :param profile: Telemetry configuration profile. :param sid: Socket ID ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TelemetryUtil: """Class contains methods for telemetry utility.""" def _run_telemetry(node, profile, sid=None, spath=None, rate='', export=False): """Get telemetry read on node. :param node: Node in the topology. :param profile: Telemetry configuration profile. :param sid: Socket ID used to descr...
the_stack_v2_python_sparse
resources/libraries/python/TelemetryUtil.py
FDio/csit
train
28
0f4405a277d36b2d0af2825b411b9cdbb7a04a86
[ "super(GafferSceneTask, self).__init__(*args, **kwargs)\nself.setMetadata('wrapper.name', 'gaffer')\nself.setMetadata('wrapper.options', {})\nself.setMetadata('dispatch.split', True)", "import Gaffer\nimport GafferDispatch\ncrawlers = self.crawlers()\nscript = Gaffer.ScriptNode()\nscript['fileName'].setValue(self...
<|body_start_0|> super(GafferSceneTask, self).__init__(*args, **kwargs) self.setMetadata('wrapper.name', 'gaffer') self.setMetadata('wrapper.options', {}) self.setMetadata('dispatch.split', True) <|end_body_0|> <|body_start_1|> import Gaffer import GafferDispatch ...
Executes a gaffer scene by triggering the task nodes. Required options: scene (full path of gaffer scene) All options defined in the task are resolved (in case the value contains a template string) then assigned to gaffer's context. Therefore, you can use it to provide custom data to gaffer. Since the task options are ...
GafferSceneTask
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GafferSceneTask: """Executes a gaffer scene by triggering the task nodes. Required options: scene (full path of gaffer scene) All options defined in the task are resolved (in case the value contains a template string) then assigned to gaffer's context. Therefore, you can use it to provide custom ...
stack_v2_sparse_classes_36k_train_016306
3,016
permissive
[ { "docstring": "Create a gaffer template task.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Perform the task.", "name": "_perform", "signature": "def _perform(self)" } ]
2
null
Implement the Python class `GafferSceneTask` described below. Class description: Executes a gaffer scene by triggering the task nodes. Required options: scene (full path of gaffer scene) All options defined in the task are resolved (in case the value contains a template string) then assigned to gaffer's context. There...
Implement the Python class `GafferSceneTask` described below. Class description: Executes a gaffer scene by triggering the task nodes. Required options: scene (full path of gaffer scene) All options defined in the task are resolved (in case the value contains a template string) then assigned to gaffer's context. There...
046dbb0c1b4ff20ea5f2e1679f8d89f3089b6aa4
<|skeleton|> class GafferSceneTask: """Executes a gaffer scene by triggering the task nodes. Required options: scene (full path of gaffer scene) All options defined in the task are resolved (in case the value contains a template string) then assigned to gaffer's context. Therefore, you can use it to provide custom ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GafferSceneTask: """Executes a gaffer scene by triggering the task nodes. Required options: scene (full path of gaffer scene) All options defined in the task are resolved (in case the value contains a template string) then assigned to gaffer's context. Therefore, you can use it to provide custom data to gaffe...
the_stack_v2_python_sparse
src/lib/kombi/Task/ImageSequence/GafferSceneTask.py
kombiHQ/kombi
train
2
9e35f489744ead8f7f7534f38a51623ebdc2883b
[ "self.from_city = kwargs['from_city']\nself.from_stop = kwargs['from_stop'] if kwargs['from_stop'] not in ['__ANY__', 'none'] else None\nself.to_city = kwargs['to_city']\nself.to_stop = kwargs['to_stop'] if kwargs['to_stop'] not in ['__ANY__', 'none'] else None\nself.vehicle = kwargs['vehicle'] if kwargs['vehicle']...
<|body_start_0|> self.from_city = kwargs['from_city'] self.from_stop = kwargs['from_stop'] if kwargs['from_stop'] not in ['__ANY__', 'none'] else None self.to_city = kwargs['to_city'] self.to_stop = kwargs['to_stop'] if kwargs['to_stop'] not in ['__ANY__', 'none'] else None self....
Holder for starting and ending point (and other parameters) of travel.
Travel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Travel: """Holder for starting and ending point (and other parameters) of travel.""" def __init__(self, **kwargs): """Initializing (just filling in data). Accepted keys: from_city, from_stop, to_city, to_stop, vehicle, max_transfers.""" <|body_0|> def get_minimal_info(se...
stack_v2_sparse_classes_36k_train_016307
30,338
permissive
[ { "docstring": "Initializing (just filling in data). Accepted keys: from_city, from_stop, to_city, to_stop, vehicle, max_transfers.", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "Return minimal waypoints information in the form of a stringified inform() dial...
2
stack_v2_sparse_classes_30k_train_021202
Implement the Python class `Travel` described below. Class description: Holder for starting and ending point (and other parameters) of travel. Method signatures and docstrings: - def __init__(self, **kwargs): Initializing (just filling in data). Accepted keys: from_city, from_stop, to_city, to_stop, vehicle, max_tran...
Implement the Python class `Travel` described below. Class description: Holder for starting and ending point (and other parameters) of travel. Method signatures and docstrings: - def __init__(self, **kwargs): Initializing (just filling in data). Accepted keys: from_city, from_stop, to_city, to_stop, vehicle, max_tran...
e8fdc6f2d908d7a1911b18f29c218ae58d19ed6f
<|skeleton|> class Travel: """Holder for starting and ending point (and other parameters) of travel.""" def __init__(self, **kwargs): """Initializing (just filling in data). Accepted keys: from_city, from_stop, to_city, to_stop, vehicle, max_transfers.""" <|body_0|> def get_minimal_info(se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Travel: """Holder for starting and ending point (and other parameters) of travel.""" def __init__(self, **kwargs): """Initializing (just filling in data). Accepted keys: from_city, from_stop, to_city, to_stop, vehicle, max_transfers.""" self.from_city = kwargs['from_city'] self.fr...
the_stack_v2_python_sparse
alex/applications/PublicTransportInfoCS/directions.py
beka-evature/alex
train
1
e44eaa63dfe5a6f52ff394f9e6f7417023ddd4f5
[ "sll = ListNode(1)\nsll.next = ListNode(2)\nsll.next.next = ListNode(3)\nsll.next.next.next = ListNode(4)\nresult = has_cycle(sll)\nself.assertFalse(result)", "sll = ListNode(1)\nsll.next = ListNode(2)\nsll.next.next = ListNode(3)\nsll.next.next.next = ListNode(4)\nsll.next.next.next.next = sll.next\nresult = has...
<|body_start_0|> sll = ListNode(1) sll.next = ListNode(2) sll.next.next = ListNode(3) sll.next.next.next = ListNode(4) result = has_cycle(sll) self.assertFalse(result) <|end_body_0|> <|body_start_1|> sll = ListNode(1) sll.next = ListNode(2) sll.ne...
TestHasCycle
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestHasCycle: def test_returns_false_for_no_cycle(self): """Takes in a SLL and returns False if no cycle""" <|body_0|> def test_returns_true_for_cycle(self): """Takes in a SLL and returns True if cycle""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_016308
824
permissive
[ { "docstring": "Takes in a SLL and returns False if no cycle", "name": "test_returns_false_for_no_cycle", "signature": "def test_returns_false_for_no_cycle(self)" }, { "docstring": "Takes in a SLL and returns True if cycle", "name": "test_returns_true_for_cycle", "signature": "def test_r...
2
null
Implement the Python class `TestHasCycle` described below. Class description: Implement the TestHasCycle class. Method signatures and docstrings: - def test_returns_false_for_no_cycle(self): Takes in a SLL and returns False if no cycle - def test_returns_true_for_cycle(self): Takes in a SLL and returns True if cycle
Implement the Python class `TestHasCycle` described below. Class description: Implement the TestHasCycle class. Method signatures and docstrings: - def test_returns_false_for_no_cycle(self): Takes in a SLL and returns False if no cycle - def test_returns_true_for_cycle(self): Takes in a SLL and returns True if cycle ...
27ffb6b32d6d18d279c51cfa45bf305a409be5c2
<|skeleton|> class TestHasCycle: def test_returns_false_for_no_cycle(self): """Takes in a SLL and returns False if no cycle""" <|body_0|> def test_returns_true_for_cycle(self): """Takes in a SLL and returns True if cycle""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestHasCycle: def test_returns_false_for_no_cycle(self): """Takes in a SLL and returns False if no cycle""" sll = ListNode(1) sll.next = ListNode(2) sll.next.next = ListNode(3) sll.next.next.next = ListNode(4) result = has_cycle(sll) self.assertFalse(res...
the_stack_v2_python_sparse
src/leetcode/easy/linked-list-cycle/test_linked_list.py
nwthomas/code-challenges
train
2
a619e369f1087ed168ca034d4829f2bab26b187c
[ "self.BATCH_SIZE = self.IMAGES_PER_GPU * self.GPU_COUNT\nif self.IMAGE_RESIZE_MODE == 'crop':\n self.IMAGE_SHAPE = np.array([self.IMAGE_MIN_DIM, self.IMAGE_MIN_DIM, self.IMAGE_CHANNEL_COUNT])\nelse:\n self.IMAGE_SHAPE = np.array([self.IMAGE_MAX_DIM, self.IMAGE_MAX_DIM, self.IMAGE_CHANNEL_COUNT])\nself.IMAGE_M...
<|body_start_0|> self.BATCH_SIZE = self.IMAGES_PER_GPU * self.GPU_COUNT if self.IMAGE_RESIZE_MODE == 'crop': self.IMAGE_SHAPE = np.array([self.IMAGE_MIN_DIM, self.IMAGE_MIN_DIM, self.IMAGE_CHANNEL_COUNT]) else: self.IMAGE_SHAPE = np.array([self.IMAGE_MAX_DIM, self.IMAGE_M...
Base configuration class. For custom configurations, create a sub-class that inherits from this one and override properties that need to be changed.
Config
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Config: """Base configuration class. For custom configurations, create a sub-class that inherits from this one and override properties that need to be changed.""" def __init__(self): """Set values of computed attributes.""" <|body_0|> def display(self): """Displa...
stack_v2_sparse_classes_36k_train_016309
42,099
permissive
[ { "docstring": "Set values of computed attributes.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Display Configuration values.", "name": "display", "signature": "def display(self)" } ]
2
stack_v2_sparse_classes_30k_val_000958
Implement the Python class `Config` described below. Class description: Base configuration class. For custom configurations, create a sub-class that inherits from this one and override properties that need to be changed. Method signatures and docstrings: - def __init__(self): Set values of computed attributes. - def ...
Implement the Python class `Config` described below. Class description: Base configuration class. For custom configurations, create a sub-class that inherits from this one and override properties that need to be changed. Method signatures and docstrings: - def __init__(self): Set values of computed attributes. - def ...
838a40fe812fc16c5387dc7f2b8afca4957e7d56
<|skeleton|> class Config: """Base configuration class. For custom configurations, create a sub-class that inherits from this one and override properties that need to be changed.""" def __init__(self): """Set values of computed attributes.""" <|body_0|> def display(self): """Displa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Config: """Base configuration class. For custom configurations, create a sub-class that inherits from this one and override properties that need to be changed.""" def __init__(self): """Set values of computed attributes.""" self.BATCH_SIZE = self.IMAGES_PER_GPU * self.GPU_COUNT if...
the_stack_v2_python_sparse
ai/web_client_mrcnn.py
joey5678/flask-restplus-server-example
train
0
fc2aeabca5ab13924be1b872d7ec6d03e207b1df
[ "super(MLP, self).__init__()\nself.hidden_sizes = hidden_sizes\nself.input_size = input_size\nself.output_size = output_size\nself.hidden_activation = hidden_activation\nself.output_activation = output_activation\nself.linear_layer = linear_layer\nself.use_output_layer = use_output_layer\nself.n_category = n_catego...
<|body_start_0|> super(MLP, self).__init__() self.hidden_sizes = hidden_sizes self.input_size = input_size self.output_size = output_size self.hidden_activation = hidden_activation self.output_activation = output_activation self.linear_layer = linear_layer ...
Baseline of Multilayer perceptron. The layer-norm is not implemented here Attributes: input_size (int): size of input output_size (int): size of output layer hidden_sizes (list): sizes of hidden layers hidden_activation: activation function of hidden layers output_activation: activation function of output layer hidden_...
MLP
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MLP: """Baseline of Multilayer perceptron. The layer-norm is not implemented here Attributes: input_size (int): size of input output_size (int): size of output layer hidden_sizes (list): sizes of hidden layers hidden_activation: activation function of hidden layers output_activation: activation f...
stack_v2_sparse_classes_36k_train_016310
10,144
no_license
[ { "docstring": "Initialize. Args: input_size (int): size of input output_size (int): size of output layer hidden_sizes (list): number of hidden layers hidden_activation: activation function of hidden layers output_activation: activation function of output layer linear_layer (nn.Module): linear layer of mlp use_...
2
null
Implement the Python class `MLP` described below. Class description: Baseline of Multilayer perceptron. The layer-norm is not implemented here Attributes: input_size (int): size of input output_size (int): size of output layer hidden_sizes (list): sizes of hidden layers hidden_activation: activation function of hidden...
Implement the Python class `MLP` described below. Class description: Baseline of Multilayer perceptron. The layer-norm is not implemented here Attributes: input_size (int): size of input output_size (int): size of output layer hidden_sizes (list): sizes of hidden layers hidden_activation: activation function of hidden...
2d70d4792e78ceefd4626302fa85e7774e2ff250
<|skeleton|> class MLP: """Baseline of Multilayer perceptron. The layer-norm is not implemented here Attributes: input_size (int): size of input output_size (int): size of output layer hidden_sizes (list): sizes of hidden layers hidden_activation: activation function of hidden layers output_activation: activation f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MLP: """Baseline of Multilayer perceptron. The layer-norm is not implemented here Attributes: input_size (int): size of input output_size (int): size of output layer hidden_sizes (list): sizes of hidden layers hidden_activation: activation function of hidden layers output_activation: activation function of ou...
the_stack_v2_python_sparse
src/SDRL_Project/learning_agents/architectures/mlp.py
sbhambr1/symbolic_planning_and_rl
train
0
17180226a4fdefd3b2413780e805c3736ab552a9
[ "self.count = 0\n\ndef dfs(index, acc, S):\n if index == len(nums):\n if acc == S:\n self.count += 1\n else:\n num = nums[index]\n dfs(index + 1, acc + num, S)\n dfs(index + 1, acc - num, S)\ndfs(0, 0, S)\nreturn self.count", "dp = {}\n\ndef dfs(index, acc, S):\n if...
<|body_start_0|> self.count = 0 def dfs(index, acc, S): if index == len(nums): if acc == S: self.count += 1 else: num = nums[index] dfs(index + 1, acc + num, S) dfs(index + 1, acc - num, S) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findTargetSumWaysBackTrack(self, nums, S): """:type nums: List[int] :type S: int :rtype: int""" <|body_0|> def findTargetSumWays(self, nums, S): """:type nums: List[int] :type S: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_016311
1,703
no_license
[ { "docstring": ":type nums: List[int] :type S: int :rtype: int", "name": "findTargetSumWaysBackTrack", "signature": "def findTargetSumWaysBackTrack(self, nums, S)" }, { "docstring": ":type nums: List[int] :type S: int :rtype: int", "name": "findTargetSumWays", "signature": "def findTarge...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findTargetSumWaysBackTrack(self, nums, S): :type nums: List[int] :type S: int :rtype: int - def findTargetSumWays(self, nums, S): :type nums: List[int] :type S: int :rtype: i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findTargetSumWaysBackTrack(self, nums, S): :type nums: List[int] :type S: int :rtype: int - def findTargetSumWays(self, nums, S): :type nums: List[int] :type S: int :rtype: i...
c937fe19be665ba7ac345e1729ff531f370f30e8
<|skeleton|> class Solution: def findTargetSumWaysBackTrack(self, nums, S): """:type nums: List[int] :type S: int :rtype: int""" <|body_0|> def findTargetSumWays(self, nums, S): """:type nums: List[int] :type S: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findTargetSumWaysBackTrack(self, nums, S): """:type nums: List[int] :type S: int :rtype: int""" self.count = 0 def dfs(index, acc, S): if index == len(nums): if acc == S: self.count += 1 else: nu...
the_stack_v2_python_sparse
facebook/onsite/targetSum.py
nguyenngochuy91/companyQuestions
train
1
291a8cd5a8278d01c0e8aa3bad89a715c0359277
[ "error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError}\nerror_map.update(kwargs.pop('error_map', {}) or {})\n_headers = kwargs.pop('headers', {}) or {}\n_params = case_insensitive_dict(kwargs.pop('params', {}) or {})\napi_version = kwargs.pop('api_version', _params.pop('...
<|body_start_0|> error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {}) or {}) _headers = kwargs.pop('headers', {}) or {} _params = case_insensitive_dict(kwargs.pop('params', {}) or {}) api_v...
RecoveryServicesClientOperationsMixin
[ "LicenseRef-scancode-generic-cla", "MIT", "LGPL-2.1-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RecoveryServicesClientOperationsMixin: def get_operation_status(self, resource_group_name: str, vault_name: str, operation_id: str, **kwargs: Any) -> _models.OperationResource: """Gets the operation status for a resource. :param resource_group_name: The name of the resource group where t...
stack_v2_sparse_classes_36k_train_016312
10,010
permissive
[ { "docstring": "Gets the operation status for a resource. :param resource_group_name: The name of the resource group where the recovery services vault is present. :type resource_group_name: str :param vault_name: The name of the recovery services vault. :type vault_name: str :param operation_id: :type operation...
2
stack_v2_sparse_classes_30k_train_003441
Implement the Python class `RecoveryServicesClientOperationsMixin` described below. Class description: Implement the RecoveryServicesClientOperationsMixin class. Method signatures and docstrings: - def get_operation_status(self, resource_group_name: str, vault_name: str, operation_id: str, **kwargs: Any) -> _models.O...
Implement the Python class `RecoveryServicesClientOperationsMixin` described below. Class description: Implement the RecoveryServicesClientOperationsMixin class. Method signatures and docstrings: - def get_operation_status(self, resource_group_name: str, vault_name: str, operation_id: str, **kwargs: Any) -> _models.O...
cece86a8548cb5f575e5419864d631673be0a244
<|skeleton|> class RecoveryServicesClientOperationsMixin: def get_operation_status(self, resource_group_name: str, vault_name: str, operation_id: str, **kwargs: Any) -> _models.OperationResource: """Gets the operation status for a resource. :param resource_group_name: The name of the resource group where t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RecoveryServicesClientOperationsMixin: def get_operation_status(self, resource_group_name: str, vault_name: str, operation_id: str, **kwargs: Any) -> _models.OperationResource: """Gets the operation status for a resource. :param resource_group_name: The name of the resource group where the recovery se...
the_stack_v2_python_sparse
sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_recovery_services_client_operations.py
test-repo-billy/azure-sdk-for-python
train
0
0925e414371759d5af758e6e43d449ec059a1df8
[ "if model._meta.app_label in self.route_app_labels:\n return model._meta.app_label\nreturn None", "if model._meta.app_label in self.route_app_labels:\n return model._meta.app_label\nreturn None", "if obj1._meta.app_label == obj2._meta.app_label:\n return True\nelse:\n return None", "if app_label i...
<|body_start_0|> if model._meta.app_label in self.route_app_labels: return model._meta.app_label return None <|end_body_0|> <|body_start_1|> if model._meta.app_label in self.route_app_labels: return model._meta.app_label return None <|end_body_1|> <|body_start_2...
A router to control all database operations on models e Models go to db with same name than his app
EncuestasRouter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncuestasRouter: """A router to control all database operations on models e Models go to db with same name than his app""" def db_for_read(self, model, **hints): """Attempts to read models""" <|body_0|> def db_for_write(self, model, **hints): """Attempts to write...
stack_v2_sparse_classes_36k_train_016313
1,158
no_license
[ { "docstring": "Attempts to read models", "name": "db_for_read", "signature": "def db_for_read(self, model, **hints)" }, { "docstring": "Attempts to write models", "name": "db_for_write", "signature": "def db_for_write(self, model, **hints)" }, { "docstring": "Allow relations if ...
4
stack_v2_sparse_classes_30k_train_015631
Implement the Python class `EncuestasRouter` described below. Class description: A router to control all database operations on models e Models go to db with same name than his app Method signatures and docstrings: - def db_for_read(self, model, **hints): Attempts to read models - def db_for_write(self, model, **hint...
Implement the Python class `EncuestasRouter` described below. Class description: A router to control all database operations on models e Models go to db with same name than his app Method signatures and docstrings: - def db_for_read(self, model, **hints): Attempts to read models - def db_for_write(self, model, **hint...
ea41397bbee7c204f590d39569a9060f1410a819
<|skeleton|> class EncuestasRouter: """A router to control all database operations on models e Models go to db with same name than his app""" def db_for_read(self, model, **hints): """Attempts to read models""" <|body_0|> def db_for_write(self, model, **hints): """Attempts to write...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EncuestasRouter: """A router to control all database operations on models e Models go to db with same name than his app""" def db_for_read(self, model, **hints): """Attempts to read models""" if model._meta.app_label in self.route_app_labels: return model._meta.app_label ...
the_stack_v2_python_sparse
django/tfmsurveysapp/router.py
dsm9/TreballFiMaster
train
0
119bdb99874d8beac14a2fc7ab45ee35eba86139
[ "super(ProfileForm, self).__init__(*args, **kwargs)\ntry:\n self.fields['email'].initial = self.instance.user.email\n self.fields['first_name'].initial = self.instance.user.first_name\n self.fields['last_name'].initial = self.instance.user.last_name\nexcept User.DoesNotExist:\n pass", "u = self.instan...
<|body_start_0|> super(ProfileForm, self).__init__(*args, **kwargs) try: self.fields['email'].initial = self.instance.user.email self.fields['first_name'].initial = self.instance.user.first_name self.fields['last_name'].initial = self.instance.user.last_name e...
A custom form to make editing a profile more powerful. Fields like email and name are part of the User object, not the user's profile, so they cannot be edited with the default profile edit form. This custom form adds these extra fields
ProfileForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProfileForm: """A custom form to make editing a profile more powerful. Fields like email and name are part of the User object, not the user's profile, so they cannot be edited with the default profile edit form. This custom form adds these extra fields""" def __init__(self, *args, **kwargs):...
stack_v2_sparse_classes_36k_train_016314
1,642
no_license
[ { "docstring": "Fill in the extra fields with the right dat afrom the user object", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Update the email address and name on the related User object as well.", "name": "save", "signature": "def save(sel...
2
stack_v2_sparse_classes_30k_val_001044
Implement the Python class `ProfileForm` described below. Class description: A custom form to make editing a profile more powerful. Fields like email and name are part of the User object, not the user's profile, so they cannot be edited with the default profile edit form. This custom form adds these extra fields Meth...
Implement the Python class `ProfileForm` described below. Class description: A custom form to make editing a profile more powerful. Fields like email and name are part of the User object, not the user's profile, so they cannot be edited with the default profile edit form. This custom form adds these extra fields Meth...
104166a2a444fe36f3a5dba954527139fee08e8d
<|skeleton|> class ProfileForm: """A custom form to make editing a profile more powerful. Fields like email and name are part of the User object, not the user's profile, so they cannot be edited with the default profile edit form. This custom form adds these extra fields""" def __init__(self, *args, **kwargs):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProfileForm: """A custom form to make editing a profile more powerful. Fields like email and name are part of the User object, not the user's profile, so they cannot be edited with the default profile edit form. This custom form adds these extra fields""" def __init__(self, *args, **kwargs): """F...
the_stack_v2_python_sparse
profiles/forms.py
NabeelaMSIT/digitalchef
train
0
9b04ed66fa63de93eef606d6b395ff457af8f579
[ "if n == 0:\n return ''\nres = []\nqueue = deque()\nqueue.append([])\nfor num in range(n):\n for _ in range(len(queue)):\n tmp = queue.popleft()\n for j in range(len(tmp) + 1):\n per = list(tmp)\n per.insert(j, str(num + 1))\n if len(per) == n:\n r...
<|body_start_0|> if n == 0: return '' res = [] queue = deque() queue.append([]) for num in range(n): for _ in range(len(queue)): tmp = queue.popleft() for j in range(len(tmp) + 1): per = list(tmp) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def getPermutation2(self, n, k): """:type n: int :type k: int :rtype: str""" <|body_0|> def getPermutation(self, n, k): """:type n: int :type k: int :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n == 0: return ...
stack_v2_sparse_classes_36k_train_016315
1,177
no_license
[ { "docstring": ":type n: int :type k: int :rtype: str", "name": "getPermutation2", "signature": "def getPermutation2(self, n, k)" }, { "docstring": ":type n: int :type k: int :rtype: str", "name": "getPermutation", "signature": "def getPermutation(self, n, k)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getPermutation2(self, n, k): :type n: int :type k: int :rtype: str - def getPermutation(self, n, k): :type n: int :type k: int :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getPermutation2(self, n, k): :type n: int :type k: int :rtype: str - def getPermutation(self, n, k): :type n: int :type k: int :rtype: str <|skeleton|> class Solution: ...
013f6f222c6c2a617787b258f8a37003a9f51526
<|skeleton|> class Solution: def getPermutation2(self, n, k): """:type n: int :type k: int :rtype: str""" <|body_0|> def getPermutation(self, n, k): """:type n: int :type k: int :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def getPermutation2(self, n, k): """:type n: int :type k: int :rtype: str""" if n == 0: return '' res = [] queue = deque() queue.append([]) for num in range(n): for _ in range(len(queue)): tmp = queue.popleft() ...
the_stack_v2_python_sparse
all/60_getPermutation.py
terrifyzhao/leetcode
train
0
1e355e32f09d4aaeb7f755e55e7c95da330b3f70
[ "result = []\nfor node in eqnNode.childList:\n try:\n num = node.formatRef.fieldDict[self.fieldName].mathValue(node, zeroBlanks, noMarkup)\n if num == None:\n return None\n result.append(num)\n except KeyError:\n if not zeroBlanks:\n return None\nif not result...
<|body_start_0|> result = [] for node in eqnNode.childList: try: num = node.formatRef.fieldDict[self.fieldName].mathValue(node, zeroBlanks, noMarkup) if num == None: return None result.append(num) except KeyError...
Class to store and eval child field references in a Math equation.
EquationChildRef
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EquationChildRef: """Class to store and eval child field references in a Math equation.""" def referenceValue(self, eqnNode, zeroBlanks=True, zeroValue=0, noMarkup=True): """Return a list with child field values referenced from a given node. Return None if there are blanks and zeroBl...
stack_v2_sparse_classes_36k_train_016316
21,625
no_license
[ { "docstring": "Return a list with child field values referenced from a given node. Return None if there are blanks and zeroBlanks is false, raise a ValueError if any aren't a number. Arguments: eqnNode -- the node containing the equation to evaluate zeroBlanks -- replace blank fields with zeroValue if True zer...
2
null
Implement the Python class `EquationChildRef` described below. Class description: Class to store and eval child field references in a Math equation. Method signatures and docstrings: - def referenceValue(self, eqnNode, zeroBlanks=True, zeroValue=0, noMarkup=True): Return a list with child field values referenced from...
Implement the Python class `EquationChildRef` described below. Class description: Class to store and eval child field references in a Math equation. Method signatures and docstrings: - def referenceValue(self, eqnNode, zeroBlanks=True, zeroValue=0, noMarkup=True): Return a list with child field values referenced from...
c9429496e8ed15116746a23f3a90f262cf54f755
<|skeleton|> class EquationChildRef: """Class to store and eval child field references in a Math equation.""" def referenceValue(self, eqnNode, zeroBlanks=True, zeroValue=0, noMarkup=True): """Return a list with child field values referenced from a given node. Return None if there are blanks and zeroBl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EquationChildRef: """Class to store and eval child field references in a Math equation.""" def referenceValue(self, eqnNode, zeroBlanks=True, zeroValue=0, noMarkup=True): """Return a list with child field values referenced from a given node. Return None if there are blanks and zeroBlanks is false...
the_stack_v2_python_sparse
source/matheval.py
doug-101/TreeLine
train
121
734f5992c1cd1a09d4f64caaef513aabc9e0b32b
[ "self._owner = owner\nself._timeout = 0.0\nself._handle = KOKORO.call_after(timeout, type(self)._step, self)", "timeout = self._timeout\nif timeout > 0.0:\n self._handle = KOKORO.call_after(timeout, type(self)._step, self)\n self._timeout = 0.0\n return\nself._handle = None\nowner = self._owner\nif owner...
<|body_start_0|> self._owner = owner self._timeout = 0.0 self._handle = KOKORO.call_after(timeout, type(self)._step, self) <|end_body_0|> <|body_start_1|> timeout = self._timeout if timeout > 0.0: self._handle = KOKORO.call_after(timeout, type(self)._step, self) ...
Executes timing out feature on ``Pagination`` and on other familiar types. Attributes ---------- _handle : `None`, ``TimerHandle`` Handle to wake_up the timeouter with it's `._step` function. Set to `None`, when the respective timeout is over or if the timeout is cancelled. _owner : `Any` The object what uses the timeo...
Timeouter
[ "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Timeouter: """Executes timing out feature on ``Pagination`` and on other familiar types. Attributes ---------- _handle : `None`, ``TimerHandle`` Handle to wake_up the timeouter with it's `._step` function. Set to `None`, when the respective timeout is over or if the timeout is cancelled. _owner :...
stack_v2_sparse_classes_36k_train_016317
20,084
permissive
[ { "docstring": "Creates a new ``Timeouter`` with the given `owner` and `timeout`. Parameters ---------- owner : `Any` The object what uses the timeouter. timeout : `float` The time with what the timeout will be expired when it's current waiting cycle is over.", "name": "__init__", "signature": "def __in...
5
null
Implement the Python class `Timeouter` described below. Class description: Executes timing out feature on ``Pagination`` and on other familiar types. Attributes ---------- _handle : `None`, ``TimerHandle`` Handle to wake_up the timeouter with it's `._step` function. Set to `None`, when the respective timeout is over o...
Implement the Python class `Timeouter` described below. Class description: Executes timing out feature on ``Pagination`` and on other familiar types. Attributes ---------- _handle : `None`, ``TimerHandle`` Handle to wake_up the timeouter with it's `._step` function. Set to `None`, when the respective timeout is over o...
53f24fdb38459dc5a4fd04f11bdbfee8295b76a4
<|skeleton|> class Timeouter: """Executes timing out feature on ``Pagination`` and on other familiar types. Attributes ---------- _handle : `None`, ``TimerHandle`` Handle to wake_up the timeouter with it's `._step` function. Set to `None`, when the respective timeout is over or if the timeout is cancelled. _owner :...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Timeouter: """Executes timing out feature on ``Pagination`` and on other familiar types. Attributes ---------- _handle : `None`, ``TimerHandle`` Handle to wake_up the timeouter with it's `._step` function. Set to `None`, when the respective timeout is over or if the timeout is cancelled. _owner : `Any` The ob...
the_stack_v2_python_sparse
hata/ext/slash/waiters.py
HuyaneMatsu/hata
train
3
962d18c4787d77cb4fba6242c63347a914ee4e0d
[ "try:\n movie = Movie.objects.get(pk=pk)\nexcept Movie.DoesNotExist:\n return Response({'Error': 'Movie Does Not Exist'}, status=status.HTTP_404_NOT_FOUND)\nserialized_data = MovieModelSerializer(movie)\nreturn Response(serialized_data.data)", "try:\n movie = Movie.objects.get(pk=pk)\nexcept Movie.DoesNo...
<|body_start_0|> try: movie = Movie.objects.get(pk=pk) except Movie.DoesNotExist: return Response({'Error': 'Movie Does Not Exist'}, status=status.HTTP_404_NOT_FOUND) serialized_data = MovieModelSerializer(movie) return Response(serialized_data.data) <|end_body_0|...
Response Movie Detail API
MovieDetail
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MovieDetail: """Response Movie Detail API""" def get(self, request, pk): """return movie detail response""" <|body_0|> def put(self, request, pk): """Updated Movie""" <|body_1|> def delete(self, request, pk): """Delete single movie""" ...
stack_v2_sparse_classes_36k_train_016318
3,987
no_license
[ { "docstring": "return movie detail response", "name": "get", "signature": "def get(self, request, pk)" }, { "docstring": "Updated Movie", "name": "put", "signature": "def put(self, request, pk)" }, { "docstring": "Delete single movie", "name": "delete", "signature": "def...
3
stack_v2_sparse_classes_30k_train_001088
Implement the Python class `MovieDetail` described below. Class description: Response Movie Detail API Method signatures and docstrings: - def get(self, request, pk): return movie detail response - def put(self, request, pk): Updated Movie - def delete(self, request, pk): Delete single movie
Implement the Python class `MovieDetail` described below. Class description: Response Movie Detail API Method signatures and docstrings: - def get(self, request, pk): return movie detail response - def put(self, request, pk): Updated Movie - def delete(self, request, pk): Delete single movie <|skeleton|> class Movie...
49e8915a1cc8d8784d4944746c016305fcd73f5e
<|skeleton|> class MovieDetail: """Response Movie Detail API""" def get(self, request, pk): """return movie detail response""" <|body_0|> def put(self, request, pk): """Updated Movie""" <|body_1|> def delete(self, request, pk): """Delete single movie""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MovieDetail: """Response Movie Detail API""" def get(self, request, pk): """return movie detail response""" try: movie = Movie.objects.get(pk=pk) except Movie.DoesNotExist: return Response({'Error': 'Movie Does Not Exist'}, status=status.HTTP_404_NOT_FOUND)...
the_stack_v2_python_sparse
watchlist/api_old/views.py
nuruddinsayeed/movie-api
train
0
97164383dc7930d4674c89ae1a3ef19f2e886f69
[ "lists = {}\nret, out = run('list_lists')\nfor l in out[1:]:\n name, desc = l.split(' - ')\n lists[name.strip()] = desc.strip()\nreturn lists", "email, domain = listemail.split('@')\nif email not in self.list():\n log.info('adding mailman list: %s' % email)\n cmd = \"newlist -q -u %s -e %s %s %s '%s'\...
<|body_start_0|> lists = {} ret, out = run('list_lists') for l in out[1:]: name, desc = l.split(' - ') lists[name.strip()] = desc.strip() return lists <|end_body_0|> <|body_start_1|> email, domain = listemail.split('@') if email not in self.list()...
Manage mailman mailing lists.
MailmanADM
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MailmanADM: """Manage mailman mailing lists.""" def list(self, refresh=False): """list mailing lists. 2 matching mailing lists found: Africa-list - [no description available] Mailman - [no description available]""" <|body_0|> def create(self, listemail, listadmin, passwo...
stack_v2_sparse_classes_36k_train_016319
7,200
permissive
[ { "docstring": "list mailing lists. 2 matching mailing lists found: Africa-list - [no description available] Mailman - [no description available]", "name": "list", "signature": "def list(self, refresh=False)" }, { "docstring": "create a new mailing list. newlist -u webdomain -e emaildomain listn...
2
stack_v2_sparse_classes_30k_train_020893
Implement the Python class `MailmanADM` described below. Class description: Manage mailman mailing lists. Method signatures and docstrings: - def list(self, refresh=False): list mailing lists. 2 matching mailing lists found: Africa-list - [no description available] Mailman - [no description available] - def create(se...
Implement the Python class `MailmanADM` described below. Class description: Manage mailman mailing lists. Method signatures and docstrings: - def list(self, refresh=False): list mailing lists. 2 matching mailing lists found: Africa-list - [no description available] Mailman - [no description available] - def create(se...
14812dfbc7bac1d76c4d9e5be2cdf83fc1c391a1
<|skeleton|> class MailmanADM: """Manage mailman mailing lists.""" def list(self, refresh=False): """list mailing lists. 2 matching mailing lists found: Africa-list - [no description available] Mailman - [no description available]""" <|body_0|> def create(self, listemail, listadmin, passwo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MailmanADM: """Manage mailman mailing lists.""" def list(self, refresh=False): """list mailing lists. 2 matching mailing lists found: Africa-list - [no description available] Mailman - [no description available]""" lists = {} ret, out = run('list_lists') for l in out[1:]: ...
the_stack_v2_python_sparse
data/python/be83e963dd5f3631631f7c1497f0afdf_appadm.py
maxim5/code-inspector
train
5
86a9a44e6fd9bce0bef0e38d3ac3871984b89cdb
[ "tokens = os.path.splitext(os.path.basename(limitfile))[0].split('_')\nif tokens[3] in ['point', 'dmap', 'dradial']:\n return True\nreturn tokens[2] in ['point', 'dmap', 'dradial']", "tokens = os.path.splitext(os.path.basename(limitfile))[0].split('_')\nif tokens[3] in ['point', 'map', 'radial']:\n return T...
<|body_start_0|> tokens = os.path.splitext(os.path.basename(limitfile))[0].split('_') if tokens[3] in ['point', 'dmap', 'dradial']: return True return tokens[2] in ['point', 'dmap', 'dradial'] <|end_body_0|> <|body_start_1|> tokens = os.path.splitext(os.path.basename(limitfi...
Small class to collect limit results from a series of simulations.
CollectLimits
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CollectLimits: """Small class to collect limit results from a series of simulations.""" def is_decay_limits(limitfile): """Return true if a file has limits for decay""" <|body_0|> def is_ann_limits(limitfile): """Return true if a file has limits for annhilation""...
stack_v2_sparse_classes_36k_train_016320
11,467
permissive
[ { "docstring": "Return true if a file has limits for decay", "name": "is_decay_limits", "signature": "def is_decay_limits(limitfile)" }, { "docstring": "Return true if a file has limits for annhilation", "name": "is_ann_limits", "signature": "def is_ann_limits(limitfile)" }, { "d...
4
stack_v2_sparse_classes_30k_train_001793
Implement the Python class `CollectLimits` described below. Class description: Small class to collect limit results from a series of simulations. Method signatures and docstrings: - def is_decay_limits(limitfile): Return true if a file has limits for decay - def is_ann_limits(limitfile): Return true if a file has lim...
Implement the Python class `CollectLimits` described below. Class description: Small class to collect limit results from a series of simulations. Method signatures and docstrings: - def is_decay_limits(limitfile): Return true if a file has limits for decay - def is_ann_limits(limitfile): Return true if a file has lim...
e5b3f950d18d5077f7abf46f53fcf59e97bb3301
<|skeleton|> class CollectLimits: """Small class to collect limit results from a series of simulations.""" def is_decay_limits(limitfile): """Return true if a file has limits for decay""" <|body_0|> def is_ann_limits(limitfile): """Return true if a file has limits for annhilation""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CollectLimits: """Small class to collect limit results from a series of simulations.""" def is_decay_limits(limitfile): """Return true if a file has limits for decay""" tokens = os.path.splitext(os.path.basename(limitfile))[0].split('_') if tokens[3] in ['point', 'dmap', 'dradial'...
the_stack_v2_python_sparse
dmpipe/dm_collect.py
fermiPy/dmpipe
train
1
0bab1ce9cb44da2855909a54b23a22c3d651644a
[ "if not segment.biological_annotation:\n segment.biological_annotation = schema.SFFBiologicalAnnotation()\nbA = segment.biological_annotation\nif self.name is not None:\n bA.name = self.name\nif self.description is not None:\n bA.description = self.description\nif self.number_of_instances:\n bA.number_o...
<|body_start_0|> if not segment.biological_annotation: segment.biological_annotation = schema.SFFBiologicalAnnotation() bA = segment.biological_annotation if self.name is not None: bA.name = self.name if self.description is not None: bA.description = s...
Note 'abstact' class that defines private attributes and main methods
AbstractNote
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AbstractNote: """Note 'abstact' class that defines private attributes and main methods""" def add_to_segment(self, segment): """Add the annotations found in this ``Note`` object to the :py:class:`sfftkrw.SFFSegment` object :param segment: single segment in EMDB-SFF :type segment: :py...
stack_v2_sparse_classes_36k_train_016321
42,507
permissive
[ { "docstring": "Add the annotations found in this ``Note`` object to the :py:class:`sfftkrw.SFFSegment` object :param segment: single segment in EMDB-SFF :type segment: :py:class:`sfftkrw.SFFSegment`", "name": "add_to_segment", "signature": "def add_to_segment(self, segment)" }, { "docstring": "...
3
stack_v2_sparse_classes_30k_train_017969
Implement the Python class `AbstractNote` described below. Class description: Note 'abstact' class that defines private attributes and main methods Method signatures and docstrings: - def add_to_segment(self, segment): Add the annotations found in this ``Note`` object to the :py:class:`sfftkrw.SFFSegment` object :par...
Implement the Python class `AbstractNote` described below. Class description: Note 'abstact' class that defines private attributes and main methods Method signatures and docstrings: - def add_to_segment(self, segment): Add the annotations found in this ``Note`` object to the :py:class:`sfftkrw.SFFSegment` object :par...
46e0890d6773bf3482b8e6b3dfe994417af00649
<|skeleton|> class AbstractNote: """Note 'abstact' class that defines private attributes and main methods""" def add_to_segment(self, segment): """Add the annotations found in this ``Note`` object to the :py:class:`sfftkrw.SFFSegment` object :param segment: single segment in EMDB-SFF :type segment: :py...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AbstractNote: """Note 'abstact' class that defines private attributes and main methods""" def add_to_segment(self, segment): """Add the annotations found in this ``Note`` object to the :py:class:`sfftkrw.SFFSegment` object :param segment: single segment in EMDB-SFF :type segment: :py:class:`sfftk...
the_stack_v2_python_sparse
sfftk/notes/modify.py
RosaryYao/sfftk
train
0
41ec649af4c99f83e1c92288a0d671c9bf7cdfb3
[ "PISM.IP_SSAHardavTaoTikhonovProblemListener.__init__(self)\nself.owner = owner\nself.listener = listener", "data = Bunch(tikhonov_penalty=eta, JDesign=objVal, JState=penaltyVal, zeta=d, zeta_step=diff_d, grad_JDesign=grad_d, u=u, residual=diff_u, grad_JState=grad_u, grad_JTikhonov=grad)\ntry:\n self.listener(...
<|body_start_0|> PISM.IP_SSAHardavTaoTikhonovProblemListener.__init__(self) self.owner = owner self.listener = listener <|end_body_0|> <|body_start_1|> data = Bunch(tikhonov_penalty=eta, JDesign=objVal, JState=penaltyVal, zeta=d, zeta_step=diff_d, grad_JDesign=grad_d, u=u, residual=diff...
Adaptor converting calls to a C++ :cpp:class:`IP_SSATaucTaoTikhonovProblemListener` on to a standard python-based listener. Used internally by :class:`InvSSATaucSolver_Tikhonov`. I.e. don't make one of these for yourself.
HardavIterationListenerAdaptor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HardavIterationListenerAdaptor: """Adaptor converting calls to a C++ :cpp:class:`IP_SSATaucTaoTikhonovProblemListener` on to a standard python-based listener. Used internally by :class:`InvSSATaucSolver_Tikhonov`. I.e. don't make one of these for yourself.""" def __init__(self, owner, listen...
stack_v2_sparse_classes_36k_train_016322
10,589
no_license
[ { "docstring": ":param owner: The :class:`InvSSATaucSolver_Tikhonov` that constructed us :param listener: The python-based listener.", "name": "__init__", "signature": "def __init__(self, owner, listener)" }, { "docstring": "Called during IP_SSATaucTaoTikhonovProblem iterations. Gathers together...
2
stack_v2_sparse_classes_30k_train_009401
Implement the Python class `HardavIterationListenerAdaptor` described below. Class description: Adaptor converting calls to a C++ :cpp:class:`IP_SSATaucTaoTikhonovProblemListener` on to a standard python-based listener. Used internally by :class:`InvSSATaucSolver_Tikhonov`. I.e. don't make one of these for yourself. ...
Implement the Python class `HardavIterationListenerAdaptor` described below. Class description: Adaptor converting calls to a C++ :cpp:class:`IP_SSATaucTaoTikhonovProblemListener` on to a standard python-based listener. Used internally by :class:`InvSSATaucSolver_Tikhonov`. I.e. don't make one of these for yourself. ...
88664f50a2f7075b6e96a06a5976986aac0302ed
<|skeleton|> class HardavIterationListenerAdaptor: """Adaptor converting calls to a C++ :cpp:class:`IP_SSATaucTaoTikhonovProblemListener` on to a standard python-based listener. Used internally by :class:`InvSSATaucSolver_Tikhonov`. I.e. don't make one of these for yourself.""" def __init__(self, owner, listen...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HardavIterationListenerAdaptor: """Adaptor converting calls to a C++ :cpp:class:`IP_SSATaucTaoTikhonovProblemListener` on to a standard python-based listener. Used internally by :class:`InvSSATaucSolver_Tikhonov`. I.e. don't make one of these for yourself.""" def __init__(self, owner, listener): ...
the_stack_v2_python_sparse
site-packages/PISM/invert/ssa_tao.py
flapo099/test
train
0
f42d522c7b847f447ad3707a8fec16c9ff32ea99
[ "sm = get_storage_manager()\nwith sm.transaction():\n role = sm.get(models.Role, None, filters={'name': role_name})\n already_exists = models.Permission.query.filter_by(role=role, name=permission_name).first()\n if already_exists:\n raise manager_exceptions.ConflictError(f'{role_name} already has pe...
<|body_start_0|> sm = get_storage_manager() with sm.transaction(): role = sm.get(models.Role, None, filters={'name': role_name}) already_exists = models.Permission.query.filter_by(role=role, name=permission_name).first() if already_exists: raise manage...
PermissionsRoleId
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PermissionsRoleId: def put(self, role_name, permission_name): """Allow role_name the permission permission_name""" <|body_0|> def delete(self, role_name, permission_name): """Disallow role_name the permission permission_name""" <|body_1|> <|end_skeleton|> <...
stack_v2_sparse_classes_36k_train_016323
3,208
permissive
[ { "docstring": "Allow role_name the permission permission_name", "name": "put", "signature": "def put(self, role_name, permission_name)" }, { "docstring": "Disallow role_name the permission permission_name", "name": "delete", "signature": "def delete(self, role_name, permission_name)" ...
2
stack_v2_sparse_classes_30k_train_013012
Implement the Python class `PermissionsRoleId` described below. Class description: Implement the PermissionsRoleId class. Method signatures and docstrings: - def put(self, role_name, permission_name): Allow role_name the permission permission_name - def delete(self, role_name, permission_name): Disallow role_name the...
Implement the Python class `PermissionsRoleId` described below. Class description: Implement the PermissionsRoleId class. Method signatures and docstrings: - def put(self, role_name, permission_name): Allow role_name the permission permission_name - def delete(self, role_name, permission_name): Disallow role_name the...
c0de6442e1d7653fad824d75e571802a74eee605
<|skeleton|> class PermissionsRoleId: def put(self, role_name, permission_name): """Allow role_name the permission permission_name""" <|body_0|> def delete(self, role_name, permission_name): """Disallow role_name the permission permission_name""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PermissionsRoleId: def put(self, role_name, permission_name): """Allow role_name the permission permission_name""" sm = get_storage_manager() with sm.transaction(): role = sm.get(models.Role, None, filters={'name': role_name}) already_exists = models.Permission....
the_stack_v2_python_sparse
rest-service/manager_rest/rest/resources_v3_1/permissions.py
cloudify-cosmo/cloudify-manager
train
146
cb9c469d1df50f59a1b1673c45f39db7aaf992f0
[ "self.branch = 'master'\nself.fix = False\nsuper(lint, self).initialize_options()", "cmd = 'black .'\ncmd = cmd.format(branch=self.branch)\nself.call_and_exit(self.apply_options(cmd, ('fix',)))" ]
<|body_start_0|> self.branch = 'master' self.fix = False super(lint, self).initialize_options() <|end_body_0|> <|body_start_1|> cmd = 'black .' cmd = cmd.format(branch=self.branch) self.call_and_exit(self.apply_options(cmd, ('fix',))) <|end_body_1|>
A PEP 8 lint command that optionally fixes violations.
lint
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class lint: """A PEP 8 lint command that optionally fixes violations.""" def initialize_options(self): """Set the default options.""" <|body_0|> def run(self): """Run the linter.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.branch = 'master' ...
stack_v2_sparse_classes_36k_train_016324
3,851
permissive
[ { "docstring": "Set the default options.", "name": "initialize_options", "signature": "def initialize_options(self)" }, { "docstring": "Run the linter.", "name": "run", "signature": "def run(self)" } ]
2
stack_v2_sparse_classes_30k_train_014011
Implement the Python class `lint` described below. Class description: A PEP 8 lint command that optionally fixes violations. Method signatures and docstrings: - def initialize_options(self): Set the default options. - def run(self): Run the linter.
Implement the Python class `lint` described below. Class description: A PEP 8 lint command that optionally fixes violations. Method signatures and docstrings: - def initialize_options(self): Set the default options. - def run(self): Run the linter. <|skeleton|> class lint: """A PEP 8 lint command that optionally...
4e2c417f68bc07c72b508e107431569b0783c4ef
<|skeleton|> class lint: """A PEP 8 lint command that optionally fixes violations.""" def initialize_options(self): """Set the default options.""" <|body_0|> def run(self): """Run the linter.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class lint: """A PEP 8 lint command that optionally fixes violations.""" def initialize_options(self): """Set the default options.""" self.branch = 'master' self.fix = False super(lint, self).initialize_options() def run(self): """Run the linter.""" cmd = 'b...
the_stack_v2_python_sparse
tasks.py
dbcli/cli_helpers
train
102
76f61f0da683de1207955d6952826a9c99489868
[ "if not gas:\n return False\nif not cost:\n return True\nn = gas.__len__()\nstart = 0\ncur = 0\niter = 0\nwhile True:\n cur += gas[iter] - cost[iter]\n iter += 1\n if cur < 0:\n if iter <= start:\n start += 1\n else:\n start = iter\n cur = 0\n else:\n ...
<|body_start_0|> if not gas: return False if not cost: return True n = gas.__len__() start = 0 cur = 0 iter = 0 while True: cur += gas[iter] - cost[iter] iter += 1 if cur < 0: if iter <= s...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canCompleteCircuit(self, gas, cost): """:type gas: List[int] :type cost: List[int] :rtype: int""" <|body_0|> def canCompleteCircuit1(self, gas, cost): """:type gas: List[int] :type cost: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_36k_train_016325
1,721
no_license
[ { "docstring": ":type gas: List[int] :type cost: List[int] :rtype: int", "name": "canCompleteCircuit", "signature": "def canCompleteCircuit(self, gas, cost)" }, { "docstring": ":type gas: List[int] :type cost: List[int] :rtype: int", "name": "canCompleteCircuit1", "signature": "def canCo...
2
stack_v2_sparse_classes_30k_train_009382
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canCompleteCircuit(self, gas, cost): :type gas: List[int] :type cost: List[int] :rtype: int - def canCompleteCircuit1(self, gas, cost): :type gas: List[int] :type cost: List[...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canCompleteCircuit(self, gas, cost): :type gas: List[int] :type cost: List[int] :rtype: int - def canCompleteCircuit1(self, gas, cost): :type gas: List[int] :type cost: List[...
472f780c3214aab5c713612812d834ccbe589434
<|skeleton|> class Solution: def canCompleteCircuit(self, gas, cost): """:type gas: List[int] :type cost: List[int] :rtype: int""" <|body_0|> def canCompleteCircuit1(self, gas, cost): """:type gas: List[int] :type cost: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def canCompleteCircuit(self, gas, cost): """:type gas: List[int] :type cost: List[int] :rtype: int""" if not gas: return False if not cost: return True n = gas.__len__() start = 0 cur = 0 iter = 0 while True: ...
the_stack_v2_python_sparse
4/134-Gas_Station.py
ChangXiaodong/Leetcode-solutions
train
4
a8075877ae5d01a6fc6e988ef44dd5ce3bb4cd56
[ "if not root:\n return []\nstack = [root]\narr = [root.val]\nwhile stack:\n node = stack.pop()\n arr.append(node.left.val if node.left else None)\n arr.append(node.right.val if node.right else None)\n if node.right:\n stack.append(node.right)\n if node.left:\n stack.append(node.left)...
<|body_start_0|> if not root: return [] stack = [root] arr = [root.val] while stack: node = stack.pop() arr.append(node.left.val if node.left else None) arr.append(node.right.val if node.right else None) if node.right: ...
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_36k_train_016326
2,575
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_018395
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:...
0bababf9d3930c8e1351e5a3ef908ea526608be2
<|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_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return [] stack = [root] arr = [root.val] while stack: node = stack.pop() arr.append(node.left.val if node.left e...
the_stack_v2_python_sparse
leetcode/树/二叉树的序列化和反序列化.py
LWZ7/algorithm
train
0
364a476317899eda3709d936233f29175071eaaa
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn BrowserSharedCookieHistory()", "from .browser_shared_cookie_source_environment import BrowserSharedCookieSourceEnvironment\nfrom .identity_set import IdentitySet\nfrom .browser_shared_cookie_source_environment import BrowserSharedCooki...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return BrowserSharedCookieHistory() <|end_body_0|> <|body_start_1|> from .browser_shared_cookie_source_environment import BrowserSharedCookieSourceEnvironment from .identity_set import Identity...
BrowserSharedCookieHistory
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BrowserSharedCookieHistory: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> BrowserSharedCookieHistory: """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...
stack_v2_sparse_classes_36k_train_016327
4,881
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: BrowserSharedCookieHistory", "name": "create_from_discriminator_value", "signature": "def create_from_discri...
3
stack_v2_sparse_classes_30k_train_001343
Implement the Python class `BrowserSharedCookieHistory` described below. Class description: Implement the BrowserSharedCookieHistory class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> BrowserSharedCookieHistory: Creates a new instance of the appropr...
Implement the Python class `BrowserSharedCookieHistory` described below. Class description: Implement the BrowserSharedCookieHistory class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> BrowserSharedCookieHistory: Creates a new instance of the appropr...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class BrowserSharedCookieHistory: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> BrowserSharedCookieHistory: """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...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BrowserSharedCookieHistory: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> BrowserSharedCookieHistory: """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 ob...
the_stack_v2_python_sparse
msgraph/generated/models/browser_shared_cookie_history.py
microsoftgraph/msgraph-sdk-python
train
135
828b995dff7e6938a3411aa97e8d64c8de3907e4
[ "self.mapper = {}\nself.names = []\nfor param in space:\n if param['name'] in self.names:\n raise ValueError('Duplicated name {}'.format(param['name']))\n self.names.append(param['name'])\n if param['type'] == TYPE.CATEGORICAL or param['type'] is TYPE.DISCRETE:\n self.mapper[param['name']] = ...
<|body_start_0|> self.mapper = {} self.names = [] for param in space: if param['name'] in self.names: raise ValueError('Duplicated name {}'.format(param['name'])) self.names.append(param['name']) if param['type'] == TYPE.CATEGORICAL or param['t...
Converter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Converter: def __init__(self, space): """Initialize the converter. Save the sequence of labels for keeping the same output and input order within the dict. Save the table used to convert the categorical and discrete parameters. Args: :param space: input space""" <|body_0|> d...
stack_v2_sparse_classes_36k_train_016328
10,066
no_license
[ { "docstring": "Initialize the converter. Save the sequence of labels for keeping the same output and input order within the dict. Save the table used to convert the categorical and discrete parameters. Args: :param space: input space", "name": "__init__", "signature": "def __init__(self, space)" }, ...
3
stack_v2_sparse_classes_30k_train_010574
Implement the Python class `Converter` described below. Class description: Implement the Converter class. Method signatures and docstrings: - def __init__(self, space): Initialize the converter. Save the sequence of labels for keeping the same output and input order within the dict. Save the table used to convert the...
Implement the Python class `Converter` described below. Class description: Implement the Converter class. Method signatures and docstrings: - def __init__(self, space): Initialize the converter. Save the sequence of labels for keeping the same output and input order within the dict. Save the table used to convert the...
27f861c09615aedfd96cffdebf7d9653f72b4d7b
<|skeleton|> class Converter: def __init__(self, space): """Initialize the converter. Save the sequence of labels for keeping the same output and input order within the dict. Save the table used to convert the categorical and discrete parameters. Args: :param space: input space""" <|body_0|> d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Converter: def __init__(self, space): """Initialize the converter. Save the sequence of labels for keeping the same output and input order within the dict. Save the table used to convert the categorical and discrete parameters. Args: :param space: input space""" self.mapper = {} self.n...
the_stack_v2_python_sparse
API/Algorithms/BayesianOptimization.py
AndreaCorsini1/Ahmet
train
1
a897d5354267cb455dd977be1e47b66840b34685
[ "def flatten_helper(node: TreeNode) -> None:\n left = node.left\n right = node.right\n if left:\n flatten_helper(left)\n node.left = None\n node.right = left\n if right:\n flatten_helper(right)\n if left:\n n = node.right\n while n:\n ...
<|body_start_0|> def flatten_helper(node: TreeNode) -> None: left = node.left right = node.right if left: flatten_helper(left) node.left = None node.right = left if right: flatten_helper(right) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def flatten_v1(self, root: TreeNode) -> None: """An in-order approach.""" <|body_0|> def flatten_v2(self, root: TreeNode) -> None: """Use a stack to change the priority of the links.""" <|body_1|> <|end_skeleton|> <|body_start_0|> def flat...
stack_v2_sparse_classes_36k_train_016329
2,701
no_license
[ { "docstring": "An in-order approach.", "name": "flatten_v1", "signature": "def flatten_v1(self, root: TreeNode) -> None" }, { "docstring": "Use a stack to change the priority of the links.", "name": "flatten_v2", "signature": "def flatten_v2(self, root: TreeNode) -> None" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def flatten_v1(self, root: TreeNode) -> None: An in-order approach. - def flatten_v2(self, root: TreeNode) -> None: Use a stack to change the priority of the links.
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def flatten_v1(self, root: TreeNode) -> None: An in-order approach. - def flatten_v2(self, root: TreeNode) -> None: Use a stack to change the priority of the links. <|skeleton|>...
97a2386f5e3adbd7138fd123810c3232bdf7f622
<|skeleton|> class Solution: def flatten_v1(self, root: TreeNode) -> None: """An in-order approach.""" <|body_0|> def flatten_v2(self, root: TreeNode) -> None: """Use a stack to change the priority of the links.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def flatten_v1(self, root: TreeNode) -> None: """An in-order approach.""" def flatten_helper(node: TreeNode) -> None: left = node.left right = node.right if left: flatten_helper(left) node.left = None ...
the_stack_v2_python_sparse
python3/trees_and_graphs/flatten_binary_tree_to_linked_list.py
victorchu/algorithms
train
0
f1fee2d533d9cfda0b03ba19ff00cf989b7c1732
[ "if not prices:\n return 0\nmax_profit, min_price = (0, prices[0])\nfor i in range(1, len(prices)):\n if prices[i] < min_price:\n min_price = prices[i]\n else:\n max_profit = max(max_profit, prices[i] - min_price)\nreturn max_profit", "max_profit, max_curr = (0, 0)\nfor i in range(1, len(pr...
<|body_start_0|> if not prices: return 0 max_profit, min_price = (0, prices[0]) for i in range(1, len(prices)): if prices[i] < min_price: min_price = prices[i] else: max_profit = max(max_profit, prices[i] - min_price) re...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit_MK1(self, prices: List[int]) -> int: """Solution.md Approach 2: One pass Time complexity: O(n) Space complexity: O(1)""" <|body_0|> def maxProfit_MK2(self, prices: List[int]) -> int: """My solution. Time complexity: O(n). Space complexity: O(1...
stack_v2_sparse_classes_36k_train_016330
1,295
no_license
[ { "docstring": "Solution.md Approach 2: One pass Time complexity: O(n) Space complexity: O(1)", "name": "maxProfit_MK1", "signature": "def maxProfit_MK1(self, prices: List[int]) -> int" }, { "docstring": "My solution. Time complexity: O(n). Space complexity: O(1). Calculate the difference array ...
2
stack_v2_sparse_classes_30k_train_015114
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit_MK1(self, prices: List[int]) -> int: Solution.md Approach 2: One pass Time complexity: O(n) Space complexity: O(1) - def maxProfit_MK2(self, prices: List[int]) -> i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit_MK1(self, prices: List[int]) -> int: Solution.md Approach 2: One pass Time complexity: O(n) Space complexity: O(1) - def maxProfit_MK2(self, prices: List[int]) -> i...
d7ba416d22becfa8f2a2ae4eee04c86617cd9332
<|skeleton|> class Solution: def maxProfit_MK1(self, prices: List[int]) -> int: """Solution.md Approach 2: One pass Time complexity: O(n) Space complexity: O(1)""" <|body_0|> def maxProfit_MK2(self, prices: List[int]) -> int: """My solution. Time complexity: O(n). Space complexity: O(1...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit_MK1(self, prices: List[int]) -> int: """Solution.md Approach 2: One pass Time complexity: O(n) Space complexity: O(1)""" if not prices: return 0 max_profit, min_price = (0, prices[0]) for i in range(1, len(prices)): if prices[i] <...
the_stack_v2_python_sparse
0121. Best Time to Buy and Sell Stock/Solution.py
faterazer/LeetCode
train
4
e4eda1a37903139fa2a3d3ae9e6c4813052ef369
[ "nums, result, i = (sorted(nums), [], 0)\nwhile i < len(nums) - 2:\n if i == 0 or nums[i] != nums[i - 1]:\n j, k = (i + 1, len(nums) - 1)\n while j < k:\n if nums[i] + nums[j] + nums[k] < 0:\n j += 1\n elif nums[i] + nums[j] + nums[k] > 0:\n k -= ...
<|body_start_0|> nums, result, i = (sorted(nums), [], 0) while i < len(nums) - 2: if i == 0 or nums[i] != nums[i - 1]: j, k = (i + 1, len(nums) - 1) while j < k: if nums[i] + nums[j] + nums[k] < 0: j += 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def threeSum(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def threeSum2(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> nums, result, i = (sorted(...
stack_v2_sparse_classes_36k_train_016331
12,022
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "threeSum", "signature": "def threeSum(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "threeSum2", "signature": "def threeSum2(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_003871
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeSum(self, nums): :type nums: List[int] :rtype: List[List[int]] - def threeSum2(self, nums): :type nums: List[int] :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeSum(self, nums): :type nums: List[int] :rtype: List[List[int]] - def threeSum2(self, nums): :type nums: List[int] :rtype: List[List[int]] <|skeleton|> class Solution: ...
035ef08434fa1ca781a6fb2f9eed3538b7d20c02
<|skeleton|> class Solution: def threeSum(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def threeSum2(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def threeSum(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" nums, result, i = (sorted(nums), [], 0) while i < len(nums) - 2: if i == 0 or nums[i] != nums[i - 1]: j, k = (i + 1, len(nums) - 1) while j < k: ...
the_stack_v2_python_sparse
leetcode_python/Array/3sum.py
yennanliu/CS_basics
train
64
2c1ce9b33fc0b7ac96c0e683692982322e64f2ae
[ "q = quantity.Temperature(1.0, 'K')\nself.assertAlmostEqual(q.value, 1.0, 6)\nself.assertAlmostEqual(q.value_si, 1.0, delta=1e-06)\nself.assertEqual(q.units, 'K')", "q = quantity.Temperature(1.0, 'degC')\nself.assertAlmostEqual(q.value, 1.0, 6)\nself.assertAlmostEqual(q.value_si, 1.0, delta=1e-06)\nself.assertEqu...
<|body_start_0|> q = quantity.Temperature(1.0, 'K') self.assertAlmostEqual(q.value, 1.0, 6) self.assertAlmostEqual(q.value_si, 1.0, delta=1e-06) self.assertEqual(q.units, 'K') <|end_body_0|> <|body_start_1|> q = quantity.Temperature(1.0, 'degC') self.assertAlmostEqual(q....
Contains unit tests of the Temperature unit type object.
TestTemperature
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestTemperature: """Contains unit tests of the Temperature unit type object.""" def test_K(self): """Test the creation of a temperature quantity with units of K.""" <|body_0|> def test_degC(self): """Test the creation of a temperature quantity with units of degre...
stack_v2_sparse_classes_36k_train_016332
33,010
permissive
[ { "docstring": "Test the creation of a temperature quantity with units of K.", "name": "test_K", "signature": "def test_K(self)" }, { "docstring": "Test the creation of a temperature quantity with units of degrees C.", "name": "test_degC", "signature": "def test_degC(self)" }, { ...
4
stack_v2_sparse_classes_30k_train_019531
Implement the Python class `TestTemperature` described below. Class description: Contains unit tests of the Temperature unit type object. Method signatures and docstrings: - def test_K(self): Test the creation of a temperature quantity with units of K. - def test_degC(self): Test the creation of a temperature quantit...
Implement the Python class `TestTemperature` described below. Class description: Contains unit tests of the Temperature unit type object. Method signatures and docstrings: - def test_K(self): Test the creation of a temperature quantity with units of K. - def test_degC(self): Test the creation of a temperature quantit...
0937b2e0a955dcf21b79674a4e89f43941c0dd85
<|skeleton|> class TestTemperature: """Contains unit tests of the Temperature unit type object.""" def test_K(self): """Test the creation of a temperature quantity with units of K.""" <|body_0|> def test_degC(self): """Test the creation of a temperature quantity with units of degre...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestTemperature: """Contains unit tests of the Temperature unit type object.""" def test_K(self): """Test the creation of a temperature quantity with units of K.""" q = quantity.Temperature(1.0, 'K') self.assertAlmostEqual(q.value, 1.0, 6) self.assertAlmostEqual(q.value_si...
the_stack_v2_python_sparse
rmgpy/quantityTest.py
vrlambert/RMG-Py
train
1
2d62befb86fa8a30aa023553a2e5d8b05cdd7a99
[ "self.retry_policy = retry_policy\nself._num_tries = 0\nself._deadline = time.time() + retry_policy.timeout.total_seconds()\nself._delay = None", "def CheckRetry():\n \"\"\"Retry should be attempted if the result inspector function exists and returns true.\"\"\"\n return self.retry_policy.check_result and s...
<|body_start_0|> self.retry_policy = retry_policy self._num_tries = 0 self._deadline = time.time() + retry_policy.timeout.total_seconds() self._delay = None <|end_body_0|> <|body_start_1|> def CheckRetry(): """Retry should be attempted if the result inspector functio...
For each kind of RetryPolicy, there should be a corresponding RetryManager which tracks the retry progress of a particular operation. The CallWithRetryAsync function will call CreateManager on the RetryPolicy instance in order to get a manager that it can use to track the progress of retries by calling the DoRetry meth...
RetryManager
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RetryManager: """For each kind of RetryPolicy, there should be a corresponding RetryManager which tracks the retry progress of a particular operation. The CallWithRetryAsync function will call CreateManager on the RetryPolicy instance in order to get a manager that it can use to track the progres...
stack_v2_sparse_classes_36k_train_016333
13,356
permissive
[ { "docstring": "Create a RetryManager that is capable of tracking properties defined in the RetryPolicy base class. This involves tracking the number of tries attempted so far, along with whether the timeout deadline has been exceeded.", "name": "__init__", "signature": "def __init__(self, retry_policy)...
4
null
Implement the Python class `RetryManager` described below. Class description: For each kind of RetryPolicy, there should be a corresponding RetryManager which tracks the retry progress of a particular operation. The CallWithRetryAsync function will call CreateManager on the RetryPolicy instance in order to get a manag...
Implement the Python class `RetryManager` described below. Class description: For each kind of RetryPolicy, there should be a corresponding RetryManager which tracks the retry progress of a particular operation. The CallWithRetryAsync function will call CreateManager on the RetryPolicy instance in order to get a manag...
992209086d01be0ef6506f325cf89b84d374f969
<|skeleton|> class RetryManager: """For each kind of RetryPolicy, there should be a corresponding RetryManager which tracks the retry progress of a particular operation. The CallWithRetryAsync function will call CreateManager on the RetryPolicy instance in order to get a manager that it can use to track the progres...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RetryManager: """For each kind of RetryPolicy, there should be a corresponding RetryManager which tracks the retry progress of a particular operation. The CallWithRetryAsync function will call CreateManager on the RetryPolicy instance in order to get a manager that it can use to track the progress of retries ...
the_stack_v2_python_sparse
backend/base/retry.py
xuantan/viewfinder
train
0
83985e7afb400526472f3f68a35658cef5c1cafe
[ "self.failfast = failfast\nif stdout is None:\n stdout = sys.stdout\nself.stdout = stdout\nself.tb_locals = tb_locals", "test_ids, _ = list_test(test)\nfor test_id in test_ids:\n self.stdout.write('%s\\n' % test_id)\nerrors = loader.errors\nif errors:\n for test_id in errors:\n self.stdout.write('...
<|body_start_0|> self.failfast = failfast if stdout is None: stdout = sys.stdout self.stdout = stdout self.tb_locals = tb_locals <|end_body_0|> <|body_start_1|> test_ids, _ = list_test(test) for test_id in test_ids: self.stdout.write('%s\n' % test...
A thunk object to support unittest.TestProgram.
TestToolsTestRunner
[ "LicenseRef-scancode-ssleay", "MIT", "BSD-3-Clause", "LicenseRef-scancode-openssl", "LicenseRef-scancode-ssleay-windows", "LicenseRef-scancode-pcre", "LicenseRef-scancode-public-domain", "Zlib", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestToolsTestRunner: """A thunk object to support unittest.TestProgram.""" def __init__(self, verbosity=None, failfast=None, buffer=None, stdout=None, tb_locals=False, **kwargs): """Create a TestToolsTestRunner. :param verbosity: Ignored. :param failfast: Stop running tests at the fi...
stack_v2_sparse_classes_36k_train_016334
10,141
permissive
[ { "docstring": "Create a TestToolsTestRunner. :param verbosity: Ignored. :param failfast: Stop running tests at the first failure. :param buffer: Ignored. :param stdout: Stream to use for stdout. :param tb_locals: If True include local variables in tracebacks.", "name": "__init__", "signature": "def __i...
3
stack_v2_sparse_classes_30k_train_004556
Implement the Python class `TestToolsTestRunner` described below. Class description: A thunk object to support unittest.TestProgram. Method signatures and docstrings: - def __init__(self, verbosity=None, failfast=None, buffer=None, stdout=None, tb_locals=False, **kwargs): Create a TestToolsTestRunner. :param verbosit...
Implement the Python class `TestToolsTestRunner` described below. Class description: A thunk object to support unittest.TestProgram. Method signatures and docstrings: - def __init__(self, verbosity=None, failfast=None, buffer=None, stdout=None, tb_locals=False, **kwargs): Create a TestToolsTestRunner. :param verbosit...
bfbb9d7526020eda1788a0ed24f2be3c8be5c1c3
<|skeleton|> class TestToolsTestRunner: """A thunk object to support unittest.TestProgram.""" def __init__(self, verbosity=None, failfast=None, buffer=None, stdout=None, tb_locals=False, **kwargs): """Create a TestToolsTestRunner. :param verbosity: Ignored. :param failfast: Stop running tests at the fi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestToolsTestRunner: """A thunk object to support unittest.TestProgram.""" def __init__(self, verbosity=None, failfast=None, buffer=None, stdout=None, tb_locals=False, **kwargs): """Create a TestToolsTestRunner. :param verbosity: Ignored. :param failfast: Stop running tests at the first failure. ...
the_stack_v2_python_sparse
openresty-win32-build/thirdparty/x86/pgsql/pgAdmin 4/venv/Lib/site-packages/testtools/run.py
nneesshh/openresty-oss
train
1
250e240fb9d01d38df515cbdd3309ca0457828d7
[ "ans = collections.defaultdict(list)\nfor s in strs:\n ans[tuple(sorted(s))].append(s)\nreturn list(ans.values())", "ans = dict()\nfor s in strs:\n k = tuple(sorted(s))\n ans.setdefault(k, [])\n ans[k].append(s)\nreturn list(ans.values())" ]
<|body_start_0|> ans = collections.defaultdict(list) for s in strs: ans[tuple(sorted(s))].append(s) return list(ans.values()) <|end_body_0|> <|body_start_1|> ans = dict() for s in strs: k = tuple(sorted(s)) ans.setdefault(k, []) an...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def groupAnagrams(self, strs): """:type strs: List[str] :rtype: List[List[str]]""" <|body_0|> def groupAnagrams1(self, strs): """:type strs: List[str] :rtype: List[List[str]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> ans = collection...
stack_v2_sparse_classes_36k_train_016335
1,391
no_license
[ { "docstring": ":type strs: List[str] :rtype: List[List[str]]", "name": "groupAnagrams", "signature": "def groupAnagrams(self, strs)" }, { "docstring": ":type strs: List[str] :rtype: List[List[str]]", "name": "groupAnagrams1", "signature": "def groupAnagrams1(self, strs)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def groupAnagrams(self, strs): :type strs: List[str] :rtype: List[List[str]] - def groupAnagrams1(self, strs): :type strs: List[str] :rtype: List[List[str]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def groupAnagrams(self, strs): :type strs: List[str] :rtype: List[List[str]] - def groupAnagrams1(self, strs): :type strs: List[str] :rtype: List[List[str]] <|skeleton|> class S...
c55b0cfd2967a2221c27ed738e8de15034775945
<|skeleton|> class Solution: def groupAnagrams(self, strs): """:type strs: List[str] :rtype: List[List[str]]""" <|body_0|> def groupAnagrams1(self, strs): """:type strs: List[str] :rtype: List[List[str]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def groupAnagrams(self, strs): """:type strs: List[str] :rtype: List[List[str]]""" ans = collections.defaultdict(list) for s in strs: ans[tuple(sorted(s))].append(s) return list(ans.values()) def groupAnagrams1(self, strs): """:type strs: List...
the_stack_v2_python_sparse
PycharmProjects/leetcode/Find/GroupAnagrams49.py
crystal30/DataStructure
train
0
b05106301dce384b8be5d32dc623e6dea68122c7
[ "try:\n desc = '{:.1f}'.format(self.ct_user / self.count * 100)\nexcept ZeroDivisionError:\n desc = '-'\nreturn desc", "try:\n ms = round(self.ms_use / self.count)\nexcept ZeroDivisionError:\n ms = 0\nreturn ms" ]
<|body_start_0|> try: desc = '{:.1f}'.format(self.ct_user / self.count * 100) except ZeroDivisionError: desc = '-' return desc <|end_body_0|> <|body_start_1|> try: ms = round(self.ms_use / self.count) except ZeroDivisionError: ms =...
请求统计
APIReqCount
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class APIReqCount: """请求统计""" def rate_auth(self): """登录用户比例(%)""" <|body_0|> def ms_avg(self): """平均响应时长(ms),向偶取整""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: desc = '{:.1f}'.format(self.ct_user / self.count * 100) except ...
stack_v2_sparse_classes_36k_train_016336
2,575
no_license
[ { "docstring": "登录用户比例(%)", "name": "rate_auth", "signature": "def rate_auth(self)" }, { "docstring": "平均响应时长(ms),向偶取整", "name": "ms_avg", "signature": "def ms_avg(self)" } ]
2
null
Implement the Python class `APIReqCount` described below. Class description: 请求统计 Method signatures and docstrings: - def rate_auth(self): 登录用户比例(%) - def ms_avg(self): 平均响应时长(ms),向偶取整
Implement the Python class `APIReqCount` described below. Class description: 请求统计 Method signatures and docstrings: - def rate_auth(self): 登录用户比例(%) - def ms_avg(self): 平均响应时长(ms),向偶取整 <|skeleton|> class APIReqCount: """请求统计""" def rate_auth(self): """登录用户比例(%)""" <|body_0|> def ms_avg(...
b7ed6588e13d2916a4162d56509d2794742a1eb1
<|skeleton|> class APIReqCount: """请求统计""" def rate_auth(self): """登录用户比例(%)""" <|body_0|> def ms_avg(self): """平均响应时长(ms),向偶取整""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class APIReqCount: """请求统计""" def rate_auth(self): """登录用户比例(%)""" try: desc = '{:.1f}'.format(self.ct_user / self.count * 100) except ZeroDivisionError: desc = '-' return desc def ms_avg(self): """平均响应时长(ms),向偶取整""" try: ...
the_stack_v2_python_sparse
server/applibs/monitor/models/api_count.py
fanshuai/kubrick
train
0
2167229670a02f19927d325dc825a3746729c379
[ "set_parser_epilog(subparser, epilog=' Example:\\n\\n manage.py kinesis disable-events --clusters corp prod\\n ')\nactions = ['disable-events', 'enable-events']\nsubparser.add_argument('action', metavar='ACTION', choices=actions, help='One of the following actions to...
<|body_start_0|> set_parser_epilog(subparser, epilog=' Example:\n\n manage.py kinesis disable-events --clusters corp prod\n ') actions = ['disable-events', 'enable-events'] subparser.add_argument('action', metavar='ACTION', choices=actions, help='...
KinesisCommand
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KinesisCommand: def setup_subparser(cls, subparser): """Add kinesis subparser: manage.py kinesis [options]""" <|body_0|> def handler(cls, options, config): """Main handler for the Kinesis parser Args: options (argparse.Namespace): Parsed arguments config (CLIConfig):...
stack_v2_sparse_classes_36k_train_016337
2,966
permissive
[ { "docstring": "Add kinesis subparser: manage.py kinesis [options]", "name": "setup_subparser", "signature": "def setup_subparser(cls, subparser)" }, { "docstring": "Main handler for the Kinesis parser Args: options (argparse.Namespace): Parsed arguments config (CLIConfig): Loaded StreamAlert co...
2
stack_v2_sparse_classes_30k_train_000662
Implement the Python class `KinesisCommand` described below. Class description: Implement the KinesisCommand class. Method signatures and docstrings: - def setup_subparser(cls, subparser): Add kinesis subparser: manage.py kinesis [options] - def handler(cls, options, config): Main handler for the Kinesis parser Args:...
Implement the Python class `KinesisCommand` described below. Class description: Implement the KinesisCommand class. Method signatures and docstrings: - def setup_subparser(cls, subparser): Add kinesis subparser: manage.py kinesis [options] - def handler(cls, options, config): Main handler for the Kinesis parser Args:...
75ba140d2e1aa6e903313d88326920adcb8bff45
<|skeleton|> class KinesisCommand: def setup_subparser(cls, subparser): """Add kinesis subparser: manage.py kinesis [options]""" <|body_0|> def handler(cls, options, config): """Main handler for the Kinesis parser Args: options (argparse.Namespace): Parsed arguments config (CLIConfig):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KinesisCommand: def setup_subparser(cls, subparser): """Add kinesis subparser: manage.py kinesis [options]""" set_parser_epilog(subparser, epilog=' Example:\n\n manage.py kinesis disable-events --clusters corp prod\n ') actions = ['disab...
the_stack_v2_python_sparse
streamalert_cli/kinesis/handler.py
avmi/streamalert
train
0
c3e0693519927f65a5379846fd17d7bf26ffc358
[ "try:\n infos = self.manager.client.get_account_info()\nexcept ConnectionError:\n self.manager.warn('Could not connect to server', title='Error', callback=self.manager.main_screen)\nelse:\n self.username = infos['username']\n self.color = infos['color']", "self.button_change_parameters.disabled = True...
<|body_start_0|> try: infos = self.manager.client.get_account_info() except ConnectionError: self.manager.warn('Could not connect to server', title='Error', callback=self.manager.main_screen) else: self.username = infos['username'] self.color = inf...
The player parameters screen
ParametersScreen
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ParametersScreen: """The player parameters screen""" def on_enter(self, *args): """fetches account information from the server on enter :param args: additional arguments""" <|body_0|> def validate_parameters(self): """modification parameters user account for the ...
stack_v2_sparse_classes_36k_train_016338
3,017
no_license
[ { "docstring": "fetches account information from the server on enter :param args: additional arguments", "name": "on_enter", "signature": "def on_enter(self, *args)" }, { "docstring": "modification parameters user account for the specified user", "name": "validate_parameters", "signature...
3
stack_v2_sparse_classes_30k_train_019834
Implement the Python class `ParametersScreen` described below. Class description: The player parameters screen Method signatures and docstrings: - def on_enter(self, *args): fetches account information from the server on enter :param args: additional arguments - def validate_parameters(self): modification parameters ...
Implement the Python class `ParametersScreen` described below. Class description: The player parameters screen Method signatures and docstrings: - def on_enter(self, *args): fetches account information from the server on enter :param args: additional arguments - def validate_parameters(self): modification parameters ...
838eacfcf446d2de9cc1c7fed13c3cd2fd940517
<|skeleton|> class ParametersScreen: """The player parameters screen""" def on_enter(self, *args): """fetches account information from the server on enter :param args: additional arguments""" <|body_0|> def validate_parameters(self): """modification parameters user account for the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ParametersScreen: """The player parameters screen""" def on_enter(self, *args): """fetches account information from the server on enter :param args: additional arguments""" try: infos = self.manager.client.get_account_info() except ConnectionError: self.man...
the_stack_v2_python_sparse
frontend/phagocyte_frontend/views/screens/parameters.py
BenjaminSchubert/HEIG_2016_GEN_project
train
0
5e41fd0e70cd2e73f65b5541c5d7186e6043af6a
[ "begin, end, res = (0, 0, [])\npStillNeed = collections.Counter(p)\ncounter = len(pStillNeed)\nwhile end < len(s):\n c = s[end]\n if c in pStillNeed:\n pStillNeed[c] -= 1\n if pStillNeed[c] == 0:\n counter -= 1\n end += 1\n while counter == 0:\n tempc = s[begin]\n ...
<|body_start_0|> begin, end, res = (0, 0, []) pStillNeed = collections.Counter(p) counter = len(pStillNeed) while end < len(s): c = s[end] if c in pStillNeed: pStillNeed[c] -= 1 if pStillNeed[c] == 0: counter -= ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findAnagrams(self, s, p): """:type s: str :type p: str :rtype: List[int]""" <|body_0|> def findAnagramsSlidingWindow(self, s, p): """:type s: str :type p: str :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> begin, end...
stack_v2_sparse_classes_36k_train_016339
2,550
no_license
[ { "docstring": ":type s: str :type p: str :rtype: List[int]", "name": "findAnagrams", "signature": "def findAnagrams(self, s, p)" }, { "docstring": ":type s: str :type p: str :rtype: List[int]", "name": "findAnagramsSlidingWindow", "signature": "def findAnagramsSlidingWindow(self, s, p)"...
2
stack_v2_sparse_classes_30k_train_013330
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findAnagrams(self, s, p): :type s: str :type p: str :rtype: List[int] - def findAnagramsSlidingWindow(self, s, p): :type s: str :type p: str :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findAnagrams(self, s, p): :type s: str :type p: str :rtype: List[int] - def findAnagramsSlidingWindow(self, s, p): :type s: str :type p: str :rtype: List[int] <|skeleton|> c...
7fa160362ebb58e7286b490012542baa2d51e5c9
<|skeleton|> class Solution: def findAnagrams(self, s, p): """:type s: str :type p: str :rtype: List[int]""" <|body_0|> def findAnagramsSlidingWindow(self, s, p): """:type s: str :type p: str :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findAnagrams(self, s, p): """:type s: str :type p: str :rtype: List[int]""" begin, end, res = (0, 0, []) pStillNeed = collections.Counter(p) counter = len(pStillNeed) while end < len(s): c = s[end] if c in pStillNeed: ...
the_stack_v2_python_sparse
substring/find_all_anagrams_in_string.py
gerrycfchang/leetcode-python
train
2
bf00ce1e33433502a6f1d614583fd9f0469545e3
[ "\"\"\"\n Idea:\n 1. l < r , progressing l or r base on which one is shorter.\n 2. Reason? because the higher one would definitely cover the\n lower one's volume.\n \"\"\"\n'\\n int trap(vector<int>& height) {\\n int l = 0, r = height.size()-1, level = 0, wat...
<|body_start_0|> """ Idea: 1. l < r , progressing l or r base on which one is shorter. 2. Reason? because the higher one would definitely cover the lower one's volume. """ '\n int trap(vector<int>& height) {\n ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def trap(self, height): """:type height: List[int] :rtype: int""" <|body_0|> def rewrite(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> """ Idea: 1. l <...
stack_v2_sparse_classes_36k_train_016340
2,464
no_license
[ { "docstring": ":type height: List[int] :rtype: int", "name": "trap", "signature": "def trap(self, height)" }, { "docstring": ":type height: List[int] :rtype: int", "name": "rewrite", "signature": "def rewrite(self, height)" } ]
2
stack_v2_sparse_classes_30k_train_012948
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def trap(self, height): :type height: List[int] :rtype: int - def rewrite(self, height): :type height: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def trap(self, height): :type height: List[int] :rtype: int - def rewrite(self, height): :type height: List[int] :rtype: int <|skeleton|> class Solution: def trap(self, hei...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def trap(self, height): """:type height: List[int] :rtype: int""" <|body_0|> def rewrite(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def trap(self, height): """:type height: List[int] :rtype: int""" """ Idea: 1. l < r , progressing l or r base on which one is shorter. 2. Reason? because the higher one would definitely cover the lower one's volume....
the_stack_v2_python_sparse
co_apple/42_Trapping_Rain_Water.py
vsdrun/lc_public
train
6
0eadfbfa1e83c474a949ac72b99f3851e324c0f4
[ "targets = (app_engine_http_target, http_target)\nif sum([1 if x is not None else 0 for x in targets]) > 1:\n raise CreatingHttpAndAppEngineQueueError('Attempting to send multiple queue target types simultaneously: {} , {}'.format(six.text_type(app_engine_http_target), six.text_type(http_target)))\ntargets = (pu...
<|body_start_0|> targets = (app_engine_http_target, http_target) if sum([1 if x is not None else 0 for x in targets]) > 1: raise CreatingHttpAndAppEngineQueueError('Attempting to send multiple queue target types simultaneously: {} , {}'.format(six.text_type(app_engine_http_target), six.text_...
Client for queues service in the Cloud Tasks API.
AlphaQueues
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlphaQueues: """Client for queues service in the Cloud Tasks API.""" def Create(self, parent_ref, queue_ref, retry_config=None, rate_limits=None, pull_target=None, app_engine_http_target=None, http_target=None): """Prepares and sends a Create request for creating a queue.""" ...
stack_v2_sparse_classes_36k_train_016341
19,528
permissive
[ { "docstring": "Prepares and sends a Create request for creating a queue.", "name": "Create", "signature": "def Create(self, parent_ref, queue_ref, retry_config=None, rate_limits=None, pull_target=None, app_engine_http_target=None, http_target=None)" }, { "docstring": "Prepares and sends a Patch...
2
stack_v2_sparse_classes_30k_train_021502
Implement the Python class `AlphaQueues` described below. Class description: Client for queues service in the Cloud Tasks API. Method signatures and docstrings: - def Create(self, parent_ref, queue_ref, retry_config=None, rate_limits=None, pull_target=None, app_engine_http_target=None, http_target=None): Prepares and...
Implement the Python class `AlphaQueues` described below. Class description: Client for queues service in the Cloud Tasks API. Method signatures and docstrings: - def Create(self, parent_ref, queue_ref, retry_config=None, rate_limits=None, pull_target=None, app_engine_http_target=None, http_target=None): Prepares and...
392abf004b16203030e6efd2f0af24db7c8d669e
<|skeleton|> class AlphaQueues: """Client for queues service in the Cloud Tasks API.""" def Create(self, parent_ref, queue_ref, retry_config=None, rate_limits=None, pull_target=None, app_engine_http_target=None, http_target=None): """Prepares and sends a Create request for creating a queue.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AlphaQueues: """Client for queues service in the Cloud Tasks API.""" def Create(self, parent_ref, queue_ref, retry_config=None, rate_limits=None, pull_target=None, app_engine_http_target=None, http_target=None): """Prepares and sends a Create request for creating a queue.""" targets = (ap...
the_stack_v2_python_sparse
lib/googlecloudsdk/api_lib/tasks/queues.py
google-cloud-sdk-unofficial/google-cloud-sdk
train
9
dfb534e679aefc3d0c72db6f4fed1bfd8ef8cade
[ "for inv in self:\n if inv.company_id.lines_invoice < 1:\n raise exceptions.except_orm(_('Error !'), _('Please set an invoice lines value in:\\nAdministration->Company->Configuration->Invoice lines'))\n if inv.type in ['out_invoice', 'out_refund']:\n if len(inv.invoice_line) > inv.company_id.lin...
<|body_start_0|> for inv in self: if inv.company_id.lines_invoice < 1: raise exceptions.except_orm(_('Error !'), _('Please set an invoice lines value in:\nAdministration->Company->Configuration->Invoice lines')) if inv.type in ['out_invoice', 'out_refund']: ...
AccountInvoice
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccountInvoice: def split_invoice(self): """Split the invoice when the lines exceed the maximum set for the company""" <|body_0|> def action_date_assign(self): """Return assigned dat""" <|body_1|> <|end_skeleton|> <|body_start_0|> for inv in self: ...
stack_v2_sparse_classes_36k_train_016342
3,700
no_license
[ { "docstring": "Split the invoice when the lines exceed the maximum set for the company", "name": "split_invoice", "signature": "def split_invoice(self)" }, { "docstring": "Return assigned dat", "name": "action_date_assign", "signature": "def action_date_assign(self)" } ]
2
null
Implement the Python class `AccountInvoice` described below. Class description: Implement the AccountInvoice class. Method signatures and docstrings: - def split_invoice(self): Split the invoice when the lines exceed the maximum set for the company - def action_date_assign(self): Return assigned dat
Implement the Python class `AccountInvoice` described below. Class description: Implement the AccountInvoice class. Method signatures and docstrings: - def split_invoice(self): Split the invoice when the lines exceed the maximum set for the company - def action_date_assign(self): Return assigned dat <|skeleton|> cla...
718327d01e5b4408add58682c5ad1901fa35b450
<|skeleton|> class AccountInvoice: def split_invoice(self): """Split the invoice when the lines exceed the maximum set for the company""" <|body_0|> def action_date_assign(self): """Return assigned dat""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AccountInvoice: def split_invoice(self): """Split the invoice when the lines exceed the maximum set for the company""" for inv in self: if inv.company_id.lines_invoice < 1: raise exceptions.except_orm(_('Error !'), _('Please set an invoice lines value in:\nAdministr...
the_stack_v2_python_sparse
l10n_ve_split_invoice/model/invoice.py
Vauxoo/odoo-venezuela
train
15
c0691d01912cda3d8372186aef59c9af810ce174
[ "self.packages: str = cli_args.packages\nself.host: str = cli_args.host\nself.env: EnvType = EnvType[cli_args.env]\nself.group: str = cli_args.group\nself.name: str = cli_args.name", "parser.add_argument('--packages', '-p', nargs='+', required=True, help='Generate schema from provided packages')\nparser.add_argum...
<|body_start_0|> self.packages: str = cli_args.packages self.host: str = cli_args.host self.env: EnvType = EnvType[cli_args.env] self.group: str = cli_args.group self.name: str = cli_args.name <|end_body_0|> <|body_start_1|> parser.add_argument('--packages', '-p', nargs=...
Command to write packages schema to specified data source
SchemaCommand
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SchemaCommand: """Command to write packages schema to specified data source""" def __init__(self, cli_args): """Init schema command from parsed CLI args.""" <|body_0|> def add_arguments(cls, parser): """Add arguments to parser.""" <|body_1|> def exec...
stack_v2_sparse_classes_36k_train_016343
3,525
permissive
[ { "docstring": "Init schema command from parsed CLI args.", "name": "__init__", "signature": "def __init__(self, cli_args)" }, { "docstring": "Add arguments to parser.", "name": "add_arguments", "signature": "def add_arguments(cls, parser)" }, { "docstring": "Generate declaration...
3
stack_v2_sparse_classes_30k_train_013727
Implement the Python class `SchemaCommand` described below. Class description: Command to write packages schema to specified data source Method signatures and docstrings: - def __init__(self, cli_args): Init schema command from parsed CLI args. - def add_arguments(cls, parser): Add arguments to parser. - def execute(...
Implement the Python class `SchemaCommand` described below. Class description: Command to write packages schema to specified data source Method signatures and docstrings: - def __init__(self, cli_args): Init schema command from parsed CLI args. - def add_arguments(cls, parser): Add arguments to parser. - def execute(...
40113ddfb68e62d98b880b3c7427db5cc9fbd8cd
<|skeleton|> class SchemaCommand: """Command to write packages schema to specified data source""" def __init__(self, cli_args): """Init schema command from parsed CLI args.""" <|body_0|> def add_arguments(cls, parser): """Add arguments to parser.""" <|body_1|> def exec...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SchemaCommand: """Command to write packages schema to specified data source""" def __init__(self, cli_args): """Init schema command from parsed CLI args.""" self.packages: str = cli_args.packages self.host: str = cli_args.host self.env: EnvType = EnvType[cli_args.env] ...
the_stack_v2_python_sparse
py/datacentric/commands/schema.py
datacentricorg/datacentric-py
train
1
34001651f4c638af91830bc6d4e6c92a7c4e1fe6
[ "self.lists = [v1, v2]\nself.num_lists = 2\nself.cur_row = None\nself.cur_col = None", "if self.cur_row is None:\n for row in range(self.num_lists):\n if self.lists[row]:\n self.cur_row = row\n self.cur_col = 0\n break\n return self.lists[self.cur_row][0]\nfor row in ...
<|body_start_0|> self.lists = [v1, v2] self.num_lists = 2 self.cur_row = None self.cur_col = None <|end_body_0|> <|body_start_1|> if self.cur_row is None: for row in range(self.num_lists): if self.lists[row]: self.cur_row = row ...
ZigzagIterator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZigzagIterator: def __init__(self, v1, v2): """Initialize your data structure here. :type v1: List[int] :type v2: List[int]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end...
stack_v2_sparse_classes_36k_train_016344
1,967
no_license
[ { "docstring": "Initialize your data structure here. :type v1: List[int] :type v2: List[int]", "name": "__init__", "signature": "def __init__(self, v1, v2)" }, { "docstring": ":rtype: int", "name": "next", "signature": "def next(self)" }, { "docstring": ":rtype: bool", "name"...
3
stack_v2_sparse_classes_30k_val_000171
Implement the Python class `ZigzagIterator` described below. Class description: Implement the ZigzagIterator class. Method signatures and docstrings: - def __init__(self, v1, v2): Initialize your data structure here. :type v1: List[int] :type v2: List[int] - def next(self): :rtype: int - def hasNext(self): :rtype: bo...
Implement the Python class `ZigzagIterator` described below. Class description: Implement the ZigzagIterator class. Method signatures and docstrings: - def __init__(self, v1, v2): Initialize your data structure here. :type v1: List[int] :type v2: List[int] - def next(self): :rtype: int - def hasNext(self): :rtype: bo...
16468a4397430b24b685cab02570ff3f5849e86f
<|skeleton|> class ZigzagIterator: def __init__(self, v1, v2): """Initialize your data structure here. :type v1: List[int] :type v2: List[int]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ZigzagIterator: def __init__(self, v1, v2): """Initialize your data structure here. :type v1: List[int] :type v2: List[int]""" self.lists = [v1, v2] self.num_lists = 2 self.cur_row = None self.cur_col = None def next(self): """:rtype: int""" if self...
the_stack_v2_python_sparse
zig-zag-iterator/s1.py
fingerroll/wip
train
0
f386695260a7b5744d9d7c1c2b9f28a99046498b
[ "parameters |= {PARAM_PUMP_SPEED_HEATING_MEDIUM}\nsuper().__init__(system, parameters)\nself._climate = climate\nself._status = 'DONE'\nself._attr_hvac_action = HVACAction.IDLE\nself._attr_hvac_mode = HVACMode.HEAT\nself._attr_hvac_modes = [HVACMode.HEAT_COOL, HVACMode.HEAT, HVACMode.COOL]\nself._attr_name = climat...
<|body_start_0|> parameters |= {PARAM_PUMP_SPEED_HEATING_MEDIUM} super().__init__(system, parameters) self._climate = climate self._status = 'DONE' self._attr_hvac_action = HVACAction.IDLE self._attr_hvac_mode = HVACMode.HEAT self._attr_hvac_modes = [HVACMode.HEAT...
Base class for nibe climate entities.
NibeClimate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NibeClimate: """Base class for nibe climate entities.""" def __init__(self, system: NibeSystem, climate: ClimateSystem, parameters: set[ParameterId | None]): """Init.""" <|body_0|> def extra_state_attributes(self): """Extra state attributes.""" <|body_1|>...
stack_v2_sparse_classes_36k_train_016345
18,528
no_license
[ { "docstring": "Init.", "name": "__init__", "signature": "def __init__(self, system: NibeSystem, climate: ClimateSystem, parameters: set[ParameterId | None])" }, { "docstring": "Extra state attributes.", "name": "extra_state_attributes", "signature": "def extra_state_attributes(self)" ...
5
stack_v2_sparse_classes_30k_val_000363
Implement the Python class `NibeClimate` described below. Class description: Base class for nibe climate entities. Method signatures and docstrings: - def __init__(self, system: NibeSystem, climate: ClimateSystem, parameters: set[ParameterId | None]): Init. - def extra_state_attributes(self): Extra state attributes. ...
Implement the Python class `NibeClimate` described below. Class description: Base class for nibe climate entities. Method signatures and docstrings: - def __init__(self, system: NibeSystem, climate: ClimateSystem, parameters: set[ParameterId | None]): Init. - def extra_state_attributes(self): Extra state attributes. ...
b32e6f256cee4727d1c830075acfa607adc15dc7
<|skeleton|> class NibeClimate: """Base class for nibe climate entities.""" def __init__(self, system: NibeSystem, climate: ClimateSystem, parameters: set[ParameterId | None]): """Init.""" <|body_0|> def extra_state_attributes(self): """Extra state attributes.""" <|body_1|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NibeClimate: """Base class for nibe climate entities.""" def __init__(self, system: NibeSystem, climate: ClimateSystem, parameters: set[ParameterId | None]): """Init.""" parameters |= {PARAM_PUMP_SPEED_HEATING_MEDIUM} super().__init__(system, parameters) self._climate = cl...
the_stack_v2_python_sparse
climate.py
elupus/hass_nibe
train
169
f6fbf9d314d8eb3cf8b33488a188cf8c7d3d7b3f
[ "self.insert = Vec3(insert)\nself.scale_factor_x = float(scale[0])\nself.scale_factor_y = float(scale[1])\nself.scale_factor_z = float(scale[2])\nself.rotation = float(rotation)\nself.extrusion = Vec3(extrusion)", "ocs = OCS(self.extrusion)\nux, uy, uz = m.transform_directions((ocs.ux, ocs.uy, ocs.uz))\nx_scale =...
<|body_start_0|> self.insert = Vec3(insert) self.scale_factor_x = float(scale[0]) self.scale_factor_y = float(scale[1]) self.scale_factor_z = float(scale[2]) self.rotation = float(rotation) self.extrusion = Vec3(extrusion) <|end_body_0|> <|body_start_1|> ocs = OC...
InsertCoordinateSystem
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InsertCoordinateSystem: def __init__(self, insert: UVec, scale: tuple[float, float, float], rotation: float, extrusion: UVec): """Defines an INSERT coordinate system. Args: insert: insertion location scale: scaling factors for x-, y- and z-axis rotation: rotation angle around the extrusi...
stack_v2_sparse_classes_36k_train_016346
11,827
permissive
[ { "docstring": "Defines an INSERT coordinate system. Args: insert: insertion location scale: scaling factors for x-, y- and z-axis rotation: rotation angle around the extrusion vector in degrees extrusion: extrusion vector which defines the :ref:`OCS`", "name": "__init__", "signature": "def __init__(sel...
2
null
Implement the Python class `InsertCoordinateSystem` described below. Class description: Implement the InsertCoordinateSystem class. Method signatures and docstrings: - def __init__(self, insert: UVec, scale: tuple[float, float, float], rotation: float, extrusion: UVec): Defines an INSERT coordinate system. Args: inse...
Implement the Python class `InsertCoordinateSystem` described below. Class description: Implement the InsertCoordinateSystem class. Method signatures and docstrings: - def __init__(self, insert: UVec, scale: tuple[float, float, float], rotation: float, extrusion: UVec): Defines an INSERT coordinate system. Args: inse...
ba6ab0264dcb6833173042a37b1b5ae878d75113
<|skeleton|> class InsertCoordinateSystem: def __init__(self, insert: UVec, scale: tuple[float, float, float], rotation: float, extrusion: UVec): """Defines an INSERT coordinate system. Args: insert: insertion location scale: scaling factors for x-, y- and z-axis rotation: rotation angle around the extrusi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InsertCoordinateSystem: def __init__(self, insert: UVec, scale: tuple[float, float, float], rotation: float, extrusion: UVec): """Defines an INSERT coordinate system. Args: insert: insertion location scale: scaling factors for x-, y- and z-axis rotation: rotation angle around the extrusion vector in d...
the_stack_v2_python_sparse
src/ezdxf/math/transformtools.py
mozman/ezdxf
train
750
51e3d1e21cf07757485a41632db4ef092670d956
[ "if single:\n listing = get_object_or_404(Listing, **filter)\n ids = Similarity.objects.filter(Q(listing_1=listing) | Q(listing_2=listing)).values_list('listing_1', 'listing_2').order_by('-score')[:5]\n pks = set([id[0] for id in ids] + [id[1] for id in ids])\n if len(pks) > 0:\n pks.remove(listi...
<|body_start_0|> if single: listing = get_object_or_404(Listing, **filter) ids = Similarity.objects.filter(Q(listing_1=listing) | Q(listing_2=listing)).values_list('listing_1', 'listing_2').order_by('-score')[:5] pks = set([id[0] for id in ids] + [id[1] for id in ids]) ...
ListingView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ListingView: def get_listing(self, filter, single=False): """Retrives listings based on the 'filter' or 404 :param: filter a query Returns the listing dictionary to be sent to the template""" <|body_0|> def get(self, request, *args, **kwargs): """Get listings based o...
stack_v2_sparse_classes_36k_train_016347
6,828
no_license
[ { "docstring": "Retrives listings based on the 'filter' or 404 :param: filter a query Returns the listing dictionary to be sent to the template", "name": "get_listing", "signature": "def get_listing(self, filter, single=False)" }, { "docstring": "Get listings based on the input arguments. it ret...
2
stack_v2_sparse_classes_30k_train_006460
Implement the Python class `ListingView` described below. Class description: Implement the ListingView class. Method signatures and docstrings: - def get_listing(self, filter, single=False): Retrives listings based on the 'filter' or 404 :param: filter a query Returns the listing dictionary to be sent to the template...
Implement the Python class `ListingView` described below. Class description: Implement the ListingView class. Method signatures and docstrings: - def get_listing(self, filter, single=False): Retrives listings based on the 'filter' or 404 :param: filter a query Returns the listing dictionary to be sent to the template...
c87755c6fcc487768ace72e5d9617c67295299fd
<|skeleton|> class ListingView: def get_listing(self, filter, single=False): """Retrives listings based on the 'filter' or 404 :param: filter a query Returns the listing dictionary to be sent to the template""" <|body_0|> def get(self, request, *args, **kwargs): """Get listings based o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ListingView: def get_listing(self, filter, single=False): """Retrives listings based on the 'filter' or 404 :param: filter a query Returns the listing dictionary to be sent to the template""" if single: listing = get_object_or_404(Listing, **filter) ids = Similarity.obj...
the_stack_v2_python_sparse
feira/fair/views.py
fmstam/feira
train
0
8939666230c3dd0dea66dff0ede0c985e67fdbf9
[ "main = MainActivity()\ndecoder = DataDecoder()\navailable_frequencies = main._gen_frequencies()\nreturn decoder.decode(frequencies, available_frequencies, bssids)", "main = MainActivity()\ndecoder = DataDecoder()\navailable_frequencies = main._gen_frequencies()\nenc_hex = decoder._hex_from_frequencies(frequencie...
<|body_start_0|> main = MainActivity() decoder = DataDecoder() available_frequencies = main._gen_frequencies() return decoder.decode(frequencies, available_frequencies, bssids) <|end_body_0|> <|body_start_1|> main = MainActivity() decoder = DataDecoder() availabl...
Essentially a minimalist wrapper for ..voice.decoder.DataDecoder
Decoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Decoder: """Essentially a minimalist wrapper for ..voice.decoder.DataDecoder""" def decode(frequencies, bssids): """Decode 'frequencies' into (bssid, psk) using 'bssids' Wrapper for ..voice.decoder.DataDecoder.DataDecoder.decode available_frequencies defaults to ..voice.MainActivity....
stack_v2_sparse_classes_36k_train_016348
3,087
no_license
[ { "docstring": "Decode 'frequencies' into (bssid, psk) using 'bssids' Wrapper for ..voice.decoder.DataDecoder.DataDecoder.decode available_frequencies defaults to ..voice.MainActivity.MainActivity._gen_frequencies() :param frequencies - A list of frequencies to be decoded. :param bssids - A list of BSSID's on t...
6
null
Implement the Python class `Decoder` described below. Class description: Essentially a minimalist wrapper for ..voice.decoder.DataDecoder Method signatures and docstrings: - def decode(frequencies, bssids): Decode 'frequencies' into (bssid, psk) using 'bssids' Wrapper for ..voice.decoder.DataDecoder.DataDecoder.decod...
Implement the Python class `Decoder` described below. Class description: Essentially a minimalist wrapper for ..voice.decoder.DataDecoder Method signatures and docstrings: - def decode(frequencies, bssids): Decode 'frequencies' into (bssid, psk) using 'bssids' Wrapper for ..voice.decoder.DataDecoder.DataDecoder.decod...
7d370342f34e26e6e66718ae397eb1d81253cd8a
<|skeleton|> class Decoder: """Essentially a minimalist wrapper for ..voice.decoder.DataDecoder""" def decode(frequencies, bssids): """Decode 'frequencies' into (bssid, psk) using 'bssids' Wrapper for ..voice.decoder.DataDecoder.DataDecoder.decode available_frequencies defaults to ..voice.MainActivity....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Decoder: """Essentially a minimalist wrapper for ..voice.decoder.DataDecoder""" def decode(frequencies, bssids): """Decode 'frequencies' into (bssid, psk) using 'bssids' Wrapper for ..voice.decoder.DataDecoder.DataDecoder.decode available_frequencies defaults to ..voice.MainActivity.MainActivity....
the_stack_v2_python_sparse
yatwin/onekeywifi/decoder/Decoder.py
andre95d/python-yatwin
train
0
b38989d148a7bdbe085c2511acd1689c1b1fa96c
[ "if minfo is None:\n minfo = {}\nsuper(DumpPeerStatsMessage, self).__init__(minfo)\nself.IsSystemMessage = False\nself.IsForward = True\nself.IsReliable = True\nself.PeerIDList = minfo.get('PeerIDList', [])\nself.MetricList = minfo.get('MetricList', [])", "result = super(DumpPeerStatsMessage, self).dump()\nres...
<|body_start_0|> if minfo is None: minfo = {} super(DumpPeerStatsMessage, self).__init__(minfo) self.IsSystemMessage = False self.IsForward = True self.IsReliable = True self.PeerIDList = minfo.get('PeerIDList', []) self.MetricList = minfo.get('MetricL...
Dump peer stats messages are sent to a peer node to request it to log statistics about specified peer connections. Attributes: DumpPeerStatsMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or not this is a system message. System messages have special delivery priority rules. IsF...
DumpPeerStatsMessage
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DumpPeerStatsMessage: """Dump peer stats messages are sent to a peer node to request it to log statistics about specified peer connections. Attributes: DumpPeerStatsMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or not this is a system message. System me...
stack_v2_sparse_classes_36k_train_016349
13,482
permissive
[ { "docstring": "Constructor for the DumpPeerStatsMessage class. Args: minfo (dict): Dictionary of values for message fields.", "name": "__init__", "signature": "def __init__(self, minfo=None)" }, { "docstring": "Dumps a dict containing object attributes. Returns: dict: A mapping of object attrib...
2
stack_v2_sparse_classes_30k_train_010443
Implement the Python class `DumpPeerStatsMessage` described below. Class description: Dump peer stats messages are sent to a peer node to request it to log statistics about specified peer connections. Attributes: DumpPeerStatsMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or ...
Implement the Python class `DumpPeerStatsMessage` described below. Class description: Dump peer stats messages are sent to a peer node to request it to log statistics about specified peer connections. Attributes: DumpPeerStatsMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or ...
8f4ca1aab54ef420a0db10c8ca822ec8686cd423
<|skeleton|> class DumpPeerStatsMessage: """Dump peer stats messages are sent to a peer node to request it to log statistics about specified peer connections. Attributes: DumpPeerStatsMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or not this is a system message. System me...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DumpPeerStatsMessage: """Dump peer stats messages are sent to a peer node to request it to log statistics about specified peer connections. Attributes: DumpPeerStatsMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or not this is a system message. System messages have s...
the_stack_v2_python_sparse
validator/gossip/messages/gossip_debug.py
aludvik/sawtooth-core
train
0
dbdd5c678d48fa2f32268e1686e679d4ea458faa
[ "super().__init__()\nself.ouath_url = 'https://login.microsoftonline.com/' + tenant_id + '/oauth2/token'\nself.data = {'resource': '73c2949e-da2d-457a-9607-fcc665198967', 'client_id': client_id, 'grant_type': 'client_credentials', 'client_secret': client_secret}\nself._graph_data = {'resource': 'https://graph.micro...
<|body_start_0|> super().__init__() self.ouath_url = 'https://login.microsoftonline.com/' + tenant_id + '/oauth2/token' self.data = {'resource': '73c2949e-da2d-457a-9607-fcc665198967', 'client_id': client_id, 'grant_type': 'client_credentials', 'client_secret': client_secret} self._graph...
Authenticates to the Azure OAuth provider using a service principal.
ServicePrincipalAuthentication
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ServicePrincipalAuthentication: """Authenticates to the Azure OAuth provider using a service principal.""" def __init__(self, tenant_id, client_id, client_secret): """:param str tenant_id: The tenant id of your Azure subscription. :param str client_id: The client id or application id...
stack_v2_sparse_classes_36k_train_016350
3,355
permissive
[ { "docstring": ":param str tenant_id: The tenant id of your Azure subscription. :param str client_id: The client id or application id of your service principal. :param str client_secret: The client secret or application secret of your service principal.", "name": "__init__", "signature": "def __init__(s...
5
null
Implement the Python class `ServicePrincipalAuthentication` described below. Class description: Authenticates to the Azure OAuth provider using a service principal. Method signatures and docstrings: - def __init__(self, tenant_id, client_id, client_secret): :param str tenant_id: The tenant id of your Azure subscripti...
Implement the Python class `ServicePrincipalAuthentication` described below. Class description: Authenticates to the Azure OAuth provider using a service principal. Method signatures and docstrings: - def __init__(self, tenant_id, client_id, client_secret): :param str tenant_id: The tenant id of your Azure subscripti...
96d671d9a161a44f32542f9f4ef069adc8b4f676
<|skeleton|> class ServicePrincipalAuthentication: """Authenticates to the Azure OAuth provider using a service principal.""" def __init__(self, tenant_id, client_id, client_secret): """:param str tenant_id: The tenant id of your Azure subscription. :param str client_id: The client id or application id...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ServicePrincipalAuthentication: """Authenticates to the Azure OAuth provider using a service principal.""" def __init__(self, tenant_id, client_id, client_secret): """:param str tenant_id: The tenant id of your Azure subscription. :param str client_id: The client id or application id of your serv...
the_stack_v2_python_sparse
pyapacheatlas/auth/serviceprincipal.py
CloudBreadPaPa/pyapacheatlas
train
0
371b0e43a53619e74869a05b9bd5a3beea65d2a0
[ "cls.test_temp_dir = os.path.join(tf.test.get_temp_dir(), 'encoder_test')\nshutil.rmtree(cls.test_temp_dir, ignore_errors=True)\ntf.gfile.MakeDirs(cls.test_temp_dir)", "corpus = 'A B C D E F G H I J K L M N O P Q R S T U V W X Y Z'\nvocab_filename = os.path.join(self.test_temp_dir, 'abc.vocab')\nencoder = text_en...
<|body_start_0|> cls.test_temp_dir = os.path.join(tf.test.get_temp_dir(), 'encoder_test') shutil.rmtree(cls.test_temp_dir, ignore_errors=True) tf.gfile.MakeDirs(cls.test_temp_dir) <|end_body_0|> <|body_start_1|> corpus = 'A B C D E F G H I J K L M N O P Q R S T U V W X Y Z' voca...
TokenTextEncoderTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TokenTextEncoderTest: def setUpClass(cls): """Make sure the test dir exists and is empty.""" <|body_0|> def test_save_and_reload(self): """Test that saving and reloading doesn't change the vocab. Note that this test reads and writes to the filesystem, which necessita...
stack_v2_sparse_classes_36k_train_016351
14,602
permissive
[ { "docstring": "Make sure the test dir exists and is empty.", "name": "setUpClass", "signature": "def setUpClass(cls)" }, { "docstring": "Test that saving and reloading doesn't change the vocab. Note that this test reads and writes to the filesystem, which necessitates that this test size be \"l...
3
stack_v2_sparse_classes_30k_train_003025
Implement the Python class `TokenTextEncoderTest` described below. Class description: Implement the TokenTextEncoderTest class. Method signatures and docstrings: - def setUpClass(cls): Make sure the test dir exists and is empty. - def test_save_and_reload(self): Test that saving and reloading doesn't change the vocab...
Implement the Python class `TokenTextEncoderTest` described below. Class description: Implement the TokenTextEncoderTest class. Method signatures and docstrings: - def setUpClass(cls): Make sure the test dir exists and is empty. - def test_save_and_reload(self): Test that saving and reloading doesn't change the vocab...
1bb3b89427f669f2f0ec84633952e21b68964a23
<|skeleton|> class TokenTextEncoderTest: def setUpClass(cls): """Make sure the test dir exists and is empty.""" <|body_0|> def test_save_and_reload(self): """Test that saving and reloading doesn't change the vocab. Note that this test reads and writes to the filesystem, which necessita...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TokenTextEncoderTest: def setUpClass(cls): """Make sure the test dir exists and is empty.""" cls.test_temp_dir = os.path.join(tf.test.get_temp_dir(), 'encoder_test') shutil.rmtree(cls.test_temp_dir, ignore_errors=True) tf.gfile.MakeDirs(cls.test_temp_dir) def test_save_and...
the_stack_v2_python_sparse
trax/data/text_encoder_test.py
google/trax
train
8,180
1d6a1395cb5d1bb1c0de2d69f4908aaed6a15d2d
[ "phone_valid = user_service.check_phone_valid(phone)\nif phone_valid:\n code = captcha_service.get_captch(phone)\n response = {'phone': phone, 'captcha': code}\n return APIResponse(response)\nelse:\n return APIResponse(status_code=status.HTTP_400_BAD_REQUEST)", "phone_valid = user_service.check_phone_...
<|body_start_0|> phone_valid = user_service.check_phone_valid(phone) if phone_valid: code = captcha_service.get_captch(phone) response = {'phone': phone, 'captcha': code} return APIResponse(response) else: return APIResponse(status_code=status.HTTP...
CaptchaViewSet
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CaptchaViewSet: def retrieve(self, request, phone): """获得某个手机号的验证码 用于测试,只获得验证码而不发送短信。 ### Example Request captcha/{phone}/ ### Response { 'phone': phone, 'captcha': code, }""" <|body_0|> def send(self, request, phone): """发送验证码 Does actions for captcha. captcha/{phon...
stack_v2_sparse_classes_36k_train_016352
9,704
permissive
[ { "docstring": "获得某个手机号的验证码 用于测试,只获得验证码而不发送短信。 ### Example Request captcha/{phone}/ ### Response { 'phone': phone, 'captcha': code, }", "name": "retrieve", "signature": "def retrieve(self, request, phone)" }, { "docstring": "发送验证码 Does actions for captcha. captcha/{phone}/send/ phone -- phone nu...
2
stack_v2_sparse_classes_30k_train_005855
Implement the Python class `CaptchaViewSet` described below. Class description: Implement the CaptchaViewSet class. Method signatures and docstrings: - def retrieve(self, request, phone): 获得某个手机号的验证码 用于测试,只获得验证码而不发送短信。 ### Example Request captcha/{phone}/ ### Response { 'phone': phone, 'captcha': code, } - def send(s...
Implement the Python class `CaptchaViewSet` described below. Class description: Implement the CaptchaViewSet class. Method signatures and docstrings: - def retrieve(self, request, phone): 获得某个手机号的验证码 用于测试,只获得验证码而不发送短信。 ### Example Request captcha/{phone}/ ### Response { 'phone': phone, 'captcha': code, } - def send(s...
31ac08148fbe67ab166faa897c0cbe72cd7f62db
<|skeleton|> class CaptchaViewSet: def retrieve(self, request, phone): """获得某个手机号的验证码 用于测试,只获得验证码而不发送短信。 ### Example Request captcha/{phone}/ ### Response { 'phone': phone, 'captcha': code, }""" <|body_0|> def send(self, request, phone): """发送验证码 Does actions for captcha. captcha/{phon...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CaptchaViewSet: def retrieve(self, request, phone): """获得某个手机号的验证码 用于测试,只获得验证码而不发送短信。 ### Example Request captcha/{phone}/ ### Response { 'phone': phone, 'captcha': code, }""" phone_valid = user_service.check_phone_valid(phone) if phone_valid: code = captcha_service.get_cap...
the_stack_v2_python_sparse
wheat/apps/user/apis.py
fortyMiles/moment-note
train
2
ff237b5be1deaa97f9c81523606599059ed00d78
[ "user = request.user\nif user.is_superuser == False:\n return Response(status=status.HTTP_401_UNAUTHORIZED)\nserializer = serializers.BranchSerializer(data=request.data)\nif serializer.is_valid():\n serializer.save()\n return Response(data=serializer.data, status=status.HTTP_201_CREATED)\nelse:\n return...
<|body_start_0|> user = request.user if user.is_superuser == False: return Response(status=status.HTTP_401_UNAUTHORIZED) serializer = serializers.BranchSerializer(data=request.data) if serializer.is_valid(): serializer.save() return Response(data=seria...
Branches
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Branches: def post(self, request, format=None): """add branch""" <|body_0|> def get(self, request, format=None): """get branches""" <|body_1|> <|end_skeleton|> <|body_start_0|> user = request.user if user.is_superuser == False: r...
stack_v2_sparse_classes_36k_train_016353
7,711
permissive
[ { "docstring": "add branch", "name": "post", "signature": "def post(self, request, format=None)" }, { "docstring": "get branches", "name": "get", "signature": "def get(self, request, format=None)" } ]
2
stack_v2_sparse_classes_30k_train_008426
Implement the Python class `Branches` described below. Class description: Implement the Branches class. Method signatures and docstrings: - def post(self, request, format=None): add branch - def get(self, request, format=None): get branches
Implement the Python class `Branches` described below. Class description: Implement the Branches class. Method signatures and docstrings: - def post(self, request, format=None): add branch - def get(self, request, format=None): get branches <|skeleton|> class Branches: def post(self, request, format=None): ...
dd482eb8a3ac8b5d4d06c63e5a5d9ccaeb3ce7b9
<|skeleton|> class Branches: def post(self, request, format=None): """add branch""" <|body_0|> def get(self, request, format=None): """get branches""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Branches: def post(self, request, format=None): """add branch""" user = request.user if user.is_superuser == False: return Response(status=status.HTTP_401_UNAUTHORIZED) serializer = serializers.BranchSerializer(data=request.data) if serializer.is_valid(): ...
the_stack_v2_python_sparse
space_manager/branches/views.py
yoojat/Space-Manager
train
1
2b5ae912190d192c9800f906ef4ce1e338138b5b
[ "if value is self.field.missing_value:\n return []\nconverter = self._getConverter(self.field.value_type)\nreturn [converter.toWidgetValue(v) for v in value]", "if not len(value):\n return self.field.missing_value\nconverter = self._getConverter(self.field.value_type)\nvalues = [converter.toFieldValue(v) fo...
<|body_start_0|> if value is self.field.missing_value: return [] converter = self._getConverter(self.field.value_type) return [converter.toWidgetValue(v) for v in value] <|end_body_0|> <|body_start_1|> if not len(value): return self.field.missing_value co...
Data converter for IMultiWidget.
MultiConverter
[ "ZPL-2.1" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiConverter: """Data converter for IMultiWidget.""" def toWidgetValue(self, value): """Just dispatch it.""" <|body_0|> def toFieldValue(self, value): """Just dispatch it.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if value is self.field....
stack_v2_sparse_classes_36k_train_016354
15,934
permissive
[ { "docstring": "Just dispatch it.", "name": "toWidgetValue", "signature": "def toWidgetValue(self, value)" }, { "docstring": "Just dispatch it.", "name": "toFieldValue", "signature": "def toFieldValue(self, value)" } ]
2
stack_v2_sparse_classes_30k_train_010933
Implement the Python class `MultiConverter` described below. Class description: Data converter for IMultiWidget. Method signatures and docstrings: - def toWidgetValue(self, value): Just dispatch it. - def toFieldValue(self, value): Just dispatch it.
Implement the Python class `MultiConverter` described below. Class description: Data converter for IMultiWidget. Method signatures and docstrings: - def toWidgetValue(self, value): Just dispatch it. - def toFieldValue(self, value): Just dispatch it. <|skeleton|> class MultiConverter: """Data converter for IMulti...
aa47e9b109ad2d7de600fc1d4ea7359d8144f356
<|skeleton|> class MultiConverter: """Data converter for IMultiWidget.""" def toWidgetValue(self, value): """Just dispatch it.""" <|body_0|> def toFieldValue(self, value): """Just dispatch it.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiConverter: """Data converter for IMultiWidget.""" def toWidgetValue(self, value): """Just dispatch it.""" if value is self.field.missing_value: return [] converter = self._getConverter(self.field.value_type) return [converter.toWidgetValue(v) for v in valu...
the_stack_v2_python_sparse
src/z3c/form/converter.py
zopefoundation/z3c.form
train
6
5e2285e371fddee1e6fb7f840be35fa0b3d943ec
[ "self.ident = ident\nself.func = func\nself.forceKeepArgsCasing = forceKeepArgsCasing\nself.forceKeepCommandCasing = forceKeepCommandCasing\nself.allowDM = allowDM\nself.allowHelp = allowHelp\nself.aliases = aliases\nself.signatureStr = signatureStr\nself.shortHelp = shortHelp\nself.longHelp = longHelp\nself.helpSe...
<|body_start_0|> self.ident = ident self.func = func self.forceKeepArgsCasing = forceKeepArgsCasing self.forceKeepCommandCasing = forceKeepCommandCasing self.allowDM = allowDM self.allowHelp = allowHelp self.aliases = aliases self.signatureStr = signatureS...
Represents a registration of a command in a HeirarchicalCommandsDB. TODO: Make allowDM so we dont have to make two HeirarchicalCommandsDBs to handle DM commands :var ident: The string command name by which this command is identified and called :vartype ident: str :var func: A reference to the function to call upon call...
CommandRegistry
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommandRegistry: """Represents a registration of a command in a HeirarchicalCommandsDB. TODO: Make allowDM so we dont have to make two HeirarchicalCommandsDBs to handle DM commands :var ident: The string command name by which this command is identified and called :vartype ident: str :var func: A ...
stack_v2_sparse_classes_36k_train_016355
15,557
permissive
[ { "docstring": ":param str ident: The string command name by which this command is identified and called :param FunctionType func: A reference to the function to call upon calling this CommandRegistry :param bool forceKeepArgsCasing: Whether to pass arguments to the function with their original casing. If False...
2
null
Implement the Python class `CommandRegistry` described below. Class description: Represents a registration of a command in a HeirarchicalCommandsDB. TODO: Make allowDM so we dont have to make two HeirarchicalCommandsDBs to handle DM commands :var ident: The string command name by which this command is identified and c...
Implement the Python class `CommandRegistry` described below. Class description: Represents a registration of a command in a HeirarchicalCommandsDB. TODO: Make allowDM so we dont have to make two HeirarchicalCommandsDBs to handle DM commands :var ident: The string command name by which this command is identified and c...
b4fe3d765b764ab169284ce0869a810825013389
<|skeleton|> class CommandRegistry: """Represents a registration of a command in a HeirarchicalCommandsDB. TODO: Make allowDM so we dont have to make two HeirarchicalCommandsDBs to handle DM commands :var ident: The string command name by which this command is identified and called :vartype ident: str :var func: A ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CommandRegistry: """Represents a registration of a command in a HeirarchicalCommandsDB. TODO: Make allowDM so we dont have to make two HeirarchicalCommandsDBs to handle DM commands :var ident: The string command name by which this command is identified and called :vartype ident: str :var func: A reference to ...
the_stack_v2_python_sparse
BB/bbDatabases/HeirarchicalCommandsDB.py
Trimatix/GOF2BountyBot
train
7
d9ef052d16d7b36802860900ca45255b0f81bc5b
[ "values = np.random.choice(trade_rets, scenarios_length * num_of_scenarios)\nvalues = np.reshape(values, (scenarios_length, num_of_scenarios))\nreturn SimpleReturnsDataFrame(values)", "assert 0.0 <= time_in_the_market <= 1.0, 'time_in_the_market should belong to the [0.0, 1.0] range'\ndates_index = date_range(sta...
<|body_start_0|> values = np.random.choice(trade_rets, scenarios_length * num_of_scenarios) values = np.reshape(values, (scenarios_length, num_of_scenarios)) return SimpleReturnsDataFrame(values) <|end_body_0|> <|body_start_1|> assert 0.0 <= time_in_the_market <= 1.0, 'time_in_the_marke...
Class used for generating different scenarios for Trades.
ScenariosGenerator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScenariosGenerator: """Class used for generating different scenarios for Trades.""" def make_scenarios(self, trade_rets: Sequence[float], scenarios_length: int=100, num_of_scenarios: int=10000) -> SimpleReturnsDataFrame: """Utility function to generate different trades scenarios, whe...
stack_v2_sparse_classes_36k_train_016356
7,119
permissive
[ { "docstring": "Utility function to generate different trades scenarios, where each scenario is a series of returns for a given investment strategy. The scenarios of a given length are created by randomly choosing (with replacement) returns from the original sequence of a Trade's returns. The result is the Simp...
3
stack_v2_sparse_classes_30k_train_014393
Implement the Python class `ScenariosGenerator` described below. Class description: Class used for generating different scenarios for Trades. Method signatures and docstrings: - def make_scenarios(self, trade_rets: Sequence[float], scenarios_length: int=100, num_of_scenarios: int=10000) -> SimpleReturnsDataFrame: Uti...
Implement the Python class `ScenariosGenerator` described below. Class description: Class used for generating different scenarios for Trades. Method signatures and docstrings: - def make_scenarios(self, trade_rets: Sequence[float], scenarios_length: int=100, num_of_scenarios: int=10000) -> SimpleReturnsDataFrame: Uti...
f707e51bc2ff45f6e46dcdd24d59d83ce7dc4f94
<|skeleton|> class ScenariosGenerator: """Class used for generating different scenarios for Trades.""" def make_scenarios(self, trade_rets: Sequence[float], scenarios_length: int=100, num_of_scenarios: int=10000) -> SimpleReturnsDataFrame: """Utility function to generate different trades scenarios, whe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScenariosGenerator: """Class used for generating different scenarios for Trades.""" def make_scenarios(self, trade_rets: Sequence[float], scenarios_length: int=100, num_of_scenarios: int=10000) -> SimpleReturnsDataFrame: """Utility function to generate different trades scenarios, where each scena...
the_stack_v2_python_sparse
qf_lib/backtesting/fast_alpha_model_tester/scenarios_generator.py
quarkfin/qf-lib
train
379
7ab37ab224045abd7cee10ff3e0815e662abc1af
[ "self.frame = frame\nsuper().__init__(self.frame)\nself.give_shape()\nself.brick_matrix = self.make_brick_matrix(self.frame)", "special_row = randint(1, len(self.location_n_type_matrix) - 1)\nfor r in range(len(self.location_n_type_matrix)):\n for c in range(len(self.location_n_type_matrix[r])):\n if r ...
<|body_start_0|> self.frame = frame super().__init__(self.frame) self.give_shape() self.brick_matrix = self.make_brick_matrix(self.frame) <|end_body_0|> <|body_start_1|> special_row = randint(1, len(self.location_n_type_matrix) - 1) for r in range(len(self.location_n_typ...
BrickLayout for stage3
LayoutStage3
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LayoutStage3: """BrickLayout for stage3""" def __init__(self, frame: Frame): """constructor for this class""" <|body_0|> def give_shape(self): """This function is from the parrent class. Now overriding it to give""" <|body_1|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_36k_train_016357
8,421
no_license
[ { "docstring": "constructor for this class", "name": "__init__", "signature": "def __init__(self, frame: Frame)" }, { "docstring": "This function is from the parrent class. Now overriding it to give", "name": "give_shape", "signature": "def give_shape(self)" } ]
2
stack_v2_sparse_classes_30k_train_011549
Implement the Python class `LayoutStage3` described below. Class description: BrickLayout for stage3 Method signatures and docstrings: - def __init__(self, frame: Frame): constructor for this class - def give_shape(self): This function is from the parrent class. Now overriding it to give
Implement the Python class `LayoutStage3` described below. Class description: BrickLayout for stage3 Method signatures and docstrings: - def __init__(self, frame: Frame): constructor for this class - def give_shape(self): This function is from the parrent class. Now overriding it to give <|skeleton|> class LayoutSta...
c4cd10f631aba51d290395dec446850a0fbfe1b5
<|skeleton|> class LayoutStage3: """BrickLayout for stage3""" def __init__(self, frame: Frame): """constructor for this class""" <|body_0|> def give_shape(self): """This function is from the parrent class. Now overriding it to give""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LayoutStage3: """BrickLayout for stage3""" def __init__(self, frame: Frame): """constructor for this class""" self.frame = frame super().__init__(self.frame) self.give_shape() self.brick_matrix = self.make_brick_matrix(self.frame) def give_shape(self): ...
the_stack_v2_python_sparse
v1/brick_layout.py
ayushsharma-crypto/Brick-Breaker-Terminal-Based-Game
train
0
e62877f3d9478332d872536d0238706c76563f5c
[ "Parametre.__init__(self, 'supprimer', 'del')\nself.schema = '<message>'\nself.aide_courte = 'supprime un alias'\nself.aide_longue = \"Cette commande permet de supprimer un de vos alias. Précisez simplement le nom de l'alias en paramètre.\"", "message = dic_masques['message'].message\nmessage = message.lower()\ni...
<|body_start_0|> Parametre.__init__(self, 'supprimer', 'del') self.schema = '<message>' self.aide_courte = 'supprime un alias' self.aide_longue = "Cette commande permet de supprimer un de vos alias. Précisez simplement le nom de l'alias en paramètre." <|end_body_0|> <|body_start_1|> ...
Commande 'alias supprimer'.
PrmSupprimer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrmSupprimer: """Commande 'alias supprimer'.""" def __init__(self): """Constructeur du paramètre""" <|body_0|> def interpreter(self, personnage, dic_masques): """Interprétation du paramètre""" <|body_1|> <|end_skeleton|> <|body_start_0|> Paramet...
stack_v2_sparse_classes_36k_train_016358
2,634
permissive
[ { "docstring": "Constructeur du paramètre", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Interprétation du paramètre", "name": "interpreter", "signature": "def interpreter(self, personnage, dic_masques)" } ]
2
stack_v2_sparse_classes_30k_train_011829
Implement the Python class `PrmSupprimer` described below. Class description: Commande 'alias supprimer'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre - def interpreter(self, personnage, dic_masques): Interprétation du paramètre
Implement the Python class `PrmSupprimer` described below. Class description: Commande 'alias supprimer'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre - def interpreter(self, personnage, dic_masques): Interprétation du paramètre <|skeleton|> class PrmSupprimer: """Commande 'a...
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class PrmSupprimer: """Commande 'alias supprimer'.""" def __init__(self): """Constructeur du paramètre""" <|body_0|> def interpreter(self, personnage, dic_masques): """Interprétation du paramètre""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PrmSupprimer: """Commande 'alias supprimer'.""" def __init__(self): """Constructeur du paramètre""" Parametre.__init__(self, 'supprimer', 'del') self.schema = '<message>' self.aide_courte = 'supprime un alias' self.aide_longue = "Cette commande permet de supprimer ...
the_stack_v2_python_sparse
src/primaires/joueur/commandes/alias/supprimer.py
vincent-lg/tsunami
train
5
b347078daf97a2fb92761ee070c401fcaf71f8de
[ "digest = hashes.Hash(algorithm, default_backend())\ndigest.update(message)\nreturn digest.finalize()", "if seed is None:\n return hashes.Hash(algorithm, default_backend())\nelse:\n hash_context = hashes.Hash(algorithm, default_backend())\n Hash.hash_update(hash_context, seed)\n return hash_context", ...
<|body_start_0|> digest = hashes.Hash(algorithm, default_backend()) digest.update(message) return digest.finalize() <|end_body_0|> <|body_start_1|> if seed is None: return hashes.Hash(algorithm, default_backend()) else: hash_context = hashes.Hash(algorith...
Hash
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Hash: def hash_bytes(message: bytes, algorithm=hashes.SHA1()): """Hash a given message with any given hash algorithm :param message: :param algorithm: :return:""" <|body_0|> def create_hash_context(seed: bytes=None, algorithm=hashes.SHA1()): """Create a hash object a...
stack_v2_sparse_classes_36k_train_016359
11,662
no_license
[ { "docstring": "Hash a given message with any given hash algorithm :param message: :param algorithm: :return:", "name": "hash_bytes", "signature": "def hash_bytes(message: bytes, algorithm=hashes.SHA1())" }, { "docstring": "Create a hash object and return its reference. :param seed: an optianl i...
4
stack_v2_sparse_classes_30k_train_019744
Implement the Python class `Hash` described below. Class description: Implement the Hash class. Method signatures and docstrings: - def hash_bytes(message: bytes, algorithm=hashes.SHA1()): Hash a given message with any given hash algorithm :param message: :param algorithm: :return: - def create_hash_context(seed: byt...
Implement the Python class `Hash` described below. Class description: Implement the Hash class. Method signatures and docstrings: - def hash_bytes(message: bytes, algorithm=hashes.SHA1()): Hash a given message with any given hash algorithm :param message: :param algorithm: :return: - def create_hash_context(seed: byt...
cf0daa63ead5a9282e36cf28133c93a9f67068c1
<|skeleton|> class Hash: def hash_bytes(message: bytes, algorithm=hashes.SHA1()): """Hash a given message with any given hash algorithm :param message: :param algorithm: :return:""" <|body_0|> def create_hash_context(seed: bytes=None, algorithm=hashes.SHA1()): """Create a hash object a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Hash: def hash_bytes(message: bytes, algorithm=hashes.SHA1()): """Hash a given message with any given hash algorithm :param message: :param algorithm: :return:""" digest = hashes.Hash(algorithm, default_backend()) digest.update(message) return digest.finalize() def create_...
the_stack_v2_python_sparse
crypto/core_crypto.py
Eli-G3/PyTORoxy
train
1
50906f4b24f41bd4318d734b696012bbb0c5c0e2
[ "super().__init__(track_interval=track_interval, track_offset=track_offset, verbose=verbose, track_schedule=track_schedule)\nself._epsilon = epsilon\nwarnings.warn('StoppingCriterion only applies to SGD without momentum.')", "ext = []\nif self.is_active(global_step):\n ext.append(BatchGradTransforms_SumGradSqu...
<|body_start_0|> super().__init__(track_interval=track_interval, track_offset=track_offset, verbose=verbose, track_schedule=track_schedule) self._epsilon = epsilon warnings.warn('StoppingCriterion only applies to SGD without momentum.') <|end_body_0|> <|body_start_1|> ext = [] i...
Evidence-based (EB) early-stopping criterion. Note: Proposed in - Mahsereci, M., Balles, L., Lassner, C., & Hennig, P., Early stopping without a validation set (2017).
EarlyStopping
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EarlyStopping: """Evidence-based (EB) early-stopping criterion. Note: Proposed in - Mahsereci, M., Balles, L., Lassner, C., & Hennig, P., Early stopping without a validation set (2017).""" def __init__(self, track_interval=1, track_offset=0, epsilon=1e-05, verbose=False, track_schedule=None)...
stack_v2_sparse_classes_36k_train_016360
3,188
permissive
[ { "docstring": "Initialize. Args: track_interval (int): Tracking rate. epsilon (float): Stabilization constant. Defaults to 0.0. verbose (bool): Turns on verbose mode. Defaults to ``False``.", "name": "__init__", "signature": "def __init__(self, track_interval=1, track_offset=0, epsilon=1e-05, verbose=F...
4
stack_v2_sparse_classes_30k_train_011359
Implement the Python class `EarlyStopping` described below. Class description: Evidence-based (EB) early-stopping criterion. Note: Proposed in - Mahsereci, M., Balles, L., Lassner, C., & Hennig, P., Early stopping without a validation set (2017). Method signatures and docstrings: - def __init__(self, track_interval=1...
Implement the Python class `EarlyStopping` described below. Class description: Evidence-based (EB) early-stopping criterion. Note: Proposed in - Mahsereci, M., Balles, L., Lassner, C., & Hennig, P., Early stopping without a validation set (2017). Method signatures and docstrings: - def __init__(self, track_interval=1...
5bd5ab3cda03eda0b0bf276f29d5c28b83d70b06
<|skeleton|> class EarlyStopping: """Evidence-based (EB) early-stopping criterion. Note: Proposed in - Mahsereci, M., Balles, L., Lassner, C., & Hennig, P., Early stopping without a validation set (2017).""" def __init__(self, track_interval=1, track_offset=0, epsilon=1e-05, verbose=False, track_schedule=None)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EarlyStopping: """Evidence-based (EB) early-stopping criterion. Note: Proposed in - Mahsereci, M., Balles, L., Lassner, C., & Hennig, P., Early stopping without a validation set (2017).""" def __init__(self, track_interval=1, track_offset=0, epsilon=1e-05, verbose=False, track_schedule=None): """...
the_stack_v2_python_sparse
cockpit/quantities/early_stopping.py
MeNicefellow/cockpit
train
0
75d0feaa1b3efba3f1b41e3cbdc755d4abd32f11
[ "self.stock_price = [0]\nself.stock_spanner = [0]\nself.index = 0", "self.stock_price.append(price)\nself.index += 1\nif self.index == 1:\n self.stock_spanner.append(1)\nelse:\n tmp = self.index - 1\n if price < self.stock_price[tmp]:\n self.stock_spanner.append(1)\n else:\n while price ...
<|body_start_0|> self.stock_price = [0] self.stock_spanner = [0] self.index = 0 <|end_body_0|> <|body_start_1|> self.stock_price.append(price) self.index += 1 if self.index == 1: self.stock_spanner.append(1) else: tmp = self.index - 1 ...
StockSpanner
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StockSpanner: def __init__(self): """stock_price record the prices of stock of each day stock_spanner record the spanner days of each day self.index reocrd the day number""" <|body_0|> def next(self, price): """:type price: int :rtype: int""" <|body_1|> <|en...
stack_v2_sparse_classes_36k_train_016361
3,780
no_license
[ { "docstring": "stock_price record the prices of stock of each day stock_spanner record the spanner days of each day self.index reocrd the day number", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": ":type price: int :rtype: int", "name": "next", "signature": "de...
2
null
Implement the Python class `StockSpanner` described below. Class description: Implement the StockSpanner class. Method signatures and docstrings: - def __init__(self): stock_price record the prices of stock of each day stock_spanner record the spanner days of each day self.index reocrd the day number - def next(self,...
Implement the Python class `StockSpanner` described below. Class description: Implement the StockSpanner class. Method signatures and docstrings: - def __init__(self): stock_price record the prices of stock of each day stock_spanner record the spanner days of each day self.index reocrd the day number - def next(self,...
f96a2273c6831a8035e1adacfa452f73c599ae16
<|skeleton|> class StockSpanner: def __init__(self): """stock_price record the prices of stock of each day stock_spanner record the spanner days of each day self.index reocrd the day number""" <|body_0|> def next(self, price): """:type price: int :rtype: int""" <|body_1|> <|en...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StockSpanner: def __init__(self): """stock_price record the prices of stock of each day stock_spanner record the spanner days of each day self.index reocrd the day number""" self.stock_price = [0] self.stock_spanner = [0] self.index = 0 def next(self, price): """:t...
the_stack_v2_python_sparse
Python/OnlineStockSpan.py
here0009/LeetCode
train
1
29f3e0e062ddc3c18932731cc60e0b00375b22bf
[ "res = super(cost_revaluation, self).default_get(cr, uid, fields, context=context)\naccount_data = self.pool.get('account.invoice').browse(cr, uid, context.get('active_id'), context=context)\nresult = []\nfor line in account_data.invoice_line:\n if line.product_id and line.prod_lot_id:\n result.append({'i...
<|body_start_0|> res = super(cost_revaluation, self).default_get(cr, uid, fields, context=context) account_data = self.pool.get('account.invoice').browse(cr, uid, context.get('active_id'), context=context) result = [] for line in account_data.invoice_line: if line.product_id ...
cost_revaluation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class cost_revaluation: def default_get(self, cr, uid, fields, context=None): """Get the default value from invoice line ---------------------------------------- @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param fields: A List o...
stack_v2_sparse_classes_36k_train_016362
6,683
no_license
[ { "docstring": "Get the default value from invoice line ---------------------------------------- @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param fields: A List of fields @param context: A standard dictionary @return: Return a dictionary which h...
2
stack_v2_sparse_classes_30k_train_011200
Implement the Python class `cost_revaluation` described below. Class description: Implement the cost_revaluation class. Method signatures and docstrings: - def default_get(self, cr, uid, fields, context=None): Get the default value from invoice line ---------------------------------------- @param self: The object poi...
Implement the Python class `cost_revaluation` described below. Class description: Implement the cost_revaluation class. Method signatures and docstrings: - def default_get(self, cr, uid, fields, context=None): Get the default value from invoice line ---------------------------------------- @param self: The object poi...
f2b44a8af0e7bee87d52d258fca012bf44ca876f
<|skeleton|> class cost_revaluation: def default_get(self, cr, uid, fields, context=None): """Get the default value from invoice line ---------------------------------------- @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param fields: A List o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class cost_revaluation: def default_get(self, cr, uid, fields, context=None): """Get the default value from invoice line ---------------------------------------- @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param fields: A List of fields @para...
the_stack_v2_python_sparse
via_lot_valuation/wizard/cost_revaluation.py
eksotama/prln-via-custom-addons
train
0
1b740044bf2f88a262d3a46f3d2d8fae1f7d38c2
[ "conn, cursor = get_db_cursor()\nbuild = 'toy_build'\nexon_lens = lu.get_all_exon_lengths(cursor, build)\nassert exon_lens[1] == 100\nconn.close()", "conn, cursor = get_db_cursor()\nbuild = 'toy_build'\nexon_lens = lu.get_all_exon_lengths(cursor, build)\nassert exon_lens[6] == 501\nconn.close()" ]
<|body_start_0|> conn, cursor = get_db_cursor() build = 'toy_build' exon_lens = lu.get_all_exon_lengths(cursor, build) assert exon_lens[1] == 100 conn.close() <|end_body_0|> <|body_start_1|> conn, cursor = get_db_cursor() build = 'toy_build' exon_lens = l...
TestComputeExonLens
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestComputeExonLens: def test_compute_exon_len_plus(self): """Plus strand example: chr1:1-100""" <|body_0|> def test_compute_exon_len_minus(self): """Minus strand example: chr1:2000-1500""" <|body_1|> <|end_skeleton|> <|body_start_0|> conn, cursor =...
stack_v2_sparse_classes_36k_train_016363
715
permissive
[ { "docstring": "Plus strand example: chr1:1-100", "name": "test_compute_exon_len_plus", "signature": "def test_compute_exon_len_plus(self)" }, { "docstring": "Minus strand example: chr1:2000-1500", "name": "test_compute_exon_len_minus", "signature": "def test_compute_exon_len_minus(self)...
2
stack_v2_sparse_classes_30k_train_005723
Implement the Python class `TestComputeExonLens` described below. Class description: Implement the TestComputeExonLens class. Method signatures and docstrings: - def test_compute_exon_len_plus(self): Plus strand example: chr1:1-100 - def test_compute_exon_len_minus(self): Minus strand example: chr1:2000-1500
Implement the Python class `TestComputeExonLens` described below. Class description: Implement the TestComputeExonLens class. Method signatures and docstrings: - def test_compute_exon_len_plus(self): Plus strand example: chr1:1-100 - def test_compute_exon_len_minus(self): Minus strand example: chr1:2000-1500 <|skele...
8014faed5f982e5e106ec05239e47d65878e76c3
<|skeleton|> class TestComputeExonLens: def test_compute_exon_len_plus(self): """Plus strand example: chr1:1-100""" <|body_0|> def test_compute_exon_len_minus(self): """Minus strand example: chr1:2000-1500""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestComputeExonLens: def test_compute_exon_len_plus(self): """Plus strand example: chr1:1-100""" conn, cursor = get_db_cursor() build = 'toy_build' exon_lens = lu.get_all_exon_lengths(cursor, build) assert exon_lens[1] == 100 conn.close() def test_compute_e...
the_stack_v2_python_sparse
testing_suite/test_compute_exon_lengths.py
kopardev/TALON
train
0
008cf34ab42d44dbb8e7e2caf36d9b08775b7eed
[ "self.cloud_usage_perf_stats = cloud_usage_perf_stats\nself.id = id\nself.local_usage_perf_stats = local_usage_perf_stats\nself.logical_stats = logical_stats\nself.usage_perf_stats = usage_perf_stats", "if dictionary is None:\n return None\ncloud_usage_perf_stats = cohesity_management_sdk.models.usage_and_perf...
<|body_start_0|> self.cloud_usage_perf_stats = cloud_usage_perf_stats self.id = id self.local_usage_perf_stats = local_usage_perf_stats self.logical_stats = logical_stats self.usage_perf_stats = usage_perf_stats <|end_body_0|> <|body_start_1|> if dictionary is None: ...
Implementation of the 'Storage Domain (View Box) Stats.' model. Provides statistics about the Storage Domain (View Box). Attributes: cloud_usage_perf_stats (UsageAndPerformanceStatistics): Provides usage and performance statistics for entities such as a disks, Nodes or Clusters. id (long|int): Specifies the id of the S...
StorageDomainViewBoxStats
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StorageDomainViewBoxStats: """Implementation of the 'Storage Domain (View Box) Stats.' model. Provides statistics about the Storage Domain (View Box). Attributes: cloud_usage_perf_stats (UsageAndPerformanceStatistics): Provides usage and performance statistics for entities such as a disks, Nodes ...
stack_v2_sparse_classes_36k_train_016364
3,967
permissive
[ { "docstring": "Constructor for the StorageDomainViewBoxStats class", "name": "__init__", "signature": "def __init__(self, cloud_usage_perf_stats=None, id=None, local_usage_perf_stats=None, logical_stats=None, usage_perf_stats=None)" }, { "docstring": "Creates an instance of this model from a di...
2
stack_v2_sparse_classes_30k_train_007182
Implement the Python class `StorageDomainViewBoxStats` described below. Class description: Implementation of the 'Storage Domain (View Box) Stats.' model. Provides statistics about the Storage Domain (View Box). Attributes: cloud_usage_perf_stats (UsageAndPerformanceStatistics): Provides usage and performance statisti...
Implement the Python class `StorageDomainViewBoxStats` described below. Class description: Implementation of the 'Storage Domain (View Box) Stats.' model. Provides statistics about the Storage Domain (View Box). Attributes: cloud_usage_perf_stats (UsageAndPerformanceStatistics): Provides usage and performance statisti...
07c5adee58810979780679065250d82b4b2cdaab
<|skeleton|> class StorageDomainViewBoxStats: """Implementation of the 'Storage Domain (View Box) Stats.' model. Provides statistics about the Storage Domain (View Box). Attributes: cloud_usage_perf_stats (UsageAndPerformanceStatistics): Provides usage and performance statistics for entities such as a disks, Nodes ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StorageDomainViewBoxStats: """Implementation of the 'Storage Domain (View Box) Stats.' model. Provides statistics about the Storage Domain (View Box). Attributes: cloud_usage_perf_stats (UsageAndPerformanceStatistics): Provides usage and performance statistics for entities such as a disks, Nodes or Clusters. ...
the_stack_v2_python_sparse
cohesity_management_sdk/models/storage_domain_view_box_stats.py
hemanshu-cohesity/management-sdk-python
train
0
f2d2aaf2387714112c9fcce70df4a07e61d62267
[ "threading.Thread.__init__(self, group=group, target=target, name=name, args=args, kwargs=kw_args)\nself._srvr = SOAPpy.WSDL.Proxy(wsdl)\nself._queue = queue\nself._lock = threading.Lock()", "while True:\n function, item, output = self._queue.get()\n try:\n info = eval('self._srvr.%s(item)' % functio...
<|body_start_0|> threading.Thread.__init__(self, group=group, target=target, name=name, args=args, kwargs=kw_args) self._srvr = SOAPpy.WSDL.Proxy(wsdl) self._queue = queue self._lock = threading.Lock() <|end_body_0|> <|body_start_1|> while True: function, item, outpu...
A Thread class that fetches instructions from the queue passed to the constructor and queries the given WSDL server attaching the result to a given list. Notes ----- Requires SOAPpy and an active internet connection.
ThreadedWSDLFetcher
[ "BSD-3-Clause", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ThreadedWSDLFetcher: """A Thread class that fetches instructions from the queue passed to the constructor and queries the given WSDL server attaching the result to a given list. Notes ----- Requires SOAPpy and an active internet connection.""" def __init__(self, queue, wsdl, group=None, targ...
stack_v2_sparse_classes_36k_train_016365
2,483
permissive
[ { "docstring": "Parameters ---------- queue: Queue.Queue Task queue that contains triples of a string with the function name to be queried on the WSDL server, the query string, and the container (list) to attach results to. wsdl: str URL of the WSDL server. The remaining parameters are the same as for the threa...
2
null
Implement the Python class `ThreadedWSDLFetcher` described below. Class description: A Thread class that fetches instructions from the queue passed to the constructor and queries the given WSDL server attaching the result to a given list. Notes ----- Requires SOAPpy and an active internet connection. Method signature...
Implement the Python class `ThreadedWSDLFetcher` described below. Class description: A Thread class that fetches instructions from the queue passed to the constructor and queries the given WSDL server attaching the result to a given list. Notes ----- Requires SOAPpy and an active internet connection. Method signature...
9459b51bb6f33c7d3c644cd95a9d72a0862470e6
<|skeleton|> class ThreadedWSDLFetcher: """A Thread class that fetches instructions from the queue passed to the constructor and queries the given WSDL server attaching the result to a given list. Notes ----- Requires SOAPpy and an active internet connection.""" def __init__(self, queue, wsdl, group=None, targ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ThreadedWSDLFetcher: """A Thread class that fetches instructions from the queue passed to the constructor and queries the given WSDL server attaching the result to a given list. Notes ----- Requires SOAPpy and an active internet connection.""" def __init__(self, queue, wsdl, group=None, target=None, name...
the_stack_v2_python_sparse
pyorganism/io/wsdl.py
Midnighter/pyorganism
train
2
f9c7319db39b3df434095214e3595f804c9b5753
[ "super().__init__(remove_numeric_tables=remove_numeric_tables, valid_languages=valid_languages, id_hash_keys=id_hash_keys)\ntry:\n subprocess.run(['pdftotext', '-v'], shell=False, check=False)\nexcept FileNotFoundError:\n raise FileNotFoundError('pdftotext is not installed. It is part of xpdf or poppler-utils...
<|body_start_0|> super().__init__(remove_numeric_tables=remove_numeric_tables, valid_languages=valid_languages, id_hash_keys=id_hash_keys) try: subprocess.run(['pdftotext', '-v'], shell=False, check=False) except FileNotFoundError: raise FileNotFoundError('pdftotext is no...
PDFToTextConverter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PDFToTextConverter: def __init__(self, remove_numeric_tables: bool=False, valid_languages: Optional[List[str]]=None, id_hash_keys: Optional[List[str]]=None, encoding: Optional[str]='UTF-8', keep_physical_layout: bool=False): """:param remove_numeric_tables: This option uses heuristics to...
stack_v2_sparse_classes_36k_train_016366
10,480
permissive
[ { "docstring": ":param remove_numeric_tables: This option uses heuristics to remove numeric rows from the tables. The tabular structures in documents might be noise for the reader model if it does not have table parsing capability for finding answers. However, tables may also have long strings that could possib...
3
null
Implement the Python class `PDFToTextConverter` described below. Class description: Implement the PDFToTextConverter class. Method signatures and docstrings: - def __init__(self, remove_numeric_tables: bool=False, valid_languages: Optional[List[str]]=None, id_hash_keys: Optional[List[str]]=None, encoding: Optional[st...
Implement the Python class `PDFToTextConverter` described below. Class description: Implement the PDFToTextConverter class. Method signatures and docstrings: - def __init__(self, remove_numeric_tables: bool=False, valid_languages: Optional[List[str]]=None, id_hash_keys: Optional[List[str]]=None, encoding: Optional[st...
5f1256ac7e5734c2ea481e72cb7e02c34baf8c43
<|skeleton|> class PDFToTextConverter: def __init__(self, remove_numeric_tables: bool=False, valid_languages: Optional[List[str]]=None, id_hash_keys: Optional[List[str]]=None, encoding: Optional[str]='UTF-8', keep_physical_layout: bool=False): """:param remove_numeric_tables: This option uses heuristics to...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PDFToTextConverter: def __init__(self, remove_numeric_tables: bool=False, valid_languages: Optional[List[str]]=None, id_hash_keys: Optional[List[str]]=None, encoding: Optional[str]='UTF-8', keep_physical_layout: bool=False): """:param remove_numeric_tables: This option uses heuristics to remove numeri...
the_stack_v2_python_sparse
haystack/nodes/file_converter/pdf_xpdf.py
deepset-ai/haystack
train
10,599
d37be7fe6b82b7b17c5bd0e911423c2ed07a19d0
[ "try:\n response = generation_ad_dict(ad_id)\nexcept AdDoesNotExists:\n return ('', 404)\nreturn jsonify(response)", "with db.connection as connection:\n as_service = AdsService(connection)\n try:\n as_service.read_ad(ad_id)\n except AdDoesNotExists:\n pass\n else:\n as_serv...
<|body_start_0|> try: response = generation_ad_dict(ad_id) except AdDoesNotExists: return ('', 404) return jsonify(response) <|end_body_0|> <|body_start_1|> with db.connection as connection: as_service = AdsService(connection) try: ...
AdView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdView: def get(self, ad_id): """Получение объявления с указанным id""" <|body_0|> def delete(self, ad_id, user): """Удаление объявления с указанным id""" <|body_1|> def patch(self, ad_id, user): """Частичное редактирование объявления с указанным...
stack_v2_sparse_classes_36k_train_016367
5,760
no_license
[ { "docstring": "Получение объявления с указанным id", "name": "get", "signature": "def get(self, ad_id)" }, { "docstring": "Удаление объявления с указанным id", "name": "delete", "signature": "def delete(self, ad_id, user)" }, { "docstring": "Частичное редактирование объявления с...
3
stack_v2_sparse_classes_30k_train_020660
Implement the Python class `AdView` described below. Class description: Implement the AdView class. Method signatures and docstrings: - def get(self, ad_id): Получение объявления с указанным id - def delete(self, ad_id, user): Удаление объявления с указанным id - def patch(self, ad_id, user): Частичное редактирование...
Implement the Python class `AdView` described below. Class description: Implement the AdView class. Method signatures and docstrings: - def get(self, ad_id): Получение объявления с указанным id - def delete(self, ad_id, user): Удаление объявления с указанным id - def patch(self, ad_id, user): Частичное редактирование...
79b0563f654016f7d56d988988ddc4bfdb0f1474
<|skeleton|> class AdView: def get(self, ad_id): """Получение объявления с указанным id""" <|body_0|> def delete(self, ad_id, user): """Удаление объявления с указанным id""" <|body_1|> def patch(self, ad_id, user): """Частичное редактирование объявления с указанным...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdView: def get(self, ad_id): """Получение объявления с указанным id""" try: response = generation_ad_dict(ad_id) except AdDoesNotExists: return ('', 404) return jsonify(response) def delete(self, ad_id, user): """Удаление объявления с указа...
the_stack_v2_python_sparse
Lesson 13/final v 2.0/src/blueprints/ads.py
Alexey7953/antida-school
train
0
3aaadc42f36f07cc21a0ad7b0e2755f8c0ce2980
[ "self.legend = legend\nself.ax = ax\nself.colors = ['b', 'g', 'r', 'c', 'm', 'y', 'b']\nself.line_styles = ['-', '-', '--', '-.', ':']\nself.line = []\nself.ax.set_ylabel(ylabel)\nself.ax.set_xlabel(xlabel)\nself.ax.set_title(title)\nself.ax.grid(True)\nself.init = True", "if self.init == True:\n for i in rang...
<|body_start_0|> self.legend = legend self.ax = ax self.colors = ['b', 'g', 'r', 'c', 'm', 'y', 'b'] self.line_styles = ['-', '-', '--', '-.', ':'] self.line = [] self.ax.set_ylabel(ylabel) self.ax.set_xlabel(xlabel) self.ax.set_title(title) self.a...
Create each individual subplot.
myPlot
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class myPlot: """Create each individual subplot.""" def __init__(self, ax, xlabel='', ylabel='', title='', legend=None): """ax - This is a handle to the axes of the figure xlable - Label of the x-axis ylable - Label of the y-axis title - Plot title legend - A tuple of strings that identify...
stack_v2_sparse_classes_36k_train_016368
4,495
permissive
[ { "docstring": "ax - This is a handle to the axes of the figure xlable - Label of the x-axis ylable - Label of the y-axis title - Plot title legend - A tuple of strings that identify the data. EX: (\"data1\",\"data2\", ... , \"dataN\")", "name": "__init__", "signature": "def __init__(self, ax, xlabel=''...
2
stack_v2_sparse_classes_30k_train_008248
Implement the Python class `myPlot` described below. Class description: Create each individual subplot. Method signatures and docstrings: - def __init__(self, ax, xlabel='', ylabel='', title='', legend=None): ax - This is a handle to the axes of the figure xlable - Label of the x-axis ylable - Label of the y-axis tit...
Implement the Python class `myPlot` described below. Class description: Create each individual subplot. Method signatures and docstrings: - def __init__(self, ax, xlabel='', ylabel='', title='', legend=None): ax - This is a handle to the axes of the figure xlable - Label of the x-axis ylable - Label of the y-axis tit...
2a6b147aa583cf5329ce9c84b0d84d72aba2bda4
<|skeleton|> class myPlot: """Create each individual subplot.""" def __init__(self, ax, xlabel='', ylabel='', title='', legend=None): """ax - This is a handle to the axes of the figure xlable - Label of the x-axis ylable - Label of the y-axis title - Plot title legend - A tuple of strings that identify...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class myPlot: """Create each individual subplot.""" def __init__(self, ax, xlabel='', ylabel='', title='', legend=None): """ax - This is a handle to the axes of the figure xlable - Label of the x-axis ylable - Label of the y-axis title - Plot title legend - A tuple of strings that identify the data. EX...
the_stack_v2_python_sparse
x11/dataPlotter.py
Shirshakk-P/ControlSystems
train
2
f72c1f467f8ef6a333d83d7e6c8faabf4b458d37
[ "cell = reference_element.UFCInterval()\npolynomial_space = polynomial_set.ONPolynomialSet(cell, degree)\ndual = TimeElementDualSet(family, degree)\nfinite_element.FiniteElement.__init__(self, polynomial_space, dual, degree)", "n = len(self.dual.coords)\nif n == 0:\n weights[0] = 2.0\n return weights\nA = e...
<|body_start_0|> cell = reference_element.UFCInterval() polynomial_space = polynomial_set.ONPolynomialSet(cell, degree) dual = TimeElementDualSet(family, degree) finite_element.FiniteElement.__init__(self, polynomial_space, dual, degree) <|end_body_0|> <|body_start_1|> n = len(s...
.
TimeElement
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimeElement: """.""" def __init__(self, family, degree): """Create time element with given (polynomial degree).""" <|body_0|> def compute_quadrature_weights(self): """Compute the quadrature weights by solving a linear system of equations for exact integration of ...
stack_v2_sparse_classes_36k_train_016369
4,109
no_license
[ { "docstring": "Create time element with given (polynomial degree).", "name": "__init__", "signature": "def __init__(self, family, degree)" }, { "docstring": "Compute the quadrature weights by solving a linear system of equations for exact integration of polynomials. We compute the integrals ove...
2
null
Implement the Python class `TimeElement` described below. Class description: . Method signatures and docstrings: - def __init__(self, family, degree): Create time element with given (polynomial degree). - def compute_quadrature_weights(self): Compute the quadrature weights by solving a linear system of equations for ...
Implement the Python class `TimeElement` described below. Class description: . Method signatures and docstrings: - def __init__(self, family, degree): Create time element with given (polynomial degree). - def compute_quadrature_weights(self): Compute the quadrature weights by solving a linear system of equations for ...
7af15cd0ab522436ca285f8422faa42675345f55
<|skeleton|> class TimeElement: """.""" def __init__(self, family, degree): """Create time element with given (polynomial degree).""" <|body_0|> def compute_quadrature_weights(self): """Compute the quadrature weights by solving a linear system of equations for exact integration of ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TimeElement: """.""" def __init__(self, family, degree): """Create time element with given (polynomial degree).""" cell = reference_element.UFCInterval() polynomial_space = polynomial_set.ONPolynomialSet(cell, degree) dual = TimeElementDualSet(family, degree) finit...
the_stack_v2_python_sparse
Lib/site-packages/ffc/timeelements.py
maciekswat/dolfin_python_deps
train
0
f9792b3debd0d998d46d1a0cf45c1414b5d6202c
[ "if ip_format not in ('ip4', 'ip6'):\n raise ValueError('Ip not in correct format!')\nsw_if_index = Topology.get_interface_sw_index(node, interface)\nwith VatTerminal(node) as vat:\n vat.vat_terminal_exec_cmd_from_template('cop_whitelist.vat', sw_if_index=sw_if_index, ip=ip_format, fib_id=fib_id)", "state =...
<|body_start_0|> if ip_format not in ('ip4', 'ip6'): raise ValueError('Ip not in correct format!') sw_if_index = Topology.get_interface_sw_index(node, interface) with VatTerminal(node) as vat: vat.vat_terminal_exec_cmd_from_template('cop_whitelist.vat', sw_if_index=sw_if_...
COP utilities.
Cop
[ "CC-BY-4.0", "Apache-2.0", "LicenseRef-scancode-dco-1.1" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cop: """COP utilities.""" def cop_add_whitelist_entry(node, interface, ip_format, fib_id): """Add cop whitelisted entry. :param node: Node to add COP whitelist on. :param interface: Interface of the node where the COP is added. :param ip_format: IP format : ip4 or ip6 are valid forma...
stack_v2_sparse_classes_36k_train_016370
2,782
permissive
[ { "docstring": "Add cop whitelisted entry. :param node: Node to add COP whitelist on. :param interface: Interface of the node where the COP is added. :param ip_format: IP format : ip4 or ip6 are valid formats. :param fib_id: Specify the fib table ID. :type node: dict :type interface: str :type ip_format: str :t...
2
null
Implement the Python class `Cop` described below. Class description: COP utilities. Method signatures and docstrings: - def cop_add_whitelist_entry(node, interface, ip_format, fib_id): Add cop whitelisted entry. :param node: Node to add COP whitelist on. :param interface: Interface of the node where the COP is added....
Implement the Python class `Cop` described below. Class description: COP utilities. Method signatures and docstrings: - def cop_add_whitelist_entry(node, interface, ip_format, fib_id): Add cop whitelisted entry. :param node: Node to add COP whitelist on. :param interface: Interface of the node where the COP is added....
3151c98618c78e3782e48bbe4d9c8f906c126f69
<|skeleton|> class Cop: """COP utilities.""" def cop_add_whitelist_entry(node, interface, ip_format, fib_id): """Add cop whitelisted entry. :param node: Node to add COP whitelist on. :param interface: Interface of the node where the COP is added. :param ip_format: IP format : ip4 or ip6 are valid forma...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Cop: """COP utilities.""" def cop_add_whitelist_entry(node, interface, ip_format, fib_id): """Add cop whitelisted entry. :param node: Node to add COP whitelist on. :param interface: Interface of the node where the COP is added. :param ip_format: IP format : ip4 or ip6 are valid formats. :param fi...
the_stack_v2_python_sparse
resources/libraries/python/Cop.py
preym17/csit
train
0
c516da3ef72bb0e501cfc1485a308745d93c155a
[ "super(MultiHeadAttention, self).__init__()\nself.h = h\nself.dm = dm\nself.depth = int(dm / h)\nself.Wq = tf.keras.layers.Dense(dm)\nself.Wk = tf.keras.layers.Dense(dm)\nself.Wv = tf.keras.layers.Dense(dm)\nself.linear = tf.keras.layers.Dense(dm)", "x = tf.reshape(x, (batch_size, -1, self.h, self.depth))\nx = tf...
<|body_start_0|> super(MultiHeadAttention, self).__init__() self.h = h self.dm = dm self.depth = int(dm / h) self.Wq = tf.keras.layers.Dense(dm) self.Wk = tf.keras.layers.Dense(dm) self.Wv = tf.keras.layers.Dense(dm) self.linear = tf.keras.layers.Dense(dm)...
class that instantiates a multi-head attention block
MultiHeadAttention
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiHeadAttention: """class that instantiates a multi-head attention block""" def __init__(self, dm, h): """constructor""" <|body_0|> def split_heads(self, x, batch_size): """function that splits data over the last axis of any given array""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_016371
2,684
no_license
[ { "docstring": "constructor", "name": "__init__", "signature": "def __init__(self, dm, h)" }, { "docstring": "function that splits data over the last axis of any given array", "name": "split_heads", "signature": "def split_heads(self, x, batch_size)" }, { "docstring": "function t...
3
null
Implement the Python class `MultiHeadAttention` described below. Class description: class that instantiates a multi-head attention block Method signatures and docstrings: - def __init__(self, dm, h): constructor - def split_heads(self, x, batch_size): function that splits data over the last axis of any given array - ...
Implement the Python class `MultiHeadAttention` described below. Class description: class that instantiates a multi-head attention block Method signatures and docstrings: - def __init__(self, dm, h): constructor - def split_heads(self, x, batch_size): function that splits data over the last axis of any given array - ...
7d3b348aec3b20da25b162b71f150c87c7c28d71
<|skeleton|> class MultiHeadAttention: """class that instantiates a multi-head attention block""" def __init__(self, dm, h): """constructor""" <|body_0|> def split_heads(self, x, batch_size): """function that splits data over the last axis of any given array""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiHeadAttention: """class that instantiates a multi-head attention block""" def __init__(self, dm, h): """constructor""" super(MultiHeadAttention, self).__init__() self.h = h self.dm = dm self.depth = int(dm / h) self.Wq = tf.keras.layers.Dense(dm) ...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/6-multihead_attention.py
dacastanogo/holbertonschool-machine_learning
train
0
79468e7349b3ff1dac533c0f751bfed38c7a080f
[ "self.eks = AwsClient().connect('eks', region_name)\ntry:\n self.eks.list_clusters()\nexcept EndpointConnectionError:\n print('eks resource is not available in this aws region')\n return", "for cluster in self.list_clusters(older_than_seconds):\n try:\n self.eks.delete_cluster(name=cluster)\n ...
<|body_start_0|> self.eks = AwsClient().connect('eks', region_name) try: self.eks.list_clusters() except EndpointConnectionError: print('eks resource is not available in this aws region') return <|end_body_0|> <|body_start_1|> for cluster in self.list...
Abstract eks nuke in a class.
NukeEks
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NukeEks: """Abstract eks nuke in a class.""" def __init__(self, region_name=None) -> None: """Initialize eks nuke.""" <|body_0|> def nuke(self, older_than_seconds: float) -> None: """EKS cluster deleting function. Deleting all EKS clusters with a timestamp greate...
stack_v2_sparse_classes_36k_train_016372
1,891
permissive
[ { "docstring": "Initialize eks nuke.", "name": "__init__", "signature": "def __init__(self, region_name=None) -> None" }, { "docstring": "EKS cluster deleting function. Deleting all EKS clusters with a timestamp greater than older_than_seconds. :param int older_than_seconds: The timestamp in sec...
3
stack_v2_sparse_classes_30k_train_011239
Implement the Python class `NukeEks` described below. Class description: Abstract eks nuke in a class. Method signatures and docstrings: - def __init__(self, region_name=None) -> None: Initialize eks nuke. - def nuke(self, older_than_seconds: float) -> None: EKS cluster deleting function. Deleting all EKS clusters wi...
Implement the Python class `NukeEks` described below. Class description: Abstract eks nuke in a class. Method signatures and docstrings: - def __init__(self, region_name=None) -> None: Initialize eks nuke. - def nuke(self, older_than_seconds: float) -> None: EKS cluster deleting function. Deleting all EKS clusters wi...
25c4159e71935a9903a41540c168992586c5ba0c
<|skeleton|> class NukeEks: """Abstract eks nuke in a class.""" def __init__(self, region_name=None) -> None: """Initialize eks nuke.""" <|body_0|> def nuke(self, older_than_seconds: float) -> None: """EKS cluster deleting function. Deleting all EKS clusters with a timestamp greate...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NukeEks: """Abstract eks nuke in a class.""" def __init__(self, region_name=None) -> None: """Initialize eks nuke.""" self.eks = AwsClient().connect('eks', region_name) try: self.eks.list_clusters() except EndpointConnectionError: print('eks resourc...
the_stack_v2_python_sparse
package/nuke/compute/eks.py
diodonfrost/terraform-aws-lambda-nuke
train
20
279420c1e8747fb5ec7221ab3cd35e5f87fd5e45
[ "if value is self.field.missing_value:\n return value\nelse:\n data = []\n for dict_ in value:\n new_dict = AttributeDict()\n for key, value in dict_.items():\n if isinstance(value, list):\n new_dict[key.encode('utf-8')] = [x.encode('utf-8') for x in value]\n ...
<|body_start_0|> if value is self.field.missing_value: return value else: data = [] for dict_ in value: new_dict = AttributeDict() for key, value in dict_.items(): if isinstance(value, list): ...
Converts values for use with QueryStringWidget (make z3c.form happy)
QueryStringConverter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QueryStringConverter: """Converts values for use with QueryStringWidget (make z3c.form happy)""" def toWidgetValue(self, value): """Converts given value for use in the widget""" <|body_0|> def toFieldValue(self, value): """Converts value for use in the field""" ...
stack_v2_sparse_classes_36k_train_016373
1,802
no_license
[ { "docstring": "Converts given value for use in the widget", "name": "toWidgetValue", "signature": "def toWidgetValue(self, value)" }, { "docstring": "Converts value for use in the field", "name": "toFieldValue", "signature": "def toFieldValue(self, value)" } ]
2
null
Implement the Python class `QueryStringConverter` described below. Class description: Converts values for use with QueryStringWidget (make z3c.form happy) Method signatures and docstrings: - def toWidgetValue(self, value): Converts given value for use in the widget - def toFieldValue(self, value): Converts value for ...
Implement the Python class `QueryStringConverter` described below. Class description: Converts values for use with QueryStringWidget (make z3c.form happy) Method signatures and docstrings: - def toWidgetValue(self, value): Converts given value for use in the widget - def toFieldValue(self, value): Converts value for ...
8a7bdbdb98c3f9fc1073c6061cd2d3a0ec80caf5
<|skeleton|> class QueryStringConverter: """Converts values for use with QueryStringWidget (make z3c.form happy)""" def toWidgetValue(self, value): """Converts given value for use in the widget""" <|body_0|> def toFieldValue(self, value): """Converts value for use in the field""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QueryStringConverter: """Converts values for use with QueryStringWidget (make z3c.form happy)""" def toWidgetValue(self, value): """Converts given value for use in the widget""" if value is self.field.missing_value: return value else: data = [] ...
the_stack_v2_python_sparse
buildout-cache/eggs/plone.formwidget.querystring-1.1.6-py2.7.egg/plone/formwidget/querystring/converter.py
renansfs/Plone_SP
train
0
029085c0f2b9bb174b64cda4869d46b29a2dfe2c
[ "try:\n from config_parser import config_parser\n self.conf_file = current_file_path + '/../../conf/appviewx.conf'\n self.conf_data = config_parser(self.conf_file)\n self.hostname = socket.gethostbyname(socket.gethostname())\n self.path = self.conf_data['ENVIRONMENT']['path'][self.conf_data['ENVIRONM...
<|body_start_0|> try: from config_parser import config_parser self.conf_file = current_file_path + '/../../conf/appviewx.conf' self.conf_data = config_parser(self.conf_file) self.hostname = socket.gethostbyname(socket.gethostname()) self.path = self.co...
Class to Initialize Java Security.
JavaSecurity
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JavaSecurity: """Class to Initialize Java Security.""" def __init__(self): """The init function.""" <|body_0|> def change_data(source, destination): """Funtion to edit contents of file.""" <|body_1|> def initialize(self): """Function to start...
stack_v2_sparse_classes_36k_train_016374
3,199
no_license
[ { "docstring": "The init function.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Funtion to edit contents of file.", "name": "change_data", "signature": "def change_data(source, destination)" }, { "docstring": "Function to start java security.", "...
3
null
Implement the Python class `JavaSecurity` described below. Class description: Class to Initialize Java Security. Method signatures and docstrings: - def __init__(self): The init function. - def change_data(source, destination): Funtion to edit contents of file. - def initialize(self): Function to start java security.
Implement the Python class `JavaSecurity` described below. Class description: Class to Initialize Java Security. Method signatures and docstrings: - def __init__(self): The init function. - def change_data(source, destination): Funtion to edit contents of file. - def initialize(self): Function to start java security....
e513224364dce05ea4d17ac25ecfa981238b1311
<|skeleton|> class JavaSecurity: """Class to Initialize Java Security.""" def __init__(self): """The init function.""" <|body_0|> def change_data(source, destination): """Funtion to edit contents of file.""" <|body_1|> def initialize(self): """Function to start...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JavaSecurity: """Class to Initialize Java Security.""" def __init__(self): """The init function.""" try: from config_parser import config_parser self.conf_file = current_file_path + '/../../conf/appviewx.conf' self.conf_data = config_parser(self.conf_fi...
the_stack_v2_python_sparse
scripts_avx/scripts/scripts/Commons/java_security_python.py
Poonammahunta/Integration
train
0
fb1fb4c894d4500dcd26348b1275cd13bb4df206
[ "querydict = request.data\ndepart_name = querydict.getlist('class_name')[0]\ndepartment_table.objects.create(dname=depart_name)\nreturn Response({'message': 'ok'})", "querydict = request.data\ndepart_name = querydict.getlist('class_name')[0]\ndepartment = department_table.objects.get(dname=depart_name)\ndepartmen...
<|body_start_0|> querydict = request.data depart_name = querydict.getlist('class_name')[0] department_table.objects.create(dname=depart_name) return Response({'message': 'ok'}) <|end_body_0|> <|body_start_1|> querydict = request.data depart_name = querydict.getlist('clas...
系信息视图
DepartmentView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DepartmentView: """系信息视图""" def post(self, request): """创建系 路由:POST classes/depart/ 返回json: {"message": "ok"}""" <|body_0|> def delete(self, request): """创建系 路由:DELETE classes/depart/ 返回json: {"message": "ok"}""" <|body_1|> <|end_skeleton|> <|body_start...
stack_v2_sparse_classes_36k_train_016375
8,225
permissive
[ { "docstring": "创建系 路由:POST classes/depart/ 返回json: {\"message\": \"ok\"}", "name": "post", "signature": "def post(self, request)" }, { "docstring": "创建系 路由:DELETE classes/depart/ 返回json: {\"message\": \"ok\"}", "name": "delete", "signature": "def delete(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_009938
Implement the Python class `DepartmentView` described below. Class description: 系信息视图 Method signatures and docstrings: - def post(self, request): 创建系 路由:POST classes/depart/ 返回json: {"message": "ok"} - def delete(self, request): 创建系 路由:DELETE classes/depart/ 返回json: {"message": "ok"}
Implement the Python class `DepartmentView` described below. Class description: 系信息视图 Method signatures and docstrings: - def post(self, request): 创建系 路由:POST classes/depart/ 返回json: {"message": "ok"} - def delete(self, request): 创建系 路由:DELETE classes/depart/ 返回json: {"message": "ok"} <|skeleton|> class DepartmentVi...
0e926292d86070f6f42066e73374ea74e39ca169
<|skeleton|> class DepartmentView: """系信息视图""" def post(self, request): """创建系 路由:POST classes/depart/ 返回json: {"message": "ok"}""" <|body_0|> def delete(self, request): """创建系 路由:DELETE classes/depart/ 返回json: {"message": "ok"}""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DepartmentView: """系信息视图""" def post(self, request): """创建系 路由:POST classes/depart/ 返回json: {"message": "ok"}""" querydict = request.data depart_name = querydict.getlist('class_name')[0] department_table.objects.create(dname=depart_name) return Response({'message':...
the_stack_v2_python_sparse
ETMS/ETMS/apps/classes/views.py
17605272633/ETMS
train
1
3c8bfc768da508b2b192cae1a9c2a3a91c246c8c
[ "self.car = Car()\nself.car.set_attr(car.as_dict())\nself.load_plan = LoadPlan(self.car)\nself.load_plan_candidate_set = []", "total_cargo_list = cargo_management.cargo_list_filter([self.car.city])\ncargo_list = []\nfor c in total_cargo_list:\n while c.c_count > 1:\n tmp = Cargo()\n tmp.set_attr(...
<|body_start_0|> self.car = Car() self.car.set_attr(car.as_dict()) self.load_plan = LoadPlan(self.car) self.load_plan_candidate_set = [] <|end_body_0|> <|body_start_1|> total_cargo_list = cargo_management.cargo_list_filter([self.car.city]) cargo_list = [] for c i...
Heuristic
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Heuristic: def __init__(self, car): """构造函数 :param car: 车辆信息json""" <|body_0|> def distribution(self): """分货功能:分出推荐车次(goods_list-->load_task),标记推荐车次,数据写库维护 :return: self.load_task type:LoadTask 推荐车次""" <|body_1|> <|end_skeleton|> <|body_start_0|> se...
stack_v2_sparse_classes_36k_train_016376
9,204
no_license
[ { "docstring": "构造函数 :param car: 车辆信息json", "name": "__init__", "signature": "def __init__(self, car)" }, { "docstring": "分货功能:分出推荐车次(goods_list-->load_task),标记推荐车次,数据写库维护 :return: self.load_task type:LoadTask 推荐车次", "name": "distribution", "signature": "def distribution(self)" } ]
2
null
Implement the Python class `Heuristic` described below. Class description: Implement the Heuristic class. Method signatures and docstrings: - def __init__(self, car): 构造函数 :param car: 车辆信息json - def distribution(self): 分货功能:分出推荐车次(goods_list-->load_task),标记推荐车次,数据写库维护 :return: self.load_task type:LoadTask 推荐车次
Implement the Python class `Heuristic` described below. Class description: Implement the Heuristic class. Method signatures and docstrings: - def __init__(self, car): 构造函数 :param car: 车辆信息json - def distribution(self): 分货功能:分出推荐车次(goods_list-->load_task),标记推荐车次,数据写库维护 :return: self.load_task type:LoadTask 推荐车次 <|ske...
ca9940afa9e41510a7ec641fc87b6d27d32c5409
<|skeleton|> class Heuristic: def __init__(self, car): """构造函数 :param car: 车辆信息json""" <|body_0|> def distribution(self): """分货功能:分出推荐车次(goods_list-->load_task),标记推荐车次,数据写库维护 :return: self.load_task type:LoadTask 推荐车次""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Heuristic: def __init__(self, car): """构造函数 :param car: 车辆信息json""" self.car = Car() self.car.set_attr(car.as_dict()) self.load_plan = LoadPlan(self.car) self.load_plan_candidate_set = [] def distribution(self): """分货功能:分出推荐车次(goods_list-->load_task),标记推荐车次...
the_stack_v2_python_sparse
app/main/models/heuristic_algorithm.py
KirsVon/ILPD
train
0
74ba213d4fab33b0a7cfabe35671d93818512ca4
[ "self.s_g = s_g\nself.s_s = s_s\nself.h = h\nself.alpha = alpha\nself.ratio_s_g = ratio_s_g", "assert len(f1.shape) == 1, 'input must be 1d ndarray'\nassert len(f2.shape) == 1, 'input must be 1d ndarray'\nassert f1.shape == f2.shape\nn_trial = len(f1)\nf1_ = np.tile(f1, (n_samp, 1)) + self.s_s * np.random.randn(n...
<|body_start_0|> self.s_g = s_g self.s_s = s_s self.h = h self.alpha = alpha self.ratio_s_g = ratio_s_g <|end_body_0|> <|body_start_1|> assert len(f1.shape) == 1, 'input must be 1d ndarray' assert len(f2.shape) == 1, 'input must be 1d ndarray' assert f1.s...
RecencyModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RecencyModel: def __init__(self, s_g, s_s, alpha=0.0, h=0.0, ratio_s_g=1): """Constructor :param s_g: std of gaussian part of unigauss :param h: weight of flat prior in unigauss mixture assuming unnormalized gaussians sharing the same variance :param s_s: std of likelihood :param alpha: ...
stack_v2_sparse_classes_36k_train_016377
11,426
no_license
[ { "docstring": "Constructor :param s_g: std of gaussian part of unigauss :param h: weight of flat prior in unigauss mixture assuming unnormalized gaussians sharing the same variance :param s_s: std of likelihood :param alpha: ratio between gaussians", "name": "__init__", "signature": "def __init__(self,...
2
stack_v2_sparse_classes_30k_train_009080
Implement the Python class `RecencyModel` described below. Class description: Implement the RecencyModel class. Method signatures and docstrings: - def __init__(self, s_g, s_s, alpha=0.0, h=0.0, ratio_s_g=1): Constructor :param s_g: std of gaussian part of unigauss :param h: weight of flat prior in unigauss mixture a...
Implement the Python class `RecencyModel` described below. Class description: Implement the RecencyModel class. Method signatures and docstrings: - def __init__(self, s_g, s_s, alpha=0.0, h=0.0, ratio_s_g=1): Constructor :param s_g: std of gaussian part of unigauss :param h: weight of flat prior in unigauss mixture a...
2a05aa98b501c8633e1fe2baf611d137740709de
<|skeleton|> class RecencyModel: def __init__(self, s_g, s_s, alpha=0.0, h=0.0, ratio_s_g=1): """Constructor :param s_g: std of gaussian part of unigauss :param h: weight of flat prior in unigauss mixture assuming unnormalized gaussians sharing the same variance :param s_s: std of likelihood :param alpha: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RecencyModel: def __init__(self, s_g, s_s, alpha=0.0, h=0.0, ratio_s_g=1): """Constructor :param s_g: std of gaussian part of unigauss :param h: weight of flat prior in unigauss mixture assuming unnormalized gaussians sharing the same variance :param s_s: std of likelihood :param alpha: ratio between ...
the_stack_v2_python_sparse
model/simple_model.py
ItayLieder/GMM_simulations
train
0
ff3e713bda33fe18287774cf6e4c22000bc7b201
[ "def dfs(root, curMax):\n if not root:\n return 0\n if root.val >= curMax:\n cur = 1\n curMax = max(curMax, root.val)\n else:\n cur = 0\n return cur + dfs(root.left, curMax) + dfs(root.right, curMax)\nres = dfs(root, root.val)\nreturn res", "self.count = 0\n\ndef dfs(root, ...
<|body_start_0|> def dfs(root, curMax): if not root: return 0 if root.val >= curMax: cur = 1 curMax = max(curMax, root.val) else: cur = 0 return cur + dfs(root.left, curMax) + dfs(root.right, curMax) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def goodNodes1(self, root): """:type root: TreeNode :rtype: int my own solution: pass curMax value down to the subtrees if current is good node, ie curcount += 1 and update curMax""" <|body_0|> def goodNodes2(self, root): """:type root: TreeNode :rtype: int...
stack_v2_sparse_classes_36k_train_016378
1,298
no_license
[ { "docstring": ":type root: TreeNode :rtype: int my own solution: pass curMax value down to the subtrees if current is good node, ie curcount += 1 and update curMax", "name": "goodNodes1", "signature": "def goodNodes1(self, root)" }, { "docstring": ":type root: TreeNode :rtype: int", "name":...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def goodNodes1(self, root): :type root: TreeNode :rtype: int my own solution: pass curMax value down to the subtrees if current is good node, ie curcount += 1 and update curMax -...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def goodNodes1(self, root): :type root: TreeNode :rtype: int my own solution: pass curMax value down to the subtrees if current is good node, ie curcount += 1 and update curMax -...
813235789ce422a3bab198317aafc46fbc61625e
<|skeleton|> class Solution: def goodNodes1(self, root): """:type root: TreeNode :rtype: int my own solution: pass curMax value down to the subtrees if current is good node, ie curcount += 1 and update curMax""" <|body_0|> def goodNodes2(self, root): """:type root: TreeNode :rtype: int...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def goodNodes1(self, root): """:type root: TreeNode :rtype: int my own solution: pass curMax value down to the subtrees if current is good node, ie curcount += 1 and update curMax""" def dfs(root, curMax): if not root: return 0 if root.val >= c...
the_stack_v2_python_sparse
7.BINARY TREE and BST/1448_count_good_nodes/solution.py
kimmyoo/python_leetcode
train
1
9a271f9b08b3c1b6fd0d99f87872cbeb78d93115
[ "if db_field.name == 'user':\n kwargs['queryset'] = User.objects.filter(id=request.user.id)\n kwargs['initial'] = request.user.id\nelif db_field.name == 'topic' and (not request.user.is_superuser):\n kwargs['queryset'] = Topic.objects.filter(id__in=request.user.profile.topics.all())\nreturn super(TaskAdmin...
<|body_start_0|> if db_field.name == 'user': kwargs['queryset'] = User.objects.filter(id=request.user.id) kwargs['initial'] = request.user.id elif db_field.name == 'topic' and (not request.user.is_superuser): kwargs['queryset'] = Topic.objects.filter(id__in=request.us...
TaskAdmin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TaskAdmin: def formfield_for_foreignkey(self, db_field, request, **kwargs): """Assigns default value for User field. limits Topics field to user's topics.""" <|body_0|> def formfield_for_manytomany(self, db_field, request, **kwargs): """Limits the choices of professo...
stack_v2_sparse_classes_36k_train_016379
9,167
permissive
[ { "docstring": "Assigns default value for User field. limits Topics field to user's topics.", "name": "formfield_for_foreignkey", "signature": "def formfield_for_foreignkey(self, db_field, request, **kwargs)" }, { "docstring": "Limits the choices of professors for the limit of user.", "name"...
3
stack_v2_sparse_classes_30k_train_021409
Implement the Python class `TaskAdmin` described below. Class description: Implement the TaskAdmin class. Method signatures and docstrings: - def formfield_for_foreignkey(self, db_field, request, **kwargs): Assigns default value for User field. limits Topics field to user's topics. - def formfield_for_manytomany(self...
Implement the Python class `TaskAdmin` described below. Class description: Implement the TaskAdmin class. Method signatures and docstrings: - def formfield_for_foreignkey(self, db_field, request, **kwargs): Assigns default value for User field. limits Topics field to user's topics. - def formfield_for_manytomany(self...
70638c121ea85ff0e6a650c5f2641b0b3b04d6d0
<|skeleton|> class TaskAdmin: def formfield_for_foreignkey(self, db_field, request, **kwargs): """Assigns default value for User field. limits Topics field to user's topics.""" <|body_0|> def formfield_for_manytomany(self, db_field, request, **kwargs): """Limits the choices of professo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TaskAdmin: def formfield_for_foreignkey(self, db_field, request, **kwargs): """Assigns default value for User field. limits Topics field to user's topics.""" if db_field.name == 'user': kwargs['queryset'] = User.objects.filter(id=request.user.id) kwargs['initial'] = req...
the_stack_v2_python_sparse
cms/admin.py
Ibrahem3amer/bala7
train
0
a851ef4865de1f429f5fb5c67bbe818ec6899f5f
[ "self.num_points = num_points\nself.column_names = []\nself.name_to_values = {}", "if isinstance(column_values, list) and isinstance(column_values[0], list):\n raise ValueError('\"column_values\" must be a flat list, but we detected that its first entry is a list')\nif isinstance(column_values, np.ndarray) and...
<|body_start_0|> self.num_points = num_points self.column_names = [] self.name_to_values = {} <|end_body_0|> <|body_start_1|> if isinstance(column_values, list) and isinstance(column_values[0], list): raise ValueError('"column_values" must be a flat list, but we detected tha...
Metadata container for an embedding. The metadata holds different columns with values used for visualization (color by, label by) in the "Embeddings" tab in TensorBoard.
EmbeddingMetadata
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmbeddingMetadata: """Metadata container for an embedding. The metadata holds different columns with values used for visualization (color by, label by) in the "Embeddings" tab in TensorBoard.""" def __init__(self, num_points): """Constructs a metadata for an embedding of the specifie...
stack_v2_sparse_classes_36k_train_016380
29,404
permissive
[ { "docstring": "Constructs a metadata for an embedding of the specified size. Args: num_points: Number of points in the embedding.", "name": "__init__", "signature": "def __init__(self, num_points)" }, { "docstring": "Adds a named column of metadata values. Args: column_name: Name of the column....
2
null
Implement the Python class `EmbeddingMetadata` described below. Class description: Metadata container for an embedding. The metadata holds different columns with values used for visualization (color by, label by) in the "Embeddings" tab in TensorBoard. Method signatures and docstrings: - def __init__(self, num_points...
Implement the Python class `EmbeddingMetadata` described below. Class description: Metadata container for an embedding. The metadata holds different columns with values used for visualization (color by, label by) in the "Embeddings" tab in TensorBoard. Method signatures and docstrings: - def __init__(self, num_points...
5961c76dca0fb9bb40d146f5ce13834ac29d8ddb
<|skeleton|> class EmbeddingMetadata: """Metadata container for an embedding. The metadata holds different columns with values used for visualization (color by, label by) in the "Embeddings" tab in TensorBoard.""" def __init__(self, num_points): """Constructs a metadata for an embedding of the specifie...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EmbeddingMetadata: """Metadata container for an embedding. The metadata holds different columns with values used for visualization (color by, label by) in the "Embeddings" tab in TensorBoard.""" def __init__(self, num_points): """Constructs a metadata for an embedding of the specified size. Args:...
the_stack_v2_python_sparse
tensorboard/plugins/projector/projector_plugin.py
tensorflow/tensorboard
train
6,766
9604adfb84b21b14d7e01f301f272979c7df43bd
[ "self.stop = stop\nself.stopwords = {'a', 'the', 'it', 'they', 'of', 'in', 'to', 'is', 'have', 'are', 'were', 'and', 'very', '.', ','}\nself.negwords = {'no', 'not', 'never', 'failed', 'rejected', 'denied'}\ntokenizer = RegexpTokenizer('[\\\\w.@:/]+|\\\\w+|\\\\$[\\\\d.]+')\nself.text_tokens = tokenizer.tokenize(rte...
<|body_start_0|> self.stop = stop self.stopwords = {'a', 'the', 'it', 'they', 'of', 'in', 'to', 'is', 'have', 'are', 'were', 'and', 'very', '.', ','} self.negwords = {'no', 'not', 'never', 'failed', 'rejected', 'denied'} tokenizer = RegexpTokenizer('[\\w.@:/]+|\\w+|\\$[\\d.]+') s...
This builds a bag of words for both the text and the hypothesis after throwing away some stopwords, then calculates overlap and difference.
RTEFeatureExtractor
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "CC-BY-NC-ND-3.0", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RTEFeatureExtractor: """This builds a bag of words for both the text and the hypothesis after throwing away some stopwords, then calculates overlap and difference.""" def __init__(self, rtepair, stop=True, use_lemmatize=False): """:param rtepair: a ``RTEPair`` from which features sho...
stack_v2_sparse_classes_36k_train_016381
6,118
permissive
[ { "docstring": ":param rtepair: a ``RTEPair`` from which features should be extracted :param stop: if ``True``, stopwords are thrown away. :type stop: bool", "name": "__init__", "signature": "def __init__(self, rtepair, stop=True, use_lemmatize=False)" }, { "docstring": "Compute the overlap betw...
5
null
Implement the Python class `RTEFeatureExtractor` described below. Class description: This builds a bag of words for both the text and the hypothesis after throwing away some stopwords, then calculates overlap and difference. Method signatures and docstrings: - def __init__(self, rtepair, stop=True, use_lemmatize=Fals...
Implement the Python class `RTEFeatureExtractor` described below. Class description: This builds a bag of words for both the text and the hypothesis after throwing away some stopwords, then calculates overlap and difference. Method signatures and docstrings: - def __init__(self, rtepair, stop=True, use_lemmatize=Fals...
582e6e35f0e6c984b44ec49dcb8846d9c011d0a8
<|skeleton|> class RTEFeatureExtractor: """This builds a bag of words for both the text and the hypothesis after throwing away some stopwords, then calculates overlap and difference.""" def __init__(self, rtepair, stop=True, use_lemmatize=False): """:param rtepair: a ``RTEPair`` from which features sho...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RTEFeatureExtractor: """This builds a bag of words for both the text and the hypothesis after throwing away some stopwords, then calculates overlap and difference.""" def __init__(self, rtepair, stop=True, use_lemmatize=False): """:param rtepair: a ``RTEPair`` from which features should be extrac...
the_stack_v2_python_sparse
nltk/classify/rte_classify.py
nltk/nltk
train
11,860
30e2d27fc53e42cf39c1ea4cb2952c67acaf8884
[ "super().__init__()\nself.batch = batch\nself.units = units\nself.embedding = tf.keras.layers.Embedding(input_dim=vocab, output_dim=embedding)\nself.gru = tf.keras.layers.GRU(units, recurrent_initializer='glorot_uniform', return_sequences=True, return_state=True)", "initializer = tf.keras.initializers.Zeros()\nhi...
<|body_start_0|> super().__init__() self.batch = batch self.units = units self.embedding = tf.keras.layers.Embedding(input_dim=vocab, output_dim=embedding) self.gru = tf.keras.layers.GRU(units, recurrent_initializer='glorot_uniform', return_sequences=True, return_state=True) <|en...
inherits from tensorflow.keras.layers.Layer to encode for machine translation:
RNNEncoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RNNEncoder: """inherits from tensorflow.keras.layers.Layer to encode for machine translation:""" def __init__(self, vocab, embedding, units, batch): """ARGS: vocab:{integer} :the size of the input vocabulary embedding:{integer} : the dimensionality of the embedding vector units:{inte...
stack_v2_sparse_classes_36k_train_016382
2,174
no_license
[ { "docstring": "ARGS: vocab:{integer} :the size of the input vocabulary embedding:{integer} : the dimensionality of the embedding vector units:{integer} : the number of hidden units in the RNN cell batch:{integer} : the batch size", "name": "__init__", "signature": "def __init__(self, vocab, embedding, ...
3
null
Implement the Python class `RNNEncoder` described below. Class description: inherits from tensorflow.keras.layers.Layer to encode for machine translation: Method signatures and docstrings: - def __init__(self, vocab, embedding, units, batch): ARGS: vocab:{integer} :the size of the input vocabulary embedding:{integer}...
Implement the Python class `RNNEncoder` described below. Class description: inherits from tensorflow.keras.layers.Layer to encode for machine translation: Method signatures and docstrings: - def __init__(self, vocab, embedding, units, batch): ARGS: vocab:{integer} :the size of the input vocabulary embedding:{integer}...
7dafc37d306fcf2ea0f5af5bd97dfd78d388100c
<|skeleton|> class RNNEncoder: """inherits from tensorflow.keras.layers.Layer to encode for machine translation:""" def __init__(self, vocab, embedding, units, batch): """ARGS: vocab:{integer} :the size of the input vocabulary embedding:{integer} : the dimensionality of the embedding vector units:{inte...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RNNEncoder: """inherits from tensorflow.keras.layers.Layer to encode for machine translation:""" def __init__(self, vocab, embedding, units, batch): """ARGS: vocab:{integer} :the size of the input vocabulary embedding:{integer} : the dimensionality of the embedding vector units:{integer} : the nu...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/0-rnn_encoder.py
AndresSern/holbertonschool-machine_learning-1
train
0
d4bcebc479d874819dcd1810a104354f9cc52b10
[ "show_in_tkinter.__init__(self)\nif testing:\n self.books_names = None\n self.x = None\n self.y = None\n self.y_mean = None\n self.y_mean_c1 = None\n self.y_mean_c2 = None\n self.label = None\n self.asymmetric_y_error = None\n self._generate_sample_data()\nelse:\n self.books_names = bo...
<|body_start_0|> show_in_tkinter.__init__(self) if testing: self.books_names = None self.x = None self.y = None self.y_mean = None self.y_mean_c1 = None self.y_mean_c2 = None self.label = None self.asymmetric...
A Class that store and handle showing the data in Error bar graph of all the books . The Class extend show_in_tkinter Class to implement showing the graph in tkniter.
Error_bar
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Error_bar: """A Class that store and handle showing the data in Error bar graph of all the books . The Class extend show_in_tkinter Class to implement showing the graph in tkniter.""" def __init__(self, books_names, x, y, y_mean, y_mean_c1, y_mean_c2, label: str, asymmetric_y_error: [[float]...
stack_v2_sparse_classes_36k_train_016383
4,519
no_license
[ { "docstring": "There is two ways to init, the default is receiving the data, and the other is generating random samples when testing is True (for testing purposes). Receive : books_names:[string] array of books names x: for book index or books names y: is the y value for the specific book y_mean: float the mea...
5
stack_v2_sparse_classes_30k_train_005677
Implement the Python class `Error_bar` described below. Class description: A Class that store and handle showing the data in Error bar graph of all the books . The Class extend show_in_tkinter Class to implement showing the graph in tkniter. Method signatures and docstrings: - def __init__(self, books_names, x, y, y_...
Implement the Python class `Error_bar` described below. Class description: A Class that store and handle showing the data in Error bar graph of all the books . The Class extend show_in_tkinter Class to implement showing the graph in tkniter. Method signatures and docstrings: - def __init__(self, books_names, x, y, y_...
c7349dd0501e9a0d47a8f1024762ee15b225c6e0
<|skeleton|> class Error_bar: """A Class that store and handle showing the data in Error bar graph of all the books . The Class extend show_in_tkinter Class to implement showing the graph in tkniter.""" def __init__(self, books_names, x, y, y_mean, y_mean_c1, y_mean_c2, label: str, asymmetric_y_error: [[float]...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Error_bar: """A Class that store and handle showing the data in Error bar graph of all the books . The Class extend show_in_tkinter Class to implement showing the graph in tkniter.""" def __init__(self, books_names, x, y, y_mean, y_mean_c1, y_mean_c2, label: str, asymmetric_y_error: [[float], [float]], t...
the_stack_v2_python_sparse
Show_results/Error_bar.py
saleems11/Final_Project_B
train
0
2145d50acf6e7994297b58a08e4b4d160f465644
[ "cluster_infos = []\nclusters = datastore_entities.ClusterInfo.query().fetch()\nfor cluster in clusters:\n host_msgs = []\n if request.include_hosts:\n host_msgs = self._GetHostsForCluster(cluster.cluster)\n cluster_infos.append(self._BuildClusterInfo(cluster, host_msgs))\nreturn ClusterInfoCollecti...
<|body_start_0|> cluster_infos = [] clusters = datastore_entities.ClusterInfo.query().fetch() for cluster in clusters: host_msgs = [] if request.include_hosts: host_msgs = self._GetHostsForCluster(cluster.cluster) cluster_infos.append(self._Bui...
A class for cluster API service.
ClusterApi
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClusterApi: """A class for cluster API service.""" def ListClusters(self, request): """Fetches a list of clusters that are available. Args: request: an API request. Returns: a ClusterInfoCollection object.""" <|body_0|> def GetCluster(self, request): """Fetches t...
stack_v2_sparse_classes_36k_train_016384
7,145
permissive
[ { "docstring": "Fetches a list of clusters that are available. Args: request: an API request. Returns: a ClusterInfoCollection object.", "name": "ListClusters", "signature": "def ListClusters(self, request)" }, { "docstring": "Fetches the information/status for a given cluster id. Args: request:...
5
null
Implement the Python class `ClusterApi` described below. Class description: A class for cluster API service. Method signatures and docstrings: - def ListClusters(self, request): Fetches a list of clusters that are available. Args: request: an API request. Returns: a ClusterInfoCollection object. - def GetCluster(self...
Implement the Python class `ClusterApi` described below. Class description: A class for cluster API service. Method signatures and docstrings: - def ListClusters(self, request): Fetches a list of clusters that are available. Args: request: an API request. Returns: a ClusterInfoCollection object. - def GetCluster(self...
0568fc1d9b9dca79aed2de493955ce1adebb1d6b
<|skeleton|> class ClusterApi: """A class for cluster API service.""" def ListClusters(self, request): """Fetches a list of clusters that are available. Args: request: an API request. Returns: a ClusterInfoCollection object.""" <|body_0|> def GetCluster(self, request): """Fetches t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClusterApi: """A class for cluster API service.""" def ListClusters(self, request): """Fetches a list of clusters that are available. Args: request: an API request. Returns: a ClusterInfoCollection object.""" cluster_infos = [] clusters = datastore_entities.ClusterInfo.query().fet...
the_stack_v2_python_sparse
tradefed_cluster/cluster_api.py
maksonlee/tradefed_cluster
train
0
029fd7c4aabe1ebcfd683db2b9668d059f5f4785
[ "B = []\nlength = len(A)\nfor i in range(length):\n B.append(int(str(A[i])[-k]))\nreturn B", "C = []\nB = _deepcopy(A)\nk = 27\nfor i in range(k):\n C.append(0)\nlength = len(A)\nfor j in range(length):\n C[A[j]] = C[A[j]] + 1\nfor i in range(1, k):\n C[i] = C[i] + C[i - 1]\nfor i in range(length):\n ...
<|body_start_0|> B = [] length = len(A) for i in range(length): B.append(int(str(A[i])[-k])) return B <|end_body_0|> <|body_start_1|> C = [] B = _deepcopy(A) k = 27 for i in range(k): C.append(0) length = len(A) for...
chpater8.3 note and function
Chapter8_3
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Chapter8_3: """chpater8.3 note and function""" def getarraystr_subarray(self, A, k): """取一个数组中每个元素第k位构成的子数组 Args === `A` : 待取子数组的数组 `k` : 第1位是最低位,第d位是最高位 Return === `subarray` : 取好的子数组 Example === ```python Chapter8_3().getarraystr_subarray(['ABC', 'DEF', 'OPQ'], 1) ['C', 'F', 'Q'] `...
stack_v2_sparse_classes_36k_train_016385
18,569
permissive
[ { "docstring": "取一个数组中每个元素第k位构成的子数组 Args === `A` : 待取子数组的数组 `k` : 第1位是最低位,第d位是最高位 Return === `subarray` : 取好的子数组 Example === ```python Chapter8_3().getarraystr_subarray(['ABC', 'DEF', 'OPQ'], 1) ['C', 'F', 'Q'] ```", "name": "getarraystr_subarray", "signature": "def getarraystr_subarray(self, A, k)" }...
4
stack_v2_sparse_classes_30k_train_001778
Implement the Python class `Chapter8_3` described below. Class description: chpater8.3 note and function Method signatures and docstrings: - def getarraystr_subarray(self, A, k): 取一个数组中每个元素第k位构成的子数组 Args === `A` : 待取子数组的数组 `k` : 第1位是最低位,第d位是最高位 Return === `subarray` : 取好的子数组 Example === ```python Chapter8_3().getarra...
Implement the Python class `Chapter8_3` described below. Class description: chpater8.3 note and function Method signatures and docstrings: - def getarraystr_subarray(self, A, k): 取一个数组中每个元素第k位构成的子数组 Args === `A` : 待取子数组的数组 `k` : 第1位是最低位,第d位是最高位 Return === `subarray` : 取好的子数组 Example === ```python Chapter8_3().getarra...
33662f46dc346203b220d7481d1a4439feda05d2
<|skeleton|> class Chapter8_3: """chpater8.3 note and function""" def getarraystr_subarray(self, A, k): """取一个数组中每个元素第k位构成的子数组 Args === `A` : 待取子数组的数组 `k` : 第1位是最低位,第d位是最高位 Return === `subarray` : 取好的子数组 Example === ```python Chapter8_3().getarraystr_subarray(['ABC', 'DEF', 'OPQ'], 1) ['C', 'F', 'Q'] `...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Chapter8_3: """chpater8.3 note and function""" def getarraystr_subarray(self, A, k): """取一个数组中每个元素第k位构成的子数组 Args === `A` : 待取子数组的数组 `k` : 第1位是最低位,第d位是最高位 Return === `subarray` : 取好的子数组 Example === ```python Chapter8_3().getarraystr_subarray(['ABC', 'DEF', 'OPQ'], 1) ['C', 'F', 'Q'] ```""" ...
the_stack_v2_python_sparse
src/chapter8/chapter8note.py
HideLakitu/IntroductionToAlgorithm.Python
train
1
8cbd9627fbb74cf13f6c462830488a50b9707f56
[ "self.start_date = start_date\nself.rec_flow = recurring_flow\nself.rec_freq = recurring_freq\nself.daily_ror = 1.0 + ror", "from_date = max(from_date, self.start_date)\nincrease_base = (from_date - self.start_date).days\n\ndef make_perf(i) -> Tuple[Timestamp, float, float]:\n \"\"\"\n This function...
<|body_start_0|> self.start_date = start_date self.rec_flow = recurring_flow self.rec_freq = recurring_freq self.daily_ror = 1.0 + ror <|end_body_0|> <|body_start_1|> from_date = max(from_date, self.start_date) increase_base = (from_date - self.start_date).days ...
The responsibility of this class is to provide a simple source of performance data in which there is a recurring flow for the same amount at a specified frequency and a consistent daily return.
SimpleSource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleSource: """The responsibility of this class is to provide a simple source of performance data in which there is a recurring flow for the same amount at a specified frequency and a consistent daily return.""" def __init__(self, start_date: Timestamp, recurring_flow: float=0.0, recurring...
stack_v2_sparse_classes_36k_train_016386
10,680
no_license
[ { "docstring": ":param Timestamp start_date: The start date of performance :param float recurring_flow: The value of a recurring flow :param int recurring_freq: The frequency at which the flow occurs in days :param float ror: The daily rate of return which is experienced each day from the start date", "name...
2
stack_v2_sparse_classes_30k_train_013013
Implement the Python class `SimpleSource` described below. Class description: The responsibility of this class is to provide a simple source of performance data in which there is a recurring flow for the same amount at a specified frequency and a consistent daily return. Method signatures and docstrings: - def __init...
Implement the Python class `SimpleSource` described below. Class description: The responsibility of this class is to provide a simple source of performance data in which there is a recurring flow for the same amount at a specified frequency and a consistent daily return. Method signatures and docstrings: - def __init...
b15d2ba0b604ddb94848d5c0353129c2b7229f1e
<|skeleton|> class SimpleSource: """The responsibility of this class is to provide a simple source of performance data in which there is a recurring flow for the same amount at a specified frequency and a consistent daily return.""" def __init__(self, start_date: Timestamp, recurring_flow: float=0.0, recurring...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SimpleSource: """The responsibility of this class is to provide a simple source of performance data in which there is a recurring flow for the same amount at a specified frequency and a consistent daily return.""" def __init__(self, start_date: Timestamp, recurring_flow: float=0.0, recurring_freq: int=7,...
the_stack_v2_python_sparse
performance_engine/performance_sources/mock_src.py
finbourne/performance-engine-poc
train
0
294bdd40aa4dfbf09a4d0df5f10681304972d4b6
[ "self.v_2_c_enabled = v_2_c_enabled\nself.v_3_enabled = v_3_enabled\nself.v_3_auth_mode = v_3_auth_mode\nself.v_3_auth_pass = v_3_auth_pass\nself.v_3_priv_mode = v_3_priv_mode\nself.v_3_priv_pass = v_3_priv_pass\nself.peer_ips = peer_ips", "if dictionary is None:\n return None\nv_2_c_enabled = dictionary.get('...
<|body_start_0|> self.v_2_c_enabled = v_2_c_enabled self.v_3_enabled = v_3_enabled self.v_3_auth_mode = v_3_auth_mode self.v_3_auth_pass = v_3_auth_pass self.v_3_priv_mode = v_3_priv_mode self.v_3_priv_pass = v_3_priv_pass self.peer_ips = peer_ips <|end_body_0|> ...
Implementation of the 'updateOrganizationSnmp' model. TODO: type model description here. Attributes: v_2_c_enabled (bool): Boolean indicating whether SNMP version 2c is enabled for the organization. v_3_enabled (bool): Boolean indicating whether SNMP version 3 is enabled for the organization. v_3_auth_mode (V3AuthModeE...
UpdateOrganizationSnmpModel
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateOrganizationSnmpModel: """Implementation of the 'updateOrganizationSnmp' model. TODO: type model description here. Attributes: v_2_c_enabled (bool): Boolean indicating whether SNMP version 2c is enabled for the organization. v_3_enabled (bool): Boolean indicating whether SNMP version 3 is e...
stack_v2_sparse_classes_36k_train_016387
3,573
permissive
[ { "docstring": "Constructor for the UpdateOrganizationSnmpModel class", "name": "__init__", "signature": "def __init__(self, v_2_c_enabled=None, v_3_enabled=None, v_3_auth_mode=None, v_3_auth_pass=None, v_3_priv_mode=None, v_3_priv_pass=None, peer_ips=None)" }, { "docstring": "Creates an instanc...
2
null
Implement the Python class `UpdateOrganizationSnmpModel` described below. Class description: Implementation of the 'updateOrganizationSnmp' model. TODO: type model description here. Attributes: v_2_c_enabled (bool): Boolean indicating whether SNMP version 2c is enabled for the organization. v_3_enabled (bool): Boolean...
Implement the Python class `UpdateOrganizationSnmpModel` described below. Class description: Implementation of the 'updateOrganizationSnmp' model. TODO: type model description here. Attributes: v_2_c_enabled (bool): Boolean indicating whether SNMP version 2c is enabled for the organization. v_3_enabled (bool): Boolean...
9894089eb013318243ae48869cc5130eb37f80c0
<|skeleton|> class UpdateOrganizationSnmpModel: """Implementation of the 'updateOrganizationSnmp' model. TODO: type model description here. Attributes: v_2_c_enabled (bool): Boolean indicating whether SNMP version 2c is enabled for the organization. v_3_enabled (bool): Boolean indicating whether SNMP version 3 is e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UpdateOrganizationSnmpModel: """Implementation of the 'updateOrganizationSnmp' model. TODO: type model description here. Attributes: v_2_c_enabled (bool): Boolean indicating whether SNMP version 2c is enabled for the organization. v_3_enabled (bool): Boolean indicating whether SNMP version 3 is enabled for th...
the_stack_v2_python_sparse
meraki_sdk/models/update_organization_snmp_model.py
RaulCatalano/meraki-python-sdk
train
1
d5efbeedc0121decab2eca5964be7d7b33df4197
[ "super().__init__()\nself.autoscaleX = utils.AutoscaleState.OFF\nself.minimumX = 0\nself.maximumX = 100\nself.pixelRangeAdditionX = 25\nself.autoscaleY = utils.AutoscaleState.OFF\nself.minimumY = 0\nself.maximumY = 100\nself.pixelRangeAdditionY = 25\nself.numHistogramBins = 40", "self.autoscaleX = getattr(utils.A...
<|body_start_0|> super().__init__() self.autoscaleX = utils.AutoscaleState.OFF self.minimumX = 0 self.maximumX = 100 self.pixelRangeAdditionX = 25 self.autoscaleY = utils.AutoscaleState.OFF self.minimumY = 0 self.maximumY = 100 self.pixelRangeAddit...
Class for handling the configuration of the centroid plots (1D line, scatter and 1D histogram) Attributes ---------- autoscaleX : `utils.AutoscaleState` Set autoscaling on the x component 1D centroid line plot. autoscaleY : `utils.AutoscaleState` Set autoscaling on the y component 1D centroid line plot. maximumX : int ...
CentroidPlotConfig
[ "Python-2.0", "BSD-3-Clause", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CentroidPlotConfig: """Class for handling the configuration of the centroid plots (1D line, scatter and 1D histogram) Attributes ---------- autoscaleX : `utils.AutoscaleState` Set autoscaling on the x component 1D centroid line plot. autoscaleY : `utils.AutoscaleState` Set autoscaling on the y co...
stack_v2_sparse_classes_36k_train_016388
4,267
permissive
[ { "docstring": "Initialize the class.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Translate config to class attributes. Parameters ---------- config : dict The configuration to translate.", "name": "fromDict", "signature": "def fromDict(self, config)" }, ...
3
stack_v2_sparse_classes_30k_train_017268
Implement the Python class `CentroidPlotConfig` described below. Class description: Class for handling the configuration of the centroid plots (1D line, scatter and 1D histogram) Attributes ---------- autoscaleX : `utils.AutoscaleState` Set autoscaling on the x component 1D centroid line plot. autoscaleY : `utils.Auto...
Implement the Python class `CentroidPlotConfig` described below. Class description: Class for handling the configuration of the centroid plots (1D line, scatter and 1D histogram) Attributes ---------- autoscaleX : `utils.AutoscaleState` Set autoscaling on the x component 1D centroid line plot. autoscaleY : `utils.Auto...
3d0242276198126240667ba13e95b7bdf901d053
<|skeleton|> class CentroidPlotConfig: """Class for handling the configuration of the centroid plots (1D line, scatter and 1D histogram) Attributes ---------- autoscaleX : `utils.AutoscaleState` Set autoscaling on the x component 1D centroid line plot. autoscaleY : `utils.AutoscaleState` Set autoscaling on the y co...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CentroidPlotConfig: """Class for handling the configuration of the centroid plots (1D line, scatter and 1D histogram) Attributes ---------- autoscaleX : `utils.AutoscaleState` Set autoscaling on the x component 1D centroid line plot. autoscaleY : `utils.AutoscaleState` Set autoscaling on the y component 1D ce...
the_stack_v2_python_sparse
spot_motion_monitor/config/centroid_plot_config.py
lsst-sitcom/spot_motion_monitor
train
0
e0515a9bbb57efc7f7b8542f1e56849e20c2a45f
[ "if not root:\n return ''\nque = deque()\nque.append(root)\nres = []\nwhile que:\n node = que.popleft()\n if not node:\n res.append('')\n continue\n res.append(str(node.val))\n que.append(node.left)\n que.append(node.right)\nlasti = len(res)\nfor i in range(len(res) - 1, -1, -1):\n ...
<|body_start_0|> if not root: return '' que = deque() que.append(root) res = [] while que: node = que.popleft() if not node: res.append('') continue res.append(str(node.val)) que.append(no...
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_36k_train_016389
2,396
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_003229
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:...
2a29426be1d690b6f90bc45b437900deee46d832
<|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_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return '' que = deque() que.append(root) res = [] while que: node = que.popleft() if not node: ...
the_stack_v2_python_sparse
src/leet/449-Serialize and Deserialize BST.py
sevenseablue/leetcode
train
0
fa3444d6392e36d9dbd78be509675fcf97f9ba08
[ "self.__monitor_time = monitor_seconds\nself.__block_time = block_seconds\nself.__chances = chances\nself.__monitor = {}\nself.__block = {}", "is_blocked = False\nif host in self.__block:\n status = self.__block[host]\n delta_time = time_difference(status[self.__LAST_EVENT], time)\n if delta_time <= stat...
<|body_start_0|> self.__monitor_time = monitor_seconds self.__block_time = block_seconds self.__chances = chances self.__monitor = {} self.__block = {} <|end_body_0|> <|body_start_1|> is_blocked = False if host in self.__block: status = self.__block[h...
The class that keeps track of the failed login and block further activities if a host fails to login for a number of times consecutively within a specified time window.
BlockedHosts
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BlockedHosts: """The class that keeps track of the failed login and block further activities if a host fails to login for a number of times consecutively within a specified time window.""" def __init__(self, monitor_seconds=20, block_seconds=300, chances=3): """Public variables: moni...
stack_v2_sparse_classes_36k_train_016390
7,735
no_license
[ { "docstring": "Public variables: monitor_time: the time period during which a number of failed login attempts will trigger the block event block_time: the time period to block the user chances: the number of attempts of failed login Private variables: __monitor_dict(dict): keep track the events after first fai...
4
stack_v2_sparse_classes_30k_train_000920
Implement the Python class `BlockedHosts` described below. Class description: The class that keeps track of the failed login and block further activities if a host fails to login for a number of times consecutively within a specified time window. Method signatures and docstrings: - def __init__(self, monitor_seconds=...
Implement the Python class `BlockedHosts` described below. Class description: The class that keeps track of the failed login and block further activities if a host fails to login for a number of times consecutively within a specified time window. Method signatures and docstrings: - def __init__(self, monitor_seconds=...
f99f15401955e8481e6c6b56b2f4afce0b0f81f7
<|skeleton|> class BlockedHosts: """The class that keeps track of the failed login and block further activities if a host fails to login for a number of times consecutively within a specified time window.""" def __init__(self, monitor_seconds=20, block_seconds=300, chances=3): """Public variables: moni...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BlockedHosts: """The class that keeps track of the failed login and block further activities if a host fails to login for a number of times consecutively within a specified time window.""" def __init__(self, monitor_seconds=20, block_seconds=300, chances=3): """Public variables: monitor_time: the...
the_stack_v2_python_sparse
src/block_hosts.py
yulinghuhappy/NASA-Fan-Web-analytics
train
0
a5e14367d885e4a4186f39649448b23fe9528a35
[ "try:\n logging.getLogger('adal-python').setLevel(logging.ERROR)\n logging.getLogger('msrest').setLevel(logging.ERROR)\n logging.getLogger('msrestazure.azure_active_directory').setLevel(logging.ERROR)\n logging.getLogger('urllib3').setLevel(logging.ERROR)\n logging.getLogger('azure.core.pipeline.poli...
<|body_start_0|> try: logging.getLogger('adal-python').setLevel(logging.ERROR) logging.getLogger('msrest').setLevel(logging.ERROR) logging.getLogger('msrestazure.azure_active_directory').setLevel(logging.ERROR) logging.getLogger('urllib3').setLevel(logging.ERROR) ...
Authenticator
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Authenticator: def authenticate_cli(self) -> Credentials: """Implements authentication for the Azure provider""" <|body_0|> def authenticate_sp(self, tenant_id: Optional[str]=None, client_id: Optional[str]=None, client_secret: Optional[str]=None) -> Credentials: """I...
stack_v2_sparse_classes_36k_train_016391
7,416
permissive
[ { "docstring": "Implements authentication for the Azure provider", "name": "authenticate_cli", "signature": "def authenticate_cli(self) -> Credentials" }, { "docstring": "Implements authentication for the Azure provider", "name": "authenticate_sp", "signature": "def authenticate_sp(self,...
2
null
Implement the Python class `Authenticator` described below. Class description: Implement the Authenticator class. Method signatures and docstrings: - def authenticate_cli(self) -> Credentials: Implements authentication for the Azure provider - def authenticate_sp(self, tenant_id: Optional[str]=None, client_id: Option...
Implement the Python class `Authenticator` described below. Class description: Implement the Authenticator class. Method signatures and docstrings: - def authenticate_cli(self) -> Credentials: Implements authentication for the Azure provider - def authenticate_sp(self, tenant_id: Optional[str]=None, client_id: Option...
830b8944879a01f52b21ee12b6fddf245f9733cb
<|skeleton|> class Authenticator: def authenticate_cli(self) -> Credentials: """Implements authentication for the Azure provider""" <|body_0|> def authenticate_sp(self, tenant_id: Optional[str]=None, client_id: Optional[str]=None, client_secret: Optional[str]=None) -> Credentials: """I...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Authenticator: def authenticate_cli(self) -> Credentials: """Implements authentication for the Azure provider""" try: logging.getLogger('adal-python').setLevel(logging.ERROR) logging.getLogger('msrest').setLevel(logging.ERROR) logging.getLogger('msrestazure....
the_stack_v2_python_sparse
cartography/intel/azure/util/credentials.py
lyft/cartography
train
2,778
62c5d0c4232f041a6e6ce5dfa904b80c1aa6b207
[ "if not value:\n return []\nreturn value.split(',')", "super(MultiEmailField, self).validate(value)\nfor email in value:\n validate_email(email.strip())" ]
<|body_start_0|> if not value: return [] return value.split(',') <|end_body_0|> <|body_start_1|> super(MultiEmailField, self).validate(value) for email in value: validate_email(email.strip()) <|end_body_1|>
MultiEmailField
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiEmailField: def to_python(self, value): """Normalize data to a list of strings.""" <|body_0|> def validate(self, value): """Check if value consists only of valid emails.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not value: ...
stack_v2_sparse_classes_36k_train_016392
4,154
permissive
[ { "docstring": "Normalize data to a list of strings.", "name": "to_python", "signature": "def to_python(self, value)" }, { "docstring": "Check if value consists only of valid emails.", "name": "validate", "signature": "def validate(self, value)" } ]
2
stack_v2_sparse_classes_30k_train_019702
Implement the Python class `MultiEmailField` described below. Class description: Implement the MultiEmailField class. Method signatures and docstrings: - def to_python(self, value): Normalize data to a list of strings. - def validate(self, value): Check if value consists only of valid emails.
Implement the Python class `MultiEmailField` described below. Class description: Implement the MultiEmailField class. Method signatures and docstrings: - def to_python(self, value): Normalize data to a list of strings. - def validate(self, value): Check if value consists only of valid emails. <|skeleton|> class Mult...
34c2d380f70ca8922c7184d0b3f8704ea785c087
<|skeleton|> class MultiEmailField: def to_python(self, value): """Normalize data to a list of strings.""" <|body_0|> def validate(self, value): """Check if value consists only of valid emails.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiEmailField: def to_python(self, value): """Normalize data to a list of strings.""" if not value: return [] return value.split(',') def validate(self, value): """Check if value consists only of valid emails.""" super(MultiEmailField, self).validate(...
the_stack_v2_python_sparse
djangoRT/forms.py
ChameleonCloud/portal
train
3
e0b32925aee455ca49a8ba47f6d45a72e7d74ee0
[ "super().__init__()\nself.fc_1 = nn.Linear(hid_dim, pf_dim)\nself.fc_2 = nn.Linear(pf_dim, hid_dim)\nself.dropout = nn.Dropout(dropout)", "x = self.dropout(torch.relu(self.fc_1(x)))\nx = self.fc_2(x)\nreturn x" ]
<|body_start_0|> super().__init__() self.fc_1 = nn.Linear(hid_dim, pf_dim) self.fc_2 = nn.Linear(pf_dim, hid_dim) self.dropout = nn.Dropout(dropout) <|end_body_0|> <|body_start_1|> x = self.dropout(torch.relu(self.fc_1(x))) x = self.fc_2(x) return x <|end_body_1|...
Fully connected feed-forward network consisting of two linear transformations with a ReLU activation in between. Args: hid_dim: the hidden size of the encoder pf_dim: the dimension of the feedforward network model dropout: the dropout value
PositionwiseFeedforwardLayer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PositionwiseFeedforwardLayer: """Fully connected feed-forward network consisting of two linear transformations with a ReLU activation in between. Args: hid_dim: the hidden size of the encoder pf_dim: the dimension of the feedforward network model dropout: the dropout value""" def __init__(se...
stack_v2_sparse_classes_36k_train_016393
10,223
permissive
[ { "docstring": "Initialize model with params.", "name": "__init__", "signature": "def __init__(self, hid_dim, pf_dim, dropout)" }, { "docstring": "Run a forward pass of model over the data.", "name": "forward", "signature": "def forward(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_016848
Implement the Python class `PositionwiseFeedforwardLayer` described below. Class description: Fully connected feed-forward network consisting of two linear transformations with a ReLU activation in between. Args: hid_dim: the hidden size of the encoder pf_dim: the dimension of the feedforward network model dropout: th...
Implement the Python class `PositionwiseFeedforwardLayer` described below. Class description: Fully connected feed-forward network consisting of two linear transformations with a ReLU activation in between. Args: hid_dim: the hidden size of the encoder pf_dim: the dimension of the feedforward network model dropout: th...
9cdbf270487751a0ad6862b2fea2ccc0e23a0b67
<|skeleton|> class PositionwiseFeedforwardLayer: """Fully connected feed-forward network consisting of two linear transformations with a ReLU activation in between. Args: hid_dim: the hidden size of the encoder pf_dim: the dimension of the feedforward network model dropout: the dropout value""" def __init__(se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PositionwiseFeedforwardLayer: """Fully connected feed-forward network consisting of two linear transformations with a ReLU activation in between. Args: hid_dim: the hidden size of the encoder pf_dim: the dimension of the feedforward network model dropout: the dropout value""" def __init__(self, hid_dim, ...
the_stack_v2_python_sparse
caspr/models/transformer.py
microsoft/CASPR
train
29
88dac5cbfd75d7e155fa46045d67719f6ff49a12
[ "makefile = stage / 'merlin' / project.pyre_name\nmarker = f\"the '{project.pyre_name}' rules\"\nyield ''\nyield from super().generate(makefile=makefile, marker=marker, project=project, **kwds)\nreturn", "yield from super()._generate(**kwds)\nyield from self.project(project=project)\nreturn", "name = project.py...
<|body_start_0|> makefile = stage / 'merlin' / project.pyre_name marker = f"the '{project.pyre_name}' rules" yield '' yield from super().generate(makefile=makefile, marker=marker, project=project, **kwds) return <|end_body_0|> <|body_start_1|> yield from super()._generat...
Workflow generator for building projects
Project
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Project: """Workflow generator for building projects""" def generate(self, stage, project, **kwds): """Generate my makefile""" <|body_0|> def _generate(self, project, **kwds): """Generate my makefile content""" <|body_1|> def project(self, project, *...
stack_v2_sparse_classes_36k_train_016394
2,818
permissive
[ { "docstring": "Generate my makefile", "name": "generate", "signature": "def generate(self, stage, project, **kwds)" }, { "docstring": "Generate my makefile content", "name": "_generate", "signature": "def _generate(self, project, **kwds)" }, { "docstring": "Generate the workflow...
3
stack_v2_sparse_classes_30k_train_004531
Implement the Python class `Project` described below. Class description: Workflow generator for building projects Method signatures and docstrings: - def generate(self, stage, project, **kwds): Generate my makefile - def _generate(self, project, **kwds): Generate my makefile content - def project(self, project, **kwd...
Implement the Python class `Project` described below. Class description: Workflow generator for building projects Method signatures and docstrings: - def generate(self, stage, project, **kwds): Generate my makefile - def _generate(self, project, **kwds): Generate my makefile content - def project(self, project, **kwd...
d741c44ffb3e9e1f726bf492202ac8738bb4aa1c
<|skeleton|> class Project: """Workflow generator for building projects""" def generate(self, stage, project, **kwds): """Generate my makefile""" <|body_0|> def _generate(self, project, **kwds): """Generate my makefile content""" <|body_1|> def project(self, project, *...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Project: """Workflow generator for building projects""" def generate(self, stage, project, **kwds): """Generate my makefile""" makefile = stage / 'merlin' / project.pyre_name marker = f"the '{project.pyre_name}' rules" yield '' yield from super().generate(makefile=...
the_stack_v2_python_sparse
packages/merlin/builders/make/Project.py
pyre/pyre
train
27
feda37a8aec7b98c47f5c2d6958df922cee44049
[ "self.queryfilters = []\nsuper().beforequery()\nondate = request.args.get('ondate', ymd.dt2asc(datetime.now()))\nondatedt = ymd.asc2dt(ondate)\nself.queryfilters += [Member.start_date <= ondatedt, Member.end_date >= ondatedt]", "self.interest = Interest.query.filter_by(interest=g.interest).one_or_none()\nif not s...
<|body_start_0|> self.queryfilters = [] super().beforequery() ondate = request.args.get('ondate', ymd.dt2asc(datetime.now())) ondatedt = ymd.asc2dt(ondate) self.queryfilters += [Member.start_date <= ondatedt, Member.end_date >= ondatedt] <|end_body_0|> <|body_start_1|> s...
FrontendMembersView
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FrontendMembersView: def beforequery(self): """add update query parameters based on ondate""" <|body_0|> def permission(self): """check for permission on data :rtype: boolean""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.queryfilters = [] ...
stack_v2_sparse_classes_36k_train_016395
7,630
permissive
[ { "docstring": "add update query parameters based on ondate", "name": "beforequery", "signature": "def beforequery(self)" }, { "docstring": "check for permission on data :rtype: boolean", "name": "permission", "signature": "def permission(self)" } ]
2
stack_v2_sparse_classes_30k_test_001074
Implement the Python class `FrontendMembersView` described below. Class description: Implement the FrontendMembersView class. Method signatures and docstrings: - def beforequery(self): add update query parameters based on ondate - def permission(self): check for permission on data :rtype: boolean
Implement the Python class `FrontendMembersView` described below. Class description: Implement the FrontendMembersView class. Method signatures and docstrings: - def beforequery(self): add update query parameters based on ondate - def permission(self): check for permission on data :rtype: boolean <|skeleton|> class ...
240ddab99d6d1f3541a2c04b9350f3da09d9d6b0
<|skeleton|> class FrontendMembersView: def beforequery(self): """add update query parameters based on ondate""" <|body_0|> def permission(self): """check for permission on data :rtype: boolean""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FrontendMembersView: def beforequery(self): """add update query parameters based on ondate""" self.queryfilters = [] super().beforequery() ondate = request.args.get('ondate', ymd.dt2asc(datetime.now())) ondatedt = ymd.asc2dt(ondate) self.queryfilters += [Member....
the_stack_v2_python_sparse
members/views/frontend/membership_frontend.py
louking/members
train
1
2955a24ef7d61ddce4e07a01bdd518262cab889f
[ "differentiator.refresh()\nop = differentiator.generate_differentiable_op(sampled_op=op)\nqubit = cirq.GridQubit(0, 0)\ncircuit = util.convert_to_tensor([cirq.Circuit(cirq.X(qubit) ** sympy.Symbol('alpha'))])\npsums = util.convert_to_tensor([[cirq.Z(qubit)]])\nsymbol_values_array = np.array([[0.123]], dtype=np.floa...
<|body_start_0|> differentiator.refresh() op = differentiator.generate_differentiable_op(sampled_op=op) qubit = cirq.GridQubit(0, 0) circuit = util.convert_to_tensor([cirq.Circuit(cirq.X(qubit) ** sympy.Symbol('alpha'))]) psums = util.convert_to_tensor([[cirq.Z(qubit)]]) ...
Test approximate correctness to sampled methods.
SampledGradientCorrectnessTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SampledGradientCorrectnessTest: """Test approximate correctness to sampled methods.""" def test_sampled_value_with_simple_circuit(self, differentiator, op, num_samples): """Test the value of sampled differentiator with simple circuit.""" <|body_0|> def test_approx_equali...
stack_v2_sparse_classes_36k_train_016396
22,303
permissive
[ { "docstring": "Test the value of sampled differentiator with simple circuit.", "name": "test_sampled_value_with_simple_circuit", "signature": "def test_sampled_value_with_simple_circuit(self, differentiator, op, num_samples)" }, { "docstring": "Test small circuits with limited depth.", "nam...
3
stack_v2_sparse_classes_30k_train_016067
Implement the Python class `SampledGradientCorrectnessTest` described below. Class description: Test approximate correctness to sampled methods. Method signatures and docstrings: - def test_sampled_value_with_simple_circuit(self, differentiator, op, num_samples): Test the value of sampled differentiator with simple c...
Implement the Python class `SampledGradientCorrectnessTest` described below. Class description: Test approximate correctness to sampled methods. Method signatures and docstrings: - def test_sampled_value_with_simple_circuit(self, differentiator, op, num_samples): Test the value of sampled differentiator with simple c...
f56257bceb988b743790e1e480eac76fd036d4ff
<|skeleton|> class SampledGradientCorrectnessTest: """Test approximate correctness to sampled methods.""" def test_sampled_value_with_simple_circuit(self, differentiator, op, num_samples): """Test the value of sampled differentiator with simple circuit.""" <|body_0|> def test_approx_equali...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SampledGradientCorrectnessTest: """Test approximate correctness to sampled methods.""" def test_sampled_value_with_simple_circuit(self, differentiator, op, num_samples): """Test the value of sampled differentiator with simple circuit.""" differentiator.refresh() op = differentiato...
the_stack_v2_python_sparse
tensorflow_quantum/python/differentiators/gradient_test.py
tensorflow/quantum
train
1,799
439848cdf275821b7a77097b9f1673ba36e558b2
[ "try:\n pink = orm['ruleset.Commodity'].objects.get(ruleset__module='remixed', name='Pink')\n pink.color = 'hotpink'\n pink.save()\nexcept orm['ruleset.Commodity'].DoesNotExist:\n pass", "try:\n pink = orm['ruleset.Commodity'].objects.get(ruleset__module='remixed', name='Pink')\n pink.color = 'p...
<|body_start_0|> try: pink = orm['ruleset.Commodity'].objects.get(ruleset__module='remixed', name='Pink') pink.color = 'hotpink' pink.save() except orm['ruleset.Commodity'].DoesNotExist: pass <|end_body_0|> <|body_start_1|> try: pink =...
Migration
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Migration: def forwards(self, orm): """Write your forwards methods here.""" <|body_0|> def backwards(self, orm): """Write your backwards methods here.""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: pink = orm['ruleset.Commodity'].o...
stack_v2_sparse_classes_36k_train_016397
2,919
no_license
[ { "docstring": "Write your forwards methods here.", "name": "forwards", "signature": "def forwards(self, orm)" }, { "docstring": "Write your backwards methods here.", "name": "backwards", "signature": "def backwards(self, orm)" } ]
2
stack_v2_sparse_classes_30k_train_007020
Implement the Python class `Migration` described below. Class description: Implement the Migration class. Method signatures and docstrings: - def forwards(self, orm): Write your forwards methods here. - def backwards(self, orm): Write your backwards methods here.
Implement the Python class `Migration` described below. Class description: Implement the Migration class. Method signatures and docstrings: - def forwards(self, orm): Write your forwards methods here. - def backwards(self, orm): Write your backwards methods here. <|skeleton|> class Migration: def forwards(self,...
ad0ca4d8cbcfa568099ffcd784f2b732f31a1b60
<|skeleton|> class Migration: def forwards(self, orm): """Write your forwards methods here.""" <|body_0|> def backwards(self, orm): """Write your backwards methods here.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Migration: def forwards(self, orm): """Write your forwards methods here.""" try: pink = orm['ruleset.Commodity'].objects.get(ruleset__module='remixed', name='Pink') pink.color = 'hotpink' pink.save() except orm['ruleset.Commodity'].DoesNotExist: ...
the_stack_v2_python_sparse
ruleset/migrations/0002_datamigration_color_for_pink_cards_set_to_hotpink.py
manurFR/mystrade-public
train
0
94f5d791645202724b933245a883b93ecf7b359a
[ "root = 0\nnew_node_id = 1\ntree = dict()\ntree[root] = dict()\nfor pattern in patterns:\n current_node = root\n for i in range(len(pattern)):\n current_symbol = pattern[i]\n if current_symbol in tree[current_node]:\n current_node = tree[current_node][current_symbol]\n else:\n ...
<|body_start_0|> root = 0 new_node_id = 1 tree = dict() tree[root] = dict() for pattern in patterns: current_node = root for i in range(len(pattern)): current_symbol = pattern[i] if current_symbol in tree[current_node]: ...
TrieUtil
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrieUtil: def build_trie(patterns): """Returns a trie built from patterns in the form of a dictionary of dictionaries, e.g. {0:{'A':1,'T':2},1:{'C':3}} where - the key of the external dictionary is the node ID (integer), and - the internal dictionary contains all the trie edges outgoing ...
stack_v2_sparse_classes_36k_train_016398
4,754
no_license
[ { "docstring": "Returns a trie built from patterns in the form of a dictionary of dictionaries, e.g. {0:{'A':1,'T':2},1:{'C':3}} where - the key of the external dictionary is the node ID (integer), and - the internal dictionary contains all the trie edges outgoing from the corresponding node, and the keys are t...
3
null
Implement the Python class `TrieUtil` described below. Class description: Implement the TrieUtil class. Method signatures and docstrings: - def build_trie(patterns): Returns a trie built from patterns in the form of a dictionary of dictionaries, e.g. {0:{'A':1,'T':2},1:{'C':3}} where - the key of the external diction...
Implement the Python class `TrieUtil` described below. Class description: Implement the TrieUtil class. Method signatures and docstrings: - def build_trie(patterns): Returns a trie built from patterns in the form of a dictionary of dictionaries, e.g. {0:{'A':1,'T':2},1:{'C':3}} where - the key of the external diction...
01dd6f0dadf62a520bcafafddf7bf2b79e8e2603
<|skeleton|> class TrieUtil: def build_trie(patterns): """Returns a trie built from patterns in the form of a dictionary of dictionaries, e.g. {0:{'A':1,'T':2},1:{'C':3}} where - the key of the external dictionary is the node ID (integer), and - the internal dictionary contains all the trie edges outgoing ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TrieUtil: def build_trie(patterns): """Returns a trie built from patterns in the form of a dictionary of dictionaries, e.g. {0:{'A':1,'T':2},1:{'C':3}} where - the key of the external dictionary is the node ID (integer), and - the internal dictionary contains all the trie edges outgoing from the corre...
the_stack_v2_python_sparse
course4-strings/assignments/assignment_001_trie_matching/trie_matching.py
dmitri-mamrukov/coursera-data-structures-and-algorithms
train
1
6b134ac667dbe3110726e995cdf81bce9593dadb
[ "import heapq, collections\nh = []\ndict = collections.defaultdict(int)\nfor i in range(k - 1):\n heapq.heappush(h, -nums[i])\n dict[-nums[i]] += 1\nresult = []\nfor i, num in enumerate(nums[k - 1:]):\n heapq.heappush(h, -num)\n dict[-num] += 1\n result.append(-h[0])\n dict[-nums[i]] -= 1\n if ...
<|body_start_0|> import heapq, collections h = [] dict = collections.defaultdict(int) for i in range(k - 1): heapq.heappush(h, -nums[i]) dict[-nums[i]] += 1 result = [] for i, num in enumerate(nums[k - 1:]): heapq.heappush(h, -num) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSlidingWindow(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[int] 332ms""" <|body_0|> def maxSlidingWindow_1(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[int] 256ms""" <|body_1|> def maxSlidingWi...
stack_v2_sparse_classes_36k_train_016399
3,258
no_license
[ { "docstring": ":type nums: List[int] :type k: int :rtype: List[int] 332ms", "name": "maxSlidingWindow", "signature": "def maxSlidingWindow(self, nums, k)" }, { "docstring": ":type nums: List[int] :type k: int :rtype: List[int] 256ms", "name": "maxSlidingWindow_1", "signature": "def maxS...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSlidingWindow(self, nums, k): :type nums: List[int] :type k: int :rtype: List[int] 332ms - def maxSlidingWindow_1(self, nums, k): :type nums: List[int] :type k: int :rtype...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSlidingWindow(self, nums, k): :type nums: List[int] :type k: int :rtype: List[int] 332ms - def maxSlidingWindow_1(self, nums, k): :type nums: List[int] :type k: int :rtype...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def maxSlidingWindow(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[int] 332ms""" <|body_0|> def maxSlidingWindow_1(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[int] 256ms""" <|body_1|> def maxSlidingWi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxSlidingWindow(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[int] 332ms""" import heapq, collections h = [] dict = collections.defaultdict(int) for i in range(k - 1): heapq.heappush(h, -nums[i]) dict[-nums[i]]...
the_stack_v2_python_sparse
SlidingWindowMaximum_HARD_239.py
953250587/leetcode-python
train
2