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
67f1a218f4bee18184bb8415a298cebed9847800
[ "snap = super(Action, self).snapshot()\nsnap['text'] = self.text\nsnap['tool_tip'] = self.tool_tip\nsnap['status_tip'] = self.status_tip\nsnap['icon_source'] = self.icon_source\nsnap['checkable'] = self.checkable\nsnap['checked'] = self.checked\nsnap['enabled'] = self.enabled\nsnap['visible'] = self.visible\nsnap['...
<|body_start_0|> snap = super(Action, self).snapshot() snap['text'] = self.text snap['tool_tip'] = self.tool_tip snap['status_tip'] = self.status_tip snap['icon_source'] = self.icon_source snap['checkable'] = self.checkable snap['checked'] = self.checked s...
A non visible widget used in a ToolBar or Menu. An Action represents an actionable item in a ToolBar or a Menu. Though an Action itself is a non-visible component, it will be rendered in an appropriate fashion for the location where it is used.
Action
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Action: """A non visible widget used in a ToolBar or Menu. An Action represents an actionable item in a ToolBar or a Menu. Though an Action itself is a non-visible component, it will be rendered in an appropriate fashion for the location where it is used.""" def snapshot(self): """Re...
stack_v2_sparse_classes_36k_train_022300
3,641
permissive
[ { "docstring": "Returns the snapshot dict for the Action.", "name": "snapshot", "signature": "def snapshot(self)" }, { "docstring": "Binds the change handlers for the Action.", "name": "bind", "signature": "def bind(self)" }, { "docstring": "Handle the 'triggered' action from the...
4
stack_v2_sparse_classes_30k_train_018567
Implement the Python class `Action` described below. Class description: A non visible widget used in a ToolBar or Menu. An Action represents an actionable item in a ToolBar or a Menu. Though an Action itself is a non-visible component, it will be rendered in an appropriate fashion for the location where it is used. M...
Implement the Python class `Action` described below. Class description: A non visible widget used in a ToolBar or Menu. An Action represents an actionable item in a ToolBar or a Menu. Though an Action itself is a non-visible component, it will be rendered in an appropriate fashion for the location where it is used. M...
424bba29219de58fe9e47196de6763de8b2009f2
<|skeleton|> class Action: """A non visible widget used in a ToolBar or Menu. An Action represents an actionable item in a ToolBar or a Menu. Though an Action itself is a non-visible component, it will be rendered in an appropriate fashion for the location where it is used.""" def snapshot(self): """Re...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Action: """A non visible widget used in a ToolBar or Menu. An Action represents an actionable item in a ToolBar or a Menu. Though an Action itself is a non-visible component, it will be rendered in an appropriate fashion for the location where it is used.""" def snapshot(self): """Returns the sna...
the_stack_v2_python_sparse
enaml/widgets/action.py
enthought/enaml
train
17
7d7949773446700a155e07f6aa166ae5d99027da
[ "n = len(A)\ncmp = [0] * n\nm = 10 ** 6 + 1\nfor i in range(n - 1, -1, -1):\n cmp[i] = m = min(m, A[i])\nm = -1\nfor i, x in enumerate(A):\n m = max(m, x)\n if m <= cmp[i + 1]:\n return i + 1", "lm = m = A[0]\nres = 0\nfor i in range(1, len(A)):\n m = max(m, A[i])\n if A[i] < lm:\n lm...
<|body_start_0|> n = len(A) cmp = [0] * n m = 10 ** 6 + 1 for i in range(n - 1, -1, -1): cmp[i] = m = min(m, A[i]) m = -1 for i, x in enumerate(A): m = max(m, x) if m <= cmp[i + 1]: return i + 1 <|end_body_0|> <|body_st...
[915. 分割数组](https://leetcode-cn.com/problems/partition-array-into-disjoint-intervals/)
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """[915. 分割数组](https://leetcode-cn.com/problems/partition-array-into-disjoint-intervals/)""" def partitionDisjoint(self, A: List[int]) -> int: """思路:找到第一个max(left)<=min(right)位置""" <|body_0|> def partitionDisjoint2(self, A: List[int]) -> int: """思路:优化,保...
stack_v2_sparse_classes_36k_train_022301
1,343
no_license
[ { "docstring": "思路:找到第一个max(left)<=min(right)位置", "name": "partitionDisjoint", "signature": "def partitionDisjoint(self, A: List[int]) -> int" }, { "docstring": "思路:优化,保存一个左边最大值,后面的遍历过程中比这个值还小的,一定要被划分到left中,相等不用。", "name": "partitionDisjoint2", "signature": "def partitionDisjoint2(self, ...
2
stack_v2_sparse_classes_30k_train_017150
Implement the Python class `Solution` described below. Class description: [915. 分割数组](https://leetcode-cn.com/problems/partition-array-into-disjoint-intervals/) Method signatures and docstrings: - def partitionDisjoint(self, A: List[int]) -> int: 思路:找到第一个max(left)<=min(right)位置 - def partitionDisjoint2(self, A: List[...
Implement the Python class `Solution` described below. Class description: [915. 分割数组](https://leetcode-cn.com/problems/partition-array-into-disjoint-intervals/) Method signatures and docstrings: - def partitionDisjoint(self, A: List[int]) -> int: 思路:找到第一个max(left)<=min(right)位置 - def partitionDisjoint2(self, A: List[...
dbe8eb449e5b112a71bc1cd4eabfd138304de4a3
<|skeleton|> class Solution: """[915. 分割数组](https://leetcode-cn.com/problems/partition-array-into-disjoint-intervals/)""" def partitionDisjoint(self, A: List[int]) -> int: """思路:找到第一个max(left)<=min(right)位置""" <|body_0|> def partitionDisjoint2(self, A: List[int]) -> int: """思路:优化,保...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """[915. 分割数组](https://leetcode-cn.com/problems/partition-array-into-disjoint-intervals/)""" def partitionDisjoint(self, A: List[int]) -> int: """思路:找到第一个max(left)<=min(right)位置""" n = len(A) cmp = [0] * n m = 10 ** 6 + 1 for i in range(n - 1, -1, -1): ...
the_stack_v2_python_sparse
leetcode/901-1200/915.py
Rivarrl/leetcode_python
train
3
d0642507d38de59877e3b9bba1e5cdf3f7a9367d
[ "primary_heartbeat = primary_mgt if not primary_heartbeat else primary_heartbeat\nphysical_interfaces = []\nfor interface in interfaces:\n if 'interface_id' not in interface:\n raise CreateEngineFailed('Interface definitions must contain the interface_id field. Failed to create engine: %s' % name)\n if...
<|body_start_0|> primary_heartbeat = primary_mgt if not primary_heartbeat else primary_heartbeat physical_interfaces = [] for interface in interfaces: if 'interface_id' not in interface: raise CreateEngineFailed('Interface definitions must contain the interface_id fie...
Firewall Cluster Creates a layer 3 firewall cluster engine with CVI and NDI's. Once engine is created, you can later add additional interfaces using the `engine.physical_interface` reference. .. seealso:: :func:`smc.core.physical_interface.add_layer3_cluster_interface`
FirewallCluster
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FirewallCluster: """Firewall Cluster Creates a layer 3 firewall cluster engine with CVI and NDI's. Once engine is created, you can later add additional interfaces using the `engine.physical_interface` reference. .. seealso:: :func:`smc.core.physical_interface.add_layer3_cluster_interface`""" ...
stack_v2_sparse_classes_36k_train_022302
39,353
permissive
[ { "docstring": ":param dict snmp: SNMP dict should have keys `snmp_agent` str defining name of SNMPAgent, `snmp_interface` which is a list of interface IDs, and optionally `snmp_location` which is a string with the SNMP location name.", "name": "create_bulk", "signature": "def create_bulk(cls, name, int...
2
stack_v2_sparse_classes_30k_train_015516
Implement the Python class `FirewallCluster` described below. Class description: Firewall Cluster Creates a layer 3 firewall cluster engine with CVI and NDI's. Once engine is created, you can later add additional interfaces using the `engine.physical_interface` reference. .. seealso:: :func:`smc.core.physical_interfac...
Implement the Python class `FirewallCluster` described below. Class description: Firewall Cluster Creates a layer 3 firewall cluster engine with CVI and NDI's. Once engine is created, you can later add additional interfaces using the `engine.physical_interface` reference. .. seealso:: :func:`smc.core.physical_interfac...
54386c8a710727cc1acf69334a57b155d2f5408c
<|skeleton|> class FirewallCluster: """Firewall Cluster Creates a layer 3 firewall cluster engine with CVI and NDI's. Once engine is created, you can later add additional interfaces using the `engine.physical_interface` reference. .. seealso:: :func:`smc.core.physical_interface.add_layer3_cluster_interface`""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FirewallCluster: """Firewall Cluster Creates a layer 3 firewall cluster engine with CVI and NDI's. Once engine is created, you can later add additional interfaces using the `engine.physical_interface` reference. .. seealso:: :func:`smc.core.physical_interface.add_layer3_cluster_interface`""" def create_b...
the_stack_v2_python_sparse
smc/core/engines.py
gabstopper/smc-python
train
31
fb7ce1e1a6e471c022dfabfe4fc853f513cb5f0b
[ "A = target\ntotal = sum(A)\nA = [-a for a in A]\nheapq.heapify(A)\nwhile True:\n a = -heapq.heappop(A)\n total -= a\n if a == 1 or total == 1:\n return True\n if a < total or total == 0 or a % total == 0:\n return False\n a %= total\n total += a\n heapq.heappush(A, -a)", "A = t...
<|body_start_0|> A = target total = sum(A) A = [-a for a in A] heapq.heapify(A) while True: a = -heapq.heappop(A) total -= a if a == 1 or total == 1: return True if a < total or total == 0 or a % total == 0: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isPossible(self, target): """:type target: List[int] :rtype: bool""" <|body_0|> def isPossible2(self, target): """:type target: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> A = target total = sum(A) ...
stack_v2_sparse_classes_36k_train_022303
2,088
no_license
[ { "docstring": ":type target: List[int] :rtype: bool", "name": "isPossible", "signature": "def isPossible(self, target)" }, { "docstring": ":type target: List[int] :rtype: bool", "name": "isPossible2", "signature": "def isPossible2(self, target)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPossible(self, target): :type target: List[int] :rtype: bool - def isPossible2(self, target): :type target: List[int] :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPossible(self, target): :type target: List[int] :rtype: bool - def isPossible2(self, target): :type target: List[int] :rtype: bool <|skeleton|> class Solution: def is...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def isPossible(self, target): """:type target: List[int] :rtype: bool""" <|body_0|> def isPossible2(self, target): """:type target: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isPossible(self, target): """:type target: List[int] :rtype: bool""" A = target total = sum(A) A = [-a for a in A] heapq.heapify(A) while True: a = -heapq.heappop(A) total -= a if a == 1 or total == 1: ...
the_stack_v2_python_sparse
C/ConstructTargetArrayWithMultipleSums.py
bssrdf/pyleet
train
2
de99b9d246dbcb67f9fd433fe045eb21fe5cd0bd
[ "self._devicename = devicename\npoll = poller.Poll(devicename)\ndata = poll.query()\nself._data = deepcopy(data)", "updated_device_data = deepcopy(self._data)\nlayer1_data = updated_device_data['layer1']\nlog_message = 'Processing data from host {}'.format(self._devicename)\nlog.log2debug(1028, log_message)\nfor ...
<|body_start_0|> self._devicename = devicename poll = poller.Poll(devicename) data = poll.query() self._data = deepcopy(data) <|end_body_0|> <|body_start_1|> updated_device_data = deepcopy(self._data) layer1_data = updated_device_data['layer1'] log_message = 'Pro...
Process data for a device. The aim of this class is to process the YAML file consistently across multiple manufacturers and present it to other classes consistently. That way manufacturer specific code for processing YAML data is in one place. For example, there isn't a standard way of reporting ethernet duplex values ...
Device
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Device: """Process data for a device. The aim of this class is to process the YAML file consistently across multiple manufacturers and present it to other classes consistently. That way manufacturer specific code for processing YAML data is in one place. For example, there isn't a standard way of...
stack_v2_sparse_classes_36k_train_022304
20,081
permissive
[ { "docstring": "Initialize class. Args: devicename: Name of device Returns: None", "name": "__init__", "signature": "def __init__(self, devicename)" }, { "docstring": "Initialize class. Args: None Returns: None Summary: IF-MIB A significant portion of this code relies on ifIndex IF-MIB::ifStackS...
3
null
Implement the Python class `Device` described below. Class description: Process data for a device. The aim of this class is to process the YAML file consistently across multiple manufacturers and present it to other classes consistently. That way manufacturer specific code for processing YAML data is in one place. For...
Implement the Python class `Device` described below. Class description: Process data for a device. The aim of this class is to process the YAML file consistently across multiple manufacturers and present it to other classes consistently. That way manufacturer specific code for processing YAML data is in one place. For...
ae82589fbbab77fef6d6be09c1fcca5846f595a8
<|skeleton|> class Device: """Process data for a device. The aim of this class is to process the YAML file consistently across multiple manufacturers and present it to other classes consistently. That way manufacturer specific code for processing YAML data is in one place. For example, there isn't a standard way of...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Device: """Process data for a device. The aim of this class is to process the YAML file consistently across multiple manufacturers and present it to other classes consistently. That way manufacturer specific code for processing YAML data is in one place. For example, there isn't a standard way of reporting et...
the_stack_v2_python_sparse
switchmap/process/device.py
PalisadoesFoundation/switchmap-ng
train
8
93f40768ff95162355ef608b42181c5acc829a8f
[ "dp = [0] * len(s)\nmax_dp = 0\nfor i in range(1, len(s)):\n if s[i] == ')' and s[i - 1] == '(':\n dp[i] = dp[i - 2] + 2\n elif s[i] == ')' and s[i - 1] == ')' and (i - dp[i - 1] - 1 >= 0):\n if s[i - dp[i - 1] - 1] == '(':\n dp[i] = dp[i - 1] + dp[i - dp[i - 1] - 2] + 2\n max_dp =...
<|body_start_0|> dp = [0] * len(s) max_dp = 0 for i in range(1, len(s)): if s[i] == ')' and s[i - 1] == '(': dp[i] = dp[i - 2] + 2 elif s[i] == ')' and s[i - 1] == ')' and (i - dp[i - 1] - 1 >= 0): if s[i - dp[i - 1] - 1] == '(': ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestValidParentheses(self, s): """:type s: str :rtype: int""" <|body_0|> def longestValidParentheses2(self, s): """dp[i] is the length of the longest of the substring ending at i including s[i] state transition: 1. if s[i] == '(', dp[i] = 0 2. if s[i...
stack_v2_sparse_classes_36k_train_022305
2,201
no_license
[ { "docstring": ":type s: str :rtype: int", "name": "longestValidParentheses", "signature": "def longestValidParentheses(self, s)" }, { "docstring": "dp[i] is the length of the longest of the substring ending at i including s[i] state transition: 1. if s[i] == '(', dp[i] = 0 2. if s[i] == ')', 2....
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestValidParentheses(self, s): :type s: str :rtype: int - def longestValidParentheses2(self, s): dp[i] is the length of the longest of the substring ending at i including ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestValidParentheses(self, s): :type s: str :rtype: int - def longestValidParentheses2(self, s): dp[i] is the length of the longest of the substring ending at i including ...
a5b02044ef39154b6a8d32eb57682f447e1632ba
<|skeleton|> class Solution: def longestValidParentheses(self, s): """:type s: str :rtype: int""" <|body_0|> def longestValidParentheses2(self, s): """dp[i] is the length of the longest of the substring ending at i including s[i] state transition: 1. if s[i] == '(', dp[i] = 0 2. if s[i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestValidParentheses(self, s): """:type s: str :rtype: int""" dp = [0] * len(s) max_dp = 0 for i in range(1, len(s)): if s[i] == ')' and s[i - 1] == '(': dp[i] = dp[i - 2] + 2 elif s[i] == ')' and s[i - 1] == ')' and (i -...
the_stack_v2_python_sparse
algo/dp/longest_valid_parentheses.py
xys234/coding-problems
train
0
4b653de11fba1d6aa8bfc0f0e14ea998358939b0
[ "super(NormalizeImage, self).__init__()\nself.mean = mean\nself.std = std\nself.is_scale = is_scale\nself.is_channel_first = is_channel_first\nif not (isinstance(self.mean, list) and isinstance(self.std, list) and isinstance(self.is_scale, bool)):\n raise TypeError('{}: input type is invalid.'.format(self))\nfro...
<|body_start_0|> super(NormalizeImage, self).__init__() self.mean = mean self.std = std self.is_scale = is_scale self.is_channel_first = is_channel_first if not (isinstance(self.mean, list) and isinstance(self.std, list) and isinstance(self.is_scale, bool)): r...
NormalizeImage
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NormalizeImage: def __init__(self, mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225], is_scale=True, is_channel_first=False): """Args: mean (list): the pixel mean std (list): the pixel variance""" <|body_0|> def __call__(self, sample, context=None): """Normalize ...
stack_v2_sparse_classes_36k_train_022306
19,057
permissive
[ { "docstring": "Args: mean (list): the pixel mean std (list): the pixel variance", "name": "__init__", "signature": "def __init__(self, mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225], is_scale=True, is_channel_first=False)" }, { "docstring": "Normalize the image. Operators: 1.(optional) S...
2
stack_v2_sparse_classes_30k_train_002748
Implement the Python class `NormalizeImage` described below. Class description: Implement the NormalizeImage class. Method signatures and docstrings: - def __init__(self, mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225], is_scale=True, is_channel_first=False): Args: mean (list): the pixel mean std (list): the pi...
Implement the Python class `NormalizeImage` described below. Class description: Implement the NormalizeImage class. Method signatures and docstrings: - def __init__(self, mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225], is_scale=True, is_channel_first=False): Args: mean (list): the pixel mean std (list): the pi...
b8ec015fa9e16c0a879c619ee1f2aab8a393c7bd
<|skeleton|> class NormalizeImage: def __init__(self, mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225], is_scale=True, is_channel_first=False): """Args: mean (list): the pixel mean std (list): the pixel variance""" <|body_0|> def __call__(self, sample, context=None): """Normalize ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NormalizeImage: def __init__(self, mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225], is_scale=True, is_channel_first=False): """Args: mean (list): the pixel mean std (list): the pixel variance""" super(NormalizeImage, self).__init__() self.mean = mean self.std = std ...
the_stack_v2_python_sparse
CV/PaddleReid/reid/data/transform/operators.py
sserdoubleh/Research
train
10
32f9d59b11d0474392c4eb5ce7ed8fa09a6c5f32
[ "super().__init__(event, arg_string)\nself.bot = SlackHandler()\nself.ka = KarmaAssistant()", "possible_userid = self.ka.check_if_correlates_to_userid(self.event, self.arg_string)\nkarma_subject = possible_userid if possible_userid else self.arg_string\nkarma_entry = KarmaModel.get_by_name(karma_subject)\nif karm...
<|body_start_0|> super().__init__(event, arg_string) self.bot = SlackHandler() self.ka = KarmaAssistant() <|end_body_0|> <|body_start_1|> possible_userid = self.ka.check_if_correlates_to_userid(self.event, self.arg_string) karma_subject = possible_userid if possible_userid else ...
Post karma status for a given string.
KarmaPlugin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KarmaPlugin: """Post karma status for a given string.""" def __init__(self, event, arg_string): """Config.""" <|body_0|> def run(self): """Run the plugin. Before querying, should check if the target is a string that correlates to a userid. If so, query the databa...
stack_v2_sparse_classes_36k_train_022307
11,809
permissive
[ { "docstring": "Config.", "name": "__init__", "signature": "def __init__(self, event, arg_string)" }, { "docstring": "Run the plugin. Before querying, should check if the target is a string that correlates to a userid. If so, query the database using that userid. Otherwise, just use the target s...
2
stack_v2_sparse_classes_30k_train_008190
Implement the Python class `KarmaPlugin` described below. Class description: Post karma status for a given string. Method signatures and docstrings: - def __init__(self, event, arg_string): Config. - def run(self): Run the plugin. Before querying, should check if the target is a string that correlates to a userid. If...
Implement the Python class `KarmaPlugin` described below. Class description: Post karma status for a given string. Method signatures and docstrings: - def __init__(self, event, arg_string): Config. - def run(self): Run the plugin. Before querying, should check if the target is a string that correlates to a userid. If...
715c14d3a06d8a7a8771572371b67cc87c7e17fb
<|skeleton|> class KarmaPlugin: """Post karma status for a given string.""" def __init__(self, event, arg_string): """Config.""" <|body_0|> def run(self): """Run the plugin. Before querying, should check if the target is a string that correlates to a userid. If so, query the databa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KarmaPlugin: """Post karma status for a given string.""" def __init__(self, event, arg_string): """Config.""" super().__init__(event, arg_string) self.bot = SlackHandler() self.ka = KarmaAssistant() def run(self): """Run the plugin. Before querying, should che...
the_stack_v2_python_sparse
src/dungeonbot/plugins/karma.py
DungeonBot/dungeonbot
train
0
0fcbb3e7f314ff7a9c0876b506dc37d34256bc33
[ "self._host = host\nself._pin = pin\nself.api = ComeliteSerialBridgeAPi(host, pin)\nsuper().__init__(hass=hass, logger=_LOGGER, name=f'{DOMAIN}-{host}-coordinator', update_interval=timedelta(seconds=5))", "_LOGGER.debug('Polling Comelit Serial Bridge host: %s', self._host)\ntry:\n logged = await self.api.login...
<|body_start_0|> self._host = host self._pin = pin self.api = ComeliteSerialBridgeAPi(host, pin) super().__init__(hass=hass, logger=_LOGGER, name=f'{DOMAIN}-{host}-coordinator', update_interval=timedelta(seconds=5)) <|end_body_0|> <|body_start_1|> _LOGGER.debug('Polling Comelit ...
Queries Comelit Serial Bridge.
ComelitSerialBridge
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ComelitSerialBridge: """Queries Comelit Serial Bridge.""" def __init__(self, hass: HomeAssistant, host: str, pin: int) -> None: """Initialize the scanner.""" <|body_0|> async def _async_update_data(self) -> dict[str, Any]: """Update router data.""" <|body...
stack_v2_sparse_classes_36k_train_022308
1,595
permissive
[ { "docstring": "Initialize the scanner.", "name": "__init__", "signature": "def __init__(self, hass: HomeAssistant, host: str, pin: int) -> None" }, { "docstring": "Update router data.", "name": "_async_update_data", "signature": "async def _async_update_data(self) -> dict[str, Any]" }...
2
null
Implement the Python class `ComelitSerialBridge` described below. Class description: Queries Comelit Serial Bridge. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, host: str, pin: int) -> None: Initialize the scanner. - async def _async_update_data(self) -> dict[str, Any]: Update router da...
Implement the Python class `ComelitSerialBridge` described below. Class description: Queries Comelit Serial Bridge. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, host: str, pin: int) -> None: Initialize the scanner. - async def _async_update_data(self) -> dict[str, Any]: Update router da...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class ComelitSerialBridge: """Queries Comelit Serial Bridge.""" def __init__(self, hass: HomeAssistant, host: str, pin: int) -> None: """Initialize the scanner.""" <|body_0|> async def _async_update_data(self) -> dict[str, Any]: """Update router data.""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ComelitSerialBridge: """Queries Comelit Serial Bridge.""" def __init__(self, hass: HomeAssistant, host: str, pin: int) -> None: """Initialize the scanner.""" self._host = host self._pin = pin self.api = ComeliteSerialBridgeAPi(host, pin) super().__init__(hass=hass,...
the_stack_v2_python_sparse
homeassistant/components/comelit/coordinator.py
home-assistant/core
train
35,501
5543fe00c176efcb18ed150be4f9e9d71e2467c7
[ "self.protocol = protocol\nself.protocol.protocol_flags['MCCP'] = False\nself.protocol.will(MCCP).addCallbacks(self.do_mccp, self.no_mccp)", "if hasattr(self.protocol, 'zlib'):\n del self.protocol.zlib\nself.protocol.protocol_flags['MCCP'] = False\nself.protocol.handshake_done()", "self.protocol.protocol_fla...
<|body_start_0|> self.protocol = protocol self.protocol.protocol_flags['MCCP'] = False self.protocol.will(MCCP).addCallbacks(self.do_mccp, self.no_mccp) <|end_body_0|> <|body_start_1|> if hasattr(self.protocol, 'zlib'): del self.protocol.zlib self.protocol.protocol_f...
Implements the MCCP protocol. Add this to a variable on the telnet protocol to set it up.
Mccp
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Mccp: """Implements the MCCP protocol. Add this to a variable on the telnet protocol to set it up.""" def __init__(self, protocol): """initialize MCCP by storing protocol on ourselves and calling the client to see if it supports MCCP. Sets callbacks to start zlib compression in that ...
stack_v2_sparse_classes_36k_train_022309
2,571
permissive
[ { "docstring": "initialize MCCP by storing protocol on ourselves and calling the client to see if it supports MCCP. Sets callbacks to start zlib compression in that case. Args: protocol (Protocol): The active protocol instance.", "name": "__init__", "signature": "def __init__(self, protocol)" }, { ...
3
stack_v2_sparse_classes_30k_train_016050
Implement the Python class `Mccp` described below. Class description: Implements the MCCP protocol. Add this to a variable on the telnet protocol to set it up. Method signatures and docstrings: - def __init__(self, protocol): initialize MCCP by storing protocol on ourselves and calling the client to see if it support...
Implement the Python class `Mccp` described below. Class description: Implements the MCCP protocol. Add this to a variable on the telnet protocol to set it up. Method signatures and docstrings: - def __init__(self, protocol): initialize MCCP by storing protocol on ourselves and calling the client to see if it support...
b3ca58b5c1325a3bf57051dfe23560a08d2947b7
<|skeleton|> class Mccp: """Implements the MCCP protocol. Add this to a variable on the telnet protocol to set it up.""" def __init__(self, protocol): """initialize MCCP by storing protocol on ourselves and calling the client to see if it supports MCCP. Sets callbacks to start zlib compression in that ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Mccp: """Implements the MCCP protocol. Add this to a variable on the telnet protocol to set it up.""" def __init__(self, protocol): """initialize MCCP by storing protocol on ourselves and calling the client to see if it supports MCCP. Sets callbacks to start zlib compression in that case. Args: p...
the_stack_v2_python_sparse
evennia/server/portal/mccp.py
evennia/evennia
train
1,781
44440d123c802d081753404c9e6aa29c149e5839
[ "super(ElevationGridFile, self).__init__()\nself.fileExtension = 'ele'\nif session is not None and project_file is not None:\n self._delete_existing(project_file, session)\nself.projectFile = project_file", "if not self.projectFile:\n raise ValueError('Must be connected to project file ...')\nelevation_rast...
<|body_start_0|> super(ElevationGridFile, self).__init__() self.fileExtension = 'ele' if session is not None and project_file is not None: self._delete_existing(project_file, session) self.projectFile = project_file <|end_body_0|> <|body_start_1|> if not self.project...
Object interface for generating an elevation grid. This object inherits the :class:`gsshapy.orm.RasterMapFile` base class. See: http://www.gsshawiki.com/Project_File:Project_File
ElevationGridFile
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ElevationGridFile: """Object interface for generating an elevation grid. This object inherits the :class:`gsshapy.orm.RasterMapFile` base class. See: http://www.gsshawiki.com/Project_File:Project_File""" def __init__(self, session=None, project_file=None): """Constructor""" <...
stack_v2_sparse_classes_36k_train_022310
4,043
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, session=None, project_file=None)" }, { "docstring": "Generates an elevation grid for the GSSHA simulation from an elevation raster Example:: from gsshapy.orm import ProjectFile, ElevationGridFile from gsshapy.lib ...
2
stack_v2_sparse_classes_30k_train_006805
Implement the Python class `ElevationGridFile` described below. Class description: Object interface for generating an elevation grid. This object inherits the :class:`gsshapy.orm.RasterMapFile` base class. See: http://www.gsshawiki.com/Project_File:Project_File Method signatures and docstrings: - def __init__(self, s...
Implement the Python class `ElevationGridFile` described below. Class description: Object interface for generating an elevation grid. This object inherits the :class:`gsshapy.orm.RasterMapFile` base class. See: http://www.gsshawiki.com/Project_File:Project_File Method signatures and docstrings: - def __init__(self, s...
73832e58b94d1182595bc7851148b626d5f76159
<|skeleton|> class ElevationGridFile: """Object interface for generating an elevation grid. This object inherits the :class:`gsshapy.orm.RasterMapFile` base class. See: http://www.gsshawiki.com/Project_File:Project_File""" def __init__(self, session=None, project_file=None): """Constructor""" <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ElevationGridFile: """Object interface for generating an elevation grid. This object inherits the :class:`gsshapy.orm.RasterMapFile` base class. See: http://www.gsshawiki.com/Project_File:Project_File""" def __init__(self, session=None, project_file=None): """Constructor""" super(Elevatio...
the_stack_v2_python_sparse
gsshapy/orm/ele.py
CI-WATER/gsshapy
train
9
dc8d9f735d4577bbbf7dcda41e76b9c0758a04e0
[ "if not root:\n return ''\nlevel = [root]\nval_list = [str(root.val)]\nwhile level:\n level_len = len(level)\n for _ in range(level_len):\n node = level.pop(0)\n if node:\n level.append(node.left)\n level.append(node.right)\n for node in level:\n val = str(node...
<|body_start_0|> if not root: return '' level = [root] val_list = [str(root.val)] while level: level_len = len(level) for _ in range(level_len): node = level.pop(0) if node: level.append(node.left) ...
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_022311
1,781
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
9ea466f1ebfd976b60dfa2ff2e8b0b2e5c99a9b3
<|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 '' level = [root] val_list = [str(root.val)] while level: level_len = len(level) for _ in range(level_len)...
the_stack_v2_python_sparse
0297_Serialize_and_Deserialize_Binary_Tree.py
oveis/LeetCode
train
0
4046c2ace89d9e68107822fdfac6b470002a8d50
[ "self.assertEqual(parse_positions('1, 10, 100, 1000'), [1, 10, 100, 1000])\nself.assertEqual(parse_positions('1 10 100 1000'), [1, 10, 100, 1000])\nwith self.assertRaises(PositionsParseException):\n parse_positions('hello')", "with self.assertRaises(QuitException):\n parse_positions('quit')\nwith self.asser...
<|body_start_0|> self.assertEqual(parse_positions('1, 10, 100, 1000'), [1, 10, 100, 1000]) self.assertEqual(parse_positions('1 10 100 1000'), [1, 10, 100, 1000]) with self.assertRaises(PositionsParseException): parse_positions('hello') <|end_body_0|> <|body_start_1|> with se...
assignment8_testcase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class assignment8_testcase: def test_parse_positions(self): """Assignment8: Parse positions correctly""" <|body_0|> def test_quit(self): """Assignment8: 'quit' string quits""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.assertEqual(parse_positions('...
stack_v2_sparse_classes_36k_train_022312
686
no_license
[ { "docstring": "Assignment8: Parse positions correctly", "name": "test_parse_positions", "signature": "def test_parse_positions(self)" }, { "docstring": "Assignment8: 'quit' string quits", "name": "test_quit", "signature": "def test_quit(self)" } ]
2
null
Implement the Python class `assignment8_testcase` described below. Class description: Implement the assignment8_testcase class. Method signatures and docstrings: - def test_parse_positions(self): Assignment8: Parse positions correctly - def test_quit(self): Assignment8: 'quit' string quits
Implement the Python class `assignment8_testcase` described below. Class description: Implement the assignment8_testcase class. Method signatures and docstrings: - def test_parse_positions(self): Assignment8: Parse positions correctly - def test_quit(self): Assignment8: 'quit' string quits <|skeleton|> class assignm...
068db95cef0c693ad833fcfe968aa0b5db2162cd
<|skeleton|> class assignment8_testcase: def test_parse_positions(self): """Assignment8: Parse positions correctly""" <|body_0|> def test_quit(self): """Assignment8: 'quit' string quits""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class assignment8_testcase: def test_parse_positions(self): """Assignment8: Parse positions correctly""" self.assertEqual(parse_positions('1, 10, 100, 1000'), [1, 10, 100, 1000]) self.assertEqual(parse_positions('1 10 100 1000'), [1, 10, 100, 1000]) with self.assertRaises(PositionsPa...
the_stack_v2_python_sparse
bk1051/test_assignment8.py
whirlkick/assignment8
train
0
bdd5690f6a2ddded83a22f8ae82b061e808fd38c
[ "if not root:\n return 0\nq = deque()\nq.append([1, root])\nwhile q:\n x = len(q)\n while x:\n d, node = q.popleft()\n if not node.left and (not node.right):\n return d\n if node.left:\n q.append([d + 1, node.left])\n if node.right:\n q.append([d...
<|body_start_0|> if not root: return 0 q = deque() q.append([1, root]) while q: x = len(q) while x: d, node = q.popleft() if not node.left and (not node.right): return d if node.left: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minDepth(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def minDepth(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: return 0 q = deque()...
stack_v2_sparse_classes_36k_train_022313
1,000
no_license
[ { "docstring": ":type root: TreeNode :rtype: int", "name": "minDepth", "signature": "def minDepth(self, root)" }, { "docstring": ":type root: TreeNode :rtype: int", "name": "minDepth", "signature": "def minDepth(self, root)" } ]
2
stack_v2_sparse_classes_30k_train_003125
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minDepth(self, root): :type root: TreeNode :rtype: int - def minDepth(self, root): :type root: TreeNode :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minDepth(self, root): :type root: TreeNode :rtype: int - def minDepth(self, root): :type root: TreeNode :rtype: int <|skeleton|> class Solution: def minDepth(self, root...
31012a004ba14ddfb468a91925d86bc2dfb60dd4
<|skeleton|> class Solution: def minDepth(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def minDepth(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minDepth(self, root): """:type root: TreeNode :rtype: int""" if not root: return 0 q = deque() q.append([1, root]) while q: x = len(q) while x: d, node = q.popleft() if not node.left and (...
the_stack_v2_python_sparse
tree/MinimumDepthofBinaryTree.py
yuhangxiaocs/LeetCodePy
train
1
2e4357d3efbb41dec5efcf860ed2f2e500a4ec0d
[ "server, validation_resources = self._create_server()\nvolume = self.create_volume()\nself.attach_volume(server, volume)\nself.assertRaises(lib_exc.BadRequest, self.delete_volume, volume['id'])", "server, validation_resources = self._create_server()\nvolume = self.create_volume()\nself.attach_volume(server, volum...
<|body_start_0|> server, validation_resources = self._create_server() volume = self.create_volume() self.attach_volume(server, volume) self.assertRaises(lib_exc.BadRequest, self.delete_volume, volume['id']) <|end_body_0|> <|body_start_1|> server, validation_resources = self._cre...
Negative tests of volume attaching
AttachVolumeNegativeTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AttachVolumeNegativeTest: """Negative tests of volume attaching""" def test_delete_attached_volume(self): """Test deleting attachemd volume should fail""" <|body_0|> def test_attach_attached_volume_to_same_server(self): """Test attaching attached volume to same s...
stack_v2_sparse_classes_36k_train_022314
2,824
permissive
[ { "docstring": "Test deleting attachemd volume should fail", "name": "test_delete_attached_volume", "signature": "def test_delete_attached_volume(self)" }, { "docstring": "Test attaching attached volume to same server should fail Test attaching the same volume to the same instance once it's alre...
3
stack_v2_sparse_classes_30k_train_002740
Implement the Python class `AttachVolumeNegativeTest` described below. Class description: Negative tests of volume attaching Method signatures and docstrings: - def test_delete_attached_volume(self): Test deleting attachemd volume should fail - def test_attach_attached_volume_to_same_server(self): Test attaching atta...
Implement the Python class `AttachVolumeNegativeTest` described below. Class description: Negative tests of volume attaching Method signatures and docstrings: - def test_delete_attached_volume(self): Test deleting attachemd volume should fail - def test_attach_attached_volume_to_same_server(self): Test attaching atta...
3932a799e620a20d7abf7b89e21b520683a1809b
<|skeleton|> class AttachVolumeNegativeTest: """Negative tests of volume attaching""" def test_delete_attached_volume(self): """Test deleting attachemd volume should fail""" <|body_0|> def test_attach_attached_volume_to_same_server(self): """Test attaching attached volume to same s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AttachVolumeNegativeTest: """Negative tests of volume attaching""" def test_delete_attached_volume(self): """Test deleting attachemd volume should fail""" server, validation_resources = self._create_server() volume = self.create_volume() self.attach_volume(server, volume) ...
the_stack_v2_python_sparse
tempest/api/compute/volumes/test_attach_volume_negative.py
openstack/tempest
train
270
d5f8c8f4652aff9e2a9663687af0ea8d1b02e320
[ "start = self._start(arr, len(arr) - 1)\nif arr[start] != start:\n return None\nend = self._end(arr, 0)\nreturn (start, end)", "start = 0\nend = inside_index\nwhile start < end:\n if arr[start] == start:\n end = start\n start = 0\n else:\n start = start + math.ceil((end - start) / 2)...
<|body_start_0|> start = self._start(arr, len(arr) - 1) if arr[start] != start: return None end = self._end(arr, 0) return (start, end) <|end_body_0|> <|body_start_1|> start = 0 end = inside_index while start < end: if arr[start] == start:...
8.3 Magic Index: A magic index in an array A [ 0 ••• n -1] is defined to be an index such that A[ i] = i. Given a sorted array of distinct integers, write a method to find a magic index, if one exists, in array A. FOLLOW UP What if the values are not distinct? Hints:#770, #204, #240, #286, #340
MagicIndex
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MagicIndex: """8.3 Magic Index: A magic index in an array A [ 0 ••• n -1] is defined to be an index such that A[ i] = i. Given a sorted array of distinct integers, write a method to find a magic index, if one exists, in array A. FOLLOW UP What if the values are not distinct? Hints:#770, #204, #24...
stack_v2_sparse_classes_36k_train_022315
3,320
no_license
[ { "docstring": "If the values are distinct, array can contain the only magic index O(log(n)) implementation :return: (start, end) of magic index", "name": "single", "signature": "def single(self, arr: [])" }, { "docstring": ":param arr: given array :param inside_index: index of element in array,...
4
null
Implement the Python class `MagicIndex` described below. Class description: 8.3 Magic Index: A magic index in an array A [ 0 ••• n -1] is defined to be an index such that A[ i] = i. Given a sorted array of distinct integers, write a method to find a magic index, if one exists, in array A. FOLLOW UP What if the values ...
Implement the Python class `MagicIndex` described below. Class description: 8.3 Magic Index: A magic index in an array A [ 0 ••• n -1] is defined to be an index such that A[ i] = i. Given a sorted array of distinct integers, write a method to find a magic index, if one exists, in array A. FOLLOW UP What if the values ...
8ae84f276cd07ffdb9b742569a5e32809ecc6b29
<|skeleton|> class MagicIndex: """8.3 Magic Index: A magic index in an array A [ 0 ••• n -1] is defined to be an index such that A[ i] = i. Given a sorted array of distinct integers, write a method to find a magic index, if one exists, in array A. FOLLOW UP What if the values are not distinct? Hints:#770, #204, #24...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MagicIndex: """8.3 Magic Index: A magic index in an array A [ 0 ••• n -1] is defined to be an index such that A[ i] = i. Given a sorted array of distinct integers, write a method to find a magic index, if one exists, in array A. FOLLOW UP What if the values are not distinct? Hints:#770, #204, #240, #286, #340...
the_stack_v2_python_sparse
pyquiz/ctci/dynamic/MagicIndex.py
DmitryPukhov/pyquiz
train
0
700103e5b3b016d0101185f1168e8b0db6797ec5
[ "self.local_name: dict[str, list[_T]] = {}\nself.service_uuid: dict[str, list[_T]] = {}\nself.service_data_uuid: dict[str, list[_T]] = {}\nself.manufacturer_id: dict[int, list[_T]] = {}\nself.service_uuid_set: set[str] = set()\nself.service_data_uuid_set: set[str] = set()\nself.manufacturer_id_set: set[int] = set()...
<|body_start_0|> self.local_name: dict[str, list[_T]] = {} self.service_uuid: dict[str, list[_T]] = {} self.service_data_uuid: dict[str, list[_T]] = {} self.manufacturer_id: dict[int, list[_T]] = {} self.service_uuid_set: set[str] = set() self.service_data_uuid_set: set[s...
Bluetooth matcher base for the bluetooth integration. The indexer puts each matcher in the bucket that it is most likely to match. This allows us to only check the service infos against each bucket to see if we should match against the data. This is optimized for cases when no service infos will be matched in any bucke...
BluetoothMatcherIndexBase
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BluetoothMatcherIndexBase: """Bluetooth matcher base for the bluetooth integration. The indexer puts each matcher in the bucket that it is most likely to match. This allows us to only check the service infos against each bucket to see if we should match against the data. This is optimized for cas...
stack_v2_sparse_classes_36k_train_022316
15,444
permissive
[ { "docstring": "Initialize the matcher index.", "name": "__init__", "signature": "def __init__(self) -> None" }, { "docstring": "Add a matcher to the index. Matchers must end up only in one bucket. We put them in the bucket that they are most likely to match.", "name": "add", "signature"...
5
null
Implement the Python class `BluetoothMatcherIndexBase` described below. Class description: Bluetooth matcher base for the bluetooth integration. The indexer puts each matcher in the bucket that it is most likely to match. This allows us to only check the service infos against each bucket to see if we should match agai...
Implement the Python class `BluetoothMatcherIndexBase` described below. Class description: Bluetooth matcher base for the bluetooth integration. The indexer puts each matcher in the bucket that it is most likely to match. This allows us to only check the service infos against each bucket to see if we should match agai...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class BluetoothMatcherIndexBase: """Bluetooth matcher base for the bluetooth integration. The indexer puts each matcher in the bucket that it is most likely to match. This allows us to only check the service infos against each bucket to see if we should match against the data. This is optimized for cas...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BluetoothMatcherIndexBase: """Bluetooth matcher base for the bluetooth integration. The indexer puts each matcher in the bucket that it is most likely to match. This allows us to only check the service infos against each bucket to see if we should match against the data. This is optimized for cases when no se...
the_stack_v2_python_sparse
homeassistant/components/bluetooth/match.py
home-assistant/core
train
35,501
afae6ee08d5f5353b9af0fd8ef6ea20e8fb6f6e0
[ "self.http_method = http_method\nself._url_template = url_template\nself.request_body_parameter = request_body_parameter\nself._path_variables = path_variables if path_variables is not None else {}\nself._query_parameters = query_parameters if query_parameters is not None else {}", "url_path = six.text_type(self....
<|body_start_0|> self.http_method = http_method self._url_template = url_template self.request_body_parameter = request_body_parameter self._path_variables = path_variables if path_variables is not None else {} self._query_parameters = query_parameters if query_parameters is not ...
This class holds the metadata for making a REST request :type http_method: :class:`str` :ivar http_method: HTTP method :type request_body_parameter: :class:`str` :ivar request_body_parameter: Python runtime name of the parameter that forms the HTTP request body
OperationRestMetadata
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OperationRestMetadata: """This class holds the metadata for making a REST request :type http_method: :class:`str` :ivar http_method: HTTP method :type request_body_parameter: :class:`str` :ivar request_body_parameter: Python runtime name of the parameter that forms the HTTP request body""" d...
stack_v2_sparse_classes_36k_train_022317
4,394
no_license
[ { "docstring": "Initialze the rest metadata class :type http_method: :class:`str` :param http_method: HTTP method :type url_template: :class:`str` :param url_template: URL path template :type path_variables: :class:`dict` of :class:`str` and :class:`str` :param path_variables: Map of python runtime name and the...
4
stack_v2_sparse_classes_30k_train_010893
Implement the Python class `OperationRestMetadata` described below. Class description: This class holds the metadata for making a REST request :type http_method: :class:`str` :ivar http_method: HTTP method :type request_body_parameter: :class:`str` :ivar request_body_parameter: Python runtime name of the parameter tha...
Implement the Python class `OperationRestMetadata` described below. Class description: This class holds the metadata for making a REST request :type http_method: :class:`str` :ivar http_method: HTTP method :type request_body_parameter: :class:`str` :ivar request_body_parameter: Python runtime name of the parameter tha...
5d395700ab3d0d1d45b497e48beab8c366fca9f5
<|skeleton|> class OperationRestMetadata: """This class holds the metadata for making a REST request :type http_method: :class:`str` :ivar http_method: HTTP method :type request_body_parameter: :class:`str` :ivar request_body_parameter: Python runtime name of the parameter that forms the HTTP request body""" d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OperationRestMetadata: """This class holds the metadata for making a REST request :type http_method: :class:`str` :ivar http_method: HTTP method :type request_body_parameter: :class:`str` :ivar request_body_parameter: Python runtime name of the parameter that forms the HTTP request body""" def __init__(s...
the_stack_v2_python_sparse
alexa-program/vmware/vapi/lib/rest.py
taromurata/TDP2018_VMCAPI
train
1
84a27c910412fb8ab11915131991f7bdb7908784
[ "if key != 'line':\n raise errors.ParseError('Unable to parse record, unknown structure: {0:s}'.format(key))\nmsg_value = self._GetValueFromStructure(structure, 'msg')\nif not msg_value:\n parser_mediator.ProduceExtractionWarning('missing msg value: {0!s}'.format(structure))\n return\ntry:\n seconds = i...
<|body_start_0|> if key != 'line': raise errors.ParseError('Unable to parse record, unknown structure: {0:s}'.format(key)) msg_value = self._GetValueFromStructure(structure, 'msg') if not msg_value: parser_mediator.ProduceExtractionWarning('missing msg value: {0!s}'.forma...
Parser for SELinux audit log (audit.log) files.
SELinuxParser
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SELinuxParser: """Parser for SELinux audit log (audit.log) files.""" def ParseRecord(self, parser_mediator, key, structure): """Parses a structure of tokens derived from a line of a text file. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other com...
stack_v2_sparse_classes_36k_train_022318
6,354
permissive
[ { "docstring": "Parses a structure of tokens derived from a line of a text file. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. key (str): name of the parsed structure. structure (pyparsing.ParseResults): structure of tokens derived...
2
stack_v2_sparse_classes_30k_train_010178
Implement the Python class `SELinuxParser` described below. Class description: Parser for SELinux audit log (audit.log) files. Method signatures and docstrings: - def ParseRecord(self, parser_mediator, key, structure): Parses a structure of tokens derived from a line of a text file. Args: parser_mediator (ParserMedia...
Implement the Python class `SELinuxParser` described below. Class description: Parser for SELinux audit log (audit.log) files. Method signatures and docstrings: - def ParseRecord(self, parser_mediator, key, structure): Parses a structure of tokens derived from a line of a text file. Args: parser_mediator (ParserMedia...
c69b2952b608cfce47ff8fd0d1409d856be35cb1
<|skeleton|> class SELinuxParser: """Parser for SELinux audit log (audit.log) files.""" def ParseRecord(self, parser_mediator, key, structure): """Parses a structure of tokens derived from a line of a text file. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other com...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SELinuxParser: """Parser for SELinux audit log (audit.log) files.""" def ParseRecord(self, parser_mediator, key, structure): """Parses a structure of tokens derived from a line of a text file. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such...
the_stack_v2_python_sparse
plaso/parsers/selinux.py
cyb3rfox/plaso
train
3
dd94ad24b316ca7660a455019bc0835911a37205
[ "self.verbose = verbose\nself._initialize_arms(arm_functions, n0, retrain_gp)\nself.initial_kg = self.arm_kg.clone()\nself.h = h\nself.g = g\nself.w_star0 = w_star0\nself.N = 0\nif self.verbose:\n print('Initialization complete. mu: %s, KG: %s' % (self.arm_mu_best, self.arm_kg))", "self.arms = []\nself.arm_mu_...
<|body_start_0|> self.verbose = verbose self._initialize_arms(arm_functions, n0, retrain_gp) self.initial_kg = self.arm_kg.clone() self.h = h self.g = g self.w_star0 = w_star0 self.N = 0 if self.verbose: print('Initialization complete. mu: %s, ...
The generic algorithm for the parametric bandit defined in the notes It does not specify g() and h() functions This doesn't do too well. It has many shortcomings.
GenericAlgorithm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GenericAlgorithm: """The generic algorithm for the parametric bandit defined in the notes It does not specify g() and h() functions This doesn't do too well. It has many shortcomings.""" def __init__(self, arm_functions: List[SyntheticTestFunction], h: Callable, g: Callable, w_star0: float, ...
stack_v2_sparse_classes_36k_train_022319
4,183
no_license
[ { "docstring": "Initialize the algorithm set-up with the given number of arms :param arm_functions: list of functions of each arm :param h: the function for allocating the weight between inferior arms :param g: the function for setting the weight of the best arm :param w_star0: the initial weight of the best ar...
3
stack_v2_sparse_classes_30k_train_021063
Implement the Python class `GenericAlgorithm` described below. Class description: The generic algorithm for the parametric bandit defined in the notes It does not specify g() and h() functions This doesn't do too well. It has many shortcomings. Method signatures and docstrings: - def __init__(self, arm_functions: Lis...
Implement the Python class `GenericAlgorithm` described below. Class description: The generic algorithm for the parametric bandit defined in the notes It does not specify g() and h() functions This doesn't do too well. It has many shortcomings. Method signatures and docstrings: - def __init__(self, arm_functions: Lis...
ac4a9a413290beee0d0f082d5b35d3a905c80f1e
<|skeleton|> class GenericAlgorithm: """The generic algorithm for the parametric bandit defined in the notes It does not specify g() and h() functions This doesn't do too well. It has many shortcomings.""" def __init__(self, arm_functions: List[SyntheticTestFunction], h: Callable, g: Callable, w_star0: float, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GenericAlgorithm: """The generic algorithm for the parametric bandit defined in the notes It does not specify g() and h() functions This doesn't do too well. It has many shortcomings.""" def __init__(self, arm_functions: List[SyntheticTestFunction], h: Callable, g: Callable, w_star0: float, n0: int=10, r...
the_stack_v2_python_sparse
parametric_bandit/deprecated/generic_algorithm.py
saitcakmak/parametric-bandit
train
0
f12c6bbec3d829d83f9d880d2e30756a2fcad8b7
[ "super().__init__(tag)\nself.mem_id = mem_id\nself.start_address = raw_values[1] if raw_values[0] & ExtMemPropTags.START_ADDRESS else None\nself.total_size = raw_values[2] * 1024 if raw_values[0] & ExtMemPropTags.SIZE_IN_KBYTES else None\nself.page_size = raw_values[3] if raw_values[0] & ExtMemPropTags.PAGE_SIZE el...
<|body_start_0|> super().__init__(tag) self.mem_id = mem_id self.start_address = raw_values[1] if raw_values[0] & ExtMemPropTags.START_ADDRESS else None self.total_size = raw_values[2] * 1024 if raw_values[0] & ExtMemPropTags.SIZE_IN_KBYTES else None self.page_size = raw_values[3...
Attributes for external memories.
ExternalMemoryAttributesValue
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause", "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExternalMemoryAttributesValue: """Attributes for external memories.""" def __init__(self, tag: int, raw_values: List[int], mem_id: int=0) -> None: """Initialize the ExternalMemoryAttributes-based property object. :param tag: Property tag, see: `PropertyTag` :param raw_values: List of...
stack_v2_sparse_classes_36k_train_022320
24,348
permissive
[ { "docstring": "Initialize the ExternalMemoryAttributes-based property object. :param tag: Property tag, see: `PropertyTag` :param raw_values: List of integers representing the property :param mem_id: ID of the external memory", "name": "__init__", "signature": "def __init__(self, tag: int, raw_values: ...
2
stack_v2_sparse_classes_30k_train_003570
Implement the Python class `ExternalMemoryAttributesValue` described below. Class description: Attributes for external memories. Method signatures and docstrings: - def __init__(self, tag: int, raw_values: List[int], mem_id: int=0) -> None: Initialize the ExternalMemoryAttributes-based property object. :param tag: Pr...
Implement the Python class `ExternalMemoryAttributesValue` described below. Class description: Attributes for external memories. Method signatures and docstrings: - def __init__(self, tag: int, raw_values: List[int], mem_id: int=0) -> None: Initialize the ExternalMemoryAttributes-based property object. :param tag: Pr...
4a31fb091f95fb035bc66241ee4e02dabb580072
<|skeleton|> class ExternalMemoryAttributesValue: """Attributes for external memories.""" def __init__(self, tag: int, raw_values: List[int], mem_id: int=0) -> None: """Initialize the ExternalMemoryAttributes-based property object. :param tag: Property tag, see: `PropertyTag` :param raw_values: List of...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExternalMemoryAttributesValue: """Attributes for external memories.""" def __init__(self, tag: int, raw_values: List[int], mem_id: int=0) -> None: """Initialize the ExternalMemoryAttributes-based property object. :param tag: Property tag, see: `PropertyTag` :param raw_values: List of integers rep...
the_stack_v2_python_sparse
spsdk/mboot/properties.py
AdrianCano-01/spsdk
train
0
074bcfad7acfb1a8f0b6042c6a37fa0f33f44261
[ "loan = super().transform_record(pid, record, links_factory=links_factory, **kwargs)\nfield_is_overdue(loan['metadata'])\nfield_pickup_location(loan['metadata'])\nfield_transaction_location(loan['metadata'])\nfield_transaction_user(loan['metadata'])\nreturn loan", "hit = super().transform_search_hit(pid, record_h...
<|body_start_0|> loan = super().transform_record(pid, record, links_factory=links_factory, **kwargs) field_is_overdue(loan['metadata']) field_pickup_location(loan['metadata']) field_transaction_location(loan['metadata']) field_transaction_user(loan['metadata']) return loa...
Serialize loan.
LoanCSVSerializer
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoanCSVSerializer: """Serialize loan.""" def transform_record(self, pid, record, links_factory=None, **kwargs): """Transform record into an intermediate representation.""" <|body_0|> def transform_search_hit(self, pid, record_hit, links_factory=None, **kwargs): "...
stack_v2_sparse_classes_36k_train_022321
1,328
permissive
[ { "docstring": "Transform record into an intermediate representation.", "name": "transform_record", "signature": "def transform_record(self, pid, record, links_factory=None, **kwargs)" }, { "docstring": "Transform search result hit into an intermediate representation.", "name": "transform_se...
2
stack_v2_sparse_classes_30k_test_000422
Implement the Python class `LoanCSVSerializer` described below. Class description: Serialize loan. Method signatures and docstrings: - def transform_record(self, pid, record, links_factory=None, **kwargs): Transform record into an intermediate representation. - def transform_search_hit(self, pid, record_hit, links_fa...
Implement the Python class `LoanCSVSerializer` described below. Class description: Serialize loan. Method signatures and docstrings: - def transform_record(self, pid, record, links_factory=None, **kwargs): Transform record into an intermediate representation. - def transform_search_hit(self, pid, record_hit, links_fa...
1c36526e85510100c5f64059518d1b716d87ac10
<|skeleton|> class LoanCSVSerializer: """Serialize loan.""" def transform_record(self, pid, record, links_factory=None, **kwargs): """Transform record into an intermediate representation.""" <|body_0|> def transform_search_hit(self, pid, record_hit, links_factory=None, **kwargs): "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LoanCSVSerializer: """Serialize loan.""" def transform_record(self, pid, record, links_factory=None, **kwargs): """Transform record into an intermediate representation.""" loan = super().transform_record(pid, record, links_factory=links_factory, **kwargs) field_is_overdue(loan['me...
the_stack_v2_python_sparse
invenio_app_ils/circulation/serializers/csv.py
inveniosoftware/invenio-app-ils
train
64
c2c8da065e9d240e976aff50186f68ab102d03e1
[ "log_id = escape(self.get_argument('log'))\naction = self.get_argument('action')\nconfirmed = self.get_argument('confirm', default='0')\ntoken = escape(self.get_argument('token'))\nif action == 'delete':\n if confirmed == '1':\n if self.delete_log_entry(log_id, token):\n content = '\\n<h3>Log F...
<|body_start_0|> log_id = escape(self.get_argument('log')) action = self.get_argument('action') confirmed = self.get_argument('confirm', default='0') token = escape(self.get_argument('token')) if action == 'delete': if confirmed == '1': if self.delete_...
Edit a log entry, with confirmation (currently only delete)
EditEntryHandler
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EditEntryHandler: """Edit a log entry, with confirmation (currently only delete)""" def get(self, *args, **kwargs): """GET request""" <|body_0|> def delete_log_entry(log_id, token): """delete a log entry (DB & file), validate token first :return: True on success"...
stack_v2_sparse_classes_36k_train_022322
3,361
permissive
[ { "docstring": "GET request", "name": "get", "signature": "def get(self, *args, **kwargs)" }, { "docstring": "delete a log entry (DB & file), validate token first :return: True on success", "name": "delete_log_entry", "signature": "def delete_log_entry(log_id, token)" } ]
2
stack_v2_sparse_classes_30k_train_015623
Implement the Python class `EditEntryHandler` described below. Class description: Edit a log entry, with confirmation (currently only delete) Method signatures and docstrings: - def get(self, *args, **kwargs): GET request - def delete_log_entry(log_id, token): delete a log entry (DB & file), validate token first :ret...
Implement the Python class `EditEntryHandler` described below. Class description: Edit a log entry, with confirmation (currently only delete) Method signatures and docstrings: - def get(self, *args, **kwargs): GET request - def delete_log_entry(log_id, token): delete a log entry (DB & file), validate token first :ret...
6b146f996be51902630fdb0cfe4a13e1aed15753
<|skeleton|> class EditEntryHandler: """Edit a log entry, with confirmation (currently only delete)""" def get(self, *args, **kwargs): """GET request""" <|body_0|> def delete_log_entry(log_id, token): """delete a log entry (DB & file), validate token first :return: True on success"...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EditEntryHandler: """Edit a log entry, with confirmation (currently only delete)""" def get(self, *args, **kwargs): """GET request""" log_id = escape(self.get_argument('log')) action = self.get_argument('action') confirmed = self.get_argument('confirm', default='0') ...
the_stack_v2_python_sparse
app/tornado_handlers/edit_entry.py
PX4/flight_review
train
169
121b8270efe1f92749162bc7dec3322a14edca88
[ "product = self.getProduct()\nif product:\n return product.Title()\nelse:\n return ''", "price = self.getPrice()\nif price:\n return self.getPrice() * self.getQuantity()\nelse:\n return 0", "price = self.getPrice()\nquantity = self.getQuantity()\nvat = self.getVAT()\nif price and quantity and vat:\n...
<|body_start_0|> product = self.getProduct() if product: return product.Title() else: return '' <|end_body_0|> <|body_start_1|> price = self.getPrice() if price: return self.getPrice() * self.getQuantity() else: return 0 <|...
SupplyOrderItem
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SupplyOrderItem: def Title(self): """Return the Product as title""" <|body_0|> def getTotal(self): """compute total excluding VAT""" <|body_1|> def getTotalIncludingVAT(self): """Compute Total including VAT""" <|body_2|> <|end_skeleton|>...
stack_v2_sparse_classes_36k_train_022323
2,229
no_license
[ { "docstring": "Return the Product as title", "name": "Title", "signature": "def Title(self)" }, { "docstring": "compute total excluding VAT", "name": "getTotal", "signature": "def getTotal(self)" }, { "docstring": "Compute Total including VAT", "name": "getTotalIncludingVAT"...
3
stack_v2_sparse_classes_30k_train_012118
Implement the Python class `SupplyOrderItem` described below. Class description: Implement the SupplyOrderItem class. Method signatures and docstrings: - def Title(self): Return the Product as title - def getTotal(self): compute total excluding VAT - def getTotalIncludingVAT(self): Compute Total including VAT
Implement the Python class `SupplyOrderItem` described below. Class description: Implement the SupplyOrderItem class. Method signatures and docstrings: - def Title(self): Return the Product as title - def getTotal(self): compute total excluding VAT - def getTotalIncludingVAT(self): Compute Total including VAT <|skel...
5516a36dbbc5578d4a9160c5023db12f58807609
<|skeleton|> class SupplyOrderItem: def Title(self): """Return the Product as title""" <|body_0|> def getTotal(self): """compute total excluding VAT""" <|body_1|> def getTotalIncludingVAT(self): """Compute Total including VAT""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SupplyOrderItem: def Title(self): """Return the Product as title""" product = self.getProduct() if product: return product.Title() else: return '' def getTotal(self): """compute total excluding VAT""" price = self.getPrice() ...
the_stack_v2_python_sparse
bika/lims/content/supplyorderitem.py
lemoene/Bika-LIMS
train
1
02edb7c26824676ea5b66b895a23663d45a7531a
[ "logging.info('Validando os dados para criação da questão.')\nif 'alternatives' not in data.keys():\n raise ParseError('As alternativas são obrigatórias.')\nif not data['alternatives']:\n raise ParseError('Alternativas vazias.')\nif data['question'] != TypeSet.V_OR_F.value:\n counter = 0\n for alternati...
<|body_start_0|> logging.info('Validando os dados para criação da questão.') if 'alternatives' not in data.keys(): raise ParseError('As alternativas são obrigatórias.') if not data['alternatives']: raise ParseError('Alternativas vazias.') if data['question'] != Ty...
Serializado de dados dos grupos da disciplina.
QuestionSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuestionSerializer: """Serializado de dados dos grupos da disciplina.""" def validate_creation(self, data): """Valida se somente uma alternativa está como True.""" <|body_0|> def create_alternatives(self, alternatives, question): """Cria as alternativas passadas....
stack_v2_sparse_classes_36k_train_022324
2,522
no_license
[ { "docstring": "Valida se somente uma alternativa está como True.", "name": "validate_creation", "signature": "def validate_creation(self, data)" }, { "docstring": "Cria as alternativas passadas.", "name": "create_alternatives", "signature": "def create_alternatives(self, alternatives, q...
3
stack_v2_sparse_classes_30k_train_014650
Implement the Python class `QuestionSerializer` described below. Class description: Serializado de dados dos grupos da disciplina. Method signatures and docstrings: - def validate_creation(self, data): Valida se somente uma alternativa está como True. - def create_alternatives(self, alternatives, question): Cria as a...
Implement the Python class `QuestionSerializer` described below. Class description: Serializado de dados dos grupos da disciplina. Method signatures and docstrings: - def validate_creation(self, data): Valida se somente uma alternativa está como True. - def create_alternatives(self, alternatives, question): Cria as a...
3a8009b17518384c269dfee3c8fe44cbe2567cc0
<|skeleton|> class QuestionSerializer: """Serializado de dados dos grupos da disciplina.""" def validate_creation(self, data): """Valida se somente uma alternativa está como True.""" <|body_0|> def create_alternatives(self, alternatives, question): """Cria as alternativas passadas....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QuestionSerializer: """Serializado de dados dos grupos da disciplina.""" def validate_creation(self, data): """Valida se somente uma alternativa está como True.""" logging.info('Validando os dados para criação da questão.') if 'alternatives' not in data.keys(): raise P...
the_stack_v2_python_sparse
project/alma/questions/serializers.py
VWApplications/VWAlmaAPI
train
1
b99219cc1ac4f26cf7369c2c77ea7ba89132b3be
[ "super().__init__(name=name, mandatory_transforms_start=mandatory_transforms_start, transforms=transforms, mandatory_transforms_end=mandatory_transforms_end)\nif num_transformations is None:\n self.num_transformations = None\n if num_transformations_min is None:\n self.num_transformations_min = 1\n ...
<|body_start_0|> super().__init__(name=name, mandatory_transforms_start=mandatory_transforms_start, transforms=transforms, mandatory_transforms_end=mandatory_transforms_end) if num_transformations is None: self.num_transformations = None if num_transformations_min is None: ...
AUTHORS: -------- :author: Alix Leroy DESCRIPTION: ------------ SomeOf class inheriting from Transformer which compute a random number of transforms in the tranforms list. The random number is bounded by a min and max
SomeOf
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SomeOf: """AUTHORS: -------- :author: Alix Leroy DESCRIPTION: ------------ SomeOf class inheriting from Transformer which compute a random number of transforms in the tranforms list. The random number is bounded by a min and max""" def __init__(self, name: str, mandatory_transforms_start: Un...
stack_v2_sparse_classes_36k_train_022325
4,619
permissive
[ { "docstring": "AUTHORS: -------- :author: Alix Leroy DESCRIPTION: ------------ Initialize a SomeOf transformer inheriting a Transformer PARAMETERS: ----------- :param config->Namespace: The config RETURN: ------- :return: None", "name": "__init__", "signature": "def __init__(self, name: str, mandatory_...
2
null
Implement the Python class `SomeOf` described below. Class description: AUTHORS: -------- :author: Alix Leroy DESCRIPTION: ------------ SomeOf class inheriting from Transformer which compute a random number of transforms in the tranforms list. The random number is bounded by a min and max Method signatures and docstr...
Implement the Python class `SomeOf` described below. Class description: AUTHORS: -------- :author: Alix Leroy DESCRIPTION: ------------ SomeOf class inheriting from Transformer which compute a random number of transforms in the tranforms list. The random number is bounded by a min and max Method signatures and docstr...
3f9a1314ccfc1428d50de6a49a040aab4cb56dad
<|skeleton|> class SomeOf: """AUTHORS: -------- :author: Alix Leroy DESCRIPTION: ------------ SomeOf class inheriting from Transformer which compute a random number of transforms in the tranforms list. The random number is bounded by a min and max""" def __init__(self, name: str, mandatory_transforms_start: Un...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SomeOf: """AUTHORS: -------- :author: Alix Leroy DESCRIPTION: ------------ SomeOf class inheriting from Transformer which compute a random number of transforms in the tranforms list. The random number is bounded by a min and max""" def __init__(self, name: str, mandatory_transforms_start: Union[Namespace...
the_stack_v2_python_sparse
deeplodocus/data/transform/transformer/some_of.py
Deeplodocus/deeplodocus
train
2
d3179f6608465ee67ea41c6f5cd149eb8f50a1e3
[ "expected_content = deepcopy(EXPECTED_CONTENT)\nexpected_content['tenant_admin'] = True\ntenant = Tenant.objects.create(name='hellothere', owner='John', owner_contact='206.867.5309')\ntoken = create_and_login(tenant=tenant)\nuser = get_user_model().objects.all()[0]\nuser.tenant = None\nuser.save()\nresponse = self....
<|body_start_0|> expected_content = deepcopy(EXPECTED_CONTENT) expected_content['tenant_admin'] = True tenant = Tenant.objects.create(name='hellothere', owner='John', owner_contact='206.867.5309') token = create_and_login(tenant=tenant) user = get_user_model().objects.all()[0] ...
The tenant_admin user gets and changes her Cloud credentials.
GetPutTenantAdmin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetPutTenantAdmin: """The tenant_admin user gets and changes her Cloud credentials.""" def test_no_tenant(self): """Get or change Cloud data when there's no Goldstone tenant.""" <|body_0|> def test_no_cloud(self): """Get or change Cloud data when there's no Cloud...
stack_v2_sparse_classes_36k_train_022326
19,841
permissive
[ { "docstring": "Get or change Cloud data when there's no Goldstone tenant.", "name": "test_no_tenant", "signature": "def test_no_tenant(self)" }, { "docstring": "Get or change Cloud data when there's no Cloud.", "name": "test_no_cloud", "signature": "def test_no_cloud(self)" }, { ...
5
stack_v2_sparse_classes_30k_train_013020
Implement the Python class `GetPutTenantAdmin` described below. Class description: The tenant_admin user gets and changes her Cloud credentials. Method signatures and docstrings: - def test_no_tenant(self): Get or change Cloud data when there's no Goldstone tenant. - def test_no_cloud(self): Get or change Cloud data ...
Implement the Python class `GetPutTenantAdmin` described below. Class description: The tenant_admin user gets and changes her Cloud credentials. Method signatures and docstrings: - def test_no_tenant(self): Get or change Cloud data when there's no Goldstone tenant. - def test_no_cloud(self): Get or change Cloud data ...
d7f1f1f1ff926148d2aa541d0bd4758173aa76d5
<|skeleton|> class GetPutTenantAdmin: """The tenant_admin user gets and changes her Cloud credentials.""" def test_no_tenant(self): """Get or change Cloud data when there's no Goldstone tenant.""" <|body_0|> def test_no_cloud(self): """Get or change Cloud data when there's no Cloud...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GetPutTenantAdmin: """The tenant_admin user gets and changes her Cloud credentials.""" def test_no_tenant(self): """Get or change Cloud data when there's no Goldstone tenant.""" expected_content = deepcopy(EXPECTED_CONTENT) expected_content['tenant_admin'] = True tenant = ...
the_stack_v2_python_sparse
goldstone/user/tests.py
leftees/goldstone-server
train
0
facdb420c23328a04f8491fe372dbf0df8e46ced
[ "if title is None:\n logger.error(\"'title' 不能为空!\")\nfor s in range(second):\n try:\n self.assertIn(title, self.get_title())\n break\n except AssertionError:\n sleep(1)\nelse:\n self.assertIn(title, self.get_title())", "if url == None:\n logger.error(\"'URL' 不能为空!\")\nfor s in...
<|body_start_0|> if title is None: logger.error("'title' 不能为空!") for s in range(second): try: self.assertIn(title, self.get_title()) break except AssertionError: sleep(1) else: self.assertIn(title, se...
TestCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCase: def assertTitle(self, title, second=3): """断言当前页面标题是否符合预期。 Usage: self.assertTitle("title")""" <|body_0|> def assertUrl(self, url, second=3): """断言当前页面URL是否符合预期。 Usage: self.assertUrl("url")""" <|body_1|> def assertText(self, actual_el, expect_...
stack_v2_sparse_classes_36k_train_022327
2,110
no_license
[ { "docstring": "断言当前页面标题是否符合预期。 Usage: self.assertTitle(\"title\")", "name": "assertTitle", "signature": "def assertTitle(self, title, second=3)" }, { "docstring": "断言当前页面URL是否符合预期。 Usage: self.assertUrl(\"url\")", "name": "assertUrl", "signature": "def assertUrl(self, url, second=3)" ...
4
stack_v2_sparse_classes_30k_train_000815
Implement the Python class `TestCase` described below. Class description: Implement the TestCase class. Method signatures and docstrings: - def assertTitle(self, title, second=3): 断言当前页面标题是否符合预期。 Usage: self.assertTitle("title") - def assertUrl(self, url, second=3): 断言当前页面URL是否符合预期。 Usage: self.assertUrl("url") - def...
Implement the Python class `TestCase` described below. Class description: Implement the TestCase class. Method signatures and docstrings: - def assertTitle(self, title, second=3): 断言当前页面标题是否符合预期。 Usage: self.assertTitle("title") - def assertUrl(self, url, second=3): 断言当前页面URL是否符合预期。 Usage: self.assertUrl("url") - def...
094e55d1efeb96911e9caca1767f7ab1b3c4e985
<|skeleton|> class TestCase: def assertTitle(self, title, second=3): """断言当前页面标题是否符合预期。 Usage: self.assertTitle("title")""" <|body_0|> def assertUrl(self, url, second=3): """断言当前页面URL是否符合预期。 Usage: self.assertUrl("url")""" <|body_1|> def assertText(self, actual_el, expect_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestCase: def assertTitle(self, title, second=3): """断言当前页面标题是否符合预期。 Usage: self.assertTitle("title")""" if title is None: logger.error("'title' 不能为空!") for s in range(second): try: self.assertIn(title, self.get_title()) break ...
the_stack_v2_python_sparse
selenium_lib/selenium_case.py
SCF123/Web_Auto_Test2.0
train
1
8fa3a6eb8cf8725b6be447d74ad2f1d6c6b77081
[ "name = f'{name} USB' if channel_usb else name\nif unique_id is not None and channel_usb:\n unique_id = f'{unique_id}-usb'\nsuper().__init__(name, plug, entry, unique_id)\nself._channel_usb = channel_usb\nif self._model == MODEL_PLUG_V3:\n self._device_features = FEATURE_FLAGS_PLUG_V3\n self._state_attrs[A...
<|body_start_0|> name = f'{name} USB' if channel_usb else name if unique_id is not None and channel_usb: unique_id = f'{unique_id}-usb' super().__init__(name, plug, entry, unique_id) self._channel_usb = channel_usb if self._model == MODEL_PLUG_V3: self._de...
Representation of a Chuang Mi Plug V1 and V3.
ChuangMiPlugSwitch
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChuangMiPlugSwitch: """Representation of a Chuang Mi Plug V1 and V3.""" def __init__(self, name, plug, entry, unique_id, channel_usb): """Initialize the plug switch.""" <|body_0|> async def async_turn_on(self, **kwargs: Any) -> None: """Turn a channel on.""" ...
stack_v2_sparse_classes_36k_train_022328
36,734
permissive
[ { "docstring": "Initialize the plug switch.", "name": "__init__", "signature": "def __init__(self, name, plug, entry, unique_id, channel_usb)" }, { "docstring": "Turn a channel on.", "name": "async_turn_on", "signature": "async def async_turn_on(self, **kwargs: Any) -> None" }, { ...
4
null
Implement the Python class `ChuangMiPlugSwitch` described below. Class description: Representation of a Chuang Mi Plug V1 and V3. Method signatures and docstrings: - def __init__(self, name, plug, entry, unique_id, channel_usb): Initialize the plug switch. - async def async_turn_on(self, **kwargs: Any) -> None: Turn ...
Implement the Python class `ChuangMiPlugSwitch` described below. Class description: Representation of a Chuang Mi Plug V1 and V3. Method signatures and docstrings: - def __init__(self, name, plug, entry, unique_id, channel_usb): Initialize the plug switch. - async def async_turn_on(self, **kwargs: Any) -> None: Turn ...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class ChuangMiPlugSwitch: """Representation of a Chuang Mi Plug V1 and V3.""" def __init__(self, name, plug, entry, unique_id, channel_usb): """Initialize the plug switch.""" <|body_0|> async def async_turn_on(self, **kwargs: Any) -> None: """Turn a channel on.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ChuangMiPlugSwitch: """Representation of a Chuang Mi Plug V1 and V3.""" def __init__(self, name, plug, entry, unique_id, channel_usb): """Initialize the plug switch.""" name = f'{name} USB' if channel_usb else name if unique_id is not None and channel_usb: unique_id = ...
the_stack_v2_python_sparse
homeassistant/components/xiaomi_miio/switch.py
home-assistant/core
train
35,501
c4398aca34a2c33ce5692b086914fdc1b32f6a8e
[ "super(BilinearSTNRegistrator, self).__init__()\nif atlas.type is np.ndarray:\n self.atlas = torch.from_numpy(atlas)\nelse:\n self.atlas = atlas\nself.atlas = self.atlas.to(device)\nself.atlas = Variable(self.atlas, requires_grad=True)\nself.localization_net = Type1Module()\nif device is None:\n device = t...
<|body_start_0|> super(BilinearSTNRegistrator, self).__init__() if atlas.type is np.ndarray: self.atlas = torch.from_numpy(atlas) else: self.atlas = atlas self.atlas = self.atlas.to(device) self.atlas = Variable(self.atlas, requires_grad=True) self...
3D spatial transformer implementation using pytorch. the STN has 3 main parts: 1. The localization network (who is giving by to user at init level) 2. creating are transformation function. This could be affine, b-slin
BilinearSTNRegistrator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BilinearSTNRegistrator: """3D spatial transformer implementation using pytorch. the STN has 3 main parts: 1. The localization network (who is giving by to user at init level) 2. creating are transformation function. This could be affine, b-slin""" def __init__(self, atlas, device=None): ...
stack_v2_sparse_classes_36k_train_022329
8,571
no_license
[ { "docstring": "Args: atlas: numpy array of size using_cuda(bool)", "name": "__init__", "signature": "def __init__(self, atlas, device=None)" }, { "docstring": "forward pass of the Bilinear STN registation using the atlas given in the constructor Args: x: Returns:", "name": "forward", "s...
2
stack_v2_sparse_classes_30k_train_007342
Implement the Python class `BilinearSTNRegistrator` described below. Class description: 3D spatial transformer implementation using pytorch. the STN has 3 main parts: 1. The localization network (who is giving by to user at init level) 2. creating are transformation function. This could be affine, b-slin Method signa...
Implement the Python class `BilinearSTNRegistrator` described below. Class description: 3D spatial transformer implementation using pytorch. the STN has 3 main parts: 1. The localization network (who is giving by to user at init level) 2. creating are transformation function. This could be affine, b-slin Method signa...
f525743a9728b6ac17fa651c4eef8dec265d778d
<|skeleton|> class BilinearSTNRegistrator: """3D spatial transformer implementation using pytorch. the STN has 3 main parts: 1. The localization network (who is giving by to user at init level) 2. creating are transformation function. This could be affine, b-slin""" def __init__(self, atlas, device=None): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BilinearSTNRegistrator: """3D spatial transformer implementation using pytorch. the STN has 3 main parts: 1. The localization network (who is giving by to user at init level) 2. creating are transformation function. This could be affine, b-slin""" def __init__(self, atlas, device=None): """Args: ...
the_stack_v2_python_sparse
network.py
ADubinA/pytorch-morph
train
0
a1536957cbf57af9f9ffc12f1fbdfb42c4bc4414
[ "self.session = session\nself.starting_op_names = starting_op_names\nself.layer_output = LayerOutput(session=session, starting_op_names=starting_op_names, output_op_names=output_op_names, dir_path=dir_path)\naxis_layout = 'NHWC' if tf.keras.backend.image_data_format() == 'channels_last' else 'NCHW'\nself.save_input...
<|body_start_0|> self.session = session self.starting_op_names = starting_op_names self.layer_output = LayerOutput(session=session, starting_op_names=starting_op_names, output_op_names=output_op_names, dir_path=dir_path) axis_layout = 'NHWC' if tf.keras.backend.image_data_format() == 'ch...
Implementation to capture and save outputs of intermediate layers of a model (fp32/quantsim)
LayerOutputUtil
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LayerOutputUtil: """Implementation to capture and save outputs of intermediate layers of a model (fp32/quantsim)""" def __init__(self, session: tf.compat.v1.Session, starting_op_names: List[str], output_op_names: List[str], dir_path: str): """Constructor for LayerOutputUtil. :param s...
stack_v2_sparse_classes_36k_train_022330
8,075
permissive
[ { "docstring": "Constructor for LayerOutputUtil. :param session: Session containing the model whose layer-outputs are needed. :param starting_op_names: List of starting op names of the model. :param output_op_names: List of output op names of the model. :param dir_path: Directory wherein layer-outputs will be s...
2
stack_v2_sparse_classes_30k_train_014819
Implement the Python class `LayerOutputUtil` described below. Class description: Implementation to capture and save outputs of intermediate layers of a model (fp32/quantsim) Method signatures and docstrings: - def __init__(self, session: tf.compat.v1.Session, starting_op_names: List[str], output_op_names: List[str], ...
Implement the Python class `LayerOutputUtil` described below. Class description: Implementation to capture and save outputs of intermediate layers of a model (fp32/quantsim) Method signatures and docstrings: - def __init__(self, session: tf.compat.v1.Session, starting_op_names: List[str], output_op_names: List[str], ...
5a406e657082b6a4f6e4bf48f0e46e085cb1e351
<|skeleton|> class LayerOutputUtil: """Implementation to capture and save outputs of intermediate layers of a model (fp32/quantsim)""" def __init__(self, session: tf.compat.v1.Session, starting_op_names: List[str], output_op_names: List[str], dir_path: str): """Constructor for LayerOutputUtil. :param s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LayerOutputUtil: """Implementation to capture and save outputs of intermediate layers of a model (fp32/quantsim)""" def __init__(self, session: tf.compat.v1.Session, starting_op_names: List[str], output_op_names: List[str], dir_path: str): """Constructor for LayerOutputUtil. :param session: Sessi...
the_stack_v2_python_sparse
TrainingExtensions/tensorflow/src/python/aimet_tensorflow/layer_output_utils.py
quic/aimet
train
1,676
c585f74d225e48c19accf2cc063c4b247d19c92a
[ "extern_pars = np.copy(pars)\nextern_pars[6:8] = np.exp(extern_pars[6:8])\nreturn extern_pars", "intern_pars = np.copy(pars)\nintern_pars[6:8] = np.log(intern_pars[6:8])\nreturn intern_pars", "if covmatrix is None:\n dx = self._pars[6]\n dv = self._pars[7]\n self._covmatrix = np.identity(6)\n self._...
<|body_start_0|> extern_pars = np.copy(pars) extern_pars[6:8] = np.exp(extern_pars[6:8]) return extern_pars <|end_body_0|> <|body_start_1|> intern_pars = np.copy(pars) intern_pars[6:8] = np.log(intern_pars[6:8]) return intern_pars <|end_body_1|> <|body_start_2|> ...
SphereComponent
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SphereComponent: def externalise(pars): """Take parameter set in internal form (as used by emcee) and convert to external form (as used to build attributes).""" <|body_0|> def internalise(pars): """Take parameter set in external form (as used to build attributes) and...
stack_v2_sparse_classes_36k_train_022331
24,480
permissive
[ { "docstring": "Take parameter set in internal form (as used by emcee) and convert to external form (as used to build attributes).", "name": "externalise", "signature": "def externalise(pars)" }, { "docstring": "Take parameter set in external form (as used to build attributes) and convert to int...
3
null
Implement the Python class `SphereComponent` described below. Class description: Implement the SphereComponent class. Method signatures and docstrings: - def externalise(pars): Take parameter set in internal form (as used by emcee) and convert to external form (as used to build attributes). - def internalise(pars): T...
Implement the Python class `SphereComponent` described below. Class description: Implement the SphereComponent class. Method signatures and docstrings: - def externalise(pars): Take parameter set in internal form (as used by emcee) and convert to external form (as used to build attributes). - def internalise(pars): T...
d38aa19edd0229bb0a8b7126f248e61b9a0a8ff3
<|skeleton|> class SphereComponent: def externalise(pars): """Take parameter set in internal form (as used by emcee) and convert to external form (as used to build attributes).""" <|body_0|> def internalise(pars): """Take parameter set in external form (as used to build attributes) and...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SphereComponent: def externalise(pars): """Take parameter set in internal form (as used by emcee) and convert to external form (as used to build attributes).""" extern_pars = np.copy(pars) extern_pars[6:8] = np.exp(extern_pars[6:8]) return extern_pars def internalise(pars)...
the_stack_v2_python_sparse
chronostar/component.py
tcrundall/chronostar
train
0
b0f13d3b13be7bc768d3b8ce635c4c8a5a187102
[ "assert isinstance(base, (str, pathlib.Path))\nassert isinstance(unique, bool)\nself._base_path = pathlib.Path(base) if isinstance(base, str) else base\nself._unique = unique", "count_str: str = '' if count == 0 else f' ({count})'\next_str: str = '' if ext is None else f'.{ext}'\nfile_name: pathlib.Path = self._b...
<|body_start_0|> assert isinstance(base, (str, pathlib.Path)) assert isinstance(unique, bool) self._base_path = pathlib.Path(base) if isinstance(base, str) else base self._unique = unique <|end_body_0|> <|body_start_1|> count_str: str = '' if count == 0 else f' ({count})' ...
A file name generator that generates file names in a base path.
BaseFileNameGenerator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseFileNameGenerator: """A file name generator that generates file names in a base path.""" def __init__(self, base: typing.Union[str, pathlib.Path]='', *, unique: bool=False): """Create a new base file name generator. :param base: The base path, current working directory by default...
stack_v2_sparse_classes_36k_train_022332
5,061
permissive
[ { "docstring": "Create a new base file name generator. :param base: The base path, current working directory by default :param unique: Force unique file names", "name": "__init__", "signature": "def __init__(self, base: typing.Union[str, pathlib.Path]='', *, unique: bool=False)" }, { "docstring"...
3
null
Implement the Python class `BaseFileNameGenerator` described below. Class description: A file name generator that generates file names in a base path. Method signatures and docstrings: - def __init__(self, base: typing.Union[str, pathlib.Path]='', *, unique: bool=False): Create a new base file name generator. :param ...
Implement the Python class `BaseFileNameGenerator` described below. Class description: A file name generator that generates file names in a base path. Method signatures and docstrings: - def __init__(self, base: typing.Union[str, pathlib.Path]='', *, unique: bool=False): Create a new base file name generator. :param ...
bb4e18743dcab017765d09b6ce1c3bba88be073e
<|skeleton|> class BaseFileNameGenerator: """A file name generator that generates file names in a base path.""" def __init__(self, base: typing.Union[str, pathlib.Path]='', *, unique: bool=False): """Create a new base file name generator. :param base: The base path, current working directory by default...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseFileNameGenerator: """A file name generator that generates file names in a base path.""" def __init__(self, base: typing.Union[str, pathlib.Path]='', *, unique: bool=False): """Create a new base file name generator. :param base: The base path, current working directory by default :param uniqu...
the_stack_v2_python_sparse
dax/util/output.py
Ginobilium/dax
train
0
aa39872b8b1c632053ad61be7798412b55ffe347
[ "super().__init__()\nself.linear1 = torch.nn.Linear(D_in, H)\nself.linear2 = torch.nn.Linear(H, D_out)", "h_relu = self.linear1(x).clamp(min=0)\ny = self.linear2(h_relu)\nreturn y" ]
<|body_start_0|> super().__init__() self.linear1 = torch.nn.Linear(D_in, H) self.linear2 = torch.nn.Linear(H, D_out) <|end_body_0|> <|body_start_1|> h_relu = self.linear1(x).clamp(min=0) y = self.linear2(h_relu) return y <|end_body_1|>
Simple two-layer neural network for demonstration purposes.
TwoLayerNet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TwoLayerNet: """Simple two-layer neural network for demonstration purposes.""" def __init__(self, D_in, H, D_out): """Instantiate two nn.Linear modules and assign them as member variables.""" <|body_0|> def forward(self, x): """In the forward function we accept a...
stack_v2_sparse_classes_36k_train_022333
6,053
permissive
[ { "docstring": "Instantiate two nn.Linear modules and assign them as member variables.", "name": "__init__", "signature": "def __init__(self, D_in, H, D_out)" }, { "docstring": "In the forward function we accept a Tensor of input data and we must return a Tensor of output data. We can use Module...
2
stack_v2_sparse_classes_30k_train_012213
Implement the Python class `TwoLayerNet` described below. Class description: Simple two-layer neural network for demonstration purposes. Method signatures and docstrings: - def __init__(self, D_in, H, D_out): Instantiate two nn.Linear modules and assign them as member variables. - def forward(self, x): In the forward...
Implement the Python class `TwoLayerNet` described below. Class description: Simple two-layer neural network for demonstration purposes. Method signatures and docstrings: - def __init__(self, D_in, H, D_out): Instantiate two nn.Linear modules and assign them as member variables. - def forward(self, x): In the forward...
9cdbf270487751a0ad6862b2fea2ccc0e23a0b67
<|skeleton|> class TwoLayerNet: """Simple two-layer neural network for demonstration purposes.""" def __init__(self, D_in, H, D_out): """Instantiate two nn.Linear modules and assign them as member variables.""" <|body_0|> def forward(self, x): """In the forward function we accept a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TwoLayerNet: """Simple two-layer neural network for demonstration purposes.""" def __init__(self, D_in, H, D_out): """Instantiate two nn.Linear modules and assign them as member variables.""" super().__init__() self.linear1 = torch.nn.Linear(D_in, H) self.linear2 = torch.n...
the_stack_v2_python_sparse
caspr/utils/early_stopping.py
microsoft/CASPR
train
29
ab3ba94f850e43fa5d518f31ea214c71498dab4b
[ "observed_log_messages = []\n\ndef _mock_logging_function(msg: str, *args: str) -> None:\n \"\"\"Mocks logging.info().\"\"\"\n observed_log_messages.append(msg % args)\nmsg_body = '\\n EmailService.SendMail\\n From: %s\\n To: %s\\n Subject: %s\\n Body:\\n...
<|body_start_0|> observed_log_messages = [] def _mock_logging_function(msg: str, *args: str) -> None: """Mocks logging.info().""" observed_log_messages.append(msg % args) msg_body = '\n EmailService.SendMail\n From: %s\n To: %s\n ...
Tests for sending emails.
EmailTests
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmailTests: """Tests for sending emails.""" def test_send_mail_logs_to_terminal(self) -> None: """In DEV Mode, platforms email_service API that sends a singular email logs the correct email info to terminal.""" <|body_0|> def test_send_mail_to_multiple_recipients_logs_to...
stack_v2_sparse_classes_36k_train_022334
5,234
permissive
[ { "docstring": "In DEV Mode, platforms email_service API that sends a singular email logs the correct email info to terminal.", "name": "test_send_mail_logs_to_terminal", "signature": "def test_send_mail_logs_to_terminal(self) -> None" }, { "docstring": "In DEV Mode, platform email_services that...
2
null
Implement the Python class `EmailTests` described below. Class description: Tests for sending emails. Method signatures and docstrings: - def test_send_mail_logs_to_terminal(self) -> None: In DEV Mode, platforms email_service API that sends a singular email logs the correct email info to terminal. - def test_send_mai...
Implement the Python class `EmailTests` described below. Class description: Tests for sending emails. Method signatures and docstrings: - def test_send_mail_logs_to_terminal(self) -> None: In DEV Mode, platforms email_service API that sends a singular email logs the correct email info to terminal. - def test_send_mai...
d16fdf23d790eafd63812bd7239532256e30a21d
<|skeleton|> class EmailTests: """Tests for sending emails.""" def test_send_mail_logs_to_terminal(self) -> None: """In DEV Mode, platforms email_service API that sends a singular email logs the correct email info to terminal.""" <|body_0|> def test_send_mail_to_multiple_recipients_logs_to...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EmailTests: """Tests for sending emails.""" def test_send_mail_logs_to_terminal(self) -> None: """In DEV Mode, platforms email_service API that sends a singular email logs the correct email info to terminal.""" observed_log_messages = [] def _mock_logging_function(msg: str, *args...
the_stack_v2_python_sparse
core/platform/email/dev_mode_email_services_test.py
oppia/oppia
train
6,172
b38616a7947205da2eba9d5bba426e6c593c99b5
[ "self.pool_size = pool_size\nif self.pool_size > 0:\n self.num_imgs = 0\n self.images = []", "if self.pool_size == 0:\n return images\nreturn_images = []\nfor image in images:\n image = torch.unsqueeze(image.data, 0)\n if self.num_imgs < self.pool_size:\n self.num_imgs = self.num_imgs + 1\n ...
<|body_start_0|> self.pool_size = pool_size if self.pool_size > 0: self.num_imgs = 0 self.images = [] <|end_body_0|> <|body_start_1|> if self.pool_size == 0: return images return_images = [] for image in images: image = torch.unsqu...
This class implements an image buffer that stores previously generated images. This buffer enables us to update discriminators using a history of generated images rather than the ones produced by the latest generators.
ImagePool
[ "BSD-3-Clause", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImagePool: """This class implements an image buffer that stores previously generated images. This buffer enables us to update discriminators using a history of generated images rather than the ones produced by the latest generators.""" def __init__(self, pool_size): """Initialize the...
stack_v2_sparse_classes_36k_train_022335
2,226
permissive
[ { "docstring": "Initialize the ImagePool class Parameters: pool_size (int) -- the size of image buffer, if pool_size=0, no buffer will be created", "name": "__init__", "signature": "def __init__(self, pool_size)" }, { "docstring": "Return an image from the pool. Parameters: images: the latest ge...
2
stack_v2_sparse_classes_30k_train_016286
Implement the Python class `ImagePool` described below. Class description: This class implements an image buffer that stores previously generated images. This buffer enables us to update discriminators using a history of generated images rather than the ones produced by the latest generators. Method signatures and do...
Implement the Python class `ImagePool` described below. Class description: This class implements an image buffer that stores previously generated images. This buffer enables us to update discriminators using a history of generated images rather than the ones produced by the latest generators. Method signatures and do...
df4da9bdff11a2f948d5bd4ac83da7922e6f44f4
<|skeleton|> class ImagePool: """This class implements an image buffer that stores previously generated images. This buffer enables us to update discriminators using a history of generated images rather than the ones produced by the latest generators.""" def __init__(self, pool_size): """Initialize the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImagePool: """This class implements an image buffer that stores previously generated images. This buffer enables us to update discriminators using a history of generated images rather than the ones produced by the latest generators.""" def __init__(self, pool_size): """Initialize the ImagePool cl...
the_stack_v2_python_sparse
torchbenchmark/models/pytorch_CycleGAN_and_pix2pix/util/image_pool.py
pytorch/benchmark
train
685
f625d6c030d5a869185690ffe2c90265d7e5245c
[ "if g is None:\n g = self.inst\nfor k, v in g.__dict__.iteritems():\n setattr(self, k, v)", "for k, v in self.inst.__dict__.iteritems():\n setattr(self.inst, k, getattr(self, k))\nreturn self.inst" ]
<|body_start_0|> if g is None: g = self.inst for k, v in g.__dict__.iteritems(): setattr(self, k, v) <|end_body_0|> <|body_start_1|> for k, v in self.inst.__dict__.iteritems(): setattr(self.inst, k, getattr(self, k)) return self.inst <|end_body_1|>
GenomeProperties
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GenomeProperties: def genome2screen(self, g=None): """Copy from genome g into self's namespace""" <|body_0|> def screen2genome(self, unused=None): """Copy from our namespace into the default global instance""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_022336
2,002
permissive
[ { "docstring": "Copy from genome g into self's namespace", "name": "genome2screen", "signature": "def genome2screen(self, g=None)" }, { "docstring": "Copy from our namespace into the default global instance", "name": "screen2genome", "signature": "def screen2genome(self, unused=None)" ...
2
stack_v2_sparse_classes_30k_train_000564
Implement the Python class `GenomeProperties` described below. Class description: Implement the GenomeProperties class. Method signatures and docstrings: - def genome2screen(self, g=None): Copy from genome g into self's namespace - def screen2genome(self, unused=None): Copy from our namespace into the default global ...
Implement the Python class `GenomeProperties` described below. Class description: Implement the GenomeProperties class. Method signatures and docstrings: - def genome2screen(self, g=None): Copy from genome g into self's namespace - def screen2genome(self, unused=None): Copy from our namespace into the default global ...
bbd32864cabce9ba5cb1051fa9d78d69c8feb5e5
<|skeleton|> class GenomeProperties: def genome2screen(self, g=None): """Copy from genome g into self's namespace""" <|body_0|> def screen2genome(self, unused=None): """Copy from our namespace into the default global instance""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GenomeProperties: def genome2screen(self, g=None): """Copy from genome g into self's namespace""" if g is None: g = self.inst for k, v in g.__dict__.iteritems(): setattr(self, k, v) def screen2genome(self, unused=None): """Copy from our namespace in...
the_stack_v2_python_sparse
pentai/gui/ai_player_screen.py
cropleyb/pentai
train
8
7a1c2d00e73057d60740c19fc1080f4be813a745
[ "self.config_entry = config_entry\nself.options = dict(config_entry.options)\nself.departure_filters: dict[str, Any] = {}", "errors = {}\nif not self.departure_filters:\n departure_list = {}\n hub: GTIHub = self.hass.data[DOMAIN][self.config_entry.entry_id]\n try:\n departure_list = await hub.gti....
<|body_start_0|> self.config_entry = config_entry self.options = dict(config_entry.options) self.departure_filters: dict[str, Any] = {} <|end_body_0|> <|body_start_1|> errors = {} if not self.departure_filters: departure_list = {} hub: GTIHub = self.hass....
Options flow handler.
OptionsFlowHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OptionsFlowHandler: """Options flow handler.""" def __init__(self, config_entry: config_entries.ConfigEntry) -> None: """Initialize HVV Departures options flow.""" <|body_0|> async def async_step_init(self, user_input=None): """Manage the options.""" <|bo...
stack_v2_sparse_classes_36k_train_022337
7,220
permissive
[ { "docstring": "Initialize HVV Departures options flow.", "name": "__init__", "signature": "def __init__(self, config_entry: config_entries.ConfigEntry) -> None" }, { "docstring": "Manage the options.", "name": "async_step_init", "signature": "async def async_step_init(self, user_input=N...
2
null
Implement the Python class `OptionsFlowHandler` described below. Class description: Options flow handler. Method signatures and docstrings: - def __init__(self, config_entry: config_entries.ConfigEntry) -> None: Initialize HVV Departures options flow. - async def async_step_init(self, user_input=None): Manage the opt...
Implement the Python class `OptionsFlowHandler` described below. Class description: Options flow handler. Method signatures and docstrings: - def __init__(self, config_entry: config_entries.ConfigEntry) -> None: Initialize HVV Departures options flow. - async def async_step_init(self, user_input=None): Manage the opt...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class OptionsFlowHandler: """Options flow handler.""" def __init__(self, config_entry: config_entries.ConfigEntry) -> None: """Initialize HVV Departures options flow.""" <|body_0|> async def async_step_init(self, user_input=None): """Manage the options.""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OptionsFlowHandler: """Options flow handler.""" def __init__(self, config_entry: config_entries.ConfigEntry) -> None: """Initialize HVV Departures options flow.""" self.config_entry = config_entry self.options = dict(config_entry.options) self.departure_filters: dict[str, ...
the_stack_v2_python_sparse
homeassistant/components/hvv_departures/config_flow.py
home-assistant/core
train
35,501
01adba14499d24e53c38eef3f27e9fe5ad9ac5f5
[ "self.k = k\nself.queue = nums\nheapq.heapify(self.queue)", "heapq.heappush(self.queue, val)\nwhile len(self.queue) > self.k:\n heapq.heappop(self.queue)\nreturn self.queue[0]" ]
<|body_start_0|> self.k = k self.queue = nums heapq.heapify(self.queue) <|end_body_0|> <|body_start_1|> heapq.heappush(self.queue, val) while len(self.queue) > self.k: heapq.heappop(self.queue) return self.queue[0] <|end_body_1|>
KthLargest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.k = k self.queue = nums heapq.heapify...
stack_v2_sparse_classes_36k_train_022338
648
no_license
[ { "docstring": ":type k: int :type nums: List[int]", "name": "__init__", "signature": "def __init__(self, k, nums)" }, { "docstring": ":type val: int :rtype: int", "name": "add", "signature": "def add(self, val)" } ]
2
stack_v2_sparse_classes_30k_train_008015
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int <|skeleton|> class KthLargest: def __init__(self, k, nu...
82ece6ed353235dcd36face80f5d87df12d56a2c
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" self.k = k self.queue = nums heapq.heapify(self.queue) def add(self, val): """:type val: int :rtype: int""" heapq.heappush(self.queue, val) while len(self.queue) > sel...
the_stack_v2_python_sparse
排序/703. 数据流中的第 K 大元素.py
pulinghao/LeetCode_Python
train
2
2341d025b8c354ff101edee1828e1c4e6c1972e4
[ "super().__init__()\nself.strategy: Strategy = Strategy()\nif data.get('strategy'):\n self.strategy = Strategy(data.get('strategy', {}))\nself.accuracy_criterion: AccCriterion = AccCriterion(data.get('accuracy_criterion', {}))\nself.objective: Optional[str] = data.get('objective', None)\nself.exit_policy: Option...
<|body_start_0|> super().__init__() self.strategy: Strategy = Strategy() if data.get('strategy'): self.strategy = Strategy(data.get('strategy', {})) self.accuracy_criterion: AccCriterion = AccCriterion(data.get('accuracy_criterion', {})) self.objective: Optional[str] ...
Configuration Tuning class.
Tuning
[ "MIT", "Intel", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Tuning: """Configuration Tuning class.""" def __init__(self, data: Dict[str, Any]={}) -> None: """Initialize Configuration Tuning class.""" <|body_0|> def set_timeout(self, timeout: int) -> None: """Update tuning timeout in config.""" <|body_1|> def ...
stack_v2_sparse_classes_36k_train_022339
5,856
permissive
[ { "docstring": "Initialize Configuration Tuning class.", "name": "__init__", "signature": "def __init__(self, data: Dict[str, Any]={}) -> None" }, { "docstring": "Update tuning timeout in config.", "name": "set_timeout", "signature": "def set_timeout(self, timeout: int) -> None" }, {...
5
stack_v2_sparse_classes_30k_train_016600
Implement the Python class `Tuning` described below. Class description: Configuration Tuning class. Method signatures and docstrings: - def __init__(self, data: Dict[str, Any]={}) -> None: Initialize Configuration Tuning class. - def set_timeout(self, timeout: int) -> None: Update tuning timeout in config. - def set_...
Implement the Python class `Tuning` described below. Class description: Configuration Tuning class. Method signatures and docstrings: - def __init__(self, data: Dict[str, Any]={}) -> None: Initialize Configuration Tuning class. - def set_timeout(self, timeout: int) -> None: Update tuning timeout in config. - def set_...
3976edc4215398e69ce0213f87ec295f5dc96e0e
<|skeleton|> class Tuning: """Configuration Tuning class.""" def __init__(self, data: Dict[str, Any]={}) -> None: """Initialize Configuration Tuning class.""" <|body_0|> def set_timeout(self, timeout: int) -> None: """Update tuning timeout in config.""" <|body_1|> def ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Tuning: """Configuration Tuning class.""" def __init__(self, data: Dict[str, Any]={}) -> None: """Initialize Configuration Tuning class.""" super().__init__() self.strategy: Strategy = Strategy() if data.get('strategy'): self.strategy = Strategy(data.get('strat...
the_stack_v2_python_sparse
neural_compressor/ux/utils/workload/tuning.py
Skp80/neural-compressor
train
0
a3e8c17507840336812204f68276dbf8d6dbf2c0
[ "intervals.append(new_interval)\nintervals = sorted(intervals, cmp_interval)\nreturn self.merge(intervals)", "if len(intervals) <= 1:\n return intervals\ni = 0\nmerge_intervals = []\nwhile i < len(intervals) - 1:\n interval = intervals[i]\n interval_next = intervals[i + 1]\n start = interval.start\n ...
<|body_start_0|> intervals.append(new_interval) intervals = sorted(intervals, cmp_interval) return self.merge(intervals) <|end_body_0|> <|body_start_1|> if len(intervals) <= 1: return intervals i = 0 merge_intervals = [] while i < len(intervals) - 1: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def insert(self, intervals, new_interval): """:param intervals: List[Interval] :param new_interval: Interval :return: List[Interval]""" <|body_0|> def merge(self, intervals): """:param intervals: List[Interval] :return: List[Interval]""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_022340
1,647
no_license
[ { "docstring": ":param intervals: List[Interval] :param new_interval: Interval :return: List[Interval]", "name": "insert", "signature": "def insert(self, intervals, new_interval)" }, { "docstring": ":param intervals: List[Interval] :return: List[Interval]", "name": "merge", "signature": ...
2
stack_v2_sparse_classes_30k_train_017472
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def insert(self, intervals, new_interval): :param intervals: List[Interval] :param new_interval: Interval :return: List[Interval] - def merge(self, intervals): :param intervals: ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def insert(self, intervals, new_interval): :param intervals: List[Interval] :param new_interval: Interval :return: List[Interval] - def merge(self, intervals): :param intervals: ...
c1c5ee72b8fe608b278ca20a58bc240fdc62b599
<|skeleton|> class Solution: def insert(self, intervals, new_interval): """:param intervals: List[Interval] :param new_interval: Interval :return: List[Interval]""" <|body_0|> def merge(self, intervals): """:param intervals: List[Interval] :return: List[Interval]""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def insert(self, intervals, new_interval): """:param intervals: List[Interval] :param new_interval: Interval :return: List[Interval]""" intervals.append(new_interval) intervals = sorted(intervals, cmp_interval) return self.merge(intervals) def merge(self, interva...
the_stack_v2_python_sparse
57_insert_interval.py
eazow/leetcode
train
5
2c55903dcf9775fb4b368fd1343c3d863807b35e
[ "SegmentSimMeasurement.__init__(self, source_segment, target_segment)\nself.sequence_type = sequence_type\nself.ne_disambiguation = ne_disambiguation", "max_lcnes = 64\nmin_lcnes = 0\nlcnes_normalised = (lcnes - min_lcnes) / (max_lcnes - min_lcnes)\nreturn lcnes_normalised", "mode = 'manual' if self.sequence_ty...
<|body_start_0|> SegmentSimMeasurement.__init__(self, source_segment, target_segment) self.sequence_type = sequence_type self.ne_disambiguation = ne_disambiguation <|end_body_0|> <|body_start_1|> max_lcnes = 64 min_lcnes = 0 lcnes_normalised = (lcnes - min_lcnes) / (max_...
LongestCommonNESequence
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LongestCommonNESequence: def __init__(self, source_segment, target_segment, sequence_type='default', ne_disambiguation=False): """:param source_segment: Segment from source article :param target_segment: Segment from target article :param sequence_type: Sequence manual of sequence defaul...
stack_v2_sparse_classes_36k_train_022341
2,585
permissive
[ { "docstring": ":param source_segment: Segment from source article :param target_segment: Segment from target article :param sequence_type: Sequence manual of sequence default :param ne_disambiguation: Flag, whether to disambiguate named entities", "name": "__init__", "signature": "def __init__(self, so...
3
stack_v2_sparse_classes_30k_train_009319
Implement the Python class `LongestCommonNESequence` described below. Class description: Implement the LongestCommonNESequence class. Method signatures and docstrings: - def __init__(self, source_segment, target_segment, sequence_type='default', ne_disambiguation=False): :param source_segment: Segment from source art...
Implement the Python class `LongestCommonNESequence` described below. Class description: Implement the LongestCommonNESequence class. Method signatures and docstrings: - def __init__(self, source_segment, target_segment, sequence_type='default', ne_disambiguation=False): :param source_segment: Segment from source art...
2e6a85dc9e95ef94bec2339987950f4e88f5d909
<|skeleton|> class LongestCommonNESequence: def __init__(self, source_segment, target_segment, sequence_type='default', ne_disambiguation=False): """:param source_segment: Segment from source article :param target_segment: Segment from target article :param sequence_type: Sequence manual of sequence defaul...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LongestCommonNESequence: def __init__(self, source_segment, target_segment, sequence_type='default', ne_disambiguation=False): """:param source_segment: Segment from source article :param target_segment: Segment from target article :param sequence_type: Sequence manual of sequence default :param ne_di...
the_stack_v2_python_sparse
newssimilarity/segment_sim/longest_common_ne_sequence.py
imackerracher/NewsSimilarity
train
0
339e96a0bf1f8d3ce57c6210d85c924ea04ebf38
[ "register_resource_for_model(ReviewChecklist, checklist_resource)\nregister_resource_for_model(ChecklistTemplate, checklist_template_resource)\nAccountPagesHook(self, [ChecklistAccountPage])", "super(Checklist, self).shutdown()\nunregister_resource_for_model(ReviewChecklist)\nunregister_resource_for_model(Checkli...
<|body_start_0|> register_resource_for_model(ReviewChecklist, checklist_resource) register_resource_for_model(ChecklistTemplate, checklist_template_resource) AccountPagesHook(self, [ChecklistAccountPage]) <|end_body_0|> <|body_start_1|> super(Checklist, self).shutdown() unregist...
The checklist extension.
Checklist
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Checklist: """The checklist extension.""" def initialize(self): """Initialize the extension.""" <|body_0|> def shutdown(self): """Shut down the extension.""" <|body_1|> <|end_skeleton|> <|body_start_0|> register_resource_for_model(ReviewChecklis...
stack_v2_sparse_classes_36k_train_022342
2,881
no_license
[ { "docstring": "Initialize the extension.", "name": "initialize", "signature": "def initialize(self)" }, { "docstring": "Shut down the extension.", "name": "shutdown", "signature": "def shutdown(self)" } ]
2
stack_v2_sparse_classes_30k_train_015838
Implement the Python class `Checklist` described below. Class description: The checklist extension. Method signatures and docstrings: - def initialize(self): Initialize the extension. - def shutdown(self): Shut down the extension.
Implement the Python class `Checklist` described below. Class description: The checklist extension. Method signatures and docstrings: - def initialize(self): Initialize the extension. - def shutdown(self): Shut down the extension. <|skeleton|> class Checklist: """The checklist extension.""" def initialize(s...
c192db4557a48b46d43821497ea92d79bbe15f6d
<|skeleton|> class Checklist: """The checklist extension.""" def initialize(self): """Initialize the extension.""" <|body_0|> def shutdown(self): """Shut down the extension.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Checklist: """The checklist extension.""" def initialize(self): """Initialize the extension.""" register_resource_for_model(ReviewChecklist, checklist_resource) register_resource_for_model(ChecklistTemplate, checklist_template_resource) AccountPagesHook(self, [ChecklistAcc...
the_stack_v2_python_sparse
rbchecklist/rbchecklist/extension.py
reviewboard/rb-extension-pack
train
19
0960020f36e83c50446ef6ea1006b6c5531c6f8d
[ "RefTester = ROOT.RefTester\na = std.vector(RefTester)()\na.push_back(RefTester(42))\nself.assertEqual(len(a), 1)\nself.assertEqual(a[0].m_i, 42)\na[0] = RefTester(33)\nself.assertEqual(len(a), 1)\nself.assertEqual(a[0].m_i, 33)", "RefTesterNoAssign = ROOT.RefTesterNoAssign\na = RefTesterNoAssign()\nself.assertEq...
<|body_start_0|> RefTester = ROOT.RefTester a = std.vector(RefTester)() a.push_back(RefTester(42)) self.assertEqual(len(a), 1) self.assertEqual(a[0].m_i, 42) a[0] = RefTester(33) self.assertEqual(len(a), 1) self.assertEqual(a[0].m_i, 33) <|end_body_0|> <|...
Cpp05AssignToRefArbitraryClass
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cpp05AssignToRefArbitraryClass: def test1AssignToReturnByRef(self): """Test assignment to an instance returned by reference""" <|body_0|> def test2NiceErrorMessageReturnByRef(self): """Want nice error message of failing assign by reference""" <|body_1|> <|en...
stack_v2_sparse_classes_36k_train_022343
30,462
no_license
[ { "docstring": "Test assignment to an instance returned by reference", "name": "test1AssignToReturnByRef", "signature": "def test1AssignToReturnByRef(self)" }, { "docstring": "Want nice error message of failing assign by reference", "name": "test2NiceErrorMessageReturnByRef", "signature"...
2
stack_v2_sparse_classes_30k_train_009127
Implement the Python class `Cpp05AssignToRefArbitraryClass` described below. Class description: Implement the Cpp05AssignToRefArbitraryClass class. Method signatures and docstrings: - def test1AssignToReturnByRef(self): Test assignment to an instance returned by reference - def test2NiceErrorMessageReturnByRef(self):...
Implement the Python class `Cpp05AssignToRefArbitraryClass` described below. Class description: Implement the Cpp05AssignToRefArbitraryClass class. Method signatures and docstrings: - def test1AssignToReturnByRef(self): Test assignment to an instance returned by reference - def test2NiceErrorMessageReturnByRef(self):...
134508460915282a5d82d6cbbb6e6afa14653413
<|skeleton|> class Cpp05AssignToRefArbitraryClass: def test1AssignToReturnByRef(self): """Test assignment to an instance returned by reference""" <|body_0|> def test2NiceErrorMessageReturnByRef(self): """Want nice error message of failing assign by reference""" <|body_1|> <|en...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Cpp05AssignToRefArbitraryClass: def test1AssignToReturnByRef(self): """Test assignment to an instance returned by reference""" RefTester = ROOT.RefTester a = std.vector(RefTester)() a.push_back(RefTester(42)) self.assertEqual(len(a), 1) self.assertEqual(a[0].m_i...
the_stack_v2_python_sparse
python/cpp/PyROOT_advancedtests.py
root-project/roottest
train
41
0a2743cd40ee82e31d47b82f1513ec1daf46a0d6
[ "super(RevisionDiff, self).__init__()\nself._r1 = r1\nself._r2 = r2\nself._repo = repo", "r1 = self._r1.get_git_commit()\nr2 = self._r2.get_git_commit()\nreturn self._repo.diff(r1, r2)" ]
<|body_start_0|> super(RevisionDiff, self).__init__() self._r1 = r1 self._r2 = r2 self._repo = repo <|end_body_0|> <|body_start_1|> r1 = self._r1.get_git_commit() r2 = self._r2.get_git_commit() return self._repo.diff(r1, r2) <|end_body_1|>
The set of changes needed to transform one revision into another.
RevisionDiff
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RevisionDiff: """The set of changes needed to transform one revision into another.""" def __init__(self, r1, r2, repo): """r1 is the older revision, r2 is the newer revision.""" <|body_0|> def get_value(self): """Concatenation of Unified Diffs of resources betwee...
stack_v2_sparse_classes_36k_train_022344
1,128
permissive
[ { "docstring": "r1 is the older revision, r2 is the newer revision.", "name": "__init__", "signature": "def __init__(self, r1, r2, repo)" }, { "docstring": "Concatenation of Unified Diffs of resources between the revisions. pg484 of Python in a Nutshell suggests the below method for big string c...
2
stack_v2_sparse_classes_30k_train_018382
Implement the Python class `RevisionDiff` described below. Class description: The set of changes needed to transform one revision into another. Method signatures and docstrings: - def __init__(self, r1, r2, repo): r1 is the older revision, r2 is the newer revision. - def get_value(self): Concatenation of Unified Diff...
Implement the Python class `RevisionDiff` described below. Class description: The set of changes needed to transform one revision into another. Method signatures and docstrings: - def __init__(self, r1, r2, repo): r1 is the older revision, r2 is the newer revision. - def get_value(self): Concatenation of Unified Diff...
4f6538324b2e1f7a8b14c346104d2f1bd8e1556b
<|skeleton|> class RevisionDiff: """The set of changes needed to transform one revision into another.""" def __init__(self, r1, r2, repo): """r1 is the older revision, r2 is the newer revision.""" <|body_0|> def get_value(self): """Concatenation of Unified Diffs of resources betwee...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RevisionDiff: """The set of changes needed to transform one revision into another.""" def __init__(self, r1, r2, repo): """r1 is the older revision, r2 is the newer revision.""" super(RevisionDiff, self).__init__() self._r1 = r1 self._r2 = r2 self._repo = repo ...
the_stack_v2_python_sparse
apps/pyvcal/git_wrapper/revisiondiff.py
hbussell/pinax-tracker
train
0
81c3f329d93adc3b57df685c68b719f9a16e112d
[ "zk_client = KazooClient(hosts=','.join(zk_locations), connection_retry=ZK_PERSISTENT_RECONNECTS)\nzk_client.start()\nself.ioloop = io_loop\nself.target = target\nself.start_time = None\nself.status = 'Not started'\nself.finish_time = None\nself.solr_adapter = solr_adapter.SolrAdapter(zk_client)\nself.scheduled_ind...
<|body_start_0|> zk_client = KazooClient(hosts=','.join(zk_locations), connection_retry=ZK_PERSISTENT_RECONNECTS) zk_client.start() self.ioloop = io_loop self.target = target self.start_time = None self.status = 'Not started' self.finish_time = None self.s...
Exports data from Search Service 2 to target storage.
Exporter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Exporter: """Exports data from Search Service 2 to target storage.""" def __init__(self, io_loop, zk_locations, target, max_concurrency): """Args: io_loop: an instance of tornado IOLoop. zk_locations: a list - Zookeeper locations. target: an instance of export Target (e.g.: S3Target)...
stack_v2_sparse_classes_36k_train_022345
10,087
permissive
[ { "docstring": "Args: io_loop: an instance of tornado IOLoop. zk_locations: a list - Zookeeper locations. target: an instance of export Target (e.g.: S3Target). max_concurrency: an int - maximum number of concurrent jobs.", "name": "__init__", "signature": "def __init__(self, io_loop, zk_locations, targ...
4
stack_v2_sparse_classes_30k_train_013314
Implement the Python class `Exporter` described below. Class description: Exports data from Search Service 2 to target storage. Method signatures and docstrings: - def __init__(self, io_loop, zk_locations, target, max_concurrency): Args: io_loop: an instance of tornado IOLoop. zk_locations: a list - Zookeeper locatio...
Implement the Python class `Exporter` described below. Class description: Exports data from Search Service 2 to target storage. Method signatures and docstrings: - def __init__(self, io_loop, zk_locations, target, max_concurrency): Args: io_loop: an instance of tornado IOLoop. zk_locations: a list - Zookeeper locatio...
be17e5f658d7b42b5aa7eeb7a5ddd4962f3ea82f
<|skeleton|> class Exporter: """Exports data from Search Service 2 to target storage.""" def __init__(self, io_loop, zk_locations, target, max_concurrency): """Args: io_loop: an instance of tornado IOLoop. zk_locations: a list - Zookeeper locations. target: an instance of export Target (e.g.: S3Target)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Exporter: """Exports data from Search Service 2 to target storage.""" def __init__(self, io_loop, zk_locations, target, max_concurrency): """Args: io_loop: an instance of tornado IOLoop. zk_locations: a list - Zookeeper locations. target: an instance of export Target (e.g.: S3Target). max_concurr...
the_stack_v2_python_sparse
SearchService2/appscale/search/backup_restore/backup_from_v2.py
obino/appscale
train
1
34b4a13545849ab09324a47ee16889cd2f7ca3e3
[ "self._variables = parameters\nassert len(self._variables) > 0\nself._prev_variables = [nn.Parameter(v.clone(), requires_grad=False) for v in parameters]", "def _adjust_step(ratio):\n r = 0.9 / ratio\n for var, prev_var in zip(self._variables, self._prev_variables):\n var.data.copy_(prev_var + r * (v...
<|body_start_0|> self._variables = parameters assert len(self._variables) > 0 self._prev_variables = [nn.Parameter(v.clone(), requires_grad=False) for v in parameters] <|end_body_0|> <|body_start_1|> def _adjust_step(ratio): r = 0.9 / ratio for var, prev_var in z...
Adjust variables based on the change calculated by `change_f()` The motivation is that if some quatity changes too much after an SGD update, the SGD step might be too big. We want to shink that step so that the concerned quatity does not change too much. We can also monitor multiple quantities to make sure none of them...
TrustedUpdater
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrustedUpdater: """Adjust variables based on the change calculated by `change_f()` The motivation is that if some quatity changes too much after an SGD update, the SGD step might be too big. We want to shink that step so that the concerned quatity does not change too much. We can also monitor mul...
stack_v2_sparse_classes_36k_train_022346
3,836
permissive
[ { "docstring": "Create a TrustedUpdater instance. Args: parameters (list[Parameter]): parameters to be monitored.", "name": "__init__", "signature": "def __init__(self, parameters)" }, { "docstring": "Adjust `parameters` based change calculated by change_f This function will copy the new values ...
2
stack_v2_sparse_classes_30k_train_007282
Implement the Python class `TrustedUpdater` described below. Class description: Adjust variables based on the change calculated by `change_f()` The motivation is that if some quatity changes too much after an SGD update, the SGD step might be too big. We want to shink that step so that the concerned quatity does not c...
Implement the Python class `TrustedUpdater` described below. Class description: Adjust variables based on the change calculated by `change_f()` The motivation is that if some quatity changes too much after an SGD update, the SGD step might be too big. We want to shink that step so that the concerned quatity does not c...
b00ff2fa5e660de31020338ba340263183fbeaa4
<|skeleton|> class TrustedUpdater: """Adjust variables based on the change calculated by `change_f()` The motivation is that if some quatity changes too much after an SGD update, the SGD step might be too big. We want to shink that step so that the concerned quatity does not change too much. We can also monitor mul...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TrustedUpdater: """Adjust variables based on the change calculated by `change_f()` The motivation is that if some quatity changes too much after an SGD update, the SGD step might be too big. We want to shink that step so that the concerned quatity does not change too much. We can also monitor multiple quantit...
the_stack_v2_python_sparse
alf/optimizers/trusted_updater.py
HorizonRobotics/alf
train
288
1cae5684310a75ec67a9bf2b97ae557b2055d111
[ "content = '\\n\\n Dear {{ pro_first_name }},\\n\\n Your host, {{ party.host.first_name }}, finished setting up the party below on <a href=\"http://{{ host_name }}\">Vinely.com</a>.\\n\\n If they haven\\'t yet, please make sure they order a Party Pack and track the RSVPs to ensure they have eno...
<|body_start_0|> content = '\n\n Dear {{ pro_first_name }},\n\n Your host, {{ party.host.first_name }}, finished setting up the party below on <a href="http://{{ host_name }}">Vinely.com</a>.\n\n If they haven\'t yet, please make sure they order a Party Pack and track the RSVPs to ensure th...
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|> content = '\n\n Dear {{ pro_first_name }},\...
stack_v2_sparse_classes_36k_train_022347
4,471
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_003049
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,...
c5c7d8a0b1a297e07302870017d3fb03c5dbb009
<|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.""" content = '\n\n Dear {{ pro_first_name }},\n\n Your host, {{ party.host.first_name }}, finished setting up the party below on <a href="http://{{ host_name }}">Vinely.com</a>.\n\n If they haven\'t y...
the_stack_v2_python_sparse
cms/migrations/0017_party_setup_complete_email.py
RSV3/nuvine
train
0
148e912260ea4629fb87446890458ed644fdef28
[ "self.places = {}\nself.transitions = {}\nself.successful_firings = []", "pn_copy = PetriNetModel()\nfor place in petri_net_model.places.values():\n pn_copy.add_place(place.tokens, place.place_id, place.label)\nfor t in petri_net_model.transitions.values():\n input_place_ids = [arc.place.place_id for arc in...
<|body_start_0|> self.places = {} self.transitions = {} self.successful_firings = [] <|end_body_0|> <|body_start_1|> pn_copy = PetriNetModel() for place in petri_net_model.places.values(): pn_copy.add_place(place.tokens, place.place_id, place.label) for t in ...
PetriNetModel
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PetriNetModel: def __init__(self): """Initialize an empty Petri net.""" <|body_0|> def make_copy_of(petri_net_model): """Makes a deep copy of a PetriNetModel instance. Args: petri_net_model: instance of PetriNetModel to be copied""" <|body_1|> def add_pl...
stack_v2_sparse_classes_36k_train_022348
15,780
permissive
[ { "docstring": "Initialize an empty Petri net.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Makes a deep copy of a PetriNetModel instance. Args: petri_net_model: instance of PetriNetModel to be copied", "name": "make_copy_of", "signature": "def make_copy_of(...
5
stack_v2_sparse_classes_30k_train_014074
Implement the Python class `PetriNetModel` described below. Class description: Implement the PetriNetModel class. Method signatures and docstrings: - def __init__(self): Initialize an empty Petri net. - def make_copy_of(petri_net_model): Makes a deep copy of a PetriNetModel instance. Args: petri_net_model: instance o...
Implement the Python class `PetriNetModel` described below. Class description: Implement the PetriNetModel class. Method signatures and docstrings: - def __init__(self): Initialize an empty Petri net. - def make_copy_of(petri_net_model): Makes a deep copy of a PetriNetModel instance. Args: petri_net_model: instance o...
8e9a3a8151069757475808c48511c9d7486ea334
<|skeleton|> class PetriNetModel: def __init__(self): """Initialize an empty Petri net.""" <|body_0|> def make_copy_of(petri_net_model): """Makes a deep copy of a PetriNetModel instance. Args: petri_net_model: instance of PetriNetModel to be copied""" <|body_1|> def add_pl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PetriNetModel: def __init__(self): """Initialize an empty Petri net.""" self.places = {} self.transitions = {} self.successful_firings = [] def make_copy_of(petri_net_model): """Makes a deep copy of a PetriNetModel instance. Args: petri_net_model: instance of Petri...
the_stack_v2_python_sparse
HFPN model/utils/petri_nets.py
PN-Alzheimers-Parkinsons/PN_Alzheimers_Parkinsons
train
0
5621d7acec37e57b04f8a59d9ed31e2759fe722e
[ "try:\n return self.database_dispatcher.current_database['project']\nexcept KeyError as e:\n raise ValueError() from e", "from renku import __version__\ndatabase = self.database_dispatcher.current_database\ntry:\n if database['project']:\n database.remove_root_object('project')\nexcept KeyError:\n...
<|body_start_0|> try: return self.database_dispatcher.current_database['project'] except KeyError as e: raise ValueError() from e <|end_body_0|> <|body_start_1|> from renku import __version__ database = self.database_dispatcher.current_database try: ...
Gateway for project database operations.
ProjectGateway
[ "Apache-2.0", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProjectGateway: """Gateway for project database operations.""" def get_project(self) -> Project: """Get project metadata.""" <|body_0|> def update_project(self, project: Project): """Update project metadata.""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_36k_train_022349
1,889
permissive
[ { "docstring": "Get project metadata.", "name": "get_project", "signature": "def get_project(self) -> Project" }, { "docstring": "Update project metadata.", "name": "update_project", "signature": "def update_project(self, project: Project)" } ]
2
stack_v2_sparse_classes_30k_train_009543
Implement the Python class `ProjectGateway` described below. Class description: Gateway for project database operations. Method signatures and docstrings: - def get_project(self) -> Project: Get project metadata. - def update_project(self, project: Project): Update project metadata.
Implement the Python class `ProjectGateway` described below. Class description: Gateway for project database operations. Method signatures and docstrings: - def get_project(self) -> Project: Get project metadata. - def update_project(self, project: Project): Update project metadata. <|skeleton|> class ProjectGateway...
449ec7bca1cc435e5a8ceb278e49a422b953bb09
<|skeleton|> class ProjectGateway: """Gateway for project database operations.""" def get_project(self) -> Project: """Get project metadata.""" <|body_0|> def update_project(self, project: Project): """Update project metadata.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProjectGateway: """Gateway for project database operations.""" def get_project(self) -> Project: """Get project metadata.""" try: return self.database_dispatcher.current_database['project'] except KeyError as e: raise ValueError() from e def update_pro...
the_stack_v2_python_sparse
renku/core/metadata/gateway/project_gateway.py
code-inflation/renku-python
train
0
f9ea9336cba8d80a3a592c6c48b4ac210a97ae33
[ "n = len(s)\nstr_list = []\nif numRows <= 1:\n return s\nzig_size = numRows * 2 - 2\nzig_count = n // zig_size\nfor i in range(numRows):\n if i == 0 or i == numRows - 1:\n for j in range(zig_count + 1):\n index = j * zig_size + i\n if index < n:\n str_list.append(s[...
<|body_start_0|> n = len(s) str_list = [] if numRows <= 1: return s zig_size = numRows * 2 - 2 zig_count = n // zig_size for i in range(numRows): if i == 0 or i == numRows - 1: for j in range(zig_count + 1): inde...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def convert1(self, s, numRows): """:type s: str :type numRows: int :rtype: str""" <|body_0|> def convert(self, s, numRows): """:type s: str :type numRows: int :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(s) s...
stack_v2_sparse_classes_36k_train_022350
2,920
no_license
[ { "docstring": ":type s: str :type numRows: int :rtype: str", "name": "convert1", "signature": "def convert1(self, s, numRows)" }, { "docstring": ":type s: str :type numRows: int :rtype: str", "name": "convert", "signature": "def convert(self, s, numRows)" } ]
2
stack_v2_sparse_classes_30k_train_012339
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def convert1(self, s, numRows): :type s: str :type numRows: int :rtype: str - def convert(self, s, numRows): :type s: str :type numRows: int :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def convert1(self, s, numRows): :type s: str :type numRows: int :rtype: str - def convert(self, s, numRows): :type s: str :type numRows: int :rtype: str <|skeleton|> class Solut...
4a1747b6497305f3821612d9c358a6795b1690da
<|skeleton|> class Solution: def convert1(self, s, numRows): """:type s: str :type numRows: int :rtype: str""" <|body_0|> def convert(self, s, numRows): """:type s: str :type numRows: int :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def convert1(self, s, numRows): """:type s: str :type numRows: int :rtype: str""" n = len(s) str_list = [] if numRows <= 1: return s zig_size = numRows * 2 - 2 zig_count = n // zig_size for i in range(numRows): if i == 0...
the_stack_v2_python_sparse
String/q006_zigzag_conversion.py
sevenhe716/LeetCode
train
0
24332902d67fda29df625c5dc9db93a6c3971397
[ "s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\ntry:\n s.connect((host, int(port)))\n s.shutdown(2)\n print('port %s is uesd !' % port)\n return False\nexcept:\n print('port %s is available!' % port)\n return True", "erromessage = ''\nappium_server_url = ''\nbootstrap_port = str(port + 1...
<|body_start_0|> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: s.connect((host, int(port))) s.shutdown(2) print('port %s is uesd !' % port) return False except: print('port %s is available!' % port) return True ...
AppiumServer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AppiumServer: def check_port(self, host, port): """检测端口是否被占用""" <|body_0|> def start_appium(self, host, port): """启动appium 服务""" <|body_1|> <|end_skeleton|> <|body_start_0|> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: ...
stack_v2_sparse_classes_36k_train_022351
2,400
no_license
[ { "docstring": "检测端口是否被占用", "name": "check_port", "signature": "def check_port(self, host, port)" }, { "docstring": "启动appium 服务", "name": "start_appium", "signature": "def start_appium(self, host, port)" } ]
2
stack_v2_sparse_classes_30k_train_015446
Implement the Python class `AppiumServer` described below. Class description: Implement the AppiumServer class. Method signatures and docstrings: - def check_port(self, host, port): 检测端口是否被占用 - def start_appium(self, host, port): 启动appium 服务
Implement the Python class `AppiumServer` described below. Class description: Implement the AppiumServer class. Method signatures and docstrings: - def check_port(self, host, port): 检测端口是否被占用 - def start_appium(self, host, port): 启动appium 服务 <|skeleton|> class AppiumServer: def check_port(self, host, port): ...
4df8ce960721407a20d89de47faad0df0de063a1
<|skeleton|> class AppiumServer: def check_port(self, host, port): """检测端口是否被占用""" <|body_0|> def start_appium(self, host, port): """启动appium 服务""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AppiumServer: def check_port(self, host, port): """检测端口是否被占用""" s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: s.connect((host, int(port))) s.shutdown(2) print('port %s is uesd !' % port) return False except: ...
the_stack_v2_python_sparse
DispatcherMobile/appiumServer.py
namexiaohuihui/operating
train
0
1b6ba4a0e8c4993d17518255b568cd541ba12ddc
[ "super(_ResponseCallbackManager, self).validate_callback(callback)\nif isinstance(callback, (type, types.ClassType)):\n if not issubclass(callback, ResponseCallback):\n raise ValueError('Type mismatch on callback argument')\nelif not issubclass(callback.__class__, ResponseCallback):\n raise ValueError(...
<|body_start_0|> super(_ResponseCallbackManager, self).validate_callback(callback) if isinstance(callback, (type, types.ClassType)): if not issubclass(callback, ResponseCallback): raise ValueError('Type mismatch on callback argument') elif not issubclass(callback.__cl...
Manager for {@link ResponseCallback} message callbacks.
_ResponseCallbackManager
[ "BSD-3-Clause", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _ResponseCallbackManager: """Manager for {@link ResponseCallback} message callbacks.""" def validate_callback(self, callback): """Validates if `callback` is a valid ResponseCallback. :param callback: Callback to validate.""" <|body_0|> def handle_fire(self, response_call...
stack_v2_sparse_classes_36k_train_022352
12,867
permissive
[ { "docstring": "Validates if `callback` is a valid ResponseCallback. :param callback: Callback to validate.", "name": "validate_callback", "signature": "def validate_callback(self, callback)" }, { "docstring": "Runs `response_callback` for `response`. :param response_callback: {@link dxlclient.c...
2
stack_v2_sparse_classes_30k_train_018880
Implement the Python class `_ResponseCallbackManager` described below. Class description: Manager for {@link ResponseCallback} message callbacks. Method signatures and docstrings: - def validate_callback(self, callback): Validates if `callback` is a valid ResponseCallback. :param callback: Callback to validate. - def...
Implement the Python class `_ResponseCallbackManager` described below. Class description: Manager for {@link ResponseCallback} message callbacks. Method signatures and docstrings: - def validate_callback(self, callback): Validates if `callback` is a valid ResponseCallback. :param callback: Callback to validate. - def...
7bbc003592022f5776006d467f591a214a119013
<|skeleton|> class _ResponseCallbackManager: """Manager for {@link ResponseCallback} message callbacks.""" def validate_callback(self, callback): """Validates if `callback` is a valid ResponseCallback. :param callback: Callback to validate.""" <|body_0|> def handle_fire(self, response_call...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _ResponseCallbackManager: """Manager for {@link ResponseCallback} message callbacks.""" def validate_callback(self, callback): """Validates if `callback` is a valid ResponseCallback. :param callback: Callback to validate.""" super(_ResponseCallbackManager, self).validate_callback(callback...
the_stack_v2_python_sparse
src/main/resources/dxlclient/_callback_manager.py
att/OpenDXLJythonClient
train
4
87f22745085078af89f706a292c1e7cfdcac54a4
[ "self.wb = xlrd.open_workbook(path)\nself.ws = self.wb.sheet_by_index(0)\nself.startrow = startrow\nself.source = source", "nrows = self.ws.nrows\ntitles = self.ws.row_values(self.startrow - 1)\nncolumns = len(titles)\nfor i in range(self.startrow, nrows):\n row = self.ws.row_values(i)\n if len(row) >= ncol...
<|body_start_0|> self.wb = xlrd.open_workbook(path) self.ws = self.wb.sheet_by_index(0) self.startrow = startrow self.source = source <|end_body_0|> <|body_start_1|> nrows = self.ws.nrows titles = self.ws.row_values(self.startrow - 1) ncolumns = len(titles) ...
excel文件操作类
Excel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Excel: """excel文件操作类""" def __init__(self, path: str, startrow=1, source=''): """path:excel文件路径 sheetname:表名,默认为第一个表 startrow:标题行所在行数,默认为1 source:来源标记""" <|body_0|> def read_sheet(self): """读取sheet并返回内容""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_022353
1,243
no_license
[ { "docstring": "path:excel文件路径 sheetname:表名,默认为第一个表 startrow:标题行所在行数,默认为1 source:来源标记", "name": "__init__", "signature": "def __init__(self, path: str, startrow=1, source='')" }, { "docstring": "读取sheet并返回内容", "name": "read_sheet", "signature": "def read_sheet(self)" } ]
2
stack_v2_sparse_classes_30k_train_021497
Implement the Python class `Excel` described below. Class description: excel文件操作类 Method signatures and docstrings: - def __init__(self, path: str, startrow=1, source=''): path:excel文件路径 sheetname:表名,默认为第一个表 startrow:标题行所在行数,默认为1 source:来源标记 - def read_sheet(self): 读取sheet并返回内容
Implement the Python class `Excel` described below. Class description: excel文件操作类 Method signatures and docstrings: - def __init__(self, path: str, startrow=1, source=''): path:excel文件路径 sheetname:表名,默认为第一个表 startrow:标题行所在行数,默认为1 source:来源标记 - def read_sheet(self): 读取sheet并返回内容 <|skeleton|> class Excel: """excel...
fe0998e859c5f2e06ecede866319ac210281a40a
<|skeleton|> class Excel: """excel文件操作类""" def __init__(self, path: str, startrow=1, source=''): """path:excel文件路径 sheetname:表名,默认为第一个表 startrow:标题行所在行数,默认为1 source:来源标记""" <|body_0|> def read_sheet(self): """读取sheet并返回内容""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Excel: """excel文件操作类""" def __init__(self, path: str, startrow=1, source=''): """path:excel文件路径 sheetname:表名,默认为第一个表 startrow:标题行所在行数,默认为1 source:来源标记""" self.wb = xlrd.open_workbook(path) self.ws = self.wb.sheet_by_index(0) self.startrow = startrow self.source = s...
the_stack_v2_python_sparse
Upload_enterprise/excel.py
Jeremylee1234/Crawl_items
train
0
387c35b6fa27d62ac46c157315515c84edfa1c8e
[ "name, extension = os.path.splitext(path)\nif extension and extension[1:] in self.CANDIDATE_EXTENSIONS:\n return True\nreturn False", "filelead, filetail = os.path.split(filepath)\nname, extension = os.path.splitext(filetail)\nif extension:\n extension = extension[1:]\nfilenames = [name]\nif not name.starts...
<|body_start_0|> name, extension = os.path.splitext(path) if extension and extension[1:] in self.CANDIDATE_EXTENSIONS: return True return False <|end_body_0|> <|body_start_1|> filelead, filetail = os.path.split(filepath) name, extension = os.path.splitext(filetail) ...
Import paths resolver. Resolve given paths from SCSS source to absolute paths. It's a mixin, meaning without own ``__init__`` method so it's should be safe enough to inherit it from another class. Attributes: CANDIDATE_EXTENSIONS (list): List of extensions available to build candidate paths. Beware, order does matter, ...
ImportPathsResolver
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImportPathsResolver: """Import paths resolver. Resolve given paths from SCSS source to absolute paths. It's a mixin, meaning without own ``__init__`` method so it's should be safe enough to inherit it from another class. Attributes: CANDIDATE_EXTENSIONS (list): List of extensions available to bui...
stack_v2_sparse_classes_36k_train_022354
7,507
permissive
[ { "docstring": "Check given path is an allowed source file. A source file must have the right file extension to be allowed. Args: path (string): A file path, either relative or absolute. Returns: bool: True if allowed, else False.", "name": "is_allowed_source", "signature": "def is_allowed_source(self, ...
4
stack_v2_sparse_classes_30k_train_008659
Implement the Python class `ImportPathsResolver` described below. Class description: Import paths resolver. Resolve given paths from SCSS source to absolute paths. It's a mixin, meaning without own ``__init__`` method so it's should be safe enough to inherit it from another class. Attributes: CANDIDATE_EXTENSIONS (lis...
Implement the Python class `ImportPathsResolver` described below. Class description: Import paths resolver. Resolve given paths from SCSS source to absolute paths. It's a mixin, meaning without own ``__init__`` method so it's should be safe enough to inherit it from another class. Attributes: CANDIDATE_EXTENSIONS (lis...
491c0db5d6a3d6c18f858a8b94673d697b79b0a8
<|skeleton|> class ImportPathsResolver: """Import paths resolver. Resolve given paths from SCSS source to absolute paths. It's a mixin, meaning without own ``__init__`` method so it's should be safe enough to inherit it from another class. Attributes: CANDIDATE_EXTENSIONS (list): List of extensions available to bui...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImportPathsResolver: """Import paths resolver. Resolve given paths from SCSS source to absolute paths. It's a mixin, meaning without own ``__init__`` method so it's should be safe enough to inherit it from another class. Attributes: CANDIDATE_EXTENSIONS (list): List of extensions available to build candidate ...
the_stack_v2_python_sparse
boussole/resolver.py
sveetch/boussole
train
14
4e839ba3808743ba8c8785079521bbfa02a0e34f
[ "id = request.GET.get('id', None)\nif id is None:\n offering_courses = OfferingCourse.objects.all()\n serializer = OfferingCourseSerializer(offering_courses, many=True)\n return JsonResponse({'offering_courses': serializer.data}, safe=False)\nelse:\n offering_course = get_object_or_404(OfferingCourse, i...
<|body_start_0|> id = request.GET.get('id', None) if id is None: offering_courses = OfferingCourse.objects.all() serializer = OfferingCourseSerializer(offering_courses, many=True) return JsonResponse({'offering_courses': serializer.data}, safe=False) else: ...
开设课程view
OfferingCourses
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OfferingCourses: """开设课程view""" def get(self, request): """查询开设课程""" <|body_0|> def put(self, request): """修改开设课程""" <|body_1|> def post(self, request): """增加开设课程""" <|body_2|> def delete(self, request): """删除开设课程""" ...
stack_v2_sparse_classes_36k_train_022355
15,061
permissive
[ { "docstring": "查询开设课程", "name": "get", "signature": "def get(self, request)" }, { "docstring": "修改开设课程", "name": "put", "signature": "def put(self, request)" }, { "docstring": "增加开设课程", "name": "post", "signature": "def post(self, request)" }, { "docstring": "删除开...
4
stack_v2_sparse_classes_30k_train_003266
Implement the Python class `OfferingCourses` described below. Class description: 开设课程view Method signatures and docstrings: - def get(self, request): 查询开设课程 - def put(self, request): 修改开设课程 - def post(self, request): 增加开设课程 - def delete(self, request): 删除开设课程
Implement the Python class `OfferingCourses` described below. Class description: 开设课程view Method signatures and docstrings: - def get(self, request): 查询开设课程 - def put(self, request): 修改开设课程 - def post(self, request): 增加开设课程 - def delete(self, request): 删除开设课程 <|skeleton|> class OfferingCourses: """开设课程view""" ...
7aaa1be773718de1beb3ce0080edca7c4114b7ad
<|skeleton|> class OfferingCourses: """开设课程view""" def get(self, request): """查询开设课程""" <|body_0|> def put(self, request): """修改开设课程""" <|body_1|> def post(self, request): """增加开设课程""" <|body_2|> def delete(self, request): """删除开设课程""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OfferingCourses: """开设课程view""" def get(self, request): """查询开设课程""" id = request.GET.get('id', None) if id is None: offering_courses = OfferingCourse.objects.all() serializer = OfferingCourseSerializer(offering_courses, many=True) return JsonRe...
the_stack_v2_python_sparse
plan/views.py
MIXISAMA/MIS-backend
train
0
f1ba654e2459649e83ca75d6a4ae75e0c2b6a6f9
[ "super().__init__()\nself.hops = hops\n\ndef embedding(use_extra_feats=True):\n return Embed(num_features, embedding_size, position_encoding=position_encoding, padding_idx=padding_idx)\nself.query_lt = embedding()\nself.in_memory_lt = embedding()\nself.out_memory_lt = embedding()\nself.answer_embedder = embeddin...
<|body_start_0|> super().__init__() self.hops = hops def embedding(use_extra_feats=True): return Embed(num_features, embedding_size, position_encoding=position_encoding, padding_idx=padding_idx) self.query_lt = embedding() self.in_memory_lt = embedding() self...
Memory Network module.
MemNN
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MemNN: """Memory Network module.""" def __init__(self, num_features, embedding_size, hops=1, memsize=32, time_features=False, position_encoding=False, dropout=0, padding_idx=0): """Initialize memnn model. See cmdline args in MemnnAgent for description of arguments.""" <|body_...
stack_v2_sparse_classes_36k_train_022356
7,626
permissive
[ { "docstring": "Initialize memnn model. See cmdline args in MemnnAgent for description of arguments.", "name": "__init__", "signature": "def __init__(self, num_features, embedding_size, hops=1, memsize=32, time_features=False, position_encoding=False, dropout=0, padding_idx=0)" }, { "docstring":...
2
null
Implement the Python class `MemNN` described below. Class description: Memory Network module. Method signatures and docstrings: - def __init__(self, num_features, embedding_size, hops=1, memsize=32, time_features=False, position_encoding=False, dropout=0, padding_idx=0): Initialize memnn model. See cmdline args in Me...
Implement the Python class `MemNN` described below. Class description: Memory Network module. Method signatures and docstrings: - def __init__(self, num_features, embedding_size, hops=1, memsize=32, time_features=False, position_encoding=False, dropout=0, padding_idx=0): Initialize memnn model. See cmdline args in Me...
e1d899edfb92471552bae153f59ad30aa7fca468
<|skeleton|> class MemNN: """Memory Network module.""" def __init__(self, num_features, embedding_size, hops=1, memsize=32, time_features=False, position_encoding=False, dropout=0, padding_idx=0): """Initialize memnn model. See cmdline args in MemnnAgent for description of arguments.""" <|body_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MemNN: """Memory Network module.""" def __init__(self, num_features, embedding_size, hops=1, memsize=32, time_features=False, position_encoding=False, dropout=0, padding_idx=0): """Initialize memnn model. See cmdline args in MemnnAgent for description of arguments.""" super().__init__() ...
the_stack_v2_python_sparse
parlai/agents/memnn/modules.py
facebookresearch/ParlAI
train
10,943
ca63aac4d1f7230bf7b292ecf3e59f7ed20658f4
[ "self.scr = scr\nself.label = TextLabel(scr=self.scr, text=TEXT_MESSAGE, color=TEXT_COLOR, size=FONT_SIZE)\nself.label.rect.center = self.scr.get_rect().center", "self.scr.fill(SCREEN_COLOR)\nself.label.draw()\npygame.display.flip()" ]
<|body_start_0|> self.scr = scr self.label = TextLabel(scr=self.scr, text=TEXT_MESSAGE, color=TEXT_COLOR, size=FONT_SIZE) self.label.rect.center = self.scr.get_rect().center <|end_body_0|> <|body_start_1|> self.scr.fill(SCREEN_COLOR) self.label.draw() pygame.display.flip...
LoadingScreen
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoadingScreen: def __init__(self, scr): """Input parameters: scr - Surface for drawing.""" <|body_0|> def draw(self): """Fills the specified surface with solid color and renders the text label with message.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_022357
851
permissive
[ { "docstring": "Input parameters: scr - Surface for drawing.", "name": "__init__", "signature": "def __init__(self, scr)" }, { "docstring": "Fills the specified surface with solid color and renders the text label with message.", "name": "draw", "signature": "def draw(self)" } ]
2
stack_v2_sparse_classes_30k_train_015037
Implement the Python class `LoadingScreen` described below. Class description: Implement the LoadingScreen class. Method signatures and docstrings: - def __init__(self, scr): Input parameters: scr - Surface for drawing. - def draw(self): Fills the specified surface with solid color and renders the text label with mes...
Implement the Python class `LoadingScreen` described below. Class description: Implement the LoadingScreen class. Method signatures and docstrings: - def __init__(self, scr): Input parameters: scr - Surface for drawing. - def draw(self): Fills the specified surface with solid color and renders the text label with mes...
f15e9d609e763e70710cd3e0faea9a5a18dfd8a5
<|skeleton|> class LoadingScreen: def __init__(self, scr): """Input parameters: scr - Surface for drawing.""" <|body_0|> def draw(self): """Fills the specified surface with solid color and renders the text label with message.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LoadingScreen: def __init__(self, scr): """Input parameters: scr - Surface for drawing.""" self.scr = scr self.label = TextLabel(scr=self.scr, text=TEXT_MESSAGE, color=TEXT_COLOR, size=FONT_SIZE) self.label.rect.center = self.scr.get_rect().center def draw(self): "...
the_stack_v2_python_sparse
loading_screen.py
ammydolphin/space_racer
train
0
c8076e8e07d5f12740776c4b90bfb1ceb6680cbd
[ "DEFAULT_PLACEHOLDER = 0.0\nCOLUMNS = ('attribute_name', 'total_val', 'max', 'min', 'mean', 'stddev', 'num_nans', 'num_distincts')\nmay_be_numeric = raw.apply(hr.is_number_as_string, axis=0)\n\ndef _descriptive_stat_reducer(reduce_fn: Callable) -> Callable[[pd.Series], pd.Series]:\n return lambda series: reduce_...
<|body_start_0|> DEFAULT_PLACEHOLDER = 0.0 COLUMNS = ('attribute_name', 'total_val', 'max', 'min', 'mean', 'stddev', 'num_nans', 'num_distincts') may_be_numeric = raw.apply(hr.is_number_as_string, axis=0) def _descriptive_stat_reducer(reduce_fn: Callable) -> Callable[[pd.Series], pd.Ser...
Abstract class to parse and extract metafeatures from a raw data set. Concrete classes that interface directly with raw data sets should inherit from here. Since subclasses from this class will interact with raw data sets solely for prediction, only the test-related attributes (test_metafeatures, test_labels) will be u...
RawDataSetParser
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RawDataSetParser: """Abstract class to parse and extract metafeatures from a raw data set. Concrete classes that interface directly with raw data sets should inherit from here. Since subclasses from this class will interact with raw data sets solely for prediction, only the test-related attribute...
stack_v2_sparse_classes_36k_train_022358
5,981
permissive
[ { "docstring": "Extract base features from the data set. Base features include: {attribute_name, total_val, num_distincts, num_nans, max, min, mean, stddev}. Secondary feature `avg_val_len` is also included here to be consistent with other sibling class methods. Arguments: raw {pd.DataFrame} -- A cleaned datafr...
3
null
Implement the Python class `RawDataSetParser` described below. Class description: Abstract class to parse and extract metafeatures from a raw data set. Concrete classes that interface directly with raw data sets should inherit from here. Since subclasses from this class will interact with raw data sets solely for pred...
Implement the Python class `RawDataSetParser` described below. Class description: Abstract class to parse and extract metafeatures from a raw data set. Concrete classes that interface directly with raw data sets should inherit from here. Since subclasses from this class will interact with raw data sets solely for pred...
ca2e927c396ae0d61923b287d6e32e142f3ba96f
<|skeleton|> class RawDataSetParser: """Abstract class to parse and extract metafeatures from a raw data set. Concrete classes that interface directly with raw data sets should inherit from here. Since subclasses from this class will interact with raw data sets solely for prediction, only the test-related attribute...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RawDataSetParser: """Abstract class to parse and extract metafeatures from a raw data set. Concrete classes that interface directly with raw data sets should inherit from here. Since subclasses from this class will interact with raw data sets solely for prediction, only the test-related attributes (test_metaf...
the_stack_v2_python_sparse
foreshadow/smart/intent_resolving/core/data_set_parsers/raw_data_set_parser.py
carsonkahn-external/foreshadow
train
0
f5a96f2a739e375fee562d8cc52d74dfc17ca1f5
[ "logger.debug('Visiting %s', self.novel_url)\nsoup = self.get_soup(self.novel_url)\nself.novel_title = soup.select_one('.breadcrumb-item.active').text.strip()\nlogger.info('Novel title: %s', self.novel_title)\npossible_cover = soup.select_one('img.lazy[alt*=\"Thumbnail\"]')\nif possible_cover:\n self.novel_cover...
<|body_start_0|> logger.debug('Visiting %s', self.novel_url) soup = self.get_soup(self.novel_url) self.novel_title = soup.select_one('.breadcrumb-item.active').text.strip() logger.info('Novel title: %s', self.novel_title) possible_cover = soup.select_one('img.lazy[alt*="Thumbnail...
WorldnovelonlineCrawler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorldnovelonlineCrawler: def read_novel_info(self): """Get novel title, autor, cover etc""" <|body_0|> def download_chapter_body(self, chapter): """Download body of a single chapter and return as clean html format""" <|body_1|> <|end_skeleton|> <|body_start...
stack_v2_sparse_classes_36k_train_022359
5,353
permissive
[ { "docstring": "Get novel title, autor, cover etc", "name": "read_novel_info", "signature": "def read_novel_info(self)" }, { "docstring": "Download body of a single chapter and return as clean html format", "name": "download_chapter_body", "signature": "def download_chapter_body(self, ch...
2
stack_v2_sparse_classes_30k_train_009900
Implement the Python class `WorldnovelonlineCrawler` described below. Class description: Implement the WorldnovelonlineCrawler class. Method signatures and docstrings: - def read_novel_info(self): Get novel title, autor, cover etc - def download_chapter_body(self, chapter): Download body of a single chapter and retur...
Implement the Python class `WorldnovelonlineCrawler` described below. Class description: Implement the WorldnovelonlineCrawler class. Method signatures and docstrings: - def read_novel_info(self): Get novel title, autor, cover etc - def download_chapter_body(self, chapter): Download body of a single chapter and retur...
451e816ab03c8466be90f6f0b3eaa52d799140ce
<|skeleton|> class WorldnovelonlineCrawler: def read_novel_info(self): """Get novel title, autor, cover etc""" <|body_0|> def download_chapter_body(self, chapter): """Download body of a single chapter and return as clean html format""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WorldnovelonlineCrawler: def read_novel_info(self): """Get novel title, autor, cover etc""" logger.debug('Visiting %s', self.novel_url) soup = self.get_soup(self.novel_url) self.novel_title = soup.select_one('.breadcrumb-item.active').text.strip() logger.info('Novel tit...
the_stack_v2_python_sparse
lncrawl/sources/worldnovelonline.py
NNTin/lightnovel-crawler
train
2
497a3ae1431ebf6f62ace729253bb044690da488
[ "out = ''\nfor i, val in enumerate(s):\n k = 0\n while i - k >= 0 and i + k < len(s) and (s[i - k] == s[i + k]):\n k += 1\n if 2 * k - 1 > len(out):\n out = s[i - k + 1:i + k]\n if i + 1 < len(s) and s[i] == s[i + 1]:\n k = 0\n while i - k >= 0 and i + 1 + k < len(s) and (s[i...
<|body_start_0|> out = '' for i, val in enumerate(s): k = 0 while i - k >= 0 and i + k < len(s) and (s[i - k] == s[i + k]): k += 1 if 2 * k - 1 > len(out): out = s[i - k + 1:i + k] if i + 1 < len(s) and s[i] == s[i + 1]: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestPalindrome1(self, s: str) -> str: """中心扩展算法,注意奇偶情况 :param s: :return:""" <|body_0|> def longestPalindrome2(self, s: str) -> str: """Manacher 算法 :param s: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> out = '' ...
stack_v2_sparse_classes_36k_train_022360
1,780
no_license
[ { "docstring": "中心扩展算法,注意奇偶情况 :param s: :return:", "name": "longestPalindrome1", "signature": "def longestPalindrome1(self, s: str) -> str" }, { "docstring": "Manacher 算法 :param s: :return:", "name": "longestPalindrome2", "signature": "def longestPalindrome2(self, s: str) -> str" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome1(self, s: str) -> str: 中心扩展算法,注意奇偶情况 :param s: :return: - def longestPalindrome2(self, s: str) -> str: Manacher 算法 :param s: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome1(self, s: str) -> str: 中心扩展算法,注意奇偶情况 :param s: :return: - def longestPalindrome2(self, s: str) -> str: Manacher 算法 :param s: :return: <|skeleton|> class So...
f2c162654a83c51495ebd161f42a1d0b69caf72d
<|skeleton|> class Solution: def longestPalindrome1(self, s: str) -> str: """中心扩展算法,注意奇偶情况 :param s: :return:""" <|body_0|> def longestPalindrome2(self, s: str) -> str: """Manacher 算法 :param s: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestPalindrome1(self, s: str) -> str: """中心扩展算法,注意奇偶情况 :param s: :return:""" out = '' for i, val in enumerate(s): k = 0 while i - k >= 0 and i + k < len(s) and (s[i - k] == s[i + k]): k += 1 if 2 * k - 1 > len(out): ...
the_stack_v2_python_sparse
05 longestPalindrome.py
ABenxj/leetcode
train
1
28b7352c858875c7e705df0bfec35bf2da929ce9
[ "min_area, max_area = self.validate_min_max_area(request)\nquery_string = self.generate_min_max_area_query_string(min_area, max_area)\nif query_string:\n query_string = '?{}'.format(query_string)\nreturn query_string", "min_area = int(request.GET.get('min_area', 1))\nif not 1 <= min_area <= 6:\n messages.er...
<|body_start_0|> min_area, max_area = self.validate_min_max_area(request) query_string = self.generate_min_max_area_query_string(min_area, max_area) if query_string: query_string = '?{}'.format(query_string) return query_string <|end_body_0|> <|body_start_1|> min_are...
Mixin for Braindump views
BraindumpViewMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BraindumpViewMixin: """Mixin for Braindump views""" def handle_query_string(self, request): """Handle query string""" <|body_0|> def validate_min_max_area(self, request): """Validate min_area and max_area query string attributes""" <|body_1|> def gen...
stack_v2_sparse_classes_36k_train_022361
11,391
permissive
[ { "docstring": "Handle query string", "name": "handle_query_string", "signature": "def handle_query_string(self, request)" }, { "docstring": "Validate min_area and max_area query string attributes", "name": "validate_min_max_area", "signature": "def validate_min_max_area(self, request)" ...
4
stack_v2_sparse_classes_30k_train_016788
Implement the Python class `BraindumpViewMixin` described below. Class description: Mixin for Braindump views Method signatures and docstrings: - def handle_query_string(self, request): Handle query string - def validate_min_max_area(self, request): Validate min_area and max_area query string attributes - def generat...
Implement the Python class `BraindumpViewMixin` described below. Class description: Mixin for Braindump views Method signatures and docstrings: - def handle_query_string(self, request): Handle query string - def validate_min_max_area(self, request): Validate min_area and max_area query string attributes - def generat...
e448729b6050f67f64606497a14236b282d25fda
<|skeleton|> class BraindumpViewMixin: """Mixin for Braindump views""" def handle_query_string(self, request): """Handle query string""" <|body_0|> def validate_min_max_area(self, request): """Validate min_area and max_area query string attributes""" <|body_1|> def gen...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BraindumpViewMixin: """Mixin for Braindump views""" def handle_query_string(self, request): """Handle query string""" min_area, max_area = self.validate_min_max_area(request) query_string = self.generate_min_max_area_query_string(min_area, max_area) if query_string: ...
the_stack_v2_python_sparse
braindump/views.py
joeig/memodrop
train
19
b341a80d0b98d20bd612ab580d168513811c5f8f
[ "fract1 = source.Fraction(5, 2)\nfract2 = source.Fraction(3, 2)\nfract3 = source.Fraction(25, 10)\nself.assertFalse(fract1 != fract3)\nself.assertTrue(fract1 == fract3)\nself.assertTrue(fract2 < fract3)\nself.assertTrue(fract1 >= fract2)\nself.assertFalse(fract2 >= fract3)\nself.assertTrue(fract1 >= 2)\nself.assert...
<|body_start_0|> fract1 = source.Fraction(5, 2) fract2 = source.Fraction(3, 2) fract3 = source.Fraction(25, 10) self.assertFalse(fract1 != fract3) self.assertTrue(fract1 == fract3) self.assertTrue(fract2 < fract3) self.assertTrue(fract1 >= fract2) self.ass...
Test exercise mod 06 Fraction
TestFraction
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestFraction: """Test exercise mod 06 Fraction""" def test_fraction_rich_comparisson(self): """Test fractions rich comparisson operators overloading""" <|body_0|> def test_fraction_math_ops(self): """Test fractions math operators overloading""" <|body_1|>...
stack_v2_sparse_classes_36k_train_022362
8,327
no_license
[ { "docstring": "Test fractions rich comparisson operators overloading", "name": "test_fraction_rich_comparisson", "signature": "def test_fraction_rich_comparisson(self)" }, { "docstring": "Test fractions math operators overloading", "name": "test_fraction_math_ops", "signature": "def tes...
3
stack_v2_sparse_classes_30k_train_013931
Implement the Python class `TestFraction` described below. Class description: Test exercise mod 06 Fraction Method signatures and docstrings: - def test_fraction_rich_comparisson(self): Test fractions rich comparisson operators overloading - def test_fraction_math_ops(self): Test fractions math operators overloading ...
Implement the Python class `TestFraction` described below. Class description: Test exercise mod 06 Fraction Method signatures and docstrings: - def test_fraction_rich_comparisson(self): Test fractions rich comparisson operators overloading - def test_fraction_math_ops(self): Test fractions math operators overloading ...
8f082201e24f0f2b991d9388500fdbf95d6f073d
<|skeleton|> class TestFraction: """Test exercise mod 06 Fraction""" def test_fraction_rich_comparisson(self): """Test fractions rich comparisson operators overloading""" <|body_0|> def test_fraction_math_ops(self): """Test fractions math operators overloading""" <|body_1|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestFraction: """Test exercise mod 06 Fraction""" def test_fraction_rich_comparisson(self): """Test fractions rich comparisson operators overloading""" fract1 = source.Fraction(5, 2) fract2 = source.Fraction(3, 2) fract3 = source.Fraction(25, 10) self.assertFalse(f...
the_stack_v2_python_sparse
intermediate/exercises/mod_04_data_model/tests_mod_04.py
garciacastano09/pycourse
train
0
a9526fd2fe7b438e5c2de485bbe67a0f9b9f0d24
[ "from pyopencl.tools import parse_arg_list\nself.arguments = parse_arg_list(arguments)\ndel arguments\nself.sort_arg_names = sort_arg_names\nself.bits = int(bits_at_a_time)\nself.index_dtype = np.dtype(index_dtype)\nself.key_dtype = np.dtype(key_dtype)\nself.options = options\nscan_ctype, scan_dtype, scan_t_cdecl =...
<|body_start_0|> from pyopencl.tools import parse_arg_list self.arguments = parse_arg_list(arguments) del arguments self.sort_arg_names = sort_arg_names self.bits = int(bits_at_a_time) self.index_dtype = np.dtype(index_dtype) self.key_dtype = np.dtype(key_dtype) ...
Provides a general `radix sort <https://en.wikipedia.org/wiki/Radix_sort>`_ on the compute device. .. versionadded:: 2013.1
RadixSort
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RadixSort: """Provides a general `radix sort <https://en.wikipedia.org/wiki/Radix_sort>`_ on the compute device. .. versionadded:: 2013.1""" def __init__(self, context, arguments, key_expr, sort_arg_names, bits_at_a_time=2, index_dtype=np.int32, key_dtype=np.uint32, options=[]): """:...
stack_v2_sparse_classes_36k_train_022363
40,605
permissive
[ { "docstring": ":arg arguments: A string of comma-separated C argument declarations. If *arguments* is specified, then *input_expr* must also be specified. All types used here must be known to PyOpenCL. (see :func:`pyopencl.tools.get_or_register_dtype`). :arg key_expr: An integer-valued C expression returning t...
2
stack_v2_sparse_classes_30k_train_010607
Implement the Python class `RadixSort` described below. Class description: Provides a general `radix sort <https://en.wikipedia.org/wiki/Radix_sort>`_ on the compute device. .. versionadded:: 2013.1 Method signatures and docstrings: - def __init__(self, context, arguments, key_expr, sort_arg_names, bits_at_a_time=2, ...
Implement the Python class `RadixSort` described below. Class description: Provides a general `radix sort <https://en.wikipedia.org/wiki/Radix_sort>`_ on the compute device. .. versionadded:: 2013.1 Method signatures and docstrings: - def __init__(self, context, arguments, key_expr, sort_arg_names, bits_at_a_time=2, ...
14812dfbc7bac1d76c4d9e5be2cdf83fc1c391a1
<|skeleton|> class RadixSort: """Provides a general `radix sort <https://en.wikipedia.org/wiki/Radix_sort>`_ on the compute device. .. versionadded:: 2013.1""" def __init__(self, context, arguments, key_expr, sort_arg_names, bits_at_a_time=2, index_dtype=np.int32, key_dtype=np.uint32, options=[]): """:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RadixSort: """Provides a general `radix sort <https://en.wikipedia.org/wiki/Radix_sort>`_ on the compute device. .. versionadded:: 2013.1""" def __init__(self, context, arguments, key_expr, sort_arg_names, bits_at_a_time=2, index_dtype=np.int32, key_dtype=np.uint32, options=[]): """:arg arguments...
the_stack_v2_python_sparse
data/python/0b8fa53e09a4b9e50dd1bda444ca4436_algorithm.py
maxim5/code-inspector
train
5
7d2678768cefb56d21b7a92047420e7fe4fbe3c2
[ "self.obstacle = obstacle\nself.missed_det_updates = 0\ncenter_point = obstacle.bounding_box_2D.get_center_point()\ntarget_pos = np.array([center_point.x, center_point.y])\ntarget_size = np.array([obstacle.bounding_box_2D.get_width(), obstacle.bounding_box_2D.get_height()])\nself._tracker = SiamRPN_init(frame.frame...
<|body_start_0|> self.obstacle = obstacle self.missed_det_updates = 0 center_point = obstacle.bounding_box_2D.get_center_point() target_pos = np.array([center_point.x, center_point.y]) target_size = np.array([obstacle.bounding_box_2D.get_width(), obstacle.bounding_box_2D.get_heig...
SingleObjectDaSiamRPNTracker
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SingleObjectDaSiamRPNTracker: def __init__(self, frame, obstacle, siam_net): """Construct a single obstacle tracker. Args: frame (:py:class:`~pylot.perception.camera_frame.CameraFrame`): Frame to reinitialize with. obstacle: perception.detection.obstacle.Obstacle.""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_022364
8,741
permissive
[ { "docstring": "Construct a single obstacle tracker. Args: frame (:py:class:`~pylot.perception.camera_frame.CameraFrame`): Frame to reinitialize with. obstacle: perception.detection.obstacle.Obstacle.", "name": "__init__", "signature": "def __init__(self, frame, obstacle, siam_net)" }, { "docstr...
3
stack_v2_sparse_classes_30k_train_010229
Implement the Python class `SingleObjectDaSiamRPNTracker` described below. Class description: Implement the SingleObjectDaSiamRPNTracker class. Method signatures and docstrings: - def __init__(self, frame, obstacle, siam_net): Construct a single obstacle tracker. Args: frame (:py:class:`~pylot.perception.camera_frame...
Implement the Python class `SingleObjectDaSiamRPNTracker` described below. Class description: Implement the SingleObjectDaSiamRPNTracker class. Method signatures and docstrings: - def __init__(self, frame, obstacle, siam_net): Construct a single obstacle tracker. Args: frame (:py:class:`~pylot.perception.camera_frame...
a71ae927328388dc44acc784662bf32a99f273f0
<|skeleton|> class SingleObjectDaSiamRPNTracker: def __init__(self, frame, obstacle, siam_net): """Construct a single obstacle tracker. Args: frame (:py:class:`~pylot.perception.camera_frame.CameraFrame`): Frame to reinitialize with. obstacle: perception.detection.obstacle.Obstacle.""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SingleObjectDaSiamRPNTracker: def __init__(self, frame, obstacle, siam_net): """Construct a single obstacle tracker. Args: frame (:py:class:`~pylot.perception.camera_frame.CameraFrame`): Frame to reinitialize with. obstacle: perception.detection.obstacle.Obstacle.""" self.obstacle = obstacle ...
the_stack_v2_python_sparse
pylot/perception/tracking/da_siam_rpn_tracker.py
erdos-project/pylot
train
389
3f9cecea547108d807bb1f2fb55d1adf8feebad1
[ "args = [[2]]\nwith self.assertRaises(ValueError):\n NeuralNetwork(*args)\nargs = [[2, 6, 1]]\nnn = NeuralNetwork(*args)\nfor field in self.fields:\n assert hasattr(nn, field)\nkwargs = {'do_setup': True}\nnn = NeuralNetwork(*args, **kwargs)\nassert all([a == b for a, b in zip(args, nn.args)])\nself.assertEqu...
<|body_start_0|> args = [[2]] with self.assertRaises(ValueError): NeuralNetwork(*args) args = [[2, 6, 1]] nn = NeuralNetwork(*args) for field in self.fields: assert hasattr(nn, field) kwargs = {'do_setup': True} nn = NeuralNetwork(*args, **...
Test the Neural Netork Policy.
TestNeuralNetwork
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestNeuralNetwork: """Test the Neural Netork Policy.""" def test_initialization(self): """Test: NEURALNETWORK: initialization.""" <|body_0|> def test_mapping(self): """Test: NEURALNETWORK: mapping.""" <|body_1|> def test_variable_assignment(self): ...
stack_v2_sparse_classes_36k_train_022365
5,830
permissive
[ { "docstring": "Test: NEURALNETWORK: initialization.", "name": "test_initialization", "signature": "def test_initialization(self)" }, { "docstring": "Test: NEURALNETWORK: mapping.", "name": "test_mapping", "signature": "def test_mapping(self)" }, { "docstring": "Test: NEURALNETWO...
4
null
Implement the Python class `TestNeuralNetwork` described below. Class description: Test the Neural Netork Policy. Method signatures and docstrings: - def test_initialization(self): Test: NEURALNETWORK: initialization. - def test_mapping(self): Test: NEURALNETWORK: mapping. - def test_variable_assignment(self): Test: ...
Implement the Python class `TestNeuralNetwork` described below. Class description: Test the Neural Netork Policy. Method signatures and docstrings: - def test_initialization(self): Test: NEURALNETWORK: initialization. - def test_mapping(self): Test: NEURALNETWORK: mapping. - def test_variable_assignment(self): Test: ...
8500c8dd90a2b59a91b988a3c83e529f6c69332f
<|skeleton|> class TestNeuralNetwork: """Test the Neural Netork Policy.""" def test_initialization(self): """Test: NEURALNETWORK: initialization.""" <|body_0|> def test_mapping(self): """Test: NEURALNETWORK: mapping.""" <|body_1|> def test_variable_assignment(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestNeuralNetwork: """Test the Neural Netork Policy.""" def test_initialization(self): """Test: NEURALNETWORK: initialization.""" args = [[2]] with self.assertRaises(ValueError): NeuralNetwork(*args) args = [[2, 6, 1]] nn = NeuralNetwork(*args) ...
the_stack_v2_python_sparse
Safe-RL/Safe-RL-Benchmark/SafeRLBench/policy/test.py
chauncygu/Safe-Reinforcement-Learning-Baselines
train
233
e8eb04ea43575c972afc0854d62bd979e73d4794
[ "event = Event.get({u'revision': revision})\nif event is None:\n raise HTTPError(404)\nif event[u'creator'] != self.get_user()[u'username']:\n raise HTTPError(403)\ndb.objects.event.remove(event[u'id'], safe=True)\nself.finish()", "event = Event.get({u'revision': revision})\nif event is None:\n raise HTT...
<|body_start_0|> event = Event.get({u'revision': revision}) if event is None: raise HTTPError(404) if event[u'creator'] != self.get_user()[u'username']: raise HTTPError(403) db.objects.event.remove(event[u'id'], safe=True) self.finish() <|end_body_0|> <|b...
EventHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EventHandler: def delete(self, revision): """Deletes an event, if the current user it that event's owner. TODO - remove associated attendance""" <|body_0|> def get(self, revision): """TODO - enforce user restrictions""" <|body_1|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_36k_train_022366
6,982
no_license
[ { "docstring": "Deletes an event, if the current user it that event's owner. TODO - remove associated attendance", "name": "delete", "signature": "def delete(self, revision)" }, { "docstring": "TODO - enforce user restrictions", "name": "get", "signature": "def get(self, revision)" } ]
2
stack_v2_sparse_classes_30k_train_006366
Implement the Python class `EventHandler` described below. Class description: Implement the EventHandler class. Method signatures and docstrings: - def delete(self, revision): Deletes an event, if the current user it that event's owner. TODO - remove associated attendance - def get(self, revision): TODO - enforce use...
Implement the Python class `EventHandler` described below. Class description: Implement the EventHandler class. Method signatures and docstrings: - def delete(self, revision): Deletes an event, if the current user it that event's owner. TODO - remove associated attendance - def get(self, revision): TODO - enforce use...
d586e1713945aeb76f94a3e8f8531a08f451454b
<|skeleton|> class EventHandler: def delete(self, revision): """Deletes an event, if the current user it that event's owner. TODO - remove associated attendance""" <|body_0|> def get(self, revision): """TODO - enforce user restrictions""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EventHandler: def delete(self, revision): """Deletes an event, if the current user it that event's owner. TODO - remove associated attendance""" event = Event.get({u'revision': revision}) if event is None: raise HTTPError(404) if event[u'creator'] != self.get_user()...
the_stack_v2_python_sparse
api/events/handlers.py
Shopcaster/Connectsy-Server
train
0
e7337b6e9dd27871838fb0bbd4b022abd2804d1c
[ "self.model_conf = model_conf\nself.inputs = inputs\nself.utils = utils\nself.layer = None", "with tf.keras.backend.name_scope('LSTM'):\n mask = tf.keras.layers.Masking()(self.inputs)\n self.layer = tf.keras.layers.LSTM(units=self.model_conf.units_num * 2, return_sequences=True, input_shape=mask.shape, drop...
<|body_start_0|> self.model_conf = model_conf self.inputs = inputs self.utils = utils self.layer = None <|end_body_0|> <|body_start_1|> with tf.keras.backend.name_scope('LSTM'): mask = tf.keras.layers.Masking()(self.inputs) self.layer = tf.keras.layers.LS...
LSTM 网络实现
LSTM
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LSTM: """LSTM 网络实现""" def __init__(self, model_conf: ModelConfig, inputs: tf.Tensor, utils: NetworkUtils): """:param model_conf: 配置 :param inputs: 网络上一层输入 tf.keras.layers.Input / tf.Tensor 类型 :param utils: 网络工具类""" <|body_0|> def build(self): """循环层构建参数 :return: ...
stack_v2_sparse_classes_36k_train_022367
3,290
permissive
[ { "docstring": ":param model_conf: 配置 :param inputs: 网络上一层输入 tf.keras.layers.Input / tf.Tensor 类型 :param utils: 网络工具类", "name": "__init__", "signature": "def __init__(self, model_conf: ModelConfig, inputs: tf.Tensor, utils: NetworkUtils)" }, { "docstring": "循环层构建参数 :return: 返回循环层的输出层", "name...
2
stack_v2_sparse_classes_30k_train_012816
Implement the Python class `LSTM` described below. Class description: LSTM 网络实现 Method signatures and docstrings: - def __init__(self, model_conf: ModelConfig, inputs: tf.Tensor, utils: NetworkUtils): :param model_conf: 配置 :param inputs: 网络上一层输入 tf.keras.layers.Input / tf.Tensor 类型 :param utils: 网络工具类 - def build(sel...
Implement the Python class `LSTM` described below. Class description: LSTM 网络实现 Method signatures and docstrings: - def __init__(self, model_conf: ModelConfig, inputs: tf.Tensor, utils: NetworkUtils): :param model_conf: 配置 :param inputs: 网络上一层输入 tf.keras.layers.Input / tf.Tensor 类型 :param utils: 网络工具类 - def build(sel...
6fd35c0c789aaa43130de46d4c04622ec2948052
<|skeleton|> class LSTM: """LSTM 网络实现""" def __init__(self, model_conf: ModelConfig, inputs: tf.Tensor, utils: NetworkUtils): """:param model_conf: 配置 :param inputs: 网络上一层输入 tf.keras.layers.Input / tf.Tensor 类型 :param utils: 网络工具类""" <|body_0|> def build(self): """循环层构建参数 :return: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LSTM: """LSTM 网络实现""" def __init__(self, model_conf: ModelConfig, inputs: tf.Tensor, utils: NetworkUtils): """:param model_conf: 配置 :param inputs: 网络上一层输入 tf.keras.layers.Input / tf.Tensor 类型 :param utils: 网络工具类""" self.model_conf = model_conf self.inputs = inputs self.uti...
the_stack_v2_python_sparse
network/LSTM.py
kerlomz/captcha_trainer
train
2,977
515d16b24900962ac4e292d3fe86f9e48481ba01
[ "self.filtering_policy = filtering_policy\nself.group_backup_params = group_backup_params\nself.onedrive_backup_params = onedrive_backup_params\nself.outlook_backup_params = outlook_backup_params\nself.public_folders_backup_params = public_folders_backup_params\nself.site_backup_params = site_backup_params\nself.te...
<|body_start_0|> self.filtering_policy = filtering_policy self.group_backup_params = group_backup_params self.onedrive_backup_params = onedrive_backup_params self.outlook_backup_params = outlook_backup_params self.public_folders_backup_params = public_folders_backup_params ...
Implementation of the 'O365BackupEnvParams' model. Message to capture any additional backup params for Office365 environment. This encapsulates both Outlook & OneDrive backup parameters. Attributes: filtering_policy (FilteringPolicyProto): This field has been deprecated. Use 'filtering_policy' specified within 'outlook...
O365BackupEnvParams
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class O365BackupEnvParams: """Implementation of the 'O365BackupEnvParams' model. Message to capture any additional backup params for Office365 environment. This encapsulates both Outlook & OneDrive backup parameters. Attributes: filtering_policy (FilteringPolicyProto): This field has been deprecated. U...
stack_v2_sparse_classes_36k_train_022368
5,762
permissive
[ { "docstring": "Constructor for the O365BackupEnvParams class", "name": "__init__", "signature": "def __init__(self, filtering_policy=None, group_backup_params=None, onedrive_backup_params=None, outlook_backup_params=None, public_folders_backup_params=None, site_backup_params=None, teams_backup_params=N...
2
stack_v2_sparse_classes_30k_train_019273
Implement the Python class `O365BackupEnvParams` described below. Class description: Implementation of the 'O365BackupEnvParams' model. Message to capture any additional backup params for Office365 environment. This encapsulates both Outlook & OneDrive backup parameters. Attributes: filtering_policy (FilteringPolicyPr...
Implement the Python class `O365BackupEnvParams` described below. Class description: Implementation of the 'O365BackupEnvParams' model. Message to capture any additional backup params for Office365 environment. This encapsulates both Outlook & OneDrive backup parameters. Attributes: filtering_policy (FilteringPolicyPr...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class O365BackupEnvParams: """Implementation of the 'O365BackupEnvParams' model. Message to capture any additional backup params for Office365 environment. This encapsulates both Outlook & OneDrive backup parameters. Attributes: filtering_policy (FilteringPolicyProto): This field has been deprecated. U...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class O365BackupEnvParams: """Implementation of the 'O365BackupEnvParams' model. Message to capture any additional backup params for Office365 environment. This encapsulates both Outlook & OneDrive backup parameters. Attributes: filtering_policy (FilteringPolicyProto): This field has been deprecated. Use 'filtering...
the_stack_v2_python_sparse
cohesity_management_sdk/models/o_365_backup_env_params.py
cohesity/management-sdk-python
train
24
15f39eab02c2098df36033b90b43c0ea373a7cd1
[ "n = len(prices)\ndp = [[0, -prices[0]]] + [[0, 0] for _ in range(n - 1)]\nfor i in range(1, n):\n dp[i][0] = max(dp[i - 1][0], dp[i - 1][1] + prices[i] - fee)\n dp[i][1] = max(dp[i - 1][1], dp[i - 1][0] - prices[i])\nreturn dp[-1][0]", "if not prices:\n return 0\nn = len(prices)\ndp0 = 0\ndp1 = -prices[...
<|body_start_0|> n = len(prices) dp = [[0, -prices[0]]] + [[0, 0] for _ in range(n - 1)] for i in range(1, n): dp[i][0] = max(dp[i - 1][0], dp[i - 1][1] + prices[i] - fee) dp[i][1] = max(dp[i - 1][1], dp[i - 1][0] - prices[i]) return dp[-1][0] <|end_body_0|> <|bo...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, prices, fee): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfit(self, prices, fee): """:type prices: List[int] :type fee: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(prices) ...
stack_v2_sparse_classes_36k_train_022369
1,003
no_license
[ { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfit", "signature": "def maxProfit(self, prices, fee)" }, { "docstring": ":type prices: List[int] :type fee: int :rtype: int", "name": "maxProfit", "signature": "def maxProfit(self, prices, fee)" } ]
2
stack_v2_sparse_classes_30k_train_003131
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices, fee): :type prices: List[int] :rtype: int - def maxProfit(self, prices, fee): :type prices: List[int] :type fee: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices, fee): :type prices: List[int] :rtype: int - def maxProfit(self, prices, fee): :type prices: List[int] :type fee: int :rtype: int <|skeleton|> class S...
a509b383a42f54313970168d9faa11f088f18708
<|skeleton|> class Solution: def maxProfit(self, prices, fee): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfit(self, prices, fee): """:type prices: List[int] :type fee: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit(self, prices, fee): """:type prices: List[int] :rtype: int""" n = len(prices) dp = [[0, -prices[0]]] + [[0, 0] for _ in range(n - 1)] for i in range(1, n): dp[i][0] = max(dp[i - 1][0], dp[i - 1][1] + prices[i] - fee) dp[i][1] = ma...
the_stack_v2_python_sparse
0714_Best_Time_to_Buy_and_Sell_Stock_with_Transaction_Fee.py
bingli8802/leetcode
train
0
92fbf799f2ec0b60b6d4439295f406e72a0598a4
[ "frequency = collections.Counter(s)\nfor i, ch in enumerate(s):\n if frequency[ch] == 1:\n return i\nreturn -1", "position = dict()\nn = len(s)\nfor i, ch in enumerate(s):\n if ch in position:\n position[ch] = -1\n else:\n position[ch] = i\nfirst = n\nfor pos in position.values():\n ...
<|body_start_0|> frequency = collections.Counter(s) for i, ch in enumerate(s): if frequency[ch] == 1: return i return -1 <|end_body_0|> <|body_start_1|> position = dict() n = len(s) for i, ch in enumerate(s): if ch in position: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def firstUniqChar(self, s): """:type s: str :rtype: int 使用哈希表存储频数 第一次遍历:统计字符串每个字符出现的次数 第二次遍历:找第一个只出现一次的字符 时间击败36.91%,内存击败54.02%""" <|body_0|> def firstUniqChar1(self, s): """:type s: str :rtype: int 使用哈希表存储索引 具体地,对于哈希映射中的每一个键值对,键表示一个字符,值表示它的首次出现的索引(如果该字符只出现...
stack_v2_sparse_classes_36k_train_022370
3,916
no_license
[ { "docstring": ":type s: str :rtype: int 使用哈希表存储频数 第一次遍历:统计字符串每个字符出现的次数 第二次遍历:找第一个只出现一次的字符 时间击败36.91%,内存击败54.02%", "name": "firstUniqChar", "signature": "def firstUniqChar(self, s)" }, { "docstring": ":type s: str :rtype: int 使用哈希表存储索引 具体地,对于哈希映射中的每一个键值对,键表示一个字符,值表示它的首次出现的索引(如果该字符只出现一次)或者 -1(如果该...
3
stack_v2_sparse_classes_30k_train_004975
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def firstUniqChar(self, s): :type s: str :rtype: int 使用哈希表存储频数 第一次遍历:统计字符串每个字符出现的次数 第二次遍历:找第一个只出现一次的字符 时间击败36.91%,内存击败54.02% - def firstUniqChar1(self, s): :type s: str :rtype: i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def firstUniqChar(self, s): :type s: str :rtype: int 使用哈希表存储频数 第一次遍历:统计字符串每个字符出现的次数 第二次遍历:找第一个只出现一次的字符 时间击败36.91%,内存击败54.02% - def firstUniqChar1(self, s): :type s: str :rtype: i...
2dc982e690b153c33bc7e27a63604f754a0df90c
<|skeleton|> class Solution: def firstUniqChar(self, s): """:type s: str :rtype: int 使用哈希表存储频数 第一次遍历:统计字符串每个字符出现的次数 第二次遍历:找第一个只出现一次的字符 时间击败36.91%,内存击败54.02%""" <|body_0|> def firstUniqChar1(self, s): """:type s: str :rtype: int 使用哈希表存储索引 具体地,对于哈希映射中的每一个键值对,键表示一个字符,值表示它的首次出现的索引(如果该字符只出现...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def firstUniqChar(self, s): """:type s: str :rtype: int 使用哈希表存储频数 第一次遍历:统计字符串每个字符出现的次数 第二次遍历:找第一个只出现一次的字符 时间击败36.91%,内存击败54.02%""" frequency = collections.Counter(s) for i, ch in enumerate(s): if frequency[ch] == 1: return i return -1 ...
the_stack_v2_python_sparse
387_first-unique-character-in-a-string.py
95275059/Algorithm
train
0
90632c3b9b52636363679c8089bf38ba0b2af845
[ "topic = model.Topic(18, 'New Topic')\nactual = json.loads(json.dumps(topic, cls=codec.TopicEncoder))\nexpected = [18, 'New Topic']\nself.assertEqual(expected, actual)", "ts = datetime.datetime(2018, 1, 1)\ndatum = model.Datum(ts, 18, 'value')\nactual = json.loads(json.dumps(datum, cls=codec.DatumEncoder))\nexpec...
<|body_start_0|> topic = model.Topic(18, 'New Topic') actual = json.loads(json.dumps(topic, cls=codec.TopicEncoder)) expected = [18, 'New Topic'] self.assertEqual(expected, actual) <|end_body_0|> <|body_start_1|> ts = datetime.datetime(2018, 1, 1) datum = model.Datum(ts,...
A test case for codec operations.
CodecTestCase
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CodecTestCase: """A test case for codec operations.""" def test_encode_topic(self): """Encodes a Topic object and ensures it has the correct representation.""" <|body_0|> def test_encode_datum(self): """Encodes a Datum object and ensures it has the correct repres...
stack_v2_sparse_classes_36k_train_022371
826
permissive
[ { "docstring": "Encodes a Topic object and ensures it has the correct representation.", "name": "test_encode_topic", "signature": "def test_encode_topic(self)" }, { "docstring": "Encodes a Datum object and ensures it has the correct representation.", "name": "test_encode_datum", "signatu...
2
stack_v2_sparse_classes_30k_train_019820
Implement the Python class `CodecTestCase` described below. Class description: A test case for codec operations. Method signatures and docstrings: - def test_encode_topic(self): Encodes a Topic object and ensures it has the correct representation. - def test_encode_datum(self): Encodes a Datum object and ensures it h...
Implement the Python class `CodecTestCase` described below. Class description: A test case for codec operations. Method signatures and docstrings: - def test_encode_topic(self): Encodes a Topic object and ensures it has the correct representation. - def test_encode_datum(self): Encodes a Datum object and ensures it h...
cbdf9294c4851ed6bd3e0a19f86eb7518df45c15
<|skeleton|> class CodecTestCase: """A test case for codec operations.""" def test_encode_topic(self): """Encodes a Topic object and ensures it has the correct representation.""" <|body_0|> def test_encode_datum(self): """Encodes a Datum object and ensures it has the correct repres...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CodecTestCase: """A test case for codec operations.""" def test_encode_topic(self): """Encodes a Topic object and ensures it has the correct representation.""" topic = model.Topic(18, 'New Topic') actual = json.loads(json.dumps(topic, cls=codec.TopicEncoder)) expected = [1...
the_stack_v2_python_sparse
src/server/codec_test.py
jerome9189/lotus-leaf
train
0
ab41fba5735d6d5dab5bc81ad7195ca1a2f5bdf5
[ "__facets = {}\nfaceted_search_query_params = [item.split(',') for item in self.get_faceted_search_query_params(request)]\nfaceted_search_query_params = [item for sublist in faceted_search_query_params for item in sublist]\nfaceted_search_fields = self.prepare_faceted_search_fields(view)\nfor __field, __options in ...
<|body_start_0|> __facets = {} faceted_search_query_params = [item.split(',') for item in self.get_faceted_search_query_params(request)] faceted_search_query_params = [item for sublist in faceted_search_query_params for item in sublist] faceted_search_fields = self.prepare_faceted_search...
CAPFacetedSearchFilterBackend
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CAPFacetedSearchFilterBackend: def construct_facets(self, request, view): """Construct facets structure.""" <|body_0|> def aggregate(self, request, queryset, view): """Generate field aggregations. Supports 3 parallel aggs and 2 sub-aggregations""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_022372
29,625
permissive
[ { "docstring": "Construct facets structure.", "name": "construct_facets", "signature": "def construct_facets(self, request, view)" }, { "docstring": "Generate field aggregations. Supports 3 parallel aggs and 2 sub-aggregations", "name": "aggregate", "signature": "def aggregate(self, requ...
2
null
Implement the Python class `CAPFacetedSearchFilterBackend` described below. Class description: Implement the CAPFacetedSearchFilterBackend class. Method signatures and docstrings: - def construct_facets(self, request, view): Construct facets structure. - def aggregate(self, request, queryset, view): Generate field ag...
Implement the Python class `CAPFacetedSearchFilterBackend` described below. Class description: Implement the CAPFacetedSearchFilterBackend class. Method signatures and docstrings: - def construct_facets(self, request, view): Construct facets structure. - def aggregate(self, request, queryset, view): Generate field ag...
bec56eaa4bfb62a44260e85cf76b421172de10e0
<|skeleton|> class CAPFacetedSearchFilterBackend: def construct_facets(self, request, view): """Construct facets structure.""" <|body_0|> def aggregate(self, request, queryset, view): """Generate field aggregations. Supports 3 parallel aggs and 2 sub-aggregations""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CAPFacetedSearchFilterBackend: def construct_facets(self, request, view): """Construct facets structure.""" __facets = {} faceted_search_query_params = [item.split(',') for item in self.get_faceted_search_query_params(request)] faceted_search_query_params = [item for sublist in...
the_stack_v2_python_sparse
capstone/capapi/filters.py
harvard-lil/capstone
train
153
16ee59bd2aa7907a32a8c635c5f27a1f27830b51
[ "raw_df = pd.read_csv(os.path.join(_TEST_DATA_DIR, 'test_industry_tiny_raw.csv'), index_col=0)\nclean_df = pd.read_csv(os.path.join(_TEST_DATA_DIR, 'test_industry_tiny_cleaned.csv'), index_col=0)\nloader = import_industry_data_and_gen_mcf.StateGDPIndustryDataLoader()\nloader.process_data(raw_df)\npd.testing.assert_...
<|body_start_0|> raw_df = pd.read_csv(os.path.join(_TEST_DATA_DIR, 'test_industry_tiny_raw.csv'), index_col=0) clean_df = pd.read_csv(os.path.join(_TEST_DATA_DIR, 'test_industry_tiny_cleaned.csv'), index_col=0) loader = import_industry_data_and_gen_mcf.StateGDPIndustryDataLoader() loader...
USStateQuarterlyPerIndustryImportTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class USStateQuarterlyPerIndustryImportTest: def test_data_processing_tiny(self): """Tests end-to-end data cleaning on a tiny example.""" <|body_0|> def test_value_converter(self): """Tests value converter function that cleans out empty datapoints.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_022373
5,596
permissive
[ { "docstring": "Tests end-to-end data cleaning on a tiny example.", "name": "test_data_processing_tiny", "signature": "def test_data_processing_tiny(self)" }, { "docstring": "Tests value converter function that cleans out empty datapoints.", "name": "test_value_converter", "signature": "...
3
stack_v2_sparse_classes_30k_train_000483
Implement the Python class `USStateQuarterlyPerIndustryImportTest` described below. Class description: Implement the USStateQuarterlyPerIndustryImportTest class. Method signatures and docstrings: - def test_data_processing_tiny(self): Tests end-to-end data cleaning on a tiny example. - def test_value_converter(self):...
Implement the Python class `USStateQuarterlyPerIndustryImportTest` described below. Class description: Implement the USStateQuarterlyPerIndustryImportTest class. Method signatures and docstrings: - def test_data_processing_tiny(self): Tests end-to-end data cleaning on a tiny example. - def test_value_converter(self):...
6b32c869f426a8a5ba1b99edd324cc0c77bbd4ad
<|skeleton|> class USStateQuarterlyPerIndustryImportTest: def test_data_processing_tiny(self): """Tests end-to-end data cleaning on a tiny example.""" <|body_0|> def test_value_converter(self): """Tests value converter function that cleans out empty datapoints.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class USStateQuarterlyPerIndustryImportTest: def test_data_processing_tiny(self): """Tests end-to-end data cleaning on a tiny example.""" raw_df = pd.read_csv(os.path.join(_TEST_DATA_DIR, 'test_industry_tiny_raw.csv'), index_col=0) clean_df = pd.read_csv(os.path.join(_TEST_DATA_DIR, 'test_in...
the_stack_v2_python_sparse
scripts/us_bea/states_gdp/import_data_test.py
wh1210/data
train
1
c690f04d34cf9034ee392b95d5be9bea2c2fd52a
[ "now = timezone.now()\nif not username:\n raise ValueError('Users must have an username')\nuser = self.model(username=username, is_staff=False, is_active=True, last_login=now, date_joined=now)\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user", "user = self.create_user(self, username, passwo...
<|body_start_0|> now = timezone.now() if not username: raise ValueError('Users must have an username') user = self.model(username=username, is_staff=False, is_active=True, last_login=now, date_joined=now) user.set_password(password) user.save(using=self._db) r...
MyUserManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyUserManager: def create_user(self, username, password=None, **extra_fields): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, username, password, **extra_fields): """Creates and saves a superuser...
stack_v2_sparse_classes_36k_train_022374
2,422
no_license
[ { "docstring": "Creates and saves a User with the given email, date of birth and password.", "name": "create_user", "signature": "def create_user(self, username, password=None, **extra_fields)" }, { "docstring": "Creates and saves a superuser with the given email, date of birth and password.", ...
2
stack_v2_sparse_classes_30k_train_000660
Implement the Python class `MyUserManager` described below. Class description: Implement the MyUserManager class. Method signatures and docstrings: - def create_user(self, username, password=None, **extra_fields): Creates and saves a User with the given email, date of birth and password. - def create_superuser(self, ...
Implement the Python class `MyUserManager` described below. Class description: Implement the MyUserManager class. Method signatures and docstrings: - def create_user(self, username, password=None, **extra_fields): Creates and saves a User with the given email, date of birth and password. - def create_superuser(self, ...
301a011e42d01544aa8ab0420d3212c549f3454b
<|skeleton|> class MyUserManager: def create_user(self, username, password=None, **extra_fields): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, username, password, **extra_fields): """Creates and saves a superuser...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyUserManager: def create_user(self, username, password=None, **extra_fields): """Creates and saves a User with the given email, date of birth and password.""" now = timezone.now() if not username: raise ValueError('Users must have an username') user = self.model(us...
the_stack_v2_python_sparse
users/models.py
GeoEDGE/cfr_web
train
1
59f59cd7eb4b35fc744f32446aa13862591a5c89
[ "configurations = g.user.get_api().get_configurations()\nresult = [config_entity.to_json() for config_entity in configurations]\nreturn jsonify(result)", "data = entity_parser.parse_args()\nconfiguration = g.user.get_api().create_configuration(data['name'])\nresult = configuration.to_json()\nreturn (result, 201)"...
<|body_start_0|> configurations = g.user.get_api().get_configurations() result = [config_entity.to_json() for config_entity in configurations] return jsonify(result) <|end_body_0|> <|body_start_1|> data = entity_parser.parse_args() configuration = g.user.get_api().create_configu...
ConfigurationCollection
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConfigurationCollection: def get(self): """Get all known Configuration(s).""" <|body_0|> def post(self): """Create a new Configuration.""" <|body_1|> <|end_skeleton|> <|body_start_0|> configurations = g.user.get_api().get_configurations() re...
stack_v2_sparse_classes_36k_train_022375
4,125
permissive
[ { "docstring": "Get all known Configuration(s).", "name": "get", "signature": "def get(self)" }, { "docstring": "Create a new Configuration.", "name": "post", "signature": "def post(self)" } ]
2
null
Implement the Python class `ConfigurationCollection` described below. Class description: Implement the ConfigurationCollection class. Method signatures and docstrings: - def get(self): Get all known Configuration(s). - def post(self): Create a new Configuration.
Implement the Python class `ConfigurationCollection` described below. Class description: Implement the ConfigurationCollection class. Method signatures and docstrings: - def get(self): Get all known Configuration(s). - def post(self): Create a new Configuration. <|skeleton|> class ConfigurationCollection: def g...
60b36434e689c3ef852ab388ca2aae370e70c62d
<|skeleton|> class ConfigurationCollection: def get(self): """Get all known Configuration(s).""" <|body_0|> def post(self): """Create a new Configuration.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConfigurationCollection: def get(self): """Get all known Configuration(s).""" configurations = g.user.get_api().get_configurations() result = [config_entity.to_json() for config_entity in configurations] return jsonify(result) def post(self): """Create a new Config...
the_stack_v2_python_sparse
Community/rest_api/configuration_page.py
bluecatlabs/gateway-workflows
train
45
0be74045a24d09229d4fca41adf39440918f678f
[ "self.word_dict = word_dict\nself.word_list = word_list\nself.id1 = id1\nself.id2 = id2\nself.vocab = list(word_dict.keys())\nself.embd = list(word_dict.values())\nself.vocab_size = len(self.vocab)\nprint('Attention! Your dim should be consistent with your word2vec model!')\nself.embedding_dim = dim", "train_set ...
<|body_start_0|> self.word_dict = word_dict self.word_list = word_list self.id1 = id1 self.id2 = id2 self.vocab = list(word_dict.keys()) self.embd = list(word_dict.values()) self.vocab_size = len(self.vocab) print('Attention! Your dim should be consistent ...
Contruction of word dictionary mapping for embedding layers paras: word_dict: trained word dictionary, mapping word to a unique vector word_list: a list of each sample that contains a list of words
construction
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class construction: """Contruction of word dictionary mapping for embedding layers paras: word_dict: trained word dictionary, mapping word to a unique vector word_list: a list of each sample that contains a list of words""" def __init__(self, word_dict, word_list, dim, id1, id2): """id1,id...
stack_v2_sparse_classes_36k_train_022376
4,629
no_license
[ { "docstring": "id1,id2: index list of separated set dim: embedding vector dimension, determined by word2vec model", "name": "__init__", "signature": "def __init__(self, word_dict, word_list, dim, id1, id2)" }, { "docstring": "Build dictionary and reversed dictionary to map integer to word The i...
4
stack_v2_sparse_classes_30k_test_000932
Implement the Python class `construction` described below. Class description: Contruction of word dictionary mapping for embedding layers paras: word_dict: trained word dictionary, mapping word to a unique vector word_list: a list of each sample that contains a list of words Method signatures and docstrings: - def __...
Implement the Python class `construction` described below. Class description: Contruction of word dictionary mapping for embedding layers paras: word_dict: trained word dictionary, mapping word to a unique vector word_list: a list of each sample that contains a list of words Method signatures and docstrings: - def __...
f47a809a6da5346abc349c3c0ba70e649872a0f0
<|skeleton|> class construction: """Contruction of word dictionary mapping for embedding layers paras: word_dict: trained word dictionary, mapping word to a unique vector word_list: a list of each sample that contains a list of words""" def __init__(self, word_dict, word_list, dim, id1, id2): """id1,id...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class construction: """Contruction of word dictionary mapping for embedding layers paras: word_dict: trained word dictionary, mapping word to a unique vector word_list: a list of each sample that contains a list of words""" def __init__(self, word_dict, word_list, dim, id1, id2): """id1,id2: index list...
the_stack_v2_python_sparse
LSTM (NLP)/construction.py
Niyu-Jia/Reports
train
0
b83f88dfafeef9bf209020cb5a55494ad9ca1099
[ "super(RNN, self).__init__()\nself.emb = nn.Embedding(vocab_size, emb_size)\nself.rnn = nn.RNN(emb_size, hidden_size, num_layers=num_layers, nonlinearity=nonlinearity, dropout=dropout, bidirectional=bidirectional)\nself.fc = nn.Linear(hidden_size, num_classes)", "x = self.emb(x)\nx = x.transpose(0, 1)\nout, hidde...
<|body_start_0|> super(RNN, self).__init__() self.emb = nn.Embedding(vocab_size, emb_size) self.rnn = nn.RNN(emb_size, hidden_size, num_layers=num_layers, nonlinearity=nonlinearity, dropout=dropout, bidirectional=bidirectional) self.fc = nn.Linear(hidden_size, num_classes) <|end_body_0|>...
RNN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RNN: def __init__(self, vocab_size, emb_size, hidden_size, num_classes, num_layers=num_layers, nonlinearity=nonlinearity, dropout=dropout, bidirectional=bidirectional): """@doc: RNN 模型细节 @author: Alpaca-Man @date: 2021/2/9 @param: { vocab_size: 单词个数 emb_size: 词嵌入维度 hidden_size: 隐藏层维度 num...
stack_v2_sparse_classes_36k_train_022377
2,172
no_license
[ { "docstring": "@doc: RNN 模型细节 @author: Alpaca-Man @date: 2021/2/9 @param: { vocab_size: 单词个数 emb_size: 词嵌入维度 hidden_size: 隐藏层维度 num_classes: 标签种类数量 num_layers: RNN 层数 nonlinearity: 激活函数 dropout: 失活率 bidirectional: RNN 是否双向 } @return: { }", "name": "__init__", "signature": "def __init__(self, vocab_size...
2
stack_v2_sparse_classes_30k_train_002421
Implement the Python class `RNN` described below. Class description: Implement the RNN class. Method signatures and docstrings: - def __init__(self, vocab_size, emb_size, hidden_size, num_classes, num_layers=num_layers, nonlinearity=nonlinearity, dropout=dropout, bidirectional=bidirectional): @doc: RNN 模型细节 @author: ...
Implement the Python class `RNN` described below. Class description: Implement the RNN class. Method signatures and docstrings: - def __init__(self, vocab_size, emb_size, hidden_size, num_classes, num_layers=num_layers, nonlinearity=nonlinearity, dropout=dropout, bidirectional=bidirectional): @doc: RNN 模型细节 @author: ...
49824925970f0439634dc66a7f19edc512f18a5f
<|skeleton|> class RNN: def __init__(self, vocab_size, emb_size, hidden_size, num_classes, num_layers=num_layers, nonlinearity=nonlinearity, dropout=dropout, bidirectional=bidirectional): """@doc: RNN 模型细节 @author: Alpaca-Man @date: 2021/2/9 @param: { vocab_size: 单词个数 emb_size: 词嵌入维度 hidden_size: 隐藏层维度 num...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RNN: def __init__(self, vocab_size, emb_size, hidden_size, num_classes, num_layers=num_layers, nonlinearity=nonlinearity, dropout=dropout, bidirectional=bidirectional): """@doc: RNN 模型细节 @author: Alpaca-Man @date: 2021/2/9 @param: { vocab_size: 单词个数 emb_size: 词嵌入维度 hidden_size: 隐藏层维度 num_classes: 标签种类...
the_stack_v2_python_sparse
RNN/standard/RNN.py
Alpaca-Man/NLP-Newcomer
train
1
e14b7ff53768410a1ccbbd0cff729ec7628d8e3c
[ "self = object.__new__(cls)\nself.handler = handler\nreturn self", "if event.user is not event.message.interaction.user:\n return\nimage_detail = await self.handler.get_image(client, event)\nembed = build_waifu_embed(image_detail)\nif event.is_unanswered():\n function = type(client).interaction_component_me...
<|body_start_0|> self = object.__new__(cls) self.handler = handler return self <|end_body_0|> <|body_start_1|> if event.user is not event.message.interaction.user: return image_detail = await self.handler.get_image(client, event) embed = build_waifu_embed(ima...
Represents a component command used to renew a waifu. Attributes ---------- handler : ``ImageHandlerWaifuPics`` The handler to use.
NewWaifu
[ "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NewWaifu: """Represents a component command used to renew a waifu. Attributes ---------- handler : ``ImageHandlerWaifuPics`` The handler to use.""" def __new__(cls, handler): """Creates a new waifu renewer. Parameters ---------- handler : ``ImageHandlerWaifuPics`` The handler to use....
stack_v2_sparse_classes_36k_train_022378
4,826
no_license
[ { "docstring": "Creates a new waifu renewer. Parameters ---------- handler : ``ImageHandlerWaifuPics`` The handler to use.", "name": "__new__", "signature": "def __new__(cls, handler)" }, { "docstring": "Calls the waifu renew component command. This method is a coroutine. Parameters ---------- c...
2
null
Implement the Python class `NewWaifu` described below. Class description: Represents a component command used to renew a waifu. Attributes ---------- handler : ``ImageHandlerWaifuPics`` The handler to use. Method signatures and docstrings: - def __new__(cls, handler): Creates a new waifu renewer. Parameters ---------...
Implement the Python class `NewWaifu` described below. Class description: Represents a component command used to renew a waifu. Attributes ---------- handler : ``ImageHandlerWaifuPics`` The handler to use. Method signatures and docstrings: - def __new__(cls, handler): Creates a new waifu renewer. Parameters ---------...
74f92b598e86606ea3a269311316cddd84a5215f
<|skeleton|> class NewWaifu: """Represents a component command used to renew a waifu. Attributes ---------- handler : ``ImageHandlerWaifuPics`` The handler to use.""" def __new__(cls, handler): """Creates a new waifu renewer. Parameters ---------- handler : ``ImageHandlerWaifuPics`` The handler to use....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NewWaifu: """Represents a component command used to renew a waifu. Attributes ---------- handler : ``ImageHandlerWaifuPics`` The handler to use.""" def __new__(cls, handler): """Creates a new waifu renewer. Parameters ---------- handler : ``ImageHandlerWaifuPics`` The handler to use.""" s...
the_stack_v2_python_sparse
koishi/plugins/image_handling_commands/waifus/waifu.py
HuyaneMatsu/Koishi
train
17
98dd2b184bbfe2fcf26fa4d033ee2db1c859827f
[ "print('Incoming get')\nprint(request.data)\ndata = {'headers': {'content-type': 'application/json'}, 'body': [{'id': '2checkoutcom', 'name': '2Checkout.com', 'checkoutUrl': 'https://sleeky-pay.netlify.app/index.html'}]}\nreturn Response(data)", "print('Incoming post')\nprint(request.data)\ndata = [{'id': '2check...
<|body_start_0|> print('Incoming get') print(request.data) data = {'headers': {'content-type': 'application/json'}, 'body': [{'id': '2checkoutcom', 'name': '2Checkout.com', 'checkoutUrl': 'https://sleeky-pay.netlify.app/index.html'}]} return Response(data) <|end_body_0|> <|body_start_1|...
* Requires token authentication.
PaymentMethods
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PaymentMethods: """* Requires token authentication.""" def get(self, request, format=None): """Docs""" <|body_0|> def post(self, request, format=None): """Docs""" <|body_1|> <|end_skeleton|> <|body_start_0|> print('Incoming get') print(r...
stack_v2_sparse_classes_36k_train_022379
5,024
no_license
[ { "docstring": "Docs", "name": "get", "signature": "def get(self, request, format=None)" }, { "docstring": "Docs", "name": "post", "signature": "def post(self, request, format=None)" } ]
2
stack_v2_sparse_classes_30k_train_002782
Implement the Python class `PaymentMethods` described below. Class description: * Requires token authentication. Method signatures and docstrings: - def get(self, request, format=None): Docs - def post(self, request, format=None): Docs
Implement the Python class `PaymentMethods` described below. Class description: * Requires token authentication. Method signatures and docstrings: - def get(self, request, format=None): Docs - def post(self, request, format=None): Docs <|skeleton|> class PaymentMethods: """* Requires token authentication.""" ...
d1ba4723c0ee8774ed70b8a1d163d10b3dcef28e
<|skeleton|> class PaymentMethods: """* Requires token authentication.""" def get(self, request, format=None): """Docs""" <|body_0|> def post(self, request, format=None): """Docs""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PaymentMethods: """* Requires token authentication.""" def get(self, request, format=None): """Docs""" print('Incoming get') print(request.data) data = {'headers': {'content-type': 'application/json'}, 'body': [{'id': '2checkoutcom', 'name': '2Checkout.com', 'checkoutUrl':...
the_stack_v2_python_sparse
meshhairline/app.py
LogicalAddress/meshhairline
train
0
2160098717c80bbdc391e6f6db963c907ee71c97
[ "self.sbml = sbml\nself.r = RoadRunner(sbml)\nself.time_start = time_start\nself.time_end = time_end\nself.n = n\nself.r.selections = ['time'] + measured_quantities\nself.measured_quantities = measured_quantities\nself.param_list = param_list\nself.setParameterVector(reference_param_values)\nsim = self.r.simulate(t...
<|body_start_0|> self.sbml = sbml self.r = RoadRunner(sbml) self.time_start = time_start self.time_end = time_end self.n = n self.r.selections = ['time'] + measured_quantities self.measured_quantities = measured_quantities self.param_list = param_list ...
Validates convergence to a given set of parameters. Generates datapoints on a grid for measured_quantities.
TimecourseSimValidate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimecourseSimValidate: """Validates convergence to a given set of parameters. Generates datapoints on a grid for measured_quantities.""" def __init__(self, sbml, measured_quantities, param_list, reference_param_values, time_start, time_end, n): """Constructor. :param measured_quantit...
stack_v2_sparse_classes_36k_train_022380
3,068
no_license
[ { "docstring": "Constructor. :param measured_quantities: A list of the measured quantities. :param reference_param_values: The vector of parameter values in the reference state. :param time_start: Start time of the simulation. :param time_end: End time of the simulation. :param n: Number of intervals/points in ...
2
stack_v2_sparse_classes_30k_train_008847
Implement the Python class `TimecourseSimValidate` described below. Class description: Validates convergence to a given set of parameters. Generates datapoints on a grid for measured_quantities. Method signatures and docstrings: - def __init__(self, sbml, measured_quantities, param_list, reference_param_values, time_...
Implement the Python class `TimecourseSimValidate` described below. Class description: Validates convergence to a given set of parameters. Generates datapoints on a grid for measured_quantities. Method signatures and docstrings: - def __init__(self, sbml, measured_quantities, param_list, reference_param_values, time_...
0e4dba7ed8bbb8f1f8e0c8f7fc5d02e7fc3a2f73
<|skeleton|> class TimecourseSimValidate: """Validates convergence to a given set of parameters. Generates datapoints on a grid for measured_quantities.""" def __init__(self, sbml, measured_quantities, param_list, reference_param_values, time_start, time_end, n): """Constructor. :param measured_quantit...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TimecourseSimValidate: """Validates convergence to a given set of parameters. Generates datapoints on a grid for measured_quantities.""" def __init__(self, sbml, measured_quantities, param_list, reference_param_values, time_start, time_end, n): """Constructor. :param measured_quantities: A list o...
the_stack_v2_python_sparse
sabaody/timecourse/timecourse_sim_validate.py
distrib-dyn-modeling/sabaody
train
2
b2c9713d6bf1875145f87a41aaf70205e2b0f394
[ "assert isinstance(block_string, str)\nops = block_string.split('_')\noptions = {}\nfor op in ops:\n splits = re.split('(\\\\d.*)', op)\n if len(splits) >= 2:\n key, value = splits[:2]\n options[key] = value\nassert 's' in options and len(options['s']) == 1 or (len(options['s']) == 2 and options...
<|body_start_0|> assert isinstance(block_string, str) ops = block_string.split('_') options = {} for op in ops: splits = re.split('(\\d.*)', op) if len(splits) >= 2: key, value = splits[:2] options[key] = value assert 's' in...
Block Decoder for readability, straight from the official TensorFlow repository
BlockDecoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BlockDecoder: """Block Decoder for readability, straight from the official TensorFlow repository""" def _decode_block_string(block_string): """Gets a block through a string notation of arguments.""" <|body_0|> def _encode_block_string(block): """Encodes a block t...
stack_v2_sparse_classes_36k_train_022381
48,558
no_license
[ { "docstring": "Gets a block through a string notation of arguments.", "name": "_decode_block_string", "signature": "def _decode_block_string(block_string)" }, { "docstring": "Encodes a block to a string.", "name": "_encode_block_string", "signature": "def _encode_block_string(block)" ...
4
stack_v2_sparse_classes_30k_train_004298
Implement the Python class `BlockDecoder` described below. Class description: Block Decoder for readability, straight from the official TensorFlow repository Method signatures and docstrings: - def _decode_block_string(block_string): Gets a block through a string notation of arguments. - def _encode_block_string(bloc...
Implement the Python class `BlockDecoder` described below. Class description: Block Decoder for readability, straight from the official TensorFlow repository Method signatures and docstrings: - def _decode_block_string(block_string): Gets a block through a string notation of arguments. - def _encode_block_string(bloc...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class BlockDecoder: """Block Decoder for readability, straight from the official TensorFlow repository""" def _decode_block_string(block_string): """Gets a block through a string notation of arguments.""" <|body_0|> def _encode_block_string(block): """Encodes a block t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BlockDecoder: """Block Decoder for readability, straight from the official TensorFlow repository""" def _decode_block_string(block_string): """Gets a block through a string notation of arguments.""" assert isinstance(block_string, str) ops = block_string.split('_') options...
the_stack_v2_python_sparse
generated/test_lufficc_SSD.py
jansel/pytorch-jit-paritybench
train
35
d90dc408ad01f61ee52738a17558b2482abd13c5
[ "self.capacity = capacity\nself.lfu_cache = {}\nself.freq_table = defaultdict(OrderedDict)\nprint('Create LFU ', self.lfu_cache, ' and frequency table ', self.freq_table)\nself.minimum_freq = 0", "if key not in self.lfu_cache:\n print('Key not present: return -1')\n return -1\nprint('Get value,freq from LFU...
<|body_start_0|> self.capacity = capacity self.lfu_cache = {} self.freq_table = defaultdict(OrderedDict) print('Create LFU ', self.lfu_cache, ' and frequency table ', self.freq_table) self.minimum_freq = 0 <|end_body_0|> <|body_start_1|> if key not in self.lfu_cache: ...
LFUCache
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LFUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """Least Frequently Used. Get item from cache update its status in the cache. :type key: int :rtype: int""" <|body_1|> def put(self, key, newValue): ...
stack_v2_sparse_classes_36k_train_022382
4,935
permissive
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": "Least Frequently Used. Get item from cache update its status in the cache. :type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "...
3
stack_v2_sparse_classes_30k_train_013131
Implement the Python class `LFUCache` described below. Class description: Implement the LFUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): Least Frequently Used. Get item from cache update its status in the cache. :type key: int :rtype: int - de...
Implement the Python class `LFUCache` described below. Class description: Implement the LFUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): Least Frequently Used. Get item from cache update its status in the cache. :type key: int :rtype: int - de...
fa58835d532126c4cfb0baf4cb8d9d8a0e2703d2
<|skeleton|> class LFUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """Least Frequently Used. Get item from cache update its status in the cache. :type key: int :rtype: int""" <|body_1|> def put(self, key, newValue): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LFUCache: def __init__(self, capacity): """:type capacity: int""" self.capacity = capacity self.lfu_cache = {} self.freq_table = defaultdict(OrderedDict) print('Create LFU ', self.lfu_cache, ' and frequency table ', self.freq_table) self.minimum_freq = 0 de...
the_stack_v2_python_sparse
lfu.py
carlb15/Python
train
2
1acc594c7ec8d598563af9feb625f18acaf94ebc
[ "self.environment = environment\nself.protected_count = protected_count\nself.protected_size = protected_size\nself.unprotected_count = unprotected_count\nself.unprotected_size = unprotected_size", "if dictionary is None:\n return None\nenvironment = dictionary.get('environment')\nprotected_count = dictionary....
<|body_start_0|> self.environment = environment self.protected_count = protected_count self.protected_size = protected_size self.unprotected_count = unprotected_count self.unprotected_size = unprotected_size <|end_body_0|> <|body_start_1|> if dictionary is None: ...
Implementation of the 'Protection Summary By Environment.' model. ProtectionSummaryByEnv specifies the number of protected and unprotected objects that is break down by environment. Attributes: environment (Environment8Enum): Specifies the type of environment of the source object like kSQL etc. Supported environment ty...
ProtectionSummaryByEnvironment
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProtectionSummaryByEnvironment: """Implementation of the 'Protection Summary By Environment.' model. ProtectionSummaryByEnv specifies the number of protected and unprotected objects that is break down by environment. Attributes: environment (Environment8Enum): Specifies the type of environment of...
stack_v2_sparse_classes_36k_train_022383
5,308
permissive
[ { "docstring": "Constructor for the ProtectionSummaryByEnvironment class", "name": "__init__", "signature": "def __init__(self, environment=None, protected_count=None, protected_size=None, unprotected_count=None, unprotected_size=None)" }, { "docstring": "Creates an instance of this model from a...
2
stack_v2_sparse_classes_30k_test_000934
Implement the Python class `ProtectionSummaryByEnvironment` described below. Class description: Implementation of the 'Protection Summary By Environment.' model. ProtectionSummaryByEnv specifies the number of protected and unprotected objects that is break down by environment. Attributes: environment (Environment8Enum...
Implement the Python class `ProtectionSummaryByEnvironment` described below. Class description: Implementation of the 'Protection Summary By Environment.' model. ProtectionSummaryByEnv specifies the number of protected and unprotected objects that is break down by environment. Attributes: environment (Environment8Enum...
07c5adee58810979780679065250d82b4b2cdaab
<|skeleton|> class ProtectionSummaryByEnvironment: """Implementation of the 'Protection Summary By Environment.' model. ProtectionSummaryByEnv specifies the number of protected and unprotected objects that is break down by environment. Attributes: environment (Environment8Enum): Specifies the type of environment of...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProtectionSummaryByEnvironment: """Implementation of the 'Protection Summary By Environment.' model. ProtectionSummaryByEnv specifies the number of protected and unprotected objects that is break down by environment. Attributes: environment (Environment8Enum): Specifies the type of environment of the source o...
the_stack_v2_python_sparse
cohesity_management_sdk/models/protection_summary_by_environment.py
hemanshu-cohesity/management-sdk-python
train
0
cd3e8572e1e7bfc4607a40f4198109b33d10a843
[ "try:\n verify_token(request.headers)\nexcept Exception as err:\n ns.abort(401, message=err)\noffset = request.args.get('offset', '0')\nlimit = request.args.get('limit', '10')\norder_by = request.args.get('order_by', 'id')\norder = request.args.get('order', 'ASC')\nper_page = request.args.get('per_page', '10'...
<|body_start_0|> try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) offset = request.args.get('offset', '0') limit = request.args.get('limit', '10') order_by = request.args.get('order_by', 'id') order = request.a...
ObservacionPreAsfList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObservacionPreAsfList: def get(self): """To fetch several observations (preliminares de la ASF). On Success it returns two custom headers: X-SOA-Total-Items, X-SOA-Total-Pages""" <|body_0|> def post(self): """To create an observation (preliminar de la ASF).""" ...
stack_v2_sparse_classes_36k_train_022384
13,540
no_license
[ { "docstring": "To fetch several observations (preliminares de la ASF). On Success it returns two custom headers: X-SOA-Total-Items, X-SOA-Total-Pages", "name": "get", "signature": "def get(self)" }, { "docstring": "To create an observation (preliminar de la ASF).", "name": "post", "sign...
2
stack_v2_sparse_classes_30k_train_012381
Implement the Python class `ObservacionPreAsfList` described below. Class description: Implement the ObservacionPreAsfList class. Method signatures and docstrings: - def get(self): To fetch several observations (preliminares de la ASF). On Success it returns two custom headers: X-SOA-Total-Items, X-SOA-Total-Pages - ...
Implement the Python class `ObservacionPreAsfList` described below. Class description: Implement the ObservacionPreAsfList class. Method signatures and docstrings: - def get(self): To fetch several observations (preliminares de la ASF). On Success it returns two custom headers: X-SOA-Total-Items, X-SOA-Total-Pages - ...
e00610fac26ef3ca078fd037c0649b70fa0e9a09
<|skeleton|> class ObservacionPreAsfList: def get(self): """To fetch several observations (preliminares de la ASF). On Success it returns two custom headers: X-SOA-Total-Items, X-SOA-Total-Pages""" <|body_0|> def post(self): """To create an observation (preliminar de la ASF).""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ObservacionPreAsfList: def get(self): """To fetch several observations (preliminares de la ASF). On Success it returns two custom headers: X-SOA-Total-Items, X-SOA-Total-Pages""" try: verify_token(request.headers) except Exception as err: ns.abort(401, message=e...
the_stack_v2_python_sparse
DOS/soa/service/genl/endpoints/observaciones_pre_asf.py
Telematica/knight-rider
train
1
0663020412a55c55bb7f242ce7ff488ff02975a0
[ "self.dic = {}\nfor it in dictionary:\n if len(it) > 2:\n if not self.dic.has_key(it[0] + str(len(it) - 2) + it[-1]):\n self.dic[it[0] + str(len(it) - 2) + it[-1]] = []\n self.dic[it[0] + str(len(it) - 2) + it[-1]].append(it)\n else:\n if not self.dic.has_key(it):\n ...
<|body_start_0|> self.dic = {} for it in dictionary: if len(it) > 2: if not self.dic.has_key(it[0] + str(len(it) - 2) + it[-1]): self.dic[it[0] + str(len(it) - 2) + it[-1]] = [] self.dic[it[0] + str(len(it) - 2) + it[-1]].append(it) ...
ValidWordAbbr
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ValidWordAbbr: def __init__(self, dictionary): """initialize your data structure here. :type dictionary: List[str]""" <|body_0|> def isUnique(self, word): """check if a word is unique. :type word: str :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start...
stack_v2_sparse_classes_36k_train_022385
1,209
no_license
[ { "docstring": "initialize your data structure here. :type dictionary: List[str]", "name": "__init__", "signature": "def __init__(self, dictionary)" }, { "docstring": "check if a word is unique. :type word: str :rtype: bool", "name": "isUnique", "signature": "def isUnique(self, word)" ...
2
null
Implement the Python class `ValidWordAbbr` described below. Class description: Implement the ValidWordAbbr class. Method signatures and docstrings: - def __init__(self, dictionary): initialize your data structure here. :type dictionary: List[str] - def isUnique(self, word): check if a word is unique. :type word: str ...
Implement the Python class `ValidWordAbbr` described below. Class description: Implement the ValidWordAbbr class. Method signatures and docstrings: - def __init__(self, dictionary): initialize your data structure here. :type dictionary: List[str] - def isUnique(self, word): check if a word is unique. :type word: str ...
c904a9f653f72fb77260f0005b1e81725f966b94
<|skeleton|> class ValidWordAbbr: def __init__(self, dictionary): """initialize your data structure here. :type dictionary: List[str]""" <|body_0|> def isUnique(self, word): """check if a word is unique. :type word: str :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ValidWordAbbr: def __init__(self, dictionary): """initialize your data structure here. :type dictionary: List[str]""" self.dic = {} for it in dictionary: if len(it) > 2: if not self.dic.has_key(it[0] + str(len(it) - 2) + it[-1]): self.dic...
the_stack_v2_python_sparse
python/p288.py
chaozc/leetcode
train
0
746c707a804f672a32390500ca7669b1049848c7
[ "response = self.query_async(cat1, cat2, max_distance, colRA1=colRA1, colDec1=colDec1, colRA2=colRA2, colDec2=colDec2, area=area, cache=cache, get_query_payload=get_query_payload, **kwargs)\nif get_query_payload:\n return response\ncontent = BytesIO(response.content)\nreturn Table.read(content, format='votable',...
<|body_start_0|> response = self.query_async(cat1, cat2, max_distance, colRA1=colRA1, colDec1=colDec1, colRA2=colRA2, colDec2=colDec2, area=area, cache=cache, get_query_payload=get_query_payload, **kwargs) if get_query_payload: return response content = BytesIO(response.content) ...
XMatchClass
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XMatchClass: def query(self, cat1, cat2, max_distance, *, colRA1=None, colDec1=None, colRA2=None, colDec2=None, area='allsky', cache=True, get_query_payload=False, **kwargs): """Query the `CDS cross-match service <http://cdsxmatch.u-strasbg.fr/xmatch>`_ by finding matches between two (po...
stack_v2_sparse_classes_36k_train_022386
7,797
permissive
[ { "docstring": "Query the `CDS cross-match service <http://cdsxmatch.u-strasbg.fr/xmatch>`_ by finding matches between two (potentially big) catalogues. Parameters ---------- cat1 : str, file or `~astropy.table.Table` Identifier of the first table. It can either be a URL, the payload of a local file being uploa...
6
stack_v2_sparse_classes_30k_train_008927
Implement the Python class `XMatchClass` described below. Class description: Implement the XMatchClass class. Method signatures and docstrings: - def query(self, cat1, cat2, max_distance, *, colRA1=None, colDec1=None, colRA2=None, colDec2=None, area='allsky', cache=True, get_query_payload=False, **kwargs): Query the ...
Implement the Python class `XMatchClass` described below. Class description: Implement the XMatchClass class. Method signatures and docstrings: - def query(self, cat1, cat2, max_distance, *, colRA1=None, colDec1=None, colRA2=None, colDec2=None, area='allsky', cache=True, get_query_payload=False, **kwargs): Query the ...
51316d7417d7daf01a8b29d1df99037b9227c2bc
<|skeleton|> class XMatchClass: def query(self, cat1, cat2, max_distance, *, colRA1=None, colDec1=None, colRA2=None, colDec2=None, area='allsky', cache=True, get_query_payload=False, **kwargs): """Query the `CDS cross-match service <http://cdsxmatch.u-strasbg.fr/xmatch>`_ by finding matches between two (po...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class XMatchClass: def query(self, cat1, cat2, max_distance, *, colRA1=None, colDec1=None, colRA2=None, colDec2=None, area='allsky', cache=True, get_query_payload=False, **kwargs): """Query the `CDS cross-match service <http://cdsxmatch.u-strasbg.fr/xmatch>`_ by finding matches between two (potentially big)...
the_stack_v2_python_sparse
astroquery/xmatch/core.py
astropy/astroquery
train
636
bf592c18c0614921201e15e43d1361577d257f84
[ "if not self.head:\n self.head = Node(val)\n return self\ncur = self.head\nif not cur._next:\n cur._next = Node(val)\nwhile cur._next:\n cur = cur._next\nnew = Node(val)\ncur._next = new\nself.length += 1\nreturn self", "if self.head:\n prev = self.head\n if prev.val == val:\n self.head =...
<|body_start_0|> if not self.head: self.head = Node(val) return self cur = self.head if not cur._next: cur._next = Node(val) while cur._next: cur = cur._next new = Node(val) cur._next = new self.length += 1 r...
betterLL
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class betterLL: def append(self, val): """Appends val to tail of linked list""" <|body_0|> def insertBefore(self, val, n_val): """Inserts n_val before first occurance of val if val in linked list""" <|body_1|> def insertAfter(self, val, n_val): """Inse...
stack_v2_sparse_classes_36k_train_022387
1,649
no_license
[ { "docstring": "Appends val to tail of linked list", "name": "append", "signature": "def append(self, val)" }, { "docstring": "Inserts n_val before first occurance of val if val in linked list", "name": "insertBefore", "signature": "def insertBefore(self, val, n_val)" }, { "docst...
3
stack_v2_sparse_classes_30k_test_000104
Implement the Python class `betterLL` described below. Class description: Implement the betterLL class. Method signatures and docstrings: - def append(self, val): Appends val to tail of linked list - def insertBefore(self, val, n_val): Inserts n_val before first occurance of val if val in linked list - def insertAfte...
Implement the Python class `betterLL` described below. Class description: Implement the betterLL class. Method signatures and docstrings: - def append(self, val): Appends val to tail of linked list - def insertBefore(self, val, n_val): Inserts n_val before first occurance of val if val in linked list - def insertAfte...
21209bbc4955926c951c2abf26c79ed2ec38bc3f
<|skeleton|> class betterLL: def append(self, val): """Appends val to tail of linked list""" <|body_0|> def insertBefore(self, val, n_val): """Inserts n_val before first occurance of val if val in linked list""" <|body_1|> def insertAfter(self, val, n_val): """Inse...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class betterLL: def append(self, val): """Appends val to tail of linked list""" if not self.head: self.head = Node(val) return self cur = self.head if not cur._next: cur._next = Node(val) while cur._next: cur = cur._next ...
the_stack_v2_python_sparse
challenges/ll-find-loop/ll_insertions.py
dsnowb/data-structures-and-algorithms
train
0
f15618c6d8c42e77cf96bb7744d59afd4b7c162f
[ "if not hasattr(cls, 'serialize') or not hasattr(cls, 'deserialize'):\n raise ValueError(\"%s ObjectListProperty requires properties with 'serialize' and 'deserialize' methods\" % debug_info())\nself._cls = cls\nsuper(ObjectListProperty, self).__init__(str, *args, **kwargs)", "for item in value:\n if not is...
<|body_start_0|> if not hasattr(cls, 'serialize') or not hasattr(cls, 'deserialize'): raise ValueError("%s ObjectListProperty requires properties with 'serialize' and 'deserialize' methods" % debug_info()) self._cls = cls super(ObjectListProperty, self).__init__(str, *args, **kwargs)...
A property that stores a list of serializable class instances This is a paramaterized property; the parameter must be a class with 'serialize' and 'deserialize' methods, and all items must conform to this type Will store serialized objects of strings up to 500 characters in length. For longer strings, change line with ...
ObjectListProperty
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObjectListProperty: """A property that stores a list of serializable class instances This is a paramaterized property; the parameter must be a class with 'serialize' and 'deserialize' methods, and all items must conform to this type Will store serialized objects of strings up to 500 characters in...
stack_v2_sparse_classes_36k_train_022388
6,489
no_license
[ { "docstring": "Construct ObjectListProperty Args: cls: Class of objects in list *args: Optional additional arguments, passed to base class **kwds: Optional additional keyword arguments, passed to base class", "name": "__init__", "signature": "def __init__(self, cls, *args, **kwargs)" }, { "docs...
4
stack_v2_sparse_classes_30k_train_008103
Implement the Python class `ObjectListProperty` described below. Class description: A property that stores a list of serializable class instances This is a paramaterized property; the parameter must be a class with 'serialize' and 'deserialize' methods, and all items must conform to this type Will store serialized obj...
Implement the Python class `ObjectListProperty` described below. Class description: A property that stores a list of serializable class instances This is a paramaterized property; the parameter must be a class with 'serialize' and 'deserialize' methods, and all items must conform to this type Will store serialized obj...
def411b13e61d6e369f1629a1d9c8b45e75cd382
<|skeleton|> class ObjectListProperty: """A property that stores a list of serializable class instances This is a paramaterized property; the parameter must be a class with 'serialize' and 'deserialize' methods, and all items must conform to this type Will store serialized objects of strings up to 500 characters in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ObjectListProperty: """A property that stores a list of serializable class instances This is a paramaterized property; the parameter must be a class with 'serialize' and 'deserialize' methods, and all items must conform to this type Will store serialized objects of strings up to 500 characters in length. For ...
the_stack_v2_python_sparse
util/model.py
BarbaraEMac/Maitre-Clik
train
0
0bce3d1217790020ea1802241100b70f04afd782
[ "assert all((stddev_type in self.DEFINED_FOR_STANDARD_DEVIATION_TYPES for stddev_type in stddev_types))\nC = self.COEFFS[imt]\nmean = self._compute_mean(C, rup.mag, rup.ztor, dists.rrup)\nstddevs = self._compute_stddevs(C, rup.mag, dists.rrup.shape, stddev_types)\nreturn (mean, stddevs)", "gc0 = 0.2418\nci = 0.38...
<|body_start_0|> assert all((stddev_type in self.DEFINED_FOR_STANDARD_DEVIATION_TYPES for stddev_type in stddev_types)) C = self.COEFFS[imt] mean = self._compute_mean(C, rup.mag, rup.ztor, dists.rrup) stddevs = self._compute_stddevs(C, rup.mag, dists.rrup.shape, stddev_types) ret...
Implements GMPE for subduction intraslab events developed by Geomatrix Consultants, Inc., 1993, "Seismic margin earthquake for the Trojan site: Final unpublished report prepared for Portland General Electric Trojan Nuclear Plant", Ranier, Oregon. This class implements the equation as coded in the subroutine ``getGeom``...
Geomatrix1993SSlabNSHMP2008
[ "BSD-3-Clause", "AGPL-3.0-only" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Geomatrix1993SSlabNSHMP2008: """Implements GMPE for subduction intraslab events developed by Geomatrix Consultants, Inc., 1993, "Seismic margin earthquake for the Trojan site: Final unpublished report prepared for Portland General Electric Trojan Nuclear Plant", Ranier, Oregon. This class impleme...
stack_v2_sparse_classes_36k_train_022389
4,565
permissive
[ { "docstring": "See :meth:`superclass method <.base.GroundShakingIntensityModel.get_mean_and_stddevs>` for spec of input and result values.", "name": "get_mean_and_stddevs", "signature": "def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types)" }, { "docstring": "Compute mean value ...
3
stack_v2_sparse_classes_30k_train_020694
Implement the Python class `Geomatrix1993SSlabNSHMP2008` described below. Class description: Implements GMPE for subduction intraslab events developed by Geomatrix Consultants, Inc., 1993, "Seismic margin earthquake for the Trojan site: Final unpublished report prepared for Portland General Electric Trojan Nuclear Pla...
Implement the Python class `Geomatrix1993SSlabNSHMP2008` described below. Class description: Implements GMPE for subduction intraslab events developed by Geomatrix Consultants, Inc., 1993, "Seismic margin earthquake for the Trojan site: Final unpublished report prepared for Portland General Electric Trojan Nuclear Pla...
0da9ba5a575360081715e8b90c71d4b16c6687c8
<|skeleton|> class Geomatrix1993SSlabNSHMP2008: """Implements GMPE for subduction intraslab events developed by Geomatrix Consultants, Inc., 1993, "Seismic margin earthquake for the Trojan site: Final unpublished report prepared for Portland General Electric Trojan Nuclear Plant", Ranier, Oregon. This class impleme...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Geomatrix1993SSlabNSHMP2008: """Implements GMPE for subduction intraslab events developed by Geomatrix Consultants, Inc., 1993, "Seismic margin earthquake for the Trojan site: Final unpublished report prepared for Portland General Electric Trojan Nuclear Plant", Ranier, Oregon. This class implements the equat...
the_stack_v2_python_sparse
openquake/hazardlib/gsim/geomatrix_1993.py
GFZ-Centre-for-Early-Warning/shakyground
train
1
42530ea1614978bebd3d0074f79ca1f0e6d21a31
[ "dp = [''] * n\ndp[0] = '1'\nfor i in range(1, n):\n queue = list(dp[i - 1])\n tmp = ''\n c = 1\n while queue:\n cur = queue.pop(0)\n if queue and queue[0] == cur:\n c += 1\n else:\n tmp += str(c) + cur\n c = 1\n dp[i] = tmp\nreturn dp[n - 1]", ...
<|body_start_0|> dp = [''] * n dp[0] = '1' for i in range(1, n): queue = list(dp[i - 1]) tmp = '' c = 1 while queue: cur = queue.pop(0) if queue and queue[0] == cur: c += 1 else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countAndSay(self, n): """从左往右推 使用队列存储上一个数,然后不断删掉第一个数,直到队列删光了,使用c计数 :type n: int :rtype: str""" <|body_0|> def countAndSay3(self, n): """优化空间 :type n: int :rtype: str""" <|body_1|> def countAndSay2(self, nums): """骚方法:使用re 暂时还学不来 :pa...
stack_v2_sparse_classes_36k_train_022390
2,207
no_license
[ { "docstring": "从左往右推 使用队列存储上一个数,然后不断删掉第一个数,直到队列删光了,使用c计数 :type n: int :rtype: str", "name": "countAndSay", "signature": "def countAndSay(self, n)" }, { "docstring": "优化空间 :type n: int :rtype: str", "name": "countAndSay3", "signature": "def countAndSay3(self, n)" }, { "docstring"...
3
stack_v2_sparse_classes_30k_train_007536
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countAndSay(self, n): 从左往右推 使用队列存储上一个数,然后不断删掉第一个数,直到队列删光了,使用c计数 :type n: int :rtype: str - def countAndSay3(self, n): 优化空间 :type n: int :rtype: str - def countAndSay2(self, n...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countAndSay(self, n): 从左往右推 使用队列存储上一个数,然后不断删掉第一个数,直到队列删光了,使用c计数 :type n: int :rtype: str - def countAndSay3(self, n): 优化空间 :type n: int :rtype: str - def countAndSay2(self, n...
5d3574ccd282d0146c83c286ae28d8baaabd4910
<|skeleton|> class Solution: def countAndSay(self, n): """从左往右推 使用队列存储上一个数,然后不断删掉第一个数,直到队列删光了,使用c计数 :type n: int :rtype: str""" <|body_0|> def countAndSay3(self, n): """优化空间 :type n: int :rtype: str""" <|body_1|> def countAndSay2(self, nums): """骚方法:使用re 暂时还学不来 :pa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def countAndSay(self, n): """从左往右推 使用队列存储上一个数,然后不断删掉第一个数,直到队列删光了,使用c计数 :type n: int :rtype: str""" dp = [''] * n dp[0] = '1' for i in range(1, n): queue = list(dp[i - 1]) tmp = '' c = 1 while queue: cur =...
the_stack_v2_python_sparse
38_报数.py
lovehhf/LeetCode
train
0
c3d2feb12adb97291a7424abbfd07976f982b13e
[ "self.front = None\nself.rear = None\nself.size = 0", "node = self.Node(val)\nif self.size == 0:\n self.front = self.rear = node\nelse:\n node.prev = None\n node.next = self.front\n self.front.prev = node\n self.front = node\nself.size += 1", "if self.size == 0:\n return\ncurr = self.rear.prev...
<|body_start_0|> self.front = None self.rear = None self.size = 0 <|end_body_0|> <|body_start_1|> node = self.Node(val) if self.size == 0: self.front = self.rear = node else: node.prev = None node.next = self.front self.fro...
LQueue
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LQueue: def __init__(self): """Initialize queue datastructure.""" <|body_0|> def enqueue(self, val: int) -> None: """add a val in the queue""" <|body_1|> def dequeue(self) -> None: """delete the first element in the queue, if not empty""" ...
stack_v2_sparse_classes_36k_train_022391
1,607
permissive
[ { "docstring": "Initialize queue datastructure.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "add a val in the queue", "name": "enqueue", "signature": "def enqueue(self, val: int) -> None" }, { "docstring": "delete the first element in the queue, if n...
4
stack_v2_sparse_classes_30k_test_000336
Implement the Python class `LQueue` described below. Class description: Implement the LQueue class. Method signatures and docstrings: - def __init__(self): Initialize queue datastructure. - def enqueue(self, val: int) -> None: add a val in the queue - def dequeue(self) -> None: delete the first element in the queue, ...
Implement the Python class `LQueue` described below. Class description: Implement the LQueue class. Method signatures and docstrings: - def __init__(self): Initialize queue datastructure. - def enqueue(self, val: int) -> None: add a val in the queue - def dequeue(self) -> None: delete the first element in the queue, ...
4e5134631a47178ed29add42fbe68d7c55a7d6f1
<|skeleton|> class LQueue: def __init__(self): """Initialize queue datastructure.""" <|body_0|> def enqueue(self, val: int) -> None: """add a val in the queue""" <|body_1|> def dequeue(self) -> None: """delete the first element in the queue, if not empty""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LQueue: def __init__(self): """Initialize queue datastructure.""" self.front = None self.rear = None self.size = 0 def enqueue(self, val: int) -> None: """add a val in the queue""" node = self.Node(val) if self.size == 0: self.front = se...
the_stack_v2_python_sparse
queue/queue.py
AnupamKP/py-coding
train
0
eac06fed4aca059f4f218b692d313ef35cb27b01
[ "self.sdict = defaultdict(lambda: defaultdict(int))\nself.cur_search = []\nfor sentence, time in zip(sentences, times):\n for idx in range(1, len(sentence) + 1):\n self.sdict[sentence[:idx]][sentence] = time", "if c == '#':\n s = ''.join(self.cur_search)\n self.cur_search = []\n for idx in rang...
<|body_start_0|> self.sdict = defaultdict(lambda: defaultdict(int)) self.cur_search = [] for sentence, time in zip(sentences, times): for idx in range(1, len(sentence) + 1): self.sdict[sentence[:idx]][sentence] = time <|end_body_0|> <|body_start_1|> if c == '...
AutocompleteSystem
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AutocompleteSystem: def __init__(self, sentences, times): """:type sentences: List[str] :type times: List[int]""" <|body_0|> def input(self, c): """:type c: str :rtype: List[str]""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.sdict = defaultdi...
stack_v2_sparse_classes_36k_train_022392
1,459
no_license
[ { "docstring": ":type sentences: List[str] :type times: List[int]", "name": "__init__", "signature": "def __init__(self, sentences, times)" }, { "docstring": ":type c: str :rtype: List[str]", "name": "input", "signature": "def input(self, c)" } ]
2
null
Implement the Python class `AutocompleteSystem` described below. Class description: Implement the AutocompleteSystem class. Method signatures and docstrings: - def __init__(self, sentences, times): :type sentences: List[str] :type times: List[int] - def input(self, c): :type c: str :rtype: List[str]
Implement the Python class `AutocompleteSystem` described below. Class description: Implement the AutocompleteSystem class. Method signatures and docstrings: - def __init__(self, sentences, times): :type sentences: List[str] :type times: List[int] - def input(self, c): :type c: str :rtype: List[str] <|skeleton|> cla...
db64a67869aae4f0e55e78b65a7e04f5bc2e671c
<|skeleton|> class AutocompleteSystem: def __init__(self, sentences, times): """:type sentences: List[str] :type times: List[int]""" <|body_0|> def input(self, c): """:type c: str :rtype: List[str]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AutocompleteSystem: def __init__(self, sentences, times): """:type sentences: List[str] :type times: List[int]""" self.sdict = defaultdict(lambda: defaultdict(int)) self.cur_search = [] for sentence, time in zip(sentences, times): for idx in range(1, len(sentence) +...
the_stack_v2_python_sparse
Questiondir/642.design-search-autocomplete-system/642.design-search-autocomplete-system_109795297.py
cczhong11/Leetcode-contest-code-downloader
train
0
55ddffee0e8cc76d352b5e963279581590c82422
[ "MainClass.__init__(self)\nself.log_path = './work'\nself.log_to_screen = True\nself.config_path = './config.json'", "self.logger.info('==WorkClass开始==')\nfor key in self.config.keys():\n print('self.config[{}] = {}'.format(key, self.config[key]))\nfor key in self.argv.keys():\n print('self.argv[{}] = {}'.f...
<|body_start_0|> MainClass.__init__(self) self.log_path = './work' self.log_to_screen = True self.config_path = './config.json' <|end_body_0|> <|body_start_1|> self.logger.info('==WorkClass开始==') for key in self.config.keys(): print('self.config[{}] = {}'.for...
工作类
WorkClass
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkClass: """工作类""" def __init__(self): """初始化""" <|body_0|> def work(self): """实际工作逻辑 覆盖父类""" <|body_1|> <|end_skeleton|> <|body_start_0|> MainClass.__init__(self) self.log_path = './work' self.log_to_screen = True self...
stack_v2_sparse_classes_36k_train_022393
1,334
no_license
[ { "docstring": "初始化", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "实际工作逻辑 覆盖父类", "name": "work", "signature": "def work(self)" } ]
2
stack_v2_sparse_classes_30k_val_001146
Implement the Python class `WorkClass` described below. Class description: 工作类 Method signatures and docstrings: - def __init__(self): 初始化 - def work(self): 实际工作逻辑 覆盖父类
Implement the Python class `WorkClass` described below. Class description: 工作类 Method signatures and docstrings: - def __init__(self): 初始化 - def work(self): 实际工作逻辑 覆盖父类 <|skeleton|> class WorkClass: """工作类""" def __init__(self): """初始化""" <|body_0|> def work(self): """实际工作逻辑 覆盖父...
866b0ca5eadcc7b7390dc1654d71c58234314efb
<|skeleton|> class WorkClass: """工作类""" def __init__(self): """初始化""" <|body_0|> def work(self): """实际工作逻辑 覆盖父类""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WorkClass: """工作类""" def __init__(self): """初始化""" MainClass.__init__(self) self.log_path = './work' self.log_to_screen = True self.config_path = './config.json' def work(self): """实际工作逻辑 覆盖父类""" self.logger.info('==WorkClass开始==') for ...
the_stack_v2_python_sparse
package_mgr/work^k1-v1^k2-v2.py
laijingfeng/PythonScripts
train
1
e72e2a50e80ce636e74777c5af85afc22da363ab
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn MacOSCompliancePolicy()", "from .device_compliance_policy import DeviceCompliancePolicy\nfrom .device_threat_protection_level import DeviceThreatProtectionLevel\nfrom .required_password_type import RequiredPasswordType\nfrom .device_co...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return MacOSCompliancePolicy() <|end_body_0|> <|body_start_1|> from .device_compliance_policy import DeviceCompliancePolicy from .device_threat_protection_level import DeviceThreatProtectionLev...
This class contains compliance settings for Mac OS.
MacOSCompliancePolicy
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MacOSCompliancePolicy: """This class contains compliance settings for Mac OS.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MacOSCompliancePolicy: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The p...
stack_v2_sparse_classes_36k_train_022394
8,051
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: MacOSCompliancePolicy", "name": "create_from_discriminator_value", "signature": "def create_from_discriminat...
3
stack_v2_sparse_classes_30k_train_005142
Implement the Python class `MacOSCompliancePolicy` described below. Class description: This class contains compliance settings for Mac OS. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MacOSCompliancePolicy: Creates a new instance of the appropriate c...
Implement the Python class `MacOSCompliancePolicy` described below. Class description: This class contains compliance settings for Mac OS. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MacOSCompliancePolicy: Creates a new instance of the appropriate c...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class MacOSCompliancePolicy: """This class contains compliance settings for Mac OS.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MacOSCompliancePolicy: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MacOSCompliancePolicy: """This class contains compliance settings for Mac OS.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MacOSCompliancePolicy: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to ...
the_stack_v2_python_sparse
msgraph/generated/models/mac_o_s_compliance_policy.py
microsoftgraph/msgraph-sdk-python
train
135
6c6596da1613c2ae2d0dd27c1024a310728691bd
[ "self.mv_21_mv_71 = mv_21_mv_71\nself.mv_12_mv_22_mv_72 = mv_12_mv_22_mv_72\nself.mv_32 = mv_32\nself.mv_12_we = mv_12_we", "if dictionary is None:\n return None\nmv_21_mv_71 = meraki_sdk.models.mv_21_mv_71_model.MV21MV71Model.from_dictionary(dictionary.get('MV21/MV71')) if dictionary.get('MV21/MV71') else Non...
<|body_start_0|> self.mv_21_mv_71 = mv_21_mv_71 self.mv_12_mv_22_mv_72 = mv_12_mv_22_mv_72 self.mv_32 = mv_32 self.mv_12_we = mv_12_we <|end_body_0|> <|body_start_1|> if dictionary is None: return None mv_21_mv_71 = meraki_sdk.models.mv_21_mv_71_model.MV21MV7...
Implementation of the 'VideoSettings' model. Video quality and resolution settings for all the camera models. Attributes: mv_21_mv_71 (MV21MV71Model): Quality and resolution for MV21/MV71 camera models. mv_12_mv_22_mv_72 (MV12MV22MV72Model): Quality and resolution for MV12/MV22/MV72 camera models. mv_32 (MV32Model): Qu...
VideoSettingsModel
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VideoSettingsModel: """Implementation of the 'VideoSettings' model. Video quality and resolution settings for all the camera models. Attributes: mv_21_mv_71 (MV21MV71Model): Quality and resolution for MV21/MV71 camera models. mv_12_mv_22_mv_72 (MV12MV22MV72Model): Quality and resolution for MV12/...
stack_v2_sparse_classes_36k_train_022395
2,971
permissive
[ { "docstring": "Constructor for the VideoSettingsModel class", "name": "__init__", "signature": "def __init__(self, mv_21_mv_71=None, mv_12_mv_22_mv_72=None, mv_32=None, mv_12_we=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictio...
2
stack_v2_sparse_classes_30k_train_001385
Implement the Python class `VideoSettingsModel` described below. Class description: Implementation of the 'VideoSettings' model. Video quality and resolution settings for all the camera models. Attributes: mv_21_mv_71 (MV21MV71Model): Quality and resolution for MV21/MV71 camera models. mv_12_mv_22_mv_72 (MV12MV22MV72M...
Implement the Python class `VideoSettingsModel` described below. Class description: Implementation of the 'VideoSettings' model. Video quality and resolution settings for all the camera models. Attributes: mv_21_mv_71 (MV21MV71Model): Quality and resolution for MV21/MV71 camera models. mv_12_mv_22_mv_72 (MV12MV22MV72M...
9894089eb013318243ae48869cc5130eb37f80c0
<|skeleton|> class VideoSettingsModel: """Implementation of the 'VideoSettings' model. Video quality and resolution settings for all the camera models. Attributes: mv_21_mv_71 (MV21MV71Model): Quality and resolution for MV21/MV71 camera models. mv_12_mv_22_mv_72 (MV12MV22MV72Model): Quality and resolution for MV12/...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VideoSettingsModel: """Implementation of the 'VideoSettings' model. Video quality and resolution settings for all the camera models. Attributes: mv_21_mv_71 (MV21MV71Model): Quality and resolution for MV21/MV71 camera models. mv_12_mv_22_mv_72 (MV12MV22MV72Model): Quality and resolution for MV12/MV22/MV72 cam...
the_stack_v2_python_sparse
meraki_sdk/models/video_settings_model.py
RaulCatalano/meraki-python-sdk
train
1
0c6f4694716ee7fcf26d6d35190b31833ed59053
[ "self.is_available_for_vss_backup = is_available_for_vss_backup\nself.created_timestamp = created_timestamp\nself.database_name = database_name\nself.db_aag_entity_id = db_aag_entity_id\nself.db_aag_name = db_aag_name\nself.db_compatibility_level = db_compatibility_level\nself.db_file_groups = db_file_groups\nself....
<|body_start_0|> self.is_available_for_vss_backup = is_available_for_vss_backup self.created_timestamp = created_timestamp self.database_name = database_name self.db_aag_entity_id = db_aag_entity_id self.db_aag_name = db_aag_name self.db_compatibility_level = db_compatibi...
Implementation of the 'SqlProtectionSource' model. Specifies an Object representing one SQL Server instance or database. Attributes: is_available_for_vss_backup (bool): Specifies whether the database is marked as available for backup according to the SQL Server VSS writer. This may be false if either the state of the d...
SqlProtectionSource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SqlProtectionSource: """Implementation of the 'SqlProtectionSource' model. Specifies an Object representing one SQL Server instance or database. Attributes: is_available_for_vss_backup (bool): Specifies whether the database is marked as available for backup according to the SQL Server VSS writer....
stack_v2_sparse_classes_36k_train_022396
10,439
permissive
[ { "docstring": "Constructor for the SqlProtectionSource class", "name": "__init__", "signature": "def __init__(self, is_available_for_vss_backup=None, created_timestamp=None, database_name=None, db_aag_entity_id=None, db_aag_name=None, db_compatibility_level=None, db_file_groups=None, db_files=None, db_...
2
null
Implement the Python class `SqlProtectionSource` described below. Class description: Implementation of the 'SqlProtectionSource' model. Specifies an Object representing one SQL Server instance or database. Attributes: is_available_for_vss_backup (bool): Specifies whether the database is marked as available for backup ...
Implement the Python class `SqlProtectionSource` described below. Class description: Implementation of the 'SqlProtectionSource' model. Specifies an Object representing one SQL Server instance or database. Attributes: is_available_for_vss_backup (bool): Specifies whether the database is marked as available for backup ...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class SqlProtectionSource: """Implementation of the 'SqlProtectionSource' model. Specifies an Object representing one SQL Server instance or database. Attributes: is_available_for_vss_backup (bool): Specifies whether the database is marked as available for backup according to the SQL Server VSS writer....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SqlProtectionSource: """Implementation of the 'SqlProtectionSource' model. Specifies an Object representing one SQL Server instance or database. Attributes: is_available_for_vss_backup (bool): Specifies whether the database is marked as available for backup according to the SQL Server VSS writer. This may be ...
the_stack_v2_python_sparse
cohesity_management_sdk/models/sql_protection_source.py
cohesity/management-sdk-python
train
24
8ce7a4a2eda571f61fb19354435555f67422cd01
[ "if len(self.pool.samples) == 0:\n raise LookupError('no samples for executing samtools')\nif self.chromosome not in self.pool.vcf:\n self.pool.vcf[self.chromosome] = VcfFile.VcfFile(self.pool, chrom=self.chromosome, bcf=True)\n inputFileString = ''\n for sample in self.pool.samples:\n inputFileS...
<|body_start_0|> if len(self.pool.samples) == 0: raise LookupError('no samples for executing samtools') if self.chromosome not in self.pool.vcf: self.pool.vcf[self.chromosome] = VcfFile.VcfFile(self.pool, chrom=self.chromosome, bcf=True) inputFileString = '' ...
SamtoolsMpileup
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SamtoolsMpileup: def callSnvs(self): """The method samtoolsMpileup calls the single nucleotide variations of a pool with samtools mpileup. :param pool: the pool to call all SNVs from :type pool: an instance of a :py:class:`Pool.Pool` object :raises: LookupError if the pool has no samples...
stack_v2_sparse_classes_36k_train_022397
3,327
no_license
[ { "docstring": "The method samtoolsMpileup calls the single nucleotide variations of a pool with samtools mpileup. :param pool: the pool to call all SNVs from :type pool: an instance of a :py:class:`Pool.Pool` object :raises: LookupError if the pool has no samples to execute samtools on", "name": "callSnvs"...
2
stack_v2_sparse_classes_30k_train_013039
Implement the Python class `SamtoolsMpileup` described below. Class description: Implement the SamtoolsMpileup class. Method signatures and docstrings: - def callSnvs(self): The method samtoolsMpileup calls the single nucleotide variations of a pool with samtools mpileup. :param pool: the pool to call all SNVs from :...
Implement the Python class `SamtoolsMpileup` described below. Class description: Implement the SamtoolsMpileup class. Method signatures and docstrings: - def callSnvs(self): The method samtoolsMpileup calls the single nucleotide variations of a pool with samtools mpileup. :param pool: the pool to call all SNVs from :...
53315eca821785aa02218e903b60921ecf18246b
<|skeleton|> class SamtoolsMpileup: def callSnvs(self): """The method samtoolsMpileup calls the single nucleotide variations of a pool with samtools mpileup. :param pool: the pool to call all SNVs from :type pool: an instance of a :py:class:`Pool.Pool` object :raises: LookupError if the pool has no samples...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SamtoolsMpileup: def callSnvs(self): """The method samtoolsMpileup calls the single nucleotide variations of a pool with samtools mpileup. :param pool: the pool to call all SNVs from :type pool: an instance of a :py:class:`Pool.Pool` object :raises: LookupError if the pool has no samples to execute sa...
the_stack_v2_python_sparse
pythonCodebase/src/programs/snvCallers/SamtoolsMpileup.py
JJacobi13/VLPB
train
0
cd9a93c932df62e1b600f78b88a8a2f7a9e7dee5
[ "self.destination = None\nself.time_left = 0\nself.is_at_home = True\nself.payload = None\nself.name = name", "self.destination = destination\nself.time_left = 2 * destination.time_to_reach\nself.is_at_home = False\nself.payload = payload", "if self.is_at_home:\n return\nself.time_left -= 1\nif self.time_lef...
<|body_start_0|> self.destination = None self.time_left = 0 self.is_at_home = True self.payload = None self.name = name <|end_body_0|> <|body_start_1|> self.destination = destination self.time_left = 2 * destination.time_to_reach self.is_at_home = False ...
Transport
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Transport: def __init__(self, name): """:param name: name of created transport""" <|body_0|> def move(self, destination: Warehouse, payload): """:param destination: destination for concrete transport to deliver a certain container :param payload: "A" or "B" depending...
stack_v2_sparse_classes_36k_train_022398
4,725
no_license
[ { "docstring": ":param name: name of created transport", "name": "__init__", "signature": "def __init__(self, name)" }, { "docstring": ":param destination: destination for concrete transport to deliver a certain container :param payload: \"A\" or \"B\" depending on the container type :return: No...
3
stack_v2_sparse_classes_30k_train_016433
Implement the Python class `Transport` described below. Class description: Implement the Transport class. Method signatures and docstrings: - def __init__(self, name): :param name: name of created transport - def move(self, destination: Warehouse, payload): :param destination: destination for concrete transport to de...
Implement the Python class `Transport` described below. Class description: Implement the Transport class. Method signatures and docstrings: - def __init__(self, name): :param name: name of created transport - def move(self, destination: Warehouse, payload): :param destination: destination for concrete transport to de...
a7ddcdfcafcb21d18b131ce2bceec48c47c9a8d0
<|skeleton|> class Transport: def __init__(self, name): """:param name: name of created transport""" <|body_0|> def move(self, destination: Warehouse, payload): """:param destination: destination for concrete transport to deliver a certain container :param payload: "A" or "B" depending...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Transport: def __init__(self, name): """:param name: name of created transport""" self.destination = None self.time_left = 0 self.is_at_home = True self.payload = None self.name = name def move(self, destination: Warehouse, payload): """:param desti...
the_stack_v2_python_sparse
12-object-oriented-design/transport_problem.py
TropinNikolay/EpamPython2019
train
0
244437b8afbe5873d9918e7369ad48d5232f3df4
[ "roles = self.get_queryset().all()\nserialized_roles = self.schema.dump(roles, many=True)\nreturn response(serialized_roles, SUCCESS_MESSAGES['FETCHED'].format('roles'))", "request_json = request.get_json()\nrole_details = self.schema.load(request_json)\nrole_details['name'] = role_details['name'].strip().lower()...
<|body_start_0|> roles = self.get_queryset().all() serialized_roles = self.schema.dump(roles, many=True) return response(serialized_roles, SUCCESS_MESSAGES['FETCHED'].format('roles')) <|end_body_0|> <|body_start_1|> request_json = request.get_json() role_details = self.schema.lo...
Roles Resource
RoleListResource
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RoleListResource: """Roles Resource""" def get(self): """Get roles""" <|body_0|> def post(self): """Create a new role""" <|body_1|> <|end_skeleton|> <|body_start_0|> roles = self.get_queryset().all() serialized_roles = self.schema.dump(r...
stack_v2_sparse_classes_36k_train_022399
7,412
permissive
[ { "docstring": "Get roles", "name": "get", "signature": "def get(self)" }, { "docstring": "Create a new role", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_003359
Implement the Python class `RoleListResource` described below. Class description: Roles Resource Method signatures and docstrings: - def get(self): Get roles - def post(self): Create a new role
Implement the Python class `RoleListResource` described below. Class description: Roles Resource Method signatures and docstrings: - def get(self): Get roles - def post(self): Create a new role <|skeleton|> class RoleListResource: """Roles Resource""" def get(self): """Get roles""" <|body_0|...
c5cf6baf60e95a7790156c85e37c76c697efd585
<|skeleton|> class RoleListResource: """Roles Resource""" def get(self): """Get roles""" <|body_0|> def post(self): """Create a new role""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RoleListResource: """Roles Resource""" def get(self): """Get roles""" roles = self.get_queryset().all() serialized_roles = self.schema.dump(roles, many=True) return response(serialized_roles, SUCCESS_MESSAGES['FETCHED'].format('roles')) def post(self): """Crea...
the_stack_v2_python_sparse
src/views/role.py
Nardri/rbac-service
train
0